diff options
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | libguile/posix.c | 13 | ||||
-rw-r--r-- | libguile/stime.c | 13 | ||||
-rw-r--r-- | m4/environ.m4 | 36 | ||||
-rw-r--r-- | m4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | m4/gnulib-comp.m4 | 3 |
6 files changed, 42 insertions, 28 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 8f431c2b1..f321b0b16 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alloca-opt autobuild count-one-bits extensions flock fpieee full-read full-write lib-symbol-visibility putenv stdlib strcase strftime +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alloca-opt autobuild count-one-bits environ extensions flock fpieee full-read full-write lib-symbol-visibility putenv stdlib strcase strftime AUTOMAKE_OPTIONS = 1.5 gnits diff --git a/libguile/posix.c b/libguile/posix.c index 2799209d9..5e6f05fb7 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -101,8 +101,6 @@ extern char *ttyname(); #include <signal.h> -extern char ** environ; - #ifdef HAVE_GRP_H #include <grp.h> #endif @@ -140,10 +138,6 @@ extern char ** environ; #include <sys/file.h> /* from Gnulib */ -#if HAVE_CRT_EXTERNS_H -#include <crt_externs.h> /* for Darwin _NSGetEnviron */ -#endif - /* Some Unix systems don't define these. CPP hair is dangerous, but this seems safe enough... */ #ifndef R_OK @@ -196,13 +190,6 @@ int sethostname (char *name, size_t namelen); -/* On Apple Darwin in a shared library there's no "environ" to access - directly, instead the address of that variable must be obtained with - _NSGetEnviron(). */ -#if HAVE__NSGETENVIRON && defined (PIC) -#define environ (*_NSGetEnviron()) -#endif - /* Two often used patterns diff --git a/libguile/stime.c b/libguile/stime.c index 34c8a98fa..5384783e3 100644 --- a/libguile/stime.c +++ b/libguile/stime.c @@ -77,10 +77,6 @@ # include <sys/timeb.h> #endif -#if HAVE_CRT_EXTERNS_H -#include <crt_externs.h> /* for Darwin _NSGetEnviron */ -#endif - #ifndef tzname /* For SGI. */ extern char *tzname[]; /* RS6000 and others reject char **tzname. */ #endif @@ -98,15 +94,6 @@ extern char *strptime (); # define timet long #endif -extern char ** environ; - -/* On Apple Darwin in a shared library there's no "environ" to access - directly, instead the address of that variable must be obtained with - _NSGetEnviron(). */ -#if HAVE__NSGETENVIRON && defined (PIC) -#define environ (*_NSGetEnviron()) -#endif - #ifdef HAVE_TIMES static diff --git a/m4/environ.m4 b/m4/environ.m4 new file mode 100644 index 000000000..b17bb60a7 --- /dev/null +++ b/m4/environ.m4 @@ -0,0 +1,36 @@ +# environ.m4 serial 2 +dnl Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_ENVIRON], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + dnl Persuade glibc <unistd.h> to declare environ. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + gt_CHECK_VAR_DECL([#include <unistd.h>], environ) + if test $gt_cv_var_environ_declaration != yes; then + HAVE_DECL_ENVIRON=0 + fi +]) + +# Check if a variable is properly declared. +# gt_CHECK_VAR_DECL(includes,variable) +AC_DEFUN([gt_CHECK_VAR_DECL], +[ + define([gt_cv_var], [gt_cv_var_]$2[_declaration]) + AC_MSG_CHECKING([if $2 is properly declared]) + AC_CACHE_VAL([gt_cv_var], [ + AC_TRY_COMPILE([$1 + extern struct { int foo; } $2;], + [$2.foo = 1;], + gt_cv_var=no, + gt_cv_var=yes)]) + AC_MSG_RESULT([$gt_cv_var]) + if test $gt_cv_var = yes; then + AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_DECL], 1, + [Define if you have the declaration of $2.]) + fi + undefine([gt_cv_var]) +]) diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index fd6c4fe91..c7cfb83dd 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -15,7 +15,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alloca-opt autobuild count-one-bits extensions flock fpieee full-read full-write lib-symbol-visibility putenv stdlib strcase strftime +# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl --libtool --macro-prefix=gl --no-vc-files alloca-opt autobuild count-one-bits environ extensions flock fpieee full-read full-write lib-symbol-visibility putenv stdlib strcase strftime # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -23,6 +23,7 @@ gl_MODULES([ alloca-opt autobuild count-one-bits + environ extensions flock fpieee diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 77100fa1b..b6d10a862 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -45,6 +45,8 @@ AC_DEFUN([gl_INIT], gl_source_base='lib' gl_FUNC_ALLOCA gl_COUNT_ONE_BITS + gl_ENVIRON + gl_UNISTD_MODULE_INDICATOR([environ]) gl_FUNC_FLOCK gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock]) gl_INLINE @@ -251,6 +253,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/autobuild.m4 m4/codeset.m4 m4/count-one-bits.m4 + m4/environ.m4 m4/extensions.m4 m4/flock.m4 m4/fpieee.m4 |