8000 Issue #17598: MINGW: init system calls · MediaTek-Labs/cpython@4fd5307 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4fd5307

Browse files
Roumen PetrovFaraz Shahbazker
authored andcommitted
Issue python#17598: MINGW: init system calls
1 parent 6a5b299 commit 4fd5307

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

Modules/posixmodule.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,25 @@ corresponding Unix manual entries for more information on calls.");
173173
#define HAVE_CWAIT 1
174174
#define HAVE_FSYNC 1
175175
#define fsync _commit
176+
#elif defined(__MINGW32__) /* GCC for windows hosts */
177+
/* getlogin is detected by configure on mingw-w64 */
178+
#undef HAVE_GETLOGIN
179+
/*#define HAVE_GETCWD 1 - detected by configure*/
180+
#define HAVE_GETPPID 1
181+
#define HAVE_GETLOGIN 1
182+
#define HAVE_SPAWNV 1
183+
/*#define HAVE_EXECV 1 - detected by configure*/
184+
#define HAVE_PIPE 1
185+
#define HAVE_POPEN 1
186+
#define HAVE_SYSTEM 1
187+
#define HAVE_CWAIT 1
188+
#define HAVE_FSYNC 1
189+
#define fsync _commit
190+
#include <windows.h>
191+
#include <winioctl.h>
192+
#ifndef _MAX_ENV
193+
#define _MAX_ENV 32767
194+
#endif
176195
#else
177196
/* Unix functions that the configure script doesn't check for */
178197
#define HAVE_EXECV 1
@@ -289,7 +308,7 @@ extern int lstat(const char *, struct stat *);
289308
#endif
290309
#endif
291310

292-
#ifdef _MSC_VER
311+
#ifdef MS_WINDOWS
293312
#ifdef HAVE_DIRECT_H
294313
#include <direct.h>
295314
#endif
@@ -1308,7 +1327,7 @@ win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag)
13081327
*/
13091328
#include <crt_externs.h>
13101329
static char **environ;
1311-
#elif !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
1330+
#elif !defined(MS_WINDOWS) && ( !defined(__WATCOMC__) || defined(__QNX__) )
13121331
extern char **environ;
13131332
#endif /* !_MSC_VER */
13141333

configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,14 @@ then
559559
AC_DEFINE(_INCLUDE__STDC_A1_SOURCE, 1, Define to include mbstate_t for mbrtowc)
560560
fi
561561

562+
AC_MSG_CHECKING([for init system calls])
563+
AC_SUBST(INITSYS)
564+
case $host in
565+
*-*-mingw*) INITSYS=nt;;
566+
*) INITSYS=posix;;
567+
esac
568+
AC_MSG_RESULT([$INITSYS])
569+
562570
# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
563571
# it may influence the way we can build extensions, so distutils
564572
# needs to check it

0 commit comments

Comments
 (0)
0