1/****************************************************************************
2**
3** Copyright (C) 2019 The Qt Company Ltd.
4** Copyright (C) 2019 Intel Corporation.
5** Contact: https://www.qt.io/licensing/
6**
7** This file is part of the QtCore module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial License Usage
11** Licensees holding valid commercial Qt licenses may use this file in
12** accordance with the commercial license agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and The Qt Company. For licensing terms
15** and conditions see https://www.qt.io/terms-conditions. For further
16** information use the contact form at https://www.qt.io/contact-us.
17**
18** GNU Lesser General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU Lesser
20** General Public License version 3 as published by the Free Software
21** Foundation and appearing in the file LICENSE.LGPL3 included in the
22** packaging of this file. Please review the following information to
23** ensure the GNU Lesser General Public License version 3 requirements
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25**
26** GNU General Public License Usage
27** Alternatively, this file may be used under the terms of the GNU
28** General Public License version 2.0 or (at your option) the GNU General
29** Public license version 3 or any later version approved by the KDE Free
30** Qt Foundation. The licenses are as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32** included in the packaging of this file. Please review the following
33** information to ensure the GNU General Public License requirements will
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35** https://www.gnu.org/licenses/gpl-3.0.html.
36**
37** $QT_END_LICENSE$
38**
39****************************************************************************/
40
41#ifndef QGLOBAL_H
42# include <QtCore/qglobal.h>
43#endif
44
45#ifndef QSYSTEMDETECTION_H
46#define QSYSTEMDETECTION_H
47
48/*
49 The operating system, must be one of: (Q_OS_x)
50
51 DARWIN - Any Darwin system (macOS, iOS, watchOS, tvOS)
52 MACOS - macOS
53 IOS - iOS
54 WATCHOS - watchOS
55 TVOS - tvOS
56 WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)
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 WEBOS - LG WebOS
75
76 The following operating systems have variants:
77 LINUX - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android
78 - only Q_OS_LINUX is defined if building for other Linux systems
79 MACOS - both Q_OS_BSD4 and Q_OS_IOS are defined when building for iOS
80 - both Q_OS_BSD4 and Q_OS_MACOS are defined when building for macOS
81 FREEBSD - Q_OS_FREEBSD is defined only when building for FreeBSD with a BSD userland
82 - Q_OS_FREEBSD_KERNEL is always defined on FreeBSD, even if the userland is from GNU
83*/
84
85#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
86# include <TargetConditionals.h>
87# if defined(TARGET_OS_MAC) && TARGET_OS_MAC
88# define Q_OS_DARWIN
89# define Q_OS_BSD4
90# ifdef __LP64__
91# define Q_OS_DARWIN64
92# else
93# define Q_OS_DARWIN32
94# endif
95# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
96# define QT_PLATFORM_UIKIT
97# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
98# define Q_OS_WATCHOS
99# elif defined(TARGET_OS_TV) && TARGET_OS_TV
100# define Q_OS_TVOS
101# else
102# // TARGET_OS_IOS is only available in newer SDKs,
103# // so assume any other iOS-based platform is iOS for now
104# define Q_OS_IOS
105# endif
106# else
107# // TARGET_OS_OSX is only available in newer SDKs,
108# // so assume any non iOS-based platform is macOS for now
109# define Q_OS_MACOS
110# endif
111# else
112# error "Qt has not been ported to this Apple platform - see http://www.qt.io/developers"
113# endif
114#elif defined(__WEBOS__)
115# define Q_OS_WEBOS
116# define Q_OS_LINUX
117#elif defined(__ANDROID__) || defined(ANDROID)
118# define Q_OS_ANDROID
119# define Q_OS_LINUX
120#elif defined(__CYGWIN__)
121# define Q_OS_CYGWIN
122#elif !defined(SAG_COM) && (!defined(WINAPI_FAMILY) || WINAPI_FAMILY==WINAPI_FAMILY_DESKTOP_APP) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
123# define Q_OS_WIN32
124# define Q_OS_WIN64
125#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
126# define Q_OS_WIN32
127#elif defined(__sun) || defined(sun)
128# define Q_OS_SOLARIS
129#elif defined(hpux) || defined(__hpux)
130# define Q_OS_HPUX
131#elif defined(__native_client__)
132# define Q_OS_NACL
133#elif defined(__EMSCRIPTEN__)
134# define Q_OS_WASM
135#elif defined(__linux__) || defined(__linux)
136# define Q_OS_LINUX
137#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
138# ifndef __FreeBSD_kernel__
139# define Q_OS_FREEBSD
140# endif
141# define Q_OS_FREEBSD_KERNEL
142# define Q_OS_BSD4
143#elif defined(__NetBSD__)
144# define Q_OS_NETBSD
145# define Q_OS_BSD4
146#elif defined(__OpenBSD__)
147# define Q_OS_OPENBSD
148# define Q_OS_BSD4
149#elif defined(__INTERIX)
150# define Q_OS_INTERIX
151# define Q_OS_BSD4
152#elif defined(_AIX)
153# define Q_OS_AIX
154#elif defined(__Lynx__)
155# define Q_OS_LYNX
156#elif defined(__GNU__)
157# define Q_OS_HURD
158#elif defined(__QNXNTO__)
159# define Q_OS_QNX
160#elif defined(__INTEGRITY)
161# define Q_OS_INTEGRITY
162#elif defined(__rtems__)
163# define Q_OS_RTEMS
164#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */
165# define Q_OS_VXWORKS
166#elif defined(__HAIKU__)
167# define Q_OS_HAIKU
168#elif defined(__MAKEDEPEND__)
169#else
170# error "Qt has not been ported to this OS - see http://www.qt-project.org/"
171#endif
172
173#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
174# define Q_OS_WINDOWS
175# define Q_OS_WIN
176// On Windows, pointers to dllimport'ed variables are not constant expressions,
177// so to keep to certain initializations (like QMetaObject) constexpr, we need
178// to use functions instead.
179# define QT_NO_DATA_RELOCATION
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_10_15)
234# define __MAC_10_15 101500
235# endif
236# if !defined(__MAC_10_16)
237# define __MAC_10_16 101600
238# endif
239# if !defined(MAC_OS_X_VERSION_10_11)
240# define MAC_OS_X_VERSION_10_11 __MAC_10_11
241# endif
242# if !defined(MAC_OS_X_VERSION_10_12)
243# define MAC_OS_X_VERSION_10_12 __MAC_10_12
244# endif
245# if !defined(MAC_OS_X_VERSION_10_13)
246# define MAC_OS_X_VERSION_10_13 __MAC_10_13
247# endif
248# if !defined(MAC_OS_X_VERSION_10_14)
249# define MAC_OS_X_VERSION_10_14 __MAC_10_14
250# endif
251# if !defined(MAC_OS_X_VERSION_10_15)
252# define MAC_OS_X_VERSION_10_15 __MAC_10_15
253# endif
254# if !defined(MAC_OS_X_VERSION_10_16)
255# define MAC_OS_X_VERSION_10_16 __MAC_10_16
256# endif
257#
258# if !defined(__IPHONE_10_0)
259# define __IPHONE_10_0 100000
260# endif
261# if !defined(__IPHONE_10_1)
262# define __IPHONE_10_1 100100
263# endif
264# if !defined(__IPHONE_10_2)
265# define __IPHONE_10_2 100200
266# endif
267# if !defined(__IPHONE_10_3)
268# define __IPHONE_10_3 100300
269# endif
270# if !defined(__IPHONE_11_0)
271# define __IPHONE_11_0 110000
272# endif
273# if !defined(__IPHONE_12_0)
274# define __IPHONE_12_0 120000
275# endif
276#endif
277
278#ifdef __LSB_VERSION__
279# if __LSB_VERSION__ < 40
280# error "This version of the Linux Standard Base is unsupported"
281# endif
282#ifndef QT_LINUXBASE
283# define QT_LINUXBASE
284#endif
285#endif
286
287#endif // QSYSTEMDETECTION_H
288