summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-04-13 19:33:19 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-04-13 19:33:19 -0700
commit38ffa1f373288d9bbf29b5bb2f763a35067ab5f4 (patch)
tree1a683d539a1a664610c26633294fe3b35ccb78ba /configure
parent7768a57e24d747ccaf188e8b618786a4ac91ef84 (diff)
downloadtxr-38ffa1f373288d9bbf29b5bb2f763a35067ab5f4.tar.gz
txr-38ffa1f373288d9bbf29b5bb2f763a35067ab5f4.tar.bz2
txr-38ffa1f373288d9bbf29b5bb2f763a35067ab5f4.zip
* configure: Restructuring configure script to be able to detect
nonexistent options. Variable default values are established first, which simplifies the syntax. The scanning loop detects attempts to create configuration variables that do not exist. The var_given convention is folded into the parsing. (If var exists, and var_given exists, and the user specifies var, then var_given is set to y to indicate that the value came from the user.)
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure116
1 files changed, 65 insertions, 51 deletions
diff --git a/configure b/configure
index c6552968..cca35bda 100755
--- a/configure
+++ b/configure
@@ -47,6 +47,58 @@ for arg in "$0" ${@+"$@"} ; do
done
#
+# Establish default values for any variables that are not specified
+# on the command line. The default derivations from prefix are in
+# Make syntax. They go verbatim into the generated config.make.
+# This way they can be overridden more flexibly at make time.
+#
+
+#
+# non-config
+#
+help=
+
+#
+# config
+#
+prefix=/usr/local
+install_prefix=
+bindir='$(prefix)/bin'
+datadir='$(prefix)/share/txr'
+mandir='$(prefix)/share/man'
+make=
+cross=
+compiler_prefix=
+ccname=gcc
+cc='$(cross)$(compiler_prefix)$(ccname)'
+intptr=
+tool_prefix=
+lex='$(cross)$(tool_prefix)flex'
+lexlib=-lfl
+yaccname_given=
+yaccname=
+yacc='$(cross)$(tool_prefix)$(yaccname)'
+yacc_given=
+nm='$(cross)$(tool_prefix)nm'
+opt_flags=-O2
+lang_flags='--ansi -D_XOPEN_SOURCE=2'
+diag_flags='-Wall -Wmissing-prototypes -Wstrict-prototypes'
+debug_flags=-g
+inline=
+platform_flags=
+remove_flags=
+lex_dbg_flags=
+txr_dbg_opts=--gc-debug
+valgrind=
+lit_align=
+extra_debugging=
+debug_support=y
+gen_gc=
+mpi_version=1.8.6
+have_quilt=
+have_patch=
+
+#
# Parse configuration variables
#
while [ $# -gt 0 ] ; do
@@ -89,61 +141,23 @@ while [ $# -gt 0 ] ; do
exit 1
fi
+ eval "var_exists=\${$var+y}"
+
+ if [ "$var_exists" != y ] ; then
+ printf "$0: nonexistent option: '%s'\n" "$1"
+ exit 1
+ fi
+
eval "$var='$val'"
- shift
-done
-#
-# Establish default values for any variables that are not specified
-# on the command line. The default derivations from prefix are in
-# Make syntax. They go verbatim into the generated config.make.
-# This way they can be overridden more flexibly at make time.
-#
+ eval "var_given_exists=\${${var}_given+y}"
-#
-# non-config
-#
-help=${help-}
+ if [ "$var_given_exists" = y ] ; then
+ eval "${var}_given=y"
+ fi
-#
-# config
-#
-prefix=${prefix-/usr/local}
-install_prefix=${install_prefix-}
-bindir=${datadir-'$(prefix)/bin'}
-datadir=${datadir-'$(prefix)/share/txr'}
-mandir=${mandir-'$(prefix)/share/man'}
-make=${make-}
-cross=${cross-}
-compiler_prefix=${compiler_prefix-}
-ccname=${ccname-gcc}
-cc=${cc-'$(cross)$(compiler_prefix)$(ccname)'}
-intptr=${intptr-}
-tool_prefix=${tool_prefix-}
-lex=${lex-'$(cross)$(tool_prefix)flex'}
-lexlib=${lexlib--lfl}
-yaccname_given=${yaccname+y}
-yaccname=${yaccname-}
-yacc_given=${yacc+y}
-yacc=${yacc-'$(cross)$(tool_prefix)$(yaccname)'}
-nm=${nm-'$(cross)$(tool_prefix)nm'}
-opt_flags=${opt_flags--O2}
-lang_flags=${lang_flags--ansi -D_XOPEN_SOURCE=2}
-diag_flags=${diag_flags--Wall -Wmissing-prototypes -Wstrict-prototypes}
-debug_flags=${debug_flags--g}
-inline=${inline-}
-platform_flags=${platform_flags-}
-remove_flags=${remove_flags-}
-lex_dbg_flags=${lex_dbg_flags-}
-txr_dbg_opts=${txr_dbg_opts---gc-debug}
-valgrind=${valgrind-}
-lit_align=${lit_align-}
-extra_debugging=${extra_debugging-}
-debug_support=${debug_support-y}
-gen_gc=${gen_gc-}
-mpi_version=1.8.6
-have_quilt=
-have_patch=
+ shift
+done
#
# If --help was given (or --help=<nonempty> or help=<nonempty>) then