From 672c0b3721201dcc5c41868b4c67976dc57d5e81 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jul 2016 14:41:09 +0200 Subject: [PATCH] unify configure command line saving with configure.exe that is, save it to config.opt and recall it when -redo is used (and do not write it again in this case). a trivial config.status is still created, as having it is very convenient when shadow-building. Task-number: QTBUG-38792 Change-Id: I5e9f7374d6bfc60c427cbfd5e9b3e68bfcaae9f2 Reviewed-by: Lars Knoll --- config_help.txt | 3 +++ configure | 51 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/config_help.txt b/config_help.txt index ece2195afb..2b3e25e1f1 100644 --- a/config_help.txt +++ b/config_help.txt @@ -55,6 +55,9 @@ Configure meta: -help, -h ............ Display this help screen -verbose, -v ......... Print verbose messages during configuration -continue ............ Continue configure despite errors + -redo ................ Re-configure with previously used options. + Additional options may be passed, but will not be + saved for later use by -redo. Build options: diff --git a/configure b/configure index 6a425232e5..bd5a0fac8d 100755 --- a/configure +++ b/configure @@ -80,16 +80,45 @@ if [ x"$1" = x"-top-level" ]; then shift fi -# later cache the command line in config.status -OPT_CMDLINE= +CFG_REDO=no +OPT_CMDLINE= # excluding -verbose (for config.opt) +QMAKE_CMDLINE= # including -verbose (for actual parsing) +set -f # suppress globbing in for loop +SAVED_IFS=$IFS +IFS=' +' for i in "$@"; do + case $i in + -redo|--redo) + if ! test -f config.opt; then + echo >&2 "No config.opt present - cannot redo configuration." + exit 1 + fi + for a in `cat config.opt`; do + OPT_CMDLINE="$OPT_CMDLINE +$a" + QMAKE_CMDLINE="$QMAKE_CMDLINE +$a" + done + CFG_REDO=yes # suppress repeated config.opt writeout + continue + ;; + -v|-verbose|--verbose|-no-v|-no-verbose|--no-verbose) + ;; + *) + OPT_CMDLINE="$OPT_CMDLINE +$i" + ;; + esac QMAKE_CMDLINE="$QMAKE_CMDLINE $i" - if [ "x$i" != "x-v" ]; then - [ -z "${i##* *}" ] && i="'$i'" - OPT_CMDLINE="$OPT_CMDLINE $i" - fi done +set -- +for i in $QMAKE_CMDLINE; do + set -- "$@" "$i" +done +set +f +IFS=$SAVED_IFS # initialize global variables DEVICE_VARS_FILE=.device.vars @@ -1928,14 +1957,16 @@ fi #------------------------------------------------------------------------------- # finally save the executed command to another script #------------------------------------------------------------------------------- -if [ `basename $0` != "config.status" ]; then - CONFIG_STATUS="$relpath/$relconf$OPT_CMDLINE" +if [ $CFG_REDO = no ]; then + echo "$OPT_CMDLINE" | grep '\-confirm\-license' >/dev/null 2>&1 || OPT_CMDLINE="$OPT_CMDLINE +-confirm-license" - echo "$CONFIG_STATUS" | grep '\-confirm\-license' >/dev/null 2>&1 || CONFIG_STATUS="$CONFIG_STATUS -confirm-license" + # skip first line, as it's always empty due to unconditional field separation + echo "$OPT_CMDLINE" | tail -n +2 > "$outpath/config.opt" [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status" echo "#!/bin/sh" > "$outpath/config.status" - echo "$CONFIG_STATUS \"\$@\"" >> "$outpath/config.status" + echo "$relpath/$relconf -redo \"\$@\"" >> "$outpath/config.status" chmod +x "$outpath/config.status" fi