[m-rev.] diff: fix mmc --make's handling of ranlib

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Nov 2 17:26:40 AEDT 2006


I'll commit this on the release branch tomorrow after saturn has
installed a compiler that supports `--ranlib-flags' (all the machines
currently building the release branch will support this then).

I won't commit it on the main branch until late next week in order
to give everyone a chance to install a new compiler that supports
`--ranlib-flags'.

Estimated hours taken: 1.5
Branches: main, release

Fix a bug in mmc --make's handling of ranlib.

configure.in:
 	Set the value of RANLIBFLAGS.
 	On most systems it will be empty; on Mac OS X it needs to be set
 	to "-c".

 	Check that the installed compiler supports the `--ranlib-flags'
 	option.

compiler/make.program_target.m:
 	Fix the problem with the quoting in the command line used to
 	invoke ranlib on Mac OS X by using the recently introduced
 	`--ranlib-flags' option.

 	Remove the workaround for this bug.

scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
 	Set the default value of the `--ranlib-flags' option.

scripts/Mmake.vars.in:
scripts/Mmake.rules:
 	Have mmake conform to the new way of handling flags for
 	ranlib.

Julien.

Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.449.2.11
diff -u -r1.449.2.11 configure.in
--- configure.in	18 Aug 2006 07:50:17 -0000	1.449.2.11
+++ configure.in	2 Nov 2006 06:13:23 -0000
@@ -375,6 +375,7 @@
  			--record-term-sizes-as-words \
  			--output-grade-string \
  			--shlib-linker-install-name-flag "-dummy_flag" \
+			--ranlib-flags "" \
  			</dev/null >&AC_FD_CC 2>&1
  	then
  		AC_MSG_RESULT(yes)
@@ -812,6 +813,7 @@

  		# MS doesn't use a ranlib.
  	RANLIB="echo"
+	RANLIBFLAGS=""
  	AC_SUBST(RANLIB)
  else
  	# Use Unix-style file names and command-line options
@@ -855,6 +857,7 @@
  	FIX_PATH_FOR_CC=echo

  	AC_PROG_RANLIB
+	RANLIBFLAGS=""

  	# On MacOS 10.1 (and other MacOS systems?),
  	# we need to pass the `-c' option to ranlib.
@@ -864,12 +867,12 @@
  	# that brain-damaged and non-standard-conforming mode the default?

  	case "$host" in *-apple-darwin*)
-		RANLIB="$RANLIB -c"
-		AC_SUBST(RANLIB)
+		RANLIBFLAGS="-c"
  		;;
  	esac
  fi

+AC_SUBST(RANLIBFLAGS)
  AC_SUBST(OBJFILE_OPT)
  AC_SUBST(AR)
  AC_SUBST(ARFLAGS)
Index: compiler/make.program_target.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.program_target.m,v
retrieving revision 1.47.2.3
diff -u -r1.47.2.3 make.program_target.m
--- compiler/make.program_target.m	1 Nov 2006 04:47:10 -0000	1.47.2.3
+++ compiler/make.program_target.m	2 Nov 2006 06:03:50 -0000
@@ -1230,26 +1230,13 @@
              io.write_string(InstallDir, !IO),
              io.nl(!IO)
          ), !IO),
-    globals.io_lookup_string_option(ranlib_command, RanLibCommand0, !IO),
-    %
-    % XXX: because some systems, e.g. Mac OS X, need to invoke ranlib 
-    % with an option we need to break the ranlib command up in order to get
-    % the quoting correct, e.g. we want
-    % 
-    %   "ranlib" "-c" <archive>
-    %
-    % rather than
-    %
-    %   "ranlib -c" <archive>
-    %
-    % on such systems. 
-    % 
-    % This is just a workaround until the change to introduce a separate
-    % `--ranlib-flags' option has bootstrapped.
-    % 
-    RanLibCommand = string.words(RanLibCommand0),
-    Command = string.join_list("    ", list.map(quote_arg,
-        RanLibCommand ++ [ InstallDir / FileName ])),
+    globals.io_lookup_string_option(ranlib_command, RanLibCommand, !IO),
+    globals.io_lookup_string_option(ranlib_flags, RanLibFlags, !IO),
+    Command = string.join_list("    ", [
+        quote_arg(RanLibCommand),
+        RanLibFlags,
+        quote_arg(InstallDir / FileName)
+    ]),
      io.output_stream(OutputStream, !IO),
      invoke_system_command(OutputStream, verbose, Command, Succeeded, !IO).

Index: scripts/Mercury.config.bootstrap.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/Mercury.config.bootstrap.in,v
retrieving revision 1.5
diff -u -r1.5 Mercury.config.bootstrap.in
--- scripts/Mercury.config.bootstrap.in	19 Oct 2004 06:01:38 -0000	1.5
+++ scripts/Mercury.config.bootstrap.in	2 Nov 2006 04:52:45 -0000
@@ -72,6 +72,7 @@
  		--create-archive-command-output-flag "@AR_LIBFILE_OPT@" \
  		--create-archive-command-flags "@ARFLAGS@" \
  		--ranlib-command "@RANLIB@" \
+		--ranlib-flags "@RANLIBFLAGS@" \
  		--link-executable-command "@LINK_EXE@" \
  		--link-shared-lib-command "@LINK_SHARED_OBJ@" \
  		--trace-libs "@TRACE_LIBS_SYSTEM@" \
Index: scripts/Mercury.config.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/Mercury.config.in,v
retrieving revision 1.13.2.3
diff -u -r1.13.2.3 Mercury.config.in
--- scripts/Mercury.config.in	18 Aug 2006 07:50:16 -0000	1.13.2.3
+++ scripts/Mercury.config.in	2 Nov 2006 04:52:26 -0000
@@ -73,6 +73,7 @@
  		--create-archive-command-output-flag "@AR_LIBFILE_OPT@" \
  		--create-archive-command-flags "@ARFLAGS@" \
  		--ranlib-command "@RANLIB@" \
+		--ranlib-flags "@RANLIBFLAGS@" \
  		--link-executable-command "@LINK_EXE@" \
  		--link-shared-lib-command "@LINK_SHARED_OBJ@" \
  		--trace-libs "@TRACE_LIBS_SYSTEM@" \
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.150
diff -u -r1.150 Mmake.rules
--- scripts/Mmake.rules	24 Feb 2006 07:11:20 -0000	1.150
+++ scripts/Mmake.rules	2 Nov 2006 06:11:53 -0000
@@ -487,7 +487,7 @@
  			lib%.install_opts
  	$(INSTALL) `vpath_find lib$*.$A lib$*.$(EXT_FOR_SHARED_LIB)` \
  			$(INSTALL_MERC_LIB_DIR)
-	$(RANLIB) $(INSTALL_MERC_LIB_DIR)/lib$*.$A
+	$(RANLIB) $(RANLIBFLAGS) $(INSTALL_MERC_LIB_DIR)/lib$*.$A

  # XXX grade_files only contains the files for the default grade, not the
  # current grade in each iteration of the loop over ALL_LIBGRADES below.
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.102.2.1
diff -u -r1.102.2.1 Mmake.vars.in
--- scripts/Mmake.vars.in	23 May 2006 06:46:54 -0000	1.102.2.1
+++ scripts/Mmake.vars.in	2 Nov 2006 04:56:37 -0000
@@ -380,7 +380,7 @@

  RANLIB		= @RANLIB@
  ALL_RANLIBFLAGS	= $(RANLIBFLAGS) $(EXTRA_RANLIBFLAGS) $(TARGET_RANLIBFLAGS)
-RANLIBFLAGS	=
+RANLIBFLAGS	= @RANLIBFLAGS@
  EXTRA_RANLIBFLAGS =

  # List of grades to install for a library

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list