+// ----------------------------------------------------------------------------
+// first deal with Unicode setting
+// ----------------------------------------------------------------------------
+
+// set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined
+#if defined(_UNICODE) || defined(UNICODE)
+# undef wxUSE_UNICODE
+# define wxUSE_UNICODE 1
+#else
+# ifndef wxUSE_UNICODE
+# define wxUSE_UNICODE 0
+# endif
+#endif // Unicode
+
+// and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1...
+#if wxUSE_UNICODE
+# 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
+ // w32api isn't yet tchar safe, will be soon, this is a placeholder
+ #elif defined(__GNUWIN32__) && wxCHECK_W32API_VERSION( 10, 0 )
+ #define wxHAVE_TCHAR_FUNCTIONS
+ #include <stddef.h>
+ #include <string.h>
+ #include <ctype.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
+#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
+#endif