From 367e3543d3d6310051adc9cf8a43f0eb4f437566 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sat, 13 Sep 2025 17:55:15 +0200
Subject: [PATCH 180/N] soabi fixes

---
 configure.ac | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 62a9dcd..2cc8b0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6705,7 +6705,7 @@ AC_MSG_CHECKING([ABIFLAGS])
 AC_MSG_RESULT([$ABIFLAGS])
 AC_MSG_CHECKING([SOABI])
 case $host_os in
-    mingw*) SOABI='cp'`echo $VERSION | tr -d .`;;
+    mingw*) SOABI='cp'`echo $VERSION | tr -d .`${ABI_THREAD}-${PYD_PLATFORM_TAG};;
     *) SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${SOABI_PLATFORM:+-$SOABI_PLATFORM};;
 esac
 AC_MSG_RESULT([$SOABI])
@@ -6716,7 +6716,7 @@ if test "$Py_DEBUG" = 'true'; then
   # Similar to SOABI but remove "d" flag from ABIFLAGS
   AC_SUBST([ALT_SOABI])
   case $host_os in
-      mingw*) ALT_SOABI='cp'`echo $VERSION | tr -d .`;;
+      mingw*) ALT_SOABI='cp'`echo $VERSION | tr -d .`${ABI_THREAD}-${PYD_PLATFORM_TAG};;
       *) ALT_SOABI='cpython-'`echo $VERSION | tr -d .``echo $ABIFLAGS | tr -d d`${SOABI_PLATFORM:+-$SOABI_PLATFORM};;
   esac
   AC_DEFINE_UNQUOTED([ALT_SOABI], ["${ALT_SOABI}"],
@@ -6724,12 +6724,15 @@ if test "$Py_DEBUG" = 'true'; then
 fi
 
 AC_SUBST([EXT_SUFFIX])
-VERSION_NO_DOTS=$(echo $LDVERSION | tr -d .)
-if test -n "${PYD_PLATFORM_TAG}"; then
-  EXT_SUFFIX="${ABIFLAGS}.cp${VERSION_NO_DOTS}-${PYD_PLATFORM_TAG}${SHLIB_SUFFIX}"
-else
-  EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX}
+
+PYD_DEBUG_SUFFIX=""
+if test "$Py_DEBUG" = "true"; then
+  PYD_DEBUG_SUFFIX="_d"
 fi
+case $host_os in
+    mingw*) EXT_SUFFIX=${PYD_DEBUG_SUFFIX}.${SOABI}${SHLIB_SUFFIX};;
+    *) EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
+esac
 
 AC_MSG_CHECKING([LDVERSION])
 LDVERSION='$(VERSION)$(ABIFLAGS)'
