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/ceval.c b/Python/ceval.c
index ef5bced..6218397 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -108,7 +108,9 @@
 
 #ifdef WITH_THREAD
 
+#ifndef DONT_HAVE_ERRNO_H
 #include <errno.h>
+#endif
 #include "pythread.h"
 
 extern int _PyThread_Started; /* Flag for Py_Exit */
diff --git a/Python/import.c b/Python/import.c
index 936cbda..851fd06 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -55,8 +55,12 @@
 #ifndef DONT_HAVE_STAT
 #define HAVE_STAT
 
+#ifndef DONT_HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
+#ifndef DONT_HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
 
 #if defined(PYCC_VACPP)
 /* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */
diff --git a/Python/mystrtoul.c b/Python/mystrtoul.c
index b5ea751..ac70e44 100644
--- a/Python/mystrtoul.c
+++ b/Python/mystrtoul.c
@@ -60,7 +60,9 @@
 */
 
 #include <ctype.h>
+#ifndef DONT_HAVE_ERRNO_H
 #include <errno.h>
+#endif
 
 unsigned long
 PyOS_strtoul(str, ptr, base)
diff --git a/Python/strtod.c b/Python/strtod.c
index 1c475e5..a0991d5 100644
--- a/Python/strtod.c
+++ b/Python/strtod.c
@@ -54,7 +54,9 @@
 
 extern	double	atof();		/* Only called when result known to be ok */
 
+#ifndef DONT_HAVE_ERRNO_H
 #include <errno.h>
+#endif
 extern	int	errno;
 
 double strtod(str, ptr)
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"