scripts/wrapper.c: Under MacOS set DYLD_LIBRARY_PATH
authorTitus von Boxberg <titus@v9g.de>
Sat May 22 12:37:02 2010 +0200 (2010-05-22)
changeset 1964f02cfced8f55
parent 1963 ea472c30c356
child 1965 e3d532dd8b5d
scripts/wrapper.c: Under MacOS set DYLD_LIBRARY_PATH

Depending on (predefined) macro __APPLE__, use DYLD_LIBRARY_PATH
instead of LD_LIBRARY_PATH.
scripts/wrapper.c
     1.1 --- a/scripts/wrapper.c	Sat May 22 18:48:50 2010 +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 );