~ chicken-core (chicken-5) 3913575fd59efe2067bfdaf4acecc7cdf560f12a


commit 3913575fd59efe2067bfdaf4acecc7cdf560f12a
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Tue Jan 28 10:17:18 2014 +0100
Commit:     Jim Ursetto <zbigniewsz@gmail.com>
CommitDate: Sat Feb 1 19:14:08 2014 -0600

    Store name of the post-install program in chicken-config, so that csc can pick up the path to "install_program_name" on Mac OS. Also pass "-headerpad_max_install_names" to the linker when building dynamically loadable .so's.

diff --git a/Makefile.cygwin b/Makefile.cygwin
index 8594882d..6989ab8b 100644
--- a/Makefile.cygwin
+++ b/Makefile.cygwin
@@ -136,6 +136,9 @@ chicken-defaults.h:
 	echo "#ifndef C_INSTALL_CXX" >>$@
 	echo "# define C_INSTALL_CXX \"$(CXX_COMPILER)\"" >>$@
 	echo "#endif" >>$@
+	echo "#ifndef C_INSTALL_POSTINSTALL_PROGRAM" >>$@
+	echo "# define C_INSTALL_POSTINSTALL_PROGRAM \"$(POSTINSTALL_PROGRAM)\"" >>$@
+	echo "#endif" >>$@
 	echo "#ifndef C_INSTALL_CFLAGS" >>$@
 	echo "# define C_INSTALL_CFLAGS \"$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
 	echo "#endif" >>$@
diff --git a/Makefile.mingw b/Makefile.mingw
index 74e9aff6..4027171c 100644
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -134,6 +134,9 @@ endif
 	echo #ifndef C_INSTALL_CXX >>$@
 	echo # define C_INSTALL_CXX "$(CXX_COMPILER)" >>$@
 	echo #endif >>$@
+	echo #ifndef C_INSTALL_POSTINSTALL_PROGRAM >>$@
+	echo # define C_INSTALL_POSTINSTALL_PROGRAM "$(POSTINSTALL_PROGRAM)" >>$@
+	echo #endif" >>$@
 	echo #ifndef C_INSTALL_RC_COMPILER >>$@
 	echo # define C_INSTALL_RC_COMPILER "$(RC_COMPILER)" >>$@
 	echo #endif >>$@
diff --git a/csc.scm b/csc.scm
index 6d1ce589..dddbbb98 100644
--- a/csc.scm
+++ b/csc.scm
@@ -61,6 +61,7 @@
 (define-foreign-variable CSC_PROGRAM c-string "C_CSC_PROGRAM")
 (define-foreign-variable WINDOWS_SHELL bool "C_WINDOWS_SHELL")
 (define-foreign-variable BINARY_VERSION int "C_BINARY_VERSION")
+(define-foreign-variable POSTINSTALL_PROGRAM c-string "C_INSTALL_POSTINSTALL_PROGRAM")
 
 
 ;;; Parameters:
@@ -523,7 +524,7 @@ EOF
     (set! compile-options (append pic-options '("-DC_SHARED") compile-options))
     (set! link-options
       (cons (cond
-             (osx (if lib "-dynamiclib" "-bundle"))
+             (osx (if lib "-dynamiclib" "-bundle -headerpad_max_install_names"))
              (else "-shared")) link-options))
     (set! shared #t) )
 
@@ -937,7 +938,7 @@ EOF
     (when (and osx (or (not cross-chicken) host-mode))
       (command
        (string-append
-	"install_name_tool -change " libchicken ".dylib "
+	POSTINSTALL_PROGRAM " -change " libchicken ".dylib "
 	(quotewrap 
 	 (let ((lib (string-append libchicken ".dylib")))
 	   (if deployed
diff --git a/defaults.make b/defaults.make
index 4a0f238e..943dc882 100644
--- a/defaults.make
+++ b/defaults.make
@@ -358,6 +358,9 @@ endif
 	echo "#ifndef C_INSTALL_RC_COMPILER" >>$@
 	echo "# define C_INSTALL_RC_COMPILER \"$(RC_COMPILER)\"" >>$@
 	echo "#endif" >>$@
+	echo "#ifndef C_INSTALL_POSTINSTALL_PROGRAM" >>$@
+	echo "# define C_INSTALL_POSTINSTALL_PROGRAM \"$(POSTINSTALL_PROGRAM)\"" >>$@
+	echo "#endif" >>$@
 	echo "#ifndef C_INSTALL_CFLAGS" >>$@
 	echo "# define C_INSTALL_CFLAGS \"$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@
 	echo "#endif" >>$@
Trap