Enable -fstack-protector-strong by default on x86
[opus.git] / configure.ac
index ad9482e..cd5cc89 100644 (file)
@@ -23,7 +23,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 # For libtool.
 dnl Please update these for releases.
 OPUS_LT_CURRENT=6
-OPUS_LT_REVISION=0
+OPUS_LT_REVISION=1
 OPUS_LT_AGE=6
 
 AC_SUBST(OPUS_LT_CURRENT)
@@ -414,7 +414,7 @@ AC_DEFUN([OPUS_PATH_NE10],
          NE10_CFLAGS="-I$NE10_includes"
       elif test "x$NE10_prefix" = "xno" || test "x$NE10_prefix" = "xyes" ; then
          NE10_CFLAGS=""
-      elif test "x$ogg_prefix" != "x" ; then
+      elif test "x$NE10_prefix" != "x" ; then
          NE10_CFLAGS="-I$NE10_prefix/include"
       elif test "x$prefix" != "xNONE"; then
          NE10_CFLAGS="-I$prefix/include"
@@ -804,12 +804,12 @@ AC_ARG_ENABLE([extra-programs],
 AM_CONDITIONAL([EXTRA_PROGRAMS], [test "$enable_extra_programs" = "yes"])
 
 
-AC_ARG_ENABLE([update-draft],
-  AS_HELP_STRING([--enable-update-draft], [Enable bitstream changes from draft-ietf-codec-opus-update]),,
-  [enable_update_draft=no])
+AC_ARG_ENABLE([rfc8251],
+             AS_HELP_STRING([--disable-rfc8251], [Disable bitstream fixes from RFC 8251]),,
+  [enable_rfc8251=yes])
 
-AS_IF([test "$enable_update_draft" = "yes"], [
-  AC_DEFINE([ENABLE_UPDATE_DRAFT], [1], [Enable bitstream changes from draft-ietf-codec-opus-update])
+AS_IF([test "$enable_rfc8251" = "no"], [
+       AC_DEFINE([DISABLE_UPDATE_DRAFT], [1], [Disable bitstream fixes from RFC 8251])
 ])
 
 
@@ -822,6 +822,37 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
       CFLAGS="$saved_CFLAGS"
     ])
 
+on_x86=no
+case "$host_cpu" in
+i[[3456]]86 | x86_64)
+  on_x86=yes
+  ;;
+esac
+
+dnl Enable stack-protector-all only on x86 where it's well supported.
+dnl on some platforms it causes crashes. Hopefully the OS's default's
+dnl include this on platforms that work but have been missed here.
+AC_ARG_ENABLE([stack-protector],
+    [AS_HELP_STRING([--disable-stack-protector],[Disable compiler stack hardening])],,
+    [
+      AS_IF([test "$ac_cv_c_compiler_gnu" = "yes" && test "$on_x86" = "yes"],
+            [enable_stack_protector=yes],[enable_stack_protector=no])
+    ])
+
+AS_IF([test "$enable_stack_protector" = "yes"],
+ [
+  saved_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fstack-protector-strong"
+  AC_MSG_CHECKING([if ${CC} supports -fstack-protector-strong])
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[char foo;]])],
+    [ AC_MSG_RESULT([yes]) ],
+    [
+      AC_MSG_RESULT([no])
+      enable_stack_protector=no
+      CFLAGS="$saved_CFLAGS"
+    ])
+ ])
+
 CFLAGS="$CFLAGS -W"
 
 warn_CFLAGS="-Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes"
@@ -873,7 +904,7 @@ AC_MSG_NOTICE([
       Fixed point debugging: ......... ${enable_fixed_point_debug}
       Inline Assembly Optimizations: . ${inline_optimization}
       External Assembly Optimizations: ${asm_optimization}
-      Intrinsics Optimizations.......: ${intrinsics_support}
+      Intrinsics Optimizations: ...... ${intrinsics_support}
       Run-time CPU detection: ........ ${rtcd_support}
       Custom modes: .................. ${enable_custom_modes}
       Assertion checking: ............ ${enable_assertions}