for review: add support for `-L' to ml

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Feb 18 13:19:36 AEDT 1998


Hi,

Tyson, can you please review this one?

scripts/ml.in:
	Add support for `-L' (`--lib-dir').
	`-L' options are basically just passed on to the system linker.

Index: ml.in
===================================================================
RCS file: /home/staff/zs/imp/mercury/scripts/ml.in,v
retrieving revision 1.37
diff -u -u -r1.37 ml.in
--- ml.in	1998/02/16 06:50:21	1.37
+++ ml.in	1998/02/18 02:14:18
@@ -40,6 +40,9 @@
 		libraries, not just the standard Mercury libraries.
 	--make-shared-lib
 		Produce a shared library, rather than an executable.
+	-L <directory>, --lib-dir <directory>
+		Include <directory> in the list of directories that the
+		linker will use to search for libraries.
 	-R <directory>, --shared-lib-dir <directory>
 		Include <directory> in the list of directories that the
 		dynamic linker will use to search for shared libraries.
@@ -154,7 +157,6 @@
 		;;
 	-shared|--shared)
 		all_libs=shared
-		MAYBE_STATIC_OPT=""
 		case $mercury_libs in static|default)
 			mercury_libs=shared ;;
 		esac
@@ -165,6 +167,14 @@
 			mercury_libs=static ;;
 		esac
 		;;
+	-L|--lib-dir)
+		dir="$2"
+		user_libdir_opts="$user_libdir_opts -L$dir"
+		shift
+		;;
+	-L*)
+		user_libdir_opts="$user_libdir_opts $1"
+		;;
 	-R|--shared-lib-dir)
 		dir="$2"
 		user_shlib_dirs="$user_shlib_dirs $dir"
@@ -318,10 +328,12 @@
 	;;
 esac
 
-LIBDIR_OPTS="
+merc_libdir_opts="\
 	-L$LIBDIR/$GRADE/$FULLARCH
 	-L$LIBDIR/$FULLARCH
 "
+LIBDIR_OPTS="$user_libdir_opts $merc_libdir_opts"
+
 case $mercury_libs in
 	shared)
 		LIBS=${MERCURY_LIBS="-lmercury -lmer $LIBGC $STDLIBS"}
@@ -336,7 +348,7 @@
 		merc_shlib_dirs=""
 		;;
 	none)	LIBS="$STDLIBS"
-		LIBDIR_OPTS=""
+		LIBDIR_OPTS="$user_libdir_opts"
 		merc_shlib_dirs=""
 		;;
 esac
@@ -386,11 +398,11 @@
 	case $demangle in
 	    false)
 		echo $LINKER $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
-			"$@" $LIBDIR_OPTS $RPATH_OPT_LIST $LIBS
+			$LIBDIR_OPTS $RPATH_OPT_LIST "$@" $LIBS
 		;;
 	    true)
 		echo $LINKER $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
-			"$@" $LIBDIR_OPTS $RPATH_OPT_LIST $LIBS "|"
+			$LIBDIR_OPTS $RPATH_OPT_LIST "$@" $LIBS "|"
 		echo "$DEMANGLER"
 		;;
 	esac
@@ -423,6 +435,6 @@
 case $# in
 	0) exec $LINKER $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
 		$LIBDIR_OPTS $RPATH_OPT_LIST $LIBS ;;
-	*) exec $LINKER $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS "$@" \
-		$LIBDIR_OPTS $RPATH_OPT_LIST $LIBS ;;
+	*) exec $LINKER $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS \
+		$LIBDIR_OPTS $RPATH_OPT_LIST "$@" $LIBS ;;
 esac

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list