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