compile check of -D_FORTIFY_SOURCE=2 not failing with CFLAGS=-O0

need to include some typical headers to get it to issue a failure
diagnostic

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I37d6e0f342698507952a8006b88d56e55060270e
This commit is contained in:
Caolán McNamara 2024-04-19 08:22:40 +01:00 committed by Michael Meeks
parent 0cd7498e64
commit f02be4aa25

View file

@ -958,7 +958,7 @@ if test "$enable_hardening_flags" = no -o "$host_os" = "emscripten" -o "x$with_s
save_CFLAGS=$CFLAGS save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2" CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"
AC_LINK_IFELSE( AC_LINK_IFELSE(
[AC_LANG_PROGRAM(, [[return 0;]])], [AC_LANG_PROGRAM(, [[#include <string.h> return 0;]])],
[AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"], [AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"],
[AC_MSG_RESULT([no])]) [AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS CFLAGS=$save_CFLAGS