diff --git a/config.tests/arch/arch.pro b/config.tests/arch/arch.pro
index c6801264b4dbe0301b5583c7793e3c5abd399692..fda4acc601a83709db4bab039a1a6bb465947528 100644
--- a/config.tests/arch/arch.pro
+++ b/config.tests/arch/arch.pro
@@ -1,3 +1,4 @@
+TARGET = arch
 SOURCES = arch.cpp
 CONFIG -= qt dylib release debug_and_release
 CONFIG += debug console
diff --git a/config.tests/arch/arch_host.pro b/config.tests/arch/arch_host.pro
new file mode 100644
index 0000000000000000000000000000000000000000..f7acef0c5ddbad5509da8cd9d26eb3befab9ee8b
--- /dev/null
+++ b/config.tests/arch/arch_host.pro
@@ -0,0 +1,2 @@
+option(host_build)
+include(arch.pro)
diff --git a/config.tests/unix/arch.test b/config.tests/unix/arch.test
index dacdcda8bf97a4fb94240d0939d83f9bf727f577..f25076600c89387e7abff3949889063b7c5a933d 100755
--- a/config.tests/unix/arch.test
+++ b/config.tests/unix/arch.test
@@ -5,9 +5,17 @@ VERBOSE=$2
 SRCDIR=$3
 OUTDIR=$4
 RESULTFILE=$5
-VARPREFIX=$6
+TARGET=$6
 shift 6
 
+if [ "$TARGET" = "host" ]; then
+    VARPREFIX="CFG_HOST"
+    PROSUFFIX="_host"
+else
+    VARPREFIX="CFG"
+    PROSUFFIX=""
+fi
+
 LFLAGS="$SYSROOT_FLAG"
 CXXFLAGS="$SYSROOT_FLAG"
 
@@ -32,7 +40,7 @@ done
 test -d "$OUTDIR/config.tests/arch" || mkdir -p "$OUTDIR/config.tests/arch"
 cd "$OUTDIR/config.tests/arch"
 [ -f Makefile ] && $MAKE distclean >/dev/null 2>&1
-OUTDIR=$OUTDIR "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "LIBS+=$LFLAGS" "QMAKE_CXXFLAGS+=$CXXFLAGS" "$SRCDIR/config.tests/arch/arch.pro" >/dev/null 2>&1 || echo "qmake is broken" >&2
+OUTDIR=$OUTDIR "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "LIBS+=$LFLAGS" "QMAKE_CXXFLAGS+=$CXXFLAGS" "$SRCDIR/config.tests/arch/arch$PROSUFFIX.pro" >/dev/null 2>&1 || echo "qmake is broken" >&2
 
 
 ARCH=""
diff --git a/configure b/configure
index 39e436d57ce654dd5ff9eed0d9d4d2b2c343d8bf..47640b10269a4a1ed92d5a2c91860835705008c7 100755
--- a/configure
+++ b/configure
@@ -3824,7 +3824,7 @@ compileTest()
 
 # Use config.tests/arch/arch.pro to have the compiler tell us what the target architecture is
 OUTFILE=$outpath/arch.result
-"$unixtests/arch.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "CFG" $MAC_SDK_FLAG
+"$unixtests/arch.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "target" $MAC_SDK_FLAG
 if [ $? -eq 0 ]; then
     eval `cat "$OUTFILE"`
 else
@@ -3837,7 +3837,7 @@ rm -f "$OUTFILE" 2>/dev/null
 
 if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
     # Do the same test again, using the host compiler
-    SYSROOT_FLAG= "$unixtests/arch.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "CFG_HOST"
+    SYSROOT_FLAG= "$unixtests/arch.test" "$QMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "host"
     if [ $? -eq 0 ]; then
         eval `cat "$OUTFILE"`
     else