As discussed before, shared libraries on Mac OS X can not reference the
environ variable directly, where applications can. This is a show
stopper on Mac OS X, because of the internals of autoconf and because
the environ variable is referenced in gpc's runtime library. To solve
this problem, I apply the following patch:
--- gcc/p/rts/rts.c.orig Wed Apr 16 01:58:46 2003
+++ gcc/p/rts/rts.c Fri Jun 6 11:35:50 2003
@@ -195,7 +195,15 @@
extern int errno;
#endif
-#if defined (HAVE_ENVIRON) || defined (environ)
+/* needed by Mac OS X */
+#if defined (__MACH__) && defined(__APPLE__)
+#include <crt_externs.h>
+#endif
+
+/* on Mac OS X the environ variable can not be referenced in shared
libraries */
+#if defined (__MACH__) && defined(__APPLE__)
+#define environ (*_NSGetEnviron())
+#elif defined (HAVE_ENVIRON) || defined (environ)
#if !defined (environ) && !defined (ENVIRON_DECLARED)
extern char **environ;
#endif
I would be grateful if this patch is merged with gpc's sources.
Regards,
Adriaan van Os