summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiliana Prikler <liliana.prikler@gmail.com>2021-10-09 18:39:15 +0200
committerDavid Thompson <dthompson2@worcester.edu>2022-07-28 16:06:22 -0400
commit678a2cdd5192ae038f1c1362a5ad0fef9c4b3a4e (patch)
tree07fdfe81166461662e2ed357b736044974a2d7b2
parent4a42112c131671a11616398e1551e753777fef31 (diff)
config: Fallback to absolute file names even with LD_LIBRARY_PATH.
This is useful when LD_LIBRARY_PATH is set but libSDL2 is not intended to be found there.
-rw-r--r--sdl2/config.scm.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/sdl2/config.scm.in b/sdl2/config.scm.in
index 6a35836..cb4793a 100644
--- a/sdl2/config.scm.in
+++ b/sdl2/config.scm.in
@@ -26,8 +26,12 @@
;;
;; Another special case is 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.
+;; found. Instead, we want to use just the library name so the search
+;; path is used. HOWEVER, it could be that LD_LIBRARY_PATH is set but
+;; libSDL2 is not within that path BUT it is available at the absolute
+;; file name provided by pkgconfig. So, we want to prioritize
+;; searching LD_LIBRARY_PATH when present, but still fallback to the
+;; absolute file names.
(define %windows? (string-prefix? "Windows" (utsname:sysname (uname))))
(define-syntax-rule (define-library-name name
(absolute ...)
@@ -37,7 +41,7 @@
(cond
(%windows? '(windows ...))
((getenv "LD_LIBRARY_PATH")
- '(relative ...))
+ '(relative ... absolute ...))
(else
'(absolute ...)))))