summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOzkan Sezer <sezero@users.noreply.github.com>2022-10-18 23:43:38 +0300
committerGitHub <noreply@github.com>2022-10-18 22:43:38 +0200
commit3426713ed9883870b40b85b5d1bd67c8354205ff (patch)
treee4da32e8b3d82197bd69d0c6732dcbe78e56b944
parentad9618c54d88534a714d2c61923c3e700615b20a (diff)
downloadflac-3426713ed9883870b40b85b5d1bd67c8354205ff.tar.gz
fix --disable-stack-smash-protection mingw issues, add --disable-fortify-source
Co-authored-by: Martijn van Beurden <mvanb1@gmail.com>
-rw-r--r--configure.ac29
1 files changed, 23 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 38daff3e..6fa2c752 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,8 +230,6 @@ os_is_windows=no
case "$host" in
*mingw*)
os_is_windows=yes
- AC_SEARCH_LIBS(__memset_chk, ssp, , mingw_has_memset_chk=no)
- AC_SEARCH_LIBS(__stack_chk_fail, ssp, , mingw_has_stack_chk_fail=no)
;;
esac
@@ -334,9 +332,26 @@ AC_ARG_ENABLE(werror,
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 "x$mingw_has_stack_chk_fail" != "xno"],
+ [AS_IF([test "$ac_cv_c_compiler_gnu" = "yes"],
[enable_stack_smash_protection=yes],[enable_stack_smash_protection=no])])
+AC_ARG_ENABLE([fortify-source],
+ [AS_HELP_STRING([--disable-fortify-source],[Disable _FORTIFY_SOURCE buffer overflow protection])],,
+ [AS_IF([test "$ac_cv_c_compiler_gnu" = "yes"],
+ [enable_fortify_source=yes],[enable_fortify_source=no])])
+
+case "$host" in
+ *mingw*)
+ if test "$enable_fortify_source" = "yes"; then
+ AC_SEARCH_LIBS(__memset_chk, ssp, , mingw_has_memset_chk=no)
+ fi
+ if test "$enable_stack_smash_protection" = "yes"; then
+ AC_SEARCH_LIBS(__stack_chk_fail, ssp, , mingw_has_stack_chk_fail=no)
+ fi
+ ;;
+esac
+
+
AC_ARG_ENABLE(64-bit-words,
AS_HELP_STRING([--enable-64-bit-words],[Set FLAC__BYTES_PER_WORD to 8 (4 is the default)]))
if test "x$enable_64_bit_words" = xyes ; then
@@ -483,7 +498,7 @@ if test x$ac_cv_c_compiler_gnu = xyes -o x$xiph_cv_c_compiler_clang = xyes ; the
dnl enabled. We test for this situation in order to prevent polluting
dnl the console with messages of macro redefinitions.
- if test "x$mingw_has_memset_chk" != "xno"
+ if test "$enable_fortify_source" = "yes" && test "x$mingw_has_memset_chk" != "xno"
then
AX_ADD_FORTIFY_SOURCE
fi
@@ -541,10 +556,12 @@ if test x$enable_werror = "xyes" ; then
AC_LANG_POP([C++])
fi
-if test x$enable_stack_smash_protection = "xyes" ; then
+if test x$enable_stack_smash_protection = "xyes" && test "x$mingw_has_stack_chk_fail" != "xno" ; then
XIPH_GCC_STACK_PROTECTOR
XIPH_GXX_STACK_PROTECTOR
- fi
+else
+ enable_stack_smash_protection=no
+fi
AH_VERBATIM([FLAC_API_EXPORTS],
[/* libtool defines DLL_EXPORT for windows dll builds,