zgz: dynamic library handling on Mac OS X
authorTorsten Maehne <torsten.maehne@gmx.de>
Mon, 27 Aug 2012 09:28:48 +0000 (11:28 +0200)
committerJoey Hess <joey@kitenet.net>
Mon, 27 Aug 2012 15:35:13 +0000 (11:35 -0400)
On Mac OS X, DYLD_LIBRARY_PATH has to be set instead of LD_LIBRARY_PATH
to find dynamic libraries in a non-standard path.

Signed-off-by: Philipp A. Hartmann <philipp.hartmann@offis.de>
(cherry picked from commit 19748569d2d98100dabbc3c3ec9d93b8f32e5ef7)

zgz/zgz.c

index 7e7a912..377b073 100644 (file)
--- a/zgz/zgz.c
+++ b/zgz/zgz.c
@@ -528,7 +528,14 @@ static     void
 rebrain(char *zombie, char *program, int level, char *opts)
 {
        char buf[128];
-       sprintf(buf, "LD_LIBRARY_PATH=%s/%s %s -%i %s",
+
+#if defined(__APPLE__) && defined(__MACH__)
+#      define LD_PATH_VAR "DYLD_LIBRARY_PATH" 
+#else
+#      define LD_PATH_VAR "LD_LIBRARY_PATH"
+#endif
+
+       sprintf(buf, LD_PATH_VAR "=%s/%s %s -%i %s",
                        ZGZ_LIB, zombie, program, level, opts);
        exit(system(buf));
 }