]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
configure: Fix -D_FORTIFY_SOURCE=2 check when CFLAGS contains -Wno-error
authorOmar Sandoval <osandov@fb.com>
Thu, 12 Dec 2019 00:23:27 +0000 (16:23 -0800)
committerMark Wielaard <mark@klomp.org>
Thu, 12 Dec 2019 11:08:51 +0000 (12:08 +0100)
If CFLAGS contains -Wno-error, then the check for -D_FORTIFY_SOURCE=2
won't fail when appropriate. E.g., compiling with:

  ./configure CFLAGS='-Wno-error -O0' &&

Results in a flood of "_FORTIFY_SOURCE requires compiling with
optimization (-O)" warnings.

Make sure we add -Werror after the user-defined CFLAGS.

Signed-off-by: Omar Sandoval <osandov@fb.com>
ChangeLog
configure.ac

index ed5f5866f727173f937dfb7f9465b58a51a5ce87..ff012e3c5601392bd5f12523993c2c7df3074b3f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-11  Omar Sandoval  <osandov@fb.com>
+
+       * configure.ac: Apply -Werror after user-defined CFLAGS in
+       -D_FORTIFY_SOURCE=2 check.
+
 2019-12-06  Mark Wielaard  <mark@klomp.org>
 
        * configure.ac: Add ac_cv_buildid check.
index 36a6b6c2d42715b81ca0b41d654444f01b79647f..25555d0bc5ee59fad40d3cb306b5cc86a1a26b5a 100644 (file)
@@ -273,7 +273,7 @@ case "$CFLAGS" in
     ;;
   *)
     save_CFLAGS="$CFLAGS"
-    CFLAGS="-D_FORTIFY_SOURCE=2 -Werror $CFLAGS"
+    CFLAGS="-D_FORTIFY_SOURCE=2 $CFLAGS -Werror"
     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
       #include <string.h>
       int main() { return 0; }