From: Roumen Petrov Date: Sat, 23 Feb 2013 13:52:48 +0200 Issue #17590: Move macros from pyconfig.h to pyport.h for Min GW diff -r 3f921c3b1e87 Include/pyport.h --- a/Include/pyport.h Fri Mar 11 22:53:15 2016 +0100 +++ b/Include/pyport.h Sun Mar 13 01:24:45 2016 +0000 @@ -13,6 +13,26 @@ #include #endif +/* Translate Windows-specific defines to those used in Python code: + * MS_WIN64 - Code specific to the MS Win64 API + * MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs) + * MS_WINDOWS - Code specific to Windows, but all versions. + +MSVC defines _WINxx to differentiate the windows platform types. +Note that for compatibility reasons _WIN32 is defined on Win32 +*and* on Win64. For the same reasons, in Python, MS_WIN32 is +defined on Win32 *and* Win64. Win32 only code must therefore be +guarded as follows: + #if defined(MS_WIN32) && !defined(MS_WIN64) +*/ +#ifdef _WIN64 +# define MS_WIN64 +#endif +#ifdef _WIN32 +# define MS_WIN32 /* only support win32 and greater. */ +# define MS_WINDOWS +#endif + /************************************************************************** Symbols and macros to supply platform-independent interfaces to basic C language & library operations whose spellings vary across platforms. diff -r 3f921c3b1e87 Misc/NEWS --- a/Misc/NEWS Fri Mar 11 22:53:15 2016 +0100 +++ b/Misc/NEWS Sun Mar 13 01:24:45 2016 +0000 @@ -804,6 +804,10 @@ Build ----- +- Issue #17590: Move basic Windows platform macros from PC/pyconfig.h to + "pyport.h" to support building with the "configure" script and Min GW. + Based on patch by Roumen Petrov. + - Issue #26465: Update Windows builds to use OpenSSL 1.0.2g. - Issue #25348: Added ``--pgo`` and ``--pgo-job`` arguments to diff -r 3f921c3b1e87 PC/pyconfig.h --- a/PC/pyconfig.h Fri Mar 11 22:53:15 2016 +0100 +++ b/PC/pyconfig.h Sun Mar 13 01:24:45 2016 +0000 @@ -11,9 +11,7 @@ The code specific to Windows should be wrapped around one of the following #defines -MS_WIN64 - Code specific to the MS Win64 API -MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs) -MS_WINDOWS - Code specific to Windows, but all versions. +MS_WIN64, MS_WIN32, or MS_WINDOWS - Defined later in "pyport.h" MS_WINCE - Code specific to Windows CE Py_ENABLE_SHARED - Code if the Python core is built as a DLL. @@ -75,8 +73,6 @@ #define LONG_BIT 32 #define WORD_BIT 32 -#define MS_WIN32 /* only support win32 and greater. */ -#define MS_WINDOWS #ifndef PYTHONPATH # define PYTHONPATH L".\\DLLs;.\\lib" #endif @@ -126,22 +122,12 @@ #define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X #define _Py_STRINGIZE2(X) #X -/* MSVC defines _WINxx to differentiate the windows platform types +/* set the COMPILER - Note that for compatibility reasons _WIN32 is defined on Win32 - *and* on Win64. For the same reasons, in Python, MS_WIN32 is - defined on Win32 *and* Win64. Win32 only code must therefore be - guarded as follows: - #if defined(MS_WIN32) && !defined(MS_WIN64) Some modules are disabled on Itanium processors, therefore we have MS_WINI64 set for those targets, otherwise MS_WINX64 */ #ifdef _WIN64 -#define MS_WIN64 -#endif - -/* set the COMPILER */ -#ifdef MS_WIN64 #if defined(_M_IA64) #define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)") #define MS_WINI64 @@ -157,7 +143,7 @@ #else #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") #endif -#endif /* MS_WIN64 */ +#endif /* _WIN64 */ /* set the version macros for the windows headers */ /* Python 3.5+ requires Windows Vista or greater */ @@ -189,14 +175,14 @@ #endif /* Define like size_t, omitting the "unsigned" */ -#ifdef MS_WIN64 +#ifdef _WIN64 typedef __int64 ssize_t; #else typedef _W64 int ssize_t; #endif #define HAVE_SSIZE_T 1 -#if defined(MS_WIN32) && !defined(MS_WIN64) +#ifndef _WIN64 #if defined(_M_IX86) #if defined(__INTEL_COMPILER) #define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]") @@ -210,7 +196,7 @@ #else #define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)") #endif -#endif /* MS_WIN32 && !MS_WIN64 */ +#endif /* !_WIN64 */ typedef int pid_t; @@ -322,7 +308,7 @@ # endif /* Py_BUILD_CORE */ #endif /* MS_COREDLL */ -#if defined(MS_WIN64) +#if defined(_WIN64) /* maintain "win32" sys.platform for backward compatibility of Python code, the Win64 API should be close enough to the Win32 API to make this preferable */ @@ -339,7 +325,7 @@ then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64 should define this. */ # define HAVE_LARGEFILE_SUPPORT -#elif defined(MS_WIN32) +#else # define PLATFORM "win32" # define HAVE_LARGEFILE_SUPPORT # define SIZEOF_VOID_P 4 @@ -360,8 +346,6 @@ #endif -#ifdef MS_WIN32 - #define SIZEOF_SHORT 2 #define SIZEOF_INT 4 #define SIZEOF_LONG 4 @@ -383,8 +367,6 @@ #endif /* _MSC_VER > 1300 */ #endif /* _MSC_VER */ -#endif - /* define signed and unsigned exact-width 32-bit and 64-bit types, used in the implementation of Python integers. */ #ifndef PY_UINT32_T