summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure38
1 files 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"
}