~ chicken-core (chicken-5) 3aa8ec7fffa59950771d756cf91f2394403973be


commit 3aa8ec7fffa59950771d756cf91f2394403973be
Author:     Kristian Lein-Mathisen <kristianlein@gmail.com>
AuthorDate: Fri Jan 3 15:16:51 2014 +0100
Commit:     Mario Domenech Goulart <mario.goulart@gmail.com>
CommitDate: Wed Feb 5 22:08:38 2014 -0200

    fix: eval.scm: use soname only with when USES_SONAME present in Makefile
    
    Android, who'se software-version is 'linux, does not use sonames and
    crashes with (use <unit>) because the binary-version is incorrectly
    appended to the shared library filename.
    
    This patch explicitly propagates the Makefiles' USES_SONAME property
    through to eval for this to work properly.
    
    Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
    Signed-off-by: Mario Domenech Goulart <mario.goulart@gmail.com>

diff --git a/defaults.make b/defaults.make
index f3c600b2..a32dfbd7 100644
--- a/defaults.make
+++ b/defaults.make
@@ -484,6 +484,13 @@ endif
 	echo "#endif" >>$@
 	echo "#ifndef C_BINARY_VERSION" >>$@
 	echo "# define C_BINARY_VERSION $(BINARYVERSION)" >>$@
+	echo "#endif" >>$@
+	echo "#ifndef C_USES_SONAME" >>$@
+ifdef USES_SONAME
+	echo "# define C_USES_SONAME 1" >>$@
+else
+	echo "# define C_USES_SONAME 0" >>$@
+endif
 	echo "#endif" >>$@
 	echo "/* END OF FILE */" >>$@
 endif
diff --git a/eval.scm b/eval.scm
index a8353942..ed1b92dd 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 uses-soname? bool "C_USES_SONAME")
 (define-foreign-variable install-lib-name c-string "C_INSTALL_LIB_NAME")
 
 (define ##sys#core-library-modules
@@ -1066,8 +1067,7 @@
 
 (define dynamic-load-libraries 
   (let ((ext
-	 (if (and (memq (software-version) '(linux netbsd openbsd freebsd haiku hurd))
-		  (not (zero? binary-version))) ; allow "configless" build
+	 (if uses-soname?
 	     (string-append
 	      ##sys#load-library-extension
 	      "." 
Trap