+ To keep wx authors from screwing this up, only enable __WXOSX_OR_COCOA__ for wxCocoa when
+ not compiling the base library. We determine this by first checking if
+ wxUSE_BASE is not defined. If it is not defined, then we're not buildling
+ the base library, and possibly not building wx at all (but actually building
+ user code that's using wx). If it is defined then we must check to make sure
+ it is not true. If it is true, we're building base.
+
+ If you want it in the common darwin base library then use __DARWIN__. You
+ can use any Darwin-available libraries like CoreFoundation but please avoid
+ using OS X libraries like Carbon or CoreServices.
+
+ */
+#if defined(__WXOSX__) || (defined(__WXCOCOA__) && (!defined(wxUSE_BASE) || !wxUSE_BASE))
+# define __WXOSX_OR_COCOA__ 1
+#endif
+
+#ifdef __WXOSX_OR_COCOA__
+# ifdef __WXMAC_XCODE__
+# include <unistd.h>
+# include <TargetConditionals.h>
+# include <AvailabilityMacros.h>
+# include "wx/osx/config_xcode.h"
+# endif
+#endif
+/*
+ first define Windows symbols if they're not defined on the command line: we
+ can autodetect everything we need if _WIN32 is defined
+ */
+#if defined(__CYGWIN__) && defined(__WINDOWS__)
+# ifndef __WXMSW__
+# define __WXMSW__
+# endif
+#endif
+
+#if defined(__PALMOS__)
+# if __PALMOS__ == 0x06000000
+# define __WXPALMOS6__ 1
+# endif
+# if __PALMOS__ == 0x05000000
+# define __WXPALMOS5__ 1
+# endif
+# ifndef __WXPALMOS__
+# define __WXPALMOS__ 1
+# endif
+# ifdef __WXMSW__
+# undef __WXMSW__
+# endif
+# ifdef __WINDOWS__
+# undef __WINDOWS__
+# endif
+# ifdef __WIN32__
+# undef __WIN32__
+# endif
+# ifdef WIN32
+# undef WIN32
+# endif
+# ifdef _WIN32
+# undef _WIN32
+# endif
+#endif
+
+#if defined(_WIN64)
+# ifndef _WIN32
+ /*
+ a lot of code (mistakenly) uses #ifdef _WIN32 to either test for
+ Windows or to test for !__WIN16__, so we must define _WIN32 for
+ Win64 as well to ensure that the existing code continues to work.
+ */
+# define _WIN32
+# endif /* !_WIN32 */
+
+# ifndef __WIN64__
+# define __WIN64__
+# endif /* !__WIN64__ */
+#endif /* _WIN64 */
+
+#if (defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)) \
+ && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__)
+# ifndef __WXMSW__
+# define __WXMSW__
+# endif