Blob Blame History Raw
From 2c05db3a37f916a2637745cd603cb8e63c8a6ab7 Mon Sep 17 00:00:00 2001
From: Alec Leamas <leamas.alec@gmail.com>
Date: Wed, 26 Dec 2012 08:13:56 +0100
Subject: [PATCH 5/8] Improve driver dir detection.

Add a rpath to the private directory so the dynamic loader finds it;
also add a trace output for detected dir.

Although using rpaths is frowned upon in the general case, using it
for a private library directory like this is perfectly OK.
---
 Makefile.in | 1 +
 server.c    | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile.in b/Makefile.in
index 9a9cdfa..89433f2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -6,6 +6,7 @@ BINDIR=@bindir@
 
 
 CFLAGS += -I. -fvisibility=hidden -DIGUANAIR_EXPORTS
+CFLAGS += -Wl,-rpath,$(LIBDIR)/iguanaIR
 
 ifdef DARWIN
   LINKARGS   = -Wl,-dylib_current_version,1.0.0,-dylib_compatibility_version,1.0.0 -install_name $(DESTDIR)/$(LIBDIR)/$(LIBNAME)
diff --git a/server.c b/server.c
index 141ee54..3493100 100644
--- a/server.c
+++ b/server.c
@@ -93,8 +93,13 @@ deviceList* initServer()
 #ifdef _WIN32
             srvSettings.driverDir = ".";
 #else
-            srvSettings.driverDir = "/usr/lib/iguanaIR";
+            if (access("/usr/lib64", F_OK))
+                srvSettings.driverDir = "/usr/lib64/iguanaIR";
+            else
+                srvSettings.driverDir = "/usr/lib/iguanaIR";
 #endif
+        message(LOG_DEBUG, "  driverDir: %s\n", srvSettings.driverDir);
+
     }
 
     /* initialize the commPipe, driver, and device list */
-- 
1.7.11.7