diff options
Diffstat (limited to 'config.tests')
-rw-r--r-- | config.tests/arch/arch.cpp | 52 | ||||
-rw-r--r-- | config.tests/arch/arch.pro | 11 | ||||
-rwxr-xr-x | config.tests/unix/arch.test | 41 |
3 files changed, 70 insertions, 34 deletions
diff --git a/config.tests/arch/arch.cpp b/config.tests/arch/arch.cpp index b1ec3d7111..ed772f70a0 100644 --- a/config.tests/arch/arch.cpp +++ b/config.tests/arch/arch.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Intel Corporation ** Contact: http://www.qt-project.org/ ** ** This file is part of the FOO module of the Qt Toolkit. @@ -39,46 +40,43 @@ ** ****************************************************************************/ -// NOTE: This file is not meant to be compiled, only preprocessed. #define QGLOBAL_H #include "../../src/corelib/global/qprocessordetection.h" -#undef alpha -#undef arm -#undef avr32 -#undef bfin -#undef i386 -#undef x86_64 -#undef ia64 -#undef mips -#undef power -#undef s390 -#undef sh -#undef sparc -#undef unknown +#include <stdio.h> + +extern const char msg[]; +const char msg[] = "==Qt=magic=Qt== Architecture:" + #if defined(Q_PROCESSOR_ALPHA) -Architecture: alpha +"alpha" #elif defined(Q_PROCESSOR_ARM) -Architecture: arm +"arm" #elif defined(Q_PROCESSOR_AVR32) -Architecture: avr32 +"avr32" #elif defined(Q_PROCESSOR_BLACKFIN) -Architecture: bfin +"bfin" #elif defined(Q_PROCESSOR_X86_32) -Architecture: i386 +"i386" #elif defined(Q_PROCESSOR_X86_64) -Architecture: x86_64 +"x86_64" #elif defined(Q_PROCESSOR_IA64) -Architecture: ia64 +"ia64" #elif defined(Q_PROCESSOR_MIPS) -Architecture: mips +"mips" #elif defined(Q_PROCESSOR_POWER) -Architecture: power +"power" #elif defined(Q_PROCESSOR_S390) -Architecture: s390 +"s390" #elif defined(Q_PROCESSOR_SH) -Architecture: sh +"sh" #elif defined(Q_PROCESSOR_SPARC) -Architecture: sparc +"sparc" #else -Architecture: unknown +"unknown" #endif + ; + +int main() +{ + puts(msg); +} diff --git a/config.tests/arch/arch.pro b/config.tests/arch/arch.pro index ea85a52b97..c6801264b4 100644 --- a/config.tests/arch/arch.pro +++ b/config.tests/arch/arch.pro @@ -1,7 +1,4 @@ -CONFIG -= qt debug_and_release -# Detect target by preprocessing a file that uses Q_PROCESSOR_* macros from qprocessordetection.h -COMMAND = $$QMAKE_CXX $$QMAKE_CXXFLAGS -E $$PWD/arch.cpp -# system function converts newline in output into spaces -COMPILER_ARCH = $$system($$COMMAND) -# Message back to configure so that it can set QT_ARCH and QT_HOST_ARCH -message($$COMPILER_ARCH) +SOURCES = arch.cpp +CONFIG -= qt dylib release debug_and_release +CONFIG += debug console +mac:CONFIG -= app_bundle diff --git a/config.tests/unix/arch.test b/config.tests/unix/arch.test new file mode 100755 index 0000000000..2a6e12de56 --- /dev/null +++ b/config.tests/unix/arch.test @@ -0,0 +1,41 @@ +#!/bin/sh + +QMKSPEC=$1 +VERBOSE=$2 +SRCDIR=$3 +OUTDIR=$4 +RESULTFILE=$5 + +# debuggery +[ "$VERBOSE" = "yes" ] && echo "Determining architecture... ($*)" + +# build a test program but don't run it +test -d "$OUTDIR/config.tests/arch" || mkdir -p "$OUTDIR/config.tests/arch" +[ -f Makefile ] && $MAKE distclean >/dev/null 2>&1 +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "LIBS+=$SYSROOT_FLAG" "QMAKE_CXXFLAGS+=$SYSROOT_FLAG" "$SRCDIR/config.tests/arch/arch.pro" -o "$OUTDIR/config.tests/arch/Makefile" >/dev/null 2>&1 || echo "qmake is broken" >&2 +cd "$OUTDIR/config.tests/arch" + + +ARCH="" +[ "$VERBOSE" = "yes" ] && $MAKE || $MAKE >/dev/null 2>&1 + +if [ -f ./arch.exe ]; then + binary=./arch.exe +elif [ -f ./arch ]; then + binary=./arch +else + [ "$VERBOSE" = "yes" ] && echo "Unable to determine architecture!" + exit 2 +fi + +ARCH=`strings - $binary 2>/dev/null | awk -F: '/==Qt=magic=Qt==/ { print $2 }'` || +{ + [ "$VERBOSE" = "yes" ] && echo "Unable to determine architecture!" + exit 2 +} + +$MAKE distclean >/dev/null 2>&1 + +[ "$VERBOSE" = "yes" ] && echo " Found '$ARCH' in binary" + +echo "$ARCH" > $5 |