Reduce even further the clutter of boring command line arguments.

Estimated hours taken: 0.3
Branches: main

Reduce even further the clutter of boring command line arguments.

scripts/mgnuc.in:
	If a file named .mgnuc_opts exists in the current directory,
	read mgnuc options from it. This mechanism is very similar to the
	mechanism I added a while ago to get C compiler options from a
	file named .mgnuc_copts.

	Convert to four-space indentation.

scripts/mgnuc_file_opts.sh-subr:
	New file containing most of the option handling code that used to be
	in mgnuc.in. Now, it is is included in mgnuc twice: once for handling
	options from the command line, once for handling options from
	.mgnuc_opts files.

configure.in:
	Set up configure to insert mgnuc_file_opts.sh-subr into mgnuc.

*/.mgnuc_opts:
	New files specifying the --no-mercury-stdlibdir mgnuc option.

Mmake.workspace:
	Don't pass --no-mercury-stdlibdir on command lines anymore, since this
	is now taken care of by the .mgnuc_opts files.
This commit is contained in:
Zoltan Somogyi
2005-09-19 08:07:15 +00:00
parent c708b19d20
commit be034a61ca
25 changed files with 470 additions and 419 deletions

View File

@@ -112,8 +112,9 @@ MCFLAGS += --options-file $(WORKSPACE)/Mercury.options
endif
# now in FLAGS files
# MCFLAGS += --no-mercury-stdlib-dir -I$(LIBRARY_DIR)
MGNUCFLAGS += --no-mercury-stdlib-dir
# MCFLAGS += -I$(LIBRARY_DIR)
# no in .mgnuc_opt files
# MGNUCFLAGS += --no-mercury-stdlib-dir
C2INITFLAGS += --trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init \
--trace-init-file $(MDBCOMP_DIR)/$(MDBCOMP_LIB_NAME).init
C2INITARGS += $(LIBRARY_DIR)/$(STD_LIB_NAME).init \

1
analysis/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,3 +1,4 @@
.cvsignore
.mgnuc_copts
.mgnuc_opts
ANALYSIS_FLAGS.in

1
browser/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,3 +1,4 @@
.cvsignore
.mgnuc_copts
.mgnuc_opts
MDB_FLAGS.in

1
bytecode/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

1
compiler/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,3 +1,4 @@
.cvsignore
.mgnuc_copts
.mgnuc_opts
COMP_FLAGS.in

View File

@@ -3625,6 +3625,9 @@ FINAL_GRADE_OPTIONS=$top/scripts/final_grade_options.sh-subr
PARSE_ML_OPTIONS=$top/scripts/parse_ml_options.sh-subr
CANONICAL_GRADE=$top/scripts/canonical_grade.sh-subr
# The following allows us to duplicate a subroutine in mgnuc.
MGNUC_FILE_OPTS=$top/scripts/mgnuc_file_opts.sh-subr
# demangling hangs on cygwin, so don't enable it.
case "$host" in
@@ -3639,6 +3642,7 @@ AC_SUBST_FILE(PARSE_GRADE_OPTIONS)
AC_SUBST_FILE(FINAL_GRADE_OPTIONS)
AC_SUBST_FILE(PARSE_ML_OPTIONS)
AC_SUBST_FILE(CANONICAL_GRADE)
AC_SUBST_FILE(MGNUC_FILE_OPTS)
AC_SUBST(DEMANGLE)
# mercury_config includes configure.help to include the help for configure

View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,4 +1,5 @@
.cvsignore
.mgnuc_copts
.mgnuc_opts
DESIGN
DEEP_FLAGS.in

1
library/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,5 +1,6 @@
.cvsignore
.mgnuc_copts
.mgnuc_opts
library_strong_name.sn
INTER_FLAGS
LIB_FLAGS.in

1
mdbcomp/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,3 +1,4 @@
.cvsignore
.mgnuc_copts
.mgnuc_opts
MDBCOMP_FLAGS.in

1
profiler/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,3 +1,4 @@
.cvsignore
.mgnuc_copts
.mgnuc_opts
PROF_FLAGS.in

1
runtime/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,2 +1,3 @@
.cvsignore
.mgnuc_copts
.mgnuc_opts

View File

@@ -1,4 +1,5 @@
#! /bin/sh
# vim: ts=4 sw=4 et
# @configure_input@
#---------------------------------------------------------------------------#
# Copyright (C) 1995-2005 The University of Melbourne.
@@ -9,7 +10,7 @@
# IMPORTANT: the manpage is produced automatically from this help
# message, so if you change the help message, don't forget to check
# that the manpage still looks OK.
# *************************************************************************
# *** IMPORTANT NOTE: any changes to this file may also require similar ***
# *** changes to compiler/compile_target_code.m ***
@@ -28,55 +29,55 @@ AS="@AS@"
case "$CC" in
*gcc*)
ANSI_OPTS="-ansi"
CHECK_OPTS="
-Wall -Wwrite-strings
-Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wno-unused"
ANSI_OPTS="-ansi"
CHECK_OPTS="
-Wall -Wwrite-strings
-Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wno-unused"
# Note: we do not enable the following gcc warnings:
# -Wredundant-decls causes too many complaints in system header files
# -Wpointer-arith causes too many complaints in system header files
# (fixed in gcc 3.0, though, so at some point
# we should re-enable this)
# -Wtraditional we don't care about compatibility with pre-ANSI C
# -Wconversion really only intended to help people using \`unprotoize'
# -Waggregate-return not useful, IMHO
# -Wredundant-decls causes too many complaints in system header files
# -Wpointer-arith causes too many complaints in system header files
# (fixed in gcc 3.0, though, so at some point
# we should re-enable this)
# -Wtraditional we don't care about compatibility with pre-ANSI C
# -Wconversion really only intended to help people using \`unprotoize'
# -Waggregate-return not useful, IMHO
# -Wcast-qual causes LOTS of redundant warnings
# -Wcast-align causes redundant warnings in memory.c
# -pedantic causes unsuppressable warnings about LVALUE_CAST()
# -Wnested-externs causes unsuppressable warnings about callentry()
# -Wid-clash-31 causes warnings about entry_mercury__xxx ...
# we don't care about compatibility with C compilers
# that have short fixed limits on identifier length
# -Wenum-clash is for C++ only
# -Wunused causes various spurious warnings
# -Wcast-qual causes LOTS of redundant warnings
# -Wcast-align causes redundant warnings in memory.c
# -pedantic causes unsuppressable warnings about LVALUE_CAST()
# -Wnested-externs causes unsuppressable warnings about callentry()
# -Wid-clash-31 causes warnings about entry_mercury__xxx ...
# we don't care about compatibility with C compilers
# that have short fixed limits on identifier length
# -Wenum-clash is for C++ only
# -Wunused causes various spurious warnings
OPT_OPTS="-O2 $CFLAGS_FOR_NO_STRICT_ALIASING -fomit-frame-pointer"
DEBUG_OPT="-g"
COMPILER=gcc
;;
OPT_OPTS="-O2 $CFLAGS_FOR_NO_STRICT_ALIASING -fomit-frame-pointer"
DEBUG_OPT="-g"
COMPILER=gcc
;;
*lcc*)
ANSI_OPTS=
CHECK_OPTS="-w" # turn off all warnings due to spurious warnings.
OPT_OPTS=""
DEBUG_OPT="-g"
COMPILER=lcc
;;
ANSI_OPTS=
CHECK_OPTS="-w" # turn off all warnings due to spurious warnings.
OPT_OPTS=""
DEBUG_OPT="-g"
COMPILER=lcc
;;
*cl* | *CL*)
ANSI_OPTS=""
CHECK_OPTS=""
OPT_OPTS=""
DEBUG_OPT="/Zi"
COMPILER=cl
;;
ANSI_OPTS=""
CHECK_OPTS=""
OPT_OPTS=""
DEBUG_OPT="/Zi"
COMPILER=cl
;;
*)
ANSI_OPTS=
CHECK_OPTS=
OPT_OPTS="-O"
DEBUG_OPT="-g"
COMPILER=unknown
;;
ANSI_OPTS=
CHECK_OPTS=
OPT_OPTS="-O"
DEBUG_OPT="-g"
COMPILER=unknown
;;
esac
AS_OPTS=""
@@ -97,147 +98,103 @@ mercury_stdlib_dir=${MERCURY_STDLIB_DIR=@LIBDIR@}
@INIT_GRADE_OPTIONS@
Help="\
Name: mgnuc - Mercury front-end to GNU C
Usage: mgnuc [<options>] [-- <gcc options>] files...
Name: mgnuc - Mercury front-end to GNU C
Usage: mgnuc [<options>] [-- <gcc options>] files...
Options:
-v, --verbose
Echo gcc command before executing it.
--no-ansi
Don't pass \`-ansi' to gcc.
Use the full contents of system headers,
rather than the ANSI subset.
--no-check
Don't enable any of gcc's warnings.
--low-level-debug
Enable low-level debugging of the C code. Useful only
for Mercury system developers.
-g, --c-debug
Generate object files that can debugged with C debuggers
such as gdb.
--no-c-optimize
Disable optimization by the C compiler.
--inline-alloc
Inline calls to the memory allocator.
--split-c-files
This option must be specified if the argument C files were
generated by the Mercury compiler with --split-c-files.
--mercury-standard-library-directory <directory>
--mercury-stdlib-dir <directory>
The directory containing the installed Mercury standard
library.
--no-mercury-standard-library-directory, --no-mercury-stdlib-dir
Don't use an installed Mercury standard library.
-v, --verbose
Echo gcc command before executing it.
--no-ansi
Don't pass \`-ansi' to gcc. Use the full contents of system headers,
rather than the ANSI subset.
--no-check
Don't enable any of gcc's warnings.
--low-level-debug
Enable low-level debugging of the C code. Useful only for Mercury
system developers.
-g, --c-debug
Generate object files that can debugged with C debuggers such as gdb.
--no-c-optimize
Disable optimization by the C compiler.
--inline-alloc
Inline calls to the memory allocator.
--split-c-files
This option must be specified if the argument C files were generated
by the Mercury compiler with --split-c-files.
--mercury-standard-library-directory <directory>
--mercury-stdlib-dir <directory>
The directory containing the installed Mercury standard library.
--no-mercury-standard-library-directory, --no-mercury-stdlib-dir
Don't use an installed Mercury standard library.
$grade_usage
Description:
This runs gcc with the appropriate options for compiling Mercury
programs.
Normally it invokes gcc in ANSI mode with almost all warnings enabled,
but this can be changed using the \`--no-ansi' or \`--no-check'
options.
This runs gcc with the appropriate options for compiling Mercury programs.
Normally it invokes gcc in ANSI mode with almost all warnings enabled,
but this can be changed using the \`--no-ansi' or \`--no-check' options.
Environment variables:
MERCURY_DEFAULT_GRADE.
MERCURY_DEFAULT_GRADE.
Files:
If the current directory contains a file named .mgnuc_copts, then
mgnuc will assume that it contains C compiler options that should
be included on the C compiler's command line. This is usually used
to specify C compiler search paths.
If the current directory contains a file named .mgnuc_copts, then mgnuc
will assume that it contains C compiler options that should be included
on the C compiler's command line. This is usually used to specify C
compiler search paths.
"
while : ; do
case "$1" in
-h|--help|"-?")
echo "$Help"
exit 0
;;
-h|--help|"-?")
echo "$Help"
exit 0
;;
-v|--verbose)
verbose=true
;;
-v-|--no-verbose)
verbose=false
;;
@MGNUC_FILE_OPTS@
--assemble)
assemble=true
;;
--mercury-standard-library-directory|--mercury-stdlib-dir)
mercury_stdlib_dir="$2"
mercury_config_dir="$2"
shift
;;
--no-ansi)
ANSI_OPTS=
DEFINE_OPTS="$DEFINE_OPTS -D__EXTENSIONS__ -D_GNU_SOURCE"
;;
--mercury-config-directory|--mercury-config-dir)
mercury_config_dir="$2"
shift
;;
--no-check)
CHECK_OPTS=
;;
# We don't allow `MERCURY_CONFIG_DIR' to be unset
# without `MERCURY_STDLIB_DIR' also being unset.
--split-c-files)
SPLIT_OPTS=-DMR_SPLIT_C_FILES ;;
--no-split-c-files)
SPLIT_OPTS= ;;
# include the file `parse_grade_options.sh-subr'
@PARSE_GRADE_OPTIONS@
--inline-alloc)
INLINE_ALLOC_OPTS="-DMR_INLINE_ALLOC -DSILENT" ;;
--no-inline-alloc)
INLINE_ALLOC_OPTS="" ;;
--)
shift
break
;;
-g|--c-debug)
c_debug=true ;;
-g-|--no-c-debug)
c_debug=false ;;
--c-optimize)
c_optimize=true ;;
--no-c-optimize)
c_optimize=false ;;
--low-level-debug)
low_level_debug=true ;;
--no-low-level-debug)
low_level_debug=false ;;
--use-activation-counts)
use_activation_counts=true ;;
--no-use-activation-counts)
use_activation_counts=false ;;
--preserve-tail-recursion)
preserve_tail_recursion=true ;;
--no-preserve-tail-recursion)
preserve_tail_recursion=false ;;
--mercury-standard-library-directory|--mercury-stdlib-dir)
mercury_stdlib_dir="$2"
mercury_config_dir="$2"
shift
;;
--no-mercury-standard-library-directory|--no-mercury-stdlib-dir)
unset mercury_stdlib_dir
unset mercury_config_dir
;;
--mercury-config-directory|--mercury-config-dir)
mercury_config_dir="$2"
shift
;;
# We don't allow `MERCURY_CONFIG_DIR' to be unset
# without `MERCURY_STDLIB_DIR' also being unset.
# include the file `parse_grade_options.sh-subr'
@PARSE_GRADE_OPTIONS@
--)
shift
break
;;
*)
break
;;
*)
break
;;
esac
shift
done
if test -r .mgnuc_opts
then
for opt in `cat .mgnuc_opts`
do
case "$opt" in
@MGNUC_FILE_OPTS@
*)
echo "unknown option $opt in .mgnuc_opts"
exit 1
;;
esac
done
fi
# include the file `final_grade_options.sh-subr'
@FINAL_GRADE_OPTIONS@
@@ -248,39 +205,37 @@ done
@CANONICAL_GRADE@
case "$mercury_stdlib_dir" in
"") MERC_ALL_C_INCL_DIRS=
;;
*)
# The option setting code above guarantees that if
# `--mercury-stdlib-dir' is set, `--mercury-config-dir'
# is also set.
MERC_ALL_C_INCL_DIRS="-I$mercury_config_dir/conf -I$mercury_stdlib_dir/inc -I$mercury_stdlib_dir/lib/$GRADE/$FULLARCH/inc"
;;
"") MERC_ALL_C_INCL_DIRS=
;;
*)
# The option setting code above guarantees that if
# `--mercury-stdlib-dir' is set, `--mercury-config-dir'
# is also set.
MERC_ALL_C_INCL_DIRS="-I$mercury_config_dir/conf -I$mercury_stdlib_dir/inc -I$mercury_stdlib_dir/lib/$GRADE/$FULLARCH/inc"
;;
esac
# add /usr/local/include to the default search path, if needed
ALL_LOCAL_C_INCL_DIRS=${MERCURY_ALL_LOCAL_C_INCL_DIRS=@ALL_LOCAL_C_INCL_DIRS@}
#
# convert non-grade mgnuc options into gcc options
# Convert non-grade mgnuc options into gcc options.
#
# IMPORTANT: any changes here will require similar changes to
# compiler/compile_target_code.m.
#
case $c_debug in
true) C_DEBUG_OPTS="$DEBUG_OPT" ;;
false) C_DEBUG_OPTS="" ;;
true) C_DEBUG_OPTS="$DEBUG_OPT" ;;
false) C_DEBUG_OPTS="" ;;
esac
case $c_optimize in
true) ;;
false) OPT_OPTS="" ;;
true) ;;
false) OPT_OPTS="" ;;
esac
case $low_level_debug in
true) LLDEBUG_OPTS="-DMR_LOWLEVEL_DEBUG" ;;
false) LLDEBUG_OPTS="" ;;
true) LLDEBUG_OPTS="-DMR_LOWLEVEL_DEBUG" ;;
false) LLDEBUG_OPTS="" ;;
esac
#
@@ -291,187 +246,183 @@ esac
#
case $highlevel_code in
true) HLC_OPTS="-DMR_HIGHLEVEL_CODE" ;;
false) HLC_OPTS="" ;;
true) HLC_OPTS="-DMR_HIGHLEVEL_CODE" ;;
false) HLC_OPTS="" ;;
esac
case $highlevel_data in
true) HLD_OPTS="-DMR_HIGHLEVEL_DATA" ;;
false) HLD_OPTS="" ;;
true) HLD_OPTS="-DMR_HIGHLEVEL_DATA" ;;
false) HLD_OPTS="" ;;
esac
case $gcc_nested_functions in
true) NEST_OPTS="-DMR_USE_GCC_NESTED_FUNCTIONS" ;;
false) NEST_OPTS="" ;;
true) NEST_OPTS="-DMR_USE_GCC_NESTED_FUNCTIONS" ;;
false) NEST_OPTS="" ;;
esac
case $asm_labels in
true) ASM_OPTS="-DMR_USE_ASM_LABELS" ;;
false) ASM_OPTS="" ;;
true) ASM_OPTS="-DMR_USE_ASM_LABELS" ;;
false) ASM_OPTS="" ;;
esac
case $non_local_gotos in
true) GOTO_OPTS="-DMR_USE_GCC_NONLOCAL_GOTOS" ;;
false) GOTO_OPTS="" ;;
true) GOTO_OPTS="-DMR_USE_GCC_NONLOCAL_GOTOS" ;;
false) GOTO_OPTS="" ;;
esac
case $global_regs in
true) REG_OPTS="-DMR_USE_GCC_GLOBAL_REGISTERS" ;;
false) REG_OPTS="" ;;
true) REG_OPTS="-DMR_USE_GCC_GLOBAL_REGISTERS" ;;
false) REG_OPTS="" ;;
esac
case $thread_safe in
true) THREAD_OPTS="$CFLAGS_FOR_THREADS"
case $FULLARCH in *linux*)
# Don't use -ansi under Linux or we get parse
# errors at sigset_t in the pthreads headers.
# This doesn't seem to be necessary for recent
# versions of Linux/glibc (e.g. glibc 2.1.2),
# but I've left it in so we can remain
# compatible with older versions.
ANSI_OPTS=""
esac ;;
false) THREAD_OPTS="" ;;
true) THREAD_OPTS="$CFLAGS_FOR_THREADS"
case $FULLARCH in *linux*)
# Don't use -ansi under Linux or we get parse errors
# at sigset_t in the pthreads headers. This doesn't seem
# to be necessary for recent versions of Linux/glibc
# (e.g. glibc 2.1.2), but I've left it in so we can remain
# compatible with older versions.
ANSI_OPTS=""
esac ;;
false) THREAD_OPTS="" ;;
esac
# Set the correct flags if we're to use the MS Visual C runtime.
use_msvcrt=@USE_MSVCRT@
if test $use_msvcrt = "yes"; then
case $thread_safe in
# /MD states that we will use the MSVC runtime,
# the boehm_gc collector assumes that the collector
# has been built as a DLL if we are using the MSVC runtime
# so we need to define GC_NOT_DLL when the collector isn't
# built as a DLL.
true) MSVCRT_OPTS="/MD" ;;
false) MSVCRT_OPTS="/DGC_NOT_DLL /MD" ;;
esac
case $thread_safe in
# /MD states that we will use the MSVC runtime, the boehm_gc collector
# assumes that the collector has been built as a DLL if we are using
# the MSVC runtime so we need to define GC_NOT_DLL when the collector
# isn't built as a DLL.
true) MSVCRT_OPTS="/MD" ;;
false) MSVCRT_OPTS="/DGC_NOT_DLL /MD" ;;
esac
else
MSVCRT_OPTS=""
MSVCRT_OPTS=""
fi
case $gc_method in
accurate) GC_OPTS="-DMR_NATIVE_GC" ;;
boehm) GC_OPTS="-DMR_CONSERVATIVE_GC -DMR_BOEHM_GC" ;;
conservative) GC_OPTS="-DMR_CONSERVATIVE_GC -DMR_BOEHM_GC" ;;
mps) GC_OPTS="-DMR_CONSERVATIVE_GC -DMR_MPS_GC" ;;
none) GC_OPTS="" ;;
accurate) GC_OPTS="-DMR_NATIVE_GC" ;;
boehm) GC_OPTS="-DMR_CONSERVATIVE_GC -DMR_BOEHM_GC" ;;
conservative) GC_OPTS="-DMR_CONSERVATIVE_GC -DMR_BOEHM_GC" ;;
mps) GC_OPTS="-DMR_CONSERVATIVE_GC -DMR_MPS_GC" ;;
none) GC_OPTS="" ;;
esac
case $profile_time in
true) PROF_TIME_OPTS="-DMR_MPROF_PROFILE_TIME" ;;
false) PROF_TIME_OPTS="-DNO_SIGNALS" ;;
# We pass -DNO_SIGNALS unless profiling is enabled.
# See comments in runtime/mercury_prof_mem.h for why.
true) PROF_TIME_OPTS="-DMR_MPROF_PROFILE_TIME" ;;
false) PROF_TIME_OPTS="-DNO_SIGNALS" ;;
# We pass -DNO_SIGNALS unless profiling is enabled.
# See comments in runtime/mercury_prof_mem.h for why.
esac
case $profile_calls in
true) PROF_CALLS_OPTS="-DMR_MPROF_PROFILE_CALLS" ;;
false) PROF_CALLS_OPTS="" ;;
true) PROF_CALLS_OPTS="-DMR_MPROF_PROFILE_CALLS" ;;
false) PROF_CALLS_OPTS="" ;;
esac
case $profile_memory in
true) PROF_MEMORY_OPTS="-DMR_MPROF_PROFILE_MEMORY" ;;
false) PROF_MEMORY_OPTS="" ;;
true) PROF_MEMORY_OPTS="-DMR_MPROF_PROFILE_MEMORY" ;;
false) PROF_MEMORY_OPTS="" ;;
esac
case $use_activation_counts in
true) ACTIVATION_COUNT_OPT="-DMR_USE_ACTIVATION_COUNTS" ;;
false) ACTIVATION_COUNT_OPT="";;
true) ACTIVATION_COUNT_OPT="-DMR_USE_ACTIVATION_COUNTS" ;;
false) ACTIVATION_COUNT_OPT="";;
esac
case $preserve_tail_recursion in
true) PRESERVE_TAIL_RECURSION_OPT="-DMR_DEEP_PROFILING_TAIL_RECURSION" ;;
false) PRESERVE_TAIL_RECURSION_OPT="";;
true) PRESERVE_TAIL_RECURSION_OPT="-DMR_DEEP_PROFILING_TAIL_RECURSION" ;;
false) PRESERVE_TAIL_RECURSION_OPT="";;
esac
case $profile_deep in
true) PROF_DEEP_OPTS="-DMR_DEEP_PROFILING $ACTIVATION_COUNT_OPT $PRESERVE_TAIL_RECURSION_OPT" ;;
false) PROF_DEEP_OPTS="" ;;
true) PROF_DEEP_OPTS="-DMR_DEEP_PROFILING $ACTIVATION_COUNT_OPT $PRESERVE_TAIL_RECURSION_OPT" ;;
false) PROF_DEEP_OPTS="" ;;
esac
case $record_term_sizes_as_words,$record_term_sizes_as_cells in
true,true) progname=`basename $0`
echo "$progname: we can't record both cell and word sizes"
exit 1 ;;
true,false) RECORD_TERM_SIZE_OPTS="-DMR_RECORD_TERM_SIZES" ;;
false,true) RECORD_TERM_SIZE_OPTS="-DMR_RECORD_TERM_SIZES -DMR_RECORD_TERM_SIZES_AS_CELLS" ;;
false,false) RECORD_TERM_SIZE_OPTS="" ;;
true,true) progname=`basename $0`
echo "$progname: we can't record both cell and word sizes"
exit 1 ;;
true,false) RECORD_TERM_SIZE_OPTS="-DMR_RECORD_TERM_SIZES" ;;
false,true) RECORD_TERM_SIZE_OPTS="-DMR_RECORD_TERM_SIZES -DMR_RECORD_TERM_SIZES_AS_CELLS" ;;
false,false) RECORD_TERM_SIZE_OPTS="" ;;
esac
case $use_trail in
true) TRAIL_OPTS="-DMR_USE_TRAIL" ;;
false) TRAIL_OPTS="" ;;
true) TRAIL_OPTS="-DMR_USE_TRAIL" ;;
false) TRAIL_OPTS="" ;;
esac
case $reserve_tag in
true) RESERVE_TAG_OPTS="-DMR_RESERVE_TAG" ;;
false) RESERVE_TAG_OPTS="" ;;
true) RESERVE_TAG_OPTS="-DMR_RESERVE_TAG" ;;
false) RESERVE_TAG_OPTS="" ;;
esac
case $use_minimal_model_stack_copy,$use_minimal_model_own_stacks in
true,true) progname=`basename $0`
echo "$progname: can't enable both forms of minimal model tabling at once"
exit 1 ;;
true,false) MINIMAL_MODEL_OPTS="-DMR_USE_MINIMAL_MODEL_STACK_COPY"
;;
false,true) MINIMAL_MODEL_OPTS="-DMR_USE_MINIMAL_MODEL_OWN_STACKS"
;;
false,false) MINIMAL_MODEL_OPTS="" ;;
true,true) progname=`basename $0`
echo "$progname: can't enable both forms of minimal model tabling at once"
exit 1 ;;
true,false) MINIMAL_MODEL_OPTS="-DMR_USE_MINIMAL_MODEL_STACK_COPY" ;;
false,true) MINIMAL_MODEL_OPTS="-DMR_USE_MINIMAL_MODEL_OWN_STACKS" ;;
false,false) MINIMAL_MODEL_OPTS="" ;;
esac
case $use_minimal_model,$minimal_model_debug in
true,false) ;; # MINIMAL_MODEL_OPTS is already set
true,true) MINIMAL_MODEL_OPTS="$MINIMAL_MODEL_OPTS -DMR_MINIMAL_MODEL_DEBUG" ;;
*) MINIMAL_MODEL_OPTS="" ;;
true,false) ;; # MINIMAL_MODEL_OPTS is already set
true,true) MINIMAL_MODEL_OPTS="$MINIMAL_MODEL_OPTS -DMR_MINIMAL_MODEL_DEBUG" ;;
*) MINIMAL_MODEL_OPTS="" ;;
esac
case $pic_reg in
true) PICREG_OPTS="-DMR_PIC_REG" ;;
false) PICREG_OPTS="" ;;
true) PICREG_OPTS="-DMR_PIC_REG" ;;
false) PICREG_OPTS="" ;;
esac
case $debug in
true) TRACE_OPTS="-DMR_EXEC_TRACE" ;;
false) TRACE_OPTS="" ;;
true) TRACE_OPTS="-DMR_EXEC_TRACE" ;;
false) TRACE_OPTS="" ;;
esac
case $decl_debug in
true) DECL_DEBUG_OPTS="-DMR_DECL_DEBUG" ;;
false) DECL_DEBUG_OPTS="" ;;
true) DECL_DEBUG_OPTS="-DMR_DECL_DEBUG" ;;
false) DECL_DEBUG_OPTS="" ;;
esac
case $extend_stacks in
true) EXTEND_STACKS_OPTS="-DMR_EXTEND_STACKS_WHEN_NEEDED" ;;
false) EXTEND_STACKS_OPTS="" ;;
true) EXTEND_STACKS_OPTS="-DMR_EXTEND_STACKS_WHEN_NEEDED" ;;
false) EXTEND_STACKS_OPTS="" ;;
esac
GCC_OPTS="$NEST_OPTS $ASM_OPTS $GOTO_OPTS $REG_OPTS"
# check that special grades are only used with gcc
case $COMPILER in
gcc|unknown)
;;
*) case "$GCC_OPTS" in
*USE_GCC*)
progname=`basename $0`
echo "$progname: For compilers other than GNU C, the only" 1>&2
echo "$progname: base grade allowed is \`none'" 1>&2
;;
esac
;;
gcc|unknown)
;;
*) case "$GCC_OPTS" in
*USE_GCC*)
progname=`basename $0`
echo "$progname: For compilers other than GNU C, the only" 1>&2
echo "$progname: base grade allowed is \`none'" 1>&2
;;
esac
;;
esac
# if we're using global registers, add CFLAGS_FOR_REGS
case $global_regs in
true) GCC_OPTS="$GCC_OPTS $CFLAGS_FOR_REGS" ;;
false) ;;
true) GCC_OPTS="$GCC_OPTS $CFLAGS_FOR_REGS" ;;
false) ;;
esac
# if we're using non-local gotos, add CFLAGS_FOR_GOTOS
case $non_local_gotos in
true) GCC_OPTS="$GCC_OPTS $CFLAGS_FOR_GOTOS" ;;
false) ;;
true) GCC_OPTS="$GCC_OPTS $CFLAGS_FOR_GOTOS" ;;
false) ;;
esac
#
@@ -481,40 +432,38 @@ esac
ARCH_OPTS=""
case "$FULLARCH" in
mips-sgi-irix5.*)
# nonlocal gotos don't work with PIC, which is the
# default for Irix 5, so if nonlocal gotos are enabled
# we need to disable the use of shared libraries.
case $non_local_gotos in
true)
LIBRARY_PATH="$NONSHARED_LIB_DIR:/usr/lib/nonshared:$LIBRARY_PATH"
export LIBRARY_PATH
AS_OPTS="-non_shared"
;;
esac
;;
i*86-*)
# the use of stack_pointer in the ASM_JUMP macro
# defined in runtime/goto.h causes lots of warnings
# about using possibly uninitialized variables;
# there's no easy way to supress them except by
# disabling the warning.
case "$COMPILER" in
gcc)
CHECK_OPTS="$CHECK_OPTS -Wno-uninitialized"
;;
esac
;;
*-solaris*|*-sunos*)
# The solaris headers for pthreads are not ANSI :-(
case $thread_safe in true)
ANSI_OPTS=""
;;
esac
;;
mips-sgi-irix5.*)
# Nonlocal gotos don't work with PIC, which is the default for Irix 5,
# so if nonlocal gotos are enabled we need to disable the use of
# shared libraries.
case $non_local_gotos in
true)
LIBRARY_PATH="$NONSHARED_LIB_DIR:/usr/lib/nonshared:$LIBRARY_PATH"
export LIBRARY_PATH
AS_OPTS="-non_shared"
;;
esac
;;
i*86-*)
# The use of stack_pointer in the ASM_JUMP macro defined in
# runtime/goto.h causes lots of warnings about using possibly
# uninitialized variables; there's no easy way to supress them
# except by disabling the warning.
case "$COMPILER" in
gcc)
CHECK_OPTS="$CHECK_OPTS -Wno-uninitialized"
;;
esac
;;
*-solaris*|*-sunos*)
# The solaris headers for pthreads are not ANSI :-(
case $thread_safe in true)
ANSI_OPTS=""
;;
esac
;;
esac
#
# Kludge for gcc-2.6.3 bug on mips: if you use gcc global registers and -O2,
# gcc 2.6.3 gets an internal error compiling library/int.c and
# compiler/bytecode.c. As a work-around, we compile those file with -O1.
@@ -524,138 +473,136 @@ esac
# Similarly for egcs-1.1 on sparc with library/lexer.c, library/string.c,
# and compiler/{deforest,dupelim,mercury_to_mercury,modules}.c.
# Similarly for egcs-1.1.2 on i386 with library/table_builtin.c.
#
case $COMPILER in gcc)
case "$FULLARCH" in
mips*)
case "$*" in
*" int.c "*|*" int.dir/int_"*".c "*)
case "`$CC --version 2>/dev/null`" in 2.6.*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
esac;;
*" bytecode.c "*|*" bytecode.dir/bytecode_"*".c "*)
case "`$CC --version 2>/dev/null`" in 2.6.*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
esac;;
*" bag.c "*)
case "`$CC --version 2>/dev/null`" in 2.6.*)
ARCH_OPTS="$ARCH_OPTS -O0" ;;
esac;;
esac ;;
alpha*)
case "$*" in
*" modules.c "*|*" modules.dir/modules_"*".c "*)
case "`$CC --version 2>/dev/null`" in 2.6.*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
esac
esac ;;
i*86*)
case "$*" in
*" call_gen.c "*|*" modules.dir/call_gen"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O0" ;;
*" table_builtin.c "*|*" modules.dir/table_builtin"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O0" ;;
*" random.c "*|*" random.dir/random"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O0" ;;
esac ;;
sparc*)
case "$*" in
*" lexer.c "*|*" modules.dir/lexer"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" string.c "*|*" modules.dir/string"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" deforest.c "*|*" modules.dir/deforest"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" dupelim.c "*|*" modules.dir/dupelim"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" dl.c "*|*" modules.dir/dl"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" mercury_to_mercury.c "*|*" modules.dir/mercury_to_mercury"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" modules.c "*|*" modules.dir/modules"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
esac
esac ;;
case "$FULLARCH" in
mips*)
case "$*" in
*" int.c "*|*" int.dir/int_"*".c "*)
case "`$CC --version 2>/dev/null`" in 2.6.*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
esac;;
*" bytecode.c "*|*" bytecode.dir/bytecode_"*".c "*)
case "`$CC --version 2>/dev/null`" in 2.6.*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
esac;;
*" bag.c "*)
case "`$CC --version 2>/dev/null`" in 2.6.*)
ARCH_OPTS="$ARCH_OPTS -O0" ;;
esac;;
esac ;;
alpha*)
case "$*" in
*" modules.c "*|*" modules.dir/modules_"*".c "*)
case "`$CC --version 2>/dev/null`" in 2.6.*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
esac
esac ;;
i*86*)
case "$*" in
*" call_gen.c "*|*" modules.dir/call_gen"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O0" ;;
*" table_builtin.c "*|*" modules.dir/table_builtin"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O0" ;;
*" random.c "*|*" random.dir/random"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O0" ;;
esac ;;
sparc*)
case "$*" in
*" lexer.c "*|*" modules.dir/lexer"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" string.c "*|*" modules.dir/string"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" deforest.c "*|*" modules.dir/deforest"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" dupelim.c "*|*" modules.dir/dupelim"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" dl.c "*|*" modules.dir/dl"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" mercury_to_mercury.c "*|*" modules.dir/mercury_to_mercury"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
*" modules.c "*|*" modules.dir/modules"*".c "*)
ARCH_OPTS="$ARCH_OPTS -O1" ;;
esac
esac ;;
esac
#
# On sparc-sun-solaris2, we need to use -fPIC rather than -fpic if we're
# using grade `none', because otherwise the Mercury standard library
# overflows the fixed limit on the number of "small pic" references.
#
case "$FULLARCH" in sparc-sun-solaris2*)
case "$grade" in none)
case "$*" in *-fpic*)
echo "mgnuc: using -fPIC rather than -fpic"
OVERRIDE_OPTS="$OVERRIDE_OPTS -fPIC" ;;
esac ;;
esac ;;
case "$grade" in none)
case "$*" in *-fpic*)
echo "mgnuc: using -fPIC rather than -fpic"
OVERRIDE_OPTS="$OVERRIDE_OPTS -fPIC"
;;
esac ;;
esac ;;
esac
#
# The -floop-optimize option is incompatible
# with the global register code we generated on Darwin PowerPC.
# See the hard_coded/ppc_bug test case for an example
# program which fails with this optimization.
#
case $FULLARCH in powerpc*apple*darwin*)
case $highlevel_code in false)
case $global_regs in true)
ARCH_OPTS="$ARCH_OPTS -fno-loop-optimize" ;;
esac
esac
# The -floop-optimize option is incompatible with the global register code
# we generated on Darwin PowerPC. See the hard_coded/ppc_bug test case
# for an example program which fails with this optimization.
case $FULLARCH in powerpc*apple*darwin*)
case $highlevel_code in false)
case $global_regs in true)
ARCH_OPTS="$ARCH_OPTS -fno-loop-optimize" ;;
esac
esac
esac
case $assemble in true)
case $verbose in true)
echo $AS $AS_OPTS "$@" ;;
esac
exec $AS $AS_OPTS "$@" ;;
case $verbose in true)
echo $AS $AS_OPTS "$@" ;;
esac
exec $AS $AS_OPTS "$@" ;;
esac
if test -r .mgnuc_copts
then
INVISIBLE_OPTS=`cat .mgnuc_copts`
INVISIBLE_OPTS=`cat .mgnuc_copts`
else
INVISIBLE_OPTS=""
INVISIBLE_OPTS=""
fi
ALL_CC_OPTS="$MERC_ALL_C_INCL_DIRS\
$ANSI_OPTS\
$CHECK_OPTS\
$OPT_OPTS\
$HLC_OPTS\
$HLD_OPTS\
$GCC_OPTS\
$MSVCRT_OPTS\
$GC_OPTS\
$DEFINE_OPTS\
$STACK_TRACE_OPTS\
$TRACE_OPTS\
$DECL_DEBUG_OPTS\
$EXTEND_STACKS_OPTS\
$LLDEBUG_OPTS\
$C_DEBUG_OPTS\
$PROF_TIME_OPTS\
$PROF_CALLS_OPTS\
$PROF_MEMORY_OPTS\
$PROF_DEEP_OPTS\
$INLINE_ALLOC_OPTS\
$TRAIL_OPTS\
$RECORD_TERM_SIZE_OPTS\
$RESERVE_TAG_OPTS\
$MINIMAL_MODEL_OPTS\
$SPLIT_OPTS\
$THREAD_OPTS\
$PICREG_OPTS\
$ARCH_OPTS\
$ARG_OPTS\
$INVISIBLE_OPTS"
$ANSI_OPTS\
$CHECK_OPTS\
$OPT_OPTS\
$HLC_OPTS\
$HLD_OPTS\
$GCC_OPTS\
$MSVCRT_OPTS\
$GC_OPTS\
$DEFINE_OPTS\
$STACK_TRACE_OPTS\
$TRACE_OPTS\
$DECL_DEBUG_OPTS\
$EXTEND_STACKS_OPTS\
$LLDEBUG_OPTS\
$C_DEBUG_OPTS\
$PROF_TIME_OPTS\
$PROF_CALLS_OPTS\
$PROF_MEMORY_OPTS\
$PROF_DEEP_OPTS\
$INLINE_ALLOC_OPTS\
$TRAIL_OPTS\
$RECORD_TERM_SIZE_OPTS\
$RESERVE_TAG_OPTS\
$MINIMAL_MODEL_OPTS\
$SPLIT_OPTS\
$THREAD_OPTS\
$PICREG_OPTS\
$ARCH_OPTS\
$ARG_OPTS\
$INVISIBLE_OPTS"
case $verbose in true)
echo $CC $ALL_CC_OPTS "$@" $OVERRIDE_OPTS $ALL_LOCAL_C_INCL_DIRS;;
echo $CC $ALL_CC_OPTS "$@" $OVERRIDE_OPTS $ALL_LOCAL_C_INCL_DIRS;;
esac
case $# in
0) exec $CC $ALL_CC_OPTS $OVERRIDE_OPTS ;;
*) exec $CC $ALL_CC_OPTS "$@" $OVERRIDE_OPTS $ALL_LOCAL_C_INCL_DIRS;;
0) exec $CC $ALL_CC_OPTS $OVERRIDE_OPTS ;;
*) exec $CC $ALL_CC_OPTS "$@" $OVERRIDE_OPTS $ALL_LOCAL_C_INCL_DIRS;;
esac

View File

@@ -0,0 +1,78 @@
#---------------------------------------------------------------------------#
# Copyright (C) 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.
#---------------------------------------------------------------------------#
#
# mgnuc_file_opts.sh-subr:
#
# An `sh' subroutine for processing the mgnuc options that can be set from
# .mgnuc_opts files. It is included twice in mgnuc. Its implementation is
# bound tightly to the code of mgnuc.in; all the variables it manipulates
# come from there.
#
# At the moment, this includes only options that do not have arguments.
# This is because processing options with arguments is hard to do without
# overriding the argument vector, and there is no simple way to preserve
# the exact structure of the original argument vector *including* any spaces
# inside individual arguments. There is no real need (at least right now)
# for putting such options into .mgnuc_opts files.
#
#---------------------------------------------------------------------------#
-v|--verbose)
verbose=true
;;
-v-|--no-verbose)
verbose=false ;;
--assemble)
assemble=true ;;
--no-ansi)
ANSI_OPTS=
DEFINE_OPTS="$DEFINE_OPTS -D__EXTENSIONS__ -D_GNU_SOURCE"
;;
--no-check)
CHECK_OPTS= ;;
--split-c-files)
SPLIT_OPTS=-DMR_SPLIT_C_FILES ;;
--no-split-c-files)
SPLIT_OPTS= ;;
--inline-alloc)
INLINE_ALLOC_OPTS="-DMR_INLINE_ALLOC -DSILENT" ;;
--no-inline-alloc)
INLINE_ALLOC_OPTS="" ;;
-g|--c-debug)
c_debug=true ;;
-g-|--no-c-debug)
c_debug=false ;;
--c-optimize)
c_optimize=true ;;
--no-c-optimize)
c_optimize=false ;;
--low-level-debug)
low_level_debug=true ;;
--no-low-level-debug)
low_level_debug=false ;;
--use-activation-counts)
use_activation_counts=true ;;
--no-use-activation-counts)
use_activation_counts=false ;;
--preserve-tail-recursion)
preserve_tail_recursion=true ;;
--no-preserve-tail-recursion)
preserve_tail_recursion=false ;;
--no-mercury-standard-library-directory|--no-mercury-stdlib-dir)
unset mercury_stdlib_dir
unset mercury_config_dir
;;

1
slice/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,4 +1,5 @@
.nocopyright
.mgnuc_copts
.mgnuc_opts
Mercury.options
SLICE_FLAGS.in

1
trace/.mgnuc_opts Normal file
View File

@@ -0,0 +1 @@
--no-mercury-stdlib-dir

View File

@@ -1,2 +1,3 @@
.nocopyright
.mgnuc_copts
.mgnuc_opts