From 40d6aaa0260b733a5bb004fd90287148e09a249c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
 <alexey.pawlow@gmail.com>
Date: Thu, 17 Jun 2021 18:51:21 +0530
Subject: [PATCH 011/N] MINGW determine if pwdmodule should be used
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Алексей <alexey.pawlow@gmail.com>
Co-authored-by: Christoph Reiter <reiter.christoph@gmail.com>
---
 Modules/Setup           | 2 --
 Modules/Setup.config.in | 3 +++
 configure.ac            | 7 +++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Modules/Setup b/Modules/Setup
index 6b6926d..2bafdd0 100644
--- a/Modules/Setup
+++ b/Modules/Setup
@@ -102,8 +102,6 @@ PYTHONPATH=$(COREPYTHONPATH)
 # setup.py script in the root of the Python source tree.
 
 errno errnomodule.c			# posix (UNIX) errno values
-pwd pwdmodule.c				# this is needed to find out the user's home dir
-					# if $HOME is not set
 _sre _sre.c				# Fredrik Lundh's new regular expressions
 _codecs _codecsmodule.c			# access to the builtin codecs and codec registry
 _weakref _weakref.c			# weak references
diff --git a/Modules/Setup.config.in b/Modules/Setup.config.in
index 612cabd..d071a74 100644
--- a/Modules/Setup.config.in
+++ b/Modules/Setup.config.in
@@ -6,6 +6,9 @@
 # init system calls(posix/nt/...) for INITFUNC (used by makesetup)
 @INITSYS@ -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c
 
+# This is needed to find out the user's home dir if $HOME is not set
+@USE_PWD_MODULE@pwd pwdmodule.c
+
 # build-in modules for windows platform:
 @USE_WIN32_MODULE@winreg ../PC/winreg.c
 
diff --git a/configure.ac b/configure.ac
index e307fe3..52b3120 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3333,6 +3333,13 @@ case $host in
   *-*-mingw*) USE_WIN32_MODULE=;;
 esac
 
+# Determine if pwdmodule should be used.
+AC_SUBST(USE_PWD_MODULE)
+USE_PWD_MODULE=
+case $host in
+  *-*-mingw*) USE_PWD_MODULE='#';;
+esac
+
 # Templates for things AC_DEFINEd more than once.
 # For a single AC_DEFINE, no template is needed.
 AH_TEMPLATE(_REENTRANT,
-- 
2.32.0

