diff options
author | axel <axel@liljencrantz.se> | 2007-01-28 02:59:11 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2007-01-28 02:59:11 +1000 |
commit | bd5a16d2139d9ea5e9f3b2405a5dd727ba6ebccb (patch) | |
tree | 2dd4941cd176aa735916b85741b312f088bc18bc /configure.ac | |
parent | be0bd50bad7f12f75bbd9e79ed6155f35df363d7 (diff) |
Add support for using __environ instead of environ, if it exists and environ isn't set
darcs-hash:20070127165911-ac50b-72747760d767a6918152c2e4f254febb19ab1205.gz
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 3abe2666..76ef63c4 100644 --- a/configure.ac +++ b/configure.ac @@ -751,6 +751,31 @@ else AC_MSG_RESULT(no) fi +# Check for __environ symbol +AC_MSG_CHECKING([for __environ symbol]) +AC_TRY_LINK( + [ + #include <unistd.h> + ], + [ + extern char **__environ; + char **tmp = __environ; + exit(tmp!=0); + ], + have___environ=yes, + have___environ=no +) +if test "$have___environ" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE( + [HAVE___ENVIRON], + [1], + [Define to 1 if the __environ symbol is exported.] + ) +else + AC_MSG_RESULT(no) +fi + # Check if getopt_long exists and works AC_MSG_CHECKING([if getopt_long exists and works]) AC_TRY_LINK( |