Ignore:
Timestamp:
Jan 3, 2007, 10:09:41 AM (14 years ago)
Author:
Sam Hocevar
Message:
  • The whole crap now builds on OS X. Now if it only agreed to run, too...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/zzuf.c

    r1540 r1543  
    4444static char *merge_regex(char *, char *);
    4545static char *merge_file(char *, char *);
    46 static void set_ld_preload(char const *);
     46static void set_environment(char const *);
    4747static void version(void);
    4848#if defined(HAVE_GETOPT_H)
     
    223223
    224224    /* Preload libzzuf.so */
    225     set_ld_preload(argv[0]);
     225    set_environment(argv[0]);
    226226
    227227    /* Create new argv */
     
    484484}
    485485
    486 static void set_ld_preload(char const *progpath)
     486static void set_environment(char const *progpath)
    487487{
    488488    char *libpath, *tmp;
    489489    int len = strlen(progpath);
     490#ifdef __APPLE__
     491    char const *preload = "DYLD_INSERT_LIBRARIES";
     492    setenv("DYLD_FORCE_FLAT_NAMESPACE", "1", 1);
     493#else
     494    char const *preload = "LD_PRELOAD";
     495#endif
    490496
    491497    libpath = malloc(len + strlen("/.libs/libzzuf.so") + 1);
     
    494500    strcpy(tmp ? tmp + 1 : libpath, ".libs/libzzuf.so");
    495501    if(access(libpath, R_OK) == 0)
    496         setenv("LD_PRELOAD", libpath, 1);
     502        setenv(preload, libpath, 1);
    497503    else
    498         setenv("LD_PRELOAD", LIBDIR "/libzzuf.so", 1);
     504        setenv(preload, LIBDIR "/libzzuf.so", 1);
    499505    free(libpath);
    500506}
Note: See TracChangeset for help on using the changeset viewer.