about summary refs log tree commit diff
path: root/configure
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-16 18:19:47 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-16 18:19:47 -0400
commit453f462297062f9444ba1517d592cf31c7d7fce5 (patch)
tree27687d6c27661eb5104b525ccff0ac234839f5a9 /configure
parent82fa6b43b367d047e89cfa5505ad718253fbb693 (diff)
downloadmusl-453f462297062f9444ba1517d592cf31c7d7fce5.tar.gz
musl-453f462297062f9444ba1517d592cf31c7d7fce5.tar.xz
musl-453f462297062f9444ba1517d592cf31c7d7fce5.zip
make configure store its command line in config.mak for easy re-run
proper shell quoting and pretty-printing (avoiding ugly gratuitous
quoting and bad quoting style) is included.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure12
1 files changed, 11 insertions, 1 deletions
diff --git a/configure b/configure
index 949fb03d..dfd3d502 100755
--- a/configure
+++ b/configure
@@ -45,6 +45,12 @@ exit 0
 
 # Helper functions
 
+quote () {
+tr '\n' ' ' <<EOF | grep '^[-[:alnum:]_=,./:]* $' >/dev/null 2>&1 && { echo "$1" ; return 0 ; }
+$1
+EOF
+printf %s\\n "$1" | sed -e "s/'/'\\\\''/g" -e "1s/^/'/;\$s/\$/'/" -e "s/^'\([-[:alnum:]_,./:]*\)=\(.*\)\$/\1='\2/"
+}
 echo () { printf "%s\n" "$*" ; }
 fail () { echo "$*" ; exit 1 ; }
 fnmatch () { eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac" ; }
@@ -421,11 +427,15 @@ fi
 
 printf "creating config.mak... "
 
+cmdline=$(quote "$0")
+for i ; do cmdline="$cmdline $(quote "$i")" ; done
+
 exec 3>&1 1>config.mak
 
 
 cat << EOF
-# This version of config.mak was generated by configure
+# This version of config.mak was generated by:
+# $cmdline
 # Any changes made here will be lost if configure is re-run
 ARCH = $ARCH
 SUBARCH = $SUBARCH