From 287e868e21e39bbb214cc11542103660bbad8ada Mon Sep 17 00:00:00 2001 From: Simon Taylor Date: Thu, 15 May 2003 07:23:45 +0000 Subject: [PATCH] Make it easier to boostrap the addition of new configuration Estimated hours taken: 0.5 Branches: main Make it easier to boostrap the addition of new configuration options. scripts/Mercury.config.bootstrap.in: A version of Mercury.config.in that does not contain any options which are not understood by the installed compilers. This is used when building the stage1 compiler. Mercury.config is used to build the stage2 and stage3 compilers, and when running the tests. Mercury.config is installed by `mmake install'. Mercury.config.bootstrap.in is currently the same as Mercury.config.in. Mmake.workspace: tools/bootcheck: tools/binary_step: tools/lmc.in: Work out which configuration file to use. configure.in: scripts/Mmakefile: scripts/mercury_config.in: Handle Mercury.config.bootstrap. --- Mmake.workspace | 6 +- configure.in | 3 +- scripts/Mercury.config.bootstrap.in | 92 +++++++++++++++++++++++++++++ scripts/Mercury.config.in | 3 + scripts/Mmakefile | 2 +- scripts/mercury_config.in | 1 + tools/binary_step | 3 + tools/bootcheck | 6 ++ tools/lmc.in | 2 +- 9 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 scripts/Mercury.config.bootstrap.in diff --git a/Mmake.workspace b/Mmake.workspace index d9a499dde..353e94f32 100644 --- a/Mmake.workspace +++ b/Mmake.workspace @@ -98,7 +98,11 @@ MTAGSFLAGS += $(EXTRA_MTAGSFLAGS) VPATH = $(LIBRARY_DIR) -MCFLAGS += --config-file $(SCRIPTS_DIR)/Mercury.config +ifeq ($(origin MERCURY_CONFIG_FILE),undefined) +MERCURY_CONFIG_FILE = $(SCRIPTS_DIR)/Mercury.config.bootstrap +endif + +MCFLAGS += --config-file $(MERCURY_CONFIG_FILE) ifeq ($(MMAKE_USE_MMC_MAKE),yes) MCFLAGS += --options-file $(WORKSPACE)/Mercury.options diff --git a/configure.in b/configure.in index 6735a12f0..509f6b5ca 100644 --- a/configure.in +++ b/configure.in @@ -3574,7 +3574,8 @@ scripts/mercury.bat scripts/mprof scripts/mercury_update_interface scripts/mgnuc scripts/parse_ml_options.sh-subr scripts/ml scripts/c2init scripts/mmake scripts/mdb scripts/mdbrc scripts/mdprof scripts/mkfifo_using_mknod bindist/bindist.INSTALL bindist/bindist.Makefile -scripts/mercury_config scripts/Mercury.config tools/lmc tools/dotime +scripts/mercury_config scripts/Mercury.config scripts/Mercury.config.bootstrap +tools/lmc tools/dotime , [ # Only do this when compiling the source, not when reconfiguring diff --git a/scripts/Mercury.config.bootstrap.in b/scripts/Mercury.config.bootstrap.in new file mode 100644 index 000000000..65c851fc4 --- /dev/null +++ b/scripts/Mercury.config.bootstrap.in @@ -0,0 +1,92 @@ +#! /bin/sh +# @configure_input@ +#---------------------------------------------------------------------------# +# Copyright (C) 2003 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.config.bootstrap +# +# Configuration file for the Melbourne Mercury Compiler. +# +# This file is used instead of Mercury.config when building the +# stage1 compiler. It should only refer to options which are +# understood by the installed compilers. +# +# Environment variables: MERCURY_STDLIB_DIR, MERCURY_C_COMPILER, +# MERCURY_DEFAULT_GRADE, MERCURY_DEFAULT_OPT_LEVEL. + +# These settings won't override settings in the environment. +MERCURY_STDLIB_DIR=@LIBDIR@ +MERCURY_DEFAULT_OPT_LEVEL=-O2 +MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@ +MERCURY_C_COMPILER=@CC@ +MERCURY_MATH_LIB=@MATH_LIB@ +# $(MATH_LIB) needs to be defined because it may +# be used by the substitution for SHARED_LIBS. +MATH_LIB=$(MERCURY_MATH_LIB) + +DEFAULT_MERCURY_LINKAGE=@DEFAULT_LINKAGE@ + +# The default optimization level should be after +# all the options that describe the machine configuration. +DEFAULT_MCFLAGS=\ + @ALL_LOCAL_C_INCL_DIR_MMC_OPTS@ \ + @ALL_LOCAL_C_LIB_DIR_MMC_OPTS@ \ + --cc "$(MERCURY_C_COMPILER)" \ + --grade "$(MERCURY_DEFAULT_GRADE)" \ + --cflags-for-ansi "@CFLAGS_FOR_ANSI@" \ + --cflags-for-optimization "@CFLAGS_FOR_OPT@" \ + --cflags-for-warnings "@CFLAGS_FOR_WARNINGS@" \ + --cflags-for-threads "@CFLAGS_FOR_THREADS@" \ + --cflags-for-debug "@CFLAGS_FOR_DEBUG@" \ + --cflags-for-regs "@CFLAGS_FOR_REGS@" \ + --cflags-for-gotos "@CFLAGS_FOR_GOTOS@" \ + --cflags-for-pic "@CFLAGS_FOR_PIC@" \ + --c-flag-to-name-object-file "@OBJFILE_OPT@" \ + --object-file-extension ".@OBJ_SUFFIX@" \ + --pic-object-file-extension ".@EXT_FOR_PIC_OBJECTS@" \ + --link-with-pic-object-file-extension ".@EXT_FOR_LINK_WITH_PIC_OBJECTS@" \ + --executable-file-extension "@EXT_FOR_EXE@" \ + --shared-library-extension ".@EXT_FOR_SHARED_LIB@" \ + --library-extension ".@LIB_SUFFIX@" \ + --create-archive-command "@AR@" \ + --create-archive-command-output-flag "@AR_LIBFILE_OPT@" \ + --create-archive-command-flags "@ARFLAGS@" \ + --ranlib-command "@RANLIB@" \ + --link-executable-command "@LINK_EXE@" \ + --link-shared-lib-command "@LINK_SHARED_OBJ@" \ + --trace-libs "@TRACE_LIBS_SYSTEM@" \ + --thread-libs "@THREAD_LIBS@" \ + --shared-libs "@SHARED_LIBS@" \ + --math-lib "@MATH_LIB@" \ + --readline-libs "@READLINE_LIBRARIES@" \ + --linker-thread-flags "@LDFLAGS_FOR_THREADS@" \ + --shlib-linker-thread-flags "@LD_LIBFLAGS_FOR_THREADS@" \ + --linker-trace-flags "@LDFLAGS_FOR_TRACE@" \ + --shlib-linker-trace-flags "@LD_LIBFLAGS_FOR_TRACE@" \ + --linker-static-flags "@LD_STATIC_FLAGS@" \ + --linker-strip-flag "@LD_STRIP_FLAG@" \ + --linker-debug-flags "@LDFLAGS_FOR_DEBUG@" \ + --shlib-linker-debug-flags "@LD_LIBFLAGS_FOR_DEBUG@" \ + --linker-rpath-flag "@EXE_RPATH_OPT@" \ + --linker-rpath-separator "@EXE_RPATH_SEP@" \ + --shlib-linker-rpath-flag "@SHLIB_RPATH_OPT@" \ + --shlib-linker-rpath-separator "@SHLIB_RPATH_SEP@" \ + --linker-allow-undefined-flag "@ALLOW_UNDEFINED@" \ + --linker-error-undefined-flag "@ERROR_UNDEFINED@" \ + --fullarch "@FULLARCH@" \ + --install-prefix "@prefix@" \ + --num-real-r-regs "@NUM_REAL_R_REGS@" \ + --num-real-r-temps "@NUM_REAL_R_TEMPS@" \ + --conf-low-tag-bits "@LOW_TAG_BITS@" \ + --bits-per-word "@BITS_PER_WORD@" \ + --bytes-per-word "@BYTES_PER_WORD@" \ + --dotnet-library-version "@MS_DOTNET_LIBRARY_VERSION@" \ + @HAVE_DELAY_SLOT@ \ + @HAVE_BOXED_FLOATS@ \ + @MCFLAGS_FOR_CC@ \ + $(MERCURY_DEFAULT_OPT_LEVEL) \ + @LIBGRADE_OPTS@ + diff --git a/scripts/Mercury.config.in b/scripts/Mercury.config.in index a89a73dbd..f8c46800c 100644 --- a/scripts/Mercury.config.in +++ b/scripts/Mercury.config.in @@ -10,6 +10,9 @@ # # Configuration file for the Melbourne Mercury Compiler. # +# Note to developers: when updating this file consider whether +# Mercury.config.bootstrap.in should also be updated. +# # Environment variables: MERCURY_STDLIB_DIR, MERCURY_C_COMPILER, # MERCURY_DEFAULT_GRADE, MERCURY_DEFAULT_OPT_LEVEL. diff --git a/scripts/Mmakefile b/scripts/Mmakefile index c6bb9e2d7..d31f4fff5 100644 --- a/scripts/Mmakefile +++ b/scripts/Mmakefile @@ -34,7 +34,7 @@ EMACS_SCRIPTS = gud.el .PHONY: all all: $(SCRIPTS) $(DEBUGGER_SCRIPTS) $(EMACS_SCRIPTS) -all: Mmake.vars Mercury.config +all: Mmake.vars Mercury.config Mercury.config.bootstrap #-----------------------------------------------------------------------------# diff --git a/scripts/mercury_config.in b/scripts/mercury_config.in index cb6cba033..f71769600 100644 --- a/scripts/mercury_config.in +++ b/scripts/mercury_config.in @@ -126,6 +126,7 @@ cp -r $input_libdir/reconf/* $TMPDIR || exit 1 mkdir $TMPDIR/bindist || exit 1 # The configure script tries to process these files, but they won't be used. +touch $TMPDIR/scripts/Mercury.config.bootstrap.in || exit 1 touch $TMPDIR/Mmake.common.in $TMPDIR/bindist/bindist.INSTALL.in || exit 1 touch $TMPDIR/bindist/bindist.Makefile.in || exit 1 diff --git a/tools/binary_step b/tools/binary_step index 86f760a39..036db95d3 100755 --- a/tools/binary_step +++ b/tools/binary_step @@ -148,6 +148,9 @@ root=`/bin/pwd` MERCURY_COMPILER=$root/compiler/mercury_compile export MERCURY_COMPILER +MERCURY_CONFIG_FILE=$root/scripts/Mercury.config +export MERCURY_CONFIG_FILE + MMAKE_VPATH=. export MMAKE_VPATH MMAKE_DIR=../scripts diff --git a/tools/bootcheck b/tools/bootcheck index 99c089ba3..a8e4b0073 100755 --- a/tools/bootcheck +++ b/tools/bootcheck @@ -457,6 +457,9 @@ then MERCURY_COMPILER=$root/compiler/mercury_compile export MERCURY_COMPILER + MERCURY_CONFIG_FILE=$root/scripts/Mercury.config + export MERCURY_CONFIG_FILE + [ -d stage2 ] || mkdir stage2 if $keep_stage_2 then @@ -1047,6 +1050,9 @@ then MERCURY_COMPILER=$root/stage2/compiler/mercury_compile export MERCURY_COMPILER + MERCURY_CONFIG_FILE=$root/scripts/Mercury.config + export MERCURY_CONFIG_FILE + if test "$test_grade" = "$grade" then stage2_insert="/stage2" diff --git a/tools/lmc.in b/tools/lmc.in index be817f2b2..ecc1ef27d 100755 --- a/tools/lmc.in +++ b/tools/lmc.in @@ -108,4 +108,4 @@ fi PATH="$WORKSPACE/scripts:$WORKSPACE/util:$PATH" export PATH -exec mmc --no-mercury-stdlib-dir -I $WORKSPACE/library -I $WORKSPACE/analysis $CDEBUG_FLAGS $C_FLAGS $INIT_FLAGS $LIB_FLAGS "$@" +exec mmc --no-mercury-stdlib-dir --config-file $WORKSPACE/scripts/Mercury.config -I $WORKSPACE/library -I $WORKSPACE/analysis $CDEBUG_FLAGS $C_FLAGS $INIT_FLAGS $LIB_FLAGS "$@"