From c124cabd6716e4c57fde3b7d0d518fa61e25f12f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 17 Sep 2011 17:34:03 +0200 Subject: [PATCH] putenv: Support for MSVC. * modules/putenv (Depends-on): Add environ. * lib/putenv.c (environ): Disable declaration. * lib/unistd.in.h: Update comment. --- ChangeLog | 7 +++++++ lib/putenv.c | 6 ++++-- lib/unistd.in.h | 3 ++- modules/putenv | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b18485ce..ef3326460 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2011-09-17 Bruno Haible + 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 + math: Avoid macro redefinition warnings on MSVC. * lib/math.in.h (ceilf, ceill, floorf, floorl, frexpl, ldexpl): Undefine before redefining. diff --git a/lib/putenv.c b/lib/putenv.c index 68e5fec31..3c332791b 100644 --- a/lib/putenv.c +++ b/lib/putenv.c @@ -34,10 +34,12 @@ #include #include -#if HAVE_GNU_LD +#if _LIBC +# if HAVE_GNU_LD # define environ __environ -#else +# else extern char **environ; +# endif #endif #if _LIBC diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 90de697e0..e3fb8c6b9 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -75,7 +75,8 @@ #endif /* mingw fails to declare _exit in . */ -/* mingw, BeOS, Haiku declare environ in , not in . */ +/* mingw, MSVC, BeOS, Haiku declare environ in , not in + . */ /* Solaris declares getcwd not only in but also in . */ /* But avoid namespace pollution on glibc systems. */ #ifndef __GLIBC__ diff --git a/modules/putenv b/modules/putenv index 7476af11a..3321a5e95 100644 --- a/modules/putenv +++ b/modules/putenv @@ -7,6 +7,7 @@ m4/putenv.m4 Depends-on: stdlib +environ [test $REPLACE_PUTENV = 1] malloc-posix [test $REPLACE_PUTENV = 1] configure.ac: -- 2.11.0