putenv: Support for MSVC.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Sep 2011 15:34:03 +0000 (17:34 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Sep 2011 15:34:03 +0000 (17:34 +0200)
* modules/putenv (Depends-on): Add environ.
* lib/putenv.c (environ): Disable declaration.
* lib/unistd.in.h: Update comment.

ChangeLog
lib/putenv.c
lib/unistd.in.h
modules/putenv

index 6b18485..ef33264 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-09-17  Bruno Haible  <bruno@clisp.org>
 
+       putenv: Support for MSVC.
+       * modules/putenv (Depends-on): Add environ.
+       * lib/putenv.c (environ): Disable declaration.
+       * lib/unistd.in.h: Update comment.
+
+2011-09-17  Bruno Haible  <bruno@clisp.org>
+
        math: Avoid macro redefinition warnings on MSVC.
        * lib/math.in.h (ceilf, ceill, floorf, floorl, frexpl, ldexpl):
        Undefine before redefining.
index 68e5fec..3c33279 100644 (file)
 #include <string.h>
 #include <unistd.h>
 
-#if HAVE_GNU_LD
+#if _LIBC
+# if HAVE_GNU_LD
 # define environ __environ
-#else
+# else
 extern char **environ;
+# endif
 #endif
 
 #if _LIBC
index 90de697..e3fb8c6 100644 (file)
@@ -75,7 +75,8 @@
 #endif
 
 /* mingw fails to declare _exit in <unistd.h>.  */
-/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
+/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
+   <unistd.h>.  */
 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
 /* But avoid namespace pollution on glibc systems.  */
 #ifndef __GLIBC__
index 7476af1..3321a5e 100644 (file)
@@ -7,6 +7,7 @@ m4/putenv.m4
 
 Depends-on:
 stdlib
+environ         [test $REPLACE_PUTENV = 1]
 malloc-posix    [test $REPLACE_PUTENV = 1]
 
 configure.ac: