X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/8ebc62f6abc9ea23a324fe51fadad2467ecddc6d..be2db0893c180332a66245514a5d72985597f181:/m4/cppflags.m4?ds=sidebyside diff --git a/m4/cppflags.m4 b/m4/cppflags.m4 index d2cd351e..b860ea67 100644 --- a/m4/cppflags.m4 +++ b/m4/cppflags.m4 @@ -1,4 +1,3 @@ -dnl dnl This is intended to be extensible, by just adding candidate C preprocessor dnl options to be checked in the for loop. The first candidate is empty, in dnl case none are needed. Also, the test program can be readily augmented. @@ -23,6 +22,9 @@ AC_DEFUN([NMH_ADDL_CPPFLAGS], AC_LANG_WERROR nmh_saved_cppflags="$CPPFLAGS" + dnl autoconf doesn't look at AM_CFLAGS, so merge it into CFLAGS. + nmh_saved_cflags="$CFLAGS" + CFLAGS="$AM_CFLAGS $CFLAGS" dnl On successful compilation, break out of loop with the AM_CPPFLAGS. for nmh_cv_addl_cppflags in "" "-D_GNU_SOURCE"; do dnl Reload initial CPPFLAGS so candidates aren't accumulated. @@ -40,8 +42,10 @@ AC_DEFUN([NMH_ADDL_CPPFLAGS], [AC_LANG_PROGRAM([#include ], [return strdup("x") == 0])], [AM_CPPFLAGS="${nmh_cv_addl_cppflags}"; break;])]) - done]) + done + CFLAGS="$nmh_saved_cflags" CPPFLAGS="$nmh_saved_cppflags" + ]) dnl autoconf doesn't currently provide a macro to disable AC_LANG_WERROR, dnl so do it this way: