summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorBernd Kuhls <bernd.kuhls@t-online.de>2018-07-29 00:16:25 +0200
committerXiang, Haihao <haihao.xiang@intel.com>2018-07-30 08:37:50 +0800
commiteefae9c0a7c80a368091577918080c553bb104e0 (patch)
tree4d3d0bd72f1ddd874cd19c01abf5d831278c3b37 /configure.ac
parent2ff28a13840feb8786d577cdb92d07c1a963a0c8 (diff)
downloadlibva-eefae9c0a7c80a368091577918080c553bb104e0.tar.gz
Check for -fstack-protector
Not all toolchains provide support for -fstack-protector. This patch provides a configure check to avoid build errors like /home/buildroot/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-uclibc/6.4.0/../../../../x86_64-buildroot-linux-uclibc/bin/ld: cannot find -lssp_nonshared /home/buildroot/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-uclibc/6.4.0/../../../../x86_64-buildroot-linux-uclibc/bin/ld: cannot find -lssp
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 16 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index b0b8836..da1908c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -209,6 +209,22 @@ if test "$ac_cv_have_gnuc_visibility_attribute" = "yes"; then
[Defined to 1 if GCC visibility attribute is supported])
fi
+# Check for -fstack-protector
+ssp_cc=yes
+if test "X$CC-cc" != "X"; then
+ AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector])
+ ssp_old_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS -fstack-protector"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [], [ssp_cc=no])
+ AC_MSG_RESULT([$ssp_cc])
+ if test "X$ssp_cc" = "Xno"; then
+ CFLAGS="$ssp_old_cflags"
+ else
+ AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
+ fi
+fi
+AM_CONDITIONAL(USE_SSP, test "$ssp_cc" = "yes")
+
# Check for DRM (mandatory)
LIBDRM_VERSION=libdrm_version
PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])