Fix up tchar for cygwin

Several psdk headers for Cygwin are requiring it.

(cherry picked from commit b9ee3c5f3a5e58fb4ab5a82b2f668e93a0817aa1)
diff --git a/mingw-w64-headers/configure.ac b/mingw-w64-headers/configure.ac
index 312cf0a..c5b695b 100644
--- a/mingw-w64-headers/configure.ac
+++ b/mingw-w64-headers/configure.ac
@@ -39,7 +39,7 @@
 
 # Checks for header files.
 
-BASEHEAD_LIST="crt/_bsd_types.h crt/_cygwin.h crt/_mingw.h crt/_mingw_mac.h crt/_mingw_print_push.h crt/_mingw_print_pop.h crt/_mingw_secapi.h crt/_mingw_unicode.h crt/_timeval.h crt/crtdefs.h crt/excpt.h crt/intrin.h crt/vadefs.h "$srcdir/include/*.h
+BASEHEAD_LIST="crt/_bsd_types.h crt/_cygwin.h crt/_mingw.h crt/_mingw_mac.h crt/_mingw_print_push.h crt/_mingw_print_pop.h crt/_mingw_secapi.h crt/_mingw_unicode.h crt/_timeval.h crt/crtdefs.h crt/excpt.h crt/intrin.h crt/vadefs.h crt/tchar.h " $srcdir/include/*.h
 SECHEAD_LIST="$srcdir/crt/sec_api/stralign_s.h"
 for i in dlg h16 hxx rh ver; do
   BASEHEAD_LIST="$BASEHEAD_LIST "$srcdir/include/*.$i
diff --git a/mingw-w64-headers/crt/tchar.h b/mingw-w64-headers/crt/tchar.h
index 3567085..c82634a 100644
--- a/mingw-w64-headers/crt/tchar.h
+++ b/mingw-w64-headers/crt/tchar.h
@@ -16,6 +16,8 @@
 extern "C" {
 #endif
 
+#ifndef __CYGWIN__
+
 #define _ftcscat _tcscat
 #define _ftcschr _tcschr
 #define _ftcscpy _tcscpy
@@ -79,6 +81,8 @@
 
 #define _WConst_return _CONST_RETURN
 
+#endif /* __CYGWIN__ */
+
 #ifdef _UNICODE
 
 #ifdef __cplusplus
@@ -91,12 +95,16 @@
 extern "C" {
 #endif
 
+#ifndef __CYGWIN__
+
 #ifndef _WCTYPE_T_DEFINED
 #define _WCTYPE_T_DEFINED
   typedef unsigned short wint_t;
   typedef unsigned short wctype_t;
 #endif
 
+#endif /* __CYGWIN__ */
+
 #ifndef __TCHAR_DEFINED
 #define __TCHAR_DEFINED
   typedef wchar_t _TCHAR;
@@ -118,6 +126,8 @@
 
 #define __T(x) L##x
 
+#ifndef __CYGWIN__
+
 #define _tmain wmain
 #define _tWinMain wWinMain
 #define _tenviron _wenviron
@@ -470,6 +480,8 @@
 #define _ttelldir	_wtelldir
 #define _tseekdir	_wseekdir
 
+#endif /* __CYGWIN__ */
+
 #else
 
 #ifdef __cplusplus
@@ -486,6 +498,8 @@
 
 #define __T(x) x
 
+#ifndef __CYGWIN__
+
 #define _tmain main
 #define _tWinMain WinMain
 #ifdef _POSIX_
@@ -733,12 +747,16 @@
 
 #define _tsetlocale setlocale
 
+#endif /* __CYGWIN__ */
+
 #ifdef _MBCS
 
 #ifdef __cplusplus
 }
 #endif
 
+#ifndef __CYGWIN__
+
 #include <mbstring.h>
 
 #ifdef __cplusplus
@@ -939,6 +957,9 @@
 #define _istlead _ismbblead
 #define _istleadbyte isleadbyte
 #define _istleadbyte_l _isleadbyte_l
+
+#endif /* __CYGWIN__ */
+
 #else
 
 #ifndef __TCHAR_DEFINED
@@ -958,6 +979,8 @@
 #endif
 #endif
 
+#ifndef __CYGWIN__
+
 #define _tcschr strchr
 #define _tcscspn strcspn
 #define _tcsncat strncat
@@ -1096,6 +1119,8 @@
 #endif
 #endif
 
+#endif /* __CYGWIN__ */
+
 #define _T(x) __T(x)
 #define _TEXT(x) __T(x)
 
@@ -1103,5 +1128,7 @@
 }
 #endif
 
+#ifndef __CYGWIN__
 #include <sec_api/tchar_s.h>
+#endif /* __CYGWIN__ */
 #endif