From 678a2cdd5192ae038f1c1362a5ad0fef9c4b3a4e Mon Sep 17 00:00:00 2001 From: Liliana Prikler Date: Sat, 9 Oct 2021 18:39:15 +0200 Subject: 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. --- sdl2/config.scm.in | 10 +++++++--- 1 file 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 ...))))) -- cgit v1.2.3