+# ifndef _UNICODE
+# define _UNICODE
+# endif
+# ifndef UNICODE
+# define UNICODE
+# endif
+#endif // Unicode
+
+// Unicode support requires wchar_t
+#if wxUSE_UNICODE
+# undef wxUSE_WCHAR_T
+# define wxUSE_WCHAR_T 1
+#endif // Unicode
+
+// ----------------------------------------------------------------------------
+// define wxHAVE_TCHAR_FUNCTIONS for the compilers which support the
+// wide-character functions
+// ----------------------------------------------------------------------------
+
+#ifdef __WIN32__
+ // VC++ and BC++ starting with 5.2 have TCHAR support
+ #ifdef __VISUALC__
+ #define wxHAVE_TCHAR_FUNCTIONS
+ #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)
+ #define wxHAVE_TCHAR_FUNCTIONS
+ #elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 )
+ #define wxHAVE_TCHAR_FUNCTIONS
+ #include <stddef.h>
+ #include <string.h>
+ #include <ctype.h>
+ #elif defined(__CYGWIN__)
+ #ifndef HAVE_WCSLEN
+ #define HAVE_WCSLEN
+ #endif // !HAVE_WCSLEN
+ #include <stddef.h>
+ #include <wchar.h>
+ #endif
+#elif defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
+ // VisualAge 4.0+ supports TCHAR
+ #define wxHAVE_TCHAR_FUNCTIONS
+
+ // but not stdio.h nor time nor conversion functions
+ #define wxNO_TCHAR_STDIO
+ #define wxNO_TCHAR_STDLIB
+ #define wxNO_TCHAR_TIME
+ #define wxNO_TCHAR_LOCALE
+ //
+ // supplemental VA V4 defs so at least we know what these are
+ // just define to standard defs
+ //
+
+ // for wcslen
+ #include <wchar.h>
+
+ // locale.h functons -- not defined in tchar.h
+ #define wxSetlocale setlocale
+ // some stdio functions are defined others are not
+ // these are not
+ #define wxFgetchar fgetchar
+ #define wxFopen fopen
+ #define wxFputchar fputchar
+ #define wxFreopen freopen
+ #define wxGets gets
+ #define wxPerror perror
+ #define wxPuts puts
+ #define wxRemove remove
+ #define wxRename rename
+ #define wxTmpnam tmpnam
+ #define wxUngetc ungetc
+ #define wxVsscanf vsscanf
+ // stdlib not defined in VA V4
+ #if !wxUSE_UNICODE
+ # define wxAtof atof
+ #endif
+ #define wxAtoi atoi
+ #define wxAtol atol
+ #define wxGetenv getenv
+ #define wxSystem system
+ // time.h functions -- none defined in tchar.h
+ #define wxAsctime asctime
+ #define wxCtime ctime
+#elif defined(__MWERKS__)
+ // for wcslen
+ #if wxUSE_WCHAR_T
+ #include <wchar.h>
+ #endif
+#endif // compilers with (good) TCHAR support
+
+#ifdef wxHAVE_TCHAR_FUNCTIONS
+# define HAVE_WCSLEN 1
+
+# include <tchar.h>
+
+# if wxUSE_UNICODE // temporary - preserve binary compatibility
+#if defined(__GNUWIN32__)
+ #define _TCHAR TCHAR
+ #define _TSCHAR TCHAR
+ #define _TUCHAR TCHAR