shithub: opus-tools

Download patch

ref: 1229864e13f1e0818219bd54b097c9b08d4e1cc6
parent: c8dd78db1215205b32d7c1c470965f26f774b452
author: Gregory Maxwell <greg@xiph.org>
date: Tue Jul 10 10:57:05 EDT 2012

Autoconf arguments to manually disable stackprotector/pie.

--- a/Makefile.unix
+++ b/Makefile.unix
@@ -2,7 +2,7 @@
 #Run ./configure to run autotools/autoconf.
 #This makefile exists as a fallback where autotools isn't working.
 #CC=gcc
-CFLAGS:=-DPACKAGE='"opus-tools"' -DVERSION='"0.1.3"' -DOPUSTOOLS -O2 -g -c -Wall -Wextra -DHAVE_GETOPT_H -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT $(CFLAGS)
+CFLAGS:=-DPACKAGE='"opus-tools"' -DVERSION='"0.1.3git"' -DOPUSTOOLS -O2 -g -c -Wall -Wextra -DHAVE_GETOPT_H -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT $(CFLAGS)
 INCLUDES=-I../opus/include
 
 all: opusenc opusdec opusinfo
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,7 @@
 OPUSTOOLS_MAJOR_VERSION=0
 OPUSTOOLS_MINOR_VERSION=1
 OPUSTOOLS_MICRO_VERSION=3
-OPUSTOOLS_EXTRA_VERSION=
+OPUSTOOLS_EXTRA_VERSION=git
 
 OPUSTOOLS_VERSION="$OPUSTOOLS_MAJOR_VERSION.$OPUSTOOLS_MINOR_VERSION.$OPUSTOOLS_MICRO_VERSION$OPUSTOOLS_EXTRA_VERSION"
 AC_MSG_CHECKING([git revision])
@@ -184,19 +184,40 @@
   ;;
 esac
 
-use_stack_protector=no
-
+ac_build_stack_protector=no
 if test $ac_cv_c_compiler_gnu = yes && test $on_x86 = yes; then
+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
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -fstack-protector-all"
 AC_MSG_CHECKING([if ${CC} supports -fstack-protector-all])
 AC_LINK_IFELSE([AC_LANG_SOURCE([void main(void){char foo;}])],
       [ AC_MSG_RESULT([yes])
-        STACK_PROTECTOR="-fstack-protector-all"; use_stack_protector=yes ],
+        STACK_PROTECTOR="-fstack-protector-all"; ac_build_stack_protector=yes ],
         AC_MSG_RESULT([no]))
 CFLAGS="$saved_CFLAGS $STACK_PROTECTOR"
 fi
+fi
 
+ac_build_pie=no
+AC_ARG_ENABLE(pie,
+     AS_HELP_STRING([--disable-pie],[Disable PIE/RELRO hardening]),
+     [
+       if test "x$enableval" = "xno"; then
+         ac_build_pie=$enableval
+       fi
+     ], [
+       ac_build_pie=yes
+     ])
+if test "x$ac_build_pie" = "xyes"; then
 save_CFLAGS="$CFLAGS"
 save_LDFLAGS="$LDFLAGS"
 save_LIBS="$LIBS"
@@ -209,10 +230,10 @@
 void main () {
   OpusDecoder *dec = opus_decoder_create(48000, 2, 0L);
 }])],
-               [have_pie=yes],
-               [have_pie=no])
-AC_MSG_RESULT([$have_pie])
-if test "x$have_pie" = "xyes"; then
+               [ac_build_pie=yes],
+               [ac_build_pie=no])
+AC_MSG_RESULT([$ac_build_pie])
+if test "x$ac_build_pie" = "xyes"; then
     PIE_CFLAGS="-fPIE"
     PIE_LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now"
 fi
@@ -219,6 +240,7 @@
 CFLAGS="$save_CFLAGS $PIE_CFLAGS"
 LDFLAGS="$save_LDFLAGS $PIE_LDFLAGS"
 LIBS="$save_LIBS"
+fi
 
 CFLAGS="$CFLAGS -W"
 
@@ -279,8 +301,8 @@
 
       C99 var arrays: ................ ${has_var_arrays}
       C99 lrintf: .................... ${ac_cv_func_lrintf}
-      Stack protector: ............... ${use_stack_protector}
-      PIE: ........................... ${have_pie}
+      Stack protector: ............... ${ac_build_stack_protector}
+      PIE: ........................... ${ac_build_pie}
 
     General configuration: