diff --git a/configure.ac b/configure.ac index 4f2b3132..3cc7e097 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,10 @@ dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE dnl LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION dnl OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION dnl WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +dnl Do not change user variables! +dnl http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html + AC_PREREQ(2.61) AC_INIT([nghttp2], [0.6.8-DEV], [t-tujikawa@users.sourceforge.net]) LT_PREREQ([2.2.6]) @@ -522,6 +526,9 @@ case "${host}" in ;; esac +ac_save_CFLAGS=$CFLAGS +CFLAGS= + if test "x$werror" != "xno"; then AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"]) AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"]) @@ -554,6 +561,11 @@ if test "x$werror" != "xno"; then AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"]) fi +WARNCFLAGS=$CFLAGS +CFLAGS=$ac_save_CFLAGS + +AC_SUBST([WARNCFLAGS]) + if test "x$debug" != "xno"; then AC_DEFINE([DEBUGBUILD], [1], [Define to 1 to enable debug output.]) fi @@ -609,6 +621,7 @@ AC_MSG_NOTICE([summary of build options: Install prefix: ${prefix} C compiler: ${CC} CFLAGS: ${CFLAGS} + WARNCFLAGS: ${WARNCFLAGS} LDFLAGS: ${LDFLAGS} LIBS: ${LIBS} CPPFLAGS: ${CPPFLAGS} diff --git a/examples/Makefile.am b/examples/Makefile.am index 0dc4dfb7..033191ad 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -23,6 +23,7 @@ if ENABLE_EXAMPLES +AM_CFLAGS = $(WARNCFLAGS) AM_CPPFLAGS = \ -Wall \ -I$(top_srcdir)/lib/includes \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 2f689146..74a6344b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -24,7 +24,7 @@ SUBDIRS = includes EXTRA_DIST = Makefile.msvc -AM_CFLAGS = -Wall +AM_CFLAGS = $(WARNCFLAGS) AM_CPPFLAGS = -I$(srcdir)/includes -I$(builddir)/includes @DEFS@ pkgconfigdir = $(libdir)/pkgconfig diff --git a/src/Makefile.am b/src/Makefile.am index 1bd94b69..8c6a1248 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,6 +26,7 @@ bin_PROGRAMS = check_PROGRAMS = TESTS = +AM_CFLAGS = $(WARNCFLAGS) AM_CPPFLAGS = \ -Wall \ -I$(top_srcdir)/lib/includes \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 96881046..34fff1a3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -60,7 +60,10 @@ failmalloc_LDADD = $(main_LDADD) failmalloc_LDFLAGS = $(main_LDFLAGS) endif # ENABLE_FAILMALLOC -AM_CFLAGS = -Wall -I${top_srcdir}/lib -I${top_srcdir}/lib/includes -I${top_builddir}/lib/includes \ +AM_CFLAGS = $(WARNCFLAGS) \ + -I${top_srcdir}/lib \ + -I${top_srcdir}/lib/includes \ + -I${top_builddir}/lib/includes \ @CUNIT_CFLAGS@ @DEFS@ TESTS = main