From 65a2801c18b5de9f3eec941837e4999b989eed20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 5 Nov 2010 14:32:54 +0100 Subject: configure: Deal with multiple redefinitions of qmake variables The function setBootstrapVariable() did not account for multiple definitions of the same variable, eg. QMAKE_CC=foo; QMAKE_CC=bar We now look for '+=' and only append the values if this is found, otherwise we reset the variable to the given value, and continue looking for extra values. Reviewed-by: ossi --- configure | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 80ebd9e..dae167c 100755 --- a/configure +++ b/configure @@ -4696,27 +4696,37 @@ fi # $2: optional transformation # relies on $QMAKESPEC, $COMPILER_CONF and $mkfile being set correctly, as the latter # is where the resulting variable is written to +# Assumes that the optional transformation produces the same variable name for each hit setBootstrapVariable() { getQMakeConf | $AWK '/^('"$1"')[^_A-Z0-9]/ { print $0; }' | ( [ -n "$2" ] && sed "$2" ; [ -z "$2" ] && cat ) | $AWK ' +BEGIN { + variable = "" + combinedValue = "" +} { - varLength = index($0, "=") - 1 - valStart = varLength + 2 - if (substr($0, varLength, 1) == "+") { - varLength = varLength - 1 - valStart = valStart + 1 + valStart = index($0, "=") + 1 + + append = 0 + if (substr($0, valStart - 2, 1) == "+") { + append = 1 + } + + variable = substr($0, 0, valStart - 2 - append) + value = substr($0, valStart) + gsub("[ \t]+", "", variable) + gsub("^[ \t]+", "", value) + gsub("[ \t]+$", "", value) + + if (append == 1 && length(combinedValue) > 0) { + combinedValue = combinedValue " " value + } else { + combinedValue = value } - var = substr($0, 0, varLength) - gsub("[ \t]+", "", var) - val = substr($0, valStart) - printf "%s_%s = %s\n", var, NR, val } END { - if (length(var) > 0) { - printf "%s =", var - for (i = 1; i <= NR; ++i) - printf " $(%s_%s)", var, i - printf "\n" + if (length(combinedValue) > 0) { + printf "%s = %s\n", variable, combinedValue } }' >> "$mkfile" } -- cgit v0.12