From d77cac2415db3ff6576b3f1c080b3322d727338d Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 27 Sep 2021 09:15:33 -0400 Subject: Add special logic for loading libraries when LD_LIBRARY_PATH is set. --- chickadee/config.scm.in | 33 ++++++++++++++++++++++++++++----- 1 file 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." -- cgit v1.2.3