[m-rev.] For review: Fix Darwin shared libs on source distribution

Ian MacLarty maclarty at cs.mu.OZ.AU
Sat Oct 30 10:31:25 AEST 2004


For review by anyone.

Please note the comment for library/Mmakefile.  Is this acceptable?

Estimated hours taken: 4
Branches: main

Fix shared libs on Mac OS X for the source distribution.  The problem is that
the source distribution is generated on a Linux PC, so the Darwin-specific 
-install_name option is not passed to the linker in the .dep files.  

The fix is to instead pass the option in the Mmakefiles when compiling the
source distribution on Mac OS X.

Also changed default install name path to the final install path. 

Index: Makefile
	Remove .dylib files when cleaning.

Index: Mmake.common.in
	Add IS_BOOTSTRAP_MC to indicate if an installed mmc is available.
	BOOTSTRAP_MC is set to a value even if no installed mmc is present, so
	we use IS_BOOTSTRAP_MC instead.

Index: configure.in
	Set value of IS_BOOTSTRAP_MC.

Index: browser/Mmakefile
Index: library/Mmakefile
	If IS_BOOTSTRAP_MC is "no" then pass the -install_name option to the 
	linker when building the .dylib libraries.  We are assuming that if 
	there is no installed mmc, then this must be a source distribution
	not built on a Darwin system (since then the -install_name option would
	be passed in the .dep files).  This means that if a source distribution
	is generated on a Darwin PC it will NOT build on a Darwin target,
	because then the -install_name option will be passed twice which is not
	allowed.

Index: compiler/options.m
	Changed default value of --shlib-linker-install-name-path to the value
	of FINAL_INSTALL_MERC_LIB_DIR, instead of INSTALL_MERC_LIB_DIR.

Index: Makefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile	16 May 2002 06:48:32 -0000	1.11
+++ Makefile	30 Oct 2004 00:11:41 -0000
@@ -43,7 +43,7 @@
 
 .PHONY: clean
 clean:
-	-rm -f */*.o */*.pic_o */*.a */*.so
+	-rm -f */*.o */*.pic_o */*.a */*.so */*.dylib
 	-rm -rf */Mercury/os */Mercury/pic_os */Mercury/libs
 	-rm -f compiler/mercury_compile profiler/mercury_profile 
 	-rm -f util/mdemangle util/mkinit
Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.79
diff -u -r1.79 Mmake.common.in
--- Mmake.common.in	19 Oct 2004 06:01:34 -0000	1.79
+++ Mmake.common.in	30 Oct 2004 00:11:43 -0000
@@ -31,6 +31,9 @@
 # Specify the Mercury compiler to use for bootstrapping.
 MC		= @BOOTSTRAP_MC@
 
+# Is there a Mercury compiler to bootstrap with?
+IS_BOOTSTRAP_MC	= @IS_BOOTSTRAP_MC@
+
 # Specify the compilation model to use for compiling the compiler.
 GRADE		= @GRADE@
 
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.405
diff -u -r1.405 configure.in
--- configure.in	19 Oct 2004 06:01:35 -0000	1.405
+++ configure.in	30 Oct 2004 00:11:57 -0000
@@ -3409,9 +3409,13 @@
 #-----------------------------------------------------------------------------#
 if test "$BOOTSTRAP_MC" = ""; then
 	BOOTSTRAP_MC=mmc
+	IS_BOOTSTRAP_MC=no
+else
+	IS_BOOTSTRAP_MC=yes
 fi
 BOOTSTRAP_MC="$BOOTSTRAP_MC $HAVE_BOXED_FLOATS --conf-low-tag-bits $LOW_TAG_BITS --bits-per-word $BITS_PER_WORD --bytes-per-word $BYTES_PER_WORD"
 AC_SUBST(BOOTSTRAP_MC)
+AC_SUBST(IS_BOOTSTRAP_MC)
 #-----------------------------------------------------------------------------#
 
 # The following allows us to share some subroutines between the
Index: browser/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/Mmakefile,v
retrieving revision 1.41
diff -u -r1.41 Mmakefile
--- browser/Mmakefile	19 Oct 2004 06:01:36 -0000	1.41
+++ browser/Mmakefile	30 Oct 2004 00:11:59 -0000
@@ -58,6 +58,22 @@
 MLLIBS +=	$(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY)	\
 		$(READLINE_LIBRARIES)
 
+#-----------------------------------------------------------------------------#
+
+# Set the install name for Darwin shared libraries when compiling from a 
+# source distribution.  Since the source distribution is not generated on 
+# Darwin the install name option is not passed to the linker in the .dep 
+# files.
+
+ifeq ("$(IS_BOOTSTRAP_MC)","no")
+LD_LIBFLAGS-libmer_browser.dylib = -install_name \
+	$(FINAL_INSTALL_MERC_LIB_DIR)/libmer_browser.dylib
+LD_LIBFLAGS-libmer_mdbcomp.dylib = -install_name \
+	$(FINAL_INSTALL_MERC_LIB_DIR)/libmer_mdbcomp.dylib
+endif
+
+#-----------------------------------------------------------------------------#
+
 JAVACFLAGS = -classpath $(LIBRARY_DIR)
 
 MTAGS	=	$(SCRIPTS_DIR)/mtags
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.434
diff -u -r1.434 options.m
--- compiler/options.m	20 Oct 2004 09:44:58 -0000	1.434
+++ compiler/options.m	30 Oct 2004 00:12:34 -0000
@@ -1281,7 +1281,8 @@
 	linker_error_undefined_flag -	string("-Wl,-no-undefined"),
 	shlib_linker_use_install_name - bool(no),
 	shlib_linker_install_name_flag - string("-install_name "),
-	shlib_linker_install_name_path - string("$(INSTALL_MERC_LIB_DIR)")
+	shlib_linker_install_name_path - string(
+		"$(FINAL_INSTALL_MERC_LIB_DIR)")
 ]).
 option_defaults_2(build_system_option, [
 		% Build System Options
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.135
diff -u -r1.135 Mmakefile
--- library/Mmakefile	31 May 2004 04:13:00 -0000	1.135
+++ library/Mmakefile	30 Oct 2004 00:13:00 -0000
@@ -114,6 +114,18 @@
 
 #-----------------------------------------------------------------------------#
 
+# Set the install name for Darwin shared libraries when compiling from a 
+# source distribution.  Since the source distribution is not generated on 
+# Darwin the install name option is not passed to the linker in the .dep 
+# file.
+
+ifeq ("$(IS_BOOTSTRAP_MC)","no")
+LD_LIBFLAGS-libmer_std.dylib = -install_name \
+	$(FINAL_INSTALL_MERC_LIB_DIR)/libmer_std.dylib
+endif
+
+#-----------------------------------------------------------------------------#
+
 # Stuff for Windows DLLS using gnu-win32
 
 ifeq ($(USE_DLLS),yes)
	
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list