From bf6ddf132e12d46cf0af3b868efb501b7c23f4ca Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Thu, 27 Nov 2008 16:43:17 +0000 Subject: [PATCH] Disable ffcall if native exceptions are in use. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27156 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ configure | 28 +++++++++++++++++++++++++--- configure.ac | 30 ++++++++++++++++++++++++++---- 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e853258bf..f0a76adcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-11-27 Richard Frith-Macdonald + + * configure.ac: check for native exceptions use. + * configure: regenerate + Disable the use of ffcall with native exceptions as the two are + incompatible (ffcall changes the stack so that throwing an exception + will crash the process). + 2008-11-27 Richard Frith-Macdonald * Source/NSDistributedNotificationCenter.m: diff --git a/configure b/configure index 5cb1cfc9d..8eedd1d25 100755 --- a/configure +++ b/configure @@ -1379,6 +1379,13 @@ if test -z "$GNUSTEP_MAKEFILES"; then GNUSTEP_MAKEFILES=`gnustep-config --variable=GNUSTEP_MAKEFILES 2>&5` fi +exceptions=`gnustep-config --objc-flags | grep _NATIVE_OBJC_EXCEPTIONS 2>&5` +if test -z "$exceptions"; then + exceptions=no +else + exceptions=yes +fi + if test -z "$GNUSTEP_MAKEFILES"; then { { echo "$as_me:$LINENO: error: You must have the gnustep-make package installed and set up the GNUSTEP_MAKEFILES environment variable to contain the path to the makefiles directory before configuring!" >&5 echo "$as_me: error: You must have the gnustep-make package installed and set up the GNUSTEP_MAKEFILES environment variable to contain the path to the makefiles directory before configuring!" >&2;} @@ -16550,7 +16557,6 @@ case "$target_cpu" in sparc64*) case "$target_os" in solaris*) - do_broken_libffi=no; do_broken_libffcall=yes; do_enable_libffi=yes; do_enable_libffcall=no;; @@ -16559,6 +16565,12 @@ case "$target_cpu" in *) ;; esac +if test "$exceptions" = "yes"; then + # ffcall will mess up native exceptions, so we must disable it. + do_broken_libffcall=yes + do_enable_libffcall=no +fi + # Check whether --enable-libffi or --disable-libffi was given. if test "${enable_libffi+set}" = set; then enableval="$enable_libffi" @@ -16622,7 +16634,8 @@ esac fi -if test "${ac_cv_header_ffi_h+set}" = set; then +if test "$do_broken_ffi" = "no"; then + if test "${ac_cv_header_ffi_h+set}" = set; then echo "$as_me:$LINENO: checking for ffi.h" >&5 echo $ECHO_N "checking for ffi.h... $ECHO_C" >&6 if test "${ac_cv_header_ffi_h+set}" = set; then @@ -16766,6 +16779,10 @@ else fi +else + have_libffi=no +fi +if test "$do_broken_ffcall" = "no"; then for ac_header in callback.h do @@ -16918,6 +16935,9 @@ fi done +else + have_ffcall=no +fi if test $have_ffcall = no; then enable_ffcall=no # If we don't have ffcall but do have libffi, use libffi @@ -17202,7 +17222,9 @@ echo "${ECHO_T}none" >&6 echo "we recommend installing libffi instead." else echo "You do not have either ffcall or libffi installed, or configure needs" - echo "--with-ffi-include and/or --with-ffi-library flags so GNUstep can find them" + echo "--with-ffi-include and/or --with-ffi-library flags so GNUstep can find them," + echo "or you have ffcall but gnustep-make is configured to use native exceptions" + echo "(native exceptions are not compatible with ffcall)." fi echo "GNUstep requires ffcall or libffi and proper libobjc hooks to do" echo "invocations and DO." diff --git a/configure.ac b/configure.ac index 8d39cabfb..4c03cc454 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,13 @@ if test -z "$GNUSTEP_MAKEFILES"; then GNUSTEP_MAKEFILES=`gnustep-config --variable=GNUSTEP_MAKEFILES 2>&5` fi +exceptions=`gnustep-config --objc-flags | grep _NATIVE_OBJC_EXCEPTIONS 2>&5` +if test -z "$exceptions"; then + exceptions=no +else + exceptions=yes +fi + if test -z "$GNUSTEP_MAKEFILES"; then AC_MSG_ERROR([You must have the gnustep-make package installed and set up the GNUSTEP_MAKEFILES environment variable to contain the path to the makefiles directory before configuring!]) fi @@ -1910,7 +1917,6 @@ case "$target_cpu" in sparc64*) case "$target_os" in solaris*) - do_broken_libffi=no; do_broken_libffcall=yes; do_enable_libffi=yes; do_enable_libffcall=no;; @@ -1919,6 +1925,12 @@ case "$target_cpu" in *) ;; esac +if test "$exceptions" = "yes"; then + # ffcall will mess up native exceptions, so we must disable it. + do_broken_libffcall=yes + do_enable_libffcall=no +fi + AC_ARG_ENABLE(libffi, [ --enable-libffi Enable use of libffi library],, enable_libffi=$do_enable_libffi) @@ -1951,8 +1963,16 @@ if test ${ffi_libdir} != "no"; then GS_ADD_LIBRARY_PATH([${ffi_libdir}]) fi -AC_CHECK_HEADER(ffi.h, have_libffi=yes, have_libffi=no) -AC_CHECK_HEADERS(callback.h, have_ffcall=yes, have_ffcall=no) +if test "$do_broken_ffi" = "no"; then + AC_CHECK_HEADER(ffi.h, have_libffi=yes, have_libffi=no) +else + have_libffi=no +fi +if test "$do_broken_ffcall" = "no"; then + AC_CHECK_HEADERS(callback.h, have_ffcall=yes, have_ffcall=no) +else + have_ffcall=no +fi if test $have_ffcall = no; then enable_ffcall=no # If we don't have ffcall but do have libffi, use libffi @@ -2041,7 +2061,9 @@ if test $ffi_ok = no; then echo "we recommend installing libffi instead." else echo "You do not have either ffcall or libffi installed, or configure needs" - echo "--with-ffi-include and/or --with-ffi-library flags so GNUstep can find them" + echo "--with-ffi-include and/or --with-ffi-library flags so GNUstep can find them," + echo "or you have ffcall but gnustep-make is configured to use native exceptions" + echo "(native exceptions are not compatible with ffcall)." fi echo "GNUstep requires ffcall or libffi and proper libobjc hooks to do" echo "invocations and DO."