1From 18ace560a15207503805d4df25b90c7a756bcbf6 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Tue, 2 Feb 2021 23:53:39 +0100
4Subject: [PATCH] configure.ac: put back --disable-stack-protector
5
6Put back --disable-stack-protector which has been removed by commit
770c85915eace83142b84e4f65f5db421cf0c09e3. This will allow the user to
8disable it or to let a higher buildsystem such as buildroot to finely
9configure it.
10
11Indeed, without this patch, build can fail as some compilers (such as
12uclibc) could missed the needed library (-lssp or -lssp_nonshared) at
13linking step:
14
15  CCLD     libsox.la
16/home/fabrice/br-test-pkg/br-arm-full/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.5.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -lssp_nonshared
17/home/fabrice/br-test-pkg/br-arm-full/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.5.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -lssp
18
19Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
20[Upstream status: https://sourceforge.net/p/sox/patches/122/]
21---
22 configure.ac | 7 ++++++-
23 1 file changed, 6 insertions(+), 1 deletion(-)
24
25diff --git a/configure.ac b/configure.ac
26index 39306398..a1665467 100644
27--- a/configure.ac
28+++ b/configure.ac
29@@ -32,7 +32,12 @@ AC_PROG_LN_S
30 PKG_PROG_PKG_CONFIG
31 PKG_INSTALLDIR
32
33-AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong])
34+AC_ARG_ENABLE([stack-protector],
35+    AS_HELP_STRING([--disable-stack-protector], [Disable -fstack-protector-strong]),
36+    [enable_stack_protector=$enableval], [enable_stack_protector=yes])
37+AS_IF([test x"$enable_stack_protector" = "xyes"],
38+    [AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong])])
39+
40 AX_APPEND_COMPILE_FLAGS([-Wall -Wmissing-prototypes -Wstrict-prototypes])
41 AX_APPEND_LINK_FLAGS([-Wl,--as-needed])
42
43--
442.29.2
45
46