gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnustep-cvs] Commit Update


From: Alexander Malmberg
Subject: Re: [Gnustep-cvs] Commit Update
Date: Tue, 22 Jun 2004 14:44:54 +0200

Nicola Pero wrote:
> Agreed - go on and fix the test :-)

The attached patch adds a --enable-native-objc-exceptions argument to
-make's configure which, for now, defaults to off. It also makes the
check stricter and renames HAS_OBJC_EXCEPTIONS to USE_OBJC_EXCEPTIONS.
OK?

- Alexander Malmberg
Index: common.make
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/common.make,v
retrieving revision 1.146
diff -u -r1.146 common.make
--- common.make 19 Jun 2004 11:09:53 -0000      1.146
+++ common.make 22 Jun 2004 12:35:46 -0000
@@ -401,8 +401,9 @@
 CFLAGS =
 OBJ_DIR_PREFIX =
 
-# If the compiler supports native ObjC exceptions, turn them on!
-ifeq ($(HAS_OBJC_EXCEPTIONS), yes)
+# If the compiler supports native ObjC exceptions and the user wants us to
+# use them, turn them on!
+ifeq ($(USE_OBJC_EXCEPTIONS), yes)
   OBJCFLAGS += -fobjc-exceptions
 endif
 
Index: config.make.in
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/config.make.in,v
retrieving revision 1.59
diff -u -r1.59 config.make.in
--- config.make.in      19 Jun 2004 11:09:50 -0000      1.59
+++ config.make.in      22 Jun 2004 12:35:46 -0000
@@ -126,4 +129,4 @@
 # Whether the ObjC compiler supports native ObjC exceptions via
 # @try/@catch/@finally/@throw.
 #
-HAS_OBJC_EXCEPTIONS = @HAS_OBJC_EXCEPTIONS@
\ No newline at end of file
+USE_OBJC_EXCEPTIONS = @USE_OBJC_EXCEPTIONS@
Index: configure.ac
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/configure.ac,v
retrieving revision 1.30
diff -u -r1.30 configure.ac
--- configure.ac        19 Jun 2004 11:09:51 -0000      1.30
+++ configure.ac        22 Jun 2004 12:35:47 -0000
@@ -482,21 +482,54 @@
 #--------------------------------------------------------------------
 # Check if GCC supports -fobjc-exceptions, and if so, turn it on!
 #--------------------------------------------------------------------
-AC_MSG_CHECKING(if the compiler supports native ObjC exceptions)
 
-# What we want to do: set HAS_OBJC_EXCEPTIONS to yes if we can compile
-# something with @try/@catch/@finally in it.
-
-if test ! ${GCC} = "yes" ; then
-  HAS_OBJC_EXCEPTIONS=""
-  AC_MSG_RESULT(no: it's not gcc)
+AC_ARG_ENABLE(native-objc-exceptions,
+       AC_HELP_STRING([--enable-native-objc-exceptions],
+                      [use native objective-c exceptions]),
+       USE_OBJC_EXCEPTIONS=$enableval,
+       USE_OBJC_EXCEPTIONS=no)
+
+AC_MSG_CHECKING(whether we should use native ObjC exceptions)
+if test x"$USE_OBJC_EXCEPTIONS" = x"yes"; then
+  # What we want to do: set USE_OBJC_EXCEPTIONS to yes if we can compile
+  # something with @try/@catch/@finally in it.
+  if test ! ${GCC} = "yes" ; then
+    USE_OBJC_EXCEPTIONS=no
+    AC_MSG_RESULT(no: compiler isn't gcc)
+  else
+    CFLAGS="$CFLAGS -fobjc-exceptions"
+    AC_RUN_IFELSE([[
+#include <stdlib.h>
+#include <objc/Object.h>
+
+int main(int argc, char **argv)
+{
+       Object *o=nil;
+       @try
+       {
+               o=[Object new];
+               @throw o;
+       }
+       @catch (id foo)
+       {
+               if (o!=foo)
+                       return 1;
+       }
+       return 0;
+}
+  ]], USE_OBJC_EXCEPTIONS=yes, USE_OBJC_EXCEPTIONS=no)
+    AC_MSG_RESULT($USE_OBJC_EXCEPTIONS)
+  fi
+  if test x$USE_OBJC_EXCEPTIONS = xno; then
+    AC_MSG_NOTICE([Native objective-c exceptions were requested, but the 
compiler])
+    AC_MSG_NOTICE([doesn't support them.])
+    AC_MSG_ERROR([compiler doesn't support native objective-c exceptions])
+  fi
 else
-  CFLAGS="$CFLAGS -fobjc-exceptions"
-  AC_COMPILE_IFELSE([[int main() address@hidden; } @finally{; }; return 0;}]], 
HAS_OBJC_EXCEPTIONS=yes, HAS_OBJC_EXCEPTIONS=no)
-  AC_MSG_RESULT($HAS_OBJC_EXCEPTIONS)
+  AC_MSG_RESULT(not requested by user)
 fi
 
-AC_SUBST(HAS_OBJC_EXCEPTIONS)
+AC_SUBST(USE_OBJC_EXCEPTIONS)
 
 # Restore LIBS and CFLAGS - we are going to compile C code in the next
 # test.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]