Rewritten code that checks for threading libraries on Apple OS X; implicitly fixing --enable-native-objc-exceptions on Apple.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@26973 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2008-10-27 14:03:08 +00:00
parent 26f570535d
commit be804b53cf
4 changed files with 84 additions and 3 deletions

View file

@ -1,3 +1,13 @@
2008-10-27 Nicola Pero <nicola.pero@meta-innovation.com>
* configure.ac: Added special case when checking for thread
support on Apple OS X - it should now detect that Apple OS X
supports threads but needs no threading library specified. This
implicitly fixes the following check for native ObjC exceptions.
* configure: Regenerated.
* config_thread.m: Rewritten Apple runtime case to use pthread
directly.
2008-10-21 Nicola Pero <nicola.pero@meta-innovation.com>
* Documentation/releasenotes.texi: Updated for latest changes.

View file

@ -1,13 +1,16 @@
/* Test whether Objective-C runtime was compiled with thread support */
#ifndef NeXT_RUNTIME
#ifdef gnu-runtime
/* Dummy NXConstantString impl for so libobjc that doesn't include it */
#include <objc/NXConstStr.h>
@implementation NXConstantString
@end
#endif
#ifdef gnu-runtime
#include <objc/thr.h>
#endif
#include <objc/Object.h>
int
@ -15,5 +18,20 @@ main()
{
id o = [Object new];
#ifdef gnu-runtime
return (objc_thread_detach (@selector(hash), o, nil) == NULL) ? -1 : 0;
#else
/* On Apple, there is no ObjC-specific thread library. We need to
* use pthread directly.
*/
pthread_t thread_id;
int error = pthread_create (&thread_id, NULL, @selector(hash), o);
if (error != 0)
{
return -1;
}
return 0;
#endif
}

49
configure vendored
View file

@ -5235,7 +5235,7 @@ if test "$OBJC_RUNTIME_LIB" = "nx"; then
CFLAGS="$CFLAGS -DNeXT_RUNTIME"
fi
if test "$OBJC_RUNTIME_LIB" = "apple"; then
CFLAGS="$CFLAGS -DNeXT_RUNTIME"
CFLAGS="$CFLAGS -DAPPLE_RUNTIME"
fi
if test "$OBJC_THREAD" != ""; then
LIBS="-lobjc $LIBS $OBJC_THREAD"
@ -5517,6 +5517,53 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
fi
elif test "$OBJC_RUNTIME_LIB" = "apple"; then
# Apple doesn't need anything extra for threads
LIBS="-lobjc $LIBS"
if test "$cross_compiling" = yes; then
objc_threaded="works"
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include "config_thread.m"
_ACEOF
rm -f conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
objc_threaded="works"
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
objc_threaded=""
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
else
LIBS="-lobjc $LIBS"
if test "$cross_compiling" = yes; then

View file

@ -1090,7 +1090,7 @@ if test "$OBJC_RUNTIME_LIB" = "nx"; then
CFLAGS="$CFLAGS -DNeXT_RUNTIME"
fi
if test "$OBJC_RUNTIME_LIB" = "apple"; then
CFLAGS="$CFLAGS -DNeXT_RUNTIME"
CFLAGS="$CFLAGS -DAPPLE_RUNTIME"
fi
if test "$OBJC_THREAD" != ""; then
LIBS="-lobjc $LIBS $OBJC_THREAD"
@ -1121,6 +1121,12 @@ elif test "$MINGW32" = yes; then
AC_TRY_RUN([#include "config_thread.m"],
objc_threaded="works",
objc_threaded="", objc_threaded="works")
elif test "$OBJC_RUNTIME_LIB" = "apple"; then
# Apple doesn't need anything extra for threads
LIBS="-lobjc $LIBS"
AC_TRY_RUN([#include "config_thread.m"],
objc_threaded="works",
objc_threaded="", objc_threaded="works")
else
LIBS="-lobjc $LIBS"
AC_TRY_RUN([#include "config_thread.m"],