[m-dev.] diff: fix bugs in scripts/ml.in

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Dec 9 18:36:06 AEDT 2000


Estimated hours taken: 1

scripts/ml.in:
	Fix a couple of bugs:
	- it was using $compiler instead of $COMPILER
	- it was assuming that compilers other than gcc and lcc understand
	  the `-static' option

Workspace: /home/pgrad/fjh/ws/hg
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.87
diff -u -d -r1.87 ml.in
--- scripts/ml.in	2000/12/01 03:22:21	1.87
+++ scripts/ml.in	2000/12/09 07:20:42
@@ -54,6 +54,9 @@
     *cl* | *CL*)
 	COMPILER=cl
 	;;
+    cc* | */cc*)
+	COMPILER=cc
+	;;
     *)
 	COMPILER=unknown
 	;;
@@ -391,6 +394,10 @@
 # Defaults have been set, now set options.
 
 case $all_libs in static)
+	case $COMPILER in gcc|lcc)
+		MAYBE_STATIC_OPT=-static
+		;;
+	esac
 	case $FULLARCH in
 		*-linux*)
 			# On Linux, if we're linking statically, we need to
@@ -399,18 +406,36 @@
 			# boehm_gc/dyn_load.c.
 			# (We might eventually need similar treatment
 			# for other OSs too)
-			case $compiler in
-			gcc)
-			    MAYBE_STATIC_OPT="-static -Wl-defsym -Wl_DYNAMIC=0"
-			    ;;
+			case $COMPILER in
+	 		gcc)
+				MAYBE_STATIC_OPT="-static \
+					-Wl-defsym -Wl_DYNAMIC=0"
+				;;
 			lcc)
-			    MAYBE_STATIC_OPT="-static -Wl,-defsym -Wl,_DYNAMIC=0"
-			    ;;
+				MAYBE_STATIC_OPT="-static \
+					-Wl,-defsym -Wl,_DYNAMIC=0"
+				;;
 			esac
 			;;
-		*)
-			MAYBE_STATIC_OPT=-static
+		alpha*-dec-osf*)
+			case $COMPILER in cc)
+				MAYBE_STATIC_OPT=-non_shared
+				;;
+			esac
+			;;
+		*-sun-solaris*)
+			case $COMPILER in cc)
+				MAYBE_STATIC_OPT="-B static"
+				;;
+			esac
 			;;
+	esac
+	case "$MAYBE_STATIC_OPT" in "")
+		echo "ml: warning: \`--static' ignored, since I don't" 1>&2
+		echo "	know how to enable static linking with this" 1>&2
+		echo "	C compiler (\`$CC')." 1>&2
+		echo "	Using \`--mercury-libs static' instead." 1>&2
+		;;
 	esac
 esac
 

-- 
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