Skip to content

Commit

Permalink
Patch #1495999: Part two of Windows CE changes.
Browse files Browse the repository at this point in the history
- update header checks, using autoconf
- provide dummies for getenv, environ, and GetVersion
- adjust MSC_VER check in socketmodule.c

git-svn-id: http://svn.python.org/projects/python/trunk@46819 6015fed2-1504-0410-9fe1-9d1591cc4771
  • Loading branch information
martin.v.loewis committed Jun 10, 2006
1 parent 3ca2129 commit af39d30
Show file tree
Hide file tree
Showing 26 changed files with 201 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Include/Python.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#endif

#include <string.h>
#ifndef DONT_HAVE_ERRNO_H
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <stdlib.h>
Expand Down
8 changes: 4 additions & 4 deletions Include/pyport.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ typedef Py_intptr_t Py_ssize_t;
* to your pyconfig.h. Python code beyond this should check HAVE_STAT and
* HAVE_FSTAT instead.
* Also
* #define DONT_HAVE_SYS_STAT_H
* if <sys/stat.h> doesn't exist on your platform, and
* #define HAVE_SYS_STAT_H
* if <sys/stat.h> exists on your platform, and
* #define HAVE_STAT_H
* if <stat.h> does (don't look at me -- ths mess is inherited).
* if <stat.h> does.
*/
#ifndef DONT_HAVE_STAT
#define HAVE_STAT
Expand All @@ -258,7 +258,7 @@ typedef Py_intptr_t Py_ssize_t;
#include "unixstuff.h"
#endif

#ifndef DONT_HAVE_SYS_STAT_H
#ifdef HAVE_SYS_STAT_H
#if defined(PYOS_OS2) && defined(PYCC_GCC)
#include <sys/types.h>
#endif
Expand Down
4 changes: 4 additions & 0 deletions Modules/_hotshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
*/
#ifdef MS_WINDOWS
#include <windows.h>

#ifdef HAVE_DIRECT_H
#include <direct.h> /* for getcwd() */
#endif

typedef __int64 hs_time;
#define GETTIMEOFDAY(P_HS_TIME) \
{ LARGE_INTEGER _temp; \
Expand Down
2 changes: 1 addition & 1 deletion Modules/_localemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This software comes with no warranty. Use at your own risk.
#include <string.h>
#include <ctype.h>

#ifndef DONT_HAVE_ERRNO_H
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif

Expand Down
4 changes: 2 additions & 2 deletions Modules/arraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#ifdef STDC_HEADERS
#include <stddef.h>
#else /* !STDC_HEADERS */
#ifndef DONT_HAVE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> /* For size_t */
#endif /* DONT_HAVE_SYS_TYPES_H */
#endif /* HAVE_SYS_TYPES_H */
#endif /* !STDC_HEADERS */

struct arrayobject; /* Forward */
Expand Down
3 changes: 3 additions & 0 deletions Modules/mmapmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ my_getpagesize(void)
#endif /* UNIX */

#include <string.h>

#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */

/* Prefer MAP_ANONYMOUS since MAP_ANON is deprecated according to man page. */
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
Expand Down
13 changes: 13 additions & 0 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,21 @@ corresponding Unix manual entries for more information on calls.");
#include "osdefs.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 */

#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h> /* For WNOHANG */
#endif

#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif

#ifdef HAVE_FCNTL_H
#include <fcntl.h>
Expand Down Expand Up @@ -246,9 +253,15 @@ extern int lstat(const char *, struct stat *);
#endif

#ifdef _MSC_VER
#ifdef HAVE_DIRECT_H
#include <direct.h>
#endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#ifdef HAVE_PROCESS_H
#include <process.h>
#endif
#include "osdefs.h"
#define _WIN32_WINNT 0x0400 /* Needed for CryptoAPI on some systems */
#include <windows.h>
Expand Down
2 changes: 1 addition & 1 deletion Modules/selectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
extern void bzero(void *, int);
#endif

#ifndef DONT_HAVE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif

Expand Down
8 changes: 6 additions & 2 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ shutdown(how) -- shut down traffic in one or both directions\n\
#endif

/* Generic includes */
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif

/* Generic socket object definitions and includes */
#define PySocket_BUILDING_SOCKET
Expand Down Expand Up @@ -270,7 +272,9 @@ int h_errno; /* not used */
#else

/* MS_WINDOWS includes */
# include <fcntl.h>
# ifdef HAVE_FCNTL_H
# include <fcntl.h>
# endif

#endif

Expand All @@ -290,7 +294,7 @@ int h_errno; /* not used */
* _SS_ALIGNSIZE is defined in sys/socket.h by 6.5.21,
* for example, but not by 6.5.10.
*/
#elif defined(_MSC_VER) && _MSC_VER>1200
#elif defined(_MSC_VER) && _MSC_VER>1201
/* Do not include addrinfo.h for MSVC7 or greater. 'addrinfo' and
* EAI_* constants are defined in (the already included) ws2tcpip.h.
*/
Expand Down
2 changes: 2 additions & 0 deletions Modules/timemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

#include <ctype.h>

#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */

#ifdef QUICKWIN
#include <io.h>
Expand Down
4 changes: 2 additions & 2 deletions Objects/fileobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include "Python.h"
#include "structmember.h"

#ifndef DONT_HAVE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* DONT_HAVE_SYS_TYPES_H */
#endif /* HAVE_SYS_TYPES_H */

#ifdef MS_WINDOWS
#define fileno _fileno
Expand Down
6 changes: 6 additions & 0 deletions PC/getpathp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 24 additions & 0 deletions PC/os2emx/pyconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,33 @@ typedef long intptr_t;
/* 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

Expand All @@ -272,12 +290,18 @@ typedef long intptr_t;
/* 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

Expand Down
8 changes: 8 additions & 0 deletions PC/os2vacpp/pyconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ typedef int pid_t;
#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 */
Expand All @@ -124,6 +128,7 @@ typedef int pid_t;
#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() */
Expand Down Expand Up @@ -163,7 +168,9 @@ typedef int pid_t;
#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() */
Expand All @@ -172,6 +179,7 @@ typedef int pid_t;
/* #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() */
Expand Down
46 changes: 44 additions & 2 deletions PC/pyconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,15 @@ MS_CORE_DLL.
#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 */
Expand Down Expand Up @@ -356,6 +363,16 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* 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 */

Expand Down Expand Up @@ -561,11 +578,26 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* 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

Expand All @@ -581,12 +613,22 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* 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 */

Expand Down
2 changes: 2 additions & 0 deletions PC/winsound.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ PyEval_GetCallStats(PyObject *self)

#ifdef WITH_THREAD

#ifndef DONT_HAVE_ERRNO_H
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include "pythread.h"
Expand Down
2 changes: 2 additions & 0 deletions Python/dynload_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
/* Support for dynamic loading of extension modules */

#include <windows.h>
#ifdef HAVE_DIRECT_H
#include <direct.h>
#endif
#include <ctype.h>

#include "Python.h"
Expand Down
Loading

0 comments on commit af39d30

Please sign in to comment.