fix handling of multi-token fields in config test definitions

standardize on the fields in the json structure being single strings in
which separate elements are quoted and space-joined (because quoting
is unlikely to be necessary in the json file itself, and this format
avoids the visual noise of array handling).

the quoting itself is expected to be qmake-compatible, which is assumed
to be the case for the output of pkg-config (it's actually shell-quoted,
but that's the same except in some not-so-relevant corner cases).

Change-Id: Icc1d7abc02c449fa759d9714bc5e56e2b8809585
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Oswald Buddenhagen 2016-07-20 20:22:50 +02:00 committed by Lars Knoll
parent 53e06e68b6
commit 62838f07d4
2 changed files with 31 additions and 22 deletions

View File

@ -293,15 +293,17 @@ defineTest(qtConfTest_psqlCompile) {
isEmpty(pg_config): \
pg_config = $$qtConfFindInPath("pg_config")
!win32:!isEmpty(pg_config) {
libdir = $$system("$$pg_config --libdir")
libdir = $$system("$$pg_config --libdir", lines)
libdir -= $$QMAKE_DEFAULT_LIBDIRS
!isEmpty(libdir): libs = "-L$$libdir"
libs =
!isEmpty(libdir): libs += "-L$$libdir"
libs += "-lpq"
$${1}.libs = $$libs
$${1}.includedir = $$system("$$pg_config --includedir")
$${1}.includedir -= $$QMAKE_DEFAULT_INCDIRS
!isEmpty($${1}.includedir): \
$${1}.cflags = "-I$$eval($${1}.includedir)"
$${1}.libs = "$$val_escape(libs)"
includedir = $$system("$$pg_config --includedir", lines)
includedir -= $$QMAKE_DEFAULT_INCDIRS
$${1}.includedir = "$$val_escape(includedir)"
!isEmpty(includedir): \
$${1}.cflags = "-I$$val_escape(includedir)"
}
# Respect PSQL_LIBS if set
@ -328,15 +330,19 @@ defineTest(qtConfTest_mysqlCompile) {
# query is either --libs or --libs_r
query = $$eval($${1}.query)
$${1}.libs = $$filterLibraryPath($$system("$$mysql_config $$query"))
libs = $$system("$$mysql_config $$query", lines)
eval(libs = $$libs)
libs = $$filterLibraryPath($$libs)
# -rdynamic should not be returned by mysql_config, but is on RHEL 6.6
$${1}.libs -= -rdynamic
includedir = $$system("$$mysql_config --include")
libs -= -rdynamic
$${1}.libs = "$$val_escape(libs)"
includedir = $$system("$$mysql_config --include", lines)
eval(includedir = $$includedir)
includedir ~= s/^-I//g
includedir -= $$QMAKE_DEFAULT_INCDIRS
$${1}.includedir = $$includedir
!isEmpty($${1}.includedir): \
$${1}.cflags = "-I$$eval($${1}.includedir)"
$${1}.includedir = "$$val_escape(includedir)"
!isEmpty(includedir): \
$${1}.cflags = "-I$$val_escape(includedir)"
export($${1}.libs)
export($${1}.includedir)
export($${1}.cflags)
@ -347,10 +353,12 @@ defineTest(qtConfTest_mysqlCompile) {
}
defineTest(qtConfTest_tdsCompile) {
libs =
sybase = $$getenv(SYBASE)
!isEmpty(sybase): \
$${1}.libs = "-L$${sybase}/lib"
$${1}.libs += $$getenv(SYBASE_LIBS)
libs += "-L$${sybase}/lib"
libs += $$getenv(SYBASE_LIBS)
$${1}.libs = "$$val_escape(libs)"
export($${1}.libs)
qtConfTest_compile($${1}): return(true)

View File

@ -350,11 +350,12 @@ defineTest(qtConfTest_pkgConfig) {
!qtConfPkgConfigPackageExists($$pkg_config, $$args): \
return(false)
$${1}.libs = $$system("$$pkg_config --libs $$args")
$${1}.cflags = $$system("$$pkg_config --cflags $$args")
includes = $$system("$$pkg_config --cflags-only-I $$args")
$${1}.libs = $$system("$$pkg_config --libs $$args", lines)
$${1}.cflags = $$system("$$pkg_config --cflags $$args", lines)
includes = $$system("$$pkg_config --cflags-only-I $$args", lines)
eval(includes = $$includes)
includes ~= s/^-I//g
$${1}.includedir = $$includes
$${1}.includedir = "$$val_escape(includes)"
version = $$system("$$pkg_config --modversion $$args")
$${1}.version = $$first(version)
export($${1}.libs)
@ -1089,9 +1090,9 @@ defineTest(qtConfOutput_library) {
isEmpty(lookup): \
error("Output type 'library' used in feature '$$eval($${1}.feature)' without a 'test' entry.")
libs = $$eval($${lookup}.libs)
cflags = $$eval($${lookup}.cflags)
includes = $$eval($${lookup}.includedir)
eval(libs = $$eval($${lookup}.libs))
eval(cflags = $$eval($${lookup}.cflags))
eval(includes = $$eval($${lookup}.includedir))
version = $$split($${lookup}.version, '.')
!isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)