filter standard paths from mysql_config & pg_config
standard paths should never be added to compiler/linker lines, as they are likely to mess up the lookup order. pkg-config does that filtering for us, but the home-grown config tools don't, so we need to take care of it. configure.exe does not have such auto-detection, so the change is not necessary there. Task-number: QTBUG-26850 Change-Id: I2f523d5cffb27c3d0a16cdef6ca8a4877c9983c0 Reviewed-by: Mark Brand <mabrand@mabrand.nl> Reviewed-by: Mitch Curtis <mitch.curtis@nokia.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
This commit is contained in:
parent
ab9fde6c0c
commit
72a7c43e90
70
configure
vendored
70
configure
vendored
@ -248,6 +248,66 @@ linkerSupportsFlag()
|
||||
compilerSupportsFlag "$lflags" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# $1: newline-separated list of default paths
|
||||
# stdin: input path
|
||||
# stdout: input path or nothing
|
||||
filterDefaultPaths()
|
||||
{
|
||||
local path
|
||||
path=`cat`
|
||||
echo "$1" | grep "^$path\$" > /dev/null || echo "$path"
|
||||
}
|
||||
|
||||
filterIncludePath()
|
||||
{
|
||||
filterDefaultPaths "$DEFAULT_INCDIRS"
|
||||
}
|
||||
|
||||
filterLibraryPath()
|
||||
{
|
||||
filterDefaultPaths "$DEFAULT_LIBDIRS"
|
||||
}
|
||||
|
||||
filterPathOptionsHelper()
|
||||
{
|
||||
local flag defpaths sep p path
|
||||
flag=$1; shift
|
||||
defpaths=$1; shift
|
||||
sep=
|
||||
for p in "$@"; do
|
||||
path=${p#$flag}
|
||||
if [ "x$path" != "x$p" ]; then
|
||||
path=`echo "$path" | filterDefaultPaths "$defpaths"`
|
||||
test -z "$path" && continue
|
||||
fi
|
||||
# Re-quote for shell & qmake
|
||||
p=`echo "$p" | sed 's,[^ ]* .*,"&",g'`
|
||||
printf "%s%s" "$sep" "$p"
|
||||
sep=" "
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
# $1: flag
|
||||
# $2: newline-separated list of default paths
|
||||
# stdin: list of command line options
|
||||
# sdout: stdin without the options naming default paths
|
||||
filterPathOptions()
|
||||
{
|
||||
# The eval does escape interpretation for us
|
||||
eval filterPathOptionsHelper $1 "\"$2\"" "`cat`"
|
||||
}
|
||||
|
||||
filterIncludeOptions()
|
||||
{
|
||||
filterPathOptions -I "$DEFAULT_INCDIRS"
|
||||
}
|
||||
|
||||
filterLibraryOptions()
|
||||
{
|
||||
filterPathOptions -L "$DEFAULT_LIBDIRS"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# device options
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -4046,9 +4106,9 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
|
||||
if [ "$CFG_SQL_mysql" != "no" ]; then
|
||||
[ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
|
||||
if [ -x "$CFG_MYSQL_CONFIG" ]; then
|
||||
QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
|
||||
QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null`
|
||||
QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null`
|
||||
QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null | filterIncludeOptions`
|
||||
QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null | filterLibraryOptions`
|
||||
QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null | filterLibraryOptions`
|
||||
QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null`
|
||||
QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1`
|
||||
fi
|
||||
@ -4097,8 +4157,8 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
|
||||
if [ "$CFG_SQL_psql" != "no" ]; then
|
||||
# Be careful not to use native pg_config when cross building.
|
||||
if [ "$XPLATFORM_MINGW" != "yes" ] && "$WHICH" pg_config >/dev/null 2>&1; then
|
||||
QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
|
||||
QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
|
||||
QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null | filterIncludePath`
|
||||
QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null | filterLibraryPath`
|
||||
fi
|
||||
[ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
|
||||
[ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
|
||||
|
Loading…
Reference in New Issue
Block a user