configure: Fix -D_FORTIFY_SOURCE=2 check when CFLAGS contains -Wno-error
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>
diff --git a/configure.ac b/configure.ac
index 36a6b6c..25555d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -273,7 +273,7 @@
;;
*)
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; }