GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-93491: Add support tier detection to configure (GH-93492) by tiran · Pull Request #93492 · python/cpython

gh-93491: Add support tier detection to configure (GH-93492) #93492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
tiran merged 9 commits into python:main from tiran:support-tier
Jun 10, 2022

Uh oh!

There was an error while loading. Please reload this page.

Merged

gh-93491: Add support tier detection to configure (GH-93492) #93492

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
9 commits
Select commit Hold shift + click to select a range
823b0b2
gh-93491: Add support tier detection to configure
tiran Mar 24, 2022
28fc007
Fix markup
tiran Jun 4, 2022
4629e38
Apply suggestions from code review
tiran Jun 4, 2022
b2e7ba4
regen configure
tiran Jun 4, 2022
7d9d6e7
Update PC/pyconfig.h
tiran Jun 7, 2022
8c75681
Use AC_MSG_WARN for tier 0
tiran Jun 10, 2022
63cb7f6
regen configure
tiran Jun 10, 2022
3132f21
not yet
tiran Jun 10, 2022
228082e
regen configure
tiran Jun 10, 2022
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Build/2022-06-04-12-53-53.gh-issue-93491.ehM211.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``configure`` now detects and reports :pep:`11` support tiers.
16 changes: 15 additions & 1 deletion 16 PC/pyconfig.h
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
*/
#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 */

Expand Down Expand Up @@ -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 */

Expand Down
106 changes: 106 additions & 0 deletions 106 configure
Show comments
View file
Open in desktop

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

71 changes: 71 additions & 0 deletions 71 configure.ac
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
#if defined(__INTEL_COMPILER) || defined(__ICC)
icc
#elif defined(__ibmxl__) || defined(__xlc__) || defined(__xlC__)
xlc
#elif defined(_MSC_VER)
msvc
#elif defined(__clang__)
clang
#elif defined(__GNUC__)
gcc
#else
# error unknown compiler
#endif
EOF

if $CPP $CPPFLAGS 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
Expand Down Expand Up @@ -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_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)])

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])
Expand Down Expand Up @@ -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_WARN([

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.
])])
3 changes: 3 additions & 0 deletions 3 pyconfig.h.in
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,9 @@
/* Cipher suite string for PY_SSL_DEFAULT_CIPHERS=0 */
#undef PY_SSL_DEFAULT_CIPHER_STRING

/* PEP 11 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

Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.