[m-rev.] for review: Mercury.config*.in

Julien Fischer jfischer at opturion.com
Tue Jun 24 11:55:42 AEST 2025


On Mon, 23 Jun 2025 at 20:57, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:

> Make Mercury.config.* more readable.
>
> scripts/Mercury.config.in:
> scripts/Mercury.config.bootstrap.in:
>     Use spaces for indentation instead of tabs.
>
>     List all the environment variables in lexicographic order.
>     Sort the big groups.
>
>     Put the options in the definitions of DEFAULT_MCFLAGS into
>     logical groups, indicated by indentation.
>
>     Note the differences between the two files. Add an XXX that asks
>     which are intentional, and which are not.
>

...

> diff --git a/scripts/Mercury.config.in b/scripts/Mercury.config.in
> index dd422fe7b..db1971397 100644
> --- a/scripts/Mercury.config.in
> +++ b/scripts/Mercury.config.in

...

> @@ -14,13 +15,19 @@
>  #
>  # Configuration file for the Melbourne Mercury Compiler.
>  #
> -# Note to developers: when updating this file consider whether
> -# Mercury.config.bootstrap.in should also be updated.
> +# Note to developers: when updating this file, consider whether
> +# Mercury.config.bootstrap.in, which includes most of what is here,
> +# should also be updated.
>  #
> -# Environment variables: MERCURY_STDLIB_DIR, MERCURY_C_COMPILER,
> -# MERCURY_DEFAULT_GRADE, MERCURY_DEFAULT_OPT_LEVEL,
> -# MERCURY_JAVA_COMPILER, MERCURY_JAVA_INTERPRETER,
> -# MERCURY_CSHARP_COMPILER.
> +# Environment variables:
> +#
> +#   MERCURY_CSHARP_COMPILER
> +#   MERCURY_C_COMPILER,
> +#   MERCURY_DEFAULT_GRADE
> +#   MERCURY_DEFAULT_OPT_LEVEL
> +#   MERCURY_JAVA_COMPILER
> +#   MERCURY_JAVA_INTERPRETER
> +#   MERCURY_STDLIB_DIR
>
>  # These settings won't override settings in the environment.
>  MERCURY_STDLIB_DIR=@LIBDIR@
> @@ -39,8 +46,8 @@ MERCURY_TARGET_ARCH=@FULLARCH@
>  # be used by the substitution for SHARED_LIBS.
>  MATH_LIB=$(MERCURY_MATH_LIB)
>
> -# If you change these, you will also need to change the files indicated in
> -# scripts/c2init.in.
> +# If you change these, you will also need to change the files
> +# indicated in scripts/c2init.in.
>  RT_LIB_NAME=mer_rt
>  STD_LIB_NAME=mer_std
>
> @@ -48,6 +55,35 @@ DEFAULT_MERCURY_LINKAGE=@DEFAULT_LINKAGE@
>
>  DEFAULT_GRADEFLAGS=--grade "$(MERCURY_DEFAULT_GRADE)"
>
> +# XXX zs: Why is @SHLIB_USE_INSTALL_NAME@ treated differently?

Differently than what?

> +# Surely it cannot be the only autoconfigured string that may be empty.

On my Linux system, RESTRICT_COMMAND_LINE_OPT, HAVE_DELAY_SLOT,
MCFLAGS_FOR_CC and MMC_USE_SYMLINK_OPT are also empty.
(I guess there is a small advantage to them being empty in that getopt
doesn't have to process them.)

> +# Likewise for $(MERCURY_DEFAULT_OPT_LEVEL) in Mercury.config.bootstrap.in,
> +# though I can see the reason for that one.

> +
> +# XXX zs: All the differences between the values of DEFAULT_MCFLAGS
> +# in this file and in Mercury.config.bootstrap.in should be
> +# either documented, or erased. These differences include
> +#
> +#   --java-classpath (times two)

These were removed from Mercury.config in 2010, since they make the
assumption that
there is only one Java grade (there isn't).  They can be removed from
Mercury.config.bootstrap as well. They cannot affect anything in stage 1
as they are pointing to the *installation* directory and there won't be
any .jar files installed in that while stage 1 is being built.

> +#   --grade

DEFAULT_GRADEFLAGS should work for Mercury.config.boostrap as well.

> +#   --cflags-for-sanitizers
> +#   --cflags-for-lto
> +#   --strip-executable-command
> +#   --strip-executable-shared-flags
> +#   --strip-executable-static-flags
> +#   --hwloc-libs
> +#   --hwloc-static-libs
> +#   --linker-sanitizer-flags

I suspect Mercury.config.bootstrap was just not updated after these were added.
(Peter added the sanitizer stuff, so he's better placed to say for that.)

I don't

> +#   $INSTALL_METHOD_OPT@

I suspect I simply forgot to add INSTALL_METHOD_OPT to Mercury.config.bootstrap
after the change that added it had bootstrapped.

> +#   $LIBGRADE_OPTS@

LIBGRADE_OPTS was removed from Mercury.config so that the installed version of
the compiler detects what library grades are installed at runtime (at least if
you're not using mmake). This is so you can install extra library grades
later without having to modify the Mercury.config file.  I'm not sure if
Mercury.config.bootstrap requires it or not.

Julien.


More information about the reviews mailing list