android: work around android's linux/input.h being retarded.
[profile/ivi/qtbase.git] / configure
index 64efde3..36576c2 100755 (executable)
--- a/configure
+++ b/configure
@@ -108,6 +108,21 @@ QMakeVar()
     echo "$2" "$eq" "$3" >> "$QMAKE_VARS_FILE"
 }
 
+shellArgumentListToQMakeListHelper()
+{
+    local retval
+    for arg in "$@"; do retval="$retval \"$arg\""; done
+    echo "$retval"
+}
+
+# Convert a string usable on a shell command line into word-by-word quoted
+# qmake list.
+shellArgumentListToQMakeList()
+{
+    # eval is needed for the shell to interpret the backslash escape sequences
+    eval shellArgumentListToQMakeListHelper "$@"
+}
+
 # Helper function for getQMakeConf. It parses include statements in
 # qmake.conf and prints out the expanded file
 getQMakeConf1()
@@ -252,15 +267,15 @@ DeviceVar()
 
 resolveDeviceMkspec()
 {
-    result=$(find "$relpath/mkspecs/devices/" -type d -name "*$VAL*" | sed "s,^$relpath/mkspecs/,,")
+    result=$(find "$relpath/mkspecs/devices/" -type d -name "*$1*" | sed "s,^$relpath/mkspecs/,,")
     match_count=$(echo "$result" | wc -w)
     if [ "$match_count" -gt 1 ]; then
-        echo >&2 "Error: Multiple matches for device '$VAL'. Candidates are:"
+        echo >&2 "Error: Multiple matches for device '$1'. Candidates are:"
         tabbed_result=$(echo "$result" | sed "s,^,    ,")
         echo >&2 "$tabbed_result"
         echo "undefined"
     elif [ "$match_count" -eq 0 ]; then
-        echo >&2 "Error: No device matching '$VAL'"
+        echo >&2 "Error: No device matching '$1'"
         echo "undefined"
     else
         echo "$result"
@@ -772,7 +787,6 @@ CFG_RPATH=yes
 CFG_FRAMEWORK=auto
 MAC_CONFIG_TEST_COMMANDLINE=  # used to make the configure tests run with the correct arch's and SDK settings
 CFG_MAC_HARFBUZZ=no
-CFG_SXE=no
 CFG_PREFIX_INSTALL=yes
 CFG_SDK=
 DEFINES=
@@ -919,19 +933,8 @@ while [ "$#" -gt 0 ]; do
         VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
         VAL=no
         ;;
-    #Qt style yes options
-    -profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-eglfs|-directfb|-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|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-qml-debug|-javascript-jit|-rpath|-pkg-config|-force-pkg-config|-icu|-force-asserts|-testcocoon|-c++11)
-        VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
-        VAL=yes
-        ;;
     #Qt style options that pass an argument
-    -qconfig)
-        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|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa)
+    -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|-qpa|-qconfig)
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
         shift
         VAL="$1"
@@ -1068,9 +1071,10 @@ while [ "$#" -gt 0 ]; do
         VAR="add_warn"
         VAL="$1"
         ;;
+    #General options, including Qt style yes options
     -*)
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
-        VAL="unknown"
+        VAL="yes"
         ;;
     *)
         UNKNOWN_ARG=yes
@@ -1170,9 +1174,6 @@ while [ "$#" -gt 0 ]; do
     bindir)
         QT_INSTALL_BINS="$VAL"
         ;;
-    sxe)
-       CFG_SXE="$VAL"
-        ;;
     sse)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_SSE="$VAL"
@@ -2124,6 +2125,9 @@ if [ "$OPT_SHADOW" = "yes" ]; then
     # save a pre-existing mkspecs/modules dir
     test -d "$outpath/mkspecs/modules" && \
         mv "$outpath/mkspecs/modules" "$outpath/mkspecs-modules"
+    # ditto for mkspecs/modules-inst
+    test -d "$outpath/mkspecs/modules-inst" && \
+        mv "$outpath/mkspecs/modules-inst" "$outpath/mkspecs-modules-inst"
 
     # symlink the mkspecs directory
     mkdir -p "$outpath/mkspecs"
@@ -2151,6 +2155,12 @@ if [ "$OPT_SHADOW" = "yes" ]; then
         ShadowMkspecs modules
     fi
 
+    # The modules-inst dir is not quite as special, but still.
+    if test -d "$outpath/mkspecs-modules-inst"; then
+        rm -rf "$outpath/mkspecs/modules-inst"
+        mv "$outpath/mkspecs-modules-inst" "$outpath/mkspecs/modules-inst"
+    fi
+
     # symlink the doc directory
     rm -rf "$outpath/doc"
     ln -s "$relpath/doc" "$outpath/doc"
@@ -2355,10 +2365,6 @@ if [ -z "$PLATFORM" ]; then
         ;;
      *)
         if [ "$OPT_HELP" != "yes" ]; then
-            echo
-            for p in $PLATFORMS; do
-                echo "    $relconf $* -platform $p"
-            done
             echo >&2
             echo "   The build script does not currently recognize all" >&2
             echo "   platforms supported by Qt." >&2
@@ -2370,13 +2376,11 @@ if [ -z "$PLATFORM" ]; then
     esac
 fi
 
-PLATFORMS=`find "$relpath/mkspecs/" -type f | grep -v qws | sed "s,$relpath/mkspecs/qws/,,"`
-
 [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
 
 case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
 case "$XPLATFORM" in linux-g++-maemo) XPLATFORM_MAEMO=yes;; esac
-case "$XPLATFORM" in qnx-*) XPLATFORM_QNX=yes;; esac
+case "$XPLATFORM" in *qnx-*|*blackberry-*) XPLATFORM_QNX=yes;; esac
 
 if [ -d "$PLATFORM" ]; then
   QMAKESPEC="$PLATFORM"
@@ -2478,7 +2482,7 @@ if [ "$CFG_DEBUG" = "auto" ]; then
     fi
 fi
 if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
-    QT_CONFIG="$QT_CONFIG build_all"
+    QT_CONFIG="$QT_CONFIG build_all debug_and_release"
 fi
 
 # pass on $CFG_SDK to the configure tests.
@@ -3497,8 +3501,9 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
     mv -f "$QMAKE_QCONFIG_H" "$QCONFIG_H"
 
     #mkspecs/default is used as a (gasp!) default mkspec so QMAKESPEC needn't be set once configured
-    rm -rf mkspecs/default
+    rm -rf mkspecs/default mkspecs/default-host
     ln -s `echo $XQMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default
+    ln -s `echo $QMAKESPEC | sed "s,^${relpath}/mkspecs/,,"` mkspecs/default-host
     mkdir -p "$outpath/qmake" || exit
     # fix makefiles
     for mkfile in GNUmakefile Makefile; do
@@ -3613,6 +3618,16 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
 fi # Build qmake
 
 #-------------------------------------------------------------------------------
+# create a qt.conf for the Qt build tree itself
+#-------------------------------------------------------------------------------
+
+QTCONFFILE="$outpath/bin/qt.conf"
+cat > "$QTCONFFILE" <<EOF
+[EffectivePaths]
+Prefix=..
+EOF
+
+#-------------------------------------------------------------------------------
 # Detect pkg-config
 #-------------------------------------------------------------------------------
 if [ -z "$PKG_CONFIG" ]; then
@@ -3763,7 +3778,7 @@ fi
 
 # detect sse2 support
 if [ "${CFG_SSE2}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-msse2"; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/common/sse2 "sse2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
        CFG_SSE2=yes
     else
        CFG_SSE2=no
@@ -3772,7 +3787,7 @@ fi
 
 # detect sse3 support
 if [ "${CFG_SSE3}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse3 "sse3" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-msse3"; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/common/sse3 "sse3" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
        CFG_SSE3=yes
     else
        CFG_SSE3=no
@@ -3781,7 +3796,7 @@ fi
 
 # detect ssse3 support
 if [ "${CFG_SSSE3}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ssse3 "ssse3" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-mssse3"; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/common/ssse3 "ssse3" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
        CFG_SSSE3=yes
     else
        CFG_SSSE3=no
@@ -3790,7 +3805,7 @@ fi
 
 # detect sse4.1 support
 if [ "${CFG_SSE4_1}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_1 "sse4_1" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-msse4.1"; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/common/sse4_1 "sse4_1" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
        CFG_SSE4_1=yes
     else
        CFG_SSE4_1=no
@@ -3799,7 +3814,7 @@ fi
 
 # detect sse4.2 support
 if [ "${CFG_SSE4_2}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse4_2 "sse4_2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-msse4.2"; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/common/sse4_2 "sse4_2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
        CFG_SSE4_2=yes
     else
        CFG_SSE4_2=no
@@ -3808,7 +3823,7 @@ fi
 
 # detect avx support
 if [ "${CFG_AVX}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-mavx"; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/common/avx "avx" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
        case "$XQMAKESPEC" in
            *g++*|*-clang*)
                # Some clang versions produce internal compiler errors compiling Qt AVX code
@@ -3838,7 +3853,7 @@ if [ "${CFG_AVX}" = "no" ]; then
     CFG_AVX2=no
 fi
 if [ "${CFG_AVX2}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx2 "avx2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-march=core-avx2"; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/common/avx2 "avx2" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
        CFG_AVX2=yes
     else
        CFG_AVX2=no
@@ -3847,7 +3862,7 @@ fi
 
 # check iWMMXt support
 if [ "$CFG_IWMMXT" = "yes" ]; then
-    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-mcpu=iwmmxt"
+    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS
     if [ $? != "0" ]; then
         echo "The iWMMXt functionality test failed!"
        echo " Please make sure your compiler supports iWMMXt intrinsics!"
@@ -3857,7 +3872,7 @@ fi
 
 # detect neon support
 if [ "$CFG_ARCH" = "arm" ] && [ "${CFG_NEON}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/neon "neon" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS "-mfpu=neon"; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/neon "neon" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS; then
        CFG_NEON=yes
     else
        CFG_NEON=no
@@ -4527,9 +4542,9 @@ elif [ "$CFG_OPENGL" = "es2" ]; then
         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"
+        QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "`shellArgumentListToQMakeList "$QMAKE_INCDIR_OPENGL_ES2"`"
+        QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "`shellArgumentListToQMakeList "$QMAKE_LIBDIR_OPENGL_ES2"`"
+        QMakeVar set QMAKE_LIBS_OPENGL_ES2 "`shellArgumentListToQMakeList "$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 $D_FLAGS $l_FLAGS $QMAKE_LIBS_OPENGL_ES2 $QMAKE_CFLAGS_OPENGL_ES2
@@ -4653,22 +4668,20 @@ if [ "$CFG_XCB" != "no" ]; 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 $D_FLAGS $l_FLAGS; then
-                    CFG_XINPUT2=yes
-                    CFG_XINPUT=no
+        # auto-detect XInput2 support. Needed by xcb too.
+        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 $D_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
@@ -4688,7 +4701,7 @@ if [ "$CFG_DIRECTFB" != "no" ]; then
     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists directfb 2>/dev/null; then
         QMAKE_CFLAGS_DIRECTFB=`$PKG_CONFIG --cflags directfb 2>/dev/null`
         QMAKE_LIBS_DIRECTFB=`$PKG_CONFIG --libs directfb 2>/dev/null`
-        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/directfb" "DirectFB" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS $QMAKE_CFLAGS_DIRECTFB $QMAKE_LIBS_DIRECTFB; then
+        if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/qpa/directfb" "DirectFB" $L_FLAGS $I_FLAGS $D_FLAGS $l_FLAGS $QMAKE_CFLAGS_DIRECTFB $QMAKE_LIBS_DIRECTFB; then
             CFG_DIRECTFB=yes
         elif [ "$CFG_DIRECTFB" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
             echo " DirectFB support cannot be enabled due to functionality tests!"
@@ -4755,7 +4768,9 @@ if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
     # check the mkspec
     QT_QPA_DEFAULT_PLATFORM=`getXQMakeConf QT_QPA_DEFAULT_PLATFORM`
     if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
-        if [ "$BUILD_ON_MAC" = "yes" ]; then
+        if [ "$XPLATFORM_MINGW" = "yes" ]; then
+            QT_QPA_DEFAULT_PLATFORM="windows"
+        elif [ "$BUILD_ON_MAC" = "yes" ]; then
             QT_QPA_DEFAULT_PLATFORM="cocoa"
         elif [ "$UNAME_SYSTEM" = "QNX" ]; then
             QT_QPA_DEFAULT_PLATFORM="qnx"
@@ -5093,25 +5108,18 @@ if [ "$CFG_OPENGL" = "es2" ]; then
     QT_CONFIG="$QT_CONFIG opengles2"
 fi
 
-# safe execution environment
-if [ "$CFG_SXE" != "no" ]; then
-    QT_CONFIG="$QT_CONFIG sxe"
-fi
-
 # build up the variables for output
 if [ "$CFG_DEBUG" = "yes" ]; then
     QMAKE_OUTDIR="${QMAKE_OUTDIR}debug"
-    QMAKE_CONFIG="$QMAKE_CONFIG debug"
 elif [ "$CFG_DEBUG" = "no" ]; then
     QMAKE_OUTDIR="${QMAKE_OUTDIR}release"
-    QMAKE_CONFIG="$QMAKE_CONFIG release"
 fi
 if [ "$CFG_SHARED" = "yes" ]; then
     QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared"
-    QMAKE_CONFIG="$QMAKE_CONFIG shared dll"
+    QT_CONFIG="$QT_CONFIG shared"
 elif [ "$CFG_SHARED" = "no" ]; then
     QMAKE_OUTDIR="${QMAKE_OUTDIR}-static"
-    QMAKE_CONFIG="$QMAKE_CONFIG static"
+    QT_CONFIG="$QT_CONFIG static"
 fi
 
 #FIXME: qpa is implicit this should all be removed
@@ -5557,6 +5565,16 @@ 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"
 
+if [ "$CFG_SHARED" = "no" ]; then
+    cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF
+/* Qt was configured for a static build */
+#if !defined(QT_SHARED) && !defined(QT_STATIC)
+# define QT_STATIC
+#endif
+
+EOF
+fi
+
 if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
 fi
@@ -5621,7 +5639,6 @@ QMakeVar set sql-plugins "$SQL_PLUGINS"
 [ "$CFG_PNG" != "yes" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
 [ "$CFG_JPEG" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
 [ "$CFG_ZLIB" != "yes" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
-[ "$CFG_SXE" = "no" ]        && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
 [ "$CFG_DBUS" = "no" ]      && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
 
 # X11/Unix/Mac only configs
@@ -5798,7 +5815,7 @@ fi
 
 if [ -n "$CFG_SYSROOT" ]; then
     echo "# sysroot" >>"$QTCONFIG.tmp"
-    echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
+    echo "!host_build {" >>"$QTCONFIG.tmp"
     echo "    QMAKE_CFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
     echo "    QMAKE_CXXFLAGS  += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
     echo "    QMAKE_LFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
@@ -5816,7 +5833,7 @@ fi
 
 if [ -n "$QMAKE_INCDIR_OPENGL_ES2" ]; then
     echo "#Qt opengl include path" >> "$QTCONFIG.tmp"
-    echo "QMAKE_INCDIR_OPENGL_ES2 = \"$QMAKE_INCDIR_OPENGL_ES2\"" >> "$QTCONFIG.tmp"
+    echo "QMAKE_INCDIR_OPENGL_ES2 = `shellArgumentListToQMakeList "$QMAKE_INCDIR_OPENGL_ES2"`" >> "$QTCONFIG.tmp"
 fi
 
 # replace qconfig.pri if it differs from the newly created temp file
@@ -5832,6 +5849,7 @@ fi
 QTMODULE="$outpath/mkspecs/qmodule.pri"
 
 echo "CONFIG += $QMAKE_CONFIG create_prl link_prl" >> "$QTMODULE.tmp"
+echo "QT_BUILD_PARTS = $CFG_BUILD_PARTS" >> "$QTMODULE.tmp"
 
 # Ensure we can link to uninistalled libraries
 if [ "$BUILD_ON_MAC" != "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
@@ -5899,24 +5917,12 @@ cat >>"$CACHEFILE.tmp" <<EOF
 #paths
 QT_SOURCE_TREE = \$\$quote($relpath)
 QT_BUILD_TREE = \$\$quote($outpath)
-QT_BUILD_PARTS = $CFG_BUILD_PARTS
-
-#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
-QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
-QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
 
 include(\$\$PWD/mkspecs/qmodule.pri)
 CONFIG += dylib depend_includepath fix_output_dirs no_private_qt_headers_warning QTDIR_build
 
 EOF
 
-#dump the qmake spec
-if [ -d "$outpath/mkspecs/$XPLATFORM" ]; then
-   echo "QMAKESPEC = \$\$QT_BUILD_TREE/mkspecs/$XPLATFORM" >> "$CACHEFILE.tmp"
-else
-   echo "QMAKESPEC = $XPLATFORM" >> "$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"
@@ -6046,6 +6052,7 @@ echo "Xcursor support ........ $CFG_XCURSOR"
 echo "Xfixes support ......... $CFG_XFIXES"
 echo "Xrandr support ......... $CFG_XRANDR"
 echo "Xi support ............. $CFG_XINPUT"
+echo "Xi2 support ............ $CFG_XINPUT2"
 echo "MIT-SHM support ........ $CFG_MITSHM"
 echo "FontConfig support ..... $CFG_FONTCONFIG"
 echo "XKB Support ............ $CFG_XKB"
@@ -6125,231 +6132,48 @@ EXEC=""
 # build makefiles based on the configuration
 #-------------------------------------------------------------------------------
 
-echo "Finding project files. Please wait..."
 if [ "$CFG_NOPROCESS" != "yes" ]; then
-    "$outpath/bin/qmake" -prl -r "${relpath}/qtbase.pro"
-    if [ -f "${relpath}/qtbase.pro" ]; then
-        mkfile="${outpath}/Makefile"
-        [ -f "$mkfile" ] && chmod +w "$mkfile"
-        QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/qtbase.pro" -o "$mkfile"
-    fi
-fi
-
-# .projects      -> projects to process
-# .projects.1    -> qt and moc
-# .projects.2    -> subdirs and libs
-# .projects.3    -> the rest
-rm -f .projects .projects.1 .projects.2 .projects.3
-
-QMAKE_PROJECTS=`find "$relpath/." -name '*.pro' -print | sed 's-/\./-/-'`
-if [ -z "$AWK" ]; then
-    for p in `echo $QMAKE_PROJECTS`; do
-        echo "$p" >> .projects
-    done
-else
-    cat >projects.awk <<EOF
-BEGIN {
-    files = 0
-    target_file = ""
-    input_file = ""
-
-    first = "./.projects.1.tmp"
-    second = "./.projects.2.tmp"
-    third = "./.projects.3.tmp"
-}
-
-FNR == 1 {
-    if ( input_file ) {
-        if ( ! target_file )
-            target_file = third
-        print input_file >target_file
-    }
-
-    matched_target = 0
-    template_lib = 0
-    input_file = FILENAME
-    target_file = ""
-}
-
-/^(TARGET.*=)/ {
-    if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
-        target_file = first
-        matched_target = 1
-    } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
-        target_file = second
-        matched_target = 1
-    }
-}
-
-matched_target == 0 && /^(TEMPLATE.*=)/ {
-    if ( \$3 == "subdirs" )
-        target_file = second
-    else if ( \$3 == "lib" )
-        template_lib = 1
-    else
-        target_file = third
-}
-
-matched_target == 0 && template_lib == 1 && /^(CONFIG.*=)/ {
-    if ( \$0 ~ /plugin/ )
-        target_file = third
-    else
-        target_file = second
-}
-
-END {
-    if ( input_file ) {
-        if ( ! target_file )
-            target_file = third
-        print input_file >>target_file
-    }
-}
-
-EOF
-
-    rm -f .projects.all
-    for p in `echo $QMAKE_PROJECTS`; do
-       echo "$p" >> .projects.all
-    done
-
-    # if you get errors about the length of the command line to awk, change the -l arg
-    # to split below
-    split -l 100 .projects.all .projects.all.
-    for p in .projects.all.*; do
-       "$AWK" -f projects.awk `cat $p`
-       [ -f .projects.1.tmp ] && cat .projects.1.tmp >> .projects.1
-       [ -f .projects.2.tmp ] && cat .projects.2.tmp >> .projects.2
-       [ -f .projects.3.tmp ] && cat .projects.3.tmp >> .projects.3
-       rm -f .projects.1.tmp .projects.2.tmp .projects.3.tmp $p
-    done
-    rm -f .projects.all* projects.awk
-
-    [ -f .projects.1 ] && cat .projects.1 >>.projects
-    [ -f .projects.2 ] && cat .projects.2 >>.projects
-    rm -f .projects.1 .projects.2
-    if [ -f .projects.3 ] && [ "$OPT_FAST" = "no" ]; then
-       cat .projects.3 >>.projects
-       rm -f .projects.3
-    fi
-fi
-# don't sort Qt and MOC in with the other project files
-# also work around a segfaulting uniq(1)
-if [ -f .sorted.projects.2 ]; then
-    sort .sorted.projects.2 > .sorted.projects.2.new
-    mv -f .sorted.projects.2.new .sorted.projects.2
-    cat .sorted.projects.2 >> .sorted.projects.1
-fi
-[ -f .sorted.projects.1 ] && sort .sorted.projects.1 >> .sorted.projects
-rm -f .sorted.projects.2 .sorted.projects.1
-
-NORM_PROJECTS=0
-FAST_PROJECTS=0
-if [ -f .projects ]; then
-   uniq .projects >.tmp
-   mv -f .tmp .projects
-   NORM_PROJECTS=`cat .projects | wc -l | sed -e "s, ,,g"`
-fi
-if [ -f .projects.3 ]; then
-   uniq .projects.3 >.tmp
-   mv -f .tmp .projects.3
-   FAST_PROJECTS=`cat .projects.3 | wc -l | sed -e "s, ,,g"`
-fi
-echo "  `expr $NORM_PROJECTS + $FAST_PROJECTS` projects found."
-echo
-
-PART_ROOTS=
-for part in $CFG_BUILD_PARTS; do
-    case "$part" in
-    tools) PART_ROOTS="$PART_ROOTS tools" ;;
-    libs) PART_ROOTS="$PART_ROOTS src" ;;
-    translations) PART_ROOTS="$PART_ROOTS translations" ;;
-    examples) PART_ROOTS="$PART_ROOTS examples" ;;
-    *) ;;
-    esac
-done
-
-if [ "$CFG_DEV" = "yes" ]; then
-    PART_ROOTS="$PART_ROOTS tests"
-fi
-
-echo "Creating makefiles. Please wait..."
-for file in .projects .projects.3; do
-    [ '!' -f "$file" ] && continue
-    for a in `cat $file`; do
-        IN_ROOT=no
-       for r in $PART_ROOTS; do
-           if echo "$a" | grep "^$r" >/dev/null 2>&1 || echo "$a" | grep "^$relpath/$r" >/dev/null 2>&1; then
-               IN_ROOT=yes
-               break
-            fi
-       done
-        [ "$IN_ROOT" = "no" ] && continue
-
-        case $a in
-        *winmain/winmain.pro)
-            if [ "$CFG_NOPROCESS" = "yes" ] || [ "$XPLATFORM_MINGW" != "yes" ]; then
-                continue
-            fi
-            SPEC=$XQMAKESPEC ;;
-        */qmake/qmake.pro) continue ;;
-        *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*tools/qdoc*|*tools/qdbusxml2cpp*|*tools/qdbuscpp2xml*) SPEC=$QMAKESPEC ;;
-        *) if [ "$CFG_NOPROCESS" = "yes" ]; then
-              continue
-           else
-              SPEC=$XQMAKESPEC
-           fi;;
-        esac
-        dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
-        test -d "$dir" || mkdir -p "$dir"
-        OUTDIR="$outpath/$dir"
-        if [ -f "${OUTDIR}/Makefile" ] && [ "$OPT_FAST" = "yes" ]; then
-            # fast configure - the makefile exists, skip it
-            # since the makefile exists, it was generated by qmake, which means we
-            # can skip it, since qmake has a rule to regenerate the makefile if the .pro
-            # file changes...
-            [ "$OPT_VERBOSE" = "yes" ] && echo "  skipping $a"
-            continue;
-        fi
-        QMAKE_SPEC_ARGS="-spec $SPEC"
-        echo $ECHO_N "  for $a$ECHO_C"
-
-        QMAKE="$outpath/bin/qmake"
-       QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
-        if [ "$file" = ".projects.3" ]; then
-            echo " (fast)"
-
-            cat >"${OUTDIR}/Makefile" <<EOF
-# ${OUTDIR}/Makefile: generated by configure
+    echo "Creating makefiles. Please wait..."
+    "$outpath/bin/qmake" -r ${OPT_FAST+CONFIG+=fast} "$relpath"
+    echo "Done"
+
+    if [ "$OPT_FAST" = "yes" ]; then
+        PART_ROOTS=
+        for part in $CFG_BUILD_PARTS; do
+            case "$part" in
+            examples|tests) PART_ROOTS="$PART_ROOTS $part" ;;
+            esac
+        done
+        if [ "x$PART_ROOTS" != "x" ]; then
+            echo
+            echo "Creating stub makefiles. Please wait..."
+            QMAKE="$outpath/bin/qmake"
+            [ "$CFG_DEBUG_RELEASE" = "no" ] && first_tgt="first_target: first" || first_tgt=
+            (cd "$relpath" && find $PART_ROOTS -name '*.pro') | grep -v /testdata/ | while read p; do
+                d=${p%/*}
+                test -f "$outpath/$d/Makefile" && continue
+                echo "  for $relpath/$p"
+
+                mkdir -p "$outpath/$d" || exit
+                cat > "$outpath/$d/Makefile" <<EOF || exit
+# $outpath/$d/Makefile: generated by configure
 #
 # WARNING: This makefile will be replaced with a real makefile.
 # All changes made to this file will be lost.
-EOF
-            [ "$CFG_DEBUG_RELEASE" = "no" ] && echo "first_target: first" >>${OUTDIR}/Makefile
 
-            cat >>"${OUTDIR}/Makefile" <<EOF
 QMAKE = "$QMAKE"
+
+$first_tgt
 all clean install qmake first Makefile: FORCE
-       \$(QMAKE) $QMAKE_ARGS -o "$OUTDIR" "$a"
-       cd "$OUTDIR"
+       \$(QMAKE) $QMAKE_SWITCHES "$relpath/$p"
        \$(MAKE) \$@
-
 FORCE:
-
 EOF
-        else
-            if [ "$OPT_VERBOSE" = "yes" ]; then
-                echo " (`basename $SPEC`)"
-                echo "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
-           else
-               echo
-            fi
-
-            [ -f "${OUTDIR}/Makefile" ] && chmod +w "${OUTDIR}/Makefile"
-            QTDIR="$outpath" "$QMAKE" $QMAKE_ARGS -o "$OUTDIR" "$a"
-       fi
-    done
-done
-rm -f .projects .projects.3
+            done || exit
+            echo "Done"
+        fi
+    fi
+fi
 
 #-------------------------------------------------------------------------------
 # check for platforms that we don't yet know about