cmake/configure.ac: Enable -fstack-protector-strong by default
This commit contains the following changes:
- Drops -fstack-protector in favor of -fstack-protector-strong.
Consequently, the ssp-buffer-size parameter has been removed as
-fstack-protector-strong ignores array size.
- Add new global opt-out for stack smash protection. This is enabled
by default for both autotools and CMake builds. Users can opt out
of stack smash protection by passing -DWITH_STACK_PROTECTOR=OFF to
CMake or --disable-stack-smash-protection when running ./configure.
- Renames HAVE_SSP_FLAG to HAVE_STACK_PROTECTOR_FLAG in
CMakeLists.txt to be more readable.
diff --git a/configure.ac b/configure.ac
index 5dd4e3a..5eb6b9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -310,8 +310,10 @@
AC_ARG_ENABLE(werror,
AC_HELP_STRING([--enable-werror], [Enable -Werror in all Makefiles]))
-AC_ARG_ENABLE(stack-smash-protection,
- AC_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection]))
+AC_ARG_ENABLE([stack-smash-protection],
+ [AS_HELP_STRING([--disable-stack-smash-protection],[Disable GNU GCC stack smash protection])],,
+ [AS_IF([test "$ac_cv_c_compiler_gnu" = "yes" && test "$os_is_windows" = "no"],
+ [enable_stack_smash_protection=yes],[enable_stack_smash_protection=no])])
AC_ARG_ENABLE(64-bit-words,
AC_HELP_STRING([--enable-64-bit-words], [Set FLAC__BYTES_PER_WORD to 8 (4 is the default)]))
@@ -627,5 +629,6 @@
echo " SSE optimizations : ....................... ${sse_os}"
echo " Asm optimizations : ....................... ${asm_optimisation}"
echo " Ogg/FLAC support : ........................ ${have_ogg}"
+ echo " Stack protector : ........................ ${enable_stack_smash_protection}"
echo " Fuzzing support (Clang only) : ............ ${have_oss_fuzzers}"
echo