MINGW-packages/mingw-w64-python/0107-Add-libraries-to-fix-compile-of-ctypes-on-MINGW.patch
2025-06-07 14:11:54 +02:00

45 lines
1.6 KiB
Diff

From 6fa96e4de4febe8a4c5d91f33356f704cf06e425 Mon Sep 17 00:00:00 2001
From: Naveen M K <naveen521kk@gmail.com>
Date: Mon, 1 Jan 2024 14:25:11 +0530
Subject: [PATCH 107/N] Add libraries to fix compile of ctypes on MINGW
---
configure.ac | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index e15e19a..159d4fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4294,6 +4294,12 @@ AS_CASE([$MACHDEP],
[SELECTMODULE_LIBS=""]
)
+dnl On MINGW, you need to link againt ole32, oleaut32 and uuid for ctypes
+AS_CASE([$MACHDEP],
+ [win32], [CTYPES_LIBS="-lole32 -loleaut32 -luuid"],
+ [CTYPES_LIBS=""]
+)
+
dnl detect sqlite3 from Emscripten emport
PY_CHECK_EMSCRIPTEN_PORT([LIBSQLITE3], [-sUSE_SQLITE3])
@@ -7991,7 +7997,7 @@ PY_STDLIB_MOD([_crypt],
[$LIBCRYPT_CFLAGS], [$LIBCRYPT_LIBS])
PY_STDLIB_MOD([_ctypes],
[], [test "$have_libffi" = yes],
- [$NO_STRICT_OVERFLOW_CFLAGS $LIBFFI_CFLAGS], [$LIBFFI_LIBS])
+ [$NO_STRICT_OVERFLOW_CFLAGS $LIBFFI_CFLAGS], [$LIBFFI_LIBS $CTYPES_LIBS])
PY_STDLIB_MOD([_curses],
[], [test "$have_curses" != "no"],
[$CURSES_CFLAGS], [$CURSES_LIBS]
@@ -8062,7 +8068,7 @@ PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
PY_STDLIB_MOD([_testconsole], [test "$TEST_MODULES" = yes -a "$MACHDEP" = "win32"])
PY_STDLIB_MOD([_ctypes_test],
[test "$TEST_MODULES" = yes], [test "$have_libffi" = yes -a "$have_dynamic_loading" = yes],
- [], [$LIBM])
+ [], [$LIBM $CTYPES_LIBS])
dnl Limited API template modules.
dnl The limited C API is not compatible with the Py_TRACE_REFS macro.