Changes by Mark Hammond for Windows CE.  Mostly of the form
  #ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
diff --git a/Python/thread.c b/Python/thread.c
index c533398..0f46223 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -42,13 +42,17 @@
 #define DL_IMPORT(RTYPE) RTYPE
 #endif
 
+#ifndef DONT_HAVE_STDIO_H
 #include <stdio.h>
+#endif
 
 #ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 #else
+#ifdef Py_DEBUG
 extern char *getenv();
 #endif
+#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -162,6 +166,10 @@
 #include "thread_beos.h"
 #endif
 
+#ifdef WINCE_THREADS
+#include "thread_wince.h"
+#endif
+
 /*
 #ifdef FOOBAR_THREADS
 #include "thread_foobar.h"