~ chicken-core (chicken-5) 5fe91ae31df87b46cda0d91ec8bb4892353596ac


commit 5fe91ae31df87b46cda0d91ec8bb4892353596ac
Author:     Mario Domenech Goulart <mario@ossystems.com.br>
AuthorDate: Thu May 17 11:39:01 2012 -0300
Commit:     Peter Bex <peter.bex@xs4all.nl>
CommitDate: Thu May 17 17:07:37 2012 +0200

    When referencing libchicken, take PROGRAM_PREFIX and PROGRAM_SUFFIX into account
    
    The build system names libchicken taking PROGRAM_PREFIX and
    PROGRAM_SUFFIX into account (to assemble INSTALL_LIB_NAME), but the
    chicken tools don't.  `libchicken' is hardcoded in chicken tools and
    tests.
    
    This patch makes cross tools load libchicken according to the name
    generated by the build system.  It also tries to keep tests working on
    windows, in cases that libchicken has to be copied to the tests dir
    (this is a bit hacky, since the actual lib name is not known from
    scripts, so lib*chicken*.dll is copied).
    
    This patch doesn't handle the case when TARGET_LIB_NAME is used by csc
    (i.e., when not in host-mode).  TARGET_LIB_NAME is hardcoded to
    `chicken'.
    
    Signed-off-by: Peter Bex <peter.bex@xs4all.nl>

diff --git a/csc.scm b/csc.scm
index 68834ea6..2310bbb8 100644
--- a/csc.scm
+++ b/csc.scm
@@ -119,8 +119,11 @@
 (define windows-shell WINDOWS_SHELL)
 (define generate-manifest #f)
 
+(define libchicken
+  (string-append "lib" INSTALL_LIB_NAME))
+
 (define default-library
-  (string-append "libchicken." library-extension))
+  (string-append libchicken "." library-extension))
 
 (define default-compilation-optimization-options (string-split (if host-mode INSTALL_CFLAGS TARGET_CFLAGS)))
 (define best-compilation-optimization-options default-compilation-optimization-options)
@@ -912,9 +915,9 @@ EOF
     (when (and osx (or (not cross-chicken) host-mode))
       (command
        (string-append
-	"install_name_tool -change libchicken.dylib "
+	"install_name_tool -change " libchicken ".dylib "
 	(quotewrap 
-	 (let ((lib "libchicken.dylib"))
+	 (let ((lib (string-append libchicken ".dylib")))
 	   (if deployed
 	       (make-pathname "@executable_path" lib)
 	       (make-pathname
@@ -955,7 +958,7 @@ EOF
 (define (copy-libraries targetdir)
   (let ((lib (make-pathname
 	      (target-lib-path) 
-	      "libchicken"
+	      libchicken
 	      (cond (osx "dylib")
 		    (win "dll")
 		    (else (string-append
diff --git a/eval.scm b/eval.scm
index 863e0c43..9f7a9cfd 100644
--- a/eval.scm
+++ b/eval.scm
@@ -57,6 +57,7 @@
 (define-foreign-variable install-egg-home c-string "C_INSTALL_EGG_HOME")
 (define-foreign-variable installation-home c-string "C_INSTALL_SHARE_HOME")
 (define-foreign-variable binary-version int "C_BINARY_VERSION")
+(define-foreign-variable install-lib-name c-string "C_INSTALL_LIB_NAME")
 
 (define ##sys#core-library-modules
   '(extras lolevel utils files tcp irregex posix srfi-1 srfi-4 srfi-13 
@@ -67,7 +68,8 @@
 
 (define ##sys#explicit-library-modules '())
 
-(define-constant default-dynamic-load-libraries '("libchicken"))
+(define default-dynamic-load-libraries
+  `(,(string-append "lib" install-lib-name)))
 (define-constant cygwin-default-dynamic-load-libraries '("cygchicken-0"))
 (define-constant macosx-load-library-extension ".dylib")
 (define-constant windows-load-library-extension ".dll")
diff --git a/tests/runbench.sh b/tests/runbench.sh
old mode 100644
new mode 100755
index 77a4e926..7841ec14
--- a/tests/runbench.sh
+++ b/tests/runbench.sh
@@ -17,7 +17,7 @@ COMPILE_OPTIONS="-O5 -d0 -disable-interrupts -b"
 if test -n "$MSYSTEM"; then
     CHICKEN="..\\chicken.exe"
     # make compiled tests use proper library on Windows
-    cp ../libchicken.dll .
+    cp ../lib*chicken*.dll .
 fi
 
 case `uname -s` in
diff --git a/tests/runtests.bat b/tests/runtests.bat
index be161342..ecd8d059 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -12,7 +12,7 @@ set FAST_OPTIONS=-O5 -d0 -b -disable-interrupts
 
 set TYPESDB=..\types.db
 
-copy ..\libchicken.dll .
+copy ..\lib*chicken*.dll .
 
 set compile=..\csc -compiler %CHICKEN% -v -I.. -L.. -include-path .. -o a.out
 set compile2=..\csc -compiler %CHICKEN% -v -I.. -L.. -include-path ..
diff --git a/tests/runtests.sh b/tests/runtests.sh
old mode 100644
new mode 100755
index 1ec59cd2..9f9f7ee5
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -43,7 +43,7 @@ if test -n "$MSYSTEM"; then
     ASMFLAGS=-Wa,-w
     TIME=time
     # make compiled tests use proper library on Windows
-    cp ../libchicken.dll .
+    cp ../lib*chicken*.dll .
 else 
     TIME=/usr/bin/time
 fi
Trap