You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.5 KiB

  1. dnl The CLN manual says that without CFLAGS or CXXFLAGS being set compilation
  2. dnl will happen with -O. However, AC_PROG_CC and AC_PROG_CXX set CFLAGS and
  3. dnl CXXFLAGS to "-g -O2", which produces way too large binaries.
  4. dnl Wrapper around AC_PROG_CC setting CFLAGS to plain "-O" as opposed to
  5. dnl "-g -O2" for the GNU compiler (unless CFLAGS was set before).
  6. AC_DEFUN([CL_PROG_CC],
  7. [cl_test_CFLAGS=${CFLAGS+set}
  8. # Make sure this macro does not come after AC_PROG_CC.
  9. # Otherwise CFLAGS would already be set.
  10. AC_BEFORE([$0],[AC_PROG_CC])dnl
  11. AC_PROG_CC([$1])
  12. if test "$cl_test_CFLAGS" != set && test "$ac_compiler_gnu" = yes; then
  13. CFLAGS="-O"
  14. fi
  15. ])
  16. dnl Wrapper around AC_PROG_CXX setting CXXFLAGS to plain "-O" as opposed to
  17. dnl "-g -O2" for the GNU compiler (unless CXXFLAGS was set before). Also
  18. dnl emits a warning if G++ is used and optimization turned off.
  19. AC_DEFUN([CL_PROG_CXX],
  20. [cl_test_CXXFLAGS=${CXXFLAGS+set}
  21. # Make sure this macro does not come after AC_PROG_CXX.
  22. # Otherwise CXXFLAGS would already be set.
  23. AC_BEFORE([$0],[AC_PROG_CXX])dnl
  24. AC_PROG_CXX([$1])
  25. if test "$ac_compiler_gnu" = yes; then
  26. if test "$cl_test_CXXFLAGS" != set; then
  27. # User has not set CXXFLAGS.
  28. CXXFLAGS="-O"
  29. else
  30. # Warn if optimization has been turned off with GCC.
  31. # Optimization is used for module ordering.
  32. case $CXXFLAGS in
  33. [ *\ -O | -O | -O\ * | *\ -O\ * | -O[!0]* | *\ -O[!0]*) ;; ]
  34. *) AC_MSG_WARN([Optimization turned off. I recommend you unset CXXFLAGS.]);;
  35. esac
  36. fi
  37. fi
  38. ])