aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
authorGravatar Herbert Valerio Riedel <hvr@gnu.org>2016-01-31 16:54:04 +0100
committerGravatar Herbert Valerio Riedel <hvr@gnu.org>2016-01-31 16:56:15 +0100
commit12799d0fc7dcff0dc95640b1efad0637ad011144 (patch)
tree54831cca5a963386a3c914adbf6cbdb946e10243 /System
parent081376c3de398d21a6600b8615d189895d03d8ac (diff)
Have Autoconf test for _NSGetEnviron presence
Diffstat (limited to 'System')
-rw-r--r--System/Posix/Env.hsc6
-rw-r--r--System/Posix/Env/ByteString.hsc4
2 files changed, 4 insertions, 6 deletions
diff --git a/System/Posix/Env.hsc b/System/Posix/Env.hsc
index 6412bae..7d5f04c 100644
--- a/System/Posix/Env.hsc
+++ b/System/Posix/Env.hsc
@@ -78,9 +78,8 @@ getEnvironmentPrim = do
mapM peekFilePath arr
getCEnviron :: IO (Ptr CString)
-
-#if darwin_HOST_OS
--- You should not access _environ directly on Darwin in a bundle/shared library.
+#if HAVE__NSGETENVIRON
+-- You should not access @char **environ@ directly on Darwin in a bundle/shared library.
-- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html
getCEnviron = nsGetEnviron >>= peek
@@ -88,7 +87,6 @@ foreign import ccall unsafe "_NSGetEnviron"
nsGetEnviron :: IO (Ptr (Ptr CString))
#else
getCEnviron = peek c_environ_p
-
foreign import ccall unsafe "&environ"
c_environ_p :: Ptr (Ptr CString)
#endif
diff --git a/System/Posix/Env/ByteString.hsc b/System/Posix/Env/ByteString.hsc
index 57b03aa..c6c374c 100644
--- a/System/Posix/Env/ByteString.hsc
+++ b/System/Posix/Env/ByteString.hsc
@@ -69,8 +69,8 @@ getEnvironmentPrim = do
mapM B.packCString arr
getCEnviron :: IO (Ptr CString)
-#if darwin_HOST_OS
--- You should not access _environ directly on Darwin in a bundle/shared library.
+#if HAVE__NSGETENVIRON
+-- You should not access @char **environ@ directly on Darwin in a bundle/shared library.
-- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html
getCEnviron = nsGetEnviron >>= peek