summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kyheku <kaz@kylheku.com>2020-01-29 22:13:25 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-01-29 22:13:25 -0800
commitf7b694183157b674abf68df1b830cadd93e18cdd (patch)
tree147fc954ca9c122a2ad1c5026bc8ea38b64ba12a /configure
parent538d49761802f6da3ce005f9293c8d74b5eb0f57 (diff)
downloadtxr-f7b694183157b674abf68df1b830cadd93e18cdd.tar.gz
txr-f7b694183157b674abf68df1b830cadd93e18cdd.tar.bz2
txr-f7b694183157b674abf68df1b830cadd93e18cdd.zip
build: drop config.log in favor of reconfigure
The configure command line is now turned into an executable script called reconfigure which can be invoked to repeat the config. * Makefile (distclean): Whether in a configured or state or not, try to remove reconfigure. In the configured state, don't remove config.log. (If distclean is invoked when not configured, the config.* pattern will remove config.log). * configure: rewrite the logic which turns the command line into text. It is now robust against spaces, quotes and meta-charaters. Moreover, the printed representation is chosen according to good heuristics to minimize unnecessary quoting and escaping. The config line is written into an executable script called reconfigure. This is now done twice; it is done immediately, so that we save the command line even if the configure subsequently fails. A comment is added to reconfigure indicating that configure didn't succeed. Then after a successful run through the tests, we save it again, without the cautionary comment. Help texts updated.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure51
1 files changed, 41 insertions, 10 deletions
diff --git a/configure b/configure
index fcfe51c8..e2ad6ccd 100755
--- a/configure
+++ b/configure
@@ -52,24 +52,47 @@ set -u
#
# Save command line in a way that can be re-run.
-# This takes care of spaces, but if there are shell-meta characters
-# in the arguments, oops.
#
cmdline=
for arg in "$0" ${@+"$@"} ; do
[ -n "$cmdline" ] && cmdline="$cmdline "
case $arg in
- *" "* | " "* | *" " )
- cmdline=$cmdline$(printf "\"%s\"" "$arg")
+ *"'"* )
+ case $arg in
+ *'"'* | *'$'* )
+ cmdline="$cmdline'$(printf "%s" "$arg" | sed -e "s/'/'\\\\''/g")'"
+ ;;
+ * )
+ cmdline="$cmdline\"$arg\""
+ ;;
+ esac
+ ;;
+ *'"'* | *['$*?[']* | '~'* )
+ cmdline="$cmdline'$arg'"
;;
* )
- cmdline=$cmdline$arg
+ cmdline="$cmdline$arg"
;;
esac
done
#
+# Tentatively save configuration in config.log
+#
+cat > reconfigure <<!
+#!/bin/sh
+#
+# Configured on $(date) using:
+
+$cmdline
+
+# The above did not complete.
+!
+
+chmod a+x reconfigure
+
+#
# 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.
@@ -233,6 +256,10 @@ Configuration variables are recorded in a file called config.make.
This is a GNU makefile, and consequently uses the GNU make syntax. It is
included in the main Makefile by an include statement.
+The configuration command line is recorded in a script called reconfigure.
+To re-run the configure script again with the same parameters, without
+repeating those parameters, run the ./reconfigure script.
+
The configure script is flexible. It allows variables to be entered in any
of these forms:
@@ -3509,13 +3536,14 @@ gen_config_make
printf "done\n"
#
-# Save configuration in config.log
+# Save configuration in reconfigure
#
-cat > config.log <<!
-
-Configured on $(date) using
+cat > reconfigure <<!
+#!/bin/sh
+#
+# Configured on $(date) using:
- $cmdline
+$cmdline
!
#
@@ -3536,4 +3564,7 @@ Usually, most users just need to "$make tests" and "$make install",
possibly switching to superuser for "$make install" if the prefix
points to a privileged location like /usr/local/.
+Also, a script called ./reconfigure has been generated.
+This can be used to re-run the configuration with the same parameters.
+
!