Save configuration feedback into config.summary
[profile/ivi/qtbase.git] / configure
index 95838ce..6ed6969 100755 (executable)
--- a/configure
+++ b/configure
@@ -71,8 +71,10 @@ QTCONFIG_CONFIG=
 QT_CONFIG=
 SUPPORTED=
 QMAKE_VARS_FILE=.qmake.vars
+DEVICE_VARS_FILE=.device.vars
 
 :> "$QMAKE_VARS_FILE"
+:> "$DEVICE_VARS_FILE"
 
 #-------------------------------------------------------------------------------
 # utility functions
@@ -224,6 +226,23 @@ linkerSupportsFlag()
 }
 
 #-------------------------------------------------------------------------------
+# device options
+#-------------------------------------------------------------------------------
+DeviceVar()
+{
+    case "$1" in
+        set)
+            eq="="
+            ;;
+        *)
+            echo >&2 "BUG: wrong command to QMakeVar: $1"
+            ;;
+    esac
+
+    echo "$2" "$eq" "$3" >> "$DEVICE_VARS_FILE"
+}
+
+#-------------------------------------------------------------------------------
 # operating system detection
 #-------------------------------------------------------------------------------
 
@@ -244,8 +263,6 @@ fi
 # window system detection
 #-------------------------------------------------------------------------------
 
-PLATFORM_X11=no
-PLATFORM_QPA=yes
 BUILD_ON_MAC=no
 PLATFORM_MAC=no
 if [ -d /System/Library/Frameworks/Carbon.framework ]; then
@@ -316,16 +333,6 @@ earlyArgParse()
             VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
             VAL=no
             ;;
-        -embedded-lite|-qpa)
-            VAR=qpa
-            # this option may or may not be followed by an argument
-            if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
-                VAL=auto
-            else
-                shift;
-                VAL=$1
-            fi
-            ;;
         -h|help|--help|-help)
             if [ "$VAL" = "yes" ]; then
                 OPT_HELP="$VAL"
@@ -355,16 +362,6 @@ earlyArgParse()
 
         UNKNOWN_OPT=no
         case "$VAR" in
-        qpa)
-            if [ "$PLATFORM_QPA" != "no" ]; then
-                if [ "$PLATFORM_QPA" = "maybe" ]; then
-                    PLATFORM_X11=no
-                    PLATFORM_QPA=yes
-                fi
-            else
-                echo "No license exists to enable Qt QPA. Disabling."
-            fi
-            ;;
         developer-build)
             CFG_DEV="yes"
             ;;
@@ -412,7 +409,6 @@ if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ];
 elif [ $COMMERCIAL_USER = "yes" ]; then
     # one of commercial editions
     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
-    [ "$PLATFORM_QPA" = "maybe" ] && PLATFORM_QPA=no
 
     # read in the license file
     if [ -f "$LICENSE_FILE" ]; then
@@ -505,7 +501,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
            ;;
     esac
     ### EMBEDDED_QPA logic missing ###
-    case "$PlatformCode,$PLATFORM_MAC,$PLATFORM_QWS" in
+    case "$PlatformCode,$PLATFORM_MAC" in
         X9,* | XC,* | XU,* | XW,* | XM,*)
             # Qt All-OS
             LICENSE_EXTENSION="-ALLOS"
@@ -514,11 +510,11 @@ elif [ $COMMERCIAL_USER = "yes" ]; then
             # Qt for Embedded Linux
             LICENSE_EXTENSION="-EMBEDDED"
             ;;
-        6M,*,no | N7,*,no | N9,*,no | NX,*,no)
+        6M,* | N7,* | N9,* | NX,*)
             # Embedded no-deploy
             LICENSE_EXTENSION="-EMBEDDED"
             ;;
-        FM,*,no | LM,yes,* | ZM,no,no)
+        FM,* | LM,yes | ZM,no)
             # Desktop
             LICENSE_EXTENSION="-DESKTOP"
             ;;
@@ -651,7 +647,7 @@ CFG_CONFIGURE_EXIT_ON_ERROR=yes
 CFG_PROFILE=no
 CFG_EXCEPTIONS=unspecified
 CFG_GUI=auto # (yes|no|auto)
-CFG_INCREMENTAL=auto
+CFG_WIDGETS=yes
 CFG_QCONFIG=full
 CFG_DEBUG=auto
 CFG_MYSQL_CONFIG=
@@ -679,23 +675,27 @@ CFG_OPENVG=auto
 CFG_OPENVG_LC_INCLUDES=no
 CFG_OPENVG_SHIVA=auto
 CFG_OPENVG_ON_OPENGL=auto
-CFG_EGL=no
-CFG_EGL_GLES_INCLUDES=no
+CFG_EGL=auto
 CFG_SSE=auto
 CFG_FONTCONFIG=auto
 CFG_LIBFREETYPE=auto
 CFG_SQL_AVAILABLE=
-QT_DEFAULT_BUILD_PARTS="libs examples tests"
+QT_DEFAULT_BUILD_PARTS="libs examples"
 CFG_BUILD_PARTS=""
 CFG_NOBUILD_PARTS=""
 CFG_RELEASE_QMAKE=no
 CFG_AUDIO_BACKEND=auto
 CFG_V8SNAPSHOT=auto
-CFG_DECLARATIVE_DEBUG=yes
+CFG_QML_DEBUG=yes
 CFG_JAVASCRIPTCORE_JIT=auto
 
+# Target architecture
 CFG_ARCH=
+# Host architecture, same as CFG_ARCH when not cross-compiling
 CFG_HOST_ARCH=
+# Set when the -arch or -host-arch arguments are used
+OPT_OBSOLETE_HOST_ARG=no
+
 CFG_USE_GNUMAKE=no
 CFG_IM=yes
 CFG_XINPUT2=auto
@@ -703,8 +703,9 @@ CFG_XINPUT=runtime
 CFG_XKB=auto
 CFG_XCB=auto
 CFG_XCB_LIMITED=yes
-CFG_WAYLAND=auto
+CFG_EGLFS=auto
 CFG_LIBUDEV=auto
+CFG_OBSOLETE_WAYLAND=no
 CFG_EVDEV=auto
 CFG_NIS=auto
 CFG_CUPS=auto
@@ -730,10 +731,11 @@ CFG_SSE4_1=auto
 CFG_SSE4_2=auto
 CFG_AVX=auto
 CFG_REDUCE_RELOCATIONS=auto
-CFG_NAS=no
 CFG_ACCESSIBILITY=auto
 CFG_IWMMXT=no
 CFG_NEON=auto
+CFG_MIPS_DSP=yes
+CFG_MIPS_DSPR2=yes
 CFG_CLOCK_GETTIME=auto
 CFG_CLOCK_MONOTONIC=auto
 CFG_MREMAP=auto
@@ -743,7 +745,6 @@ CFG_GETIFADDRS=auto
 CFG_INOTIFY=auto
 CFG_RPATH=yes
 CFG_FRAMEWORK=auto
-CFG_MAC_ARCHS=
 MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
 CFG_MAC_DWARF2=auto
 CFG_MAC_HARFBUZZ=no
@@ -775,6 +776,7 @@ CFG_NOPROCESS=no
 CFG_ICU=auto
 CFG_FORCE_ASSERTS=no
 CFG_PCRE=auto
+QPA_PLATFORM_GUARD=yes
 
 # initalize variables used for installation
 QT_INSTALL_PREFIX=
@@ -888,23 +890,18 @@ while [ "$#" -gt 0 ]; do
         VAL=no
         ;;
     #Qt style yes options
-    -incremental|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-wayland|-nis|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-debug-and-release|-exceptions|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-declarative-debug|-javascript-jit|-rpath|-force-pkg-config|-icu|-force-asserts|-testcocoon)
+    -profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-eglfs|-nis|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-debug-and-release|-exceptions|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-qml-debug|-javascript-jit|-rpath|-force-pkg-config|-icu|-force-asserts|-testcocoon)
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
         VAL=yes
         ;;
     #Qt style options that pass an argument
     -qconfig)
-        if [ "$PLATFORM_QPA" != "yes" ]; then
-            echo
-            echo "WARNING: -qconfig is only tested and supported on Qt for Embedded Linux."
-            echo
-        fi
         CFG_QCONFIG="$VAL"
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
         shift
         VAL=$1
         ;;
-    -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir)
+    -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir)
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
         shift
         VAL="$1"
@@ -924,16 +921,6 @@ while [ "$#" -gt 0 ]; do
         VAR=fatal_error
         VAL=no
         ;;
-    -embedded-lite|-qpa)
-        VAR=qpa
-        # this option may or may not be followed by an argument
-        if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
-            VAL=auto
-        else
-            shift;
-            VAL=$1
-        fi
-       ;;
     -opengl)
         VAR=opengl
         # this option may or may not be followed by an argument
@@ -1144,10 +1131,6 @@ while [ "$#" -gt 0 ]; do
     sxe)
        CFG_SXE="$VAL"
         ;;
-    embedded-lite|qpa)
-        PLATFORM_X11=no
-        PLATFORM_QPA=yes
-        ;;
     sse)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_SSE="$VAL"
@@ -1160,9 +1143,6 @@ while [ "$#" -gt 0 ]; do
             [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
             [ "$VAL" = "es2" ]; then
             CFG_OPENGL="$VAL"
-            if  [ "$VAL" = "es2" ]; then
-                CFG_EGL="yes"
-            fi
         else
             UNKNOWN_OPT=yes
         fi
@@ -1170,9 +1150,6 @@ while [ "$#" -gt 0 ]; do
     openvg)
         if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_OPENVG="$VAL"
-            if [ "$CFG_EGL" = "no" ] && [ "$VAL" != "no" ]; then
-                CFG_EGL=auto
-            fi
         else
             UNKNOWN_OPT=yes
         fi
@@ -1183,11 +1160,6 @@ while [ "$#" -gt 0 ]; do
     make)
        CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
         ;;
-    x11)
-        PLATFORM_QPA=no
-        PLATFORM_MAC=no
-        PLATFORM_X11=yes
-        ;;
     sdk)
         if [ "$BUILD_ON_MAC" = "yes" ]; then
             CFG_SDK="$VAL"
@@ -1202,17 +1174,8 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
        ;;
-    arch)
-        # if this is a Mac then "windows" probably means
-        # we are cross-compiling for MinGW
-        if [ "$BUILD_ON_MAC" = "yes" ] && [ "$VAL" != "windows" ]; then
-            CFG_MAC_ARCHS="$CFG_MAC_ARCHS $VAL"
-        else
-            CFG_ARCH=$VAL
-        fi
-        ;;
-    host-arch)
-        CFG_HOST_ARCH=$VAL
+    arch|host-arch)
+        OPT_OBSOLETE_HOST_ARG=yes
         ;;
     harfbuzz)
         if [ "$BUILD_ON_MAC" = "yes" ] && [ "$VAL" = "yes" ]; then
@@ -1315,6 +1278,14 @@ while [ "$#" -gt 0 ]; do
         XPLATFORM="$VAL"
         case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
         ;;
+    device)
+        XPLATFORM="devices/$VAL"
+        ;;
+    device-option)
+        DEV_VAR=`echo $VAL | sed "s,^\(.*\)=.*,\1,"`
+        DEV_VAL=`echo $VAL | sed "s,^.*=\(.*\),\1,"`
+        DeviceVar set $DEV_VAR $DEV_VAL
+        ;;
     debug-and-release)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_DEBUG_RELEASE="$VAL"
@@ -1360,13 +1331,6 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
         ;;
-    incremental)
-        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
-            CFG_INCREMENTAL="$VAL"
-        else
-            UNKNOWN_OPT=yes
-        fi
-        ;;
     fatal_error)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_CONFIGURE_EXIT_ON_ERROR="$VAL"
@@ -1559,6 +1523,20 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
         ;;
+    mips_dsp)
+        if [ "$VAL" = "no" ]; then
+            CFG_MIPS_DSP="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
+    mips_dspr2)
+        if [ "$VAL" = "no" ]; then
+            CFG_MIPS_DSPR2="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
     reduce-relocations)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_REDUCE_RELOCATIONS="$VAL"
@@ -1599,13 +1577,6 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
         ;;
-    nas-sound)
-        if [ "$VAL" = "system" ] || [ "$VAL" = "no" ]; then
-            CFG_NAS="$VAL"
-        else
-            UNKNOWN_OPT=yes
-        fi
-        ;;
     xcursor)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
             CFG_XCURSOR="$VAL"
@@ -1663,8 +1634,11 @@ while [ "$#" -gt 0 ]; do
         fi
         ;;
     wayland)
+        CFG_OBSOLETE_WAYLAND=yes
+        ;;
+    eglfs)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
-            CFG_WAYLAND="$VAL"
+            CFG_EGLFS="$VAL"
         else
             UNKNOWN_OPT=yes
         fi
@@ -1729,6 +1703,22 @@ while [ "$#" -gt 0 ]; do
             fi
         fi
         ;;
+    widgets)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
+            CFG_WIDGETS="yes"
+        elif [ "$VAL" = "no" ]; then
+            CFG_WIDGETS="no"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
+    qpa-platform-guard)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+            QPA_PLATFORM_GUARD="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
     dbus)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "linked" ]; then
             CFG_DBUS="$VAL"
@@ -1773,12 +1763,12 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
         ;;
-    declarative-debug)
+    qml-debug)
         if [ "$VAL" = "yes" ]; then
-            CFG_DECLARATIVE_DEBUG="yes"
+            CFG_QML_DEBUG="yes"
         else
             if [ "$VAL" = "no" ]; then
-                CFG_DECLARATIVE_DEBUG="no"
+                CFG_QML_DEBUG="no"
             else
                 UNKNOWN_OPT=yes
             fi
@@ -2061,9 +2051,9 @@ if [ "$OPT_SHADOW" = "yes" ]; then
     [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..."
 fi
 
-if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
+if [ "$PLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then
     echo
-    echo "WARNING: -debug-and-release is not supported anymore on Qt/X11 and Qt for Embedded Linux"
+    echo "WARNING: -debug-and-release is not supported outside of Mac OS X."
     echo "Qt can be built in release mode with separate debug information, so"
     echo "-debug-and-release is not necessary anymore"
     echo
@@ -2107,6 +2097,10 @@ if [ "$OPT_SHADOW" = "yes" ]; then
         fi
     done
 
+    # save a pre-existing mkspecs/modules dir
+    test -d "$outpath/mkspecs/modules" && \
+        mv "$outpath/mkspecs/modules" "$outpath/mkspecs-modules"
+
     # symlink the mkspecs directory
     mkdir -p "$outpath/mkspecs"
     rm -rf "$outpath"/mkspecs/*
@@ -2126,7 +2120,12 @@ if [ "$OPT_SHADOW" = "yes" ]; then
     ShadowMkspecs features
 
     # The modules dir is special, too.
-    ShadowMkspecs modules
+    if test -d "$outpath/mkspecs-modules"; then
+        rm -rf "$outpath/mkspecs/modules"
+        mv "$outpath/mkspecs-modules" "$outpath/mkspecs/modules"
+    else
+        ShadowMkspecs modules
+    fi
 
     # symlink the doc directory
     rm -rf "$outpath/doc"
@@ -2134,7 +2133,7 @@ if [ "$OPT_SHADOW" = "yes" ]; then
 fi
 
 # symlink fonts to be able to run application from build directory
-if [ "$PLATFORM_QPA" = "yes" ] && [ ! -d "${outpath}/lib/fonts" ]; then
+if [ ! -d "${outpath}/lib/fonts" ]; then
     if [ "$PLATFORM" = "$XPLATFORM" ]; then
         mkdir -p "${outpath}/lib"
         ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts"
@@ -2177,26 +2176,22 @@ if [ -z "$PLATFORM" ]; then
     PLATFORM_NOTES=
     case "$UNAME_SYSTEM:$UNAME_RELEASE" in
      Darwin:*)
-        if [ "$PLATFORM_QPA" = "yes" ]; then
-          OSX_VERSION=`uname -r | cut -d. -f1`
-          if [ "$OSX_VERSION" -ge 11 ]; then
-              # We're on Lion or above. Check if we have a supported Clang version
-              case "$(clang -v 2>&1 | grep -Po '(?<=version )\d[\d.]+')" in
-                  3.*)
-                      PLATFORM=macx-clang
-                      PLATFORM_NOTES="\n    - Also available for Mac OS X: macx-g++\n"
-                      ;;
-                  *)
-                      PLATFORM=macx-g++
-                      ;;
-              esac
-          else
-              PLATFORM=macx-g++
-          fi
-        else
-          PLATFORM=darwin-g++
-        fi
-        ;;
+         OSX_VERSION=`uname -r | cut -d. -f1`
+         if [ "$OSX_VERSION" -ge 11 ]; then
+             # We're on Lion or above. Check if we have a supported Clang version
+             case "$(clang -v 2>&1 | grep -Po '(?<=version )\d[\d.]+')" in
+                 3.*)
+                     PLATFORM=macx-clang
+                     PLATFORM_NOTES="\n    - Also available for Mac OS X: macx-g++\n"
+                     ;;
+                 *)
+                     PLATFORM=macx-g++
+                     ;;
+             esac
+         else
+             PLATFORM=macx-g++
+         fi
+         ;;
      AIX:*)
         #PLATFORM=aix-g++
         #PLATFORM=aix-g++-64
@@ -2418,12 +2413,6 @@ if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
     exit 2
 fi
 
-# now look at the configs and figure out what platform we are config'd for
-[ "$PLATFORM_QPA" != "yes" ] \
-  && [ -n "`getXQMakeConf QMAKE_LIBS_X11`" ] \
-  && PLATFORM_X11=yes
-### echo "$XQMAKESPEC" | grep mkspecs/qws >/dev/null 2>&1 && PLATFORM_QWS=yes
-
 if [ "$UNAME_SYSTEM" = "SunOS" ]; then
     # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up
     if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then
@@ -2432,13 +2421,6 @@ if [ "$UNAME_SYSTEM" = "SunOS" ]; then
     fi
 fi
 
-#-------------------------------------------------------------------------------
-# determine the system architecture
-#-------------------------------------------------------------------------------
-if [ "$OPT_VERBOSE" = "yes" ]; then
-    echo "Determining system architecture... ($UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE)"
-fi
-
 if [ "$CFG_RTOS_ENABLED" = "no" ]; then
     case `basename "$XPLATFORM"` in
        qnx-* | vxworks-*)
@@ -2453,151 +2435,13 @@ if [ "$CFG_RTOS_ENABLED" = "no" ]; then
     esac
 fi
 
-if [ -z "${CFG_HOST_ARCH}" ]; then
-    case "$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_MACHINE" in
-    GNU:*:*)
-        CFG_HOST_ARCH=`echo ${UNAME_MACHINE} | sed -e 's,[-/].*$,,'`
-        case "$CFG_HOST_ARCH" in
-            i?86)
-                CFG_HOST_ARCH=i386
-                ;;
-        esac
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-            echo "    GNU/Hurd ($CFG_HOST_ARCH)"
-        fi
-        ;;
-    IRIX*:*:*)
-        CFG_HOST_ARCH=`uname -p`
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-            echo "    SGI ($CFG_HOST_ARCH)"
-        fi
-        ;;
-    SunOS:5*:*)
-        case "$UNAME_MACHINE" in
-       sun4u*|sun4v*)
-            if [ "$OPT_VERBOSE" = "yes" ]; then
-                echo "    Sun SPARC (sparc)"
-            fi
-            CFG_HOST_ARCH=sparc
-            ;;
-        i86pc)
-           case "$PLATFORM" in
-           *-64*)
-                if [ "$OPT_VERBOSE" = "yes" ]; then
-                   echo "    64-bit AMD 80x86 (x86_64)"
-                fi
-                CFG_HOST_ARCH=x86_64
-                ;;
-           *)
-                if [ "$OPT_VERBOSE" = "yes" ]; then
-                   echo "    32-bit Intel 80x86 (i386)"
-                fi
-                CFG_HOST_ARCH=i386
-                ;;
-            esac
-        esac
-        ;;
-    AIX:*:00????????00)
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-        echo "    64-bit IBM PowerPC (powerpc)"
-        fi
-        CFG_HOST_ARCH=powerpc
-        ;;
-    HP-UX:*:9000*)
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-            echo "    HP PA-RISC (parisc)"
-        fi
-        CFG_HOST_ARCH=parisc
-        ;;
-    *:*:i?86)
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-            echo "    32-bit Intel 80x86 (i386)"
-        fi
-        CFG_HOST_ARCH=i386
-        ;;
-    *:*:x86_64|*:*:amd64)
-        if [ "$PLATFORM" = "linux-g++-32" -o "$PLATFORM" = "linux-icc-32" ]; then
-            if [ "$OPT_VERBOSE" = "yes" ]; then
-                echo "    32 bit on 64-bit AMD 80x86 (i386)"
-            fi
-            CFG_HOST_ARCH=i386
-        else
-            if [ "$OPT_VERBOSE" = "yes" ]; then
-                echo "    64-bit AMD 80x86 (x86_64)"
-            fi
-            CFG_HOST_ARCH=x86_64
-        fi
-        ;;
-    *:*:ppc)
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-            echo "    32-bit PowerPC (powerpc)"
-        fi
-        CFG_HOST_ARCH=powerpc
-        ;;
-    *:*:ppc64)
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-            echo "    64-bit PowerPC (powerpc)"
-        fi
-        CFG_HOST_ARCH=powerpc
-        ;;
-    *:*:s390*)
-       if [ "$OPT_VERBOSE" = "yes" ]; then
-           echo "    IBM S/390 (s390)"
-       fi
-       CFG_HOST_ARCH=s390
-       ;;
-    *:*:arm*)
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-            echo "    ARM (arm)"
-        fi
-        CFG_HOST_ARCH=arm
-        ;;
-    Linux:*:sparc*)
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-            echo "    Linux on SPARC"
-        fi
-        CFG_HOST_ARCH=sparc
-        ;;
-    QNX:*:*)
-        case "$UNAME_MACHINE" in
-        x86pc)
-            if [ "$OPT_VERBOSE" = "yes" ]; then
-                echo "    QNX on Intel 80x86 (i386)"
-            fi
-            CFG_HOST_ARCH=i386
-            ;;
-        esac
-        ;;
-    *:*:*)
-        if [ "$OPT_VERBOSE" = "yes" ]; then
-            echo "    Trying '$UNAME_MACHINE'..."
-        fi
-        CFG_HOST_ARCH="$UNAME_MACHINE"
-        ;;
-    esac
-fi
-
-if [ "$XPLATFORM_MINGW" = "yes" ]; then
-    [ -z "$CFG_ARCH" ] && CFG_ARCH="windows"
-elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
-    CFG_ARCH=$CFG_HOST_ARCH
-fi
-
-# for compatibility
-COMPAT_ARCH=
-case "$CFG_ARCH" in
-arm*)
-    # previously, armv6 was a different arch
-    CFG_ARCH=arm
-    COMPAT_ARCH=armv6
-    ;;
-esac
-
-if [ "$OPT_VERBOSE" = "yes" ]; then
-    echo "System architecture: '$CFG_ARCH'"
-    if [ "$PLATFORM_QPA" = "yes" ]; then
-       echo "Host architecture: '$CFG_HOST_ARCH'"
-    fi
+#-------------------------------------------------------------------------------
+# write out device config before we run the test.
+#-------------------------------------------------------------------------------
+if cmp -s "$DEVICE_VARS_FILE" "$outpath/mkspecs/qdevice.pri"; then
+    rm -f "$DEVICE_VARS_FILE"
+else
+    mv -f $DEVICE_VARS_FILE "$outpath/mkspecs/qdevice.pri"
 fi
 
 #-------------------------------------------------------------------------------
@@ -2637,11 +2481,11 @@ if [ "$QT_CROSS_COMPILE" = "yes" ]; then
         echo >&2 "Please make sure you have a correctly set-up pkg-config"
         echo >&2 "environment!"
         echo >&2 ""
-        if [ -z "$PKG_CONFIG_PATH" ]; then
+        if [ -z "$PKG_CONFIG_LIBDIR" ]; then
             echo >&2 ""
-            echo >&2 "Warning: PKG_CONFIG_PATH has not been set.  This could mean"
-            echo >&2 "the host compiler's .pc files will be used. This is probably"
-            echo >&2 "not what you want."
+            echo >&2 "Warning: PKG_CONFIG_LIBDIR has not been set.  This could mean"
+            echo >&2 "the host's .pc files will be used (even if you set PKG_CONFIG_PATH)."
+            echo >&2 "This is probably not what you want."
             echo >&2 ""
         elif [ -z "$PKG_CONFIG_SYSROOT" ] && [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
             echo >&2 ""
@@ -2694,15 +2538,10 @@ if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
     fi
 fi
 
-SYSROOT_FLAG=
 if [ -n "$CFG_SYSROOT" ]; then
-    if compilerSupportsFlag --sysroot="$CFG_SYSROOT"; then
-       [ "$OPT_VERBOSE" = "yes" ] && echo "Setting sysroot to: $CFG_SYSROOT"
-       SYSROOT_FLAG="--sysroot=$CFG_SYSROOT"
-    else
-       echo >&2 "The compiler doesn't support the --sysroot flag, I can't set the sysroot"
-       exit 1
-    fi
+    SYSROOT_FLAG="--sysroot=$CFG_SYSROOT"
+else
+    SYSROOT_FLAG=
 fi
 export SYSROOT_FLAG    # used by config.tests/unix/compile.test
 
@@ -2724,12 +2563,6 @@ if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
     fi
 fi
 
-# don't autodetect support for separate debug info on objcopy when
-# cross-compiling as lots of toolchains seems to have problems with this
-if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
-    CFG_SEPARATE_DEBUG_INFO="no"
-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`
@@ -2753,8 +2586,13 @@ if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
 fi
 
 # auto-detect -fvisibility support
-if [ "$CFG_REDUCE_EXPORTS" = "auto" ]; then
+if [ "$CFG_REDUCE_EXPORTS" != "no" ]; then
     if "$unixtests/fvisibility.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
+       if [ "$CFG_REDUCE_EXPORTS" = "yes" ]; then
+           echo "-reduce-exports was requested but this compiler does not support it"
+           echo "Re-run configure with -v for more information"
+           exit 1
+       fi
        CFG_REDUCE_EXPORTS=no
     else
        CFG_REDUCE_EXPORTS=yes
@@ -2764,6 +2602,11 @@ fi
 # detect the availability of the -Bsymbolic-functions linker optimization
 if [ "$CFG_REDUCE_RELOCATIONS" != "no" ]; then
     if "$unixtests/bsymbolic_functions.test" "$TEST_COMPILER" "$OPT_VERBOSE"; then
+       if [ "$CFG_REDUCE_RELOCATIONS" = "yes" ]; then
+           echo "-reduce-relocations was requested but this compiler does not support it"
+           echo "Re-run configure with -v for more information"
+           exit 1
+       fi
         CFG_REDUCE_RELOCATIONS=no
     else
         CFG_REDUCE_RELOCATIONS=yes
@@ -2789,13 +2632,15 @@ else
     CFG_FRAMEWORK=no
 fi
 
-# x11 tests are done after qmake is built
-
-
 #setup the build parts
 if [ -z "$CFG_BUILD_PARTS" ]; then
     CFG_BUILD_PARTS="$QT_DEFAULT_BUILD_PARTS"
 
+    # build tests by default, if a developer build
+    if [ "$CFG_DEV" = "yes" ]; then
+        CFG_BUILD_PARTS="$CFG_BUILD_PARTS tests"
+    fi
+
     # don't build tools by default when cross-compiling
     if [ "$PLATFORM" != "$XPLATFORM" ]; then
        CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, tools,,g"`
@@ -3022,13 +2867,14 @@ if [ "$OPT_HELP" = "yes" ]; then
         XCBN=" "
     fi
 
-    if [ "$CFG_WAYLAND" = "no" ]; then
-        XWY=" "
-        XWN="*"
+    if [ "$CFG_EGLFS" = "no" ]; then
+        EGLFSY=" "
+        EGLFSN="*"
     else
-        XWY="*"
-        XWN=" "
+        EGLFSY="*"
+        EGLFSN=" "
     fi
+
     if [ "$CFG_XINPUT2" = "no" ]; then
         X2Y=" "
         X2N="*"
@@ -3037,6 +2883,30 @@ if [ "$OPT_HELP" = "yes" ]; then
         X2N=" "
     fi
 
+    if [ "$CFG_DBUS" = "no" ]; then
+        DBY=" "
+        DBN="+"
+    else
+        DBY="+"
+        DBN=" "
+    fi
+
+    if [ "$CFG_SEPARATE_DEBUG_INFO" = "no" ]; then
+        SBY=" "
+        SBN="*"
+    else
+        SBY="*"
+        SBN=" "
+    fi
+
+    if [ "$CFG_GLIB" = "no" ]; then
+        GBY=" "
+        GBN="+"
+    else
+        GBY="+"
+        GBN=" "
+    fi
+
     cat <<EOF
 Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
         [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
@@ -3057,34 +2927,26 @@ Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir
         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info]
         [-no-phonon-backend] [-phonon-backend] [-no-media-backend] [-media-backend]
         [-no-audio-backend] [-audio-backend]
-        [-no-javascript-jit] [-javascript-jit] [-no-declarative-debug] [-declarative-debug]
+        [-no-javascript-jit] [-javascript-jit] [-no-qml-debug] [-qml-debug]
         [-no-optimized-qmake] [-optimized-qmake]
         [-no-openssl] [-openssl] [-openssl-linked]
         [-no-gtkstyle] [-gtkstyle]
         [-qt-pcre] [-system-pcre]
+        [-device <name>] [-device-option <key=value>]
         [additional platform specific options (see below)]
 
 
 Installation options:
 
-    -qpa ................ This will enable the QPA build.
-                          QPA is a window system agnostic implementation of Qt.
-
  These are optional, but you may specify install directories.
 
     -prefix <dir> ...... This will install everything relative to <dir>
                          (default $QT_INSTALL_PREFIX)
-EOF
-if [ "$PLATFORM_QPA" = "yes" ]; then
-cat <<EOF
 
     -hostprefix [dir] .. Tools and libraries needed when developing
                          applications are installed in [dir]. If [dir] is
                          not given, the current build directory will be used.
                          (default PREFIX)
-EOF
-fi
-cat <<EOF
 
   * -prefix-install .... Force a sandboxed "local" installation of
                          Qt. This will install into
@@ -3118,17 +2980,11 @@ cat <<EOF
                             (default PREFIX/examples)
     -testsdir <dir> ....... Tests will be installed to <dir>
                             (default PREFIX/tests)
-EOF
-if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
-cat <<EOF
 
     -hostbindir <dir> .. Host executables will be installed to <dir>
                          (default HOSTPREFIX/bin)
     -hostdatadir <dir> . Data used by qmake will be installed to <dir>
                          (default HOSTPREFIX)
-EOF
-fi
-cat <<EOF
 
 Configure options:
 
@@ -3159,25 +3015,8 @@ Configure options:
     -no-largefile ...... Disables large file support.
  +  -largefile ......... Enables Qt to access files larger than 4 GB.
 
-EOF
-if [ "$PLATFORM_QPA" = "yes" ]; then
-    EXCN="*"
-    EXCY=" "
-else
-    EXCN=" "
-    EXCY="*"
-fi
-if [ "$CFG_DBUS" = "no" ]; then
-    DBY=" "
-    DBN="+"
-else
-    DBY="+"
-    DBN=" "
-fi
-
-    cat << EOF
- $EXCN  -no-exceptions ..... Disable exceptions on compilers that support it.
- $EXCY  -exceptions ........ Enable exceptions on compilers that support it.
+    -no-exceptions ..... Disable exceptions on compilers that support it.
+ *  -exceptions ........ Enable exceptions on compilers that support it.
 
     -no-accessibility .. Do not compile Accessibility support.
  *  -accessibility ..... Compile Accessibility support.
@@ -3202,27 +3041,14 @@ fi
     -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
  +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
 
-    -no-declarative-debug ..... Do not build the declarative debugging support.
- +  -declarative-debug ....... Build the declarative debugging support.
+    -no-qml-debug ...... Do not build the in-process QML debugging support.
+ +  -qml-debug ......... Build the QML debugging support.
 
     -platform target ... The operating system and compiler you are building
                          on ($PLATFORM).
 
                          See the README file for a list of supported
                          operating systems and compilers.
-EOF
-
-if [ "${PLATFORM_QPA}" != "yes" ]; then
-cat << EOF
-    -graphicssystem <sys> Sets an alternate graphics system. Available options are:
-                           raster - Software rasterizer
-                           opengl - Rendering via OpenGL, Experimental!
-                           openvg - Rendering via OpenVG, Experimental!
-
-EOF
-fi
-
-cat << EOF
 
     -no-mmx ............ Do not compile with use of MMX instructions.
     -no-3dnow .......... Do not compile with use of 3DNOW instructions.
@@ -3234,6 +3060,8 @@ cat << EOF
     -no-sse4.2.......... Do not compile with use of SSE4.2 instructions.
     -no-avx ............ Do not compile with use of AVX instructions.
     -no-neon ........... Do not compile with use of NEON instructions.
+    -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions.
+    -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions.
 
     -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
     -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
@@ -3323,27 +3151,9 @@ Additional options:
 
     -force-asserts ........ Force Q_ASSERT to be enabled even in release builds.
 
-EOF
-
-if [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
-    if [ "$QT_CROSS_COMPILE" = "yes" ]; then
-        SBY=""
-        SBN="*"
-    else
-        SBY="*"
-        SBN=" "
-    fi
-elif [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
-    SBY="*"
-    SBN=" "
-else
-    SBY=" "
-    SBN="*"
-fi
-
-if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
-
-    cat << EOF
+    -device <name> ............... Cross-compile for device <name> (experimental)
+    -device-option <key=value> ... Add device specific options for the device mkspec
+                                   (experimental)
 
  $SBN  -no-separate-debug-info . Do not store debug information in a separate file.
  $SBY  -separate-debug-info .... Strip debug information into a separate .debug file.
@@ -3351,15 +3161,36 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
  $XCBN  -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
  $XCBY  -xcb ............... Compile Xcb support.
 
- $XWN  -no-wayland......... Do not compile Wayland support.
- $XWY  -wayland  .......... Compile Wayland support.
+ $EGLFSN  -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support.
+ $EGLFSY  -eglfs ............. Compile EGLFS support.
 
-EOF
+    -xplatform target ... The target platform when cross-compiling.
 
-fi # X11
+    -sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot.
 
-if [ "$XPLATFORM_MAEMO" = "yes" ]; then
+    -no-feature-<feature> Do not compile in <feature>.
+    -feature-<feature> .. Compile in <feature>. The available features
+                          are described in src/corelib/global/qfeatures.txt
 
+    -no-freetype ........ Do not compile in Freetype2 support.
+    -qt-freetype ........ Use the libfreetype bundled with Qt.
+ *  -system-freetype .... Use libfreetype from the operating system.
+                          See http://www.freetype.org/
+
+    -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
+                          default ($CFG_QCONFIG).
+
+    -no-opengl .......... Do not support OpenGL.
+    -opengl <api> ....... Enable OpenGL support
+                          With no parameter, this will attempt to auto-detect
+                          OpenGL ES 2, or regular desktop OpenGL.
+                          Use es2 for <api> to override auto-detection.
+
+ $GBN  -no-glib ........... Do not compile Glib support.
+ $GBY  -glib .............. Compile Glib support.
+EOF
+
+if [ "$XPLATFORM_MAEMO" = "yes" ]; then
     cat << EOF
 
  $X2N  -no-xinput2......... Do not compile XInput2 support.
@@ -3369,192 +3200,6 @@ EOF
 
 fi
 
-if [ "$PLATFORM_X11" = "yes" ]; then
-    if [ "$CFG_SM" = "no" ]; then
-        SMY=" "
-        SMN="*"
-    else
-        SMY="*"
-        SMN=" "
-    fi
-    if [ "$CFG_XSHAPE" = "no" ]; then
-        SHY=" "
-        SHN="*"
-    else
-        SHY="*"
-        SHN=" "
-    fi
-    if [ "$CFG_XVIDEO" = "no" ]; then
-        XVY=" "
-        XVN="*"
-    else
-        XVY="*"
-        XVN=" "
-    fi
-    if [ "$CFG_XINERAMA" = "no" ]; then
-        XAY=" "
-        XAN="*"
-    else
-        XAY="*"
-        XAN=" "
-    fi
-    if [ "$CFG_FONTCONFIG" = "no" ]; then
-        FCGY=" "
-        FCGN="*"
-    else
-        FCGY="*"
-        FCGN=" "
-    fi
-    if [ "$CFG_XCURSOR" = "no" ]; then
-        XCY=" "
-        XCN="*"
-    else
-        XCY="*"
-        XCN=" "
-    fi
-    if [ "$CFG_XFIXES" = "no" ]; then
-        XFY=" "
-        XFN="*"
-    else
-        XFY="*"
-        XFN=" "
-    fi
-    if [ "$CFG_XRANDR" = "no" ]; then
-        XZY=" "
-        XZN="*"
-    else
-        XZY="*"
-        XZN=" "
-    fi
-    if [ "$CFG_XRENDER" = "no" ]; then
-        XRY=" "
-        XRN="*"
-    else
-        XRY="*"
-        XRN=" "
-    fi
-    if [ "$CFG_MITSHM" = "no" ]; then
-        XMY=" "
-        XMN="*"
-    else
-        XMY="*"
-        XMN=" "
-    fi
-    if [ "$CFG_XINPUT" = "no" ]; then
-        XIY=" "
-        XIN="*"
-    else
-        XIY="*"
-        XIN=" "
-    fi
-    if [ "$CFG_XKB" = "no" ]; then
-        XKY=" "
-        XKN="*"
-    else
-        XKY="*"
-        XKN=" "
-    fi
-    if [ "$CFG_IM" = "no" ]; then
-        IMY=" "
-        IMN="*"
-    else
-        IMY="*"
-        IMN=" "
-    fi
-    cat << EOF
-
-Qt/X11 only:
-
-    -no-gtkstyle ....... Do not build the GTK theme integration.
- +  -gtkstyle .......... Build the GTK theme integration.
-
- *  -no-nas-sound ...... Do not compile in NAS sound support.
-    -system-nas-sound .. Use NAS libaudio from the operating system.
-                         See http://radscan.com/nas.html
-
-    -egl ............... Use EGL instead of GLX to manage contexts.
-                         When building for desktop OpenGL, this option will
-                         make Qt use EGL to manage contexts rather than the
-                         GLX, which is the default. Note: For OpenGL ES, EGL
-                         is always used.
-
-    -no-opengl ......... Do not support OpenGL.
- +  -opengl <api> ...... Enable OpenGL support.
-                         With no parameter, this will auto-detect the "best"
-                         OpenGL API to use. If desktop OpenGL is available, it
-                         will be used. Use desktop or es2 for <api>
-                         to force the use of the Desktop OpenGL or
-                         OpenGL ES 2 APIs instead.
-
-     -no-openvg ........ Do not support OpenVG.
- +   -openvg ........... Enable OpenVG support.
-                         Requires EGL support, typically supplied by an OpenGL
-                         or other graphics implementation.
-
- $SMN  -no-sm ............. Do not support X Session Management.
- $SMY  -sm ................ Support X Session Management, links in -lSM -lICE.
-
- $SHN  -no-xshape ......... Do not compile XShape support.
- $SHY  -xshape ............ Compile XShape support.
-                         Requires X11/extensions/shape.h.
-
- $XVN  -no-xvideo ......... Do not compile XVideo support.
- $XVY  -xvideo ............ Compile XVideo support.
-                         Requires X11/extensions/Xv.h & Xvlib.h.
-
- $SHN  -no-xsync .......... Do not compile XSync support.
- $SHY  -xsync ............. Compile XSync support.
-                         Requires X11/extensions/sync.h.
-
- $XAN  -no-xinerama ....... Do not compile Xinerama (multihead) support.
- $XAY  -xinerama .......... Compile Xinerama support.
-                         Requires X11/extensions/Xinerama.h and libXinerama.
-                        By default, Xinerama support will be compiled if
-                         available and the shared libraries are dynamically
-                         loaded at runtime.
-
- $XCN  -no-xcursor ........ Do not compile Xcursor support.
- $XCY  -xcursor ........... Compile Xcursor support.
-                         Requires X11/Xcursor/Xcursor.h and libXcursor.
-                        By default, Xcursor support will be compiled if
-                         available and the shared libraries are dynamically
-                         loaded at runtime.
-
- $XFN  -no-xfixes ......... Do not compile Xfixes support.
- $XFY  -xfixes ............ Compile Xfixes support.
-                         Requires X11/extensions/Xfixes.h and libXfixes.
-                        By default, Xfixes support will be compiled if
-                         available and the shared libraries are dynamically
-                         loaded at runtime.
-
- $XZN  -no-xrandr ......... Do not compile Xrandr (resize and rotate) support.
- $XZY  -xrandr ............ Compile Xrandr support.
-                         Requires X11/extensions/Xrandr.h and libXrandr.
-
- $XRN  -no-xrender ........ Do not compile Xrender support.
- $XRY  -xrender ........... Compile Xrender support.
-                         Requires X11/extensions/Xrender.h and libXrender.
-
- $XMN  -no-mitshm ......... Do not compile MIT-SHM support.
- $XMY  -mitshm ............ Compile MIT-SHM support.
-                         Requires sys/ipc.h, sys/shm.h and X11/extensions/XShm.h
-
- $FCGN  -no-fontconfig ..... Do not compile FontConfig (anti-aliased font) support.
- $FCGY  -fontconfig ........ Compile FontConfig support.
-                         Requires fontconfig/fontconfig.h, libfontconfig,
-                         freetype.h and libfreetype.
-
- $XIN  -no-xinput ......... Do not compile Xinput support.
- $XIY  -xinput ............ Compile Xinput support. This also enabled tablet support
-                         which requires IRIX with wacom.h and libXi or
-                         XFree86 with X11/extensions/XInput.h and libXi.
-
- $XKN  -no-xkb ............ Do not compile XKB (X KeyBoard extension) support.
- $XKY  -xkb ............... Compile XKB support.
-
-EOF
-fi
-
 if [ "$BUILD_ON_MAC" = "yes" ]; then
     cat << EOF
 
@@ -3570,9 +3215,6 @@ Qt/Mac only:
  *  -dwarf2 ............ Enable dwarf2 debugging symbols.
     -no-dwarf2 ......... Disable dwarf2 debugging symbols.
 
-    -arch <arch> ....... Build Qt for <arch>. Supported arch values: x86 x86_64.
-                         Only one arch value can be specified.
-
     -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
                          To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
 
@@ -3583,52 +3225,6 @@ Qt/Mac only:
 EOF
 fi
 
-if [ "$PLATFORM_QPA" = "yes" ]; then
-    cat << EOF
-Qt for QPA only:
-EOF
-fi
-
-if [ "$PLATFORM_QPA" = "yes" ]; then
-    cat << EOF
-
-    -xplatform target ... The target platform when cross-compiling.
-
-    -no-feature-<feature> Do not compile in <feature>.
-    -feature-<feature> .. Compile in <feature>. The available features
-                          are described in src/corelib/global/qfeatures.txt
-
-    -no-freetype ........ Do not compile in Freetype2 support.
-    -qt-freetype ........ Use the libfreetype bundled with Qt.
- *  -system-freetype .... Use libfreetype from the operating system.
-                          See http://www.freetype.org/
-
-    -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the
-                          default ($CFG_QCONFIG).
-
-    -no-opengl .......... Do not support OpenGL.
-    -opengl <api> ....... Enable OpenGL ES support
-                          With no parameter, this will attempt to auto-detect
-                          OpenGL ES 2, or regular desktop OpenGL.
-                          Use es2 for <api> to override auto-detection.
-EOF
-fi
-
-if [ "$PLATFORM_QPA" = "yes" -o "$PLATFORM_X11" = "yes" ]; then
-    if [ "$CFG_GLIB" = "no" ]; then
-        GBY=" "
-        GBN="+"
-    else
-        GBY="+"
-        GBN=" "
-    fi
-    cat << EOF
- $GBN  -no-glib ........... Do not compile Glib support.
- $GBY  -glib .............. Compile Glib support.
-
-EOF
-fi
-
    [ "x$ERROR" = "xyes" ] && exit 1
    exit 0
 fi # Help
@@ -3638,17 +3234,8 @@ fi # Help
 # LICENSING, INTERACTIVE PART
 # -----------------------------------------------------------------------------
 
-if [ "$PLATFORM_QPA" = "yes" ]; then
-    Platform="Qt Lighthouse"
-elif [ "$XPLATFORM_MINGW" = "yes" ]; then
-    Platform="Qt for Windows"
-elif [ -n "`getXQMakeConf grep QMAKE_LIBS_X11`" ]; then
-    PLATFORM_X11=yes
-    Platform="Qt for Linux/X11"
-fi
-
 echo
-echo "This is the $Platform ${EditionString} Edition."
+echo "This is the Qt ${EditionString} Edition."
 echo
 
 if [ "$Edition" = "OpenSource" ]; then
@@ -4060,6 +3647,32 @@ fi # Build qmake
 # tests that need qmake
 #-------------------------------------------------------------------------------
 
+#-------------------------------------------------------------------------------
+# determine the target and host architectures
+#-------------------------------------------------------------------------------
+
+# Use config.tests/arch/arch.pro to has the compiler tell us what the target architecture is
+CFG_ARCH=`OUTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -n -e 's,^Project MESSAGE:.*Architecture: \([a-zA-Z0-9_]*\).*,\1,p'`
+
+[ -z "$CFG_ARCH" ] && CFG_ARCH="unknown"
+if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
+    # Do the same test again, using the host compiler
+    CFG_HOST_ARCH=`OUTDIR="$outpath" "$outpath/bin/qmake" -spec "$QMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -n -e 's,^Project MESSAGE:.*Architecture: \([a-zA-Z0-9_]*\).*,\1,p'`
+    [ -z "$CFG_HOST_ARCH" ] && CFG_HOST_ARCH="unknown"
+else
+    # not cross compiling, host == target
+    CFG_HOST_ARCH="$CFG_ARCH"
+fi
+
+if [ "$OPT_VERBOSE" = "yes" ]; then
+    echo "System architecture: '$CFG_ARCH'"
+    echo "Host architecture: '$CFG_HOST_ARCH'"
+fi
+
+#-------------------------------------------------------------------------------
+# functionality tests
+#-------------------------------------------------------------------------------
+
 # detect availability of float math.h functions
 if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
     CFG_USE_FLOATMATH=yes
@@ -4165,6 +3778,22 @@ if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then
     else
        CFG_NEON=no
     fi
+elif [ "$CFG_ARCH" != "arm" ]; then
+    CFG_NEON=no
+fi
+
+# detect mips_dsp support
+if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSP}" = "yes" ]; then
+  CFG_MIPS_DSP=yes
+    else
+  CFG_MIPS_DSP=no
+fi
+
+# detect mips_dspr2 support
+if [ "${CFG_ARCH}" = "mips" ] && [ "${CFG_MIPS_DSPR2}" = "yes" ]; then
+  CFG_MIPS_DSPR2=yes
+    else
+  CFG_MIPS_DSPR2=no
 fi
 
 [ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista"
@@ -4196,6 +3825,10 @@ if [ "$CFG_LARGEFILE" = "auto" ]; then
     CFG_LARGEFILE=yes
 fi
 
+if [ "$CFG_GUI" = "no" ]; then
+    QPA_PLATFORM_GUARD=no
+fi
+
 # detect how jpeg should be built
 if [ "$CFG_JPEG" = "auto" ]; then
     if [ "$CFG_SHARED" = "yes" ]; then
@@ -4236,6 +3869,14 @@ if [ "$CFG_ACCESSIBILITY" = "auto" ]; then
     CFG_ACCESSIBILITY=yes
 fi
 
+if [ "$CFG_EGLFS" = "yes" ]; then
+    if [ "$CFG_EGL" = "no" ]; then
+        echo "The EGLFS plugin requires EGL support and cannot be built"
+        exit 101
+    fi
+    CFG_EGL=yes
+fi
+
 # auto-detect SQL-modules support
 for _SQLDR in $CFG_SQL_AVAILABLE; do
         case $_SQLDR in
@@ -4522,7 +4163,7 @@ fi
 
 # auto-detect iconv(3) support
 if [ "$CFG_ICONV" != "no" ]; then
-    if [ "$XPLATFORM_MINGW" = "yes" ] || [ "$PLATFORM_QPA" = "yes" -a "$CFG_ICONV" = "auto" ]; then
+    if [ "$XPLATFORM_MINGW" = "yes" ]; then
         CFG_ICONV=no
     elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_ICONV=yes
@@ -4568,125 +4209,98 @@ if [ "$CFG_DBUS" != "no" ]; then
     fi
 fi
 
-# X11/Lighthouse
-if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
-
-    # auto-detect Glib support
-    if [ "$CFG_GLIB" != "no" ]; then
-        if [ -n "$PKG_CONFIG" ]; then
-            QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
-            QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
-        fi
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/glib "Glib" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GLIB $QT_LIBS_GLIB $X11TESTS_FLAGS ; then
-            CFG_GLIB=yes
-            QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
-            QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
-        else
-            if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                echo "Glib support cannot be enabled due to functionality tests!"
-                echo " Turn on verbose messaging (-v) to $0 to see the final report."
-                echo " If you believe this message is in error you may use the continue"
-                echo " switch (-continue) to $0 to continue."
-                exit 101
-            else
-                CFG_GLIB=no
-            fi
-        fi
+# auto-detect Glib support
+if [ "$CFG_GLIB" != "no" ]; then
+    if [ -n "$PKG_CONFIG" ]; then
+        QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null`
+        QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null`
     fi
-
-    # ### Vestige
-    if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
-        if [ -n "$PKG_CONFIG" ]; then
-            QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
-            QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
-        fi
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/gstreamer "GStreamer" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GSTREAMER $QT_LIBS_GSTREAMER $X11TESTS_FLAGS; then
-            CFG_GSTREAMER=yes
-            QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
-            QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/glib "Glib" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GLIB $QT_LIBS_GLIB; then
+        CFG_GLIB=yes
+        QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB"
+        QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB"
+    else
+        if [ "$CFG_GLIB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+            echo "Glib support cannot be enabled due to functionality tests!"
+            echo " Turn on verbose messaging (-v) to $0 to see the final report."
+            echo " If you believe this message is in error you may use the continue"
+            echo " switch (-continue) to $0 to continue."
+            exit 101
         else
-            if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                echo "Gstreamer support cannot be enabled due to functionality tests!"
-                echo " Turn on verbose messaging (-v) to $0 to see the final report."
-                echo " If you believe this message is in error you may use the continue"
-                echo " switch (-continue) to $0 to continue."
-                exit 101
-            else
-                CFG_GSTREAMER=no
-            fi
+            CFG_GLIB=no
         fi
-    elif [ "$CFG_GLIB" = "no" ]; then
-        CFG_GSTREAMER=no
     fi
+fi
 
-    # auto-detect libicu support
-    if [ "$CFG_ICU" != "no" ]; then
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icu "ICU" $L_FLAGS $I_FLAGS $l_FLAGS; then
-            [ "$CFG_ICU" = "auto" ] && CFG_ICU=yes
+# ### Vestige
+if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
+    if [ -n "$PKG_CONFIG" ]; then
+        QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
+        QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
+    fi
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/gstreamer "GStreamer" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GSTREAMER $QT_LIBS_GSTREAMER; then
+        CFG_GSTREAMER=yes
+        QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER"
+        QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER"
+    else
+        if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+            echo "Gstreamer support cannot be enabled due to functionality tests!"
+            echo " Turn on verbose messaging (-v) to $0 to see the final report."
+            echo " If you believe this message is in error you may use the continue"
+            echo " switch (-continue) to $0 to continue."
+            exit 101
         else
-            if [ "$CFG_ICU" = "auto" ]; then
-                CFG_ICU=no
-            elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                # CFG_ICU is "yes"
-
-                echo "The ICU library support cannot be enabled."
-                echo " Turn on verbose messaging (-v) to $0 to see the final report."
-                echo " If you believe this message is in error you may use the continue"
-                echo " switch (-continue) to $0 to continue."
-                exit 101
-            fi
+            CFG_GSTREAMER=no
         fi
     fi
+elif [ "$CFG_GLIB" = "no" ]; then
+    CFG_GSTREAMER=no
+fi
 
-    # Auto-detect PulseAudio support
-    if [ "$CFG_PULSEAUDIO" != "no" ]; then
-        if [ -n "$PKG_CONFIG" ]; then
-            QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
-            QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
-        fi
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pulseaudio "PulseAudio" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_PULSEAUDIO $QT_LIBS_PULSEAUDIO $X11TESTS_FLAGS; then
-            CFG_PULSEAUDIO=yes
-            QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO"
-            QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO"
-        else
-            if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                echo "PulseAudio support cannot be enabled due to functionality tests!"
-                echo " Turn on verbose messaging (-v) to $0 to see the final report."
-                echo " If you believe this message is in error you may use the continue"
-                echo " switch (-continue) to $0 to continue."
-                exit 101
-            else
-               CFG_PULSEAUDIO=no
-            fi
+# auto-detect libicu support
+if [ "$CFG_ICU" != "no" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/icu "ICU" $L_FLAGS $I_FLAGS $l_FLAGS; then
+        [ "$CFG_ICU" = "auto" ] && CFG_ICU=yes
+    else
+        if [ "$CFG_ICU" = "auto" ]; then
+            CFG_ICU=no
+        elif [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+            # CFG_ICU is "yes"
+
+            echo "The ICU library support cannot be enabled."
+            echo " Turn on verbose messaging (-v) to $0 to see the final report."
+            echo " If you believe this message is in error you may use the continue"
+            echo " switch (-continue) to $0 to continue."
+            exit 101
         fi
     fi
-fi # X11/Lighthouse
-
-# X11
-if [ "$PLATFORM_X11" = "yes" -a "$CFG_GUI" != "no" ]; then
-    x11tests="$relpath/config.tests/x11"
-    X11TESTS_FLAGS=
+fi
 
-    # work around broken X11 headers when using GCC 2.95 or later
-    NOTYPE=no
-    "$x11tests/notype.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" && NOTYPE=yes
-    if [ $NOTYPE = "yes" ]; then
-       QMakeVar add QMAKE_CXXFLAGS -fpermissive
-        X11TESTS_FLAGS="$X11TESTS_FLAGS -fpermissive"
+# Auto-detect PulseAudio support
+if [ "$CFG_PULSEAUDIO" != "no" ]; then
+    if [ -n "$PKG_CONFIG" ]; then
+        QT_CFLAGS_PULSEAUDIO=`$PKG_CONFIG --cflags libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
+        QT_LIBS_PULSEAUDIO=`$PKG_CONFIG --libs libpulse '>=' 0.9.10 libpulse-mainloop-glib 2>/dev/null`
     fi
-
-    # Check we actually have X11 :-)
-    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
-    if [ $? != "0" ]; then
-        echo "Basic XLib functionality test failed!"
-        echo " You might need to modify the include and library search paths by editing"
-        echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
-        exit 1
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pulseaudio "PulseAudio" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_PULSEAUDIO $QT_LIBS_PULSEAUDIO; then
+        CFG_PULSEAUDIO=yes
+        QMakeVar set QT_CFLAGS_PULSEAUDIO "$QT_CFLAGS_PULSEAUDIO"
+        QMakeVar set QT_LIBS_PULSEAUDIO "$QT_LIBS_PULSEAUDIO"
+    else
+        if [ "$CFG_PULSEAUDIO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+            echo "PulseAudio support cannot be enabled due to functionality tests!"
+            echo " Turn on verbose messaging (-v) to $0 to see the final report."
+            echo " If you believe this message is in error you may use the continue"
+            echo " switch (-continue) to $0 to continue."
+            exit 101
+        else
+            CFG_PULSEAUDIO=no
+        fi
     fi
 fi
 
 # X11/MINGW OpenGL
-if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
+if [ "$XPLATFORM_MINGW" = "yes" ]; then
     # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
     if [ "$CFG_GUI" = "no" ]; then
         if [ "$CFG_OPENGL" = "auto" ]; then
@@ -4699,13 +4313,10 @@ if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
         fi
     fi
     if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
+        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS; then
             CFG_OPENGL=desktop
         elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
             CFG_OPENGL=es2
-            if [ "$CFG_EGL" = "no" ]; then
-                CFG_EGL=auto
-            fi
         else
             if [ "$CFG_OPENGL" = "yes" ]; then
                 echo "All the OpenGL functionality tests failed!"
@@ -4720,7 +4331,7 @@ if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
         hpux*)
             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
             if [ "$CFG_OPENGL" = "desktop" ]; then
-                "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
+                "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS
                 if [ $? != "0" ]; then
                     QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
                 fi
@@ -4741,7 +4352,7 @@ if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
         fi
     elif [ "$CFG_OPENGL" = "desktop" ]; then
         # Desktop OpenGL support
-        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
+        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS
         if [ $? != "0" ]; then
             echo "The OpenGL functionality test failed!"
             echo " You might need to modify the include and library search paths by editing"
@@ -4752,7 +4363,7 @@ if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
         case "$PLATFORM" in
         hpux*)
             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
-            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
+            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS
             if [ $? != "0" ]; then
                 QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
             fi
@@ -4763,275 +4374,6 @@ if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then
     fi
 fi # X11/MINGW OpenGL
 
-# X11
-if [ "$PLATFORM_X11" = "yes" ]; then
-    # auto-detect Xcursor support
-    if [ "$CFG_XCURSOR" != "no" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xcursor "Xcursor" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-           if [ "$CFG_XCURSOR" != "runtime" ]; then
-               CFG_XCURSOR=yes;
-           fi
-       else
-           if [ "$CFG_XCURSOR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "Xcursor support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_XCURSOR=no
-           fi
-       fi
-    fi
-
-    # auto-detect Xfixes support
-    if [ "$CFG_XFIXES" != "no" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xfixes "Xfixes" $L_FLAGS $I_FLAGS $X11TESTS_FLAGS; then
-           if [ "$CFG_XFIXES" != "runtime" ]; then
-               CFG_XFIXES=yes;
-           fi
-       else
-           if [ "$CFG_XFIXES" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "Xfixes support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_XFIXES=no
-           fi
-       fi
-    fi
-
-    # auto-detect Xrandr support (resize and rotate extension)
-    if [ "$CFG_XRANDR" != "no" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrandr "Xrandr" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-            if [ "$CFG_XRANDR" != "runtime" ]; then
-           CFG_XRANDR=yes
-            fi
-       else
-           if [ "$CFG_XRANDR" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "Xrandr support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_XRANDR=no
-           fi
-       fi
-    fi
-
-    # auto-detect Xrender support
-    if [ "$CFG_XRENDER" != "no" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrender "Xrender" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-           CFG_XRENDER=yes
-       else
-           if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "Xrender support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_XRENDER=no
-           fi
-       fi
-    fi
-
-    # auto-detect MIT-SHM support
-    if [ "$CFG_MITSHM" != "no" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/mitshm "mitshm" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-           CFG_MITSHM=yes
-       else
-           if [ "$CFG_MITSHM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "MITSHM support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_MITSHM=no
-           fi
-       fi
-    fi
-
-    # auto-detect FontConfig support
-    if [ "$CFG_FONTCONFIG" != "no" ]; then
-    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
-        QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
-        QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
-    else
-        QT_CFLAGS_FONTCONFIG=
-        QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
-    fi
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/fontconfig "FontConfig" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS $QT_CFLAGS_FONTCONFIG $QT_LIBS_FONTCONFIG; then
-           CFG_FONTCONFIG=yes
-        QMakeVar set QMAKE_CFLAGS_X11 "$QT_CFLAGS_FONTCONFIG \$\$QMAKE_CFLAGS_X11"
-        QMakeVar set QMAKE_LIBS_X11 "$QT_LIBS_FONTCONFIG \$\$QMAKE_LIBS_X11"
-           CFG_LIBFREETYPE=system
-       else
-           if [ "$CFG_FONTCONFIG" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "FontConfig support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_FONTCONFIG=no
-           fi
-       fi
-    fi
-
-    # auto-detect Session Management support
-    if [ "$CFG_SM" = "auto" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/sm "Session Management" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-           CFG_SM=yes
-       else
-           if [ "$CFG_SM" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "Session Management support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_SM=no
-           fi
-       fi
-    fi
-
-    # auto-detect SHAPE support
-    if [ "$CFG_XSHAPE" != "no" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xshape "XShape" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-           CFG_XSHAPE=yes
-       else
-           if [ "$CFG_XSHAPE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "XShape support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_XSHAPE=no
-           fi
-       fi
-    fi
-
-    # auto-detect XVideo support
-    if [ "$CFG_XVIDEO" != "no" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xvideo "XVideo" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-           CFG_XVIDEO=yes
-       else
-           if [ "$CFG_XVIDEO" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "XVideo support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_XVIDEO=no
-           fi
-       fi
-    fi
-
-    # auto-detect XSync support
-    if [ "$CFG_XSYNC" != "no" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xsync "XSync" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-           CFG_XSYNC=yes
-       else
-           if [ "$CFG_XSYNC" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "XSync support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_XSYNC=no
-           fi
-       fi
-    fi
-
-    # auto-detect Xinerama support
-    if [ "$CFG_XINERAMA" != "no" ]; then
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinerama "Xinerama" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-           if [ "$CFG_XINERAMA" != "runtime" ]; then
-               CFG_XINERAMA=yes
-           fi
-       else
-           if [ "$CFG_XINERAMA" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-               echo "Xinerama support cannot be enabled due to functionality tests!"
-               echo " Turn on verbose messaging (-v) to $0 to see the final report."
-               echo " If you believe this message is in error you may use the continue"
-               echo " switch (-continue) to $0 to continue."
-               exit 101
-           else
-               CFG_XINERAMA=no
-           fi
-       fi
-    fi
-
-    # auto-detect Xinput support
-    if [ "$CFG_XINPUT" != "no" ]; then
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinput "XInput" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-           if [ "$CFG_XINPUT" != "runtime" ]; then
-               CFG_XINPUT=yes
-           fi
-        else
-            if [ "$CFG_XINPUT" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                echo "Tablet and Xinput support cannot be enabled due to functionality tests!"
-                echo " Turn on verbose messaging (-v) to $0 to see the final report."
-                echo " If you believe this message is in error you may use the continue"
-                echo " switch (-continue) to $0 to continue."
-                exit 101
-            else
-                CFG_XINPUT=no
-            fi
-        fi
-    fi
-
-    # auto-detect XKB support
-    if [ "$CFG_XKB" != "no" ]; then
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xkb "XKB" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-            CFG_XKB=yes
-        else
-            if [ "$CFG_XKB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                echo "XKB support cannot be enabled due to functionality tests!"
-                echo " Turn on verbose messaging (-v) to $0 to see the final report."
-                echo " If you believe this message is in error you may use the continue"
-                echo " switch (-continue) to $0 to continue."
-                exit 101
-            else
-                CFG_XKB=no
-            fi
-        fi
-    fi
-
-    if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
-        if [ -n "$PKG_CONFIG" ]; then
-            QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
-            QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
-        fi
-        if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
-            CFG_QGTKSTYLE=yes
-            QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
-            QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
-        else
-            if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                echo "Gtk theme support cannot be enabled due to functionality tests!"
-                echo " Turn on verbose messaging (-v) to $0 to see the final report."
-                echo " If you believe this message is in error you may use the continue"
-                echo " switch (-continue) to $0 to continue."
-                exit 101
-            else
-                CFG_QGTKSTYLE=no
-            fi
-        fi
-    elif [ "$CFG_GLIB" = "no" ]; then
-        CFG_QGTKSTYLE=no
-    fi
-fi # X11
-
-
 if [ "$BUILD_ON_MAC" = "yes" ]; then
     if [ "$CFG_PHONON" != "no" ]; then
         # Always enable Phonon (unless it was explicitly disabled)
@@ -5047,285 +4389,252 @@ if [ "$BUILD_ON_MAC" = "yes" ]; then
     fi
 fi
 
-
-if [ "$PLATFORM_QPA" = "yes" ]; then
-    # auto-detect OpenGL support (es2 = OpenGL ES 2.x)
-    if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-            CFG_OPENGL=desktop
-        elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
-            CFG_OPENGL=es2
-        else
-            if [ "$CFG_OPENGL" = "yes" ]; then
-                echo "All the OpenGL functionality tests failed!"
-                echo " You might need to modify the include and library search paths by editing"
-                echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
-                echo " ${XQMAKESPEC}."
-                exit 1
-            fi
-            CFG_OPENGL=no
-        fi
-    elif [ "$CFG_OPENGL" = "es2" ]; then
-        #OpenGL ES 2.x
-        if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then
-            QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --cflags-only-I glesv2 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
-            QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --libs-only-L glesv2 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'`
-            QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null`
-            QMAKE_CFLAGS_OPENGL_ES2=`$PKG_CONFIG --cflags glesv2 2>/dev/null`
-            QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2"
-            QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2"
-            QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2"
-        fi
-
-        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_LIBS_OPENGL_ES2 $QMAKE_CFLAGS_OPENGL_ES2
-        if [ $? != "0" ]; then
-            echo "The OpenGL ES 2.0 functionality test failed!"
-            echo " You might need to modify the include and library search paths by editing"
-            echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
-            echo " ${XQMAKESPEC}."
-            exit 1
-        fi
-    elif [ "$CFG_OPENGL" = "desktop" ]; then
-        # Desktop OpenGL support
-        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
-        if [ $? != "0" ]; then
-            echo "The OpenGL functionality test failed!"
+# auto-detect OpenGL support (es2 = OpenGL ES 2.x)
+if [ "$CFG_OPENGL" = "auto" ] || [ "$CFG_OPENGL" = "yes" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS; then
+        CFG_OPENGL=desktop
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
+        CFG_OPENGL=es2
+    else
+        if [ "$CFG_OPENGL" = "yes" ]; then
+            echo "All the OpenGL functionality tests failed!"
             echo " You might need to modify the include and library search paths by editing"
             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
             echo " ${XQMAKESPEC}."
             exit 1
         fi
+        CFG_OPENGL=no
     fi
+elif [ "$CFG_OPENGL" = "es2" ]; then
+    #OpenGL ES 2.x
+    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then
+        QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --cflags-only-I glesv2 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
+        QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --libs-only-L glesv2 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'`
+        QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null`
+        QMAKE_CFLAGS_OPENGL_ES2=`$PKG_CONFIG --cflags glesv2 2>/dev/null`
+        QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2"
+        QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2"
+        QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2"
+    fi
+
+    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_LIBS_OPENGL_ES2 $QMAKE_CFLAGS_OPENGL_ES2
+    if [ $? != "0" ]; then
+        echo "The OpenGL ES 2.0 functionality test failed!"
+        echo " You might need to modify the include and library search paths by editing"
+        echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in"
+        echo " ${XQMAKESPEC}."
+        exit 1
+    fi
+elif [ "$CFG_OPENGL" = "desktop" ]; then
+    # Desktop OpenGL support
+    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengldesktop "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS
+    if [ $? != "0" ]; then
+        echo "The OpenGL functionality test failed!"
+        echo " You might need to modify the include and library search paths by editing"
+        echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
+        echo " ${XQMAKESPEC}."
+        exit 1
+    fi
+fi
 
-    # auto-detect FontConfig support
-    if [ "$CFG_FONTCONFIG" != "no" ]; then
-        if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
-            QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
-            QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
-        else
-            QT_CFLAGS_FONTCONFIG=
-            QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
-        fi
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/fontconfig "FontConfig" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS $QT_CFLAGS_FONTCONFIG $QT_LIBS_FONTCONFIG; then
-                QT_CONFIG="$QT_CONFIG fontconfig"
-                QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG"
-                QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG"
-                CFG_LIBFREETYPE=system
-        fi
-
+# auto-detect FontConfig support
+if [ "$CFG_FONTCONFIG" != "no" ]; then
+    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
+        QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
+        QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig --libs freetype2 2>/dev/null`
+    else
+        QT_CFLAGS_FONTCONFIG=
+        QT_LIBS_FONTCONFIG="-lfreetype -lfontconfig"
+    fi
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/fontconfig "FontConfig" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_FONTCONFIG $QT_LIBS_FONTCONFIG; then
+        QT_CONFIG="$QT_CONFIG fontconfig"
+        QMakeVar set QMAKE_CFLAGS_FONTCONFIG "$QT_CFLAGS_FONTCONFIG"
+        QMakeVar set QMAKE_LIBS_FONTCONFIG "$QT_LIBS_FONTCONFIG"
+        CFG_LIBFREETYPE=system
     fi
 
-    # Save these for a check later
-    ORIG_CFG_WAYLAND="$CFG_WAYLAND"
-    ORIG_CFG_XCB="$CFG_XCB"
+fi
 
-    if [ "$CFG_WAYLAND" != "no" ]; then
-        if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then
-            QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null`
-            QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null`
-            QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --cflags-only-I wayland-client 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
-            QMAKE_LIBDIR_WAYLAND=`$PKG_CONFIG --libs-only-L wayland-client 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'`
-        fi
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_WAYLAND $QMAKE_LIBS_WAYLAND; then
-            CFG_WAYLAND=yes
-            QT_CONFIG="$QT_CONFIG wayland"
-        elif [ "$CFG_WAYLAND" = "yes" ]; then
-            echo "The Wayland functionality test failed!"
-            exit 1
-        else
-            CFG_WAYLAND=no
-            QMakeVar add DEFINES QT_NO_WAYLAND
-        fi
-    fi
+# Save these for a check later
+ORIG_CFG_XCB="$CFG_XCB"
+ORIG_CFG_EGLFS="$CFG_EGLFS"
 
-    if [ "$CFG_LIBUDEV" != "no" ]; then
-       if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then
-           QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
-           QMAKE_LIBS_LIBUDEV=`$PKG_CONFIG --libs libudev 2>/dev/null`
-           QMakeVar set QMAKE_INCDIR_LIBUDEV "$QMAKE_INCDIR_LIBUDEV"
-           QMakeVar set QMAKE_LIBS_LIBUDEV "$QMAKE_LIBS_LIBUDEV"
-       fi
-       if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libudev "libudev" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_INCDIR_LIBUDEV $QMAKE_LIBS_LIBUDEV; then
-            CFG_LIBUDEV=yes
-            QT_CONFIG="$QT_CONFIG libudev"
-        elif [ "$CFG_LIBUDEV" = "yes" ]; then
-            echo "The libudev functionality test failed!"
-            exit 1
-        else
-            CFG_LIBUDEV=no
-            QMakeVar add DEFINES QT_NO_LIBUDEV
-        fi
+if [ "$CFG_LIBUDEV" != "no" ]; then
+    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists libudev 2>/dev/null; then
+        QMAKE_INCDIR_LIBUDEV=`$PKG_CONFIG --cflags-only-I libudev 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'`
+        QMAKE_LIBS_LIBUDEV=`$PKG_CONFIG --libs libudev 2>/dev/null`
+        QMakeVar set QMAKE_INCDIR_LIBUDEV "$QMAKE_INCDIR_LIBUDEV"
+        QMakeVar set QMAKE_LIBS_LIBUDEV "$QMAKE_LIBS_LIBUDEV"
     fi
-
-    if [ "$CFG_EVDEV" != "no" ]; then
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/evdev "evdev" $L_FLAGS $I_FLAGS $l_FLAGS; then
-            CFG_EVDEV=yes
-            QT_CONFIG="$QT_CONFIG evdev"
-        elif [ "$CFG_EVDEV" = "yes" ]; then
-            echo "The evdev functionality test failed!"
-            exit 1
-        else
-            CFG_EVDEV=no
-            QMakeVar add DEFINES QT_NO_EVDEV
-        fi
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libudev "libudev" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_INCDIR_LIBUDEV $QMAKE_LIBS_LIBUDEV; then
+        CFG_LIBUDEV=yes
+        QT_CONFIG="$QT_CONFIG libudev"
+    elif [ "$CFG_LIBUDEV" = "yes" ]; then
+        echo "The libudev functionality test failed!"
+        exit 1
+    else
+        CFG_LIBUDEV=no
+        QMakeVar add DEFINES QT_NO_LIBUDEV
     fi
+fi
 
-    # Check we actually have X11 :-)
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-        QT_CONFIG="$QT_CONFIG xlib"
+if [ "$CFG_EVDEV" != "no" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/evdev "evdev" $L_FLAGS $I_FLAGS $l_FLAGS; then
+        CFG_EVDEV=yes
+        QT_CONFIG="$QT_CONFIG evdev"
+    elif [ "$CFG_EVDEV" = "yes" ]; then
+        echo "The evdev functionality test failed!"
+        exit 1
+    else
+        CFG_EVDEV=no
+        QMakeVar add DEFINES QT_NO_EVDEV
     fi
+fi
 
-    # auto-detect Xrender support
-    if [ "$CFG_XRENDER" != "no" ]; then
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrender "Xrender" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
-            CFG_XRENDER=yes
-            QT_CONFIG="$QT_CONFIG xrender"
+# Check we actually have X11 :-)
+if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    QT_CONFIG="$QT_CONFIG xlib"
+fi
+
+# auto-detect Xrender support
+if [ "$CFG_XRENDER" != "no" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xrender "Xrender" $L_FLAGS $I_FLAGS $l_FLAGS; then
+        CFG_XRENDER=yes
+        QT_CONFIG="$QT_CONFIG xrender"
+    else
+        if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+            echo "Xrender support cannot be enabled due to functionality tests!"
+            echo " Turn on verbose messaging (-v) to $0 to see the final report."
+            echo " If you believe this message is in error you may use the continue"
+            echo " switch (-continue) to $0 to continue."
+            exit 101
         else
-            if [ "$CFG_XRENDER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                echo "Xrender support cannot be enabled due to functionality tests!"
-                echo " Turn on verbose messaging (-v) to $0 to see the final report."
-                echo " If you believe this message is in error you may use the continue"
-                echo " switch (-continue) to $0 to continue."
-                exit 101
-            else
-                CFG_XRENDER=no
-            fi
+            CFG_XRENDER=no
         fi
     fi
+fi
 
-    if [ "$CFG_XCB" != "no" ]; then
-        if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xcb 2>/dev/null; then
-            QMAKE_CFLAGS_XCB="`$PKG_CONFIG --cflags xcb 2>/dev/null`"
-            QMAKE_LIBS_XCB="`$PKG_CONFIG --libs xcb 2>/dev/null`"
+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`"
+    fi
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb "xcb" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
+        CFG_XCB=yes
+        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-render "xcb-render" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
+            QT_CONFIG="$QT_CONFIG xcb-render"
         fi
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb "xcb" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
-            CFG_XCB=yes
-            if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-render "xcb-render" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
-                QT_CONFIG="$QT_CONFIG xcb-render"
-            fi
 
-            if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-poll-for-queued-event "xcb-poll-for-queued-event" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
-                CFG_XCB_LIMITED=no
-                QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event"
-            fi
+        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-poll-for-queued-event "xcb-poll-for-queued-event" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
+            CFG_XCB_LIMITED=no
+            QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event"
+        fi
 
-            if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-xlib "xcb-xlib" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
-                QT_CONFIG="$QT_CONFIG xcb-xlib"
-            fi
+        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-xlib "xcb-xlib" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then
+            QT_CONFIG="$QT_CONFIG xcb-xlib"
+        fi
 
-            if [ "$XPLATFORM_MAEMO" = "yes" ]; then
-                # auto-detect XInput2/Xinput support
-                if [ "$CFG_XINPUT2" != "no" ]; then
-                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinput2 "XInput2" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
+        if [ "$XPLATFORM_MAEMO" = "yes" ]; then
+            # auto-detect XInput2/Xinput support
+            if [ "$CFG_XINPUT2" != "no" ]; then
+                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xinput2 "XInput2" $L_FLAGS $I_FLAGS $l_FLAGS; then
                     CFG_XINPUT2=yes
                     CFG_XINPUT=no
+                else
+                    if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+                        echo "XInput2 support cannot be enabled due to functionality tests!"
+                        echo " Turn on verbose messaging (-v) to $0 to see the final report."
+                        echo " If you believe this message is in error you may use the continue"
+                        echo " switch (-continue) to $0 to continue."
+                        exit 101
                     else
-                        if [ "$CFG_XINPUT2" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                            echo "XInput2 support cannot be enabled due to functionality tests!"
-                            echo " Turn on verbose messaging (-v) to $0 to see the final report."
-                            echo " If you believe this message is in error you may use the continue"
-                            echo " switch (-continue) to $0 to continue."
-                            exit 101
-                        else
-                            CFG_XINPUT2=no
-                        fi
+                        CFG_XINPUT2=no
                     fi
                 fi
             fi
-        else
-            if [ "$CFG_XCB" = "yes" ]; then
-                echo "The XCB test failed!"
-                echo " You might need to install dependency packages."
-                echo " See src/plugins/platforms/xcb/README."
-                exit 1
-            fi
-            CFG_XCB=no
-            QMakeVar add DEFINES QT_NO_XCB
-        fi
-    fi
-
-    # Detect libxkbcommon
-    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
-        QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
-        QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
-        if [ "$CFG_WAYLAND" = "yes" ]; then
-            QMAKE_CFLAGS_WAYLAND="$QMAKE_CFLAGS_WAYLAND $QMAKE_CFLAGS_XKBCOMMON"
-            QMAKE_LIBS_WAYLAND="$QMAKE_LIBS_WAYLAND $QMAKE_LIBS_XKBCOMMON"
         fi
-        QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
-        QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
     else
-        if [ "$CFG_WAYLAND" = "yes" ]; then
-            QMAKE_DEFINES_WAYLAND=QT_NO_WAYLAND_XKB
+        if [ "$CFG_XCB" = "yes" ]; then
+            echo "The XCB test failed!"
+            echo " You might need to install dependency packages."
+            echo " See src/plugins/platforms/xcb/README."
+            exit 1
         fi
-        QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
+        CFG_XCB=no
+        QMakeVar add DEFINES QT_NO_XCB
     fi
+fi
 
-    # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero.
-    if [ -n "$QMAKE_CFLAGS_WAYLAND" ] || [ -n "$QMAKE_LIBS_WAYLAND" ]; then
-        QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND"
-        QMakeVar set QMAKE_INCDIR_WAYLAND "$QMAKE_INCDIR_WAYLAND"
-        QMakeVar set QMAKE_LIBS_WAYLAND "$QMAKE_LIBS_WAYLAND"
-        QMakeVar set QMAKE_LIBDIR_WAYLAND "$QMAKE_LIBDIR_WAYLAND"
-        QMakeVar set QMAKE_DEFINES_WAYLAND " $QMAKE_DEFINES_WAYLAND"
-    fi
+# Detect libxkbcommon
+if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then
+    QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`"
+    QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`"
+    QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON"
+    QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON"
+else
+    QMAKE_DEFINES_XCB=QT_NO_XCB_XKB
+fi
 
-    if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
-        QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
-        QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
-        QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
+# EGL Support
+if [ "$CFG_EGL" != "no" ] && [ "$CFG_OPENGL" != "desktop" ]; 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`
+        QMAKE_CFLAGS_EGL=`$PKG_CONFIG --cflags egl 2>/dev/null`
+        QMakeVar set QMAKE_INCDIR_EGL "$QMAKE_INCDIR_EGL"
+        QMakeVar set QMAKE_LIBS_EGL "$QMAKE_LIBS_EGL"
+    fi       # detect EGL support
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/qpa/egl" "EGL" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_EGL $QMAKE_LIBS_EGL; then
+        CFG_EGL=yes
+    elif [ "$CFG_EGL" = "yes" ]; then
+        echo " The EGL functionality test failed; EGL is required by some QPA plugins to manage contexts & surfaces."
+        echo " You might need to modify the include and library search paths by editing"
+        echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in ${XQMAKESPEC}."
+        exit 1
+    else
+        CFG_EGL=no
     fi
+elif [ "$CFG_OPENGL" = "desktop" ]; then
+    if [ "$CFG_EGL" = "yes" ]; then
+        echo "EGL support was requested but Qt is being configured for desktop OpenGL."
+        echo "Either disable EGL support or enable OpenGL ES support."
+        exit 101
+    fi
+    CFG_EGL=no
+fi
+
+if [ "$CFG_EGLFS" != "no" ]; then
+    CFG_EGLFS="$CFG_EGL"
+fi
+
+if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
+    QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
+    QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
+    QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB"
+fi
 
+if [ "$BUILD_ON_MAC" = "yes" ]; then
     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/coreservices "CoreServices" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         QT_CONFIG="$QT_CONFIG coreservices"
     else
         QMakeVar add DEFINES QT_NO_CORESERVICES
     fi
-
-    if [ "$PLATFORM_QPA" = "yes" ] && [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ]; then
-        if [ "$CFG_XCB" = "no" ] && [ "$CFG_WAYLAND" = "no" ]; then
-            if [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_WAYLAND" = "auto" ]; then
-                echo "No QPA platform plugin enabled!"
-                echo " If you really want to build without a QPA platform plugin you must pass"
-                echo " -no-xcb and -no-wayland to configure. Doing this will produce a Qt that"
-                echo " cannot run GUI applications."
-                echo " The dependencies needed for xcb to build are listed in"
-                echo " src/plugins/platforms/xcb/README"
-                exit 1
-            fi
-        fi
-    fi
-
 fi
 
-EGL_VARIANT=none
-# EGL Support
-if [ "$PLATFORM_X11" = "yes" ]; then
-    if [ "$CFG_EGL" != "no" ]; then
-        # detect EGL support
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl" "EGL (EGL/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then
-            # EGL specified by QMAKE_*_EGL, included with <EGL/egl.h>
-            EGL_VARIANT=regular
-            CFG_EGL=yes
-        fi
-
-        if [ "$EGL_VARIANT" = "none" ]; then
-            if [ "$CFG_EGL" = "yes" ]; then
-                echo "The EGL functionality test failed!"
-                echo " EGL is required for OpenGL ES to manage contexts & surfaces."
-                echo " You might need to modify the include and library search paths by editing"
-                echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in"
-                echo " ${XQMAKESPEC}."
-                exit 1
-            fi
-            CFG_EGL=no
-            # If QtOpenGL would be built against OpenGL ES, disable it as we can't to that if EGL is missing
-            if [ "$CFG_OPENGL" = "es2" ]; then
-                CFG_OPENGL=no
-            fi
-        fi
+if [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ]; then
+    if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ]; then
+        if [ "$QPA_PLATFORM_GUARD" = "yes" ] &&
+            ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] ); then
+        echo "No QPA platform plugin enabled!"
+        echo " If you really want to build without a QPA platform plugin you must pass"
+        echo " -no-xcb and -no-eglfs to configure. Doing this will"
+        echo " produce a Qt that cannot run GUI applications."
+        echo " The dependencies needed for xcb to build are listed in"
+        echo " src/plugins/platforms/xcb/README"
+        exit 1
     fi
 fi
+    fi
 
 [ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes"
 
@@ -5578,29 +4887,27 @@ if [ "$CFG_MAC_DWARF2" = "yes" ]; then
     QT_CONFIG="$QT_CONFIG dwarf2"
 fi
 
-# Set the default Mac OS X arch if there are no "-arch" arguments on the configure line
-if [ "$BUILD_ON_MAC" = "yes" ]; then
-    DEFAULT_ARCH="$CFG_MAC_ARCHS"
-    if [ -z "$DEFAULT_ARCH" ]; then
-        case `file "${outpath}/bin/qmake"` in
-        *i?86)
-            DEFAULT_ARCH=x86
-            ;;
-        *x86_64)
-            DEFAULT_ARCH=x86_64
-            ;;
-        *ppc|*ppc64|*)
-            # unsupported/unknown
-            ;;
-        esac
-    fi
+# Detect the default arch (x86 or x86_64) on Mac OS X
+if [ "$BUILD_ON_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
+    DEFAULT_ARCH=
+    case `file "${outpath}/bin/qmake"` in
+    *i?86)
+        DEFAULT_ARCH=x86
+        ;;
+    *x86_64)
+        DEFAULT_ARCH=x86_64
+        ;;
+    *ppc|*ppc64|*)
+        # unsupported/unknown
+        ;;
+    esac
+
     if [ -n "$DEFAULT_ARCH" ]; then
         [ "$OPT_VERBOSE" = "yes" ] && echo "Setting default Mac OS X architechture to $DEFAULT_ARCH."
         QT_CONFIG="$QT_CONFIG $DEFAULT_ARCH"
         QMAKE_CONFIG="$QMAKE_CONFIG $DEFAULT_ARCH"
-        # Make the application arch follow the Qt arch for single arch builds.
-        # (for multiple-arch builds, set CONFIG manually in the application .pro file)
-        [ `echo "$DEFAULT_ARCH" | wc -w` -eq 1 ] && QTCONFIG_CONFIG="$QTCONFIG_CONFIG $DEFAULT_ARCH"
+        # Make the application arch follow the Qt arch
+        QTCONFIG_CONFIG="$QTCONFIG_CONFIG $DEFAULT_ARCH"
     fi
 fi
 
@@ -5616,19 +4923,18 @@ else
     QT_CONFIG="$QT_CONFIG accessibility"
 fi
 
-# egl stuff does not belong in lighthouse, but rather in plugins
-if [ "$PLATFORM_QPA" = "yes" ]; then
-    CFG_EGL="no"
-fi
-
 # enable egl
-if [ "$CFG_EGL" = "no" ]; then
+if [ "$CFG_EGL" = "yes" ]; then
+    QT_CONFIG="$QT_CONFIG egl"
+else
     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
+fi
+
+# enable eglfs
+if [ "$CFG_EGLFS" = "yes" ]; then
+    QT_CONFIG="$QT_CONFIG eglfs"
 else
-    QT_CONFIG="$QT_CONFIG egl"
-    if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
-        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GLES_EGL"
-    fi
+    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGLFS"
 fi
 
 # enable openvg
@@ -5684,12 +4990,12 @@ elif [ "$CFG_SHARED" = "no" ]; then
     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
     QMAKE_CONFIG="$QMAKE_CONFIG static"
 fi
-if [ "$PLATFORM_QPA" = "yes" ]; then
-    QMAKE_CONFIG="$QMAKE_CONFIG qpa"
-    QT_CONFIG="$QT_CONFIG qpa"
-    QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
-    rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
-fi
+
+#FIXME: qpa is implicit this should all be removed
+QMAKE_CONFIG="$QMAKE_CONFIG qpa"
+QT_CONFIG="$QT_CONFIG qpa"
+QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa"
+rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes
 
 if [ "$XPLATFORM_MINGW" != "yes" ]; then
     # Do not set this here for Windows. Let qmake do it so
@@ -5733,6 +5039,10 @@ fi
 [ "$CFG_AVX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG avx"
 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
 [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
+if [ "$CFG_ARCH" = "mips" ]; then
+    [ "$CFG_MIPS_DSP" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dsp"
+    [ "$CFG_MIPS_DSPR2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mips_dspr2"
+fi
 if [ "$CFG_CLOCK_GETTIME" = "yes" ]; then
     QT_CONFIG="$QT_CONFIG clock-gettime"
 fi
@@ -5793,10 +5103,12 @@ if [ "$CFG_GUI" = "auto" ]; then
 fi
 if [ "$CFG_GUI" = "no" ]; then
     QT_CONFIG="$QT_CONFIG no-gui"
-else
-    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GUI"
+    CFG_WIDGETS="no"
+fi
+if [ "$CFG_WIDGETS" = "no" ]; then
+    QT_CONFIG="$QT_CONFIG no-widgets"
+    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WIDGETS"
 fi
-
 
 if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
     #On Mac we implicitly link against libz, so we
@@ -5818,76 +5130,21 @@ fi
 [ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer"
 [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus"
 [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked"
-[ "$CFG_NAS" = "system" ] && QT_CONFIG="$QT_CONFIG nas"
 [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
 [ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
 [ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
 [ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
 [ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
 
-if [ "$PLATFORM_X11" = "yes" ]; then
-    [ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
-
-    # for some reason, the following libraries are not always built shared,
-    # so *every* program/lib (including Qt) has to link against them
-    if [ "$CFG_XSHAPE" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xshape"
-    fi
-    if [ "$CFG_XVIDEO" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xvideo"
-    fi
-    if [ "$CFG_XSYNC" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xsync"
-    fi
-    if [ "$CFG_XINERAMA" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xinerama"
-       QMakeVar set QMAKE_LIBS_X11 '-lXinerama $$QMAKE_LIBS_X11'
-    fi
-    if [ "$CFG_XCURSOR" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xcursor"
-       QMakeVar set QMAKE_LIBS_X11 '-lXcursor $$QMAKE_LIBS_X11'
-    fi
-    if [ "$CFG_XFIXES" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xfixes"
-       QMakeVar set QMAKE_LIBS_X11 '-lXfixes $$QMAKE_LIBS_X11'
-    fi
-    if [ "$CFG_XRANDR" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xrandr"
-        if [ "$CFG_XRENDER" != "yes" ]; then
-            # libXrandr uses 1 function from libXrender, so we always have to have it :/
-           QMakeVar set QMAKE_LIBS_X11 '-lXrandr -lXrender $$QMAKE_LIBS_X11'
-        else
-           QMakeVar set QMAKE_LIBS_X11 '-lXrandr $$QMAKE_LIBS_X11'
-        fi
-    fi
-    if [ "$CFG_XRENDER" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xrender"
-       QMakeVar set QMAKE_LIBS_X11 '-lXrender $$QMAKE_LIBS_X11'
-    fi
-    if [ "$CFG_MITSHM" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG mitshm"
-    fi
-    if [ "$CFG_FONTCONFIG" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG fontconfig"
-    fi
-    if [ "$CFG_XINPUT" = "yes" ]; then
-       QMakeVar set QMAKE_LIBS_X11 '-lXi $$QMAKE_LIBS_X11'
-    fi
-    if [ "$CFG_XINPUT" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xinput tablet"
-    fi
-    if [ "$CFG_XKB" = "yes" ]; then
-        QT_CONFIG="$QT_CONFIG xkb"
-    fi
-fi
-
 [ '!' -z "$D_FLAGS" ] && QMakeVar add DEFINES "$D_FLAGS"
 [ '!' -z "$L_FLAGS" ] && QMakeVar add QMAKE_LIBDIR_FLAGS "$L_FLAGS"
 [ '!' -z "$l_FLAGS" ] && QMakeVar add LIBS "$l_FLAGS"
 
-if [ "$PLATFORM_MAC" = "yes" ]; then
+if [ "$PLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
     if [ "$CFG_RPATH" = "yes" ]; then
        QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname"
+       # set the default rpath to the library installation directory
+       RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS"
     fi
 elif [ -z "`getXQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then
     if [ -n "$RPATH_FLAGS" ]; then
@@ -6136,8 +5393,8 @@ if [ "$CFG_V8SNAPSHOT" = "yes" ]; then
 fi
 
 # ### Vestige
-if [ "$CFG_DECLARATIVE_DEBUG" = "no" ]; then
-    QCONFIG_FLAGS="$QCONFIG_FLAGS QDECLARATIVE_NO_DEBUG_PROTOCOL"
+if [ "$CFG_QML_DEBUG" = "no" ]; then
+    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QML_NO_DEBUGGER"
 fi
 
 if [ "$CFG_EXCEPTIONS" = "no" ]; then
@@ -6214,17 +5471,6 @@ cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
 #endif
 EOF
 
-CFG_ARCH_STR=`echo $CFG_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-CFG_HOST_ARCH_STR=`echo $CFG_HOST_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
-/* Machine Architecture */
-#ifndef QT_BOOTSTRAPPED
-# define QT_ARCH_${CFG_ARCH_STR}
-#else
-# define QT_ARCH_${CFG_HOST_ARCH_STR}
-#endif
-EOF
-
 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
 
@@ -6261,10 +5507,8 @@ if [ "$CFG_DEV" = "yes" ]; then
     echo "#define QT_BUILD_INTERNAL" >>"$outpath/src/corelib/global/qconfig.h.new"
 fi
 
-if [ "$PLATFORM_QPA" = "yes" ]; then
-    # Add QPA to config.h
-    QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
-fi
+# Add QPA to config.h
+QCONFIG_FLAGS="$QCONFIG_FLAGS Q_WS_QPA QT_NO_QWS_QPF QT_NO_QWS_QPF2"
 
 if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
     QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
@@ -6310,7 +5554,6 @@ QMakeVar set sql-plugins "$SQL_PLUGINS"
 [ "$CFG_IPV6IFNAME" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IPV6IFNAME"
 [ "$CFG_GETIFADDRS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GETIFADDRS"
 [ "$CFG_INOTIFY" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
-[ "$CFG_NAS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NAS"
 [ "$CFG_NIS" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
 [ "$CFG_OPENSSL" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL QT_NO_SSL"
 [ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
@@ -6447,6 +5690,7 @@ cat >>"$QTCONFIG.tmp" <<EOF
 #configuration
 CONFIG += $QTCONFIG_CONFIG
 QT_ARCH = $CFG_ARCH
+QT_HOST_ARCH = $CFG_HOST_ARCH
 QT_EDITION = $Edition
 QT_CONFIG += $QT_CONFIG
 
@@ -6470,8 +5714,8 @@ if [ -n "$CFG_SYSROOT" ]; then
     echo "}" >> "$QTCONFIG.tmp"
     echo >> "$QTCONFIG.tmp"
 fi
-if [ "$CFG_RPATH" = "yes" ]; then
-    echo "QMAKE_RPATHDIR += \"$QT_INSTALL_LIBS\"" >> "$QTCONFIG.tmp"
+if [ -n "$RPATH_FLAGS" ]; then
+    echo "QMAKE_RPATHDIR += $RPATH_FLAGS" >> "$QTCONFIG.tmp"
 fi
 if [ -n "$QT_GCC_MAJOR_VERSION" ]; then
     echo "QT_GCC_MAJOR_VERSION = $QT_GCC_MAJOR_VERSION" >> "$QTCONFIG.tmp"
@@ -6582,21 +5826,6 @@ else
    echo "QMAKESPEC = $XPLATFORM" >> "$CACHEFILE.tmp"
 fi
 
-# incrementals
-INCREMENTAL=""
-[ "$CFG_INCREMENTAL" = "auto" ] && "$WHICH" p4 >/dev/null 2>&1 && [ "$CFG_DEV" = "yes" ] && CFG_INCREMENTAL="yes"
-if [ "$CFG_INCREMENTAL" = "yes" ]; then
-    find "$relpath" -perm u+w -mtime -3 | grep 'cpp$' | while read f; do
-        # don't need to worry about generated files
-        [ -r `echo $f | sed "s,cpp$,ui,"` ] && continue
-        basename "$f" | grep '^moc_' >/dev/null 2>&1 && continue
-        # done
-        INCREMENTAL="$INCREMENTAL `basename \"$f\" | sed 's,.cpp,.o,'`"
-    done
-    [ '!' -z "$INCREMENTAL" ] && echo "QMAKE_INCREMENTAL += $INCREMENTAL" >> "$CACHEFILE.tmp"
-    [ -r "$outpath/.qmake.incremental" ] && echo "include($outpath/.qmake.incremental)" >> "$CACHEFILE.tmp"
-fi
-
 # replace .qmake.cache if it differs from the newly created temp file
 if cmp -s "$CACHEFILE.tmp" "$CACHEFILE"; then
     rm -f "$CACHEFILE.tmp"
@@ -6607,6 +5836,7 @@ fi
 #-------------------------------------------------------------------------------
 # give feedback on configuration
 #-------------------------------------------------------------------------------
+exec 3>&1 1>$outpath/config.summary # redirect output temporarily to config.summary
 
 case "$COMPILER" in
 g++*)
@@ -6656,15 +5886,8 @@ else
     echo "Building for:  $XPLATFORM"
 fi
 
-if [ ! -z "$CFG_MAC_ARCHS" ]; then
-    echo "Architecture:  $CFG_ARCH ($CFG_MAC_ARCHS )"
-else
-    echo "Architecture:  $CFG_ARCH"
-fi
-
-if [ "$PLATFORM_QPA" = "yes" ]; then
-    echo "Host architecture: $CFG_HOST_ARCH"
-fi
+echo "Architecture:  $CFG_ARCH"
+echo "Host architecture: $CFG_HOST_ARCH"
 
 if [ -n "$PLATFORM_NOTES" ]; then
     echo "Platform notes:"
@@ -6679,7 +5902,6 @@ if [ "$OPT_VERBOSE" = "yes" ]; then
     echo "qmake switches ......... $QMAKE_SWITCHES"
 fi
 
-[ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ............ $INCREMENTAL"
 echo "Build .................. $CFG_BUILD_PARTS"
 echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG"
 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
@@ -6697,21 +5919,26 @@ fi
 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)"
 echo "QtConcurrent code ...... $CFG_CONCURRENT"
 echo "QtGui module ........... $CFG_GUI"
+echo "QtWidgets module ....... $CFG_WIDGETS"
 if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
     echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore"
 else
     echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT"
 fi
-echo "Declarative debugging ...$CFG_DECLARATIVE_DEBUG"
+echo "QML debugging .......... $CFG_QML_DEBUG"
 echo "STL support ............ $CFG_STL"
 echo "PCH support ............ $CFG_PRECOMPILE"
-echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
-echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
-echo "AVX..................... ${CFG_AVX}"
-if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
+if [ "$CFG_ARCH" = "i386" -o "$CFG_ARCH" = "x86_64" ]; then
+    echo "MMX/3DNOW/SSE/SSE2/SSE3. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_SSE3}"
+    echo "SSSE3/SSE4.1/SSE4.2..... ${CFG_SSSE3}/${CFG_SSE4_1}/${CFG_SSE4_2}"
+    echo "AVX..................... ${CFG_AVX}"
+elif [ "$CFG_ARCH" = "arm" ]; then
     echo "iWMMXt support ......... ${CFG_IWMMXT}"
     echo "NEON support ........... ${CFG_NEON}"
 fi
+if [ "$CFG_ARCH" = "mips" ]; then
+    echo "MIPS_DSP/MIPS_DSPR2..... ${CFG_MIPS_DSP}/${CFG_MIPS_DSPR2}"
+fi
 echo "IPv6 ifname support .... $CFG_IPV6IFNAME"
 echo "getaddrinfo support .... $CFG_GETADDRINFO"
 echo "getifaddrs support ..... $CFG_GETIFADDRS"
@@ -6745,13 +5972,7 @@ elif [ "$CFG_OPENGL" = "es2" ]; then
 else
     echo "OpenGL support ......... no"
 fi
-if [ "$CFG_EGL" != "no" ]; then
-    if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
-        echo "EGL support ............ yes <GLES/egl.h>"
-    else
-        echo "EGL support ............ yes <EGL/egl.h>"
-    fi
-fi
+
 if [ "$CFG_OPENVG" ]; then
     if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
         echo "OpenVG support ......... ShivaVG"
@@ -6759,22 +5980,21 @@ if [ "$CFG_OPENVG" ]; then
         echo "OpenVG support ......... $CFG_OPENVG"
     fi
 fi
-if [ "$PLATFORM_X11" = "yes" ]; then
-    echo "NAS sound support ...... $CFG_NAS"
-    echo "XShape support ......... $CFG_XSHAPE"
-    echo "XVideo support ......... $CFG_XVIDEO"
-    echo "XSync support .......... $CFG_XSYNC"
-    echo "Xinerama support ....... $CFG_XINERAMA"
-    echo "Xcursor support ........ $CFG_XCURSOR"
-    echo "Xfixes support ......... $CFG_XFIXES"
-    echo "Xrandr support ......... $CFG_XRANDR"
-    echo "Xi support ............. $CFG_XINPUT"
-    echo "MIT-SHM support ........ $CFG_MITSHM"
-    echo "FontConfig support ..... $CFG_FONTCONFIG"
-    echo "XKB Support ............ $CFG_XKB"
-    echo "immodule support ....... $CFG_IM"
-    echo "GTK theme support ...... $CFG_QGTKSTYLE"
-fi
+
+echo "XShape support ......... $CFG_XSHAPE"
+echo "XVideo support ......... $CFG_XVIDEO"
+echo "XSync support .......... $CFG_XSYNC"
+echo "Xinerama support ....... $CFG_XINERAMA"
+echo "Xcursor support ........ $CFG_XCURSOR"
+echo "Xfixes support ......... $CFG_XFIXES"
+echo "Xrandr support ......... $CFG_XRANDR"
+echo "Xi support ............. $CFG_XINPUT"
+echo "MIT-SHM support ........ $CFG_MITSHM"
+echo "FontConfig support ..... $CFG_FONTCONFIG"
+echo "XKB Support ............ $CFG_XKB"
+echo "immodule support ....... $CFG_IM"
+echo "GTK theme support ...... $CFG_QGTKSTYLE"
+
 [ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql"
 [ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql"
 [ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc"
@@ -6807,6 +6027,7 @@ echo "Xrender support ........ $CFG_XRENDER"
 if [ "$XPLATFORM_MAEMO" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then
     echo "XInput2 support ........ $CFG_XINPUT2"
 fi
+echo "EGLFS support .......... $CFG_EGLFS"
 echo
 
 # complain about not being able to use dynamic plugins if we are using a static build
@@ -6825,6 +6046,10 @@ if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then
     echo "    OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked"
     echo
 fi
+
+exec 1>&3 3>&- # restore stdout
+cat $outpath/config.summary # display config feedback to user
+
 if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then
     echo
     echo "Error: debug-only framework builds are not supported. Configure with -no-framework"
@@ -7071,14 +6296,21 @@ rm -f .projects .projects.3
 #-------------------------------------------------------------------------------
 # check for platforms that we don't yet know about
 #-------------------------------------------------------------------------------
-if [ "$CFG_ARCH" = "generic" ]; then
+if [ "$CFG_ARCH" = "unknown" ]; then
 cat <<EOF
 
-        NOTICE: Atomic operations are not yet supported for this
-        architecture.
+        NOTICE: configure was unable to determine the architecture
+        for the $XQMAKESPEC target.
 
-        Qt will use the 'generic' architecture instead, which uses a
-        single pthread_mutex_t to protect all atomic operations. This
+        Qt will not use a specialized implementation for any atomic
+        operations. Instead a generic implemention based on either GCC
+        intrinsics or C++11 std::atomic<T> will be used (when
+        available). The generic implementations are generally as fast
+        as and always as safe as a specialized implementation.
+
+        If no generic implementation is available, Qt will use a
+        fallback UNIX implementation which uses a single
+        pthread_mutex_t to protect all atomic operations. This
         implementation is the slow (but safe) fallback implementation
         for architectures Qt does not yet support.
 EOF
@@ -7105,6 +6337,33 @@ EOF
 fi
 
 #-------------------------------------------------------------------------------
+# check if the user passed the obsoleted -wayland or -no-wayland flag
+#-------------------------------------------------------------------------------
+if [ "$CFG_OBSOLETE_WAYLAND" = "yes" ]; then
+cat <<EOF
+
+        NOTICE: The -wayland and -no-wayland flags are now obsolete
+
+        All configuring of QtWayland plugin and QtCompositor happens in the module
+EOF
+fi
+
+#-------------------------------------------------------------------------------
+# check if the user passed the obsoleted -arch or -host-arch options
+#-------------------------------------------------------------------------------
+if [ "$OPT_OBSOLETE_HOST_ARG" = "yes" ]; then
+cat <<EOF
+
+        NOTICE: The -arch and -host-arch options are obsolete.
+
+        Qt now detects the target and host architectures based on compiler
+        output. Qt will be built using $CFG_ARCH for the target architecture
+        and $CFG_HOST_ARCH for the host architecture (note that these two
+        will be the same unless you are cross-compiling).
+EOF
+fi
+
+#-------------------------------------------------------------------------------
 # finally save the executed command to another script
 #-------------------------------------------------------------------------------
 if [ `basename $0` != "config.status" ]; then
@@ -7123,6 +6382,10 @@ fi'`
 
     [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
     echo "#!/bin/sh" > "$outpath/config.status"
+    [ -n "$PKG_CONFIG_SYSROOT_DIR" ] && \
+        echo "export PKG_CONFIG_SYSROOT_DIR=$PKG_CONFIG_SYSROOT_DIR" >> "$outpath/config.status"
+    [ -n "$PKG_CONFIG_LIBDIR" ] && \
+        echo "export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR" >> "$outpath/config.status"
     echo "if [ \"\$#\" -gt 0 ]; then" >> "$outpath/config.status"
     echo "  $CONFIG_STATUS \"\$@\"" >> "$outpath/config.status"
     echo "else" >> "$outpath/config.status"