CMake: Fix the generated location of static libraries.
[profile/ivi/qtbase.git] / configure
index 8f02fdf..364e4da 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,39 +1,39 @@
 #!/bin/sh
 #############################################################################
 ##
-## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-## Contact: http://www.qt-project.org/
+## Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+## Contact: http://www.qt-project.org/legal
 ##
 ## This file is the build configuration utility of the Qt Toolkit.
 ##
 ## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and Digia.  For licensing terms and
+## conditions see http://qt.digia.com/licensing.  For further information
+## use the contact form at http://qt.digia.com/contact-us.
+##
 ## GNU Lesser General Public License Usage
-## This file may be used under the terms of the GNU Lesser General Public
-## License version 2.1 as published by the Free Software Foundation and
-## appearing in the file LICENSE.LGPL included in the packaging of this
-## file. Please review the following information to ensure the GNU Lesser
-## General Public License version 2.1 requirements will be met:
-## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file.  Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 ##
-## In addition, as a special exception, Nokia gives you certain additional
-## rights. These rights are described in the Nokia Qt LGPL Exception
+## In addition, as a special exception, Digia gives you certain additional
+## rights.  These rights are described in the Digia Qt LGPL Exception
 ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 ##
 ## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU General
-## Public License version 3.0 as published by the Free Software Foundation
-## and appearing in the file LICENSE.GPL included in the packaging of this
-## file. Please review the following information to ensure the GNU General
-## Public License version 3.0 requirements will be met:
-## http://www.gnu.org/copyleft/gpl.html.
-##
-## Other Usage
-## Alternatively, this file may be used in accordance with the terms and
-## conditions contained in a signed written agreement between you and Nokia.
-##
-##
-##
-##
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3.0 as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL included in the
+## packaging of this file.  Please review the following information to
+## ensure the GNU General Public License version 3.0 requirements will be
+## met: http://www.gnu.org/copyleft/gpl.html.
 ##
 ##
 ## $QT_END_LICENSE$
@@ -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
 #-------------------------------------------------------------------------------
@@ -334,13 +394,6 @@ if [ -z "$QT_MAJOR_VERSION" ]; then
    exit 1
 fi
 
-QT_PACKAGEDATE=`grep '^# *define *QT_PACKAGEDATE_STR' "$relpath"/src/corelib/global/qglobal.h | sed -e 's,^# *define *QT_PACKAGEDATE_STR *"\([^ ]*\)"$,\1,' -e s,-,,g`
-if [ -z "$QT_PACKAGEDATE" ]; then
-   echo "Unable to determine package date from qglobal.h: '$QT_PACKAGEDATE'"
-   echo "Cannot proceed"
-   exit 1
-fi
-
 #-------------------------------------------------------------------------------
 # check the license
 #-------------------------------------------------------------------------------
@@ -457,7 +510,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
             echo
             echo "You are using an old license file."
             echo
-            echo "Please install the license file supplied by Nokia,"
+            echo "Please install the license file supplied by Digia,"
             echo "or install the Qt Open Source Edition if you intend to"
             echo "develop free software."
             exit 1
@@ -564,9 +617,9 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
             echo
             echo "You are not licensed for the $Platform platform."
             echo
-            echo "Please contact qt-info@nokia.com to upgrade your license to"
-            echo "include the $Platform platform, or install the Qt Open Source Edition"
-            echo "if you intend to develop free software."
+            echo "Please use the contact form at http://qt.digia.com/contact-us"
+            echo "to upgrade your license to include the $Platform platform, or install"
+            echo "the Qt Open Source Edition if you intend to develop free software."
             exit 1
             ;;
     esac
@@ -685,6 +738,7 @@ MIN_DBUS_1_VERSION=0.93
 # initalize internal variables
 CFG_CONFIGURE_EXIT_ON_ERROR=yes
 CFG_PROFILE=no
+CFG_STRIP=yes
 CFG_GUI=auto # (yes|no|auto)
 CFG_WIDGETS=yes
 CFG_QCONFIG=full
@@ -777,8 +831,8 @@ CFG_REDUCE_RELOCATIONS=auto
 CFG_ACCESSIBILITY=auto
 CFG_IWMMXT=no
 CFG_NEON=auto
-CFG_MIPS_DSP=yes
-CFG_MIPS_DSPR2=yes
+CFG_MIPS_DSP=auto
+CFG_MIPS_DSPR2=auto
 CFG_CLOCK_GETTIME=auto
 CFG_CLOCK_MONOTONIC=auto
 CFG_MREMAP=auto
@@ -788,7 +842,6 @@ CFG_GETIFADDRS=auto
 CFG_INOTIFY=auto
 CFG_RPATH=yes
 CFG_FRAMEWORK=auto
-MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
 CFG_MAC_HARFBUZZ=no
 CFG_PREFIX_INSTALL=yes
 CFG_SDK=
@@ -1245,6 +1298,13 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
         ;;
+    strip)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+            CFG_STRIP=$VAL
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
     testcocoon)
         if [ "$VAL" = "yes" ]; then
             QTCONFIG_CONFIG="$QTCONFIG_CONFIG testcocoon"
@@ -1309,7 +1369,12 @@ while [ "$#" -gt 0 ]; do
         ;;
     xplatform)
         XPLATFORM="$VAL"
-        case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
+        case `basename "$XPLATFORM"` in win32-g++*)
+            XPLATFORM_MINGW=yes
+            CFG_RPATH=no
+            CFG_REDUCE_EXPORTS=no
+            ;;
+        esac
         ;;
     device)
         XPLATFORM=`resolveDeviceMkspec $VAL`
@@ -2398,7 +2463,7 @@ fi
 [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
 
 case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
-case "$XPLATFORM" in linux-g++-maemo) XPLATFORM_MAEMO=yes;; esac
+case "$XPLATFORM" in *-maemo*) XPLATFORM_MAEMO=yes;; esac
 case "$XPLATFORM" in *qnx-*|*blackberry-*) XPLATFORM_QNX=yes;; esac
 
 if [ -d "$PLATFORM" ]; then
@@ -2456,7 +2521,7 @@ if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
     echo
     echo "      $XQMAKESPEC/qplatformdefs.h"
     echo
-    echo "   Please contact qt-info@nokia.com."
+    echo "   Please use the contact form at http://qt.digia.com/contact-us"
     echo
     exit 2
 fi
@@ -2475,9 +2540,9 @@ if [ "$CFG_RTOS_ENABLED" = "no" ]; then
             echo ""
             echo "You are not licensed for Qt for `basename $XPLATFORM`."
             echo ""
-            echo "Please contact qt-info@nokia.com to upgrade your license to"
-            echo "include this platform, or install the Qt Open Source Edition"
-            echo "if you intend to develop free software."
+            echo "Please use the contact form at http://qt.digia.com/contact-us"
+            echo "to upgrade your license to include this platform, or install"
+            echo "the Qt Open Source Edition if you intend to develop free software."
             exit 1
            ;;
     esac
@@ -2508,9 +2573,11 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then
     QT_CONFIG="$QT_CONFIG force_debug_info"
 fi
 
-# pass on $CFG_SDK to the configure tests.
-if [ '!' -z "$CFG_SDK" ]; then
-    MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -sdk $CFG_SDK"
+# pass on $CFG_SDK to the arch/configure tests.
+if [ -n "$CFG_SDK" ]; then
+    MAC_SDK_FLAG="-sdk $CFG_SDK"
+else
+    MAC_SDK_FLAG=
 fi
 
 # find the default framework value
@@ -2536,6 +2603,7 @@ if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
         exit 1
     fi
 fi
+TEST_COMPILER_CXXFLAGS=`getXQMakeConf QMAKE_CXXFLAGS`
 
 GCC_MACHINE_DUMP=
 case "$TEST_COMPILER" in *g++) GCC_MACHINE_DUMP=$($TEST_COMPILER -dumpmachine);; esac
@@ -2561,11 +2629,8 @@ fi
 
 # auto-detect support for separate debug info in objcopy
 if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
-    TEST_COMPILER_CFLAGS=`getXQMakeConf QMAKE_CFLAGS`
-    TEST_COMPILER_CXXFLAGS=`getXQMakeConf QMAKE_CXXFLAGS`
     TEST_OBJCOPY=`getXQMakeConf QMAKE_OBJCOPY`
     COMPILER_WITH_FLAGS="$TEST_COMPILER $TEST_COMPILER_CXXFLAGS"
-    COMPILER_WITH_FLAGS=`echo "$COMPILER_WITH_FLAGS" | sed -e "s%\\$\\$QMAKE_CFLAGS%$TEST_COMPILER_CFLAGS%g"`
     if "$unixtests/objcopy.test" "$COMPILER_WITH_FLAGS" "$TEST_OBJCOPY" "$OPT_VERBOSE"; then
        CFG_SEPARATE_DEBUG_INFO=no
     else
@@ -2628,6 +2693,20 @@ else
     CFG_FRAMEWORK=no
 fi
 
+# auto-detect default include and library search paths
+gccout=`$TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null`
+libdirs=`echo "$gccout" | sed -n -e 's/^LIBRARY_PATH=\(.*\)/\1/p'`
+DEFAULT_LIBDIRS=`IFS=:; for i in $libdirs; do test -d "$i" && cd "$i" && pwd; done | sort -u`
+DEFAULT_INCDIRS=`echo "$gccout" | awk '
+/^End of search/ { yup=0 }
+yup { print substr($0, 2) }
+/^\#include </ { yup=1 }
+' | sort -u`
+test -z "$DEFAULT_LIBDIRS" && DEFAULT_LIBDIRS="/lib
+/usr/lib"
+test -z "$DEFAULT_INCDIRS" && DEFAULT_INCDIRS="/usr/include
+/usr/local/include"
+
 #setup the build parts
 if [ -z "$CFG_BUILD_PARTS" ]; then
     CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
@@ -2939,9 +3018,8 @@ Installation options:
                          Qt. This will install into
                          $QT_INSTALL_PREFIX, if this option is
                          disabled then some platforms will attempt a
-                         "system" install by placing default values to
-                         be placed in a system location other than
-                         PREFIX.
+                         "system" install by placing default values
+                         in a system location other than PREFIX.
 
  You may use these to separate different parts of the install:
 
@@ -3129,6 +3207,12 @@ Additional options:
  $CIN  -no-iconv .......... Do not compile support for iconv(3).
  $CIY  -iconv ............. Compile support for iconv(3).
 
+    -no-icu ............ Do not compile support for ICU libraries.
+ +  -icu ............... Compile support for ICU libraries.
+
+    -no-strip .......... Do not strip binaries and libraries of unneeded symbols.
+ *  -strip ............. Strip binaries and libraries of unneeded symbols when installing.
+
  $PHN  -no-pch ............ Do not use precompiled header support.
  $PHY  -pch ............... Use precompiled header support.
 
@@ -3314,38 +3398,23 @@ elif [ "$Edition" != "OpenSource" ]; then
         if [ "$Today" -gt "$ExpiryDate" ]; then
             case "$LicenseType" in
             Commercial|Academic|Educational)
-                if [ "$QT_PACKAGEDATE" -gt "$ExpiryDate" ]; then
-                    echo
-                    echo "NOTICE  NOTICE  NOTICE  NOTICE"
-                    echo
-                    echo "  Your support and upgrade period has expired."
-                    echo
-                    echo "  You are no longer licensed to use this version of Qt."
-                    echo "  Please contact qt-info@nokia.com to renew your support"
-                    echo "  and upgrades for this license."
-                    echo
-                    echo "NOTICE  NOTICE  NOTICE  NOTICE"
-                    echo
-                    exit 1
-                else
-                    echo
-                    echo "WARNING  WARNING  WARNING  WARNING"
-                    echo
-                    echo "  Your support and upgrade period has expired."
-                    echo
-                    echo "  You may continue to use your last licensed release"
-                    echo "  of Qt under the terms of your existing license"
-                    echo "  agreement. But you are not entitled to technical"
-                    echo "  support, nor are you entitled to use any more recent"
-                    echo "  Qt releases."
-                    echo
-                    echo "  Please contact qt-info@nokia.com to renew your"
-                    echo "  support and upgrades for this license."
-                    echo
-                    echo "WARNING  WARNING  WARNING  WARNING"
-                    echo
-                    sleep 3
-                fi
+                echo
+                echo "WARNING  WARNING  WARNING  WARNING"
+                echo
+                echo "  Your support and upgrade period has expired."
+                echo
+                echo "  You may continue to use your last licensed release"
+                echo "  of Qt under the terms of your existing license"
+                echo "  agreement. But you are not entitled to technical"
+                echo "  support, nor are you entitled to use any more recent"
+                echo "  Qt releases."
+                echo
+                echo "  Please use the contact form at http://qt.digia.com/contact-us"
+                echo "  to renew your support and upgrades for this license."
+                echo
+                echo "WARNING  WARNING  WARNING  WARNING"
+                echo
+                sleep 3
                 ;;
             Evaluation|*)
                 echo
@@ -3354,9 +3423,9 @@ elif [ "$Edition" != "OpenSource" ]; then
                 echo "  Your Evaluation license has expired."
                 echo
                 echo "  You are no longer licensed to use this software. Please"
-                echo "  contact qt-info@nokia.com to purchase license, or install"
-                echo "  the Qt Open Source Edition if you intend to develop free"
-                echo "  software."
+                echo "  use the contact form at http://qt.digia.com/contact-us to"
+                echo "  purchase license, or install the Qt Open Source Edition"
+                echo "  if you intend to develop free software."
                 echo
                 echo "NOTICE  NOTICE  NOTICE  NOTICE"
                 echo
@@ -3483,13 +3552,7 @@ fi
 
 # symlink includes
 if [ -n "$PERL" ] && [ -x "$relpath/bin/syncqt" ]; then
-    SYNCQT_OPTS=
-    [ "$CFG_DEV" = "yes" ] && SYNCQT_OPTS="$SYNCQT_OPTS -check-includes"
-    if [ "$OPT_SHADOW" = "yes" ]; then
-        "$outpath/bin/syncqt" $SYNCQT_OPTS "$relpath" || exit 1
-    elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ] || [ -d $relpath/.git ]; then
-        QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS || exit 1
-    fi
+    "$outpath/bin/syncqt" -minimal -module QtCore "$relpath" || exit 1
 fi
 
 # $1: input variable name (awk regexp)
@@ -3506,25 +3569,6 @@ setBootstrapVariable()
 if true; then ###[ '!' -f "$outpath/bin/qmake" ];
     echo "Creating qmake. Please wait..."
 
-    OLD_QCONFIG_H=
-    QCONFIG_H="$outpath/src/corelib/global/qconfig.h"
-    QMAKE_QCONFIG_H="${QCONFIG_H}.qmake"
-    if [ -f "$QCONFIG_H" ]; then
-         OLD_QCONFIG_H=$QCONFIG_H
-         mv -f "$OLD_QCONFIG_H" "${OLD_QCONFIG_H}.old"
-    fi
-
-    # create temporary qconfig.h for compiling qmake, if it doesn't exist
-    # when building qmake, we use #defines for the install paths,
-    # however they are real functions in the library
-    if [ '!' -f "$QMAKE_QCONFIG_H" ]; then
-        mkdir -p "$outpath/src/corelib/global"
-        [ -f "$QCONFIG_H" ] && chmod +w "$QCONFIG_H"
-        echo "/* All features enabled while building qmake */" >"$QMAKE_QCONFIG_H"
-    fi
-
-    mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
-
     #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
     rm -rf mkspecs/default mkspecs/default-host
     ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
@@ -3635,11 +3679,7 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
         fi
     done
 
-    QMAKE_BUILD_ERROR=no
-    (cd "$outpath/qmake"; "$MAKE") || QMAKE_BUILD_ERROR=yes
-    [ '!' -z "$QCONFIG_H" ] && mv -f "$QCONFIG_H" "$QMAKE_QCONFIG_H" #move qmake's qconfig.h to qconfig.h.qmake
-    [ '!' -z "$OLD_QCONFIG_H" ] && mv -f "${OLD_QCONFIG_H}.old" "$OLD_QCONFIG_H" #put back qconfig.h
-    [ "$QMAKE_BUILD_ERROR" = "yes" ] && exit 2
+    (cd "$outpath/qmake"; "$MAKE") || exit 2
 fi # Build qmake
 
 #-------------------------------------------------------------------------------
@@ -3653,11 +3693,22 @@ Prefix=..
 EOF
 
 #-------------------------------------------------------------------------------
+# write out device config before we run the test.
+#-------------------------------------------------------------------------------
+DEVICE_VARS_OUTFILE="$outpath/mkspecs/qdevice.pri"
+if cmp -s "$DEVICE_VARS_FILE" "$DEVICE_VARS_OUTFILE"; then
+    rm -f "$DEVICE_VARS_FILE"
+else
+    mv -f $DEVICE_VARS_FILE "$DEVICE_VARS_OUTFILE"
+    DEVICE_VARS_FILE="$DEVICE_VARS_OUTFILE"
+fi
+
+#-------------------------------------------------------------------------------
 # Detect pkg-config
 #-------------------------------------------------------------------------------
 if [ -z "$PKG_CONFIG" ]; then
     # See if PKG_CONFIG is set in the mkspec:
-    PKG_CONFIG=`getXQMakeConf PKG_CONFIG`
+    PKG_CONFIG="`"$outpath/bin/qmake" -E -nocache -spec "$XQMAKESPEC" "CONFIG=" /dev/null 2>&1 | sed -n -e 's,^PKG_CONFIG = \(.*\),\1,p'`"
 fi
 if [ -z "$PKG_CONFIG" ]; then
     PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
@@ -3720,17 +3771,6 @@ if [ -z "$PKG_CONFIG" ]; then
 fi
 
 #-------------------------------------------------------------------------------
-# write out device config before we run the test.
-#-------------------------------------------------------------------------------
-DEVICE_VARS_OUTFILE="$outpath/mkspecs/qdevice.pri"
-if cmp -s "$DEVICE_VARS_FILE" "$DEVICE_VARS_OUTFILE"; then
-    rm -f "$DEVICE_VARS_FILE"
-else
-    mv -f $DEVICE_VARS_FILE "$DEVICE_VARS_OUTFILE"
-    DEVICE_VARS_FILE="$DEVICE_VARS_OUTFILE"
-fi
-
-#-------------------------------------------------------------------------------
 # tests that need qmake
 #-------------------------------------------------------------------------------
 
@@ -3740,7 +3780,7 @@ compileTest()
     path=config.tests/$1
     name=$2
     shift 2
-    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS $MAC_CONFIG_TEST_COMMANDLINE "$@"
+    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS $MAC_SDK_FLAG "$@"
 }
 
 #-------------------------------------------------------------------------------
@@ -3749,7 +3789,7 @@ compileTest()
 
 # Use config.tests/arch/arch.pro to have the compiler tell us what the target architecture is
 OUTFILE=$outpath/arch.result
-"$unixtests/arch.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "CFG" $MAC_CONFIG_TEST_COMMANDLINE
+"$unixtests/arch.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "CFG" $MAC_SDK_FLAG
 if [ $? -eq 0 ]; then
     eval `cat "$OUTFILE"`
 else
@@ -3762,7 +3802,7 @@ rm -f "$OUTFILE" 2>/dev/null
 
 if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
     # Do the same test again, using the host compiler
-    SYSROOT_FLAG= "$unixtests/arch.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "CFG_HOST" $MAC_CONFIG_TEST_COMMANDLINE
+    SYSROOT_FLAG= "$unixtests/arch.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "CFG_HOST" $MAC_SDK_FLAG
     if [ $? -eq 0 ]; then
         eval `cat "$OUTFILE"`
     else
@@ -3790,7 +3830,7 @@ fi
 
 # Detect C++11 support
 if [ "$CFG_CXX11" != "no" ]; then
-    if compileTest unix/c++11 "C++11"; then
+    if compileTest common/c++11 "C++11"; then
         CFG_CXX11="yes"
     elif [ "$CFG_CXX11" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
         echo "C++11 support cannot be enabled due to functionality tests!"
@@ -3916,17 +3956,25 @@ elif [ "$CFG_ARCH" != "arm" ]; then
 fi
 
 # detect mips_dsp support
-if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSP}" = "yes" ]; then
-  CFG_MIPS_DSP=yes
+if [ "$CFG_ARCH" = "mips" ] && [ "${CFG_MIPS_DSP}" = "auto" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mips_dsp "mips_dsp" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
+        CFG_MIPS_DSP=yes
     else
-  CFG_MIPS_DSP=no
+        CFG_MIPS_DSP=no
+    fi
+elif [ "$CFG_ARCH" != "mips" ]; then
+    CFG_MIPS_DSP=no
 fi
 
 # detect mips_dspr2 support
-if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "yes" ]; then
-  CFG_MIPS_DSPR2=yes
+if [ "$CFG_ARCH" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "auto" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mips_dspr2 "mips_dspr2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
+        CFG_MIPS_DSPR2=yes
     else
-  CFG_MIPS_DSPR2=no
+        CFG_MIPS_DSPR2=no
+    fi
+elif [ "$CFG_ARCH" != "mips" ]; then
+    CFG_MIPS_DSPR2=no
 fi
 
 [ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
@@ -4028,9 +4076,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
@@ -4079,8 +4127,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"
@@ -4694,8 +4742,8 @@ fi
 
 if [ "$CFG_XCB" != "no" ]; then
     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists "xcb >= 1.5" 2>/dev/null; then
-        QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb 2>/dev/null`"
-        QMAKE_LIBS_XCB="`$PKG_CONFIG --libs xcb 2>/dev/null`"
+        QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb xcb-image xcb-keysyms xcb-icccm xcb-sync xcb-xfixes xcb-randr 2>/dev/null`"
+        QMAKE_LIBS_XCB="`$PKG_CONFIG --libs xcb xcb-image xcb-keysyms xcb-icccm xcb-sync xcb-xfixes xcb-randr 2>/dev/null`"
     fi
     if compileTest qpa/xcb "xcb" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
         CFG_XCB=yes
@@ -4802,7 +4850,7 @@ else
 fi
 
 # EGL Support
-if [ "$CFG_EGL" != "no" ] && [ "$CFG_OPENGL" != "desktop" ]; then
+if [ "$CFG_EGL" != "no" ]; then
     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then
         QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
         QMAKE_LIBS_EGL=`$PKG_CONFIG --libs egl 2>/dev/null`
@@ -5245,6 +5293,7 @@ if [ "$CFG_USE_GNUMAKE" = "yes" ]; then
 fi
 [ "$CFG_REDUCE_EXPORTS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_exports"
 [ "$CFG_REDUCE_RELOCATIONS" = "yes" ] && QT_CONFIG="$QT_CONFIG reduce_relocations"
+[ "$CFG_STRIP" = "no" ] && QMAKE_CONFIG="$QMAKE_CONFIG nostrip"
 [ "$CFG_PRECOMPILE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG precompile_header"
 if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
     QMakeVar add QMAKE_CFLAGS -g
@@ -5697,6 +5746,20 @@ if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
     echo "#define QT_REDUCE_RELOCATIONS" >>"$outpath/src/corelib/global/qconfig.h.new"
 fi
 
+# Add compiler sub-architecture support
+echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
+echo "// Compiler sub-arch support" >>"$outpath/src/corelib/global/qconfig.h.new"
+for SUBARCH in SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 AVX AVX2 \
+    IWMMXT NEON \
+    MIPS_DSP MIPS_DSPR2; do
+    eval "VAL=\$CFG_$SUBARCH"
+    case "$VAL" in
+        yes)
+            echo "#define QT_COMPILER_SUPPORTS_$SUBARCH" \
+                >>"$outpath/src/corelib/global/qconfig.h.new"
+            ;;
+    esac
+done
 
 echo "" >>"$outpath/src/corelib/global/qconfig.h.new"
 
@@ -5726,7 +5789,6 @@ for DRIVER in $CFG_SQL_AVAILABLE; do
     esac
 done
 
-
 QMakeVar set sql-drivers "$SQL_DRIVERS"
 QMakeVar set sql-plugins "$SQL_PLUGINS"
 
@@ -5887,6 +5949,8 @@ QT_ARCH = $CFG_ARCH
 QT_HOST_ARCH = $CFG_HOST_ARCH
 QT_CPU_FEATURES = $CFG_CPUFEATURES
 QT_HOST_CPU_FEATURES = $CFG_HOST_CPUFEATURES
+QMAKE_DEFAULT_LIBDIRS = `echo "$DEFAULT_LIBDIRS" | sed 's,^,",;s,$,",' | tr '\n' ' '`
+QMAKE_DEFAULT_INCDIRS = `echo "$DEFAULT_INCDIRS" | sed 's,^,",;s,$,",' | tr '\n' ' '`
 QT_EDITION = $Edition
 QT_CONFIG += $QT_CONFIG
 
@@ -6011,7 +6075,7 @@ QT_SOURCE_TREE = \$\$quote($relpath)
 QT_BUILD_TREE = \$\$quote($outpath)
 
 include(\$\$PWD/mkspecs/qmodule.pri)
-CONFIG += dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
+CONFIG += dylib fix_output_dirs no_private_qt_headers_warning QTDIR_build
 
 EOF