diff --git a/ChangeLog b/ChangeLog index bad5914..51a4f89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-04-24 Richard B. Kreckel + + Make GCC compiler flags default to -O + * m4/cc.m4: New file... + * configure.ac: ...used here. + * autoconf/aclocal.m4: Regenerate. + 2005-04-18 Ralf Wildenhues * include/cln/string.h: Declare cl_string. diff --git a/autoconf/aclocal.m4 b/autoconf/aclocal.m4 index 388b458..8f92295 100644 --- a/autoconf/aclocal.m4 +++ b/autoconf/aclocal.m4 @@ -868,5 +868,6 @@ fi fi ]) +m4_include([m4/cc.m4]) m4_include([m4/gmp.m4]) m4_include([m4/libtool.m4]) diff --git a/configure.ac b/configure.ac index c7c966f..bd77b6d 100644 --- a/configure.ac +++ b/configure.ac @@ -41,11 +41,11 @@ d dnl dnl checks for programs dnl -AC_PROG_CC +CL_PROG_CC dnl sets variable CC AC_PROG_CPP dnl sets variable CPP -AC_PROG_CXX +CL_PROG_CXX dnl sets variable CXX AC_PROG_CXXCPP dnl sets variable CXXCPP diff --git a/m4/cc.m4 b/m4/cc.m4 new file mode 100644 index 0000000..a18c47d --- /dev/null +++ b/m4/cc.m4 @@ -0,0 +1,33 @@ +dnl The CLN manual says that without CFLAGS or CXXFLAGS being set compilation +dnl will happen with -O. However, AC_PROG_CC and AC_PROG_CXX set CFLAGS and +dnl CXXFLAGS to "-g -O2", which produces way too large binaries. + + +dnl Wrapper around AC_PROG_CC setting CFLAGS to plain "-O" as opposed to +dnl "-g -O2" for the GNU compiler (unless CFLAGS was set before). +AC_DEFUN([CL_PROG_CC], +[cl_test_CFLAGS=${CFLAGS+set} +cl_save_CFLAGS=$CFLAGS +# Make sure this macro does not come after AC_PROG_CC. +# Otherwise CFLAGS would already be set. +AC_BEFORE([$0],[AC_PROG_CC])dnl +AC_PROG_CC([$1]) +if test "$cl_test_CFLAGS" != set && test "$ac_compiler_gnu" = yes; then + CFLAGS="-O" +fi +]) + + +dnl Wrapper around AC_PROG_CXX setting CXXFLAGS to plain "-O" as opposed to +dnl "-g -O2" for the GNU compiler (unless CXXFLAGS was set before). +AC_DEFUN([CL_PROG_CXX], +[cl_test_CXXFLAGS=${CXXFLAGS+set} +cl_save_CXXFLAGS=$CXXFLAGS +# Make sure this macro does not come after AC_PROG_CXX. +# Otherwise CXXFLAGS would already be set. +AC_BEFORE([$0],[AC_PROG_CXX])dnl +AC_PROG_CXX([$1]) +if test "$cl_test_CXXFLAGS" != set && test "$ac_compiler_gnu" = yes; then + CXXFLAGS="-O" +fi +])