Add configure option to disable stack protector.
authorGregory Maxwell <greg@xiph.org>
Fri, 29 Jun 2012 00:22:26 +0000 (20:22 -0400)
committerGregory Maxwell <greg@xiph.org>
Fri, 29 Jun 2012 00:22:26 +0000 (20:22 -0400)
configure.ac

index e761389..4a2499f 100644 (file)
@@ -209,7 +209,18 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
 CFLAGS="$saved_CFLAGS $SYMBOL_VISIBILITY"
 AC_SUBST(SYMBOL_VISIBILITY)
 
-if test $ac_cv_c_compiler_gnu = yes ; then
+ac_build_stack_protector=yes
+AC_ARG_ENABLE(stack-protector,
+     AS_HELP_STRING([--disable-stack-protector],[Disable compiler stack hardening]),
+     [
+       if test "x$enableval" = "xno"; then
+         ac_build_stack_protector=$enableval
+       fi
+     ], [
+       ac_build_stack_protector=yes
+     ])
+if test "x$ac_build_stack_protector" = "xyes"; then
+if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -fstack-protector-all"
 AC_MSG_CHECKING([if ${CC} supports -fstack-protector-all])
@@ -219,6 +230,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
         AC_MSG_RESULT([no]))
 CFLAGS="$saved_CFLAGS $STACK_PROTECTOR"
 fi
+fi
 
 CFLAGS="$CFLAGS -W"