|
|
f1a631 |
diff --git a/configure.ac b/configure.ac
|
|
|
f1a631 |
index 878284d..9e2ba4d 100644
|
|
|
f1a631 |
--- a/configure.ac
|
|
|
f1a631 |
+++ b/configure.ac
|
|
|
f1a631 |
@@ -214,21 +214,46 @@ AC_SEARCH_LIBS([dlopen], [dl], [], [
|
|
|
f1a631 |
AC_MSG_ERROR([unable to find the dlopen() function])
|
|
|
f1a631 |
])
|
|
|
f1a631 |
|
|
|
f1a631 |
-# Check for -fstack-protector
|
|
|
f1a631 |
-ssp_cc=yes
|
|
|
f1a631 |
+# Check for -fstack-protector and -fstack-protector-strong
|
|
|
f1a631 |
+SSP_CC_FLAG=""
|
|
|
f1a631 |
if test "X$CC-cc" != "X"; then
|
|
|
f1a631 |
- AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector])
|
|
|
f1a631 |
+ # Do not duplicate options in CFLAGS
|
|
|
f1a631 |
+ ssp_sp_set=no
|
|
|
f1a631 |
+ ssp_sps_set=no
|
|
|
f1a631 |
+ for ssp_x in $CFLAGS; do
|
|
|
f1a631 |
+ case "X$ssp_x" in
|
|
|
f1a631 |
+ X-fstack-protector) ssp_sp_set=yes ;;
|
|
|
f1a631 |
+ X-fstack-protector-strong) ssp_sps_set=yes ;;
|
|
|
f1a631 |
+ esac
|
|
|
f1a631 |
+ done
|
|
|
f1a631 |
ssp_old_cflags="$CFLAGS"
|
|
|
f1a631 |
- CFLAGS="$CFLAGS -fstack-protector"
|
|
|
f1a631 |
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [], [ssp_cc=no])
|
|
|
f1a631 |
+ # Prefer -fstack-protector-strong over -fstack-protector
|
|
|
f1a631 |
+ if test "X$ssp_sps_set" = "Xno"; then
|
|
|
f1a631 |
+ SSP_CC_FLAG="-fstack-protector-strong"
|
|
|
f1a631 |
+ fi
|
|
|
f1a631 |
+ AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector-strong])
|
|
|
f1a631 |
+ CFLAGS="$ssp_old_cflags $SSP_CC_FLAG"
|
|
|
f1a631 |
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [ssp_cc=yes], [ssp_cc=no])
|
|
|
f1a631 |
AC_MSG_RESULT([$ssp_cc])
|
|
|
f1a631 |
if test "X$ssp_cc" = "Xno"; then
|
|
|
f1a631 |
- CFLAGS="$ssp_old_cflags"
|
|
|
f1a631 |
- else
|
|
|
f1a631 |
+ # Fallback to -fstack-protector
|
|
|
f1a631 |
+ if test "X$ssp_sp_set" = "Xno"; then
|
|
|
f1a631 |
+ SSP_CC_FLAG="-fstack-protector"
|
|
|
f1a631 |
+ fi
|
|
|
f1a631 |
+ AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector])
|
|
|
f1a631 |
+ CFLAGS="$ssp_old_cflags $SSP_CC_FLAG"
|
|
|
f1a631 |
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [ssp_cc=yes], [ssp_cc=no])
|
|
|
f1a631 |
+ AC_MSG_RESULT([$ssp_cc])
|
|
|
f1a631 |
+ if test "X$ssp_cc" = "Xno"; then
|
|
|
f1a631 |
+ SSP_CC_FLAG=""
|
|
|
f1a631 |
+ fi
|
|
|
f1a631 |
+ fi
|
|
|
f1a631 |
+ CFLAGS="$ssp_old_cflags $SSP_CC_FLAG"
|
|
|
f1a631 |
+ if test "X$ssp_cc" = "Xyes"; then
|
|
|
f1a631 |
AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
|
|
|
f1a631 |
fi
|
|
|
f1a631 |
fi
|
|
|
f1a631 |
-AM_CONDITIONAL(USE_SSP, test "$ssp_cc" = "yes")
|
|
|
f1a631 |
+AC_SUBST(SSP_CC_FLAG)
|
|
|
f1a631 |
|
|
|
f1a631 |
# Check for DRM (mandatory)
|
|
|
f1a631 |
LIBDRM_VERSION=libdrm_version
|
|
|
f1a631 |
diff --git a/va/Makefile.am b/va/Makefile.am
|
|
|
f1a631 |
index 0d8eff1..5ee49c4 100644
|
|
|
f1a631 |
--- a/va/Makefile.am
|
|
|
f1a631 |
+++ b/va/Makefile.am
|
|
|
f1a631 |
@@ -83,9 +83,7 @@ libva_cflags = \
|
|
|
f1a631 |
-Wall \
|
|
|
f1a631 |
$(NULL)
|
|
|
f1a631 |
|
|
|
f1a631 |
-if USE_SSP
|
|
|
f1a631 |
-libva_cflags += -fstack-protector
|
|
|
f1a631 |
-endif
|
|
|
f1a631 |
+libva_cflags += $(SSP_CC_FLAG)
|
|
|
f1a631 |
|
|
|
f1a631 |
lib_LTLIBRARIES = libva.la
|
|
|
f1a631 |
libvaincludedir = ${includedir}/va
|