From 823b0b24247281da9fe4f6779b68325dc180fa83 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 24 Mar 2022 15:09:16 +0100 Subject: [PATCH 1/9] gh-93491: Add support tier detection to configure --- ...2-06-04-12-53-53.gh-issue-93491.ehM211.rst | 1 + PC/pyconfig.h | 16 ++- configure | 106 ++++++++++++++++++ configure.ac | 71 ++++++++++++ pyconfig.h.in | 3 + 5 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst diff --git a/Misc/NEWS.d/next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst b/Misc/NEWS.d/next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst new file mode 100644 index 00000000000000..d091a5818812d8 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst @@ -0,0 +1 @@ +:script:`configure` now detects and reports :pep:`11`` support tiers. diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 2ddd5847f9c8a7..e53dba54379ddf 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -113,20 +113,30 @@ WIN32 is still required for the locale module. #define MS_WIN64 #endif -/* set the COMPILER */ +/* set the COMPILER and support tier + * + * win_amd64 MSCV (x86_64-pc-windows-msvc): 1 + * win32 MSCV (i686-pc-windows-msvc): 1 + * win_arm64 MSVC (aarch64-pc-windows-msvc): 3 + * other archs and ICC: 0 + */ #ifdef MS_WIN64 #if defined(_M_X64) || defined(_M_AMD64) #if defined(__INTEL_COMPILER) #define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 64 bit (amd64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]") +#define PY_SUPPORT_TIER 0 #else #define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)") +#define PY_SUPPORT_TIER 1 #endif /* __INTEL_COMPILER */ #define PYD_PLATFORM_TAG "win_amd64" #elif defined(_M_ARM64) #define COMPILER _Py_PASTE_VERSION("64 bit (ARM64)") +#define PY_SUPPORT_TIER 3 #define PYD_PLATFORM_TAG "win_arm64" #else #define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)") +#define PY_SUPPORT_TIER 0 #endif #endif /* MS_WIN64 */ @@ -173,15 +183,19 @@ typedef _W64 int Py_ssize_t; #if defined(_M_IX86) #if defined(__INTEL_COMPILER) #define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]") +#define PY_SUPPORT_TIER 0 #else #define COMPILER _Py_PASTE_VERSION("32 bit (Intel)") +#define PY_SUPPORT_TIER 1 #endif /* __INTEL_COMPILER */ #define PYD_PLATFORM_TAG "win32" #elif defined(_M_ARM) #define COMPILER _Py_PASTE_VERSION("32 bit (ARM)") #define PYD_PLATFORM_TAG "win_arm32" +#define PY_SUPPORT_TIER 0 #else #define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)") +#define PY_SUPPORT_TIER 0 #endif #endif /* MS_WIN32 && !MS_WIN64 */ diff --git a/configure b/configure index 601089cd44c204..1724e5d2d08da8 100755 --- a/configure +++ b/configure @@ -5213,6 +5213,39 @@ $as_echo "$ac_cv_path_EGREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CC compiler name" >&5 +$as_echo_n "checking for CC compiler name... " >&6; } +if ${ac_cv_cc_name+:} false; then : + $as_echo_n "(cached) " >&6 +else + +cat > conftest.c <conftest.out 2>/dev/null; then + ac_cv_cc_name=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` +else + ac_cv_cc_name="unknown" +fi +rm -f conftest.c conftest.out + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_name" >&5 +$as_echo "$ac_cv_cc_name" >&6; } + # checks for UNIX variants that set C preprocessor variables # may set _GNU_SOURCE, __EXTENSIONS__, _POSIX_PTHREAD_SEMANTICS, # _POSIX_SOURCE, _POSIX_1_SOURCE, and more @@ -6172,6 +6205,66 @@ if test x$MULTIARCH != x; then fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PEP 11 support tier" >&5 +$as_echo_n "checking for PEP 11 support tier... " >&6; } +case $host/$ac_cv_cc_name in #( + x86_64-*-linux-gnu/gcc) : + PY_SUPPORT_TIER=1 ;; #( + x86_64-apple-darwin*/clang) : + PY_SUPPORT_TIER=1 ;; #( + i686-pc-windows-msvc/msvc) : + PY_SUPPORT_TIER=1 ;; #( + x86_64-pc-windows-msvc/msvc) : + PY_SUPPORT_TIER=1 ;; #( + + aarch64-apple-darwin*/clang) : + PY_SUPPORT_TIER=2 ;; #( + aarch64-*-linux-gnu/gcc) : + PY_SUPPORT_TIER=2 ;; #( + aarch64-*-linux-gnu/clang) : + PY_SUPPORT_TIER=2 ;; #( + powerpc64le-*-linux-gnu/gcc) : + PY_SUPPORT_TIER=2 ;; #( + x86_64-*-linux-gnu/clang) : + PY_SUPPORT_TIER=2 ;; #( + + aarch64-pc-windows-msvc/msvc) : + PY_SUPPORT_TIER=3 ;; #( + armv7l-*-linux-gnueabihf/gcc) : + PY_SUPPORT_TIER=3 ;; #( + powerpc64le-*-linux-gnu/clang) : + PY_SUPPORT_TIER=3 ;; #( + s390x-*-linux-gnu/gcc) : + PY_SUPPORT_TIER=3 ;; #( + x86_64-*-freebsd/clang) : + PY_SUPPORT_TIER=3 ;; #( + *) : + PY_SUPPORT_TIER=0 + ;; +esac + +case $PY_SUPPORT_TIER in #( + 1) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $host/$ac_cv_cc_name has tier 1 (supported)" >&5 +$as_echo "$host/$ac_cv_cc_name has tier 1 (supported)" >&6; } ;; #( + 2) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $host/$ac_cv_cc_name has tier 2 (supported)" >&5 +$as_echo "$host/$ac_cv_cc_name has tier 2 (supported)" >&6; } ;; #( + 3) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $host/$ac_cv_cc_name has tier 3 (partially supported)" >&5 +$as_echo "$host/$ac_cv_cc_name has tier 3 (partially supported)" >&6; } ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $host/$ac_cv_cc_name is not supported" >&5 +$as_echo "$host/$ac_cv_cc_name is not supported" >&6; } + ;; +esac + + +cat >>confdefs.h <<_ACEOF +#define PY_SUPPORT_TIER $PY_SUPPORT_TIER +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wl,--no-as-needed" >&5 $as_echo_n "checking for -Wl,--no-as-needed... " >&6; } if ${ac_cv_wl_no_as_needed+:} false; then : @@ -26296,3 +26389,16 @@ If you want a release build with all stable optimizations active (PGO, etc), please run ./configure --enable-optimizations " >&6;} fi + +if test "x$PY_SUPPORT_TIER" = x0; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: + +Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not yet supported by +CPython core team, see https://peps.python.org/pep-0011/ for more information. +" >&5 +$as_echo "$as_me: + +Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not yet supported by +CPython core team, see https://peps.python.org/pep-0011/ for more information. +" >&6;} +fi diff --git a/configure.ac b/configure.ac index 4c540ec52b4d86..132aad902cd234 100644 --- a/configure.ac +++ b/configure.ac @@ -770,6 +770,35 @@ AC_PROG_GREP AC_PROG_SED AC_PROG_EGREP +dnl detect compiler name +dnl check for xlc before clang, newer xlc's can use clang as frontend. +dnl check for GCC last, other compilers set __GNUC__, too. +dnl msvc is listed for completeness. +AC_CACHE_CHECK([for CC compiler name], [ac_cv_cc_name], [ +cat > conftest.c <conftest.out 2>/dev/null; then + ac_cv_cc_name=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` +else + ac_cv_cc_name="unknown" +fi +rm -f conftest.c conftest.out +]) + # checks for UNIX variants that set C preprocessor variables # may set _GNU_SOURCE, __EXTENSIONS__, _POSIX_PTHREAD_SEMANTICS, # _POSIX_SOURCE, _POSIX_1_SOURCE, and more @@ -1031,6 +1060,42 @@ if test x$MULTIARCH != x; then fi AC_SUBST(MULTIARCH_CPPFLAGS) +dnl Support tiers according to https://peps.python.org/pep-0011/ +dnl +dnl NOTE: Windows support tiers are defined in PC/pyconfig.h. +dnl +AC_MSG_CHECKING([for PEP 11 support tier]) +AS_CASE([$host/$ac_cv_cc_name], + [x86_64-*-linux-gnu/gcc], [PY_SUPPORT_TIER=1], dnl Linux on AMD64, any vendor, glibc, gcc + [x86_64-apple-darwin*/clang], [PY_SUPPORT_TIER=1], dnl macOS on Intel, any version + [i686-pc-windows-msvc/msvc], [PY_SUPPORT_TIER=1], dnl 32bit Windows on Intel, MSVC + [x86_64-pc-windows-msvc/msvc], [PY_SUPPORT_TIER=1], dnl 64bit Windows on AMD64, MSVC + + [aarch64-apple-darwin*/clang], [PY_SUPPORT_TIER=2], dnl macOS on M1, any version + [aarch64-*-linux-gnu/gcc], [PY_SUPPORT_TIER=2], dnl Linux ARM64, glibc, gcc+clang + [aarch64-*-linux-gnu/clang], [PY_SUPPORT_TIER=2], + [powerpc64le-*-linux-gnu/gcc], [PY_SUPPORT_TIER=2], dnl Linux on PPC64 little endian, glibc, gcc + [x86_64-*-linux-gnu/clang], [PY_SUPPORT_TIER=2], dnl Linux on AMD64, any vendor, glibc, clang + + [aarch64-pc-windows-msvc/msvc], [PY_SUPPORT_TIER=3], dnl Windows ARM64, MSVC + [armv7l-*-linux-gnueabihf/gcc], [PY_SUPPORT_TIER=3], dnl ARMv7 LE with hardware floats, any vendor, glibc, gcc + [powerpc64le-*-linux-gnu/clang], [PY_SUPPORT_TIER=3], dnl Linux on PPC64 little endian, glibc, clang + [s390x-*-linux-gnu/gcc], [PY_SUPPORT_TIER=3], dnl Linux on 64bit s390x (big endian), glibc, gcc + dnl [wasm32-unknown-emscripten/clang], [PY_SUPPORT_TIER=3], dnl WebAssembly Emscripten + dnl [wasm32-unknown-wasi/clang], [PY_SUPPORT_TIER=3], dnl WebAssembly System Interface + [x86_64-*-freebsd/clang], [PY_SUPPORT_TIER=3], dnl FreeBSD on AMD64 + [PY_SUPPORT_TIER=0] +) + +AS_CASE([$PY_SUPPORT_TIER], + [1], [AC_MSG_RESULT([$host/$ac_cv_cc_name has tier 1 (supported)])], + [2], [AC_MSG_RESULT([$host/$ac_cv_cc_name has tier 2 (supported)])], + [3], [AC_MSG_RESULT([$host/$ac_cv_cc_name has tier 3 (partially supported)])], + [AC_MSG_RESULT([$host/$ac_cv_cc_name is not supported])] +) + +AC_DEFINE_UNQUOTED([PY_SUPPORT_TIER], [$PY_SUPPORT_TIER], [Support tier (1, 2, 3 or 0 for unsupported)]) + AC_CACHE_CHECK([for -Wl,--no-as-needed], [ac_cv_wl_no_as_needed], [ save_LDFLAGS="$LDFLAGS" 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), please run ./configure --enable-optimizations ]) fi + +AS_VAR_IF([PY_SUPPORT_TIER], [0], [AC_MSG_NOTICE([ + +Platform "$host" with compiler "$ac_cv_cc_name" is not yet supported by +CPython core team, see https://peps.python.org/pep-0011/ for more information. +])]) diff --git a/pyconfig.h.in b/pyconfig.h.in index b32a5802d3182e..4c8d934402b9fb 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1515,6 +1515,9 @@ /* Cipher suite string for PY_SSL_DEFAULT_CIPHERS=0 */ #undef PY_SSL_DEFAULT_CIPHER_STRING +/* Support tier (1, 2, 3 or 0 for unsupported) */ +#undef PY_SUPPORT_TIER + /* Define if you want to build an interpreter with many run-time checks. */ #undef Py_DEBUG From 28fc007f5f5cf8604cf290e347cf3d373cad00d9 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sat, 4 Jun 2022 14:38:00 +0200 Subject: [PATCH 2/9] Fix markup --- .../next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst b/Misc/NEWS.d/next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst index d091a5818812d8..b3560fac81d2a9 100644 --- a/Misc/NEWS.d/next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst +++ b/Misc/NEWS.d/next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst @@ -1 +1 @@ -:script:`configure` now detects and reports :pep:`11`` support tiers. +``configure`` now detects and reports :pep:`11` support tiers. From 4629e3844f3d66f883958a35d3f0e8f140ea565d Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sat, 4 Jun 2022 18:45:56 +0200 Subject: [PATCH 3/9] Apply suggestions from code review Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- configure.ac | 4 ++-- pyconfig.h.in | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 132aad902cd234..5706573322915e 100644 --- a/configure.ac +++ b/configure.ac @@ -781,7 +781,7 @@ cat > conftest.c < Date: Sat, 4 Jun 2022 18:46:46 +0200 Subject: [PATCH 4/9] regen configure --- configure | 6 +++--- configure.ac | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 1724e5d2d08da8..1c7dd5300840f2 100755 --- a/configure +++ b/configure @@ -5225,7 +5225,7 @@ cat > conftest.c <&5 $as_echo "$as_me: -Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not yet supported by +Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not yet supported by the CPython core team, see https://peps.python.org/pep-0011/ for more information. " >&6;} fi diff --git a/configure.ac b/configure.ac index 5706573322915e..7a3507f7c82256 100644 --- a/configure.ac +++ b/configure.ac @@ -1094,7 +1094,7 @@ AS_CASE([$PY_SUPPORT_TIER], [AC_MSG_RESULT([$host/$ac_cv_cc_name is not supported])] ) -AC_DEFINE_UNQUOTED([PY_SUPPORT_TIER], [$PY_SUPPORT_TIER], [Support tier (1, 2, 3 or 0 for unsupported)]) +AC_DEFINE_UNQUOTED([PY_SUPPORT_TIER], [$PY_SUPPORT_TIER], [PEP 11 Support tier (1, 2, 3 or 0 for unsupported)]) AC_CACHE_CHECK([for -Wl,--no-as-needed], [ac_cv_wl_no_as_needed], [ save_LDFLAGS="$LDFLAGS" From 7d9d6e7c27c4f74521a5291cf4bbfc9fb17d197c Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 7 Jun 2022 09:04:44 +0200 Subject: [PATCH 5/9] Update PC/pyconfig.h Co-authored-by: Steve Dower --- PC/pyconfig.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PC/pyconfig.h b/PC/pyconfig.h index e53dba54379ddf..87d55fa07e51e3 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -115,8 +115,8 @@ WIN32 is still required for the locale module. /* set the COMPILER and support tier * - * win_amd64 MSCV (x86_64-pc-windows-msvc): 1 - * win32 MSCV (i686-pc-windows-msvc): 1 + * win_amd64 MSVC (x86_64-pc-windows-msvc): 1 + * win32 MSVC (i686-pc-windows-msvc): 1 * win_arm64 MSVC (aarch64-pc-windows-msvc): 3 * other archs and ICC: 0 */ From 8c756811a79a40b8735c7265db10d30f8f9647f1 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 10 Jun 2022 12:57:57 +0200 Subject: [PATCH 6/9] Use AC_MSG_WARN for tier 0 Co-authored-by: Erlend Egeberg Aasland --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 7a3507f7c82256..2477bc859304fe 100644 --- a/configure.ac +++ b/configure.ac @@ -1091,7 +1091,7 @@ AS_CASE([$PY_SUPPORT_TIER], [1], [AC_MSG_RESULT([$host/$ac_cv_cc_name has tier 1 (supported)])], [2], [AC_MSG_RESULT([$host/$ac_cv_cc_name has tier 2 (supported)])], [3], [AC_MSG_RESULT([$host/$ac_cv_cc_name has tier 3 (partially supported)])], - [AC_MSG_RESULT([$host/$ac_cv_cc_name is not supported])] + [AC_MSG_WARN([$host/$ac_cv_cc_name is not supported])] ) AC_DEFINE_UNQUOTED([PY_SUPPORT_TIER], [$PY_SUPPORT_TIER], [PEP 11 Support tier (1, 2, 3 or 0 for unsupported)]) @@ -6944,7 +6944,7 @@ please run ./configure --enable-optimizations ]) fi -AS_VAR_IF([PY_SUPPORT_TIER], [0], [AC_MSG_NOTICE([ +AS_VAR_IF([PY_SUPPORT_TIER], [0], [AC_MSG_WARN([ Platform "$host" with compiler "$ac_cv_cc_name" is not yet supported by the CPython core team, see https://peps.python.org/pep-0011/ for more information. From 63cb7f6bf93d8fa04debd869dda2a4dcdf09e349 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 10 Jun 2022 12:58:51 +0200 Subject: [PATCH 7/9] regen configure --- configure | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 1c7dd5300840f2..251faa02e47301 100755 --- a/configure +++ b/configure @@ -6254,8 +6254,8 @@ $as_echo "$host/$ac_cv_cc_name has tier 2 (supported)" >&6; } ;; #( { $as_echo "$as_me:${as_lineno-$LINENO}: result: $host/$ac_cv_cc_name has tier 3 (partially supported)" >&5 $as_echo "$host/$ac_cv_cc_name has tier 3 (partially supported)" >&6; } ;; #( *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $host/$ac_cv_cc_name is not supported" >&5 -$as_echo "$host/$ac_cv_cc_name is not supported" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $host/$ac_cv_cc_name is not supported" >&5 +$as_echo "$as_me: WARNING: $host/$ac_cv_cc_name is not supported" >&2;} ;; esac @@ -26391,14 +26391,14 @@ please run ./configure --enable-optimizations fi if test "x$PY_SUPPORT_TIER" = x0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not yet supported by the CPython core team, see https://peps.python.org/pep-0011/ for more information. " >&5 -$as_echo "$as_me: +$as_echo "$as_me: WARNING: Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not yet supported by the CPython core team, see https://peps.python.org/pep-0011/ for more information. -" >&6;} +" >&2;} fi From 3132f21534b3252769439273219c28c7150df754 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 10 Jun 2022 14:36:41 +0200 Subject: [PATCH 8/9] not yet Co-authored-by: Erlend Egeberg Aasland --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2477bc859304fe..af437b6d401f8f 100644 --- a/configure.ac +++ b/configure.ac @@ -6946,6 +6946,6 @@ fi AS_VAR_IF([PY_SUPPORT_TIER], [0], [AC_MSG_WARN([ -Platform "$host" with compiler "$ac_cv_cc_name" is not yet supported by the +Platform "$host" with compiler "$ac_cv_cc_name" is not supported by the CPython core team, see https://peps.python.org/pep-0011/ for more information. ])]) From 228082e05e7bb96884b4af481d7fd6ee4ed63579 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 10 Jun 2022 14:37:37 +0200 Subject: [PATCH 9/9] regen configure --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 251faa02e47301..677de64741128b 100755 --- a/configure +++ b/configure @@ -26393,12 +26393,12 @@ fi if test "x$PY_SUPPORT_TIER" = x0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: -Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not yet supported by the +Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not supported by the CPython core team, see https://peps.python.org/pep-0011/ for more information. " >&5 $as_echo "$as_me: WARNING: -Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not yet supported by the +Platform \"$host\" with compiler \"$ac_cv_cc_name\" is not supported by the CPython core team, see https://peps.python.org/pep-0011/ for more information. " >&2;} fi