Fix stack protector detection for C++

This commit is contained in:
Martijn van Beurden 2022-04-01 00:42:45 -04:00
parent cde4b8c783
commit 4b7e79f974
1 changed files with 4 additions and 4 deletions

View File

@ -54,14 +54,14 @@ AC_DEFUN([XIPH_GCC_STACK_PROTECTOR],
AC_DEFUN([XIPH_GXX_STACK_PROTECTOR],
[AC_LANG_PUSH([C++])
AC_MSG_CHECKING([if $CXX supports stack smash protection])
xiph_stack_check_old_cflags="$CFLAGS"
xiph_stack_check_old_cxxflags="$CXXFLAGS"
SSP_FLAGS="-fstack-protector-strong"
CFLAGS=$SSP_FLAGS
CXXFLAGS=$SSP_FLAGS
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <cstdio>
]], [[puts("Hello, World!"); return 0;]])],[AC_MSG_RESULT(yes)
CFLAGS="$xiph_stack_check_old_cflags $SSP_FLAGS"],[AC_MSG_RESULT(no)
CFLAGS="$xiph_stack_check_old_cflags"
CXXFLAGS="$xiph_stack_check_old_cxxflags $SSP_FLAGS"],[AC_MSG_RESULT(no)
CXXFLAGS="$xiph_stack_check_old_cxxflags"
])
AC_LANG_POP([C++])
])# XIPH_GXX_STACK_PROTECTOR