aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorLibravatar Reiner Herrmann <reiner@reiner-h.de>2019-06-21 14:29:11 +0200
committerLibravatar Reiner Herrmann <reiner@reiner-h.de>2019-06-21 14:54:58 +0200
commit2c64d1fdd395e439bfbde415656326ed2c32f79a (patch)
tree68b1aafeb216b4414d63aa32d76ea71ed649b502 /configure.ac
parentimport ax_check_compile_flag macro from autoconf-archive (diff)
downloadfirejail-2c64d1fdd395e439bfbde415656326ed2c32f79a.tar.gz
firejail-2c64d1fdd395e439bfbde415656326ed2c32f79a.tar.zst
firejail-2c64d1fdd395e439bfbde415656326ed2c32f79a.zip
use AX_CHECK_COMPILE_FLAG to check for spectre flags
Fixes #2661
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac33
1 files changed, 10 insertions, 23 deletions
diff --git a/configure.ac b/configure.ac
index 40ead1604..f14b3812c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,35 +3,22 @@ AC_INIT(firejail, 0.9.61, netblue30@yahoo.com, , https://firejail.wordpress.com)
3AC_CONFIG_SRCDIR([src/firejail/main.c]) 3AC_CONFIG_SRCDIR([src/firejail/main.c])
4#AC_CONFIG_HEADERS([config.h]) 4#AC_CONFIG_HEADERS([config.h])
5 5
6AC_CONFIG_MACRO_DIR([m4])
7
6AC_PROG_CC 8AC_PROG_CC
7#AC_PROG_CXX 9#AC_PROG_CXX
8AC_PROG_INSTALL 10AC_PROG_INSTALL
9AC_PROG_RANLIB 11AC_PROG_RANLIB
10 12
11HAVE_SPECTRE="no" 13HAVE_SPECTRE="no"
12AC_MSG_CHECKING(for Spectre mitigation support in gcc or clang compiler) 14AX_CHECK_COMPILE_FLAG(
13AS_IF([test "$CC" = "gcc"], [ 15 [-mindirect-branch=thunk],
14 HAVE_SPECTRE="yes" 16 [HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -mindirect-branch=thunk"]
15 $CC -mindirect-branch=thunk -c dummy.c || HAVE_SPECTRE="no" 17)
16 rm -f dummy.o 18AX_CHECK_COMPILE_FLAG(
17 AS_IF([test "$HAVE_SPECTRE" = "yes"], [ 19 [-mretpoline],
18 EXTRA_CFLAGS+=" -mindirect-branch=thunk " 20 [HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -mretpoline"]
19 ]) 21)
20])
21AS_IF([test "$CC" = "clang"], [
22 HAVE_SPECTRE="yes"
23 $CC -mretpoline -c dummy.c || HAVE_SPECTRE="no"
24 rm -f dummy.o
25 AS_IF([test "$HAVE_SPECTRE" = "yes"], [
26 EXTRA_CFLAGS+=" -mretpoline "
27 ])
28])
29AS_IF([test "$HAVE_SPECTRE" = "yes"], [
30 AC_MSG_RESULT(yes)
31])
32AS_IF([test "$HAVE_SPECTRE" = "no"], [
33 AC_MSG_RESULT(... not available)
34])
35AC_SUBST([EXTRA_CFLAGS]) 22AC_SUBST([EXTRA_CFLAGS])
36 23
37HAVE_APPARMOR="" 24HAVE_APPARMOR=""