I’d like to use -Wall and -Werror as flags for gcc in an autotools project, but I don’t want to put them in my configure.ac.
As such, I tried using ./configure CFLAGS='-Wall -Werror', only to get an error from one of my AC_SEARCH_LIBS macro calls:
AC_SEARCH_LIBS([pow], [m], , AC_MSG_ERROR([Could not find standard math library.]))
Resulting error when running configure with the CFLAGS added:
configure: error: Could not find standard math library.
What am I doing wrong here? Configuration works fine without the CFLAGS variable set.
As you now know, elevating the compile warnings to errors confuses
./configure.What you can do is pass custom
CFLAGSatmaketime:The other option is William Pursell’s approach: add an option to
./configureto turn on-Werrorif supported:(configure.ac)
(Makefile.am)