aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac14
-rw-r--r--libsandbox/Makefile.am4
2 files changed, 15 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 3a6eb7a..4dcb54b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,6 +248,20 @@ dnl the variables ($sysconfdir defaults to "$prefix/etc")
SANDBOX_DEFINES='-DETCDIR="\"$(sysconfdir)\"" -DLIBSANDBOX_PATH="\"$(libdir)\"" -DSANDBOX_BASHRC_PATH="\"$(pkgdatadir)\""'
AC_SUBST([SANDBOX_DEFINES])
+dnl Check for toolchain features
+dnl We need -fexceptions here, else we do not catch exceptions
+dnl (nptl/tst-cancelx4.c in glibc among others fails for wrapped functions)
+AC_MSG_CHECKING([how to enable exception handling])
+for CFLAG_EXCEPTIONS in -fexceptions "" ; do
+ ac_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS -fexceptions"
+ AC_TRY_COMPILE([],[],[ok=yes],[ok=no])
+ CFLAGS=$ac_save_CFLAGS
+ test "$ok" = "yes" && break
+done
+AC_MSG_RESULT($CFLAG_EXCEPTIONS)
+AC_SUBST([CFLAG_EXCEPTIONS])
+
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall"
diff --git a/libsandbox/Makefile.am b/libsandbox/Makefile.am
index 3f70086..71af2c9 100644
--- a/libsandbox/Makefile.am
+++ b/libsandbox/Makefile.am
@@ -11,9 +11,7 @@ INCLUDES = \
-I$(top_srcdir)/libsbutil \
-I$(top_srcdir)/libsbutil/include
-# We need -fexceptions here, else we do not catch exceptions
-# (nptl/tst-cancelx4.c in glibc among others fails for wrapped functions).
-libsandbox_la_CFLAGS = -fexceptions
+libsandbox_la_CFLAGS = $(CFLAG_EXCEPTIONS)
# Could use the following to libsandbox_la_LIBADD, but then libtool links it
# with --whole-archive, and libsandbox.so increase with a few KB in size:
# $(top_builddir)/libsbutil/libsbutil.la