[m-rev.] configure.in: lcc "-Wl" versus "-Wl,"

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Aug 5 19:14:52 AEST 2003


Estimated hours taken: 1.5
Branches: main, release

configure.in:
	Change the definition of LD_STATIC_FLAGS for lcc
	so that we check whether lcc's -Wl option requires
	a comma after it.  This check is needed because lcc 4.1
	requires the comma, but lcc 4.2 does not permit the comma.
	Also, print out the value of LD_STATIC_FLAGS in configure.log.

Workspace: /home/mars/fjh/ws4/mercury
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.372
diff -u -d -r1.372 configure.in
--- configure.in	5 Aug 2003 08:31:42 -0000	1.372
+++ configure.in	5 Aug 2003 09:09:58 -0000
@@ -3091,12 +3091,28 @@
 		# for other OSs too)
 		case $COMPILER in
 		gcc)
-			LD_STATIC_FLAGS="-static \
-				-Wl-defsym -Wl_DYNAMIC=0"
+			LD_STATIC_FLAGS="-static -Wl-defsym -Wl_DYNAMIC=0"
 			;;
 		lcc)
-			LD_STATIC_FLAGS="-static \
-				-Wl,-defsym -Wl,_DYNAMIC=0"
+			# for lcc 4.1, we need to use "-Wl,".
+			# for lcc 4.2, we need to use "-Wl" without the comma,
+			# like we do for gcc.
+			AC_MSG_CHECKING(whether lcc requires comma after -Wl)
+			LD_STATIC_FLAGS="-static -Wl-defsym -Wl_DYNAMIC=0"
+			rm -f conftest*
+			echo "int main() { return 0; }" > conftest.c
+			if
+				echo $CC $LD_STATIC_FLAGS conftest.c \
+					>&AC_FD_CC 2>&1 &&
+				$CC $LD_STATIC_FLAGS conftest.c \
+					>&AC_FD_CC 2>&1
+			then
+				AC_MSG_RESULT(no)
+			else
+				AC_MSG_RESULT(yes)
+			        LD_STATIC_FLAGS="-static -Wl,-defsym -Wl,_DYNAMIC=0"
+			fi
+			rm -f conftest*
 			;;
 		esac
 		;;
@@ -3113,6 +3129,11 @@
 		esac
 		;;
 esac
+# we can't put the call to MSG_CHECKING at the start of the case statement
+# above, because of the nested check in the lcc case.  So we just put it
+# here immediately before the MSG_RESULT call.
+AC_MSG_CHECKING(options for static linking)
+AC_MSG_RESULT($LD_STATIC_FLAGS)
 case "$LD_STATIC_FLAGS" in "")
 	AC_MSG_WARN(
 [\`mmc --linkage static' and \`ml --static' not implemented with

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