Blame firejail-0.9.56-build-err.patch

b54ff3a
From df978f44ed33150820edaf1244f97aab2aabece1 Mon Sep 17 00:00:00 2001
b54ff3a
From: Ondrej Dubaj <odubaj@redhat.com>
b54ff3a
Date: Mon, 29 Jul 2019 10:11:33 +0200
b54ff3a
Subject: [PATCH] Resolved f31 build errors
b54ff3a
b54ff3a
---
b54ff3a
 configure    | 90 ++++++++++++++++++++++++++++++++++------------------
b54ff3a
 configure.ac | 33 ++++++-------------
b54ff3a
 2 files changed, 69 insertions(+), 54 deletions(-)
b54ff3a
b54ff3a
diff --git a/configure b/configure
b54ff3a
index a7ef3a3..0b511c5 100755
b54ff3a
--- a/configure
b54ff3a
+++ b/configure
b54ff3a
@@ -2095,6 +2095,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
b54ff3a
 
b54ff3a
 #AC_CONFIG_HEADERS([config.h])
b54ff3a
 
b54ff3a
+
b54ff3a
+
b54ff3a
 ac_ext=c
b54ff3a
 ac_cpp='$CPP $CPPFLAGS'
b54ff3a
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
b54ff3a
@@ -3101,46 +3103,73 @@ fi
b54ff3a
 
b54ff3a
 
b54ff3a
 HAVE_SPECTRE="no"
b54ff3a
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Spectre mitigation support in gcc or clang compiler" >&5
b54ff3a
-$as_echo_n "checking for Spectre mitigation support in gcc or clang compiler... " >&6; }
b54ff3a
-if test "$CC" = "gcc"; then :
b54ff3a
-
b54ff3a
-	HAVE_SPECTRE="yes"
b54ff3a
-	$CC -mindirect-branch=thunk -c dummy.c || HAVE_SPECTRE="no"
b54ff3a
-	rm -f dummy.o
b54ff3a
-	if test "$HAVE_SPECTRE" = "yes"; then :
b54ff3a
-
b54ff3a
-		EXTRA_CFLAGS+=" -mindirect-branch=thunk "
b54ff3a
-
b54ff3a
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -mindirect-branch=thunk" >&5
b54ff3a
+$as_echo_n "checking whether C compiler accepts -mindirect-branch=thunk... " >&6; }
b54ff3a
+if ${ax_cv_check_cflags___mindirect_branch_thunk+:} false; then :
b54ff3a
+  $as_echo_n "(cached) " >&6
b54ff3a
+else
b54ff3a
+  ax_check_save_flags=$CFLAGS
b54ff3a
+  CFLAGS="$CFLAGS  -mindirect-branch=thunk"
b54ff3a
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
b54ff3a
+/* end confdefs.h.  */
b54ff3a
+int
b54ff3a
+main ()
b54ff3a
+{
b54ff3a
+  ;
b54ff3a
+  return 0;
b54ff3a
+}
b54ff3a
+_ACEOF
b54ff3a
+if ac_fn_c_try_compile "$LINENO"; then :
b54ff3a
+  ax_cv_check_cflags___mindirect_branch_thunk=yes
b54ff3a
+else
b54ff3a
+  ax_cv_check_cflags___mindirect_branch_thunk=no
b54ff3a
 fi
b54ff3a
-
b54ff3a
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
b54ff3a
+  CFLAGS=$ax_check_save_flags
b54ff3a
 fi
b54ff3a
-if test "$CC" = "clang"; then :
b54ff3a
-
b54ff3a
-	HAVE_SPECTRE="yes"
b54ff3a
-	$CC -mretpoline -c dummy.c || HAVE_SPECTRE="no"
b54ff3a
-	rm -f dummy.o
b54ff3a
-	if test "$HAVE_SPECTRE" = "yes"; then :
b54ff3a
-
b54ff3a
-		EXTRA_CFLAGS+=" -mretpoline "
b54ff3a
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___mindirect_branch_thunk" >&5
b54ff3a
+$as_echo "$ax_cv_check_cflags___mindirect_branch_thunk" >&6; }
b54ff3a
+if test "x$ax_cv_check_cflags___mindirect_branch_thunk" = xyes; then :
b54ff3a
+  HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -mindirect-branch=thunk"
b54ff3a
 
b54ff3a
+else
b54ff3a
+  :
b54ff3a
 fi
b54ff3a
-
b54ff3a
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -mretpoline" >&5
b54ff3a
+$as_echo_n "checking whether C compiler accepts -mretpoline... " >&6; }
b54ff3a
+if ${ax_cv_check_cflags___mretpoline+:} false; then :
b54ff3a
+  $as_echo_n "(cached) " >&6
b54ff3a
+else
b54ff3a
+  ax_check_save_flags=$CFLAGS
b54ff3a
+  CFLAGS="$CFLAGS  -mretpoline"
b54ff3a
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
b54ff3a
+/* end confdefs.h.  */
b54ff3a
+int
b54ff3a
+main ()
b54ff3a
+{
b54ff3a
+  ;
b54ff3a
+  return 0;
b54ff3a
+}
b54ff3a
+_ACEOF
b54ff3a
+if ac_fn_c_try_compile "$LINENO"; then :
b54ff3a
+  ax_cv_check_cflags___mretpoline=yes
b54ff3a
+else
b54ff3a
+  ax_cv_check_cflags___mretpoline=no
b54ff3a
 fi
b54ff3a
-if test "$HAVE_SPECTRE" = "yes"; then :
b54ff3a
-
b54ff3a
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
b54ff3a
-$as_echo "yes" >&6; }
b54ff3a
-
b54ff3a
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
b54ff3a
+  CFLAGS=$ax_check_save_flags
b54ff3a
 fi
b54ff3a
-if test "$HAVE_SPECTRE" = "no"; then :
b54ff3a
-
b54ff3a
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ... not available" >&5
b54ff3a
-$as_echo "... not available" >&6; }
b54ff3a
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___mretpoline" >&5
b54ff3a
+$as_echo "$ax_cv_check_cflags___mretpoline" >&6; }
b54ff3a
+if test "x$ax_cv_check_cflags___mretpoline" = xyes; then :
b54ff3a
+  HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -mretpoline"
b54ff3a
 
b54ff3a
+else
b54ff3a
+  :
b54ff3a
 fi
b54ff3a
 
b54ff3a
 
b54ff3a
+
b54ff3a
 HAVE_APPARMOR=""
b54ff3a
 # Check whether --enable-apparmor was given.
b54ff3a
 if test "${enable_apparmor+set}" = set; then :
b54ff3a
@@ -3154,7 +3183,6 @@ if test "x$enable_apparmor" = "xyes"; then :
b54ff3a
 
b54ff3a
 fi
b54ff3a
 
b54ff3a
-
b54ff3a
 ac_ext=c
b54ff3a
 ac_cpp='$CPP $CPPFLAGS'
b54ff3a
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
b54ff3a
diff --git a/configure.ac b/configure.ac
b54ff3a
index d1b827f..71addf5 100644
b54ff3a
--- a/configure.ac
b54ff3a
+++ b/configure.ac
b54ff3a
@@ -3,35 +3,22 @@ AC_INIT(firejail, 0.9.57, netblue30@yahoo.com, , https://firejail.wordpress.com)
b54ff3a
 AC_CONFIG_SRCDIR([src/firejail/main.c])
b54ff3a
 #AC_CONFIG_HEADERS([config.h])
b54ff3a
 
b54ff3a
+AC_CONFIG_MACRO_DIR([m4])
b54ff3a
+
b54ff3a
 AC_PROG_CC
b54ff3a
 #AC_PROG_CXX
b54ff3a
 AC_PROG_INSTALL
b54ff3a
 AC_PROG_RANLIB
b54ff3a
 
b54ff3a
 HAVE_SPECTRE="no"
b54ff3a
-AC_MSG_CHECKING(for Spectre mitigation support in gcc or clang compiler)
b54ff3a
-AS_IF([test "$CC" = "gcc"], [
b54ff3a
-	HAVE_SPECTRE="yes"
b54ff3a
-	$CC -mindirect-branch=thunk -c dummy.c || HAVE_SPECTRE="no"
b54ff3a
-	rm -f dummy.o
b54ff3a
-	AS_IF([test "$HAVE_SPECTRE" = "yes"], [
b54ff3a
-		EXTRA_CFLAGS+=" -mindirect-branch=thunk "
b54ff3a
-	])
b54ff3a
-])
b54ff3a
-AS_IF([test "$CC" = "clang"], [
b54ff3a
-	HAVE_SPECTRE="yes"
b54ff3a
-	$CC -mretpoline -c dummy.c || HAVE_SPECTRE="no"
b54ff3a
-	rm -f dummy.o
b54ff3a
-	AS_IF([test "$HAVE_SPECTRE" = "yes"], [
b54ff3a
-		EXTRA_CFLAGS+=" -mretpoline "
b54ff3a
-	])
b54ff3a
-])
b54ff3a
-AS_IF([test "$HAVE_SPECTRE" = "yes"], [
b54ff3a
-	AC_MSG_RESULT(yes)
b54ff3a
-])
b54ff3a
-AS_IF([test "$HAVE_SPECTRE" = "no"], [
b54ff3a
-	AC_MSG_RESULT(... not available)
b54ff3a
-])
b54ff3a
+AX_CHECK_COMPILE_FLAG(
b54ff3a
+    [-mindirect-branch=thunk],
b54ff3a
+    HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -mindirect-branch=thunk"
b54ff3a
+)
b54ff3a
+AX_CHECK_COMPILE_FLAG(
b54ff3a
+    [-mretpoline],
b54ff3a
+    HAVE_SPECTRE="yes" && EXTRA_CFLAGS+=" -mretpoline"
b54ff3a
+)
b54ff3a
 AC_SUBST([EXTRA_CFLAGS])
b54ff3a
 
b54ff3a
 HAVE_APPARMOR=""
b54ff3a
-- 
b54ff3a
2.19.1
b54ff3a