@@ -3279,7 +3279,7 @@ if test -z "$SHLIB_SUFFIX"; then
3279
3279
*) SHLIB_SUFFIX=.so;;
3280
3280
esac
3281
3281
case $host_os in
3282
- mingw*) SHLIB_SUFFIX=.dll ;;
3282
+ mingw*) SHLIB_SUFFIX=.pyd ;;
3283
3283
esac
3284
3284
fi
3285
3285
AC_MSG_RESULT ( $SHLIB_SUFFIX )
@@ -5938,6 +5938,68 @@ esac
5938
5938
# check for endianness
5939
5939
AC_C_BIGENDIAN
5940
5940
5941
+ AC_SUBST ( PYD_PLATFORM_TAG )
5942
+ # Special case of PYD_PLATFORM_TAG with python build with mingw.
5943
+ # Python can with compiled with clang or gcc and linked
5944
+ # to msvcrt or ucrt. To avoid conflicts between them
5945
+ # we are selecting the extension as based on the compiler
5946
+ # and the runtime they link to
5947
+ # gcc + x86_64 + msvcrt = cp{version number}-x86_64
5948
+ # gcc + i686 + msvcrt = cp{version number}-i686
5949
+ # gcc + x86_64 + ucrt = cp{version number}-x86_64-ucrt
5950
+ # clang + x86_64 + ucrt = cp{version number}-x86_64-clang
5951
+ # clang + i686 + ucrt = cp{version number}-i686-clang
5952
+
5953
+ PYD_PLATFORM_TAG=""
5954
+ case $host in
5955
+ *-*-mingw*)
5956
+ # check if we are linking to ucrt
5957
+ AC_MSG_CHECKING ( whether linking to ucrt )
5958
+ AC_COMPILE_IFELSE ( [ AC_LANG_SOURCE ( [ [
5959
+ #include <stdio.h>
5960
+ #ifndef _UCRT
5961
+ #error no ucrt
5962
+ #endif
5963
+ int main(){ return 0; }
5964
+ ] ] ) ] ,[ linking_to_ucrt=yes] ,[ linking_to_ucrt=no] )
5965
+ AC_MSG_RESULT ( $linking_to_ucrt )
5966
+ ;;
5967
+ esac
5968
+ case $host_os in
5969
+ mingw*)
5970
+ AC_MSG_CHECKING ( PYD_PLATFORM_TAG )
5971
+ case $host in
5972
+ i686-*-mingw*)
5973
+ if test -n "${cc_is_clang}"; then
5974
+ # it is CLANG32
5975
+ PYD_PLATFORM_TAG="mingw_i686_clang"
5976
+ else
5977
+ if test $linking_to_ucrt = no; then
5978
+ PYD_PLATFORM_TAG="mingw_i686"
5979
+ else
5980
+ PYD_PLATFORM_TAG="mingw_i686_ucrt"
5981
+ fi
5982
+ fi
5983
+ ;;
5984
+ x86_64-*-mingw*)
5985
+ if test -n "${cc_is_clang}"; then
5986
+ # it is CLANG64
5987
+ PYD_PLATFORM_TAG="mingw_x86_64_clang"
5988
+ else
5989
+ if test $linking_to_ucrt = no; then
5990
+ PYD_PLATFORM_TAG="mingw_x86_64"
5991
+ else
5992
+ PYD_PLATFORM_TAG="mingw_x86_64_ucrt"
5993
+ fi
5994
+ fi
5995
+ ;;
5996
+ aarch64-*-mingw*)
5997
+ PYD_PLATFORM_TAG+="mingw_aarch64"
5998
+ ;;
5999
+ esac
6000
+ AC_MSG_RESULT ( $PYD_PLATFORM_TAG )
6001
+ esac
6002
+
5941
6003
# ABI version string for Python extension modules. This appears between the
5942
6004
# periods in shared library file names, e.g. foo.<SOABI>.so. It is calculated
5943
6005
# from the following attributes which affect the ABI of this Python build (in
@@ -5970,7 +6032,12 @@ if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then
5970
6032
fi
5971
6033
5972
6034
AC_SUBST ( EXT_SUFFIX )
5973
- EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX}
6035
+ VERSION_NO_DOTS=$(echo $LDVERSION | tr -d .)
6036
+ if test -n "${PYD_PLATFORM_TAG}"; then
6037
+ EXT_SUFFIX=".cp${VERSION_NO_DOTS}-${PYD_PLATFORM_TAG}${SHLIB_SUFFIX}"
6038
+ else
6039
+ EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX}
6040
+ fi
5974
6041
5975
6042
AC_MSG_CHECKING ( LDVERSION )
5976
6043
LDVERSION='$(VERSION)$(ABIFLAGS)'
@@ -6596,12 +6663,6 @@ case "$ac_cv_computed_gotos" in yes*)
6596
6663
AC_DEFINE ( HAVE_COMPUTED_GOTOS , 1 ,
6597
6664
[ Define if the C compiler supports computed gotos.] )
6598
6665
esac
6599
- case $host_os in
6600
- mingw*)
6601
- dnl Synchronized with _PyImport_DynLoadFiletab (dynload_win.c)
6602
- dnl Do not use more then one dot on this platform !
6603
- EXT_SUFFIX=-$SOABI$SHLIB_SUFFIX;;
6604
- esac
6605
6666
6606
6667
case $ac_sys_system in
6607
6668
AIX*)
0 commit comments