[m-dev.] for review: enforce library self-containedness

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Feb 9 03:48:19 AEDT 2001


On 06-Feb-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On platforms which support it, check that there are no undefined
> symbols when linking the Mercury shared libraries. 
> Some platforms (AIX, Windows, and BeOS) require this when building
> shared libraries.  This change means that we check it on our usual
> platforms, including Linux.
> 
> configure.in:
> 	Set ERROR_UNDEFINED to `-Wl,--no-undefined' on x86 Linux.

Estimated hours taken: 0.5

configure.in:
	For Linux, when using `--no-undefined', test to see whether
	the linker supports it.  This is needed because it turns out
	that this option is a quite recent addition to GNU ld.

Workspace: /home/venus/fjh/ws-venus2/mercury
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.246
diff -u -d -b -r1.246 configure.in
--- configure.in	2001/02/08 16:10:45	1.246
+++ configure.in	2001/02/08 16:36:41
@@ -2254,13 +2254,22 @@
 		yes)
 			AC_MSG_RESULT(yes)
 			EXT_FOR_SHARED_LIB=so
+			AC_MSG_CHECKING(if linker supports --no-undefined)
+			rm -f conftest*
+			echo "int main(void) { return 0; }" > conftest.c
+			$CC -Wl,--no-undefined -o conftest conftest.c
+			if test -f conftest; then
+				AC_MSG_RESULT(yes)
+				ERROR_UNDEFINED="-Wl,--no-undefined"
+
 				AC_MSG_CHECKING(for ld-linux.so)
+				rm -f conftest*
 				echo "int main(void) { return 0; }" > conftest.c
 				$CC -o conftest conftest.c
-			ld_linux=`ldd ./conftest | awk '/ld-linux/{print $1;}'`
+				ld_linux=`ldd ./conftest | \
+					awk '/ld-linux/{print $1;}'`
 				case $ld_linux in /lib/ld-linux.so*)
 					AC_MSG_RESULT($ld_linux)
-					ERROR_UNDEFINED="-Wl,--no-undefined"
 					SHARED_LIBS="$SHARED_LIBS $ld_linux"
 					SHARED_LIBS_SH="$SHARED_LIBS_SH $ld_linux"
 					;;
@@ -2268,6 +2277,9 @@
 					AC_MSG_RESULT(no)
 					;;
 				esac
+			else
+				AC_MSG_RESULT(no)
+			fi
 			rm -f conftest*
 			;;
 		*)
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list