# HG changeset patch # User Bruno Haible # Date 1316273643 -7200 # Node ID 6c1f469caadef36922da9708284829d23a84eb00 # Parent f2a7b56d34a3d5b15bb12cba4464a331667b1903 putenv: Support for MSVC. * modules/putenv (Depends-on): Add environ. * lib/putenv.c (environ): Disable declaration. * lib/unistd.in.h: Update comment. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +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. diff --git a/lib/putenv.c b/lib/putenv.c --- 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 --- 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 --- a/modules/putenv +++ b/modules/putenv @@ -7,6 +7,7 @@ Depends-on: stdlib +environ [test $REPLACE_PUTENV = 1] malloc-posix [test $REPLACE_PUTENV = 1] configure.ac: