]> git.saurik.com Git - wxWidgets.git/blame - include/wx/platform.h
Patch [665886]: Fix smapi.cpp to support new for loop scoping.
[wxWidgets.git] / include / wx / platform.h
CommitLineData
78340847
VZ
1/*
2 * Name: wx/platform.h
3 * Purpose: define the OS and compiler identification macros
4 * Author: Vadim Zeitlin
5 * Modified by:
6 * Created: 29.10.01 (extracted from wx/defs.h)
7 * RCS-ID: $Id$
8 * Copyright: (c) 1997-2001 wxWindows team
9 * Licence: wxWindows license
10 */
11
12/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
13
14#ifndef _WX_PLATFORM_H_
15#define _WX_PLATFORM_H_
16
17/*
18 first define Windows symbols if they're not defined on the command line: we
19 can autodetect everything we need if _WIN32 is defined
20 */
d66dcb60
MB
21#if defined(__CYGWIN32__) && !defined(__WXMOTIF__) && !defined(__WXGTK__) \
22 && !defined(__WXX11__)
23 /* for Cygwin, default to wxMSW unless otherwise specified */
24 #ifndef __WXMSW__
25 #define __WXMSW__
26 #endif
27
28 #ifndef _WIN32
29 #define _WIN32
30 #endif
31
32 #ifndef WIN32
33 #define WIN32
34 #endif
35#endif
36
158b6688 37#if defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)
78340847
VZ
38 #ifndef __WXMSW__
39 #define __WXMSW__
40 #endif
41
42 #ifndef __WIN32__
43 #define __WIN32__
44 #endif
45
46 /* Win95 means Win95-style UI, i.e. Win9x/NT 4+ */
47 #if !defined(__WIN95__) && defined(WINVER) && (WINVER >= 0x0400)
48 #define __WIN95__
49 #endif
50#endif /* Win32 */
51
52#if defined(__WXMSW__) || defined(__WIN32__)
53 #if !defined(__WINDOWS__)
54 #define __WINDOWS__
55 #endif
56#endif
57
b4da152e 58#ifdef __WINE__
78340847
VZ
59 #ifndef __WIN95__
60 #define __WIN95__
61 #endif
78340847
VZ
62#endif /* WINE */
63
64#if defined(TWIN32) && !defined(__TWIN32__)
65 #define __TWIN32__
66#endif /* Twin32 */
67
68/*
69 Include wx/setup.h for the Unix platform defines generated by configure and
70 the library compilation options
71 */
72#include "wx/setup.h"
73
74/* check the consistency of the settings in setup.h */
75#include "wx/chkconf.h"
76
77/*
78 old C++ headers (like <iostream.h>) declare classes in the global namespace
79 while the new, standard ones (like <iostream>) do it in std:: namespace
80
81 using this macro allows constuctions like "wxSTD iostream" to work in
82 either case
83 */
84#if !wxUSE_IOSTREAMH
85 #define wxSTD std::
86#else
87 #define wxSTD
88#endif
89
90/*
865c589e
VS
91 OS: first of all, test for MS-DOS platform. We must do this before testing
92 for Unix, because DJGPP compiler defines __unix__ under MS-DOS
93 */
94#if defined(__GO32__) || defined(__DJGPP__) || defined(__DOS__)
95 #ifndef __DOS__
96 #define __DOS__
97 #endif
98 /* size_t is the same as unsigned int for Watcom 11 compiler, */
99 /* so define it if it hadn't been done by configure yet */
100 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
101 #ifdef __WATCOMC__
102 #define wxSIZE_T_IS_UINT
103 #endif
104 #ifdef __DJGPP__
105 #define wxSIZE_T_IS_ULONG
106 #endif
107 #endif
108
109/*
110 OS: then test for generic Unix defines, then for particular flavours and
78340847
VZ
111 finally for Unix-like systems
112 */
865c589e
VS
113#elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \
114 defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
115 defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \
116 defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
78340847
VZ
117
118 #define __UNIX_LIKE__
119
120 /* Helps SGI compilation, apparently */
121 #ifdef __SGI__
122 #ifdef __GNUG__
123 #define __need_wchar_t
124 #else /* !gcc */
125 /*
126 Note I use the term __SGI_CC__ for both cc and CC, its not a good
127 idea to mix gcc and cc/CC, the name mangling is different
128 */
129 #define __SGI_CC__
130 #endif /* gcc/!gcc */
131 #endif /* SGI */
132
133 #if defined(sun) || defined(__SUN__)
134 #ifndef __GNUG__
135 #ifndef __SUNCC__
136 #define __SUNCC__
137 #endif /* Sun CC */
138 #endif
139 #endif /* Sun */
140
141 #ifdef __EMX__
142 #define OS2EMX_PLAIN_CHAR
143 #endif
144
145 /* define __HPUX__ for HP-UX where standard macro is __hpux */
146 #if defined(__hpux) && !defined(__HPUX__)
147 #define __HPUX__
148 #endif /* HP-UX */
149
5283098e 150 #if defined(__CYGWIN__) || defined(__WINE__)
78340847
VZ
151 #if !defined(wxSIZE_T_IS_UINT)
152 #define wxSIZE_T_IS_UINT
153 #endif
154 #endif
155#elif defined(applec) || \
156 defined(THINK_C) || \
157 (defined(__MWERKS__) && !defined(__INTEL__))
158 /* MacOS */
26bea6ac
SC
159 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
160 #define wxSIZE_T_IS_ULONG
161 #endif
67087ab4 162#elif defined(__WXMAC__) && defined(__APPLE__)
78340847
VZ
163 /* Mac OS X */
164 #define __UNIX_LIKE__
165
67087ab4
GD
166 /*
167 These defines are needed when compiling using Project Builder
168 with a non generated setup0.h
169 */
170 #ifndef __UNIX__
171 #define __UNIX__ 1
172 #endif
173 #ifndef __BSD__
174 #define __BSD__ 1
175 #endif
176 #ifndef __DARWIN__
177 #define __DARWIN__ 1
178 #endif
179 #ifndef __POWERPC__
180 #define __POWERPC__ 1
181 #endif
182
26bea6ac
SC
183 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
184 #define wxSIZE_T_IS_ULONG
185 #endif
78340847
VZ
186 /*
187 Some code has been added to workaround defects(?) in the
67087ab4
GD
188 bundled gcc compiler. These corrections are identified by
189 __DARWIN__ for Darwin related corrections (wxMac, wxMotif)
78340847 190 */
78340847
VZ
191#elif defined(__OS2__)
192 #if defined(__IBMCPP__)
193 #define __VISAGEAVER__ __IBMCPP__
194 #endif
195 #ifndef __WXOS2__
196 #define __WXOS2__
197 #endif
198 #ifndef __WXPM__
199 #define __WXPM__
200 #endif
201
202 /* Place other OS/2 compiler environment defines here */
203 #if defined(__VISAGECPP__)
204 /* VisualAge is the only thing that understands _Optlink */
205 #define LINKAGEMODE _Optlink
206 #endif
207 #define wxSIZE_T_IS_UINT
c427acc8 208
78340847
VZ
209#else /* Windows */
210 #ifndef __WINDOWS__
211 #define __WINDOWS__
212 #endif /* Windows */
213
214 /* to be changed for Win64! */
215 #ifndef __WIN32__
216 #define __WIN16__
217 #endif
218
219 /*
220 define another standard symbol for Microsoft Visual C++: the standard
221 one (_MSC_VER) is also defined by Metrowerks compiler
222 */
223 #if defined(_MSC_VER) && !defined(__MWERKS__)
224 #define __VISUALC__ _MSC_VER
225 #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
226 #define __BORLANDC__
227 #elif defined(__WATCOMC__)
228 #elif defined(__SC__)
229 #define __SYMANTECC__
230 #endif /* compiler */
231
232 /* size_t is the same as unsigned int for all Windows compilers we know, */
233 /* so define it if it hadn't been done by configure yet */
234 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
235 #define wxSIZE_T_IS_UINT
236 #endif
237#endif /* OS */
238
239/*
240 if we're on a Unix system but didn't use configure (so that setup.h didn't
241 define __UNIX__), do define __UNIX__ now
242 */
243#if !defined(__UNIX__) && defined(__UNIX_LIKE__)
244 #define __UNIX__
245#endif /* Unix */
246
247#if defined(__HPUX__) && !defined(__WXGTK__)
248 #ifndef __WXMOTIF__
249 #define __WXMOTIF__
250 #endif /* __WXMOTIF__ */
251#endif
252
f79bd02d 253#if defined(__WXMOTIF__) || defined(__WXX11__)
78340847
VZ
254 #define __X__
255#endif
256
44893b87
VZ
257/*
258 This macro can be used to test the gcc version and can be used like this:
259
260 #if wxCHECK_GCC_VERSION(3, 1)
261 ... we have gcc 3.1 or later ...
262 #else
263 ... no gcc at all or gcc < 3.1 ...
264 #endif
265*/
266#define wxCHECK_GCC_VERSION( major, minor ) \
267 ( defined(__GNUC__) && defined(__GNUC_MINOR__) \
268 && ( ( __GNUC__ > (major) ) \
269 || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) )
270
78340847
VZ
271/*
272 This macro can be used to check that the version of mingw32 compiler is
273 at least maj.min
274 */
275#if defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || defined( __CYGWIN__ )
276 #include "wx/msw/gccpriv.h"
277#else
278 #undef wxCHECK_W32API_VERSION
279 #define wxCHECK_W32API_VERSION(maj, min) (0)
280#endif
281
282#endif /* _WX_PLATFORM_H_ */
283