summaryrefslogtreecommitdiff
path: root/libobjc/configure.ac
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2004-10-01 03:46:39 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2004-09-30 20:46:39 -0700
commit049bc4044531a146d278dd63ff0ad226c239424c (patch)
tree3e3bcca19e5054e4df68cedcfb17b544f287f58d /libobjc/configure.ac
parentbd042dbb63f5c616041474fcbc268598dfb6d5e5 (diff)
re PR libobjc/16448 (FAIL: objc/execute/IMP.m compilation, -O0)
2004-09-16 Andrew Pinski <pinskia@physics.uc.edu> PR libobjc/16448 * exception.c: Include config.h (objc_exception_throw): Change _GLIBCXX_SJLJ_EXCEPTIONS to SJLJ_EXCEPTIONS. * configure.ac: Find out what exception handling code we use. * configure: Regenerate. * config.h.in: New file, regenerate. From-SVN: r88379
Diffstat (limited to 'libobjc/configure.ac')
-rw-r--r--libobjc/configure.ac56
1 files changed, 56 insertions, 0 deletions
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index b3c12cea40c..6c6b4309b63 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -167,6 +167,8 @@ esac
AC_SUBST(includedirname)
AC_SUBST(libext)
+AC_CONFIG_HEADERS(config.h)
+
# --------
# Programs
# --------
@@ -228,6 +230,60 @@ fi])
GTHREAD_FLAGS=$objc_cv_gthread_flags
AC_SUBST(GTHREAD_FLAGS)
+AC_MSG_CHECKING([for exception model to use])
+AC_LANG_PUSH(C)
+AC_ARG_ENABLE(sjlj-exceptions,
+ AS_HELP_STRING([--enable-sjlj-exceptions],
+ [force use of builtin_setjmp for exceptions]),
+[:],
+[dnl Botheration. Now we've got to detect the exception model.
+dnl Link tests against libgcc.a are problematic since -- at least
+dnl as of this writing -- we've not been given proper -L bits for
+dnl single-tree newlib and libgloss.
+dnl
+dnl This is what AC_TRY_COMPILE would do if it didn't delete the
+dnl conftest files before we got a change to grep them first.
+cat > conftest.$ac_ext << EOF
+[#]line __oline__ "configure"
+@interface Frob
+@end
+@implementation Frob
+@end
+int proc();
+int foo()
+{
+ @try {
+ return proc();
+ }
+ @catch (Frob* ex) {
+ return 0;
+ }
+}
+EOF
+old_CFLAGS="$CFLAGS"
+dnl work around that we don't have Objective-C support in autoconf
+CFLAGS="-x objective-c -fgnu-runtime -fobjc-exceptions -S"
+if AC_TRY_EVAL(ac_compile); then
+ if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
+ enable_sjlj_exceptions=yes
+ elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
+ enable_sjlj_exceptions=no
+ fi
+fi
+CFLAGS="$old_CFLAGS"
+rm -f conftest*])
+if test x$enable_sjlj_exceptions = xyes; then
+ AC_DEFINE(SJLJ_EXCEPTIONS, 1,
+ [Define if the compiler is configured for setjmp/longjmp exceptions.])
+ ac_exception_model_name=sjlj
+elif test x$enable_sjlj_exceptions = xno; then
+ ac_exception_model_name="call frame"
+else
+ AC_MSG_ERROR([unable to detect exception model])
+fi
+AC_LANG_POP(C)
+AC_MSG_RESULT($ac_exception_model_name)
+
# ------
# Output
# ------