]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/platform.h
3 * Purpose: define the OS and compiler identification macros
4 * Author: Vadim Zeitlin
6 * Created: 29.10.01 (extracted from wx/defs.h)
8 * Copyright: (c) 1997-2001 Vadim Zeitlin
9 * Licence: wxWindows licence
12 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
14 #ifndef _WX_PLATFORM_H_
15 #define _WX_PLATFORM_H_
19 Codewarrior doesn't define any Windows symbols until some headers
28 __WXMAC_CLASSIC__ means ppc non-carbon builds, __WXMAC_CARBON__ means
29 carbon API available (mach or cfm builds) , __WXMAC_OSX__ means mach-o
30 builds, running under 10.2 + only
33 # if defined(__MACH__)
34 # define __WXMAC_OSX__
35 # define __WXMAC_CARBON__ /* for backwards compat in user code still defined */
36 # include <AvailabilityMacros.h>
37 # ifndef MAC_OS_X_VERSION_10_4
38 # define MAC_OS_X_VERSION_10_4 1040
40 # ifndef MAC_OS_X_VERSION_10_5
41 # define MAC_OS_X_VERSION_10_5 1050
43 # ifdef __WXMAC_XCODE__
45 # include "wx/mac/carbon/config_xcode.h"
48 # error "only mach-o configurations are supported"
53 __WXOSX__ is a common define to wxMac (Carbon) and wxCocoa ports under OS X.
55 DO NOT use this define in base library code. Although wxMac has its own
56 private base library (and thus __WXOSX__,__WXMAC__ and related defines are
57 valid there), wxCocoa shares its library with other ports like wxGTK and wxX11.
59 To keep wx authors from screwing this up, only enable __WXOSX__ for wxCocoa when
60 not compiling the base library. We determine this by first checking if
61 wxUSE_BASE is not defined. If it is not defined, then we're not buildling
62 the base library, and possibly not building wx at all (but actually building
63 user code that's using wx). If it is defined then we must check to make sure
64 it is not true. If it is true, we're building base.
66 If you want it in the common darwin base library then use __DARWIN__. You
67 can use any Darwin-available libraries like CoreFoundation but please avoid
68 using OS X libraries like Carbon or CoreServices.
71 #if defined(__WXMAC_OSX__) || (defined(__WXCOCOA__) && (!defined(wxUSE_BASE) || !wxUSE_BASE))
76 first define Windows symbols if they're not defined on the command line: we
77 can autodetect everything we need if _WIN32 is defined
79 #if defined(__CYGWIN__) && defined(__WINDOWS__)
93 #if defined(__PALMOS__)
94 # if __PALMOS__ == 0x06000000
95 # define __WXPALMOS6__
97 # if __PALMOS__ == 0x05000000
98 # define __WXPALMOS5__
100 # ifndef __WXPALMOS__
101 # define __WXPALMOS__
123 a lot of code (mistakenly) uses #ifdef _WIN32 to either test for
124 Windows or to test for !__WIN16__, so we must define _WIN32 for
125 Win64 as well to ensure that the existing code continues to work.
128 # endif /* !_WIN32 */
132 # endif /* !__WIN64__ */
135 #if (defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)) \
136 && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__)
146 #if defined(__WXMSW__) || defined(__WIN32__)
147 # if !defined(__WINDOWS__)
152 /* detect MS SmartPhone */
153 #if defined( WIN32_PLATFORM_WFSP )
154 # ifndef __SMARTPHONE__
155 # define __SMARTPHONE__
162 /* detect PocketPC */
163 #if defined( WIN32_PLATFORM_PSPC )
164 # ifndef __POCKETPC__
165 # define __POCKETPC__
172 /* detect Standard WinCE SDK */
173 #if defined( WCE_PLATFORM_STANDARDSDK )
174 # ifndef __WINCE_STANDARDSDK__
175 # define __WINCE_STANDARDSDK__
182 #if defined(_WIN32_WCE) && !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC)
183 # if (_WIN32_WCE >= 400)
184 # ifndef __WINCE_NET__
185 # define __WINCE_NET__
187 # elif (_WIN32_WCE >= 200)
188 # ifndef __HANDHELDPC__
189 # define __HANDHELDPC__
197 #if defined(__POCKETPC__) || defined(__SMARTPHONE__) || defined(__WXGPE__)
198 # define __WXHANDHELD__
202 Include wx/setup.h for the Unix platform defines generated by configure and
203 the library compilation options
205 Note that it must be included before defining hardware symbols below as they
206 could be already defined by configure
208 #include "wx/setup.h"
211 Hardware platform detection.
213 VC++ defines _M_xxx symbols.
215 #if defined(_M_IX86) || defined(i386) || defined(__i386) || defined(__i386__)
227 #if defined(_M_MPPC) || defined(__PPC__) || defined(__ppc__)
233 #if defined(_M_ALPHA) || defined(__AXP__)
241 adjust the Unicode setting: wxUSE_UNICODE should be defined as 0 or 1
242 and is used by wxWidgets, _UNICODE and/or UNICODE may be defined or used by
243 the system headers so bring these settings in sync
246 /* set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined */
247 #if defined(_UNICODE) || defined(UNICODE)
248 # undef wxUSE_UNICODE
249 # define wxUSE_UNICODE 1
251 # ifndef wxUSE_UNICODE
252 # define wxUSE_UNICODE 0
254 #endif /* UNICODE/!UNICODE */
256 /* and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1 */
264 #endif /* wxUSE_UNICODE */
266 #if defined( __MWERKS__ ) && !defined(__INTEL__)
267 /* otherwise MSL headers bring in WIN32 dependant APIs */
272 /* test for old versions of Borland C, normally need at least 5.82, Turbo explorer,
273 available for free at http://www.turboexplorer.com/downloads
275 #if defined(__BORLANDC__) && (__BORLANDC__ < 0x550)
276 #error "This version of wxWidgets requires a newer version of Borland - we recommend 5.82 (Turbo Explorer); You may at your own risk remove this line and try your system"
277 #endif /* __BORLANDC__ */
279 #if defined(__BORLANDC__) && (__BORLANDC__ < 0x582) && (__BORLANDC__ > 0x559)
280 #error "This version of wxWidgets has problems with Borland 5.6; we recommend getting Borland 5.82 (Turbo Explorer); You may at your own risk remove this line and try your system"
281 #endif /* __BORLANDC__ */
285 This macro can be used to test the Open Watcom version.
288 # define wxWATCOM_VERSION(major,minor) 0
289 # define wxCHECK_WATCOM_VERSION(major,minor) 0
290 # define wxONLY_WATCOM_EARLIER_THAN(major,minor) 0
291 #elif defined(__WATCOMC__) && __WATCOMC__ < 1200
292 # error "Only Open Watcom is supported in this release"
294 # define wxWATCOM_VERSION(major,minor) ( major * 100 + minor * 10 + 1100 )
295 # define wxCHECK_WATCOM_VERSION(major,minor) ( __WATCOMC__ >= wxWATCOM_VERSION(major,minor) )
296 # define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) )
300 OS: first of all, test for MS-DOS platform. We must do this before testing
301 for Unix, because DJGPP compiler defines __unix__ under MS-DOS
303 #if defined(__GO32__) || defined(__DJGPP__) || defined(__DOS__)
307 /* size_t is the same as unsigned int for Watcom 11 compiler, */
308 /* so define it if it hadn't been done by configure yet */
309 # if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
311 # define wxSIZE_T_IS_UINT
314 # define wxSIZE_T_IS_ULONG
319 OS: then test for generic Unix defines, then for particular flavours and
320 finally for Unix-like systems
321 Mac OS X matches this case (__MACH__), prior Mac OS do not.
323 #elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \
324 defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
325 defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \
326 defined(__EMX__) || defined(__VMS) || defined(__BEOS__) || defined(__MACH__)
328 # define __UNIX_LIKE__
330 /* Helps SGI compilation, apparently */
333 # define __need_wchar_t
336 Note I use the term __SGI_CC__ for both cc and CC, its not a good
337 idea to mix gcc and cc/CC, the name mangling is different
340 # endif /* gcc/!gcc */
342 /* system headers use this symbol and not __cplusplus in some places */
343 # ifndef _LANGUAGE_C_PLUS_PLUS
344 # define _LANGUAGE_C_PLUS_PLUS
348 # if defined(__SUNPRO_CC)
350 # define __SUNCC__ __SUNPRO_CC
355 # define OS2EMX_PLAIN_CHAR
358 /* define __HPUX__ for HP-UX where standard macro is __hpux */
359 # if defined(__hpux) && !defined(__HPUX__)
363 # if defined(__CYGWIN__) || defined(__WINE__)
364 # if !defined(wxSIZE_T_IS_UINT)
365 # define wxSIZE_T_IS_UINT
369 /* All of these should already be defined by including configure-
370 generated setup.h but we wish to support Xcode compilation without
371 requiring the user to define these himself.
373 # if defined(__APPLE__) && defined(__MACH__)
380 /* __DARWIN__ is our own define to mean OS X or pure Darwin */
382 # define __DARWIN__ 1
384 /* NOTE: TARGET_CARBON is actually a 0/1 and must be 1 for OS X */
385 # ifndef TARGET_CARBON
386 # define TARGET_CARBON 1
388 /* OS X uses unsigned long size_t for both ILP32 and LP64 modes. */
389 # if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
390 # define wxSIZE_T_IS_ULONG
397 #elif defined(applec) || \
398 defined(THINK_C) || \
399 (defined(__MWERKS__) && !defined(__INTEL__))
401 # if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
402 # define wxSIZE_T_IS_ULONG
408 #elif defined(__OS2__)
410 /* wxOS2 vs. non wxOS2 ports on OS2 platform */
411 # if !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__)
417 # if defined(__IBMCPP__)
418 # define __VISAGEAVER__ __IBMCPP__
421 /* Place other OS/2 compiler environment defines here */
422 # if defined(__VISAGECPP__)
423 /* VisualAge is the only thing that understands _Optlink */
424 # define LINKAGEMODE _Optlink
426 # define wxSIZE_T_IS_UINT
431 #elif defined(__PALMOS__)
433 # error "__WIN32__ should not be defined for PalmOS"
436 # error "__WINDOWS__ should not be defined for PalmOS"
439 # error "__WXMSW__ should not be defined for PalmOS"
443 OS: Otherwise it must be Windows
448 # endif /* Windows */
450 /* to be changed for Win64! */
452 # error "__WIN32__ should be defined for Win32 and Win64, Win16 is not supported"
456 define another standard symbol for Microsoft Visual C++: the standard
457 one (_MSC_VER) is also defined by Metrowerks compiler
459 # if defined(_MSC_VER) && !defined(__MWERKS__)
460 # define __VISUALC__ _MSC_VER
461 # elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
462 # define __BORLANDC__
463 # elif defined(__WATCOMC__)
464 # elif defined(__SC__)
465 # define __SYMANTECC__
466 # endif /* compiler */
468 /* size_t is the same as unsigned int for all Windows compilers we know, */
469 /* so define it if it hadn't been done by configure yet */
470 # if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG)
471 # define wxSIZE_T_IS_UINT
476 if we're on a Unix system but didn't use configure (so that setup.h didn't
477 define __UNIX__), do define __UNIX__ now
479 #if !defined(__UNIX__) && defined(__UNIX_LIKE__)
483 #if defined(__WXMOTIF__) || defined(__WXX11__)
489 # define __DIGITALMARS__
491 # define __SYMANTEC__
495 #ifdef __INTEL_COMPILER
500 We get "Large Files (ILP32) not supported in strict ANSI mode." #error
501 from HP-UX standard headers when compiling with g++ without this:
503 #if defined(__HPUX__) && !defined(__STDC_EXT__)
504 # define __STDC_EXT__ 1
507 /* Force linking against required libraries under Windows: */
509 # include "wx/msw/wince/libraries.h"
510 #elif defined __WINDOWS__
511 # include "wx/msw/libraries.h"
515 This macro can be used to test the gcc version and can be used like this:
517 # if wxCHECK_GCC_VERSION(3, 1)
518 ... we have gcc 3.1 or later ...
520 ... no gcc at all or gcc < 3.1 ...
523 #if defined(__GNUC__) && defined(__GNUC_MINOR__)
524 #define wxCHECK_GCC_VERSION( major, minor ) \
525 ( ( __GNUC__ > (major) ) \
526 || ( __GNUC__ == (major) && __GNUC_MINOR__ >= (minor) ) )
528 #define wxCHECK_GCC_VERSION( major, minor ) 0
531 #if defined(__BORLANDC__) || (defined(__GNUC__) && __GNUC__ < 3)
532 #define wxNEEDS_CHARPP
536 This macro can be used to check that the version of mingw32 compiler is
539 #if ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \
540 ( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) || \
541 wxCHECK_WATCOM_VERSION(1,0) ) && \
542 !defined(__DOS__) && \
543 !defined(__WXPM__) && \
544 !defined(__WXMOTIF__) && \
545 !defined(__WXGTK__) && \
546 !defined(__WXX11__) && \
547 !defined(__WXPALMOS__)
548 # include "wx/msw/gccpriv.h"
550 # undef wxCHECK_W32API_VERSION
551 # define wxCHECK_W32API_VERSION(maj, min) (0)
555 This is similar to wxCHECK_GCC_VERSION but for Sun CC compiler.
559 __SUNCC__ is 0xVRP where V is major version, R release and P patch level
561 #define wxCHECK_SUNCC_VERSION(maj, min) (__SUNCC__ >= (((maj)<<8) | ((min)<<4)))
563 #define wxCHECK_SUNCC_VERSION(maj, min) (0)
566 #if defined (__WXMSW__)
567 # if !defined(__WATCOMC__)
568 # define wxHAVE_RAW_BITMAP
573 Handle Darwin gcc universal compilation. Don't do this in an Apple-
574 specific case since no sane compiler should be defining either
575 __BIG_ENDIAN__ or __LITTLE_ENDIAN__ unless it really is generating
576 code that will be hosted on a machine with the appropriate endianness.
577 If a compiler defines neither, assume the user or configure set
578 WORDS_BIGENDIAN appropriately.
580 #if defined(__BIG_ENDIAN__)
581 # undef WORDS_BIGENDIAN
582 # define WORDS_BIGENDIAN 1
583 #elif defined(__LITTLE_ENDIAN__)
584 # undef WORDS_BIGENDIAN
585 #elif defined(__WXMAC__) && !defined(WORDS_BIGENDIAN)
586 /* According to Stefan even ancient Mac compilers defined __BIG_ENDIAN__ */
587 # warning "Compiling wxMac with probably wrong endianness"
591 check the consistency of the settings in setup.h: note that this must be
592 done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h
593 and after defining the compiler macros which are used in it too
595 #include "wx/chkconf.h"
599 some compilers don't support iostream.h any longer, while some of theme
600 are not updated with <iostream> yet, so override the users setting here
603 #if defined(_MSC_VER) && (_MSC_VER >= 1310)
604 # undef wxUSE_IOSTREAMH
605 # define wxUSE_IOSTREAMH 0
606 #elif defined(__DMC__) || defined(__WATCOMC__)
607 # undef wxUSE_IOSTREAMH
608 # define wxUSE_IOSTREAMH 1
609 #elif defined(__MINGW32__)
610 # undef wxUSE_IOSTREAMH
611 # define wxUSE_IOSTREAMH 0
612 #endif /* compilers with/without iostream.h */
615 old C++ headers (like <iostream.h>) declare classes in the global namespace
616 while the new, standard ones (like <iostream>) do it in std:: namespace,
617 unless it's an old gcc version.
619 using this macro allows constuctions like "wxSTD iostream" to work in
622 #if !wxUSE_IOSTREAMH && (!defined(__GNUC__) || ( __GNUC__ > 2 ) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
628 /* On OpenVMS with the most recent HP C++ compiler some function (i.e. wscanf)
629 * are only available in the std-namespace. (BUG???)
631 #if defined( __VMS ) && (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD )
632 # define wxVMS_USE_STD std::
634 # define wxVMS_USE_STD
637 /* Choose which method we will use for updating menus
638 * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event.
639 * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN.
641 #ifndef wxUSE_IDLEMENUUPDATES
642 # if (defined(__WXMSW__) || defined(__WXGTK__)) && !defined(__WXUNIVERSAL__)
643 # define wxUSE_IDLEMENUUPDATES 0
645 # define wxUSE_IDLEMENUUPDATES 1
650 * Define symbols that are not yet in
651 * configure or possibly some setup.h files.
652 * They will need to be added.
655 #ifndef wxUSE_FILECONFIG
657 # define wxUSE_FILECONFIG 1
659 # define wxUSE_FILECONFIG 0
664 # define wxUSE_HOTKEY 0
667 #if !defined(wxUSE_WXDIB) && defined(__WXMSW__)
668 # define wxUSE_WXDIB 1
672 We need AvailabilityMacros.h for ifdefing out things that don't exist on
674 FIXME: We need a better way to detect for 10.3 then including a system header
677 #include <AvailabilityMacros.h>
680 #endif /* _WX_PLATFORM_H_ */