From 8cb8e31773f9d148091cb71141c5ec4cd6b815df Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Sun, 12 Nov 2017 18:22:23 +0100 Subject: Don't touch CFLAGS in configure.ac CFLAGS shouldn't be touched by configure.ac. The variable is supplied by the user and must come after other flags, so flags like warning options can be overridden. Rename CFLAGS to EXTRA_CFLAGS and add the value to AM_CFLAGS. This also makes it possible to override flags for each Automake program or library. --- Makefile.am | 2 +- configure.ac | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile.am b/Makefile.am index 748dfc2a..9c630be4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ DIST_SUBDIRS = include . doc example python xstc AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include -AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS) +AM_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS) check_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \ testThreads testC14N testAutomata testRegexp \ diff --git a/configure.ac b/configure.ac index 8dbc56c0..964dd937 100644 --- a/configure.ac +++ b/configure.ac @@ -771,13 +771,13 @@ dnl if test "${GCC}" != "yes" ; then case "${host}" in hppa*-*-hpux* ) - CFLAGS="${CFLAGS} -Wp,-H30000" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wp,-H30000" ;; *-dec-osf* ) - CFLAGS="${CFLAGS} -ieee" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee" ;; alpha*-*-linux* ) - CFLAGS="${CFLAGS} -ieee" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -ieee" ;; esac else @@ -787,19 +787,19 @@ else # Not activated by default because this inflates the code size # Used to allow propagation of C++ exceptions through the library # - CFLAGS="${CFLAGS} -fexceptions" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -fexceptions" fi # warnings we'd like to see - CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wno-format-extra-args -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -pedantic -W -Wformat -Wno-format-extra-args -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" # warnings we'd like to supress - CFLAGS="${CFLAGS} -Wno-long-long" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wno-long-long" case "${host}" in alpha*-*-linux* ) - CFLAGS="${CFLAGS} -mieee" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee" ;; alpha*-*-osf* ) - CFLAGS="${CFLAGS} -mieee" + EXTRA_CFLAGS="${EXTRA_CFLAGS} -mieee" ;; esac fi @@ -812,13 +812,13 @@ case ${host} in ;; *-*-mingw* | *-*-cygwin* | *-*-msvc* ) # If the host is Windows, and shared libraries are disabled, we - # need to add -DLIBXML_STATIC to CFLAGS in order for linking to + # need to add -DLIBXML_STATIC to EXTRA_CFLAGS in order for linking to # work properly (without it, xmlexports.h would force the use of # DLL imports, which obviously aren't present in a static # library). if test "x$enable_shared" = "xno"; then XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC" - CFLAGS="$CFLAGS -DLIBXML_STATIC" + EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBXML_STATIC" fi ;; esac @@ -1010,7 +1010,7 @@ if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \ fi fi if test "${GCC}" = "yes" ; then - CFLAGS="-g -O -pedantic -W -Wformat -Wno-format-extra-args -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall" + EXTRA_CFLAGS="-g -O -pedantic -W -Wformat -Wno-format-extra-args -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall" fi STATIC_BINARIES="-static" dnl -Wcast-qual -ansi @@ -1680,14 +1680,14 @@ AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscan if test "$with_coverage" = "yes" -a "${GCC}" = "yes" then echo Enabling code coverage for GCC - CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" + EXTRA_CFLAGS="$EXTRA_CFLAGS -fprofile-arcs -ftest-coverage" LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage" else echo Disabling code coverage for GCC fi AC_SUBST(CPPFLAGS) -AC_SUBST(CFLAGS) +AC_SUBST(EXTRA_CFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(XML_CFLAGS) -- cgit v1.2.1