Changeset 1544 for zzuf


Ignore:
Timestamp:
Jan 3, 2007, 6:57:52 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Now works on Darwin!
Location:
zzuf/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/Makefile.am

    r1543 r1544  
    88                     load-fd.c load-signal.c load-stream.c load.h \
    99                     random.c random.h
    10 libzzuf_la_LDFLAGS = -module -avoid-version -no-undefined
     10libzzuf_la_LDFLAGS = -avoid-version -no-undefined
    1111libzzuf_la_LIBADD = -ldl
    1212
  • zzuf/trunk/src/zzuf.c

    r1543 r1544  
    489489    int len = strlen(progpath);
    490490#ifdef __APPLE__
    491     char const *preload = "DYLD_INSERT_LIBRARIES";
     491#   define FILENAME "libzzuf.dylib"
     492#   define PRELOAD "DYLD_INSERT_LIBRARIES"
    492493    setenv("DYLD_FORCE_FLAT_NAMESPACE", "1", 1);
    493494#else
    494     char const *preload = "LD_PRELOAD";
     495#   define FILENAME "libzzuf.so"
     496#   define PRELOAD "LD_PRELOAD"
    495497#endif
    496498
    497     libpath = malloc(len + strlen("/.libs/libzzuf.so") + 1);
     499    libpath = malloc(len + strlen("/.libs/" FILENAME) + 1);
    498500    strcpy(libpath, progpath);
    499501    tmp = strrchr(libpath, '/');
    500     strcpy(tmp ? tmp + 1 : libpath, ".libs/libzzuf.so");
     502    strcpy(tmp ? tmp + 1 : libpath, ".libs/" FILENAME);
    501503    if(access(libpath, R_OK) == 0)
    502         setenv(preload, libpath, 1);
     504        setenv(PRELOAD, libpath, 1);
    503505    else
    504         setenv(preload, LIBDIR "/libzzuf.so", 1);
     506        setenv(PRELOAD, LIBDIR "/" FILENAME, 1);
    505507    free(libpath);
    506508}
Note: See TracChangeset for help on using the changeset viewer.