[m-rev.] for review: support 'mercury' as a synonym for 'mmc' on all platforms

Julien Fischer jfischer at opturion.com
Tue Jun 16 16:15:52 AEST 2020


Any takers to review this one?

Julien.

On Sat, 13 Jun 2020, Julien Fischer wrote:

>
> For review by anyone.
>
> Branches: master, 20.06
>
>
> Support 'mercury' as a synonym for 'mmc' on all platforms.
>
> On Windows the name 'mmc' is also used for the executable for Microsoft
> Management Console.  For the MSVC port on the Windows command line we have 
> long
> provided a batch file named 'mercury' as an alternative to 'mmc' in
> order to avoid this clash.  (Re-arranging your PATH to avoid the clash
> is not always an option.)
>
> Provide a shell script named 'mercury' that serves the same purpose 
> elsewhere.
> Its main use is to avoid the name clash on MinGW/MSYS, Cygwin etc., but
> making the name available everywhere should avoid unnecessary changes in 
> build
> scripts and alike.
>
> Document the issue with the name clash in the appropriate chapter of the 
> user's
> guide and also in the top-level Windows README file.
>
> scripts/mercury.in:
>      Add a template for the 'mercury' script.
>
> configure.ac:
>      Create the 'mercury' wrapper script.
>
> scripts/Mmakefile:
>      Add 'mercury' to the list of scripts.
>
> doc/user_guide.texi:
>      Add a paragraph describing the 'mmc' name clash on Windows and what
>      to do about it.
>
>     Unrelated change: ':' is no longer a module qualifier.
>
> README.MS-Windows:
>      Point users to the relevant chapter of the user's guide for ways
>      to deal with the `mmc' name clash.
>
> NEWS:
>      Announce the addition.
>
> Julien.
>
> diff --git a/NEWS b/NEWS
> index ad3dd94..e2905d0 100644
> --- a/NEWS
> +++ b/NEWS
> @@  -239,6 +239,12 @@ Changes to the Mercury standard library
>  Changes to the Mercury compiler
>  -------------------------------
>
> +### Alternative script to invoke the compiler
> +
> +* We have added an alternative script, `mercury`, to use when invoking the
> +  compiler on systems where the usual name, `mmc`, clashes with other
> +  executables.
> +
>  ### Changes to the treatment of unused imports
>
> * The compiler now generates warnings for `:- import_module` and
> diff --git a/README.MS-Windows b/README.MS-Windows
> index 5b11d8e..1296151 100644
> --- a/README.MS-Windows
> +++ b/README.MS-Windows
> @@  -41,3 +41,12 @@ Building Mercury for Windows on Linux
>
>  Alternatively, you can cross-compile Mercury on Linux with a MinGW
>  cross-compiler.  See README.MinGW-cross.
> +
> +------------------------
> +Using Mercury on Windows
> +------------------------
> +
> +On Windows systems the usual name for the Mercury compiler, mmc, conflicts 
> with
> +the name of the executable for the Microsoft Management Console.  See the
> +"Using the Mercury compiler" chapter of the Mercury Users's Guide for how to
> +deal with this.
> diff --git a/configure.ac b/configure.ac
> index 63bb026..32c5918 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@  -5702,6 +5702,7 @@ export had_old_conf_h
>  executable_output_files='
>  scripts/mmc
>  scripts/mercury.bat
> +scripts/mercury
>  scripts/mprof
>  scripts/mprof.bat
>  scripts/mercury_update_interface
> diff --git a/doc/user_guide.texi b/doc/user_guide.texi
> index 03c2174..97e9618 100644
> --- a/doc/user_guide.texi
> +++ b/doc/user_guide.texi
> @@  -245,6 +245,7 @@ act like a library archive.
>
> @ node Using mmc
> @ chapter Using the Mercury compiler
> + at cindex Microsoft Management Console
>
>  Following a long Unix tradition,
>  the Mercury compiler is called @samp{mmc}
> @@  -253,8 +254,15 @@ the Mercury compiler is called @samp{mmc}
>  Some of its options (e.g.@: @samp{-c}, @samp{-o}, and @samp{-I})
>  have a similar meaning to that in other Unix compilers.
>
> +(Note that on Microsoft Windows systems the name @samp{mmc} is also used by 
> the
> +executable for the Microsoft Management Console.
> +To avoid the name clash on these systems you can either invoke the
> +Mercury compiler by the alternative name @samp{mercury} or adjust your
> + at env{PATH} to ensure that the @file{bin} directory precedes the Windows 
> system
> +directory.)
> +
> Arguments to @samp{mmc} may be either file names (ending in @samp{.m}),
> -or module names, with @samp{.} (rather than @samp{__} or @samp{:})
> +or module names, with @samp{.} (rather than @samp{__})
>  as the module qualifier.  For a module name such as @samp{foo.bar.baz},
>  the compiler will look for the source in the file named
>  @file{foo.bar.baz.m}.
>  To make the compiler look for a module in another file,
> diff --git a/scripts/Mmakefile b/scripts/Mmakefile
> index fc288bf..13d17d1 100644
> --- a/scripts/Mmakefile
> +++ b/scripts/Mmakefile
> @@  -26,6 +26,7 @@ CONF_SCRIPTS = \
> 	 mdb \
> 	 mdb.bat \
> 	 mdprof \
> +	mercury \
> 	 mercury.bat \
> 	 mercury_config \
> 	 mercury_update_interface \
> diff --git a/scripts/mercury.in b/scripts/mercury.in
> index e69de29..dd49c0f 100644
> --- a/scripts/mercury.in
> +++ b/scripts/mercury.in
> @@  -0,0 +1,33 @@
> +#! /bin/sh
> +# @configure_input@
> +#---------------------------------------------------------------------------#
> +# Copyright (C) 1994-1998, 2000-2005 The University of Melbourne.
> +# This file may only be copied under the terms of the GNU General
> +# Public License - see the file COPYING in the Mercury distribution.
> +#---------------------------------------------------------------------------#
> +#
> +# mercury - Melbourne Mercury Compiler.
> +#
> +# Use `mercury -h' for help.
> +#
> +# Environment variables: MERCURY_STDLIB_DIR, MERCURY_CONFIG_DIR,
> +# MERCURY_COMPILER, MERCURY_C_COMPILER, MERCURY_DEFAULT_GRADE,
> +# MERCURY_DEFAULT_OPT_LEVEL.
> +
> +prefix=@prefix@
> +exec_prefix=@exec_prefix@
> +MERCURY_COMPILER=${MERCURY_COMPILER-"@bindir@/mercury_compile"}
> +MERCURY_CONFIG_DIR=${MERCURY_CONFIG_DIR-${MERCURY_STDLIB_DIR-'@CONFIG_LIBDIR@'}}
> +export MERCURY_COMPILER MERCURY_CONFIG_DIR
> +
> +# Set the MACOSX_DEPLOYMENT_TARGET environment variable if needed.
> + at SET_MACOSX_DEPLOYMENT_TARGET@
> +
> +case $# in
> +	0)
> +        @MMC_INVOKE_CMD@ ${MERCURY_COMPILER}
> +        ;;
> +	*)
> +        @MMC_INVOKE_CMD@ ${MERCURY_COMPILER} "$@"
> +        ;;
> +esac
>
>
>


More information about the reviews mailing list