]> git.saurik.com Git - wxWidgets.git/blame - include/wx/platform.h
Commented out wxAutoNSAutoreleasePool in CallOnInit()
[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
371a5b4e 9 * Licence: wxWindows licence
78340847
VZ
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
a203834e
MB
17
18/*
19 Codewarrior doesn't define any Windows symbols until some headers
20 are included
21*/
22#if __MWERKS__
23 #include <stddef.h>
a203834e
MB
24#endif
25
78340847
VZ
26/*
27 first define Windows symbols if they're not defined on the command line: we
28 can autodetect everything we need if _WIN32 is defined
29 */
d66dcb60
MB
30#if defined(__CYGWIN32__) && !defined(__WXMOTIF__) && !defined(__WXGTK__) \
31 && !defined(__WXX11__)
32 /* for Cygwin, default to wxMSW unless otherwise specified */
33 #ifndef __WXMSW__
34 #define __WXMSW__
35 #endif
36
37 #ifndef _WIN32
38 #define _WIN32
39 #endif
40
41 #ifndef WIN32
42 #define WIN32
43 #endif
44#endif
45
158b6688 46#if defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)
78340847
VZ
47 #ifndef __WXMSW__
48 #define __WXMSW__
49 #endif
50
51 #ifndef __WIN32__
52 #define __WIN32__
53 #endif
54
7863fab4
VZ
55 /*
56 see MSDN for the description of possible WINVER values, this one is a
57 good default and, anyhow, we check for most of the features we use
58 during run-time.
59 */
60 #ifndef WINVER
61 #define WINVER 0x0400
62 #endif
63
78340847 64 /* Win95 means Win95-style UI, i.e. Win9x/NT 4+ */
7863fab4 65 #if !defined(__WIN95__) && (WINVER >= 0x0400)
78340847
VZ
66 #define __WIN95__
67 #endif
68#endif /* Win32 */
69
70#if defined(__WXMSW__) || defined(__WIN32__)
71 #if !defined(__WINDOWS__)
72 #define __WINDOWS__
73 #endif
74#endif
75
b4da152e 76#ifdef __WINE__
78340847
VZ
77 #ifndef __WIN95__
78 #define __WIN95__
79 #endif
78340847
VZ
80#endif /* WINE */
81
78340847
VZ
82/*
83 Include wx/setup.h for the Unix platform defines generated by configure and
84 the library compilation options
85 */
86#include "wx/setup.h"
87
88/* check the consistency of the settings in setup.h */
89#include "wx/chkconf.h"
90
eb382f3e
VZ
91/*
92 some compilers don't support iostream.h any longer, so override the users
93 setting here in such case.
94 */
95#if defined(_MSC_VER) && (_MSC_VER >= 1310)
96 #undef wxUSE_IOSTREAMH
97 #define wxUSE_IOSTREAMH 0
98#endif /* compilers not supporting iostream.h */
99
78340847
VZ
100/*
101 old C++ headers (like <iostream.h>) declare classes in the global namespace
102 while the new, standard ones (like <iostream>) do it in std:: namespace
103
104 using this macro allows constuctions like "wxSTD iostream" to work in
105 either case
106 */
107#if !wxUSE_IOSTREAMH
eb382f3e 108 #define wxSTD std::
78340847 109#else
eb382f3e 110 #define wxSTD
78340847
VZ
111#endif
112
113/*
865c589e
VS
114 OS: first of all, test for MS-DOS platform. We must do this before testing
115 for Unix, because DJGPP compiler defines __unix__ under MS-DOS
116 */
117#if defined(__GO32__) || defined(__DJGPP__) || defined(__DOS__)
118 #ifndef __DOS__
119 #define __DOS__
120 #endif
121 /* size_t is the same as unsigned int for Watcom 11 compiler, */
122 /* so define it if it hadn't been done by configure yet */
123 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
124 #ifdef __WATCOMC__
125 #define wxSIZE_T_IS_UINT
126 #endif
127 #ifdef __DJGPP__
128 #define wxSIZE_T_IS_ULONG
129 #endif
130 #endif
131
132/*
133 OS: then test for generic Unix defines, then for particular flavours and
78340847
VZ
134 finally for Unix-like systems
135 */
865c589e
VS
136#elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \
137 defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
138 defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \
139 defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
78340847
VZ
140
141 #define __UNIX_LIKE__
142
143 /* Helps SGI compilation, apparently */
144 #ifdef __SGI__
145 #ifdef __GNUG__
146 #define __need_wchar_t
147 #else /* !gcc */
148 /*
149 Note I use the term __SGI_CC__ for both cc and CC, its not a good
150 idea to mix gcc and cc/CC, the name mangling is different
151 */
152 #define __SGI_CC__
153 #endif /* gcc/!gcc */
154 #endif /* SGI */
155
156 #if defined(sun) || defined(__SUN__)
157 #ifndef __GNUG__
158 #ifndef __SUNCC__
159 #define __SUNCC__
160 #endif /* Sun CC */
161 #endif
162 #endif /* Sun */
163
164 #ifdef __EMX__
165 #define OS2EMX_PLAIN_CHAR
166 #endif
167
168 /* define __HPUX__ for HP-UX where standard macro is __hpux */
169 #if defined(__hpux) && !defined(__HPUX__)
170 #define __HPUX__
171 #endif /* HP-UX */
172
5283098e 173 #if defined(__CYGWIN__) || defined(__WINE__)
78340847
VZ
174 #if !defined(wxSIZE_T_IS_UINT)
175 #define wxSIZE_T_IS_UINT
176 #endif
177 #endif
178#elif defined(applec) || \
179 defined(THINK_C) || \
180 (defined(__MWERKS__) && !defined(__INTEL__))
181 /* MacOS */
26bea6ac
SC
182 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
183 #define wxSIZE_T_IS_ULONG
184 #endif
67087ab4 185#elif defined(__WXMAC__) && defined(__APPLE__)
78340847
VZ
186 /* Mac OS X */
187 #define __UNIX_LIKE__
188
67087ab4
GD
189 /*
190 These defines are needed when compiling using Project Builder
191 with a non generated setup0.h
192 */
193 #ifndef __UNIX__
194 #define __UNIX__ 1
195 #endif
196 #ifndef __BSD__
197 #define __BSD__ 1
198 #endif
199 #ifndef __DARWIN__
200 #define __DARWIN__ 1
201 #endif
202 #ifndef __POWERPC__
203 #define __POWERPC__ 1
204 #endif
57fbe23f
GD
205 #ifndef TARGET_CARBON
206 #define TARGET_CARBON 1
207 #endif
67087ab4 208
26bea6ac
SC
209 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
210 #define wxSIZE_T_IS_ULONG
211 #endif
78340847
VZ
212 /*
213 Some code has been added to workaround defects(?) in the
67087ab4
GD
214 bundled gcc compiler. These corrections are identified by
215 __DARWIN__ for Darwin related corrections (wxMac, wxMotif)
78340847 216 */
78340847
VZ
217#elif defined(__OS2__)
218 #if defined(__IBMCPP__)
219 #define __VISAGEAVER__ __IBMCPP__
220 #endif
221 #ifndef __WXOS2__
222 #define __WXOS2__
223 #endif
224 #ifndef __WXPM__
225 #define __WXPM__
226 #endif
227
228 /* Place other OS/2 compiler environment defines here */
229 #if defined(__VISAGECPP__)
230 /* VisualAge is the only thing that understands _Optlink */
231 #define LINKAGEMODE _Optlink
232 #endif
233 #define wxSIZE_T_IS_UINT
c427acc8 234
78340847
VZ
235#else /* Windows */
236 #ifndef __WINDOWS__
237 #define __WINDOWS__
238 #endif /* Windows */
239
240 /* to be changed for Win64! */
241 #ifndef __WIN32__
242 #define __WIN16__
243 #endif
244
245 /*
246 define another standard symbol for Microsoft Visual C++: the standard
247 one (_MSC_VER) is also defined by Metrowerks compiler
248 */
249 #if defined(_MSC_VER) && !defined(__MWERKS__)
250 #define __VISUALC__ _MSC_VER
251 #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
252 #define __BORLANDC__
253 #elif defined(__WATCOMC__)
254 #elif defined(__SC__)
255 #define __SYMANTECC__
256 #endif /* compiler */
257
258 /* size_t is the same as unsigned int for all Windows compilers we know, */
259 /* so define it if it hadn't been done by configure yet */
260 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
261 #define wxSIZE_T_IS_UINT
262 #endif
263#endif /* OS */
264
265/*
266 if we're on a Unix system but didn't use configure (so that setup.h didn't
267 define __UNIX__), do define __UNIX__ now
268 */
269#if !defined(__UNIX__) && defined(__UNIX_LIKE__)
270 #define __UNIX__
271#endif /* Unix */
272
273#if defined(__HPUX__) && !defined(__WXGTK__)
274 #ifndef __WXMOTIF__
275 #define __WXMOTIF__
276 #endif /* __WXMOTIF__ */
277#endif
278
f79bd02d 279#if defined(__WXMOTIF__) || defined(__WXX11__)
78340847
VZ
280 #define __X__
281#endif
282
44893b87
VZ
283/*
284 This macro can be used to test the gcc version and can be used like this:
285
286 #if wxCHECK_GCC_VERSION(3, 1)
287 ... we have gcc 3.1 or later ...
288 #else
289 ... no gcc at all or gcc < 3.1 ...
290 #endif
291*/
292#define wxCHECK_GCC_VERSION( major, minor ) \
293 ( defined(__GNUC__) && defined(__GNUC_MINOR__) \
294 && ( ( __GNUC__ > (major) ) \
295 || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) )
296
78340847
VZ
297/*
298 This macro can be used to check that the version of mingw32 compiler is
299 at least maj.min
300 */
ac776ec9
VS
301#if defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \
302 defined( __CYGWIN__ ) || \
303 (defined(__WATCOMC__) && __WATCOMC__ >= 1200) || defined(__DIGITALMARS__)
78340847
VZ
304 #include "wx/msw/gccpriv.h"
305#else
306 #undef wxCHECK_W32API_VERSION
307 #define wxCHECK_W32API_VERSION(maj, min) (0)
308#endif
309
4ce1efe1
CE
310#ifdef __SC__
311 #ifdef __DMC__
312 #define __DIGITALMARS__
bf978f96
CE
313 #else
314 #define __SYMANTEC__
4ce1efe1
CE
315 #endif
316#endif
317
1e3c12d7 318#if defined (__WXMSW__)
957f0369 319 #if !defined(__WATCOMC__)
1e3c12d7
CE
320 #define wxHAVE_RAW_BITMAP
321 #endif
322#endif
bf978f96 323
01ebf752
JS
324#if defined (__WXMAC__)
325 #ifndef WORDS_BIGENDIAN
326 #define WORDS_BIGENDIAN 1
327 #endif
328#endif
329
0b30bb0b
JS
330/* Choose which method we will use for updating menus
331 * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event.
332 * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN.
333 */
334#ifndef wxUSE_IDLEMENUUPDATES
92f1a59c 335 #if defined(__WXMSW__) || defined(__WXGTK__)
0b30bb0b
JS
336 #define wxUSE_IDLEMENUUPDATES 0
337 #else
338 #define wxUSE_IDLEMENUUPDATES 1
339 #endif
340#endif
341
5e967044
JS
342/*
343 * Define symbols that are not yet in
344 * configure or possibly some setup.h files.
345 * They will need to be added.
346 */
347
348#ifndef wxUSE_FILECONFIG
349 #if wxUSE_CONFIG
350 #define wxUSE_FILECONFIG 1
351 #else
352 #define wxUSE_FILECONFIG 0
353 #endif
354#endif
355
356#ifndef wxUSE_HOTKEY
357 #define wxUSE_HOTKEY 0
358#endif
359
086b3a5b
JS
360#if !defined(wxUSE_WXDIB) && defined(__WXMSW__)
361 #define wxUSE_WXDIB 1
362#endif
363
78340847
VZ
364#endif /* _WX_PLATFORM_H_ */
365