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