diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-02-03 20:26:24 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-06 14:32:09 +0100 |
commit | ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb (patch) | |
tree | fefb0a008603849dc88a069d564427618b526906 /src | |
parent | 3282b060d19f73ade5b7370983dbea75c130166b (diff) |
Move operating system detection from qglobal.h to a separate header
qsystemdetection.h is included from qglobal.h, and does all Q_OS_*
detection
A side-effect of this change is that QT_BEGIN_HEADER and QT_END_HEADER
started being defined on Mac OS X, which ends up breaking the build
in some cases. Since QT_BEGIN_HEADER and QT_END_HEADER have been
defined to nothing in the past, even on Mac OS X, change these 2
to be unconditionally defined to nothing.
Change-Id: Ibc8a0aa2207664741c25627d7621e006c2ce80d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/global.pri | 1 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 170 | ||||
-rw-r--r-- | src/corelib/global/qsystemdetection.h | 222 |
3 files changed, 225 insertions, 168 deletions
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index fca9969db0..ded3e4db57 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -2,6 +2,7 @@ HEADERS += \ global/qglobal.h \ + global/qsystemdetection.h \ global/qnamespace.h \ global/qendian.h \ global/qnumeric_p.h \ diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index c92336f95c..6cb3cc2f44 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -62,6 +62,8 @@ #include <QtCore/qconfig.h> #endif +#include <QtCore/qsystemdetection.h> + #ifdef __cplusplus #ifndef QT_NO_STL @@ -140,181 +142,13 @@ namespace QT_NAMESPACE {} #endif /* __cplusplus */ -#if defined(Q_OS_MAC) && !defined(Q_CC_INTEL) -#define QT_BEGIN_HEADER extern "C++" { -#define QT_END_HEADER } -#else #define QT_BEGIN_HEADER #define QT_END_HEADER -#endif - -/* - The operating system, must be one of: (Q_OS_x) - - DARWIN - Darwin OS (synonym for Q_OS_MAC) - MSDOS - MS-DOS and Windows - OS2 - OS/2 - OS2EMX - XFree86 on OS/2 (not PM) - WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) - WINCE - WinCE (Windows CE 5.0) - CYGWIN - Cygwin - SOLARIS - Sun Solaris - HPUX - HP-UX - ULTRIX - DEC Ultrix - LINUX - Linux - FREEBSD - FreeBSD - NETBSD - NetBSD - OPENBSD - OpenBSD - BSDI - BSD/OS - IRIX - SGI Irix - OSF - HP Tru64 UNIX - SCO - SCO OpenServer 5 - UNIXWARE - UnixWare 7, Open UNIX 8 - AIX - AIX - HURD - GNU Hurd - DGUX - DG/UX - RELIANT - Reliant UNIX - DYNIX - DYNIX/ptx - QNX - QNX - QNX6 - QNX RTP 6.1 - LYNX - LynxOS - BSD4 - Any BSD 4.4 system - UNIX - Any UNIX BSD/SYSV system -*/ - -#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) -# define Q_OS_DARWIN -# define Q_OS_BSD4 -# ifdef __LP64__ -# define Q_OS_DARWIN64 -# else -# define Q_OS_DARWIN32 -# endif -#elif defined(__CYGWIN__) -# define Q_OS_CYGWIN -#elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) -# define Q_OS_WIN32 -# define Q_OS_WIN64 -#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) -# if defined(WINCE) || defined(_WIN32_WCE) -# define Q_OS_WINCE -# else -# define Q_OS_WIN32 -# endif -#elif defined(__sun) || defined(sun) -# define Q_OS_SOLARIS -#elif defined(hpux) || defined(__hpux) -# define Q_OS_HPUX -#elif defined(__ultrix) || defined(ultrix) -# define Q_OS_ULTRIX -#elif defined(sinix) -# define Q_OS_RELIANT -#elif defined(__native_client__) -# define Q_OS_NACL -#elif defined(__linux__) || defined(__linux) -# define Q_OS_LINUX -#elif defined(__FreeBSD__) || defined(__DragonFly__) -# define Q_OS_FREEBSD -# define Q_OS_BSD4 -#elif defined(__NetBSD__) -# define Q_OS_NETBSD -# define Q_OS_BSD4 -#elif defined(__OpenBSD__) -# define Q_OS_OPENBSD -# define Q_OS_BSD4 -#elif defined(__bsdi__) -# define Q_OS_BSDI -# define Q_OS_BSD4 -#elif defined(__sgi) -# define Q_OS_IRIX -#elif defined(__osf__) -# define Q_OS_OSF -#elif defined(_AIX) -# define Q_OS_AIX -#elif defined(__Lynx__) -# define Q_OS_LYNX -#elif defined(__GNU__) -# define Q_OS_HURD -#elif defined(__DGUX__) -# define Q_OS_DGUX -#elif defined(__QNXNTO__) -# define Q_OS_QNX -#elif defined(_SEQUENT_) -# define Q_OS_DYNIX -#elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */ -# define Q_OS_SCO -#elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */ -# define Q_OS_UNIXWARE -#elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */ -# define Q_OS_UNIXWARE -#elif defined(__INTEGRITY) -# define Q_OS_INTEGRITY -#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */ -# define Q_OS_VXWORKS -#elif defined(__MAKEDEPEND__) -#else -# error "Qt has not been ported to this OS - see http://www.qt-project.org/" -#endif - -#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) -# define Q_OS_WIN -#endif - -#if defined(Q_OS_DARWIN) -# define Q_OS_MAC -# define Q_OS_MACX /* Q_OS_MACX is only for compatibility.*/ -# if defined(Q_OS_DARWIN64) -# define Q_OS_MAC64 -# elif defined(Q_OS_DARWIN32) -# define Q_OS_MAC32 -# endif -#endif - -#if defined(Q_OS_WIN) -# undef Q_OS_UNIX -#elif !defined(Q_OS_UNIX) -# define Q_OS_UNIX -#endif #if defined(Q_OS_DARWIN) && !defined(QT_LARGEFILE_SUPPORT) # define QT_LARGEFILE_SUPPORT 64 #endif -#ifdef Q_OS_DARWIN -# ifdef MAC_OS_X_VERSION_MIN_REQUIRED -# undef MAC_OS_X_VERSION_MIN_REQUIRED -# endif -# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4 -# include <AvailabilityMacros.h> -# if !defined(MAC_OS_X_VERSION_10_3) -# define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1 -# endif -# if !defined(MAC_OS_X_VERSION_10_4) -# define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1 -# endif -# if !defined(MAC_OS_X_VERSION_10_5) -# define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1 -# endif -# if !defined(MAC_OS_X_VERSION_10_6) -# define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1 -# endif -# if !defined(MAC_OS_X_VERSION_10_7) -# define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1 -# endif -# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_7) -# warning "This version of Mac OS X is unsupported" -# endif -#endif - -#ifdef __LSB_VERSION__ -# if __LSB_VERSION__ < 40 -# error "This version of the Linux Standard Base is unsupported" -# endif -#ifndef QT_LINUXBASE -# define QT_LINUXBASE -#endif -#endif - /* The compiler, must be one of: (Q_CC_x) diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h new file mode 100644 index 0000000000..11df62bcef --- /dev/null +++ b/src/corelib/global/qsystemdetection.h @@ -0,0 +1,222 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYSTEMDETECTION_H +#define QSYSTEMDETECTION_H + +#if 0 +// header is automatically included in qglobal.h +#pragma qt_no_master_include + +// silence syncqt warnings (QT_* macros are not yet defined) +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_END_NAMESPACE +QT_END_HEADER + +#pragma qt_sync_stop_processing +#endif + +/* + The operating system, must be one of: (Q_OS_x) + + DARWIN - Darwin OS (synonym for Q_OS_MAC) + MSDOS - MS-DOS and Windows + OS2 - OS/2 + OS2EMX - XFree86 on OS/2 (not PM) + WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) + WINCE - WinCE (Windows CE 5.0) + CYGWIN - Cygwin + SOLARIS - Sun Solaris + HPUX - HP-UX + ULTRIX - DEC Ultrix + LINUX - Linux + FREEBSD - FreeBSD + NETBSD - NetBSD + OPENBSD - OpenBSD + BSDI - BSD/OS + IRIX - SGI Irix + OSF - HP Tru64 UNIX + SCO - SCO OpenServer 5 + UNIXWARE - UnixWare 7, Open UNIX 8 + AIX - AIX + HURD - GNU Hurd + DGUX - DG/UX + RELIANT - Reliant UNIX + DYNIX - DYNIX/ptx + QNX - QNX + QNX6 - QNX RTP 6.1 + LYNX - LynxOS + BSD4 - Any BSD 4.4 system + UNIX - Any UNIX BSD/SYSV system +*/ + +#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) +# define Q_OS_DARWIN +# define Q_OS_BSD4 +# ifdef __LP64__ +# define Q_OS_DARWIN64 +# else +# define Q_OS_DARWIN32 +# endif +#elif defined(__CYGWIN__) +# define Q_OS_CYGWIN +#elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) +# define Q_OS_WIN32 +# define Q_OS_WIN64 +#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) +# if defined(WINCE) || defined(_WIN32_WCE) +# define Q_OS_WINCE +# else +# define Q_OS_WIN32 +# endif +#elif defined(__sun) || defined(sun) +# define Q_OS_SOLARIS +#elif defined(hpux) || defined(__hpux) +# define Q_OS_HPUX +#elif defined(__ultrix) || defined(ultrix) +# define Q_OS_ULTRIX +#elif defined(sinix) +# define Q_OS_RELIANT +#elif defined(__native_client__) +# define Q_OS_NACL +#elif defined(__linux__) || defined(__linux) +# define Q_OS_LINUX +#elif defined(__FreeBSD__) || defined(__DragonFly__) +# define Q_OS_FREEBSD +# define Q_OS_BSD4 +#elif defined(__NetBSD__) +# define Q_OS_NETBSD +# define Q_OS_BSD4 +#elif defined(__OpenBSD__) +# define Q_OS_OPENBSD +# define Q_OS_BSD4 +#elif defined(__bsdi__) +# define Q_OS_BSDI +# define Q_OS_BSD4 +#elif defined(__sgi) +# define Q_OS_IRIX +#elif defined(__osf__) +# define Q_OS_OSF +#elif defined(_AIX) +# define Q_OS_AIX +#elif defined(__Lynx__) +# define Q_OS_LYNX +#elif defined(__GNU__) +# define Q_OS_HURD +#elif defined(__DGUX__) +# define Q_OS_DGUX +#elif defined(__QNXNTO__) +# define Q_OS_QNX +#elif defined(_SEQUENT_) +# define Q_OS_DYNIX +#elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */ +# define Q_OS_SCO +#elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */ +# define Q_OS_UNIXWARE +#elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */ +# define Q_OS_UNIXWARE +#elif defined(__INTEGRITY) +# define Q_OS_INTEGRITY +#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */ +# define Q_OS_VXWORKS +#elif defined(__MAKEDEPEND__) +#else +# error "Qt has not been ported to this OS - see http://www.qt-project.org/" +#endif + +#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) +# define Q_OS_WIN +#endif + +#if defined(Q_OS_DARWIN) +# define Q_OS_MAC +# define Q_OS_MACX /* Q_OS_MACX is only for compatibility.*/ +# if defined(Q_OS_DARWIN64) +# define Q_OS_MAC64 +# elif defined(Q_OS_DARWIN32) +# define Q_OS_MAC32 +# endif +#endif + +#if defined(Q_OS_WIN) +# undef Q_OS_UNIX +#elif !defined(Q_OS_UNIX) +# define Q_OS_UNIX +#endif + +#ifdef Q_OS_DARWIN +# ifdef MAC_OS_X_VERSION_MIN_REQUIRED +# undef MAC_OS_X_VERSION_MIN_REQUIRED +# endif +# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4 +# include <AvailabilityMacros.h> +# if !defined(MAC_OS_X_VERSION_10_3) +# define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1 +# endif +# if !defined(MAC_OS_X_VERSION_10_4) +# define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1 +# endif +# if !defined(MAC_OS_X_VERSION_10_5) +# define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1 +# endif +# if !defined(MAC_OS_X_VERSION_10_6) +# define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1 +# endif +# if !defined(MAC_OS_X_VERSION_10_7) +# define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1 +# endif +# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_7) +# warning "This version of Mac OS X is unsupported" +# endif +#endif + +#ifdef __LSB_VERSION__ +# if __LSB_VERSION__ < 40 +# error "This version of the Linux Standard Base is unsupported" +# endif +#ifndef QT_LINUXBASE +# define QT_LINUXBASE +#endif +#endif + +#endif // QSYSTEMDETECTION_H |