Index: trunk/configure
===================================================================
--- trunk/configure	(revision 5)
+++ trunk/configure	(revision 561)
@@ -1,12 +1,43 @@
 #!/bin/sh
-#
-# Configures to build the Qt library
-#
-# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# Contact: Qt Software Information (qt-info@nokia.com)
-#
-# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## All rights reserved.
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial Usage
+## Licensees holding valid Qt Commercial licenses may use this file in
+## accordance with the Qt Commercial License Agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and Nokia.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file.  Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Nokia gives you certain additional
+## rights.  These rights are described in the Nokia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3.0 as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL included in the
+## packaging of this file.  Please review the following information to
+## ensure the GNU General Public License version 3.0 requirements will be
+## met: http://www.gnu.org/copyleft/gpl.html.
+##
+## If you have questions regarding the use of this file, please contact
+## Nokia at qt-info@nokia.com.
+## $QT_END_LICENSE$
+##
+#############################################################################
 
 #-------------------------------------------------------------------------------
@@ -47,4 +78,9 @@
 # utility functions
 #-------------------------------------------------------------------------------
+
+shellEscape()
+{
+    echo "$@" | sed 's/ /\ /g'
+}
 
 # Adds a new qmake variable to the cache
@@ -71,4 +107,26 @@
 }
 
+# Helper function for getQMakeConf. It parses include statements in
+# qmake.conf and prints out the expanded file
+getQMakeConf1()
+{
+    while read line; do case "$line" in
+        include*)
+	    inc_file=`echo "$line" | sed -n -e "/^include.*(.*)/s/include.*(\(.*\)).*$/\1/p"`
+	    current_dir=`dirname "$1"`
+	    conf_file="$current_dir/$inc_file"
+	    if [ ! -e  "$conf_file" ]; then
+                echo "WARNING: Unable to find file $conf_file" >&2
+                continue
+            fi
+            getQMakeConf1 "$conf_file"
+        ;;
+        *)
+            echo "$line"
+        ;;
+    esac; done < "$1"
+}
+
+
 # relies on $QMAKESPEC being set correctly. parses include statements in
 # qmake.conf and prints out the expanded file
@@ -79,13 +137,29 @@
         tmpSPEC="$1"
     fi
-    $AWK -v "QMAKESPEC=$tmpSPEC" '
-/^include\(.+\)$/{
-    fname = QMAKESPEC "/" substr($0, 9, length($0) - 9)
-    while ((getline line < fname) > 0)
-        print line
-    close(fname)
-    next
+    getQMakeConf1 "$tmpSPEC/qmake.conf"
 }
-{ print }' "$tmpSPEC/qmake.conf"
+
+# relies on $TEST_COMPILER being set correctly
+compilerSupportsFlag()
+{
+    cat >conftest.cpp <<EOF
+int main() { return 0; }
+EOF
+    "$TEST_COMPILER" "$@" -o conftest.o conftest.cpp
+    ret=$?
+    rm -f conftest.cpp conftest.o
+    return $ret
+}
+
+# relies on $TEST_COMPILER being set correctly
+linkerSupportsFlag()
+{
+    lflags=-Wl
+    for flag
+    do
+	safe_flag=`shellEscape "$flag"`
+	lflags=$lflags,$safe_flag
+    done
+    compilerSupportsFlag "$lflags" >/dev/null 2>&1
 }
 
@@ -167,4 +241,5 @@
 CFG_NOKIA=no
 CFG_EMBEDDED=no
+CFG_RTOS_ENABLED=yes
 EditionString=Commercial
 
@@ -203,5 +278,5 @@
             fi
             ;;
-        h|help|--help|-help)
+        -h|help|--help|-help)
             if [ "$VAL" = "yes" ]; then
                 OPT_HELP="$VAL"
@@ -280,5 +355,5 @@
             COMMERCIAL_USER="yes"
             break
-        else [ "$commercial" = "o" ];
+        elif [ "$commercial" = "o" ]; then
             COMMERCIAL_USER="no"
             break
@@ -303,5 +378,5 @@
     # one of commercial editions
     [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes
-    [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=yes
+    [ "$PLATFORM_QWS" = "maybe" ] && PLATFORM_QWS=no
 
     # read in the license file
@@ -312,5 +387,5 @@
             echo "You are using an old license file."
             echo
-            echo "Please install the license file supplied by Qt Software,"
+            echo "Please install the license file supplied by Nokia,"
             echo "or install the Qt Open Source Edition if you intend to"
             echo "develop free software."
@@ -345,5 +420,5 @@
     fi
     ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1`
-    PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d - | cut -b 1`
+    PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -`
     LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -`
     LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1`
@@ -372,4 +447,5 @@
     Z4M|R4M|Q4M)
         LicenseType="Evaluation"
+        QMakeVar add DEFINES QT_EVAL
         case $ProductCode in
          B)
@@ -388,63 +464,44 @@
     # verify that we are licensed to use Qt on this platform
     LICENSE_EXTENSION=
-    if [ "$PlatformCode" = "X" ]; then
-	# Qt All-OS
-	LICENSE_EXTENSION="-ALLOS"
-    elif [ "$PLATFORM_QWS" = "yes" ]; then
-        case $PlatformCode in
-        2|4|8|A|B|E|G|J|K|P|Q|S|U|V|W)
+    case "$PlatformCode" in
+	*L)
+	    CFG_RTOS_ENABLED=yes
+	    PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'`
+	    ;;
+	*)
+	    CFG_RTOS_ENABLED=no
+	    PlatformCode=`echo "$PlatformCode" | sed 's/.$//'`
+	    ;;
+    esac
+    case "$PlatformCode,$PLATFORM_MAC,$PLATFORM_QWS" in
+        X9,* | XC,* | XU,* | XW,* | XM,*)
+            # Qt All-OS
+            LICENSE_EXTENSION="-ALLOS"
+            ;;
+        8M,* | KM,* | S9,* | SC,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*)
             # Qt for Embedded Linux
             LICENSE_EXTENSION="-EMBEDDED"
             ;;
+        6M,*,no | N7,*,no | N9,*,no | NX,*,no)
+            # Embedded no-deploy
+            LICENSE_EXTENSION="-EMBEDDED"
+            ;;
+        FM,*,no | LM,yes,* | ZM,no,no)
+            # Desktop
+            LICENSE_EXTENSION="-DESKTOP"
+            ;;
         *)
+            Platform=Linux/X11
+            [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X'
+            [ "$PLATFORM_QWS" = "yes" ] && Platform='Embedded Linux'
             echo
-            echo "You are not licensed for Qt for Embedded Linux."
+            echo "You are not licensed for the $Platform platform."
             echo
-            echo "Please contact sales@trolltech.com to upgrade your license"
-            echo "to include Qt for Embedded Linux, or install the"
-            echo "Qt Open Source Edition if you intend to develop free software."
+            echo "Please contact qt-info@nokia.com to upgrade your license to"
+            echo "include the $Platform platform, or install the Qt Open Source Edition"
+            echo "if you intend to develop free software."
             exit 1
             ;;
-        esac
-    elif [ "$PLATFORM_MAC" = "yes" ]; then
-        case $PlatformCode in
-        2|4|5|7|9|B|C|E|F|G|L|M|U|W|Y)
-            # Qt/Mac
-            LICENSE_EXTENSION="-DESKTOP"
-            ;;
-        3|6|8|A|D|H|J|K|P|Q|S|V)
-            # Embedded no-deploy
-            LICENSE_EXTENSION="-EMBEDDED"
-	    ;;
-        *)
-            echo
-            echo "You are not licensed for the Qt/Mac platform."
-            echo
-            echo "Please contact sales@trolltech.com to upgrade your license"
-            echo "to include the Qt/Mac platform."
-            exit 1
-            ;;
-        esac
-     else
-         case $PlatformCode in
-         2|3|4|5|7|D|E|F|J|M|Q|S|T|V|Z)
-             # Qt/X11
-             LICENSE_EXTENSION="-DESKTOP"
-             ;;
-         6|8|9|A|B|C|G|H|K|P|U|W)
-             # Embedded no-deploy
-             LICENSE_EXTENSION="-EMBEDDED"
-             ;;
-         *)
-             echo
-             echo "You are not licensed for the Qt/X11 platform."
-             echo
-             echo "Please contact sales@trolltech.com to upgrade your license to"
-             echo "include the Qt/X11 platform, or install the Qt Open Source Edition"
-             echo "if you intend to develop free software."
-             exit 1
-             ;;
-        esac
-    fi
+    esac
 
     if test -r "$relpath/.LICENSE"; then
@@ -473,5 +530,5 @@
 
     case "$LicenseFeatureCode" in
-    G|L)
+    B|G|L|Y)
         # US
         case "$LicenseType" in
@@ -484,5 +541,5 @@
         esac
         ;;
-    2|5)
+    2|4|5|F)
         # non-US
         case "$LicenseType" in
@@ -500,4 +557,12 @@
         exit 1
         ;;
+    esac
+    case "$LicenseFeatureCode" in
+	4|B|F|Y)
+	    CFG_RTOS_ENABLED=yes
+	    ;;
+	2|5|G|L)
+	    CFG_RTOS_ENABLED=no
+	    ;;
     esac
     if [ '!' -f "$outpath/LICENSE" ]; then
@@ -543,7 +608,10 @@
 QMakeVar add styles "cde mac motif plastique cleanlooks windows"
 QMakeVar add decorations "default windows styled"
-QMakeVar add gfx-drivers "linuxfb"
+QMakeVar add mouse-drivers "pc"
+if [ "$UNAME_SYSTEM" = "Linux" ] ; then
+    QMakeVar add gfx-drivers "linuxfb"
+    QMakeVar add mouse-drivers "linuxtp"
+fi
 QMakeVar add kbd-drivers "tty"
-QMakeVar add mouse-drivers "pc linuxtp"
 
 if [ "$CFG_DEV" = "yes" ]; then
@@ -555,5 +623,5 @@
 
 # the minimum version of libdbus-1 that we require:
-MIN_DBUS_1_VERSION=0.62
+MIN_DBUS_1_VERSION=0.93
 
 # initalize internal variables
@@ -561,4 +629,5 @@
 CFG_PROFILE=no
 CFG_EXCEPTIONS=unspecified
+CFG_SCRIPT=auto # (yes|no|auto)
 CFG_SCRIPTTOOLS=auto # (yes|no|auto)
 CFG_XMLPATTERNS=auto # (yes|no|auto)
@@ -571,4 +640,5 @@
 CFG_SM=auto
 CFG_XSHAPE=auto
+CFG_XSYNC=auto
 CFG_XINERAMA=runtime
 CFG_XFIXES=runtime
@@ -589,4 +659,10 @@
 CFG_MITSHM=auto
 CFG_OPENGL=auto
+CFG_OPENVG=no
+CFG_OPENVG_LC_INCLUDES=no
+CFG_OPENVG_SHIVA=no
+CFG_OPENVG_ON_OPENGL=no
+CFG_EGL=no
+CFG_EGL_GLES_INCLUDES=no
 CFG_SSE=auto
 CFG_FONTCONFIG=auto
@@ -600,16 +676,26 @@
 CFG_PHONON=auto
 CFG_PHONON_BACKEND=yes
+CFG_MULTIMEDIA=yes
+CFG_AUDIO_BACKEND=yes
 CFG_SVG=yes
+CFG_DECLARATIVE=auto
 CFG_WEBKIT=auto # (yes|no|auto)
-
-CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen"
+CFG_JAVASCRIPTCORE_JIT=auto
+
+CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen directfb"
 CFG_GFX_ON="linuxfb multiscreen"
 CFG_GFX_PLUGIN_AVAILABLE=
 CFG_GFX_PLUGIN=
 CFG_GFX_OFF=
-CFG_KBD_AVAILABLE="tty usb sl5000 yopy vr41xx qvfb"
+CFG_KBD_AVAILABLE="tty linuxinput qvfb"
 CFG_KBD_ON="tty"    #default, see QMakeVar above
-CFG_MOUSE_AVAILABLE="pc bus linuxtp yopy vr41xx tslib qvfb"
+CFG_MOUSE_AVAILABLE="pc linuxtp linuxinput tslib qvfb"
 CFG_MOUSE_ON="pc linuxtp"   #default, see QMakeVar above
+
+if [ -f "$relpath/src/gui/embedded/qscreenqnx_qws.cpp" ]; then
+    CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} qnx"
+    CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} qnx"
+    CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} qnx"
+fi
 
 CFG_ARCH=
@@ -642,4 +728,5 @@
 CFG_PRECOMPILE=auto
 CFG_SEPARATE_DEBUG_INFO=auto
+CFG_SEPARATE_DEBUG_INFO_NOCOPY=no
 CFG_REDUCE_EXPORTS=auto
 CFG_MMX=auto
@@ -659,4 +746,5 @@
 CFG_ARMFPA=auto
 CFG_IWMMXT=no
+CFG_NEON=auto
 CFG_CLOCK_GETTIME=auto
 CFG_CLOCK_MONOTONIC=auto
@@ -669,4 +757,5 @@
 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_XARCH=auto
@@ -693,4 +782,5 @@
 CFG_SILENT=no
 CFG_GRAPHICS_SYSTEM=default
+CFG_ALSA=auto
 
 # initalize variables used for installation
@@ -716,4 +806,5 @@
 QT_CFLAGS_SQLITE=
 QT_LFLAGS_SQLITE=
+QT_LFLAGS_ODBC="-lodbc"
 
 # flags for libdbus-1
@@ -742,5 +833,5 @@
   for a in "$relpath/src/plugins/sqldrivers/"*; do
      if [ -d "$a" ]; then
-	 base_a=`basename $a`
+	 base_a=`basename "$a"`
   	 CFG_SQL_AVAILABLE="${CFG_SQL_AVAILABLE} ${base_a}"
 	 eval "CFG_SQL_${base_a}=auto"
@@ -753,5 +844,5 @@
   for a in "$relpath/src/plugins/decorations/"*; do
      if [ -d "$a" ]; then
-	 base_a=`basename $a`
+	 base_a=`basename "$a"`
   	 CFG_DECORATION_PLUGIN_AVAILABLE="${CFG_DECORATION_PLUGIN_AVAILABLE} ${base_a}"
      fi
@@ -763,5 +854,5 @@
   for a in "$relpath/src/plugins/kbddrivers/"*; do
      if [ -d "$a" ]; then
-	 base_a=`basename $a`
+	 base_a=`basename "$a"`
   	 CFG_KBD_PLUGIN_AVAILABLE="${CFG_KBD_PLUGIN_AVAILABLE} ${base_a}"
      fi
@@ -773,5 +864,5 @@
   for a in "$relpath/src/plugins/mousedrivers/"*; do
      if [ -d "$a" ]; then
-	 base_a=`basename $a`
+	 base_a=`basename "$a"`
   	 CFG_MOUSE_PLUGIN_AVAILABLE="${CFG_MOUSE_PLUGIN_AVAILABLE} ${base_a}"
      fi
@@ -783,5 +874,5 @@
   for a in "$relpath/src/plugins/gfxdrivers/"*; do
      if [ -d "$a" ]; then
-	 base_a=`basename $a`
+	 base_a=`basename "$a"`
   	 CFG_GFX_PLUGIN_AVAILABLE="${CFG_GFX_PLUGIN_AVAILABLE} ${base_a}"
      fi
@@ -831,5 +922,5 @@
         ;;
     #Qt style yes options
-        -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-svg|-webkit|-scripttools|-rpath|-force-pkg-config)
+        -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config)
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
         VAL=yes
@@ -837,12 +928,13 @@
     #Qt style options that pass an argument
     -qconfig)
-        if [ "$PLATFORM_QWS" = "yes" ]; then
-            CFG_QCONFIG="$VAL"
-            VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
-            shift
-            VAL=$1
-        else
-            UNKNOWN_ARG=yes
-        fi
+        if [ "$PLATFORM_QWS" != "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|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-demosdir|-depths|-make|-nomake|-platform|-xplatform|-buildkey|-sdk|-arch|-host-arch|-mysql_config)
@@ -878,4 +970,14 @@
     -opengl)
         VAR=opengl
+        # this option may or may not be followed by an argument
+        if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
+            VAL=yes
+        else
+            shift;
+            VAL=$1
+        fi
+	;;
+    -openvg)
+        VAR=openvg
         # this option may or may not be followed by an argument
         if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
@@ -1130,4 +1232,11 @@
         fi
         ;;
+    openvg)
+        if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+            CFG_OPENVG="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
     graphicssystem)
         if [ "$PLATFORM_QWS" = "yes" ]; then
@@ -1140,4 +1249,6 @@
             if  [ "$VAL" = "opengl" ]; then
                 CFG_GRAPHICS_SYSTEM="opengl"
+            elif [ "$VAL" = "openvg" ]; then
+                CFG_GRAPHICS_SYSTEM="openvg"
             elif [ "$VAL" = "raster" ]; then
                 CFG_GRAPHICS_SYSTEM="raster"
@@ -1147,5 +1258,5 @@
         fi
 	;;
-	    
+
     qvfb) # left for commandline compatibility, not documented
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
@@ -1419,4 +1530,11 @@
         fi
         ;;
+    xsync)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+            CFG_XSYNC="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
     xinput)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "runtime" ]; then
@@ -1443,4 +1561,7 @@
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
             CFG_SEPARATE_DEBUG_INFO="$VAL"
+        elif [ "$VAL" = "nocopy" ] ; then
+            CFG_SEPARATE_DEBUG_INFO="yes"
+            CFG_SEPARATE_DEBUG_INFO_NOCOPY="yes"
         else
             UNKNOWN_OPT=yes
@@ -1485,4 +1606,11 @@
 	CFG_IWMMXT="yes"
 	;;
+    neon)
+        if [ "$VAL" = "no" ]; then
+            CFG_NEON="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
     reduce-relocations)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
@@ -1703,4 +1831,15 @@
         fi
         ;;
+    script)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
+            CFG_SCRIPT="yes"
+        else
+            if [ "$VAL" = "no" ]; then
+                CFG_SCRIPT="no"
+            else
+                UNKNOWN_OPT=yes
+            fi
+        fi
+        ;;
     scripttools)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
@@ -1724,4 +1863,15 @@
             fi
         fi
+        ;;
+    declarative)
+        if [ "$VAL" = "yes" ]; then
+            CFG_DECLARATIVE="yes"
+        else
+            if [ "$VAL" = "no" ]; then
+                CFG_DECLARATIVE="no"
+            else
+                UNKNOWN_OPT=yes
+            fi
+        fi
 	;;
     webkit)
@@ -1734,4 +1884,11 @@
                 UNKNOWN_OPT=yes
             fi
+        fi
+        ;;
+    javascript-jit)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then 
+            CFG_JAVASCRIPTCORE_JIT="$VAL"
+        else
+            UNKNOWN_OPT=yes
         fi
         ;;
@@ -1932,4 +2089,18 @@
         fi
         ;;
+    multimedia)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+            CFG_MULTIMEDIA="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
+    audio-backend)
+        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+            CFG_AUDIO_BACKEND="$VAL"
+        else
+            UNKNOWN_OPT=yes
+        fi
+        ;;
     *)
         UNKNOWN_OPT=yes
@@ -1986,4 +2157,10 @@
 done
 
+# find perl
+PERL="/usr/bin/perl"
+if "$WHICH" perl >/dev/null 2>&1 && ( perl /dev/null ) >/dev/null 2>&1; then
+    PERL=`$WHICH perl`
+fi
+
 ### skip this if the user just needs help...
 if [ "$OPT_HELP" != "yes" ]; then
@@ -2001,5 +2178,5 @@
 fi
 if [ "$OPT_SHADOW" = "yes" ]; then
-    if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" ]; then
+    if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then
         echo >&2 "You cannot make a shadow build from a source tree containing a previous build."
         echo >&2 "Cannot proceed."
@@ -2101,13 +2278,4 @@
 fi
 
-# symlink files from src/gui/embedded neccessary to build qvfb
-if [ "$CFG_DEV" = "yes" ]; then
-    for f in qvfbhdr.h qlock_p.h qlock.cpp qwssignalhandler_p.h qwssignalhandler.cpp; do
-	dest="${relpath}/tools/qvfb/${f}"
-	rm -f "$dest"
-	ln -s "${relpath}/src/gui/embedded/${f}" "${dest}"
-    done
-fi
-
 # symlink fonts to be able to run application from build directory
 if [ "$PLATFORM_QWS" = "yes" ] && [ ! -e "${outpath}/lib/fonts" ]; then
@@ -2131,5 +2299,5 @@
     for mk in gmake make; do
         if "$WHICH" $mk >/dev/null 2>&1; then
-            MAKE=`$WHICH $mk`
+            MAKE=`"$WHICH" $mk`
             break
         fi
@@ -2140,4 +2308,6 @@
         exit 1
     fi
+    # export MAKE, we need it later in the config.tests
+    export MAKE
 fi
 
@@ -2180,7 +2350,4 @@
             *86_64)
                 PLATFORM=qws/linux-x86_64-g++
-                ;;
-            *ppc)
-                PLATFORM=qws/linux-ppc-g++
                 ;;
             *)
@@ -2201,7 +2368,4 @@
                         CFG_EMBEDDED=x86_64
                         ;;
-                    *ppc)
-                        CFG_EMBEDDED=ppc
-                        ;;
                     *)
                         CFG_EMBEDDED=generic
@@ -2211,4 +2375,11 @@
             fi
             XPLATFORM="qws/linux-$CFG_EMBEDDED-g++"
+        fi
+        ;;
+    QNX:*)
+        [ -z "$PLATFORM" ] && PLATFORM=unsupported/qws/qnx-generic-g++
+        if [ -z "$XPLATFORM" ]; then
+            [ "$CFG_EMBEDDED" = "auto" ] && CFG_EMBEDDED=generic
+            XPLATFORM="unsupported/qws/qnx-$CFG_EMBEDDED-g++"
         fi
         ;;
@@ -2364,4 +2535,7 @@
         PLATFORM=unixware-g++
         ;;
+     QNX:*)
+        PLATFORM=unsupported/qnx-g++
+        ;;
      *)
         if [ "$OPT_HELP" != "yes" ]; then
@@ -2478,4 +2652,18 @@
         exit 1
     fi
+fi
+
+if [ "$CFG_RTOS_ENABLED" = "no" ]; then
+    case `basename "$XPLATFORM"` in
+	qnx-* | vxworks-*)
+            echo ""
+            echo "You are not licensed for Qt for `basename $XPLATFORM`."
+            echo ""
+            echo "Please contact qt-info@nokia.com to upgrade your license to"
+            echo "include this platform, or install the Qt Open Source Edition"
+            echo "if you intend to develop free software."
+            exit 1
+	    ;;
+    esac
 fi
 
@@ -2589,4 +2777,14 @@
         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
@@ -2669,5 +2867,5 @@
 fi
 if [ -z "$PKG_CONFIG" ]; then
-    PKG_CONFIG=`$WHICH pkg-config 2>/dev/null`
+    PKG_CONFIG=`"$WHICH" pkg-config 2>/dev/null`
 fi
 
@@ -2695,18 +2893,41 @@
         fi
     else
+        echo >&2 ""
+        echo >&2 "You have not explicitly asked to use pkg-config and are cross-compiling."
+        echo >&2 "pkg-config will not be used to automatically query cflag/lib parameters for"
+        echo >&2 "dependencies"
+        echo >&2 ""
         PKG_CONFIG=""
     fi
 fi
 
-# check -arch arguments for validity.
+# process CFG_MAC_ARCHS
 if [ "$PLATFORM_MAC" = "yes" ]; then
-    ALLOWED="x86 ppc x86_64 ppc64"
-    for i in $CFG_MAC_ARCHS 
+#   check -arch arguments for validity.
+    ALLOWED="x86 ppc x86_64 ppc64 i386"
+    # Save the list so we can re-write it using only valid values
+    CFG_MAC_ARCHS_IN="$CFG_MAC_ARCHS"
+    CFG_MAC_ARCHS=
+    for i in $CFG_MAC_ARCHS_IN
     do 
         if echo "$ALLOWED" | grep -w -v "$i" > /dev/null 2>&1; then
-            echo "Unknown architecture: \"$i\". Supported architectures: x86 ppc x86_64 ppc64";
+            echo "Unknown architecture: \"$i\". Supported architectures: x86[i386] ppc x86_64 ppc64";
             exit 2;
         fi
+        if [ "$i" = "i386" -o "$i" = "x86" ]; then
+            # These are synonymous values
+            # CFG_MAC_ARCHS requires x86 while GCC requires i386
+            CFG_MAC_ARCHS="$CFG_MAC_ARCHS x86"
+            MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch i386"
+        else
+            CFG_MAC_ARCHS="$CFG_MAC_ARCHS $i"
+            MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -arch $i"
+        fi
     done
+fi
+
+# pass on $CFG_SDK to the configure tests.
+if [ '!' -z "$CFG_SDK" ]; then
+    MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -sdk $CFG_SDK"
 fi
 
@@ -2728,4 +2949,8 @@
 TEST_COMPILER="$CC"
 [ -z "$TEST_COMPILER" ] && TEST_COMPILER=$QMAKE_CONF_COMPILER
+if [ -z "$TEST_COMPILER" ]; then
+    echo "ERROR: Cannot set the compiler for the configuration tests"
+    exit 1
+fi
 
 # auto-detect precompiled header support
@@ -2746,5 +2971,5 @@
 
 #auto-detect DWARF2 on the mac
-if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" == "auto" ]; then
+if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
     if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
         CFG_MAC_DWARF2=no
@@ -2755,5 +2980,5 @@
 
 # auto-detect support for -Xarch on the mac
-if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" == "auto" ]; then
+if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" = "auto" ]; then
     if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
         CFG_MAC_XARCH=no
@@ -2840,4 +3065,16 @@
 fi
 
+# Print a warning if configure was called with the 10.4u SDK option on Snow Leopard
+# with the default mkspec. The 10.4u SDK does not support gcc 4.2.
+if [ "$PLATFORM_MAC" = "yes" ] && [ '!' -z "$CFG_SDK" ]; then
+    # get the darwin version. 10.0.0 and up means snow leopard.
+    VERSION=`uname -r | tr '.' ' ' | awk '{print $1}'`
+    if [ "$VERSION" -gt 9 ] && [ "$CFG_SDK" == "/Developer/SDKs/MacOSX10.4u.sdk/" ] && [ "$PLATFORM" == "macx-g++" ]; then
+        echo
+        echo "WARNING: The 10.4u SDK does not support gcc 4.2. Configure with -platform macx-g++40. "
+        echo
+    fi
+fi
+
 # x11 tests are done after qmake is built
 
@@ -2869,5 +3106,5 @@
 if [ -z "$QT_INSTALL_PREFIX" ]; then
     if [ "$CFG_DEV" = "yes" ]; then
-	QT_INSTALL_PREFIX="$outpath" # At Trolltech, we use sandboxed builds by default
+	QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default
     elif [ "$PLATFORM_QWS" = "yes" ]; then
         QT_INSTALL_PREFIX="/usr/local/Trolltech/QtEmbedded-${QT_VERSION}"
@@ -3054,5 +3291,5 @@
         [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
         [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
-        [-no-make <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
+        [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
         [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv]
         [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked]
@@ -3060,8 +3297,8 @@
         [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa]
         [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns]
-        [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
-        [-no-openssl] [-openssl] [-openssl-linked]
-        [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit]
-        [-no-scripttools] [-scripttools]
+        [-no-multimedia] [-multimedia] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
+        [-no-audio-backend] [-audio-backend] [-no-openssl] [-openssl] [-openssl-linked]
+        [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-javascript-jit] [-javascript-jit]
+        [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative]
 
         [additional platform specific options (see below)]
@@ -3196,4 +3433,10 @@
                          is used and exceptions are enabled.
 
+    -no-multimedia ..... Do not build the QtMultimedia module.
+ +  -multimedia ........ Build the QtMultimedia module.
+
+    -no-audio-backend .. Do not build the platform audio backend into QtMultimedia.
+ +  -audio-backend ..... Build the platform audio backend into QtMultimedia if available.
+
     -no-phonon ......... Do not build the Phonon module.
  +  -phonon ............ Build the Phonon module.
@@ -3209,6 +3452,15 @@
                          WebKit is built if a decent C++ compiler is used.
 
+    -no-javascript-jit . Do not build the JavaScriptCore JIT compiler.
+ +  -javascript-jit .... Build the JavaScriptCore JIT compiler.
+
+    -no-script ......... Do not build the QtScript module.
+ +  -script ............ Build the QtScript module.
+
     -no-scripttools .... Do not build the QtScriptTools module.
  +  -scripttools ....... Build the QtScriptTools module.
+
+ +  -no-declarative .....Do not build the declarative module.
+    -declarative ....... Build the declarative module.
 
     -platform target ... The operating system and compiler you are building
@@ -3453,10 +3705,15 @@
  +  -opengl <api> ...... Enable OpenGL support.
                          With no parameter, this will auto-detect the "best"
-                         OpenGL API to use. If desktop OpenGL is avaliable, it
+                         OpenGL API to use. If desktop OpenGL is available, it
                          will be used. Use desktop, es1, es1cl or es2 for <api>
                          to force the use of the Desktop (OpenGL 1.x or 2.x),
                          OpenGL ES 1.x Common profile, 1.x Common Lite profile
                          or 2.x APIs instead. On X11, the EGL API will be used
-                         to manage GL contexts in the case of OpenGL ES.
+                         to manage GL contexts in the case of OpenGL ES
+
+     -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.
@@ -3466,4 +3723,8 @@
  $SHY  -xshape ............ Compile XShape support.
                          Requires X11/extensions/shape.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.
@@ -3564,5 +3825,5 @@
                           Example values for <arch>: arm mips x86 generic
 
-    -armfpa ............. Target platform is uses the ARM-FPA floating point format.
+    -armfpa ............. Target platform uses the ARM-FPA floating point format.
     -no-armfpa .......... Target platform does not use the ARM-FPA floating point format.
 
@@ -3637,4 +3898,5 @@
                          (available on some XScale CPUs).
 
+    -no-neon ........... Do not compile with use of NEON instructions.
 EOF
 fi
@@ -3668,8 +3930,8 @@
     Platform="Qt for Embedded Linux"
 elif [ "$PLATFORM_MAC" = "yes" ]; then
-    Platform="Qt/Mac"
+    Platform="Qt for Mac OS X"
 else
     PLATFORM_X11=yes
-    Platform="Qt/X11"
+    Platform="Qt for Linux/X11"
 fi
 
@@ -3685,14 +3947,20 @@
     while true; do
         echo "You are licensed to use this software under the terms of"
-        echo "the GNU General Public License (GPL) versions 3."
-        echo "You are also licensed to use this software under the terms of"
         echo "the Lesser GNU General Public License (LGPL) versions 2.1."
+        if [ -f "$relpath/LICENSE.GPL3" ]; then
+            echo "You are also licensed to use this software under the terms of"
+            echo "the GNU General Public License (GPL) versions 3."
+            affix="either"
+        else
+            affix="the"
+        fi
         echo
-        affix="either"
         if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
-	    echo "You have already accepted the terms of the $LicenseType license."
+            echo "You have already accepted the terms of the $LicenseType license."
             acceptance=yes
         else
-	    echo "Type '3' to view the GNU General Public License version 3."
+            if [ -f "$relpath/LICENSE.GPL3" ]; then
+                echo "Type '3' to view the GNU General Public License version 3."
+            fi
             echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
             echo "Type 'yes' to accept this license offer."
@@ -3707,5 +3975,5 @@
         fi
         echo
-        if [ "$acceptance" = "yes" ]; then
+        if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then
             break
         elif [ "$acceptance" = "no" ]; then
@@ -3767,5 +4035,5 @@
                     echo
                     echo "  You are no longer licensed to use this version of Qt."
-                    echo "  Please contact sales@trolltech.com to renew your support"
+                    echo "  Please contact qt-info@nokia.com to renew your support"
                     echo "  and upgrades for this license."
                     echo
@@ -3785,5 +4053,5 @@
                     echo "  Qt releases."
                     echo
-                    echo "  Please contact sales@trolltech.com to renew your"
+                    echo "  Please contact qt-info@nokia.com to renew your"
                     echo "  support and upgrades for this license."
                     echo
@@ -3800,5 +4068,5 @@
                 echo
                 echo "  You are no longer licensed to use this software. Please"
-                echo "  contact sales@trolltech.com to purchase license, or install"
+                echo "  contact qt-info@nokia.com to purchase license, or install"
                 echo "  the Qt Open Source Edition if you intend to develop free"
                 echo "  software."
@@ -3875,9 +4143,14 @@
 DEMOS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_demopath=$QT_INSTALL_DEMOS"`
 
+TODAY=`date +%Y-%m-%d`
 cat > "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
 /* License Info */
 static const char qt_configure_licensee_str          [256 + 12] = "$LICENSE_USER_STR";
 static const char qt_configure_licensed_products_str [256 + 12] = "$LICENSE_PRODUCTS_STR";
+
+/* Installation date */
+static const char qt_configure_installation          [12+11]    = "qt_instdate=$TODAY";
 EOF
+
 
 if [ ! -z "$QT_HOST_PREFIX" ]; then
@@ -3962,4 +4235,21 @@
 
 # -----------------------------------------------------------------------------
+if [ "$LicenseType" = "Evaluation" ]; then
+    EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey=$LicenseKeyExt"`
+elif echo "$D_FLAGS" | grep QT_EVAL >/dev/null 2>&1; then
+    EVALKEY=`"$relpath/config.tests/unix/padstring" 524 "qt_qevalkey="`
+fi
+
+if [ -n "$EVALKEY" ]; then
+    rm -f "$outpath/src/corelib/global/qconfig_eval.cpp"
+    cat > "$outpath/src/corelib/global/qconfig_eval.cpp" <<EOF
+/* Evaluation license key */
+static const char qt_eval_key_data                   [512 + 12] = "$EVALKEY";
+EOF
+    chmod -w "$outpath/src/corelib/global/qconfig_eval.cpp"
+fi
+
+
+# -----------------------------------------------------------------------------
 # build qmake
 # -----------------------------------------------------------------------------
@@ -3971,5 +4261,5 @@
     if [ "$OPT_SHADOW" = "yes" ]; then
         "$outpath/bin/syncqt" $SYNCQT_OPTS
-    elif [ "$CFG_DEV" = "yes" ]; then
+    elif [ "$CFG_DEV" = "yes" ] || [ ! -d $relpath/include ]; then
         QTDIR="$relpath" perl "$outpath/bin/syncqt" $SYNCQT_OPTS
     fi
@@ -4056,7 +4346,7 @@
         [ -f "$in_mkfile" ] || continue
 
-        echo "########################################################################" >$mkfile
-        echo "## This file was autogenerated by configure, all changes will be lost ##" >>$mkfile
-        echo "########################################################################" >>$mkfile
+        echo "########################################################################" > "$mkfile"
+        echo "## This file was autogenerated by configure, all changes will be lost ##" >> "$mkfile"
+        echo "########################################################################" >> "$mkfile"
         EXTRA_OBJS=
         EXTRA_SRCS=
@@ -4069,6 +4359,6 @@
         fi
 
-	[ -n "$CC" ] && echo "CC = $CC" >>$mkfile
-	[ -n "$CXX" ] && echo "CXX = $CXX" >>$mkfile
+	[ -n "$CC" ] && echo "CC = $CC" >> "$mkfile"
+	[ -n "$CXX" ] && echo "CXX = $CXX" >> "$mkfile"
         if [ "$CFG_SILENT" = "yes" ]; then
             [ -z "$CC" ] && setBootstrapVariable QMAKE_CC 's,QMAKE_CC.*=,CC=\@,'
@@ -4105,9 +4395,5 @@
         fi
         if [ "$PLATFORM_MAC" = "yes" ]; then
-            if [ "$PLATFORM" = "macx-icc" ]; then
-                echo "export MACOSX_DEPLOYMENT_TARGET = 10.4" >>"$mkfile"
-	    else
-                echo "export MACOSX_DEPLOYMENT_TARGET = 10.3" >>"$mkfile"
-	    fi
+            echo "export MACOSX_DEPLOYMENT_TARGET = 10.4" >> "$mkfile"
             echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
             echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
@@ -4117,5 +4403,5 @@
             EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
             EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
-	    if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then
+	    if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then # matches both x86 and x86_64
 		X86_CFLAGS="-arch i386"
 		X86_LFLAGS="-arch i386"
@@ -4124,5 +4410,5 @@
                 EXTRA_LFLAGS="$EXTRA_LFLAGS $X86_LFLAGS"
             fi
-	    if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then
+	    if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then # matches both ppc and ppc64
 		PPC_CFLAGS="-arch ppc"
 		PPC_LFLAGS="-arch ppc"
@@ -4152,4 +4438,5 @@
 	adjrelpath=`echo "$relpath" | sed 's/ /\\\\\\\\ /g'`
 	adjoutpath=`echo "$outpath" | sed 's/ /\\\\\\\\ /g'`
+	adjqmakespec=`echo "$QMAKESPEC" | sed 's/ /\\\\\\\\ /g'`
         sed -e "s,@SOURCE_PATH@,$adjrelpath,g" -e "s,@BUILD_PATH@,$adjoutpath,g" \
             -e "s,@QMAKE_CFLAGS@,$EXTRA_CFLAGS,g" -e "s,@QMAKE_LFLAGS@,$EXTRA_LFLAGS,g" \
@@ -4158,10 +4445,11 @@
             -e "s,@QT_INSTALL_DATA@,\$(INSTALL_ROOT)$QMAKE_DATA_DIR,g" \
             -e "s,@QMAKE_QTOBJS@,$EXTRA_OBJS,g" -e "s,@QMAKE_QTSRCS@,$EXTRA_SRCS,g" \
-	    -e "s,@QMAKESPEC@,$QMAKESPEC,g" "$in_mkfile" >>"$mkfile"
+	    -e "s,@QMAKESPEC@,$adjqmakespec,g" "$in_mkfile" >>"$mkfile"
 
         if "$WHICH" makedepend >/dev/null 2>&1 && grep 'depend:' "$mkfile" >/dev/null 2>&1; then
             (cd "$outpath/qmake" && "$MAKE" -f "$mkfile" depend) >/dev/null 2>&1
-	    sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"${mkfile}.tmp"
-	    mv "${mkfile}.tmp" "${mkfile}"
+	    sed "s,^.*/\([^/]*.o\):,\1:,g" "$mkfile" >"$mkfile.tmp"
+	    sed "s,$outpath,$adjoutpath,g" "$mkfile.tmp" >"$mkfile"
+	    rm "$mkfile.tmp"
         fi
     done
@@ -4223,8 +4511,18 @@
 # check iWMMXt support
 if [ "$CFG_IWMMXT" = "yes" ]; then
-    if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"; then
+    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
+    if [ $? != "0" ]; then
         echo "The iWMMXt functionality test failed!"
 	echo " Please make sure your compiler supports iWMMXt intrinsics!"
 	exit 1
+    fi
+fi
+
+# detect neon support
+if ([ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]) && [ "${CFG_NEON}" = "auto" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/neon "neon" $L_FLAGS $I_FLAGS $l_FLAGS "-mfpu=neon"; then
+	CFG_NEON=yes
+    else
+	CFG_NEON=no
     fi
 fi
@@ -4245,5 +4543,5 @@
 fi
 if [ "$CFG_ZLIB" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
        CFG_ZLIB=system
     else
@@ -4262,5 +4560,5 @@
 # detect jpeg
 if [ "$CFG_LIBJPEG" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
        CFG_LIBJPEG=system
     else
@@ -4289,5 +4587,5 @@
 # detect tiff
 if [ "$CFG_LIBTIFF" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_LIBTIFF=system
     else
@@ -4306,5 +4604,5 @@
 # detect mng
 if [ "$CFG_LIBMNG" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
        CFG_LIBMNG=system
     else
@@ -4315,5 +4613,5 @@
 # detect png
 if [ "$CFG_LIBPNG" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
        CFG_LIBPNG=system
     else
@@ -4332,5 +4630,5 @@
         mysql)
             if [ "$CFG_SQL_mysql" != "no" ]; then
-		[ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`$WHICH mysql_config`
+		[ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config`
                 if [ -x "$CFG_MYSQL_CONFIG" ]; then
                     QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null`
@@ -4354,5 +4652,5 @@
                     fi
                 else
-                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS; then
+                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                         QMakeVar add CONFIG use_libmysqlclient_r
                         if [ "$CFG_SQL_mysql" = "auto" ]; then
@@ -4360,5 +4658,5 @@
                         fi
                         QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R"
-                    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS; then
+                    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                         if [ "$CFG_SQL_mysql" = "auto" ]; then
                             CFG_SQL_mysql=plugin
@@ -4389,5 +4687,5 @@
                 [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
                 [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
-                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $L_FLAGS $QT_CFLAGS_PSQL $I_FLAGS $l_FLAGS; then
+                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $L_FLAGS $QT_CFLAGS_PSQL $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                     if [ "$CFG_SQL_psql" = "auto" ]; then
                         CFG_SQL_psql=plugin
@@ -4410,17 +4708,24 @@
         odbc)
             if [ "$CFG_SQL_odbc" != "no" ]; then
-                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS; then
+                if [ "$PLATFORM_MAC" != "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                     if [ "$CFG_SQL_odbc" = "auto" ]; then
                         CFG_SQL_odbc=plugin
                     fi
                 else
-                    if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
-                        echo "ODBC 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
+                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iodbc "iODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+                        QT_LFLAGS_ODBC="-liodbc"
+                        if [ "$CFG_SQL_odbc" = "auto" ]; then
+                            CFG_SQL_odbc=plugin
+                        fi
                     else
-                        CFG_SQL_odbc=no
+                        if [ "$CFG_SQL_odbc" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+                            echo "ODBC 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_SQL_odbc=no
+                        fi
                     fi
                 fi
@@ -4429,5 +4734,5 @@
         oci)
             if [ "$CFG_SQL_oci" != "no" ]; then
-                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS; then
+                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                     if [ "$CFG_SQL_oci" = "auto" ]; then
                         CFG_SQL_oci=plugin
@@ -4448,5 +4753,5 @@
         tds)
             if [ "$CFG_SQL_tds" != "no" ]; then
-                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS; then
+                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                     if [ "$CFG_SQL_tds" = "auto" ]; then
                         CFG_SQL_tds=plugin
@@ -4467,5 +4772,5 @@
         db2)
             if [ "$CFG_SQL_db2" != "no" ]; then
-                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS; then
+                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                     if [ "$CFG_SQL_db2" = "auto" ]; then
                         CFG_SQL_db2=plugin
@@ -4486,5 +4791,5 @@
         ibase)
             if [ "$CFG_SQL_ibase" != "no" ]; then
-                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS; then
+                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                     if [ "$CFG_SQL_ibase" = "auto" ]; then
                         CFG_SQL_ibase=plugin
@@ -4505,5 +4810,5 @@
         sqlite2)
             if [ "$CFG_SQL_sqlite2" != "no" ]; then
-                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS; then
+                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                     if [ "$CFG_SQL_sqlite2" = "auto" ]; then
                         CFG_SQL_sqlite2=plugin
@@ -4530,5 +4835,5 @@
                         QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
                     fi
-                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS; then
+                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                         if [ "$CFG_SQL_sqlite" = "auto" ]; then
                             CFG_SQL_sqlite=plugin
@@ -4567,5 +4872,5 @@
 # auto-detect NIS support
 if [ "$CFG_NIS" != "no" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_NIS=yes
     else
@@ -4584,5 +4889,5 @@
 # auto-detect CUPS support
 if [ "$CFG_CUPS" != "no" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_CUPS=yes
     else
@@ -4603,7 +4908,7 @@
     if [ "$PLATFORM_QWS" = "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; then
+    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
-    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_ICONV=gnu
     else
@@ -4626,5 +4931,5 @@
         QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
     fi
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/dbus "D-Bus" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/dbus "D-Bus" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DBUS $QT_LIBS_DBUS $MAC_CONFIG_TEST_COMMANDLINE; then
         [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes
         QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
@@ -4653,4 +4958,25 @@
 
 if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; 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>
+        CFG_EGL=yes
+        CFG_EGL_GLES_INCLUDES=no
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl4gles1" "EGL (GLES/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then
+        # EGL specified by QMAKE_*_EGL, included with <GLES/egl.h>
+        CFG_EGL=yes
+        CFG_EGL_GLES_INCLUDES=yes
+    fi
+    if ( [ "$CFG_OPENGL" = "es1" ] || [ "$CFG_OPENGL" = "es1cl" ] || [ "$CFG_OPENGL" = "es2" ] ) && [ "$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
+
+
     # auto-detect Glib support
     if [ "$CFG_GLIB" != "no" ]; then
@@ -4659,5 +4985,5 @@
             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
+        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"
@@ -4735,5 +5061,6 @@
 
     # 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
+    "$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"
@@ -4766,5 +5093,6 @@
            # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
            if [ "$CFG_OPENGL" = "desktop" ]; then
-               if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
+               "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
+               if [ $? != "0" ]; then
                    QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
                fi
@@ -4776,36 +5104,40 @@
     elif [ "$CFG_OPENGL" = "es1cl" ]; then
         # OpenGL ES 1.x common lite
-	if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1cl "OpenGL ES 1.x Lite" $L_FLAGS $I_FLAGS $l_FLAGS; then
+	"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1cl "OpenGL ES 1.x Lite" $L_FLAGS $I_FLAGS $l_FLAGS
+        if [ $? != "0" ]; then
 	    echo "The OpenGL ES 1.x Common Lite Profile 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}."
+            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
+            echo " ${XQMAKESPEC}."
             exit 1
         fi
     elif [ "$CFG_OPENGL" = "es1" ]; then
         # OpenGL ES 1.x
-	if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
+	"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS
+        if [ $? != "0" ]; then
 	    echo "The OpenGL ES 1.x 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}."
+            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
+            echo " ${XQMAKESPEC}."
             exit 1
         fi
     elif [ "$CFG_OPENGL" = "es2" ]; then
         #OpenGL ES 2.x
-	if ! "$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
+	"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
+        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, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
-	    echo " ${XQMAKESPEC}."
+            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
+            echo " ${XQMAKESPEC}."
             exit 1
         fi
     elif [ "$CFG_OPENGL" = "desktop" ]; then
         # Desktop OpenGL support
-        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
+        "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_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}."
+            echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
+            echo " ${XQMAKESPEC}."
             exit 1
         fi
@@ -4813,5 +5145,6 @@
         hpux*)
             # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct.
-            if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
+            "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
+            if [ $? != "0" ]; then
                 QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT
             fi
@@ -4921,7 +5254,7 @@
     # auto-detect FontConfig support
     if [ "$CFG_FONTCONFIG" != "no" ]; then
-    if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig 2>/dev/null; then
-        QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig 2>/dev/null`
-        QT_LIBS_FONTCONFIG=`$PKG_CONFIG --libs fontconfig 2>/dev/null`
+    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=
@@ -4976,4 +5309,21 @@
 	    else
 		CFG_XSHAPE=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
@@ -5088,5 +5438,6 @@
     elif [ "$CFG_OPENGL" = "es1" ]; then
         # OpenGL ES 1.x
-	if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then
+	"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS
+        if [ $? != "0" ]; then
 	    echo "The OpenGL ES 1.x functionality test failed!"
             echo " You might need to modify the include and library search paths by editing"
@@ -5097,5 +5448,6 @@
     elif [ "$CFG_OPENGL" = "es2" ]; then
         #OpenGL ES 2.x
-	if ! "$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
+	"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS
+        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"
@@ -5113,5 +5465,6 @@
     for screen in ${CFG_GFX_ON} ${CFG_GFX_PLUGIN}; do
        if [ "${screen}" = "ahi" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
-           if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/ahi "Ahi" $L_FLAGS $I_FLAGS $l_FLAGS; then
+           "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/ahi "Ahi" $L_FLAGS $I_FLAGS $l_FLAGS
+           if [ $? != "0" ]; then
                echo "The Ahi screen driver functionality test failed!"
                echo " You might need to modify the include and library search paths by editing"
@@ -5123,5 +5476,6 @@
 
        if [ "${screen}" = "svgalib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
-           if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/svgalib "SVGAlib" $L_FLAGS $I_FLAGS $l_FLAGS; then
+           "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/svgalib "SVGAlib" $L_FLAGS $I_FLAGS $l_FLAGS
+           if [ $? != "0" ]; then
                echo "The SVGAlib screen driver functionality test failed!"
                echo " You might need to modify the include and library search paths by editing"
@@ -5148,6 +5502,10 @@
                QMakeVar set QT_LIBS_DIRECTFB "$QT_LIBS_DIRECTFB"
            fi
-
-           if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/directfb "DirectFB" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DIRECTFB $QT_LIBS_DIRECTFB; then
+           if [ "$CFG_QT3SUPPORT" = "yes" ]; then
+               QMakeVar set QT_DEFINES_DIRECTFB "QT3_SUPPORT"
+           fi
+
+           "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/directfb "DirectFB" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DIRECTFB $QT_LIBS_DIRECTFB
+           if [ $? != "0" ]; then
                echo "The DirectFB screen driver functionality test failed!"
                echo " You might need to modify the include and library search paths by editing"
@@ -5163,5 +5521,6 @@
     for mouse in ${CFG_MOUSE_ON} ${CFG_MOUSE_PLUGIN}; do
 	if [ "${mouse}" = "tslib" ] && [ "${CFG_CONFIGURE_EXIT_ON_ERROR}" = "yes" ]; then
-	    if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tslib "tslib" $L_FLAGS $I_FLAGS $l_FLAGS; then
+	    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tslib "tslib" $L_FLAGS $I_FLAGS $l_FLAGS
+            if [ $? != "0" ]; then
                echo "The tslib functionality test failed!"
                echo " You might need to modify the include and library search paths by editing"
@@ -5176,5 +5535,6 @@
 
     # sound
-    if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/sound "sound" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/sound "sound" $L_FLAGS $I_FLAGS $l_FLAGS
+    if [ $? != "0" ]; then
         QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SOUND"
     fi
@@ -5186,5 +5546,5 @@
 [ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no
 if [ "$CFG_LIBFREETYPE" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS ; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_LIBFREETYPE=system
     else
@@ -5303,5 +5663,5 @@
 # find if the platform supports IPv6
 if [ "$CFG_IPV6" != "no" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_IPV6=yes
     else
@@ -5434,5 +5794,5 @@
 # detect OpenSSL
 if [ "$CFG_OPENSSL" != "no" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         if [ "$CFG_OPENSSL" = "auto" ]; then
             CFG_OPENSSL=yes
@@ -5451,4 +5811,48 @@
 fi
 
+# detect OpenVG support
+if [ "$CFG_OPENVG" != "no" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
+        if [ "$CFG_OPENVG" = "auto" ]; then
+            CFG_OPENVG=yes
+        fi
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG openvg_on_opengl" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
+        if [ "$CFG_OPENVG" = "auto" ]; then
+            CFG_OPENVG=yes
+        fi
+        CFG_OPENVG_ON_OPENGL=yes
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG lower_case_includes" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG (lc includes)" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
+        if [ "$CFG_OPENVG" = "auto" ]; then
+            CFG_OPENVG=yes
+        fi
+        CFG_OPENVG_LC_INCLUDES=yes
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG openvg_on_opengl lower_case_includes" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG (lc includes)" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
+        if [ "$CFG_OPENVG" = "auto" ]; then
+            CFG_OPENVG=yes
+        fi
+        CFG_OPENVG_LC_INCLUDES=yes
+        CFG_OPENVG_ON_OPENGL=yes
+    else
+        if [ "$CFG_OPENVG" != "auto" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+            echo "$CFG_OPENVG was specified for OpenVG but 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_OPENVG=no
+        fi
+    fi
+    if [ "$CFG_OPENVG" = "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/shivavg" "ShivaVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then
+        CFG_OPENVG_SHIVA=yes
+    fi
+fi
+
+# if openvg is disabled and the user specified graphicssystem vg, disable it...
+if [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && [ "$CFG_OPENVG" = "no" ]; then
+    echo "OpenVG Graphics System is disabled due to missing OpenVG support..."
+    CFG_GRAPHICS_SYSTEM=default
+fi
+
 if [ "$CFG_PTMALLOC" != "no" ]; then
     # build ptmalloc, copy .a file to lib/
@@ -5458,4 +5862,40 @@
 
     QMakeVar add QMAKE_LFLAGS "$outpath/lib/libptmalloc3.a"
+fi
+
+if [ "$CFG_ALSA" = "auto" ]; then
+    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/alsa "alsa" $L_FLAGS $I_FLAGS $l_FLAGS; then
+        CFG_ALSA=yes
+    else
+        CFG_ALSA=no
+    fi
+fi
+
+if [ -f "$relpath/src/declarative/declarative.pro" ]; then
+    if [ "$CFG_DECLARATIVE" = "auto" ]; then
+        CFG_DECLARATIVE=yes
+    fi
+else
+    if [ "$CFG_DECLARATIVE" = "auto" ] || [ "$CFG_DECLARATIVE" = "no" ]; then
+        CFG_DECLARATIVE=no
+    else
+        echo "Error: Unable to locate the qt-declarative package. Refer to the documentation on how to build the package."
+        exit 1
+    fi
+fi
+
+if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ] || [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then 
+    if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
+       "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/javascriptcore-jit "javascriptcore-jit" $L_FLAGS $I_FLAGS $l_FLAGS
+        if [ $? != "0" ]; then
+           CFG_JAVASCRIPTCORE_JIT=no
+        fi
+    fi
+fi
+
+if [ "$CFG_JAVASCRIPTCORE_JIT" = "yes" ]; then
+    QMakeVar set JAVASCRIPTCORE_JIT yes
+elif [ "$CFG_JAVASCRIPTCORE_JIT" = "no" ]; then
+    QMakeVar set JAVASCRIPTCORE_JIT no
 fi
 
@@ -5503,18 +5943,24 @@
 fi
 
-# Set the default arch. Select 32-bit/carbon if nothing else has 
-# been specified on the configure line.
-if [ "$PLATFORM_MAC" = "yes" ]  && [ "$CFG_MAC_ARCHS" == "" ]; then
+# Set the default arch.
+# Carbon builds: 32 bit x86/ppc.
+# For "-cocoa" builds on snow leopard : compiler default (64-bit).
+# For "-cocoa" builds on leopard : compiler default (32-bit).
+if [ "$PLATFORM_MAC" = "yes" ]  && [ "$CFG_MAC_ARCHS" = "" ]; then
     source "$mactests/defaultarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests"
 
-    if [ "$QT_MAC_DEFUALT_ARCH" == "x86_64" ]; then
-        CFG_MAC_ARCHS=" x86"
-    elif [ "$QT_MAC_DEFUALT_ARCH" == "ppc64" ]; then
-        CFG_MAC_ARCHS=" ppc"
-    else
-        CFG_MAC_ARCHS=" $QT_MAC_DEFUALT_ARCH"
-    fi
-
-    [ "$OPT_VERBOSE" == "yes" ] && echo "Setting Mac architechture to$CFG_MAC_ARCHS."
+	if [ "$CFG_MAC_COCOA" != "yes" ]; then
+		if [ "$QT_MAC_DEFAULT_ARCH" = "x86_64" ]; then
+			CFG_MAC_ARCHS=" x86"
+		elif [ "$QT_MAC_DEFAULT_ARCH" = "ppc64" ]; then
+			CFG_MAC_ARCHS=" ppc"
+		else
+			CFG_MAC_ARCHS=" $QT_MAC_DEFAULT_ARCH"
+		fi
+	else
+		CFG_MAC_ARCHS=" $QT_MAC_DEFAULT_ARCH"
+    fi
+
+    [ "$OPT_VERBOSE" = "yes" ] && echo "Setting Mac architechture to$CFG_MAC_ARCHS."
 fi
 
@@ -5540,5 +5986,5 @@
 fi;
 
-# set the global Mac deployment target. This is overridden on an arch-by-arch basis 
+# set the global Mac deployment target. This is overridden on an arch-by-arch basis
 # in some cases, see code further down
 case "$PLATFORM,$CFG_MAC_COCOA" in
@@ -5546,14 +5992,16 @@
 	# Cocoa
 	QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5
-	CFG_QT3SUPPORT="no"
-	;;
-    macx-icc,*)
-	# Intel CC, Carbon
-	QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.4
 	;;
     macx*,no)
 	# gcc, Carbon
-	QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.3
+	QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.4
 	;;
+esac
+
+# disable Qt 3 support on VxWorks
+case "$XPLATFORM" in
+    unsupported/vxworks*)
+	CFG_QT3SUPPORT="no"
+    ;;
 esac
 
@@ -5578,4 +6026,31 @@
 else
     QT_CONFIG="$QT_CONFIG accessibility"
+fi
+
+# enable egl
+if [ "$CFG_EGL" = "no" ]; then
+    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL"
+else
+    QT_CONFIG="$QT_CONFIG egl"
+    if [ "$CFG_EGL_GLES_INCLUDES" = "yes" ]; then
+        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GLES_EGL"
+    fi
+fi
+
+# enable openvg
+if [ "$CFG_OPENVG" = "no" ]; then
+    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENVG"
+else
+    QT_CONFIG="$QT_CONFIG openvg"
+    if [ "$CFG_OPENVG_LC_INCLUDES" = "yes" ]; then
+        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LOWER_CASE_VG_INCLUDES"
+    fi
+    if [ "$CFG_OPENVG_ON_OPENGL" = "yes" ]; then
+        QT_CONFIG="$QT_CONFIG openvg_on_opengl"
+    fi
+    if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then
+        QT_CONFIG="$QT_CONFIG shivavg"
+        QCONFIG_FLAGS="$QCONFIG_FLAGS QT_SHIVAVG"
+    fi
 fi
 
@@ -5660,4 +6135,7 @@
     QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info"
 fi
+if [ "$CFG_SEPARATE_DEBUG_INFO_NOCOPY" = "yes" ] ; then
+    QMAKE_CONFIG="$QMAKE_CONFIG separate_debug_info_nocopy"
+fi
 [ "$CFG_MMX" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG mmx"
 [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
@@ -5665,4 +6143,5 @@
 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
+[ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
 [ "$PLATFORM_MAC" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG $CFG_MAC_ARCHS"
 if [ "$CFG_IPV6" = "yes" ]; then
@@ -5690,5 +6169,7 @@
     QT_CONFIG="$QT_CONFIG inotify"
 fi
-if [ "$CFG_LIBJPEG" = "system" ]; then
+if [ "$CFG_LIBJPEG" = "no" ]; then
+    CFG_JPEG="no"
+elif [ "$CFG_LIBJPEG" = "system" ]; then
     QT_CONFIG="$QT_CONFIG system-jpeg"
 fi
@@ -5698,5 +6179,7 @@
     QT_CONFIG="$QT_CONFIG jpeg"
 fi
-if [ "$CFG_LIBMNG" = "system" ]; then
+if [ "$CFG_LIBMNG" = "no" ]; then
+    CFG_MNG="no"
+elif [ "$CFG_LIBMNG" = "system" ]; then
     QT_CONFIG="$QT_CONFIG system-mng"
 fi
@@ -5722,5 +6205,7 @@
     QT_CONFIG="$QT_CONFIG gif"
 fi
-if [ "$CFG_LIBTIFF" = "system" ]; then
+if [ "$CFG_LIBTIFF" = "no" ]; then
+    CFG_TIFF="no"
+elif [ "$CFG_LIBTIFF" = "system" ]; then
     QT_CONFIG="$QT_CONFIG system-tiff"
 fi
@@ -5769,4 +6254,7 @@
         QT_CONFIG="$QT_CONFIG xshape"
     fi
+    if [ "$CFG_XSYNC" = "yes" ]; then
+        QT_CONFIG="$QT_CONFIG xsync"
+    fi
     if [ "$CFG_XINERAMA" = "yes" ]; then
         QT_CONFIG="$QT_CONFIG xinerama"
@@ -5861,4 +6349,8 @@
 fi
 
+if [ "$CFG_ALSA" = "yes" ]; then
+    QT_CONFIG="$QT_CONFIG alsa"
+fi
+
 #
 # Some Qt modules are too advanced in C++ for some old compilers
@@ -5870,4 +6362,5 @@
 canBuildQtXmlPatterns="yes"
 canBuildWebKit="$HAVE_STL"
+canBuildQtConcurrent="yes"
 
 # WebKit requires stdint.h
@@ -5896,4 +6389,11 @@
 	esac
 	;;
+    unsupported/vxworks-*-g++*)
+	canBuildWebKit="no"
+	;;
+    unsupported/vxworks-*-dcc*)
+	canBuildWebKit="no"
+	canBuildQtXmlPatterns="no"
+	;;
     *-g++*)
 	# Check gcc's version
@@ -5901,7 +6401,7 @@
 	    4*|3.4*)
 		;;
-	    3.3*)
-		canBuildWebKit="no"
-		;;
+            3.3*)
+                canBuildWebKit="no"
+                ;;
 	    *)
 		canBuildWebKit="no"
@@ -5911,15 +6411,21 @@
 	;;
     solaris-cc*)
-	# Check the compiler version
-	case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
-	    *)
-		canBuildWebKit="no"
-		canBuildQtXmlPatterns="no"
-		;;
-	esac
-	;;
+        # Check the compiler version
+        case `${QMAKE_CONF_COMPILER} -V 2>&1 | awk '{print $4}'` in
+            5.[012345678])
+                canBuildWebKit="no"
+                canBuildQtXmlPatterns="no"
+                canBuildQtConcurrent="no"
+                ;;
+            5.9)
+                canBuildWebKit="no"
+                canBuildQtConcurrent="no"
+                ;;
+        esac
+        ;;
     hpux-acc*)
 	canBuildWebKit="no"
 	canBuildQtXmlPatterns="no"
+        canBuildQtConcurrent="no"
 	;;
     hpuxi-acc*)
@@ -5927,11 +6433,49 @@
 	;;
     aix-xlc*)
-	canBuildWebKit="no"
-	canBuildQtXmlPatterns="no"
-	;;
+        # Get the xlC version
+        cat > xlcver.c <<EOF
+#include <stdio.h>
+int main()
+{
+    printf("%d.%d\n", __xlC__ >> 8, __xlC__ & 0xFF);
+    return 0;
+}
+EOF
+        xlcver=
+        if ${QMAKE_CONF_COMPILER} -o xlcver xlcver.c >/dev/null 2>/dev/null; then
+            xlcver=`./xlcver 2>/dev/null`
+            rm -f ./xlcver
+        fi
+        if [ "$OPT_VERBOSE" = "yes" ]; then
+            if [ -n "$xlcver" ]; then
+                echo Found IBM xlC version: $xlcver.
+            else
+                echo Could not determine IBM xlC version, assuming oldest supported.
+            fi
+        fi
+
+        case "$xlcver" in
+            [123456].*)
+                canBuildWebKit="no"
+                canBuildQtXmlPatterns="no"
+                canBuildQtConcurrent="no"
+                ;;
+            *)
+                canBuildWebKit="no"
+                canBuildQtConcurrent="no"
+                ;;
+        esac
+        ;;
     irix-cc*)
         canBuildWebKit="no"
+        canBuildQtConcurrent="no"
 	;;
 esac
+
+CFG_CONCURRENT="yes"
+if [ "$canBuildQtConcurrent" = "no" ]; then
+    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"
+    CFG_CONCURRENT="no"
+fi
 
 if [ "$CFG_XMLPATTERNS" = "yes" -a "$CFG_EXCEPTIONS" = "no" ]; then
@@ -5950,8 +6494,24 @@
 fi
 
+if [ "$CFG_MULTIMEDIA" = "no" ]; then
+    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MULTIMEDIA"
+else
+    QT_CONFIG="$QT_CONFIG multimedia"
+fi
+
+if [ "$CFG_AUDIO_BACKEND" = "yes" ]; then
+    QT_CONFIG="$QT_CONFIG audio-backend"
+fi
+
 if [ "$CFG_SVG" = "yes" ]; then
     QT_CONFIG="$QT_CONFIG svg"
 else
     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SVG"
+fi
+
+if [ "$CFG_DECLARATIVE" = "yes" ]; then
+    QT_CONFIG="$QT_CONFIG declarative"
+else
+    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DECLARATIVE"
 fi
 
@@ -5969,11 +6529,26 @@
 fi
 
-if [ "$CFG_SCRIPTTOOLS" = "auto" ]; then
+if [ "$CFG_SCRIPT" = "auto" ]; then
+    CFG_SCRIPT="yes"
+fi
+
+if [ "$CFG_SCRIPT" = "yes" ]; then
+    QT_CONFIG="$QT_CONFIG script"
+else
+    QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SCRIPT"
+fi
+
+if [ "$CFG_SCRIPTTOOLS" = "yes" -a "$CFG_SCRIPT" = "no" ]; then
+    echo "QtScriptTools was requested, but it can't be built due to QtScript being disabled."
+    exit 1
+fi
+if [ "$CFG_SCRIPTTOOLS" = "auto" -a "$CFG_SCRIPT" != "no" ]; then
     CFG_SCRIPTTOOLS="yes"
+elif [ "$CFG_SCRIPT" = "no" ]; then
+    CFG_SCRIPTTOOLS="no"
 fi
 
 if [ "$CFG_SCRIPTTOOLS" = "yes" ]; then
     QT_CONFIG="$QT_CONFIG scripttools"
-    CFG_SCRIPTTOOLS="yes"
 else
     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SCRIPTTOOLS"
@@ -6002,8 +6577,9 @@
 fi
 
-# On Mac, set the minimum deployment target using Xarch when that is supported (10.5 and up).
-# On 10.4 the deployment version is set to 10.3 globally using the QMAKE_MACOSX_DEPLOYMENT_TARGET env. variable
-# "-cocoa" on the command line means Cocoa is used in 32-bit mode also, in this case fall back on 
-# QMAKE_MACOSX_DEPLOYMENT_TARGET which will be set to 10.5.
+# On Mac, set the minimum deployment target for the different architechtures 
+# using the Xarch compiler option when supported (10.5 and up).  On 10.4 the
+# deployment version is set to 10.4 globally using the QMAKE_MACOSX_DEPLOYMENT_TARGET
+# env. variable. "-cocoa" on the command line means Cocoa is used in 32-bit mode also,
+# in this case fall back on QMAKE_MACOSX_DEPLOYMENT_TARGET which will be set to 10.5.
 if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ] && [ "$COMMANDLINE_MAC_COCOA" != "yes" ]; then
     if echo "$CFG_MAC_ARCHS" | grep '\<x86\>' > /dev/null 2>&1; then
@@ -6014,8 +6590,8 @@
     fi
     if echo "$CFG_MAC_ARCHS" | grep '\<ppc\>' > /dev/null 2>&1; then
-        QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=10.3"
-        QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=10.3"
-        QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=10.3"
-        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.3"
+        QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
+        QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
+        QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
+        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.4"
     fi
     if echo "$CFG_MAC_ARCHS" | grep '\<x86_64\>' > /dev/null 2>&1; then
@@ -6087,8 +6663,6 @@
 #     network canvas table xml opengl sql
 #
-#   Options:
+# Things that do not affect the Qt API/ABI:
 #     stl
-#
-# Things that do not affect the Qt API/ABI:
 #     system-jpeg no-jpeg jpeg
 #     system-mng no-mng mng
@@ -6100,5 +6674,4 @@
 #     dll staticlib
 #
-#     internal
 #     nocrosscompiler
 #     GNUmake
@@ -6112,5 +6685,5 @@
 #     Embedded: embedded freetype
 #
-ALL_OPTIONS="stl"
+ALL_OPTIONS=
 BUILD_CONFIG=
 BUILD_OPTIONS=
@@ -6124,10 +6697,4 @@
         # and is the one that we will use for tagging plugins
         BUILD_CONFIG="$config_option"
-        ;;
-
-    stl)
-        # these config options affect the Qt API/ABI. they should influence
-        # the generation of the buildkey, so we don't skip them
-        SKIP="no"
         ;;
 
@@ -6451,4 +7018,5 @@
     [ "$CFG_GRAPHICS_SYSTEM" = "raster" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_RASTER"
     [ "$CFG_GRAPHICS_SYSTEM" = "opengl" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENGL"
+    [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENVG"
 fi
 
@@ -6480,4 +7048,5 @@
 [ "$CFG_MITSHM" = "no" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MITSHM"
 [ "$CFG_XSHAPE" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SHAPE"
+[ "$CFG_XSYNC" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XSYNC"
 [ "$CFG_XINPUT" = "no" ]     && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_XINPUT QT_NO_TABLET"
 
@@ -6487,4 +7056,5 @@
 [ "$CFG_XRANDR" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR"
 [ "$CFG_XINPUT" = "runtime" ]    && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT"
+[ "$CFG_ALSA" = "no" ]           && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA"
 
 # sort QCONFIG_FLAGS for neatness if we can
@@ -6580,4 +7150,7 @@
     QT_CONFIG="$QT_CONFIG $CFG_MAC_ARCHS"
 fi
+if [ "$CFG_DEV" = "yes" ]; then
+    QT_CONFIG="$QT_CONFIG private_tests"
+fi
 
 # Make the application arch follow the Qt arch for single arch builds.
@@ -6646,4 +7219,9 @@
 EOF
 
+# Ensure we can link to uninistalled libraries
+if linkerSupportsFlag -rpath-link "$outpath/lib"; then
+    echo "QMAKE_LFLAGS    += -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp"
+fi
+
 if [ -n "$QT_CFLAGS_PSQL" ]; then
     echo "QT_CFLAGS_PSQL   = $QT_CFLAGS_PSQL" >> "$CACHEFILE.tmp"
@@ -6663,4 +7241,7 @@
 if [ -n "$QT_LFLAGS_SQLITE" ]; then
     echo "QT_LFLAGS_SQLITE   = $QT_LFLAGS_SQLITE" >> "$CACHEFILE.tmp"
+fi
+if [ -n "$QT_LFLAGS_ODBC" ]; then
+    echo "QT_LFLAGS_ODBC   = $QT_LFLAGS_ODBC" >> "$CACHEFILE.tmp"
 fi
 
@@ -6763,5 +7344,5 @@
 esac
 
-if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" == "no" ]  && [ "$CFG_WEBKIT" = "yes" ] && [ "$CFG_DEBUG_RELEASE" == "yes" ]; then
+if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "no" ]  && [ "$CFG_WEBKIT" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "yes" ]; then
     cat <<EOF
         WARNING: DWARF2 debug symbols are not enabled. Linking webkit
@@ -6836,14 +7417,26 @@
 [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module ....... yes (run-time)"
 [ "$CFG_DBUS" = "linked" ] && echo "QtDBus module ....... yes (linked)"
+echo "QtConcurrent code.... $CFG_CONCURRENT"
+echo "QtScript module ..... $CFG_SCRIPT"
 echo "QtScriptTools module  $CFG_SCRIPTTOOLS"
 echo "QtXmlPatterns module  $CFG_XMLPATTERNS"
 echo "Phonon module ....... $CFG_PHONON"
+echo "Multimedia module ... $CFG_MULTIMEDIA"
 echo "SVG module .......... $CFG_SVG"
 echo "WebKit module ....... $CFG_WEBKIT"
+if [ "$CFG_WEBKIT" = "yes" ]; then 
+    if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then
+        echo "JavaScriptCore JIT .. To be decided by JavaScriptCore"
+    else
+        echo "JavaScriptCore JIT .. $CFG_JAVASCRIPTCORE_JIT"
+    fi
+fi
+echo "Declarative module .. $CFG_DECLARATIVE"
 echo "STL support ......... $CFG_STL"
 echo "PCH support ......... $CFG_PRECOMPILE"
 echo "MMX/3DNOW/SSE/SSE2..  ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}"
-if [ "${CFG_ARCH}" = "arm" ]; then
+if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
     echo "iWMMXt support ...... ${CFG_IWMMXT}"
+    echo "NEON support ........ ${CFG_NEON}"
 fi
 [ "${PLATFORM_QWS}" != "yes" ] && echo "Graphics System ..... $CFG_GRAPHICS_SYSTEM"
@@ -6918,7 +7511,22 @@
     echo "OpenGL support ...... no"
 fi
+if [ "$CFG_EGL" != "no" ]; then
+    if [ "$CFG_EGL_GLES_INCLUDES" != "no" ]; 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"
+    else
+        echo "OpenVG support ...... $CFG_OPENVG"
+    fi
+fi
 if [ "$PLATFORM_X11" = "yes" ]; then
     echo "NAS sound support ... $CFG_NAS"
     echo "XShape support ...... $CFG_XSHAPE"
+    echo "XSync support ....... $CFG_XSYNC"
     echo "Xinerama support .... $CFG_XINERAMA"
     echo "Xcursor support ..... $CFG_XCURSOR"
@@ -6974,4 +7582,5 @@
     echo
 fi
+echo "alsa support ........ $CFG_ALSA"
 echo
 
@@ -7018,7 +7627,7 @@
 FNR == 1 {
     if ( input_file ) {
-  if ( ! target_file )
-      target_file = third
-  print input_file >target_file
+        if ( ! target_file )
+            target_file = third
+        print input_file >target_file
     }
 
@@ -7031,5 +7640,8 @@
 /^(TARGET.*=)/ {
     if ( \$3 == "moc" || \$3 ~ /^Qt/ ) {
-  target_file = first
+        target_file = first
+        matched_target = 1
+    } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) {
+        target_file = second
         matched_target = 1
     }
@@ -7038,9 +7650,9 @@
 matched_target == 0 && /^(TEMPLATE.*=)/ {
     if ( \$3 == "subdirs" )
-  target_file = second
+        target_file = second
     else if ( \$3 == "lib" )
-  template_lib = 1
-    else
-  target_file = third
+        template_lib = 1
+    else
+        target_file = third
 }
 
@@ -7049,12 +7661,12 @@
         target_file = third
     else
-  target_file = second
+        target_file = second
 }
 
 END {
     if ( input_file ) {
-  if ( ! target_file )
-      target_file = third
-  print input_file >>target_file
+        if ( ! target_file )
+            target_file = third
+        print input_file >>target_file
     }
 }
@@ -7117,4 +7729,5 @@
     tools) PART_ROOTS="$PART_ROOTS tools" ;;
     libs) PART_ROOTS="$PART_ROOTS src" ;;
+    translations) PART_ROOTS="$PART_ROOTS tools/linguist/lrelease translations" ;;
     examples) PART_ROOTS="$PART_ROOTS examples demos" ;;
     *) ;;
@@ -7141,9 +7754,11 @@
         case $a in
         *winmain/winmain.pro) continue ;;
+        *s60main/s60main.pro) continue ;;
+        *examples/activeqt/*) continue ;;
         */qmake/qmake.pro) continue ;;
-        *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*) SPEC=$QMAKESPEC ;;
+        *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*linguist/lrelease*) SPEC=$QMAKESPEC ;;
         *) SPEC=$XQMAKESPEC ;;
         esac
-        dir=`dirname $a | sed -e "s;$sepath;.;g"`
+        dir=`dirname "$a" | sed -e "s;$sepath;.;g"`
         test -d "$dir" || mkdir -p "$dir"
         OUTDIR="$outpath/$dir"
@@ -7288,5 +7903,5 @@
 fi
 
-MAKE=`basename $MAKE`
+MAKE=`basename "$MAKE"`
 echo
 echo Qt is now configured for building. Just run \'$MAKE\'.
