scripts/wrapper.c
changeset 1964 f02cfced8f55
parent 1504 4e8dd617a1ca
child 1992 eebcaff6626f
     1.1 --- a/scripts/wrapper.c	Sun Aug 30 19:58:41 2009 +0200
     1.2 +++ b/scripts/wrapper.c	Sat May 22 12:37:02 2010 +0200
     1.3 @@ -7,6 +7,11 @@
     1.4  #include <unistd.h>
     1.5  #include <errno.h>
     1.6  
     1.7 +#ifdef	__APPLE__
     1.8 +#define LDLP "DYLD_LIBRARY_PATH"
     1.9 +#else
    1.10 +#define LDLP "LD_LIBRARY_PATH"
    1.11 +#endif
    1.12  
    1.13  /* Needed for execve */
    1.14  extern char **environ;
    1.15 @@ -106,7 +111,7 @@
    1.16  
    1.17    /* Now add the directory with our runtime libraries to the
    1.18       front of the library search path, LD_LIBRARY_PATH */
    1.19 -  ldlibpath = getenv( "LD_LIBRARY_PATH" );
    1.20 +  ldlibpath = getenv(LDLP);
    1.21    if( ldlibpath ) {
    1.22      basedir = (char*) realloc( basedir,   strlen( basedir )
    1.23                                          + strlen( ldlibpath )
    1.24 @@ -115,7 +120,7 @@
    1.25      strcat( basedir, ldlibpath );
    1.26    }
    1.27  
    1.28 -  if( setenv( "LD_LIBRARY_PATH", basedir, 1 ) ) {
    1.29 +  if( setenv( LDLP, basedir, 1 ) ) {
    1.30      errno = ENOMEM;
    1.31      perror( "tool wrapper" );
    1.32      exit( 1 );