summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-09-27 09:15:33 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-09-28 08:02:39 -0400
commitd77cac2415db3ff6576b3f1c080b3322d727338d (patch)
tree3375e9d9d20dee49c22e480abf9ac3f66a9e273b
parentf4c04f37757d1cda4fae9aa91ad72bc633b83094 (diff)
Add special logic for loading libraries when LD_LIBRARY_PATH is set.
-rw-r--r--chickadee/config.scm.in33
1 files changed, 28 insertions, 5 deletions
diff --git a/chickadee/config.scm.in b/chickadee/config.scm.in
index 81b0f3e..2a43918 100644
--- a/chickadee/config.scm.in
+++ b/chickadee/config.scm.in
@@ -52,11 +52,34 @@
(define %chickadee-version "@PACKAGE_VERSION@")
-(define %libopenal '("@OPENAL_LIBDIR@/libopenal" "libopenal"))
-(define %libvorbisfile '("@VORBIS_LIBDIR@/libvorbisfile" "libvorbisfile"))
-(define %libmpg123 '("@MPG123_LIBDIR@/libmpg123" "libmpg123"))
-(define %libfreetype '("@FREETYPE_LIBDIR@/libfreetype" "libfreetype"))
-(define %libreadline '("@READLINE_LIBDIR@/libreadline" "libreadline"))
+;; When LD_LIBRARY_PATH is set, we *don't* want to use the absolute
+;; file name of the library that pkgconfig found. Instead, we want to
+;; use the library name itself so the search path is used.
+(define-syntax-rule (define-library-name name
+ (absolute ...)
+ (relative ...))
+ (define name
+ (cond
+ ((getenv "LD_LIBRARY_PATH")
+ '(relative ...))
+ (else
+ '(absolute ...)))))
+
+(define-library-name %libopenal
+ ("@OPENAL_LIBDIR@/libopenal")
+ ("libopenal"))
+(define-library-name %libvorbisfile
+ ("@VORBIS_LIBDIR@/libvorbisfile")
+ ("libvorbisfile"))
+(define-library-name %libmpg123
+ ("@MPG123_LIBDIR@/libmpg123")
+ ("libmpg123"))
+(define-library-name %libfreetype
+ ("@FREETYPE_LIBDIR@/libfreetype")
+ ("libfreetype"))
+(define-library-name %libreadline
+ ("@READLINE_LIBDIR@/libreadline")
+ ("libreadline"))
(define (scope-datadir file)
"Append the Chickadee data directory to FILE."