From a1000de2b48d1105fcfb1e6f7ead4fdd71479b6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@digia.com>
Date: Fri, 15 Feb 2013 11:57:08 +0100
Subject: [PATCH] Ensure that arch.test for host runs with option(host_build)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

So that mkspecs and features may rely on the host_build test.

Change-Id: I18fee4820d9e2904285afcc7ddb8f1cc3d025fef
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
---
 config.tests/arch/arch.pro      |  1 +
 config.tests/arch/arch_host.pro |  2 ++
 config.tests/unix/arch.test     | 12 ++++++++++--
 configure                       |  4 ++--
 4 files changed, 15 insertions(+), 4 deletions(-)
 create mode 100644 config.tests/arch/arch_host.pro

diff --git a/config.tests/arch/arch.pro b/config.tests/arch/arch.pro
index c6801264b4d..fda4acc601a 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 00000000000..f7acef0c5dd
--- /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 dacdcda8bf9..f25076600c8 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 39e436d57ce..47640b10269 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
-- 
GitLab