diff options
author | Bernd Kuhls <bernd.kuhls@t-online.de> | 2018-07-29 00:16:25 +0200 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2018-07-30 08:37:50 +0800 |
commit | eefae9c0a7c80a368091577918080c553bb104e0 (patch) | |
tree | 4d3d0bd72f1ddd874cd19c01abf5d831278c3b37 | |
parent | 2ff28a13840feb8786d577cdb92d07c1a963a0c8 (diff) | |
download | libva-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
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | va/Makefile.am | 5 |
2 files changed, 20 insertions, 1 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]) diff --git a/va/Makefile.am b/va/Makefile.am index 5b6d49a..0e94d0f 100644 --- a/va/Makefile.am +++ b/va/Makefile.am @@ -77,9 +77,12 @@ libva_ldflags = \ libva_cflags = \ -Wall \ - -fstack-protector \ $(NULL) +if USE_SSP +libva_cflags += -fstack-protector +endif + lib_LTLIBRARIES = libva.la libvaincludedir = ${includedir}/va libvainclude_HEADERS = $(libva_source_h) |