summaryrefslogtreecommitdiff
path: root/src/faketime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/faketime.c')
-rw-r--r--src/faketime.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/faketime.c b/src/faketime.c
index 452a58f..99d2f9e 100644
--- a/src/faketime.c
+++ b/src/faketime.c
@@ -47,8 +47,9 @@
#include <semaphore.h>
#include "faketime_common.h"
+#include "config.h"
-const char version[] = "0.9.7";
+const char version[] = VERSION;
#ifdef __APPLE__
static const char *date_cmd = "gdate";
@@ -295,19 +296,21 @@ int main (int argc, char **argv)
{
char *ftpl_path;
#ifdef __APPLE__
- ftpl_path = PREFIX "/libfaketime.1.dylib";
- FILE *check;
- check = fopen(ftpl_path, "ro");
- if (check == NULL)
- {
- ftpl_path = PREFIX "/lib/faketime/libfaketime.1.dylib";
- }
- else
- {
- fclose(check);
+ if (!getenv("DYLD_INSERT_LIBRARIES") && !getenv("DYLD_FORCE_FLAT_NAMESPACE")) {
+ ftpl_path = LIBPREFIX "/libfaketime." LIBVERSION ".dylib";
+ FILE *check;
+ check = fopen(ftpl_path, "ro");
+ if (check == NULL)
+ {
+ ftpl_path = PREFIX "/lib/faketime/libfaketime." LIBVERSION ".dylib";
+ }
+ else
+ {
+ fclose(check);
+ }
+ setenv("DYLD_INSERT_LIBRARIES", ftpl_path, true);
+ setenv("DYLD_FORCE_FLAT_NAMESPACE", "1", true);
}
- setenv("DYLD_INSERT_LIBRARIES", ftpl_path, true);
- setenv("DYLD_FORCE_FLAT_NAMESPACE", "1", true);
#else
{
char *ld_preload_new, *ld_preload = getenv("LD_PRELOAD");
@@ -318,17 +321,17 @@ int main (int argc, char **argv)
* on MultiArch platforms, such as Debian, we put a literal $LIB into LD_PRELOAD.
*/
#ifndef MULTI_ARCH
- ftpl_path = PREFIX LIBDIRNAME "/libfaketimeMT.so.1";
+ ftpl_path = LIBPREFIX "/libfaketimeMT.so." LIBVERSION;
#else
- ftpl_path = PREFIX "/$LIB/faketime/libfaketimeMT.so.1";
+ ftpl_path = PREFIX "/$LIB/faketime/libfaketimeMT.so." LIBVERSION;
#endif
}
else
{
#ifndef MULTI_ARCH
- ftpl_path = PREFIX LIBDIRNAME "/libfaketime.so.1";
+ ftpl_path = LIBPREFIX "/libfaketime.so." LIBVERSION;
#else
- ftpl_path = PREFIX "/$LIB/faketime/libfaketime.so.1";
+ ftpl_path = PREFIX "/$LIB/faketime/libfaketime.so." LIBVERSION;
#endif
}
len = ((ld_preload)?strlen(ld_preload) + 1: 0) + 1 + strlen(ftpl_path);