#undef sparc
#undef unknown
#if defined(Q_PROCESSOR_ALPHA)
-alpha
+Architecture: alpha
#elif defined(Q_PROCESSOR_ARM)
-arm
+Architecture: arm
#elif defined(Q_PROCESSOR_AVR32)
-avr32
+Architecture: avr32
#elif defined(Q_PROCESSOR_BLACKFIN)
-bfin
+Architecture: bfin
#elif defined(Q_PROCESSOR_X86_32)
-i386
+Architecture: i386
#elif defined(Q_PROCESSOR_X86_64)
-x86_64
+Architecture: x86_64
#elif defined(Q_PROCESSOR_IA64)
-ia64
+Architecture: ia64
#elif defined(Q_PROCESSOR_MIPS)
-mips
+Architecture: mips
#elif defined(Q_PROCESSOR_POWER)
-power
+Architecture: power
#elif defined(Q_PROCESSOR_S390)
-s390
+Architecture: s390
#elif defined(Q_PROCESSOR_SH)
-sh
+Architecture: sh
#elif defined(Q_PROCESSOR_SPARC)
-sparc
+Architecture: sparc
#else
-unknown
+Architecture: unknown
#endif
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
-# 'false' as second argument to system() prevents qmake from stripping newlines
-COMPILER_ARCH = $$system($$COMMAND, false)
+# 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)
#-------------------------------------------------------------------------------
# Use config.tests/arch/arch.pro to has the compiler tell us what the target architecture is
-CFG_ARCH=`"$outpath/bin/qmake" -spec "$XQMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -e "s,^Project MESSAGE: ,," -e "s,^#.*$,,g" | grep -v "^$"`
+CFG_ARCH=`"$outpath/bin/qmake" -spec "$XQMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -n -e 's,^Project MESSAGE:.*Architecture: \([a-zA-Z0-9]*\).*,\1,p'`
+
[ -z "$CFG_ARCH" ] && CFG_ARCH="unknown"
if [ "$QMAKESPEC" != "$XQMAKESPEC" ]; then
# Do the same test again, using the host compiler
- CFG_HOST_ARCH=`"$outpath/bin/qmake" -spec "$QMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -e "s,^Project MESSAGE: ,," -e "s,^#.*$,,g" | grep -v "^$"`
+ CFG_HOST_ARCH=`"$outpath/bin/qmake" -spec "$QMAKESPEC" -o /dev/null "$relpath/config.tests/arch/arch.pro" 2>&1 | sed -n -e 's,^Project MESSAGE:.*Architecture: \([a-zA-Z0-9]*\).*,\1,p'`
[ -z "$CFG_HOST_ARCH" ] && CFG_HOST_ARCH="unknown"
else
# not cross compiling, host == target
if (output.isEmpty())
continue;
- // strip everything up to and including 'Project MESSAGE: '
- QString ProjectMESSAGE = QStringLiteral("Project MESSAGE: ");
- int at = output.indexOf(ProjectMESSAGE);
- if (at != -1)
- output = output.mid(at + ProjectMESSAGE.length());
-
- // strip lines beginning with a #
- at = 0;
- while ((at = output.indexOf('#', at)) != -1) {
- if (at > 0 && output.at(at - 1) != '\n') {
- // # isnt' at the beginning of a line, skip it
- ++at;
- continue;
- }
-
- int eol = output.indexOf('\n', at);
- if (eol == -1) {
- // end of string
- output.remove(at, output.length() - at);
- break;
- }
-
- output.remove(at, eol - at + 1);
- }
-
- dictionary[key] = output.simplified();
+ QRegExp re("Project MESSAGE:.*Architecture: ([a-zA-Z0-9]*)");
+ if (re.indexIn(output) != -1)
+ dictionary[key] = re.cap(1);
}
if (!dictionary.contains("QT_HOST_ARCH"))