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>
+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.
;;
*)
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; }