| 1 | #ifndef Py_CONFIG_H
|
|---|
| 2 | #define Py_CONFIG_H
|
|---|
| 3 |
|
|---|
| 4 | /* pyconfig.h. NOT Generated automatically by configure.
|
|---|
| 5 |
|
|---|
| 6 | This is a manually maintained version used for the Watcom,
|
|---|
| 7 | Borland and Microsoft Visual C++ compilers. It is a
|
|---|
| 8 | standard part of the Python distribution.
|
|---|
| 9 |
|
|---|
| 10 | WINDOWS DEFINES:
|
|---|
| 11 | The code specific to Windows should be wrapped around one of
|
|---|
| 12 | the following #defines
|
|---|
| 13 |
|
|---|
| 14 | MS_WIN64 - Code specific to the MS Win64 API
|
|---|
| 15 | MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs)
|
|---|
| 16 | MS_WINDOWS - Code specific to Windows, but all versions.
|
|---|
| 17 | MS_WINCE - Code specific to Windows CE
|
|---|
| 18 | Py_ENABLE_SHARED - Code if the Python core is built as a DLL.
|
|---|
| 19 |
|
|---|
| 20 | Also note that neither "_M_IX86" or "_MSC_VER" should be used for
|
|---|
| 21 | any purpose other than "Windows Intel x86 specific" and "Microsoft
|
|---|
| 22 | compiler specific". Therefore, these should be very rare.
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | NOTE: The following symbols are deprecated:
|
|---|
| 26 | NT, WIN32, USE_DL_EXPORT, USE_DL_IMPORT, DL_EXPORT, DL_IMPORT
|
|---|
| 27 | MS_CORE_DLL.
|
|---|
| 28 |
|
|---|
| 29 | */
|
|---|
| 30 |
|
|---|
| 31 | #ifdef _WIN32_WCE
|
|---|
| 32 | #define MS_WINCE
|
|---|
| 33 | #endif
|
|---|
| 34 |
|
|---|
| 35 | /* Visual Studio 2005 introduces deprecation warnings for
|
|---|
| 36 | "insecure" and POSIX functions. The insecure functions should
|
|---|
| 37 | be replaced by *_s versions (according to Microsoft); the
|
|---|
| 38 | POSIX functions by _* versions (which, according to Microsoft,
|
|---|
| 39 | would be ISO C conforming). Neither renaming is feasible, so
|
|---|
| 40 | we just silence the warnings. */
|
|---|
| 41 |
|
|---|
| 42 | #define _CRT_SECURE_NO_DEPRECATE 1
|
|---|
| 43 | #define _CRT_NONSTDC_NO_DEPRECATE 1
|
|---|
| 44 |
|
|---|
| 45 | /* Windows CE does not have these */
|
|---|
| 46 | #ifndef MS_WINCE
|
|---|
| 47 | #define HAVE_IO_H
|
|---|
| 48 | #define HAVE_SYS_UTIME_H
|
|---|
| 49 | #define HAVE_TEMPNAM
|
|---|
| 50 | #define HAVE_TMPFILE
|
|---|
| 51 | #define HAVE_TMPNAM
|
|---|
| 52 | #define HAVE_CLOCK
|
|---|
| 53 | #define HAVE_STRERROR
|
|---|
| 54 | #endif
|
|---|
| 55 |
|
|---|
| 56 | #ifdef HAVE_IO_H
|
|---|
| 57 | #include <io.h>
|
|---|
| 58 | #endif
|
|---|
| 59 |
|
|---|
| 60 | #define HAVE_HYPOT
|
|---|
| 61 | #define HAVE_STRFTIME
|
|---|
| 62 | #define DONT_HAVE_SIG_ALARM
|
|---|
| 63 | #define DONT_HAVE_SIG_PAUSE
|
|---|
| 64 | #define LONG_BIT 32
|
|---|
| 65 | #define WORD_BIT 32
|
|---|
| 66 | #define PREFIX ""
|
|---|
| 67 | #define EXEC_PREFIX ""
|
|---|
| 68 |
|
|---|
| 69 | #define MS_WIN32 /* only support win32 and greater. */
|
|---|
| 70 | #define MS_WINDOWS
|
|---|
| 71 | #ifndef PYTHONPATH
|
|---|
| 72 | # define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
|
|---|
| 73 | #endif
|
|---|
| 74 | #define NT_THREADS
|
|---|
| 75 | #define WITH_THREAD
|
|---|
| 76 | #ifndef NETSCAPE_PI
|
|---|
| 77 | #define USE_SOCKET
|
|---|
| 78 | #endif
|
|---|
| 79 |
|
|---|
| 80 | #ifdef MS_WINCE
|
|---|
| 81 | /* Python uses GetVersion() to distinguish between
|
|---|
| 82 | * Windows NT and 9x/ME where OS Unicode support is concerned.
|
|---|
| 83 | * Windows CE supports Unicode in the same way as NT so we
|
|---|
| 84 | * define the missing GetVersion() accordingly.
|
|---|
| 85 | */
|
|---|
| 86 | #define GetVersion() (4)
|
|---|
| 87 | /* Windows CE does not support environment variables */
|
|---|
| 88 | #define getenv(v) (NULL)
|
|---|
| 89 | #define environ (NULL)
|
|---|
| 90 | #endif
|
|---|
| 91 |
|
|---|
| 92 | /* Compiler specific defines */
|
|---|
| 93 |
|
|---|
| 94 | /* ------------------------------------------------------------------------*/
|
|---|
| 95 | /* Microsoft C defines _MSC_VER */
|
|---|
| 96 | #ifdef _MSC_VER
|
|---|
| 97 |
|
|---|
| 98 | /* We want COMPILER to expand to a string containing _MSC_VER's *value*.
|
|---|
| 99 | * This is horridly tricky, because the stringization operator only works
|
|---|
| 100 | * on macro arguments, and doesn't evaluate macros passed *as* arguments.
|
|---|
| 101 | * Attempts simpler than the following appear doomed to produce "_MSC_VER"
|
|---|
| 102 | * literally in the string.
|
|---|
| 103 | */
|
|---|
| 104 | #define _Py_PASTE_VERSION(SUFFIX) \
|
|---|
| 105 | ("[MSC v." _Py_STRINGIZE(_MSC_VER) " " SUFFIX "]")
|
|---|
| 106 | /* e.g., this produces, after compile-time string catenation,
|
|---|
| 107 | * ("[MSC v.1200 32 bit (Intel)]")
|
|---|
| 108 | *
|
|---|
| 109 | * _Py_STRINGIZE(_MSC_VER) expands to
|
|---|
| 110 | * _Py_STRINGIZE1((_MSC_VER)) expands to
|
|---|
| 111 | * _Py_STRINGIZE2(_MSC_VER) but as this call is the result of token-pasting
|
|---|
| 112 | * it's scanned again for macros and so further expands to (under MSVC 6)
|
|---|
| 113 | * _Py_STRINGIZE2(1200) which then expands to
|
|---|
| 114 | * "1200"
|
|---|
| 115 | */
|
|---|
| 116 | #define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
|
|---|
| 117 | #define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
|
|---|
| 118 | #define _Py_STRINGIZE2(X) #X
|
|---|
| 119 |
|
|---|
| 120 | /* MSVC defines _WINxx to differentiate the windows platform types
|
|---|
| 121 |
|
|---|
| 122 | Note that for compatibility reasons _WIN32 is defined on Win32
|
|---|
| 123 | *and* on Win64. For the same reasons, in Python, MS_WIN32 is
|
|---|
| 124 | defined on Win32 *and* Win64. Win32 only code must therefore be
|
|---|
| 125 | guarded as follows:
|
|---|
| 126 | #if defined(MS_WIN32) && !defined(MS_WIN64)
|
|---|
| 127 | */
|
|---|
| 128 | #ifdef _WIN64
|
|---|
| 129 | #define MS_WIN64
|
|---|
| 130 | #endif
|
|---|
| 131 |
|
|---|
| 132 | /* set the COMPILER */
|
|---|
| 133 | #ifdef MS_WIN64
|
|---|
| 134 | #ifdef _M_IX86
|
|---|
| 135 | #define COMPILER _Py_PASTE_VERSION("64 bit (Intel)")
|
|---|
| 136 | #elif defined(_M_IA64)
|
|---|
| 137 | #define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)")
|
|---|
| 138 | #elif defined(_M_AMD64)
|
|---|
| 139 | #define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
|
|---|
| 140 | #else
|
|---|
| 141 | #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)")
|
|---|
| 142 | #endif
|
|---|
| 143 | #endif /* MS_WIN64 */
|
|---|
| 144 |
|
|---|
| 145 | /* _W64 is not defined for VC6 or eVC4 */
|
|---|
| 146 | #ifndef _W64
|
|---|
| 147 | #define _W64
|
|---|
| 148 | #endif
|
|---|
| 149 |
|
|---|
| 150 | /* Define like size_t, omitting the "unsigned" */
|
|---|
| 151 | #ifdef MS_WIN64
|
|---|
| 152 | typedef __int64 ssize_t;
|
|---|
| 153 | #else
|
|---|
| 154 | typedef _W64 int ssize_t;
|
|---|
| 155 | #endif
|
|---|
| 156 | #define HAVE_SSIZE_T 1
|
|---|
| 157 |
|
|---|
| 158 | #if defined(MS_WIN32) && !defined(MS_WIN64)
|
|---|
| 159 | #ifdef _M_IX86
|
|---|
| 160 | #define COMPILER _Py_PASTE_VERSION("32 bit (Intel)")
|
|---|
| 161 | #else
|
|---|
| 162 | #define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)")
|
|---|
| 163 | #endif
|
|---|
| 164 | #endif /* MS_WIN32 && !MS_WIN64 */
|
|---|
| 165 |
|
|---|
| 166 | typedef int pid_t;
|
|---|
| 167 | #define hypot _hypot
|
|---|
| 168 |
|
|---|
| 169 | #include <float.h>
|
|---|
| 170 | #define Py_IS_NAN _isnan
|
|---|
| 171 | #define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X))
|
|---|
| 172 | #define Py_IS_FINITE(X) _finite(X)
|
|---|
| 173 |
|
|---|
| 174 | /* Turn off warnings about deprecated C runtime functions in
|
|---|
| 175 | VisualStudio .NET 2005 */
|
|---|
| 176 | #if _MSC_VER >= 1400 && !defined _CRT_SECURE_NO_DEPRECATE
|
|---|
| 177 | #define _CRT_SECURE_NO_DEPRECATE
|
|---|
| 178 | #endif
|
|---|
| 179 |
|
|---|
| 180 | #endif /* _MSC_VER */
|
|---|
| 181 |
|
|---|
| 182 | /* define some ANSI types that are not defined in earlier Win headers */
|
|---|
| 183 | #if defined(_MSC_VER) && _MSC_VER >= 1200
|
|---|
| 184 | /* This file only exists in VC 6.0 or higher */
|
|---|
| 185 | #include <basetsd.h>
|
|---|
| 186 | #endif
|
|---|
| 187 |
|
|---|
| 188 | /* ------------------------------------------------------------------------*/
|
|---|
| 189 | /* The Borland compiler defines __BORLANDC__ */
|
|---|
| 190 | /* XXX These defines are likely incomplete, but should be easy to fix. */
|
|---|
| 191 | #ifdef __BORLANDC__
|
|---|
| 192 | #define COMPILER "[Borland]"
|
|---|
| 193 |
|
|---|
| 194 | #ifdef _WIN32
|
|---|
| 195 | /* tested with BCC 5.5 (__BORLANDC__ >= 0x0550)
|
|---|
| 196 | */
|
|---|
| 197 |
|
|---|
| 198 | typedef int pid_t;
|
|---|
| 199 | /* BCC55 seems to understand __declspec(dllimport), it is used in its
|
|---|
| 200 | own header files (winnt.h, ...) - so we can do nothing and get the default*/
|
|---|
| 201 |
|
|---|
| 202 | #undef HAVE_SYS_UTIME_H
|
|---|
| 203 | #define HAVE_UTIME_H
|
|---|
| 204 | #define HAVE_DIRENT_H
|
|---|
| 205 |
|
|---|
| 206 | /* rename a few functions for the Borland compiler */
|
|---|
| 207 | #include <io.h>
|
|---|
| 208 | #define _chsize chsize
|
|---|
| 209 | #define _setmode setmode
|
|---|
| 210 |
|
|---|
| 211 | #else /* !_WIN32 */
|
|---|
| 212 | #error "Only Win32 and later are supported"
|
|---|
| 213 | #endif /* !_WIN32 */
|
|---|
| 214 |
|
|---|
| 215 | #endif /* BORLANDC */
|
|---|
| 216 |
|
|---|
| 217 | /* ------------------------------------------------------------------------*/
|
|---|
| 218 | /* egcs/gnu-win32 defines __GNUC__ and _WIN32 */
|
|---|
| 219 | #if defined(__GNUC__) && defined(_WIN32)
|
|---|
| 220 | /* XXX These defines are likely incomplete, but should be easy to fix.
|
|---|
| 221 | They should be complete enough to build extension modules. */
|
|---|
| 222 | /* Suggested by Rene Liebscher <[email protected]> to avoid a GCC 2.91.*
|
|---|
| 223 | bug that requires structure imports. More recent versions of the
|
|---|
| 224 | compiler don't exhibit this bug.
|
|---|
| 225 | */
|
|---|
| 226 | #if (__GNUC__==2) && (__GNUC_MINOR__<=91)
|
|---|
| 227 | #warning "Please use an up-to-date version of gcc! (>2.91 recommended)"
|
|---|
| 228 | #endif
|
|---|
| 229 |
|
|---|
| 230 | #define COMPILER "[gcc]"
|
|---|
| 231 | #define hypot _hypot
|
|---|
|
|---|