Files
mercury/scripts/c2init.in
Simon Taylor dead626652 Allow Mercury runtime options to be set at compile time.
Estimated hours taken: 1.5
Branches: main

Allow Mercury runtime options to be set at compile time.

scripts/parse_ml_options.sh-subr.in:
	Add an initialization option `--runtime-flags'.

runtime/mercury_wrapper.h:
	Add a global variable MR_runtime_flags.

util/mkinit.c:
	Set MR_runtime_flags.

runtime/mercury_wrapper.c:
	Add the value of MR_runtime_flags to the dummy
	command line passed to getopt().

tests/hard_coded/Mmakefile:
	Use `--runtime-flags' rather than MERCURY_OPTIONS.
2002-01-13 10:13:20 +00:00

80 lines
2.2 KiB
Bash
Executable File

#! /bin/sh
# @configure_input@
#---------------------------------------------------------------------------#
# Copyright (C) 1995-2002 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.
#---------------------------------------------------------------------------#
# C2INIT - Convert *.c to *_init.c
#
# This script outputs an appropriate init.c, given the .c files.
# Type `c2init --help' for usage message.
#
Usage="\
Name: c2init - Create Mercury initialization file.
Usage: c2init [options] *.c *.init ..."
FULLARCH=@FULLARCH@
DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
# include the file `parse_ml_options.sh-subr'
@PARSE_ML_OPTIONS@
# include the file `canonical_grade.sh-subr'
@CANONICAL_GRADE@
# If you change these, you will also need to change Mmake.common.in,
# scripts/ml.in, tools/bootcheck, tools/binary, tools/binary_step and
# tools/linear.
RT_LIB_NAME=mer_rt
STD_LIB_NAME=mer_std
TRACE_LIB_NAME=mer_trace
BROWSER_LIB_NAME=mer_browser
MERCURY_MOD_LIB_DIR=${MERCURY_MOD_LIB_DIR=@LIBDIR@/modules}
MERCURY_TRACE_LIB_DIR=${MERCURY_TRACE_LIB_DIR=@LIBDIR@/modules}
MKINIT=${MERCURY_MKINIT=mkinit}
case $require_tracing in
true)
trace_opt="-t" ;;
esac
case $stack_trace in
true)
init_opt="-i" ;;
esac
MERCURY_MOD_LIB_MODS=${MERCURY_MOD_LIB_MODS="\
$MERCURY_MOD_LIB_DIR/$RT_LIB_NAME.init \
$MERCURY_MOD_LIB_DIR/$STD_LIB_NAME.init"}
MERCURY_TRACE_LIB_MODS=${MERCURY_TRACE_LIB_MODS="\
$MERCURY_TRACE_LIB_DIR/$BROWSER_LIB_NAME.init"}
case "$trace_opt" in
-t)
init_opt="-i"
MERCURY_ALL_LIB_MODS="$MERCURY_MOD_LIB_MODS\
$MERCURY_TRACE_LIB_MODS"
;;
*)
MERCURY_ALL_LIB_MODS="$MERCURY_MOD_LIB_MODS"
;;
esac
case $# in
0) exec $MKINIT $aditi_opt -c"$maxcalls" $init_opt $trace_opt \
$library_opt $defentry_opt $extra_inits_opt \
-g "$GRADE" -o "$init_c_file" \
$extra_init_dirs $EXTRA_INIT_FILES $MERCURY_ALL_LIB_MODS
;;
*) exec $MKINIT $aditi_opt -c"$maxcalls" $init_opt $trace_opt \
$library_opt $defentry_opt $extra_inits_opt \
-g "$GRADE" -o "$init_c_file" -r "$runtime_flags" \
$extra_init_dirs "$@" $EXTRA_INIT_FILES $MERCURY_ALL_LIB_MODS
;;
esac