1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtCore module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QGLOBAL_H
41# include <QtCore/qglobal.h>
42#endif
43
44#ifndef QSYSTEMDETECTION_H
45#define QSYSTEMDETECTION_H
46
47/*
48 The operating system, must be one of: (Q_OS_x)
49
50 DARWIN - Any Darwin system (macOS, iOS, watchOS, tvOS)
51 MACOS - macOS
52 IOS - iOS
53 WATCHOS - watchOS
54 TVOS - tvOS
55 WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)
56 WINRT - WinRT (Windows Runtime)
57 CYGWIN - Cygwin
58 SOLARIS - Sun Solaris
59 HPUX - HP-UX
60 LINUX - Linux [has variants]
61 FREEBSD - FreeBSD [has variants]
62 NETBSD - NetBSD
63 OPENBSD - OpenBSD
64 INTERIX - Interix
65 AIX - AIX
66 HURD - GNU Hurd
67 QNX - QNX [has variants]
68 QNX6 - QNX RTP 6.1
69 LYNX - LynxOS
70 BSD4 - Any BSD 4.4 system
71 UNIX - Any UNIX BSD/SYSV system
72 ANDROID - Android platform
73 HAIKU - Haiku
74
75 The following operating systems have variants:
76 LINUX - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android
77 - only Q_OS_LINUX is defined if building for other Linux systems
78 FREEBSD - Q_OS_FREEBSD is defined only when building for FreeBSD with a BSD userland
79 - Q_OS_FREEBSD_KERNEL is always defined on FreeBSD, even if the userland is from GNU
80*/
81
82#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
83# include <TargetConditionals.h>
84# if defined(TARGET_OS_MAC) && TARGET_OS_MAC
85# define Q_OS_DARWIN
86# define Q_OS_BSD4
87# ifdef __LP64__
88# define Q_OS_DARWIN64
89# else
90# define Q_OS_DARWIN32
91# endif
92# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
93# define QT_PLATFORM_UIKIT
94# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
95# define Q_OS_WATCHOS
96# elif defined(TARGET_OS_TV) && TARGET_OS_TV
97# define Q_OS_TVOS
98# else
99# // TARGET_OS_IOS is only available in newer SDKs,
100# // so assume any other iOS-based platform is iOS for now
101# define Q_OS_IOS
102# endif
103# else
104# // TARGET_OS_OSX is only available in newer SDKs,
105# // so assume any non iOS-based platform is macOS for now
106# define Q_OS_MACOS
107# endif
108# else
109# error "Qt has not been ported to this Apple platform - see http://www.qt.io/developers"
110# endif
111#elif defined(__ANDROID__) || defined(ANDROID)
112# define Q_OS_ANDROID
113# define Q_OS_LINUX
114#elif defined(__CYGWIN__)
115# define Q_OS_CYGWIN
116#elif !defined(SAG_COM) && (!defined(WINAPI_FAMILY) || WINAPI_FAMILY==WINAPI_FAMILY_DESKTOP_APP) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
117# define Q_OS_WIN32
118# define Q_OS_WIN64
119#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
120# if defined(WINAPI_FAMILY)
121# ifndef WINAPI_FAMILY_PC_APP
122# define WINAPI_FAMILY_PC_APP WINAPI_FAMILY_APP
123# endif
124# if defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
125# define Q_OS_WINRT
126# elif WINAPI_FAMILY==WINAPI_FAMILY_PC_APP
127# define Q_OS_WINRT
128# else
129# define Q_OS_WIN32
130# endif
131# else
132# define Q_OS_WIN32
133# endif
134#elif defined(__sun) || defined(sun)
135# define Q_OS_SOLARIS
136#elif defined(hpux) || defined(__hpux)
137# define Q_OS_HPUX
138#elif defined(__native_client__)
139# define Q_OS_NACL
140#elif defined(__EMSCRIPTEN__)
141# define Q_OS_WASM
142#elif defined(__linux__) || defined(__linux)
143# define Q_OS_LINUX
144#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
145# ifndef __FreeBSD_kernel__
146# define Q_OS_FREEBSD
147# endif
148# define Q_OS_FREEBSD_KERNEL
149# define Q_OS_BSD4
150#elif defined(__NetBSD__)
151# define Q_OS_NETBSD
152# define Q_OS_BSD4
153#elif defined(__OpenBSD__)
154# define Q_OS_OPENBSD
155# define Q_OS_BSD4
156#elif defined(__INTERIX)
157# define Q_OS_INTERIX
158# define Q_OS_BSD4
159#elif defined(_AIX)
160# define Q_OS_AIX
161#elif defined(__Lynx__)
162# define Q_OS_LYNX
163#elif defined(__GNU__)
164# define Q_OS_HURD
165#elif defined(__QNXNTO__)
166# define Q_OS_QNX
167#elif defined(__INTEGRITY)
168# define Q_OS_INTEGRITY
169#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */
170# define Q_OS_VXWORKS
171#elif defined(__HAIKU__)
172# define Q_OS_HAIKU
173#elif defined(__MAKEDEPEND__)
174#else
175# error "Qt has not been ported to this OS - see http://www.qt-project.org/"
176#endif
177
178#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT)
179# define Q_OS_WIN
180#endif
181
182#if defined(Q_OS_WIN)
183# undef Q_OS_UNIX
184#elif !defined(Q_OS_UNIX)
185# define Q_OS_UNIX
186#endif
187
188// Compatibility synonyms
189#ifdef Q_OS_DARWIN
190#define Q_OS_MAC
191#endif
192#ifdef Q_OS_DARWIN32
193#define Q_OS_MAC32
194#endif
195#ifdef Q_OS_DARWIN64
196#define Q_OS_MAC64
197#endif
198#ifdef Q_OS_MACOS
199#define Q_OS_MACX
200#define Q_OS_OSX
201#endif
202
203#ifdef Q_OS_DARWIN
204# include <Availability.h>
205# include <AvailabilityMacros.h>
206#
207# ifdef Q_OS_MACOS
208# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
209# undef __MAC_OS_X_VERSION_MIN_REQUIRED
210# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6
211# endif
212# if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
213# undef MAC_OS_X_VERSION_MIN_REQUIRED
214# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
215# endif
216# endif
217#
218# // Numerical checks are preferred to named checks, but to be safe
219# // we define the missing version names in case Qt uses them.
220#
221# if !defined(__MAC_10_11)
222# define __MAC_10_11 101100
223# endif
224# if !defined(__MAC_10_12)
225# define __MAC_10_12 101200
226# endif
227# if !defined(__MAC_10_13)
228# define __MAC_10_13 101300
229# endif
230# if !defined(__MAC_10_14)
231# define __MAC_10_14 101400
232# endif
233# if !defined(MAC_OS_X_VERSION_10_11)
234# define MAC_OS_X_VERSION_10_11 101100
235# endif
236# if !defined(MAC_OS_X_VERSION_10_12)
237# define MAC_OS_X_VERSION_10_12 101200
238# endif
239# if !defined(MAC_OS_X_VERSION_10_13)
240# define MAC_OS_X_VERSION_10_13 101300
241# endif
242# if !defined(MAC_OS_X_VERSION_10_14)
243# define MAC_OS_X_VERSION_10_14 101400
244# endif
245#
246# if !defined(__IPHONE_10_0)
247# define __IPHONE_10_0 100000
248# endif
249# if !defined(__IPHONE_10_1)
250# define __IPHONE_10_1 100100
251# endif
252# if !defined(__IPHONE_10_2)
253# define __IPHONE_10_2 100200
254# endif
255# if !defined(__IPHONE_10_3)
256# define __IPHONE_10_3 100300
257# endif
258# if !defined(__IPHONE_11_0)
259# define __IPHONE_11_0 110000
260# endif
261# if !defined(__IPHONE_12_0)
262# define __IPHONE_12_0 120000
263# endif
264#endif
265
266#ifdef __LSB_VERSION__
267# if __LSB_VERSION__ < 40
268# error "This version of the Linux Standard Base is unsupported"
269# endif
270#ifndef QT_LINUXBASE
271# define QT_LINUXBASE
272#endif
273#endif
274
275#endif // QSYSTEMDETECTION_H
276