[vlc-commits] configure: Check if the support library for stack protectors is available

Martin Storsjö git at videolan.org
Wed Feb 28 10:58:58 CET 2018


vlc | branch: master | Martin Storsjö <martin at martin.st> | Wed Dec 20 15:34:29 2017 +0200| [e43da3c83eee88701ba4f918808c8f4039126c8d] | committer: Martin Storsjö

configure: Check if the support library for stack protectors is available

Clang does support the -fstack-protector-strong flag, but that
in itself doesn't mean that the required support library actually
exists.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e43da3c83eee88701ba4f918808c8f4039126c8d
---

 configure.ac | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/configure.ac b/configure.ac
index e54b19be32..c03533e6d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1121,12 +1121,21 @@ AH_BOTTOM([
     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
   ])
 
+  VLC_SAVE_FLAGS
   AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong])
   AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong], [CXXFLAGS])
   dnl Win32 requires linking to ssp for stack-protection
   AS_IF([test "${SYS}" = "mingw32"], [
       LDFLAGS="${LDFLAGS} -lssp"
       AS_IF([test "${vlc_winstore_app}" != 1], [LDFLAGS="${LDFLAGS} -ladvapi32"])
+      AC_CACHE_CHECK([if linker supports stack protectors], [ac_cv_ld_ssp], [
+        AC_TRY_LINK([#include <stdio.h>],[char buf[100]; fgets(buf, sizeof(buf), stdin);], [
+          ac_cv_ld_ssp="yes"
+        ], [
+          ac_cv_ld_ssp="no"
+        ])
+      ])
+      AS_IF([test "${ac_cv_ld_ssp}" = "no"], [VLC_RESTORE_FLAGS])
   ])
 ])
 



More information about the vlc-commits mailing list