[m-rev.] for review: fix `--use-subdirs' on Windows
Simon Taylor
stayl at cs.mu.OZ.AU
Thu May 22 13:41:33 AEST 2003
Estimated hours taken: 1
Branches: main
Don't create symlinks when installing with a Win32 version
of the compiler. The compiler won't know how to follow the
symlinks.
configure.in:
scripts/Mmake.vars.in:
scripts/Mercury.config.in:
compiler/modules.m:
When using `gcc -mno-cygwin' or MS Visual C++ to
build the compiler, don't create symlinks when installing.
compiler/options.m:
Add an option `--no-use-symlinks'.
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.366
diff -u -u -r1.366 configure.in
--- configure.in 19 May 2003 15:25:10 -0000 1.366
+++ configure.in 22 May 2003 02:50:28 -0000
@@ -617,6 +617,24 @@
AC_SUBST(CYGPATH)
#-----------------------------------------------------------------------------#
+# If we're producing a Win32 version of the compiler, don't use symlinks
+# when installing. The generated compiler executable will not be able to
+# follow them.
+MMC_USE_SYMLINKS_OPT=
+LN_S="ln -s"
+case "$host" in
+ *cygwin*)
+ case "$CC" in
+ # cl is the Microsoft C compiler
+ *gcc*-mno-cygwin* | *cl* | *CL*)
+ MMC_USE_SYMLINKS_OPT=--no-use-symlinks
+ LN_S=false ;;
+ esac ;;
+esac
+AC_SUBST(LN_S)
+AC_SUBST(MMC_USE_SYMLINKS_OPT)
+
+#-----------------------------------------------------------------------------#
# Microsoft.NET configuration
#
MERCURY_CHECK_DOTNET
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.271
diff -u -u -r1.271 modules.m
--- compiler/modules.m 17 May 2003 04:23:51 -0000 1.271
+++ compiler/modules.m 21 May 2003 15:20:48 -0000
@@ -1109,9 +1109,16 @@
make_symlink(LinkTarget, LinkName, Result) -->
io__output_stream(ErrorStream),
- { string__format("rm -f %s && ln -s %s %s",
- [s(LinkName), s(LinkTarget), s(LinkName)], Command) },
- invoke_shell_command(ErrorStream, verbose, Command, Result).
+ globals__io_lookup_bool_option(use_symlinks, SymLinks),
+ (
+ { SymLinks = yes },
+ { string__format("rm -f %s && ln -s %s %s",
+ [s(LinkName), s(LinkTarget), s(LinkName)], Command) },
+ invoke_shell_command(ErrorStream, verbose, Command, Result)
+ ;
+ { SymLinks = no },
+ { Result = no }
+ ).
copy_file(Source, Destination, Res) -->
io__open_binary_input(Source, SourceRes),
@@ -4465,13 +4472,13 @@
fi; \\
done
# The following is needed to support the `--use-subdirs' option
- # We try using `ln -s', but if that fails, then we just use
+ # We try using `$(LN_S)', but if that fails, then we just use
# `$(INSTALL)'.
for ext in int int2 int3", Int0Str, OptStr,
TransOptStr, DepStr, "; do \\
dir=""$(INSTALL_INT_DIR)/Mercury/$${ext}s""; \\
rm -f ""$$dir""; \\
- ln -s .. ""$$dir"" || { \\
+ $(LN_S) .. ""$$dir"" || { \\
{ [ -d ""$$dir"" ] || \\
$(INSTALL_MKDIR) ""$$dir""; } && \\
$(INSTALL) ""$(INSTALL_INT_DIR)""/*.$$ext \\
@@ -4507,12 +4514,12 @@
fi; \\
done
# The following is needed to support the `--use-subdirs' option
- # We try using `ln -s', but if that fails, then we just use
+ # We try using `$(LN_S)', but if that fails, then we just use
# `$(INSTALL)'.
for ext in ", OptStr, TransOptStr, "; do \\
dir=""$(INSTALL_GRADE_INT_DIR)/Mercury/$${ext}s""; \\
rm -f ""$$dir""; \\
- ln -s .. ""$$dir"" || { \\
+ $(LN_S) .. ""$$dir"" || { \\
{ [ -d ""$$dir"" ] || \\
$(INSTALL_MKDIR) ""$$dir""; } && \\
$(INSTALL) ""$(INSTALL_GRADE_INT_DIR)""/*.$$ext \\
@@ -4565,10 +4572,10 @@
$(INSTALL) $$hdr $(INSTALL_GRADE_INC_DIR); \\
done
# The following is needed to support the `--use-subdirs' option
- # We try using `ln -s', but if that fails, then we just use
+ # We try using `$(LN_S)', but if that fails, then we just use
# `$(INSTALL)'.
rm -f $(INSTALL_GRADE_INC_SUBDIR)
- ln -s .. $(INSTALL_GRADE_INC_SUBDIR) || { \\
+ $(LN_S) .. $(INSTALL_GRADE_INC_SUBDIR) || { \\
{ [ -d $(INSTALL_GRADE_INC_SUBDIR) ] || \\
$(INSTALL_MKDIR) $(INSTALL_GRADE_INC_SUBDIR); \\
} && \\
@@ -4576,7 +4583,7 @@
$(INSTALL_GRADE_INC_SUBDIR); \\
} || exit 1
rm -f $(INSTALL_INT_DIR)/Mercury/mihs
- ln -s .. $(INSTALL_INT_DIR)/Mercury/mihs || { \\
+ $(LN_S) .. $(INSTALL_INT_DIR)/Mercury/mihs || { \\
{ [ -d $(INSTALL_INT_DIR)/Mercury/mihs ] || \\
$(INSTALL_MKDIR) \\
$(INSTALL_INT_DIR)/Mercury/mihs; \\
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.411
diff -u -u -r1.411 options.m
--- compiler/options.m 10 May 2003 05:03:53 -0000 1.411
+++ compiler/options.m 21 May 2003 15:20:36 -0000
@@ -632,6 +632,7 @@
; extra_init_command
; pre_link_command
; install_prefix
+ ; use_symlinks
; mercury_configuration_directory
; mercury_configuration_directory_special
; install_command
@@ -1240,6 +1241,7 @@
pre_link_command - maybe_string(no),
extra_init_command - maybe_string(no),
install_prefix - string("/usr/local/"),
+ use_symlinks - bool(yes),
% If `--mercury-stdlib-dir' is set, `--mercury-config-dir'
% must also be set. This invariant is maintained by the
@@ -1899,6 +1901,7 @@
mercury_configuration_directory_special).
long_option("install-prefix", install_prefix).
long_option("install-command", install_command).
+long_option("use-symlinks", use_symlinks).
long_option("library-grade", libgrades).
long_option("libgrade", libgrades).
long_option("options-file", options_files).
@@ -3925,6 +3928,11 @@
"\tare substituted as for the `--pre-link-command' option.",
"--install-prefix <dir>",
"\tThe directory under which to install Mercury libraries.",
+
+ % --use-symlinks is only used by Mercury.config.
+ % It controls whether the build system should attempt
+ % to use symlinks.
+
"--install-command <command>",
"\tSpecify the command to use to install the files in",
"\tMercury libraries. The given command will be invoked as",
Index: scripts/Mercury.config.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mercury.config.in,v
retrieving revision 1.5
diff -u -u -r1.5 Mercury.config.in
--- scripts/Mercury.config.in 15 May 2003 07:23:43 -0000 1.5
+++ scripts/Mercury.config.in 21 May 2003 15:11:11 -0000
@@ -87,5 +87,6 @@
@HAVE_BOXED_FLOATS@ \
@MCFLAGS_FOR_CC@ \
$(MERCURY_DEFAULT_OPT_LEVEL) \
+ @MMC_USE_SYMLINKS_OPT@ \
@LIBGRADE_OPTS@
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.90
diff -u -u -r1.90 Mmake.vars.in
--- scripts/Mmake.vars.in 19 May 2003 03:21:35 -0000 1.90
+++ scripts/Mmake.vars.in 21 May 2003 15:14:02 -0000
@@ -740,6 +740,12 @@
#-----------------------------------------------------------------------------#
+# The command to use to make symlinks, `false' if we shouldn't use
+# symlinks (e.g. because Windows executables don't understand them).
+LN_S = @LN_S@
+
+#-----------------------------------------------------------------------------#
+
# We need to use $(empty_string) here to prevent Make from truncating
# any trailing spaces in @OBJFILE_OPT@
empty_string=
--------------------------------------------------------------------------
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