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
#-------------------------------------------------------------------------------
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
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"