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>
This commit is contained in:
Lars Knoll 2016-08-10 12:34:24 +02:00 committed by Oswald Buddenhagen
parent 98ddf9262e
commit 9172143f52
3 changed files with 87 additions and 6 deletions

View File

@ -1,4 +1,8 @@
Usage: configure [options]
Usage: configure [options] [assignments]
Configure understands variable assignments like VAR=value on the command line.
These override any values possibly obtained from pkg-config. The variables
are mentioned in the descriptions of the options they relate to.
Top-level installation directories:
-prefix <dir> ...... The deployment directory, as seen on the target device.
@ -161,6 +165,7 @@ Component selection:
-no-dbus ............. Do not build the Qt D-Bus module [default on Android]
-dbus-linked ......... Build Qt D-Bus and link to libdbus-1 [auto]
-dbus-runtime ........ Build Qt D-Bus and dynamically load libdbus-1 [no]
DBUS_PATH= DBUS_HOST_PATH=
-feature-<feature> ... Enable <feature>. The available features are described
in src/corelib/global/qfeatures.txt. [all enabled]
-accessibility ....... Enable accessibility support [yes]
@ -182,6 +187,7 @@ Core options:
-pps ................. Enable PPS support [auto] (QNX only)
-pcre ................ Select used libpcre3 [system/qt]
-zlib ................ Select used zlib [system/qt]
ZLIB_LIBS=
Logging backends:
-journald .......... Enable journald support [no]
@ -194,6 +200,7 @@ Network options:
-no-openssl .......... Do not use OpenSSL [default on Apple]
-openssl-linked ...... Use OpenSSL and link to libssl [no]
-openssl-runtime ..... Use OpenSSL and dynamically load libssl [auto]
OPENSSL_PATH= OPENSSL_LIBS=
-securetransport ..... Use SecureTransport [auto] (Apple only)
-sctp ................ Enable SCTP support [no]
@ -256,6 +263,7 @@ Database options:
-sql-<driver> ........ Enable SQL <driver> plugin. Supported drivers:
db2 ibase mysql oci odbc psql sqlite2 sqlite tds
[all auto]
MYSQL_PATH= PSQL_LIBS= SYBASE= SYBASE_LIBS=
-sqlite .............. Select used sqlite3 [system/qt]
Multimedia options:

View File

@ -6,6 +6,17 @@
},
"commandline": {
"assignments": {
"DBUS_HOST_PATH": "host_dbus.prefix",
"DBUS_PATH": "dbus.prefix",
"MYSQL_PATH": "mysql.prefix",
"OPENSSL_LIBS": "openssl.libs",
"OPENSSL_PATH": "openssl.prefix",
"PSQL_LIBS": "psql.libs",
"SYBASE": "tds.prefix",
"SYBASE_LIBS": "tds.libs",
"ZLIB_LIBS": "zlib.libs"
},
"options": {
"prefix": "string",
"hostprefix": "string",
@ -421,7 +432,8 @@
"description": "D-Bus >= 1.2 (host)",
"export": "",
"sources": [
{ "type": "pkgConfig", "host": true, "args": "dbus-1 >= 1.2" }
{ "type": "pkgConfig", "host": true, "args": "dbus-1 >= 1.2" },
{ "libs": "", "comment": "placeholder for DBUS_HOST_PATH" }
]
},
"libinput": {
@ -2447,7 +2459,8 @@ XKB configuration data. This is required for keyboard input support."
},
{
"type": "note",
"condition": "features.openssl-linked && libs.openssl.source != 0",
"condition": "features.openssl-linked && libs.openssl.source != 0
&& input.openssl.prefix == '' && input.openssl.libs == ''",
"message": "When linking against OpenSSL, you can override the default
library names through OPENSSL_LIBS.
For example:

View File

@ -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)
}