Adriaan van Os wrote:
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.
I'd rather not. The idea is to check for features in autoconf, *not* to add system-conditionals. AFAICS, checking for <crt_externs.h> and _NSGetEnviron() and using them, if present, in favour of environ should work, shouldn't it? Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: 51FF C1F0 1A77 C6C2 4482 4DDC 117A 9773 7F88 1707