[m-rev.] diff: support shared libraries on Solaris/x86

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Sep 12 04:24:48 AEST 2002


Estimated hours taken: 6
Branches: main

Support shared libraries on mundroo.

configure.in:
	Add support for shared libraries on x*86-*-solaris2.*.

boehm_gc/Makefile:
	Compile mach_dep.c with $(CFLAGS_FOR_PIC), like we do all the
	other C files in this directory.  This is needed for Solaris/x86,
	and should hopefully be harmless on other systems.

scripts/ml.in:
	Pass -L/usr/local/lib, even when `--mercury-libs none' or
	`--no-mercury-stdlib-dir' is specified.  This is needed to ensure
	that we find libreadline.a when building the Mercury standard
	library, if libreadline.a is installed in /usr/local/lib.
	(The Mercury configure script searches /usr/local/lib.)

runtime/Mmakefile:
trace/Mmakefile:
	Include -L/usr/local/lib in LDFLAGS, for the same reason as above.

Workspace: /tmp/fjh/mercury
Index: boehm_gc/Makefile
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Makefile,v
retrieving revision 1.53
diff -u -d -r1.53 Makefile
--- boehm_gc/Makefile	2002/07/26 05:16:00	1.53
+++ boehm_gc/Makefile	2002/09/11 15:38:18
@@ -367,7 +367,7 @@
 # the SHELL environment variable.
 SHELL= /bin/sh
 
-SPECIALCFLAGS = -I$(srcdir)/include
+SPECIALCFLAGS = -I$(srcdir)/include $(CFLAGS_FOR_PIC)
 # Alternative flags to the C compiler for mach_dep.c.
 # Mach_dep.c often doesn't like optimization, and it's
 # not time-critical anyway.
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.316
diff -u -d -r1.316 configure.in
--- configure.in	2002/09/11 17:20:26	1.316
+++ configure.in	2002/09/11 17:43:29
@@ -2467,6 +2467,33 @@
 		SHLIB_RPATH_OPT="-R"
 		SHLIB_RPATH_SEP=" -R"
 		;;
+	i*86-*-solaris2.*)
+		AC_MSG_RESULT(yes)
+
+		# XXX For Solaris/SPARC, we don't link in libgcc.a.
+		# Why not?  Do we need to do the same thing for Solaris/x86?
+		#SHARED_LIBS="$(MATH_LIB) -lc"	# don't link in libgcc.a
+		#SHARED_LIBS_SH="$MATH_LIB -lc"	# don't link in libgcc.a
+
+		# XXX We need -mimpure-text because libraries such as
+		# libreadline.a might be installed with only the .a rather
+		# than the .so, and not compiled with -fpic,
+		# and we need to link against them when creating shared libs.
+		LINK_SHARED_OBJ="$CC -shared -mimpure-text"
+		LINK_SHARED_OBJ_SH="$CC -shared -mimpure-text"
+
+		# XXX We should use the following.
+		# However, this causes problems on mundroo.cs.mu.oz.au,
+		# due to the readline library being installed only as
+		# libreadline.a, with no corresponding libreadline.so.
+		#ERROR_UNDEFINED="-Wl,-z,defs"
+
+		EXE_RPATH_OPT="-R"
+		EXE_RPATH_SEP=" -R"
+		SHLIB_RPATH_OPT="-R"
+		SHLIB_RPATH_SEP=" -R"
+		EXT_FOR_SHARED_LIB=so
+		;;
 	sparc-sun-solaris2.*)
 		AC_MSG_RESULT(yes)
 		SHARED_LIBS="$(MATH_LIB) -lc"	# don't link in libgcc.a
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.93
diff -u -d -r1.93 Mmakefile
--- runtime/Mmakefile	2002/08/21 11:27:39	1.93
+++ runtime/Mmakefile	2002/09/11 16:38:20
@@ -190,7 +190,7 @@
 OBJS		= $(CFILES:.c=.$O)
 PIC_OBJS	= $(CFILES:.c=.$(EXT_FOR_PIC_OBJECTS))
 
-LDFLAGS		= -L$(BOEHM_GC_DIR)
+LDFLAGS		= -L$(BOEHM_GC_DIR) -L/usr/local/lib
 LDLIBS		= $(SHARED_GC_LIBS)
 
 THREADLIBS	= \
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.98
diff -u -d -r1.98 ml.in
--- scripts/ml.in	2002/09/01 06:05:20	1.98
+++ scripts/ml.in	2002/09/11 16:18:56
@@ -338,9 +338,11 @@
 merc_libdir_opts="\
 	@LIB_LIBPATH@$LIBDIR/$GRADE/$FULLARCH
 	@LIB_LIBPATH@$LIBDIR/$FULLARCH
+"
+system_libdir_opts="\
 	@LIB_LIBPATH@/usr/local/lib
 "
-LIBDIR_OPTS="$user_libdir_opts $merc_libdir_opts"
+LIBDIR_OPTS="$user_libdir_opts $merc_libdir_opts $system_libdir_opts"
 
 case $mercury_libs in
 	shared)
@@ -358,7 +360,7 @@
 		merc_shlib_dirs=""
 		;;
 	none)	LIBS="$TRACE_LIBS_SYSTEM $STDLIBS"
-		LIBDIR_OPTS="$user_libdir_opts"
+		LIBDIR_OPTS="$user_libdir_opts $system_libdir_opts"
 		merc_shlib_dirs=""
 		;;
 esac
Index: trace/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/Mmakefile,v
retrieving revision 1.33
diff -u -d -r1.33 Mmakefile
--- trace/Mmakefile	2002/08/21 11:28:01	1.33
+++ trace/Mmakefile	2002/09/11 16:37:23
@@ -83,7 +83,7 @@
 OBJ_CHECKS	= $(OBJS:%=%.obj_check)
 
 LDFLAGS		= -L$(BROWSER_DIR) -L$(LIBRARY_DIR) \
-			-L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
+			-L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR) -L/usr/local/lib
 LDLIBS		= -l$(BROWSER_LIB_NAME) $(MLLIBS) $(SOCKET_LIBRARY) \
 			$(NSL_LIBRARY) $(DL_LIBRARY) $(READLINE_LIBRARIES)
 THREADLIBS	= \

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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