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(__linux__) || defined(__linux)
141# define Q_OS_LINUX
142#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
143# ifndef __FreeBSD_kernel__
144# define Q_OS_FREEBSD
145# endif
146# define Q_OS_FREEBSD_KERNEL
147# define Q_OS_BSD4
148#elif defined(__NetBSD__)
149# define Q_OS_NETBSD
150# define Q_OS_BSD4
151#elif defined(__OpenBSD__)
152# define Q_OS_OPENBSD
153# define Q_OS_BSD4
154#elif defined(__INTERIX)
155# define Q_OS_INTERIX
156# define Q_OS_BSD4
157#elif defined(_AIX)
158# define Q_OS_AIX
159#elif defined(__Lynx__)
160# define Q_OS_LYNX
161#elif defined(__GNU__)
162# define Q_OS_HURD
163#elif defined(__QNXNTO__)
164# define Q_OS_QNX
165#elif defined(__INTEGRITY)
166# define Q_OS_INTEGRITY
167#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */
168# define Q_OS_VXWORKS
169#elif defined(__HAIKU__)
170# define Q_OS_HAIKU
171#elif defined(__MAKEDEPEND__)
172#else
173# error "Qt has not been ported to this OS - see http://www.qt-project.org/"
174#endif
175
176#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT)
177# define Q_OS_WIN
178#endif
179
180#if defined(Q_OS_WIN)
181# undef Q_OS_UNIX
182#elif !defined(Q_OS_UNIX)
183# define Q_OS_UNIX
184#endif
185
186// Compatibility synonyms
187#ifdef Q_OS_DARWIN
188#define Q_OS_MAC
189#endif
190#ifdef Q_OS_DARWIN32
191#define Q_OS_MAC32
192#endif
193#ifdef Q_OS_DARWIN64
194#define Q_OS_MAC64
195#endif
196#ifdef Q_OS_MACOS
197#define Q_OS_MACX
198#define Q_OS_OSX
199#endif
200
201#ifdef Q_OS_DARWIN
202# include <Availability.h>
203# include <AvailabilityMacros.h>
204#
205# ifdef Q_OS_MACOS
206# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
207# undef __MAC_OS_X_VERSION_MIN_REQUIRED
208# define __MAC_OS_X_VERSION_MIN_REQUIRED __MAC_10_6
209# endif
210# if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
211# undef MAC_OS_X_VERSION_MIN_REQUIRED
212# define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_6
213# endif
214# endif
215#
216# // Numerical checks are preferred to named checks, but to be safe
217# // we define the missing version names in case Qt uses them.
218#
219# if !defined(__MAC_10_7)
220# define __MAC_10_7 1070
221# endif
222# if !defined(__MAC_10_8)
223# define __MAC_10_8 1080
224# endif
225# if !defined(__MAC_10_9)
226# define __MAC_10_9 1090
227# endif
228# if !defined(__MAC_10_10)
229# define __MAC_10_10 101000
230# endif
231# if !defined(__MAC_10_11)
232# define __MAC_10_11 101100
233# endif
234# if !defined(__MAC_10_12)
235# define __MAC_10_12 101200
236# endif
237# if !defined(__MAC_10_13)
238# define __MAC_10_13 101300
239# endif
240# if !defined(MAC_OS_X_VERSION_10_7)
241# define MAC_OS_X_VERSION_10_7 1070
242# endif
243# if !defined(MAC_OS_X_VERSION_10_8)
244# define MAC_OS_X_VERSION_10_8 1080
245# endif
246# if !defined(MAC_OS_X_VERSION_10_9)
247# define MAC_OS_X_VERSION_10_9 1090
248# endif
249# if !defined(MAC_OS_X_VERSION_10_10)
250# define MAC_OS_X_VERSION_10_10 101000
251# endif
252# if !defined(MAC_OS_X_VERSION_10_11)
253# define MAC_OS_X_VERSION_10_11 101100
254# endif
255# if !defined(MAC_OS_X_VERSION_10_12)
256# define MAC_OS_X_VERSION_10_12 101200
257# endif
258# if !defined(MAC_OS_X_VERSION_10_13)
259# define MAC_OS_X_VERSION_10_13 101300
260# endif
261#
262# if !defined(__IPHONE_4_3)
263# define __IPHONE_4_3 40300
264# endif
265# if !defined(__IPHONE_5_0)
266# define __IPHONE_5_0 50000
267# endif
268# if !defined(__IPHONE_5_1)
269# define __IPHONE_5_1 50100
270# endif
271# if !defined(__IPHONE_6_0)
272# define __IPHONE_6_0 60000
273# endif
274# if !defined(__IPHONE_6_1)
275# define __IPHONE_6_1 60100
276# endif
277# if !defined(__IPHONE_7_0)
278# define __IPHONE_7_0 70000
279# endif
280# if !defined(__IPHONE_7_1)
281# define __IPHONE_7_1 70100
282# endif
283# if !defined(__IPHONE_8_0)
284# define __IPHONE_8_0 80000
285# endif
286# if !defined(__IPHONE_8_1)
287# define __IPHONE_8_1 80100
288# endif
289# if !defined(__IPHONE_8_2)
290# define __IPHONE_8_2 80200
291# endif
292# if !defined(__IPHONE_8_3)
293# define __IPHONE_8_3 80300
294# endif
295# if !defined(__IPHONE_8_4)
296# define __IPHONE_8_4 80400
297# endif
298# if !defined(__IPHONE_9_0)
299# define __IPHONE_9_0 90000
300# endif
301# if !defined(__IPHONE_9_1)
302# define __IPHONE_9_1 90100
303# endif
304# if !defined(__IPHONE_9_2)
305# define __IPHONE_9_2 90200
306# endif
307# if !defined(__IPHONE_9_3)
308# define __IPHONE_9_3 90300
309# endif
310# if !defined(__IPHONE_10_0)
311# define __IPHONE_10_0 100000
312# endif
313# if !defined(__IPHONE_10_1)
314# define __IPHONE_10_1 100100
315# endif
316# if !defined(__IPHONE_10_2)
317# define __IPHONE_10_2 100200
318# endif
319# if !defined(__IPHONE_10_3)
320# define __IPHONE_10_3 100300
321# endif
322# if !defined(__IPHONE_11_0)
323# define __IPHONE_11_0 110000
324# endif
325#endif
326
327#ifdef __LSB_VERSION__
328# if __LSB_VERSION__ < 40
329# error "This version of the Linux Standard Base is unsupported"
330# endif
331#ifndef QT_LINUXBASE
332# define QT_LINUXBASE
333#endif
334#endif
335
336#endif // QSYSTEMDETECTION_H
337