summaryrefslogtreecommitdiffstats
path: root/config.tests/mac
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commit38be0d13830efd2d98281c645c3a60afe05ffece (patch)
tree6ea73f3ec77f7d153333779883e8120f82820abe /config.tests/mac
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'config.tests/mac')
-rw-r--r--config.tests/mac/coreservices/coreservices.mm48
-rw-r--r--config.tests/mac/coreservices/coreservices.pro3
-rw-r--r--config.tests/mac/corewlan/corewlan.pro3
-rw-r--r--config.tests/mac/corewlan/corewlantest.mm49
-rwxr-xr-xconfig.tests/mac/crc.test71
-rw-r--r--config.tests/mac/crc/crc.pro2
-rw-r--r--config.tests/mac/crc/main.cpp108
-rwxr-xr-xconfig.tests/mac/defaultarch.test33
-rwxr-xr-xconfig.tests/mac/dwarf2.test42
-rwxr-xr-xconfig.tests/mac/xarch.test26
-rw-r--r--config.tests/mac/xcodeversion.cpp99
11 files changed, 484 insertions, 0 deletions
diff --git a/config.tests/mac/coreservices/coreservices.mm b/config.tests/mac/coreservices/coreservices.mm
new file mode 100644
index 0000000000..c70802c725
--- /dev/null
+++ b/config.tests/mac/coreservices/coreservices.mm
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <CoreServices/CoreServices.h>
+
+int main()
+{
+ FSRef ref;
+ return 0;
+}
diff --git a/config.tests/mac/coreservices/coreservices.pro b/config.tests/mac/coreservices/coreservices.pro
new file mode 100644
index 0000000000..c9bf8eccd7
--- /dev/null
+++ b/config.tests/mac/coreservices/coreservices.pro
@@ -0,0 +1,3 @@
+SOURCES = coreservices.mm
+LIBS += -framework CoreServices
+CONFIG -= app_bundle qt
diff --git a/config.tests/mac/corewlan/corewlan.pro b/config.tests/mac/corewlan/corewlan.pro
new file mode 100644
index 0000000000..a9c256043c
--- /dev/null
+++ b/config.tests/mac/corewlan/corewlan.pro
@@ -0,0 +1,3 @@
+OBJECTIVE_SOURCES = corewlantest.mm
+LIBS += -framework CoreWLAN -framework Foundation
+CONFIG -= app_bundle qt
diff --git a/config.tests/mac/corewlan/corewlantest.mm b/config.tests/mac/corewlan/corewlantest.mm
new file mode 100644
index 0000000000..3b63607c8f
--- /dev/null
+++ b/config.tests/mac/corewlan/corewlantest.mm
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <CoreWLAN/CoreWLAN.h>
+#include <CoreWLAN/CWInterface.h>
+
+int main()
+{
+ [CWInterface interfaceWithName:@"en2"];
+ return 0;
+}
diff --git a/config.tests/mac/crc.test b/config.tests/mac/crc.test
new file mode 100755
index 0000000000..9cbe7bad94
--- /dev/null
+++ b/config.tests/mac/crc.test
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+SUCCESS=no
+QMKSPEC=$1
+XPLATFORM=`basename "$1"`
+QMAKE_CONFIG=$2
+VERBOSE=$3
+SRCDIR=$4
+OUTDIR=$5
+TEST=$6
+EXE=`basename "$6"`
+ARG=$7
+shift 7
+LFLAGS=""
+INCLUDEPATH=""
+CXXFLAGS=""
+while [ "$#" -gt 0 ]; do
+ PARAM=$1
+ case $PARAM in
+ -framework)
+ LFLAGS="$LFLAGS -framework \"$2\""
+ shift
+ ;;
+ -F*|-m*|-x*)
+ LFLAGS="$LFLAGS $PARAM"
+ CXXFLAGS="$CXXFLAGS $PARAM"
+ ;;
+ -L*|-l*|-pthread)
+ LFLAGS="$LFLAGS $PARAM"
+ ;;
+ -I*)
+ INC=`echo $PARAM | sed -e 's/^-I//'`
+ INCLUDEPATH="$INCLUDEPATH $INC"
+ ;;
+ -f*|-D*)
+ CXXFLAGS="$CXXFLAGS $PARAM"
+ ;;
+ -Qoption)
+ # Two-argument form for the Sun Compiler
+ CXXFLAGS="$CXXFLAGS $PARAM \"$2\""
+ shift
+ ;;
+ *) ;;
+ esac
+ shift
+done
+
+# debuggery
+[ "$VERBOSE" = "yes" ] && echo "$DESCRIPTION auto-detection... ($*)"
+
+test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST"
+
+cd "$OUTDIR/$TEST"
+
+$MAKE distclean >/dev/null 2>&1
+"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
+
+if [ "$VERBOSE" = "yes" ]; then
+ $MAKE
+else
+ $MAKE >/dev/null 2>&1
+fi
+
+
+if [ -x "$EXE" ]; then
+ foo=`$OUTDIR/$TEST/$EXE $ARG`
+ echo "$foo"
+else
+ echo "'CUTE'" #1129665605 # == 'CUTE'
+fi
+
diff --git a/config.tests/mac/crc/crc.pro b/config.tests/mac/crc/crc.pro
new file mode 100644
index 0000000000..c3abf15759
--- /dev/null
+++ b/config.tests/mac/crc/crc.pro
@@ -0,0 +1,2 @@
+SOURCES = main.cpp
+CONFIG -= app_bundle qt
diff --git a/config.tests/mac/crc/main.cpp b/config.tests/mac/crc/main.cpp
new file mode 100644
index 0000000000..8d44e0afa5
--- /dev/null
+++ b/config.tests/mac/crc/main.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <iostream>
+#include <cstdlib>
+#include <cstring>
+
+
+class CCRC32
+{
+public:
+ CCRC32() { initialize(); }
+
+ unsigned long FullCRC(const unsigned char *sData, unsigned long ulDataLength)
+ {
+ unsigned long ulCRC = 0xffffffff;
+ PartialCRC(&ulCRC, sData, ulDataLength);
+ return(ulCRC ^ 0xffffffff);
+ }
+
+ void PartialCRC(unsigned long *ulCRC, const unsigned char *sData, unsigned long ulDataLength)
+ {
+ while(ulDataLength--) {
+ *ulCRC = (*ulCRC >> 8) ^ ulTable[(*ulCRC & 0xFF) ^ *sData++];
+ }
+ }
+
+private:
+ void initialize(void)
+ {
+ unsigned long ulPolynomial = 0x04C11DB7;
+ memset(&ulTable, 0, sizeof(ulTable));
+ for(int iCodes = 0; iCodes <= 0xFF; iCodes++) {
+ ulTable[iCodes] = Reflect(iCodes, 8) << 24;
+ for(int iPos = 0; iPos < 8; iPos++) {
+ ulTable[iCodes] = ((ulTable[iCodes] << 1) & 0xffffffff)
+ ^ ((ulTable[iCodes] & (1 << 31)) ? ulPolynomial : 0);
+ }
+
+ ulTable[iCodes] = Reflect(ulTable[iCodes], 32);
+ }
+ }
+ unsigned long Reflect(unsigned long ulReflect, const char cChar)
+ {
+ unsigned long ulValue = 0;
+ // Swap bit 0 for bit 7, bit 1 For bit 6, etc....
+ for(int iPos = 1; iPos < (cChar + 1); iPos++) {
+ if(ulReflect & 1) {
+ ulValue |= (1ul << (cChar - iPos));
+ }
+ ulReflect >>= 1;
+ }
+ return ulValue;
+ }
+ unsigned long ulTable[256]; // CRC lookup table array.
+};
+
+
+int main(int argc, char **argv)
+{
+ CCRC32 crc;
+ char *name;
+ if (argc < 2) {
+ std::cerr << "usage: crc <string>\n";
+ return 0;
+ } else {
+ name = argv[1];
+ }
+ std::cout << crc.FullCRC((unsigned char *)name, strlen(name)) << std::endl;
+}
diff --git a/config.tests/mac/defaultarch.test b/config.tests/mac/defaultarch.test
new file mode 100755
index 0000000000..80f244a8bb
--- /dev/null
+++ b/config.tests/mac/defaultarch.test
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+COMPILER=$1
+VERBOSE=$2
+WORKDIR=$3
+QT_MAC_DEFAULT_ARCH=
+
+touch defaultarch.c
+
+# compile something and run 'file' on it.
+if "$COMPILER" -c defaultarch.c 2>/dev/null 1>&2; then
+ FIlE_OUTPUT=`file defaultarch.o`
+ [ "$VERBOSE" = "yes" ] && echo "'file' reports compiler ($COMPILER) default architechture as: $FIlE_OUTPUT"
+
+fi
+rm -f defaultarch.c defaultarch.o
+
+# detect our known archs.
+if echo "$FIlE_OUTPUT" | grep '\<i386\>' > /dev/null 2>&1; then
+ QT_MAC_DEFAULT_ARCH=x86 # configure knows it as "x86" not "i386"
+fi
+if echo "$FIlE_OUTPUT" | grep '\<x86_64\>' > /dev/null 2>&1; then
+ QT_MAC_DEFAULT_ARCH=x86_64
+fi
+if echo "$FIlE_OUTPUT" | grep '\<ppc\>' > /dev/null 2>&1; then
+ QT_MAC_DEFAULT_ARCH=ppc
+fi
+if echo "$FIlE_OUTPUT" | grep '\<ppc64\>' > /dev/null 2>&1; then
+ QT_MAC_DEFAULT_ARCH=ppc64
+fi
+
+[ "$VERBOSE" = "yes" ] && echo "setting QT_MAC_DEFAULT_ARCH to \"$QT_MAC_DEFAULT_ARCH\""
+export QT_MAC_DEFAULT_ARCH
diff --git a/config.tests/mac/dwarf2.test b/config.tests/mac/dwarf2.test
new file mode 100755
index 0000000000..a640b113de
--- /dev/null
+++ b/config.tests/mac/dwarf2.test
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+DWARF2_SUPPORT=no
+DWARF2_SUPPORT_BROKEN=no
+COMPILER=$1
+VERBOSE=$2
+WORKDIR=$3
+
+touch dwarf2.c
+
+if "$COMPILER" -c dwarf2.c -Werror -gdwarf-2 2>/dev/null 1>&2; then
+ if "$COMPILER" -c dwarf2.c -Werror -gdwarf-2 2>&1 | grep "unsupported" >/dev/null ; then
+ true
+ else
+ DWARF2_SUPPORT=yes
+ fi
+fi
+rm -f dwarf2.c dwarf2.o
+
+# Test for xcode 2.4.0, which has a broken implementation of DWARF
+"$COMPILER" $WORKDIR/xcodeversion.cpp -o xcodeversion -framework Carbon;
+./xcodeversion
+
+if [ "$?" == "1" ]; then
+ DWARF2_SUPPORT_BROKEN=yes
+fi
+
+rm xcodeversion
+
+# done
+if [ "$DWARF2_SUPPORT" != "yes" ]; then
+ [ "$VERBOSE" = "yes" ] && echo "DWARF2 debug symbols disabled."
+ exit 0
+else
+ if [ "$DWARF2_SUPPORT_BROKEN" == "yes" ]; then
+ [ "$VERBOSE" = "yes" ] && echo "DWARF2 debug symbols disabled."
+ exit 0
+ else
+ [ "$VERBOSE" = "yes" ] && echo "DWARF2 debug symbols enabled."
+ exit 1
+ fi
+fi
diff --git a/config.tests/mac/xarch.test b/config.tests/mac/xarch.test
new file mode 100755
index 0000000000..08322a96cf
--- /dev/null
+++ b/config.tests/mac/xarch.test
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+XARCH_SUPPORT=no
+COMPILER=$1
+VERBOSE=$2
+WORKDIR=$3
+
+touch xarch.c
+
+if "$COMPILER" -c xarch.c -Xarch_i386 -mmmx 2>/dev/null 1>&2; then
+ if "$COMPILER" -c xarch.c -Xarch_i386 -mmmx 2>&1 | grep "unrecognized" >/dev/null ; then
+ true
+ else
+ XARCH_SUPPORT=yes
+ fi
+fi
+rm -f xarch.c xarch.o
+
+# done
+if [ "$XARCH_SUPPORT" != "yes" ]; then
+ [ "$VERBOSE" = "yes" ] && echo "Xarch is not supported"
+ exit 0
+else
+ [ "$VERBOSE" = "yes" ] && echo "Xarch support detected"
+ exit 1
+fi
diff --git a/config.tests/mac/xcodeversion.cpp b/config.tests/mac/xcodeversion.cpp
new file mode 100644
index 0000000000..dc7e5fc104
--- /dev/null
+++ b/config.tests/mac/xcodeversion.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <Carbon/Carbon.h>
+
+int success = 0;
+int fail = 1;
+int internal_error = success; // enable dwarf on internal errors
+
+int main(int argc, const char **argv)
+{
+ CFURLRef cfurl;
+ OSStatus err = LSFindApplicationForInfo(0, CFSTR("com.apple.Xcode"), 0, 0, &cfurl);
+ if (err != noErr)
+ return internal_error;
+
+ CFBundleRef bundle = CFBundleCreate(0, cfurl);
+ if (bundle == 0)
+ return internal_error;
+
+ CFStringRef str = CFStringRef(CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("CFBundleShortVersionString")));
+ const char * ptr = CFStringGetCStringPtr(str, 0);
+ if (ptr == 0)
+ return internal_error;
+
+ // self-test
+ const char * fail1 = "2.4";
+ const char * fail2 = "2.4.0";
+ const char * fail3 ="2.3";
+ const char * ok1 = "2.4.1";
+ const char * ok2 ="2.5";
+ const char * ok3 ="3.0";
+// ptr = fail1;
+// printf ("string: %s\n", ptr);
+
+ int length = strlen(ptr);
+ if (length < 3) // expect "x.y" at least
+ return internal_error;
+
+ // fail on 2.4 and below (2.4.1 is ok)
+
+ if (ptr[0] < '2')
+ return fail;
+
+ if (ptr[0] >= '3')
+ return success;
+
+ if (ptr[2] < '4')
+ return fail;
+
+ if (length < 5)
+ return fail;
+
+ if (ptr[4] < '1')
+ return fail;
+
+ return success;
+} \ No newline at end of file