Patch #1495999: Part two of Windows CE changes.
- update header checks, using autoconf
- provide dummies for getenv, environ, and GetVersion
- adjust MSC_VER check in socketmodule.c
diff --git a/PC/getpathp.c b/PC/getpathp.c
index 37a9c0b..2bd3f26 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -62,8 +62,14 @@
 #include <tchar.h>
 #endif
 
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+
+#ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif /* HAVE_SYS_STAT_H */
+
 #include <string.h>
 
 /* Search in some common locations for the associated Python libraries.
diff --git a/PC/os2emx/pyconfig.h b/PC/os2emx/pyconfig.h
index afe79e4..3d6e5f1 100644
--- a/PC/os2emx/pyconfig.h
+++ b/PC/os2emx/pyconfig.h
@@ -254,15 +254,33 @@
 /* Define if you have the waitpid function. */
 #define HAVE_WAITPID 1
 
+/* Define if you have the <conio.h> header file. */
+#undef HAVE_CONIO_H
+
+/* Define if you have the <direct.h> header file. */
+#undef HAVE_DIRECT_H
+
 /* Define if you have the <dirent.h> header file. */
 #define HAVE_DIRENT_H 1
 
+/* Define if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
 /* Define if you have the <fcntl.h> header file. */
 #define HAVE_FCNTL_H 1
 
+/* Define if you have the <io.h> header file. */
+#undef HAVE_IO_H
+
 /* Define if you have the <ncurses.h> header file. */
 #define HAVE_NCURSES_H 1
 
+/* Define to 1 if you have the <process.h> header file. */
+#define HAVE_PROCESS_H 1
+
+/* Define if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
 /* Define if you have the <sys/file.h> header file. */
 #define HAVE_SYS_FILE_H 1
 
@@ -272,12 +290,18 @@
 /* Define if you have the <sys/select.h> header file. */
 #define HAVE_SYS_SELECT_H 1
 
+/* Define if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
 /* Define if you have the <sys/time.h> header file. */
 #define HAVE_SYS_TIME_H 1
 
 /* Define if you have the <sys/times.h> header file. */
 #define HAVE_SYS_TIMES_H 1
 
+/* Define if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
 /* Define if you have the <sys/un.h> header file. */
 #define HAVE_SYS_UN_H 1
 
diff --git a/PC/os2vacpp/pyconfig.h b/PC/os2vacpp/pyconfig.h
index c858fe9..97f9b80 100644
--- a/PC/os2vacpp/pyconfig.h
+++ b/PC/os2vacpp/pyconfig.h
@@ -112,6 +112,10 @@
 #define HAVE_HYPOT               1 /* hypot()                               */
 #define HAVE_PUTENV              1 /* putenv()                              */
 /* #define VA_LIST_IS_ARRAY   1 */ /* if va_list is an array of some kind   */
+/* #define HAVE_CONIO_H       1 */ /* #include <conio.h>                    */
+#define HAVE_ERRNO_H             1 /* #include <errno.h>                    */
+#define HAVE_SYS_STAT_H          1 /* #include <sys/stat.h>                 */
+#define HAVE_SYS_TYPES_H         1 /* #include <sys/types.h>                */
 
   /* Variable-Arguments/Prototypes */
 #define HAVE_PROTOTYPES          1 /* VAC++ supports C Function Prototypes  */
@@ -124,6 +128,7 @@
 #define MALLOC_ZERO_RETURNS_NULL 1 /* Our malloc(0) returns a NULL ptr      */
 
   /* Signal Handling */
+#define HAVE_SIGNAL_H            1 /* signal.h                              */
 #define RETSIGTYPE            void /* Return type of handlers (int or void) */
 /* #undef WANT_SIGFPE_HANDLER   */ /* Handle SIGFPE (see Include/pyfpe.h)   */
 /* #define HAVE_ALARM         1 */ /* alarm()                               */
@@ -163,7 +168,9 @@
 #define HAVE_SETVBUF             1 /* setvbuf()                             */
 #define HAVE_GETCWD              1 /* getcwd()                              */
 #define HAVE_PIPE                1 /* pipe()     [OS/2-specific code added] */
+#define HAVE_IO_H                1 /* #include <io.h>                       */
 #define HAVE_FCNTL_H             1 /* #include <fcntl.h>                    */
+#define HAVE_DIRECT_H            1 /* #include <direct.h>                   */
 /* #define HAVE_FLOCK         1 */ /* flock()                               */
 /* #define HAVE_TRUNCATE      1 */ /* truncate()                            */
 /* #define HAVE_FTRUNCATE     1 */ /* ftruncate()                           */
@@ -172,6 +179,7 @@
 /* #define HAVE_OPENDIR       1 */ /* opendir()                             */
 
   /* Process Operations */
+#define HAVE_PROCESS_H           1 /* #include <process.h>                  */
 #define HAVE_GETPID              1 /* getpid()                              */
 #define HAVE_SYSTEM              1 /* system()                              */
 #define HAVE_WAIT                1 /* wait()                                */
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index 14a32db..e0df673 100644
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -78,8 +78,15 @@
 #endif
 
 #ifdef MS_WINCE
-#define DONT_HAVE_SYS_STAT_H
-#define DONT_HAVE_ERRNO_H
+/* Python uses GetVersion() to distinguish between
+ * Windows NT and 9x/ME where OS Unicode support is concerned.
+ * Windows CE supports Unicode in the same way as NT so we
+ * define the missing GetVersion() accordingly.
+ */
+#define GetVersion() (4)
+/* Windows CE does not support environment variables */
+#define getenv(v) (NULL)
+#define environ (NULL)
 #endif
 
 /* Compiler specific defines */
@@ -356,6 +363,16 @@
 /* Define to empty if the keyword does not work.  */
 /* #define const  */
 
+/* Define to 1 if you have the <conio.h> header file. */
+#ifndef MS_WINCE
+#define HAVE_CONIO_H 1
+#endif
+
+/* Define to 1 if you have the <direct.h> header file. */
+#ifndef MS_WINCE
+#define HAVE_DIRECT_H 1
+#endif
+
 /* Define if you have dirent.h.  */
 /* #define DIRENT 1 */
 
@@ -561,11 +578,26 @@
 /* Define if you have the <dlfcn.h> header file.  */
 /* #undef HAVE_DLFCN_H */
 
+/* Define to 1 if you have the <errno.h> header file. */
+#ifndef MS_WINCE
+#define HAVE_ERRNO_H 1
+#endif
+
 /* Define if you have the <fcntl.h> header file.  */
 #ifndef MS_WINCE
 #define HAVE_FCNTL_H 1
 #endif
 
+/* Define to 1 if you have the <process.h> header file. */
+#ifndef MS_WINCE
+#define HAVE_PROCESS_H 1
+#endif
+
+/* Define to 1 if you have the <signal.h> header file. */
+#ifndef MS_WINCE
+#define HAVE_SIGNAL_H 1
+#endif
+
 /* Define if you have the <stdarg.h> prototypes.  */
 #define HAVE_STDARG_PROTOTYPES
 
@@ -581,12 +613,22 @@
 /* Define if you have the <sys/select.h> header file.  */
 /* #define HAVE_SYS_SELECT_H 1 */
 
+/* Define to 1 if you have the <sys/stat.h> header file.  */
+#ifndef MS_WINCE
+#define HAVE_SYS_STAT_H 1
+#endif
+
 /* Define if you have the <sys/time.h> header file.  */
 /* #define HAVE_SYS_TIME_H 1 */
 
 /* Define if you have the <sys/times.h> header file.  */
 /* #define HAVE_SYS_TIMES_H 1 */
 
+/* Define to 1 if you have the <sys/types.h> header file.  */
+#ifndef MS_WINCE
+#define HAVE_SYS_TYPES_H 1
+#endif
+
 /* Define if you have the <sys/un.h> header file.  */
 /* #define HAVE_SYS_UN_H 1 */
 
diff --git a/PC/winsound.c b/PC/winsound.c
index bc30ccc..c593d77 100644
--- a/PC/winsound.c
+++ b/PC/winsound.c
@@ -37,7 +37,9 @@
 
 #include <windows.h>
 #include <mmsystem.h>
+#ifdef HAVE_CONIO_H
 #include <conio.h>	/* port functions on Win9x */
+#endif
 #include <Python.h>
 
 PyDoc_STRVAR(sound_playsound_doc,