]> git.saurik.com Git - wxWidgets.git/blob - include/wx/platform.h
extracted platform/compiler detection macros from wx/defs,h into wx/platform.h
[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__)
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 __WXWINE__
43 #ifndef __WIN32__
44 #define __WIN32__
45 #endif
46 #ifndef __WIN95__
47 #define __WIN95__
48 #endif
49 #ifndef STRICT
50 #define STRICT
51 #endif
52 #endif /* WINE */
53
54 #if defined(TWIN32) && !defined(__TWIN32__)
55 #define __TWIN32__
56 #endif /* Twin32 */
57
58 /*
59 Include wx/setup.h for the Unix platform defines generated by configure and
60 the library compilation options
61 */
62 #include "wx/setup.h"
63
64 /* check the consistency of the settings in setup.h */
65 #include "wx/chkconf.h"
66
67 /*
68 old C++ headers (like <iostream.h>) declare classes in the global namespace
69 while the new, standard ones (like <iostream>) do it in std:: namespace
70
71 using this macro allows constuctions like "wxSTD iostream" to work in
72 either case
73 */
74 #if !wxUSE_IOSTREAMH
75 #define wxSTD std::
76 #else
77 #define wxSTD
78 #endif
79
80 /*
81 OS: first test for generic Unix defines, then for particular flavours and
82 finally for Unix-like systems
83 */
84 #if defined(__UNIX__) || defined(__unix) || defined(__unix__) || \
85 defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
86 defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \
87 defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
88
89 #define __UNIX_LIKE__
90
91 /* Helps SGI compilation, apparently */
92 #ifdef __SGI__
93 #ifdef __GNUG__
94 #define __need_wchar_t
95 #else /* !gcc */
96 /*
97 Note I use the term __SGI_CC__ for both cc and CC, its not a good
98 idea to mix gcc and cc/CC, the name mangling is different
99 */
100 #define __SGI_CC__
101 #endif /* gcc/!gcc */
102 #endif /* SGI */
103
104 #if defined(sun) || defined(__SUN__)
105 #ifndef __GNUG__
106 #ifndef __SUNCC__
107 #define __SUNCC__
108 #endif /* Sun CC */
109 #endif
110 #endif /* Sun */
111
112 #ifdef __EMX__
113 #define OS2EMX_PLAIN_CHAR
114 #endif
115
116 /* define __HPUX__ for HP-UX where standard macro is __hpux */
117 #if defined(__hpux) && !defined(__HPUX__)
118 #define __HPUX__
119 #endif /* HP-UX */
120
121 #if defined(__WXMAC__) && defined(__DARWIN__)
122 /* Mac OS X */
123
124 /*
125 Some code has been added to workaround defects(?) in the
126 bundled gcc compiler. These corrections are identified by:
127 __DARWIN__ for corrections necessary for Darwin (wxMac, wxMotif)
128 */
129
130 #include <Carbon/Carbon.h>
131 #endif /* __WXMAC__ && __DARWIN__ */
132
133 #if defined(__CYGWIN__)
134 #if !defined(wxSIZE_T_IS_UINT)
135 #define wxSIZE_T_IS_UINT
136 #endif
137 #endif
138 #elif defined(applec) || \
139 defined(THINK_C) || \
140 (defined(__MWERKS__) && !defined(__INTEL__))
141 /* MacOS */
142 #elif defined(__WXMAC__) && defined(__DARWIN__)
143 /* Mac OS X */
144 #define __UNIX_LIKE__
145
146 /*
147 Some code has been added to workaround defects(?) in the
148 bundled gcc compiler. These corrections are identified by:
149 __DARWIN__ for corrections necessary for Darwin (wxMac, wxMotif)
150 */
151
152 #include <Carbon/Carbon.h>
153 #elif defined(__OS2__)
154 #if defined(__IBMCPP__)
155 #define __VISAGEAVER__ __IBMCPP__
156 #endif
157 #ifndef __WXOS2__
158 #define __WXOS2__
159 #endif
160 #ifndef __WXPM__
161 #define __WXPM__
162 #endif
163
164 /* Place other OS/2 compiler environment defines here */
165 #if defined(__VISAGECPP__)
166 /* VisualAge is the only thing that understands _Optlink */
167 #define LINKAGEMODE _Optlink
168 #endif
169 #define wxSIZE_T_IS_UINT
170 #else /* Windows */
171 #ifndef __WINDOWS__
172 #define __WINDOWS__
173 #endif /* Windows */
174
175 /* to be changed for Win64! */
176 #ifndef __WIN32__
177 #define __WIN16__
178 #endif
179
180 /*
181 define another standard symbol for Microsoft Visual C++: the standard
182 one (_MSC_VER) is also defined by Metrowerks compiler
183 */
184 #if defined(_MSC_VER) && !defined(__MWERKS__)
185 #define __VISUALC__ _MSC_VER
186 #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
187 #define __BORLANDC__
188 #elif defined(__WATCOMC__)
189 #elif defined(__SC__)
190 #define __SYMANTECC__
191 #endif /* compiler */
192
193 /* size_t is the same as unsigned int for all Windows compilers we know, */
194 /* so define it if it hadn't been done by configure yet */
195 #if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
196 #define wxSIZE_T_IS_UINT
197 #endif
198 #endif /* OS */
199
200 /*
201 if we're on a Unix system but didn't use configure (so that setup.h didn't
202 define __UNIX__), do define __UNIX__ now
203 */
204 #if !defined(__UNIX__) && defined(__UNIX_LIKE__)
205 #define __UNIX__
206 #endif /* Unix */
207
208 #if defined(__HPUX__) && !defined(__WXGTK__)
209 #ifndef __WXMOTIF__
210 #define __WXMOTIF__
211 #endif /* __WXMOTIF__ */
212 #endif
213
214 #if defined(__WXMOTIF__)
215 #define __X__
216 #endif
217
218 /*
219 This macro can be used to check that the version of mingw32 compiler is
220 at least maj.min
221 */
222 #if defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || defined( __CYGWIN__ )
223 #include "wx/msw/gccpriv.h"
224 #else
225 #undef wxCHECK_W32API_VERSION
226 #define wxCHECK_W32API_VERSION(maj, min) (0)
227 #endif
228
229 #endif /* _WX_PLATFORM_H_ */
230