bug-gnustep
[Top][All Lists]
Advanced

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

NSConstantString on Darwin / NeXT Runtime


From: Markus Hitter
Subject: NSConstantString on Darwin / NeXT Runtime
Date: Wed, 27 Feb 2002 23:34:09 +0100

Hi,

for some unknown reason, the configure test in GNUstep base for NeXT_RUNTIME was set up to never use -fconstant-string-class, see config/config. constant-string-class.m .

As you can use gcc 3.1 on Darwin / OS X, which supports this option, I patched configure and the test to do a real test. Gives correct results for gcc 2.95.2 (no) and gcc 3.1 (yes)

Beware: this is a real ugly hack, it uses Apples Foundation.framework. I send it as it might be helpful for other OS X porters, not to be included finally. I just couldn't figure out how to get the test code work without it, tried two days. Perhaps somebody more knowledgable can give me some insight.



--- snip ---
Nobile:~/Desktop/GNUstep/base$ cvs diff -u
cvs server: Diffing .
Index: configure
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/configure,v
retrieving revision 1.139
diff -u -r1.139 configure
--- configure   24 Feb 2002 18:28:40 -0000      1.139
+++ configure   27 Feb 2002 22:14:09 -0000
@@ -1198,7 +1198,10 @@
 echo "configure:1199: checking the Objective-C runtime" >&5
 if test "$OBJC_RUNTIME_LIB" = "nx"; then
   echo "$ac_t""NeXT" 1>&6
-  LIBOBJC='-lobjc'
+  # Markus LIBOBJC='-lobjc'
+  LIBOBJC='-framework Foundation'
+  # Markus: This is a hack to get more meaningful results until I've
+ # figured out how to get NSConstantStrings to work without it.
   CPPFLAGS="$CPPFLAGS -fnext-runtime -DNeXT_RUNTIME"
 else
   echo "$ac_t""GNU" 1>&6
cvs server: Diffing Admin

[...]

cvs server: Diffing config
Index: config/config.constant-string-class.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/config/config.constant-string-
class.m,v
retrieving revision 1.1
diff -u -r1.1 config.constant-string-class.m
--- config/config.constant-string-class.m 6 Jun 2001 15:08:42 -0000 1.1 +++ config/config.constant-string-class.m 27 Feb 2002 22:14:17 -0000
@@ -11,15 +11,6 @@
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
 */
-#ifdef NeXT_RUNTIME
-/* ignore this test with the NeXT runtime - never use
-   -fconstant-string-class */
-int main (int argc, char **argv)
-{
-  abort ();
-  return 1;
-}
-#else /* GNU RUNTIME - the real test */

 /* must be compiled compile using -fconstant-string-
class=NSConstantString
    as an option to gcc.  If it doesn't work, it means your gcc doesn't
@@ -36,14 +27,22 @@
 }
 - (char *) customString;
 @end
-
+
+#ifdef NeXT_RUNTIME
+/* Markus: As a hack in configure we add -framework Foundation on OS X
+           This, we need these tweaks here. */
+extern void *_NSConstantStringClassReference;
+
+@implementation NSConstantString (NSConstantString)
+#else
 @implementation NSConstantString
+#endif
 - (char *) customString
 {
     return c_string;
 }
 @end
-
+

 int main (int argc, char **argv)
 {
@@ -58,4 +57,3 @@

    return 0;
 }
-#endif /* GNU RUNTIME */
--- snip ---


Cheers,
Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/





reply via email to

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