@@ -770,6 +770,35 @@ AC_PROG_GREP
770
770
AC_PROG_SED
771
771
AC_PROG_EGREP
772
772
773
+ dnl detect compiler name
774
+ dnl check for xlc before clang, newer xlc's can use clang as frontend.
775
+ dnl check for GCC last, other compilers set __GNUC__, too.
776
+ dnl msvc is listed for completeness.
777
+ AC_CACHE_CHECK ( [ for CC compiler name] , [ ac_cv_cc_name] , [
778
+ cat > conftest.c <<EOF
779
+ #if defined(__INTEL_COMPILER) || defined(__ICC)
780
+ icc
781
+ #elif defined(__ibmxl__) || defined(__xlc__) || defined(__xlC__)
782
+ xlc
783
+ #elif defined(_MSC_VER)
784
+ msvc
785
+ #elif defined(__clang__)
786
+ clang
787
+ #elif defined(__GNUC__)
788
+ gcc
789
+ #else
790
+ # error unknown compiler
791
+ #endif
792
+ EOF
793
+
794
+ if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
795
+ ac_cv_cc_name=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
796
+ else
797
+ ac_cv_cc_name="unknown"
798
+ fi
799
+ rm -f conftest.c conftest.out
800
+ ] )
801
+
773
802
# checks for UNIX variants that set C preprocessor variables
774
803
# may set _GNU_SOURCE, __EXTENSIONS__, _POSIX_PTHREAD_SEMANTICS,
775
804
# _POSIX_SOURCE, _POSIX_1_SOURCE, and more
@@ -1031,6 +1060,42 @@ if test x$MULTIARCH != x; then
1031
1060
fi
1032
1061
AC_SUBST ( MULTIARCH_CPPFLAGS )
1033
1062
1063
+ dnl Support tiers according to https://peps.python.org/pep-0011/
1064
+ dnl
1065
+ dnl NOTE: Windows support tiers are defined in PC/pyconfig.h.
1066
+ dnl
1067
+ AC_MSG_CHECKING ( [ for PEP 11 support tier] )
1068
+ AS_CASE ( [ $host/$ac_cv_cc_name] ,
1069
+ [ x86_64-*-linux-gnu/gcc] , [ PY_SUPPORT_TIER=1] , dnl Linux on AMD64, any vendor, glibc, gcc
1070
+ [ x86_64-apple-darwin*/clang] , [ PY_SUPPORT_TIER=1] , dnl macOS on Intel, any version
1071
+ [ i686-pc-windows-msvc/msvc] , [ PY_SUPPORT_TIER=1] , dnl 32bit Windows on Intel, MSVC
1072
+ [ x86_64-pc-windows-msvc/msvc] , [ PY_SUPPORT_TIER=1] , dnl 64bit Windows on AMD64, MSVC
1073
+
1074
+ [ aarch64-apple-darwin*/clang] , [ PY_SUPPORT_TIER=2] , dnl macOS on M1, any version
1075
+ [ aarch64-*-linux-gnu/gcc] , [ PY_SUPPORT_TIER=2] , dnl Linux ARM64, glibc, gcc+clang
1076
+ [ aarch64-*-linux-gnu/clang] , [ PY_SUPPORT_TIER=2] ,
1077
+ [ powerpc64le-*-linux-gnu/gcc] , [ PY_SUPPORT_TIER=2] , dnl Linux on PPC64 little endian, glibc, gcc
1078
+ [ x86_64-*-linux-gnu/clang] , [ PY_SUPPORT_TIER=2] , dnl Linux on AMD64, any vendor, glibc, clang
1079
+
1080
+ [ aarch64-pc-windows-msvc/msvc] , [ PY_SUPPORT_TIER=3] , dnl Windows ARM64, MSVC
1081
+ [ armv7l-*-linux-gnueabihf/gcc] , [ PY_SUPPORT_TIER=3] , dnl ARMv7 LE with hardware floats, any vendor, glibc, gcc
1082
+ [ powerpc64le-*-linux-gnu/clang] , [ PY_SUPPORT_TIER=3] , dnl Linux on PPC64 little endian, glibc, clang
1083
+ [ s390x-*-linux-gnu/gcc] , [ PY_SUPPORT_TIER=3] , dnl Linux on 64bit s390x (big endian), glibc, gcc
1084
+ dnl [wasm32-unknown-emscripten/clang], [PY_SUPPORT_TIER=3], dnl WebAssembly Emscripten
1085
+ dnl [wasm32-unknown-wasi/clang], [PY_SUPPORT_TIER=3], dnl WebAssembly System Interface
1086
+ [ x86_64-*-freebsd/clang] , [ PY_SUPPORT_TIER=3] , dnl FreeBSD on AMD64
1087
+ [ PY_SUPPORT_TIER=0]
1088
+ )
1089
+
1090
+ AS_CASE ( [ $PY_SUPPORT_TIER] ,
1091
+ [ 1] , [ AC_MSG_RESULT ( [ $host/$ac_cv_cc_name has tier 1 (supported)] ) ] ,
1092
+ [ 2] , [ AC_MSG_RESULT ( [ $host/$ac_cv_cc_name has tier 2 (supported)] ) ] ,
1093
+ [ 3] , [ AC_MSG_RESULT ( [ $host/$ac_cv_cc_name has tier 3 (partially supported)] ) ] ,
1094
+ [ AC_MSG_WARN ( [ $host/$ac_cv_cc_name is not supported] ) ]
1095
+ )
1096
+
1097
+ AC_DEFINE_UNQUOTED ( [ PY_SUPPORT_TIER] , [ $PY_SUPPORT_TIER] , [ PEP 11 Support tier (1, 2, 3 or 0 for unsupported)] )
1098
+
1034
1099
AC_CACHE_CHECK ( [ for -Wl,--no-as-needed] , [ ac_cv_wl_no_as_needed] , [
1035
1100
save_LDFLAGS="$LDFLAGS"
1036
1101
AS_VAR_APPEND ( [ LDFLAGS] , [ -Wl,--no-as-needed] )
@@ -6878,3 +6943,9 @@ If you want a release build with all stable optimizations active (PGO, etc),
6878
6943
please run ./configure --enable-optimizations
6879
6944
] )
6880
6945
fi
6946
+
6947
+ AS_VAR_IF ( [ PY_SUPPORT_TIER] , [ 0] , [ AC_MSG_WARN ( [
6948
+
6949
+ Platform "$host" with compiler "$ac_cv_cc_name" is not supported by the
6950
+ CPython core team, see https://peps.python.org/pep-0011/ for more information.
6951
+ ] ) ] )
0 commit comments