From: Matthias Clasen Date: Wed, 17 Aug 2005 18:31:08 +0000 (+0000) Subject: Check for crt_externs.h and _NSGetEnviron. X-Git-Tag: GLIB_2_8_1~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1ab92582cbf279202e890ecb0ddfad79033acfa;p=platform%2Fupstream%2Fglib.git Check for crt_externs.h and _NSGetEnviron. 2005-08-17 Matthias Clasen * configure.in: Check for crt_externs.h and _NSGetEnviron. * glib/gutils.c: On Darwin, include crt-externs.h and define environ using _NSGetEnviron(). (#313731) --- diff --git a/ChangeLog b/ChangeLog index 3d6a2c8..2b065ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-08-17 Matthias Clasen + + * configure.in: Check for crt_externs.h and _NSGetEnviron. + + * glib/gutils.c: On Darwin, include crt-externs.h and + define environ using _NSGetEnviron(). (#313731) + 2005-08-16 Stepan Kasal * glib/gutils.c (g_get_any_init): Move the body of the big if... diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3d6a2c8..2b065ae 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2005-08-17 Matthias Clasen + + * configure.in: Check for crt_externs.h and _NSGetEnviron. + + * glib/gutils.c: On Darwin, include crt-externs.h and + define environ using _NSGetEnviron(). (#313731) + 2005-08-16 Stepan Kasal * glib/gutils.c (g_get_any_init): Move the body of the big if... diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 3d6a2c8..2b065ae 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +2005-08-17 Matthias Clasen + + * configure.in: Check for crt_externs.h and _NSGetEnviron. + + * glib/gutils.c: On Darwin, include crt-externs.h and + define environ using _NSGetEnviron(). (#313731) + 2005-08-16 Stepan Kasal * glib/gutils.c (g_get_any_init): Move the body of the big if... diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3d6a2c8..2b065ae 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2005-08-17 Matthias Clasen + + * configure.in: Check for crt_externs.h and _NSGetEnviron. + + * glib/gutils.c: On Darwin, include crt-externs.h and + define environ using _NSGetEnviron(). (#313731) + 2005-08-16 Stepan Kasal * glib/gutils.c (g_get_any_init): Move the body of the big if... diff --git a/configure.in b/configure.in index 0366996..43af69f 100644 --- a/configure.in +++ b/configure.in @@ -837,6 +837,9 @@ AC_MSG_RESULT(unsigned $glib_size_type) # Check for some functions AC_CHECK_FUNCS(lstat strerror strsignal memmove mkstemp vsnprintf stpcpy strcasecmp strncasecmp poll getcwd nanosleep vasprintf setenv unsetenv getc_unlocked readlink symlink) +AC_CHECK_HEADERS(crt_externs.h) +AC_CHECK_FUNC(_NSGetEnviron) + AC_FUNC_VSNPRINTF_C99 AC_FUNC_PRINTF_UNIX98 diff --git a/glib/gutils.c b/glib/gutils.c index eb0d1d0..1acb4f9 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -46,6 +46,9 @@ #ifdef HAVE_SYS_PARAM_H #include #endif +#ifdef HAVE_CRT_EXTERNS_H +#include /* for _NSGetEnviron */ +#endif /* implement gutils's inline functions */ @@ -1229,15 +1232,16 @@ g_setenv (const gchar *variable, #endif /* G_OS_WIN32 */ } -#ifndef G_OS_WIN32 +#ifdef HAVE__NSGETENVIRON +#define environ (*_NSGetEnviron()) +#elif !defined(G_OS_WIN32) /* According to the Single Unix Specification, environ is not in * any system header, although unistd.h often declares it. */ extern char **environ; - #endif - + /** * g_unsetenv: * @variable: the environment variable to remove, must not contain '='.