summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rwxr-xr-xconfigure116
2 files changed, 76 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 33588240..2d622fe5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2012-04-13 Kaz Kylheku <kaz@kylheku.com>
+ * 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.)
+
+2012-04-13 Kaz Kylheku <kaz@kylheku.com>
+
Bugfix: multiple uses of @(next :args) seeing junk "args" string
in argument list. Fix is not to rely on the hack of using the first
element of the list of files to hold the name of the current file.
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