summaryrefslogtreecommitdiffstats
path: root/mkspecs/features
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-08-10 12:34:24 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-08-18 17:10:18 +0000
commit9172143f52757c29fbcf1a5f30d5ca25c52efb81 (patch)
tree9df4e8edd2decb88eafeef5bc920bdff397acbf0 /mkspecs/features
parent98ddf9262e356178ddcf26b72e375c99cec16b79 (diff)
Add configure.exe-like FOO_LIBS=bar style command line options
Add the command line options supported by the windows version of configure and respect them when running our configure tests. Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Change-Id: I1206d60a177e251540d34d232c73c930847564b3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'mkspecs/features')
-rw-r--r--mkspecs/features/qt_configure.prf66
1 files changed, 63 insertions, 3 deletions
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index 674f59044c..3d7b0ed9d2 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -123,6 +123,7 @@ defineTest(qtConfCommandline_string) {
val = $${2}
isEmpty(val): val = $$qtConfGetNextCommandlineArg()
+ # Note: Arguments which are variable assignments are legit here.
contains(val, "^-.*")|isEmpty(val) {
qtConfAddError("No value supplied to command line option '$$opt'.")
return()
@@ -139,7 +140,7 @@ defineTest(qtConfCommandline_optionalString) {
val = $${2}
isEmpty(val) {
v = $$qtConfPeekNextCommandlineArg()
- contains(v, "^-.*")|isEmpty(v): \
+ contains(v, "^-.*|[A-Z_]+=.*")|isEmpty(v): \
val = "yes"
else: \
val = $$qtConfGetNextCommandlineArg()
@@ -157,7 +158,7 @@ defineTest(qtConfCommandline_addString) {
val = $${2}
isEmpty(val): val = $$qtConfGetNextCommandlineArg()
- contains(val, "^-.*")|isEmpty(val) {
+ contains(val, "^-.*|[A-Z_]+=.*")|isEmpty(val) {
qtConfAddError("No value supplied to command line option '$$opt'.")
return()
}
@@ -189,6 +190,19 @@ defineTest(qtConfParseCommandLine) {
next()
}
+ contains(c, "([A-Z_]+)=(.*)") {
+ opt = $$replace(c, "^([A-Z_]+)=(.*)", "\\1")
+ val = $$replace(c, "^([A-Z_]+)=(.*)", "\\2")
+ var = $$eval(config.commandline.assignments.$${opt})
+ isEmpty(var) {
+ qtConfAddError("Assigning unknown variable '$$opt' on command line.")
+ return()
+ }
+ config.input.$$var = $$val
+ export(config.input.$$var)
+ next()
+ }
+
# parse out opt and val
contains(c, "^--?enable-(.*)") {
opt = $$replace(c, "^--?enable-(.*)", "\\1")
@@ -353,14 +367,60 @@ defineTest(qtConfSetupLibraries) {
}
}
}
+
+ # reverse mapping for assignments on command line.
+ for (a, config.commandline.assignments._KEYS_) {
+ apfx = config.commandline.assignments.$${a}
+ ra = config.commandline.rev_assignments.$$eval($$apfx)
+ $$ra = $$a
+ export($$ra)
+ }
}
# the library is specified inline in a 'libs' field.
-# this source type cannot fail.
+# overrides from the command line are accepted.
defineTest(qtConfLibrary_inline) {
lib = $$eval($${1}.library)
!defined($${1}.libs, var): \
error("'inline' source in library '$$lib' does not specify 'libs'.")
+
+ # direct libs. overwrites inline libs.
+ defined(config.input.$${lib}.libs, var) {
+ $${1}.libs = $$eval(config.input.$${lib}.libs)
+ export($${1}.libs)
+ }
+
+ # build-specific direct libs. overwrites inline libs.
+ vars =
+ any = false
+ all = true
+ for (b, $${1}.builds._KEYS_) {
+ iv = $${lib}.libs.$${b}
+ vars += $$eval(config.commandline.rev_assignments.$${iv})
+ defined(config.input.$${iv}, var) {
+ $${1}.builds.$${b}.libs = $$eval(config.input.$${iv})
+ export($${1}.builds.$${b}.libs)
+ any = true
+ } else {
+ all = false
+ }
+ }
+ $$any:!$$all {
+ qtConfAddError("Either none or all of $$join(vars, ", ", [, ]) must be specified.")
+ return(false)
+ }
+
+ # prefix. prepends to (possibly overwritten) inline libs.
+ prefix = $$val_escape(config.input.$${lib}.prefix)
+ !isEmpty(prefix) {
+ $${1}.includedir = $$prefix/include
+ export($${1}.includedir)
+ $${1}.cflags = -I$$prefix/include
+ export($${1}.cflags)
+ $${1}.libs = "-L$$prefix/lib $$eval($${1}.libs)"
+ export($${1}.libs)
+ }
+
return(true)
}