]>
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 | |
57fbe23f GD |
197 | #ifndef TARGET_CARBON |
198 | #define TARGET_CARBON 1 | |
199 | #endif | |
67087ab4 | 200 | |
26bea6ac SC |
201 | #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) |
202 | #define wxSIZE_T_IS_ULONG | |
203 | #endif | |
78340847 VZ |
204 | /* |
205 | Some code has been added to workaround defects(?) in the | |
67087ab4 GD |
206 | bundled gcc compiler. These corrections are identified by |
207 | __DARWIN__ for Darwin related corrections (wxMac, wxMotif) | |
78340847 | 208 | */ |
78340847 VZ |
209 | #elif defined(__OS2__) |
210 | #if defined(__IBMCPP__) | |
211 | #define __VISAGEAVER__ __IBMCPP__ | |
212 | #endif | |
213 | #ifndef __WXOS2__ | |
214 | #define __WXOS2__ | |
215 | #endif | |
216 | #ifndef __WXPM__ | |
217 | #define __WXPM__ | |
218 | #endif | |
219 | ||
220 | /* Place other OS/2 compiler environment defines here */ | |
221 | #if defined(__VISAGECPP__) | |
222 | /* VisualAge is the only thing that understands _Optlink */ | |
223 | #define LINKAGEMODE _Optlink | |
224 | #endif | |
225 | #define wxSIZE_T_IS_UINT | |
c427acc8 | 226 | |
78340847 VZ |
227 | #else /* Windows */ |
228 | #ifndef __WINDOWS__ | |
229 | #define __WINDOWS__ | |
230 | #endif /* Windows */ | |
231 | ||
232 | /* to be changed for Win64! */ | |
233 | #ifndef __WIN32__ | |
234 | #define __WIN16__ | |
235 | #endif | |
236 | ||
237 | /* | |
238 | define another standard symbol for Microsoft Visual C++: the standard | |
239 | one (_MSC_VER) is also defined by Metrowerks compiler | |
240 | */ | |
241 | #if defined(_MSC_VER) && !defined(__MWERKS__) | |
242 | #define __VISUALC__ _MSC_VER | |
243 | #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__) | |
244 | #define __BORLANDC__ | |
245 | #elif defined(__WATCOMC__) | |
246 | #elif defined(__SC__) | |
247 | #define __SYMANTECC__ | |
248 | #endif /* compiler */ | |
249 | ||
250 | /* size_t is the same as unsigned int for all Windows compilers we know, */ | |
251 | /* so define it if it hadn't been done by configure yet */ | |
252 | #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) | |
253 | #define wxSIZE_T_IS_UINT | |
254 | #endif | |
255 | #endif /* OS */ | |
256 | ||
257 | /* | |
258 | if we're on a Unix system but didn't use configure (so that setup.h didn't | |
259 | define __UNIX__), do define __UNIX__ now | |
260 | */ | |
261 | #if !defined(__UNIX__) && defined(__UNIX_LIKE__) | |
262 | #define __UNIX__ | |
263 | #endif /* Unix */ | |
264 | ||
265 | #if defined(__HPUX__) && !defined(__WXGTK__) | |
266 | #ifndef __WXMOTIF__ | |
267 | #define __WXMOTIF__ | |
268 | #endif /* __WXMOTIF__ */ | |
269 | #endif | |
270 | ||
f79bd02d | 271 | #if defined(__WXMOTIF__) || defined(__WXX11__) |
78340847 VZ |
272 | #define __X__ |
273 | #endif | |
274 | ||
44893b87 VZ |
275 | /* |
276 | This macro can be used to test the gcc version and can be used like this: | |
277 | ||
278 | #if wxCHECK_GCC_VERSION(3, 1) | |
279 | ... we have gcc 3.1 or later ... | |
280 | #else | |
281 | ... no gcc at all or gcc < 3.1 ... | |
282 | #endif | |
283 | */ | |
284 | #define wxCHECK_GCC_VERSION( major, minor ) \ | |
285 | ( defined(__GNUC__) && defined(__GNUC_MINOR__) \ | |
286 | && ( ( __GNUC__ > (major) ) \ | |
287 | || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) ) ) | |
288 | ||
78340847 VZ |
289 | /* |
290 | This macro can be used to check that the version of mingw32 compiler is | |
291 | at least maj.min | |
292 | */ | |
293 | #if defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || defined( __CYGWIN__ ) | |
294 | #include "wx/msw/gccpriv.h" | |
295 | #else | |
296 | #undef wxCHECK_W32API_VERSION | |
297 | #define wxCHECK_W32API_VERSION(maj, min) (0) | |
298 | #endif | |
299 | ||
300 | #endif /* _WX_PLATFORM_H_ */ | |
301 |