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