Hi! This weekend, i migrated my project (http://freshmeat.net/projects/hamsterdb/) from scons to autotools. It was quite easy. However, i have one problem, and after searching the web and the autoconf mailing list, i did found some results, but it was not exactly what i needed. The problem is that if my library is compiled with gcc < 4.1.1, then EVERY optimization flag (even -O0) breaks the library. I therefore have to completely get rid of optimization if an older gcc is used. I have written a macro to recognize such gcc compilers; but how do i get rid of -O? It seems that per default, CFLAGS is "-O2 -g"; i don't know why -g is enabled, i'm not making debug builds. I therefore *could* completely clear CFLAGS. But i don't know if that's a good idea - maybe other unix platforms have other flags which would then be missed. Here's the macro for configure.in: if test "$GCC" = yes ; then AC_MSG_CHECKING(whether gcc version is older than 4.1.1) AC_TRY_COMPILE(, [#define GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) #if GCC_VERSION<40101 # error "gcc too old, disabling optimizations" #endif int main(void) { return 0; }], gcc_version_ok=yes, gcc_version_ok=no) if test $gcc_version_ok != yes; then AC_MSG_RESULT(Yes, disabling optimizations) else AC_MSG_RESULT(No, enabling optimizations) fi fi AM_CONDITIONAL(ENABLE_GCC_OPTIMIZATION, test x$gcc_version_ok = xyes) And here's the code from Makefile.am. Currently, it completely deletes CFLAGS if GCC is used, and then enables -O3, if we're not in DEBUG mode and ENABLE_GCC_OPTIMIZATION is set: if USING_GCC CFLAGS = endif if DEBUG AM_CFLAGS += -DDEBUG -DHAM_DEBUG else AM_CFLAGS += -DHAM_RELEASE -ffast-math if ENABLE_GCC_OPTIMIZATION AM_CFLAGS += -O3 -ffast-math endif endif Thanks, Chris _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf