X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FSupport%2FUnix%2FProgram.inc;h=baf2767ad584c52019ebf9b448797f5a74107eb2;hp=2ed5597e4ad99784bde7468f25c90767ef3569c5;hb=cbccd8ddf555768ad957d03bc22c7e6a1f252fe2;hpb=f45c1a4d12f065a249b897e35a7248e61ee12187 diff --git a/lib/Support/Unix/Program.inc b/lib/Support/Unix/Program.inc index 2ed5597e4ad..baf2767ad58 100644 --- a/lib/Support/Unix/Program.inc +++ b/lib/Support/Unix/Program.inc @@ -42,10 +42,18 @@ #define _RESTRICT_KYWD #endif #include + #if defined(__APPLE__) #include #endif -#if !defined(__APPLE__) || defined(TARGET_OS_IPHONE) + +#if defined(__APPLE__) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) +#define USE_NSGETENVIRON 1 +#else +#define USE_NSGETENVIRON 0 +#endif + +#if !USE_NSGETENVIRON extern char **environ; #else #include // _NSGetEnviron @@ -220,7 +228,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, const char **args, } if (!envp) -#if !defined(__APPLE__) || defined(TARGET_OS_IPHONE) +#if !USE_NSGETENVIRON envp = const_cast(environ); #else // environ is missing in dylibs.