Title: detecting clang in configure.ac · Issue #110034 · python/cpython · GitHub
Open Graph Title: detecting clang in configure.ac · Issue #110034 · python/cpython
X Title: detecting clang in configure.ac · Issue #110034 · python/cpython
Description: Bug report Bug description: There are several attempts in configure.ac to detect what the compiler we're dealing with actually is: dnl detect compiler name dnl check for xlc before clang, newer xlc's can use clang as frontend. dnl check ...
Open Graph Description: Bug report Bug description: There are several attempts in configure.ac to detect what the compiler we're dealing with actually is: dnl detect compiler name dnl check for xlc before clang, newer xlc...
X Description: Bug report Bug description: There are several attempts in configure.ac to detect what the compiler we're dealing with actually is: dnl detect compiler name dnl check for xlc before clang, newer...
Opengraph URL: https://github.com/python/cpython/issues/110034
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"detecting clang in configure.ac","articleBody":"# Bug report\n\n### Bug description:\n\nThere are several attempts in configure.ac to detect what the compiler we're dealing with actually is:\n\n```autoconf\ndnl detect compiler name\ndnl check for xlc before clang, newer xlc's can use clang as frontend.\ndnl check for GCC last, other compilers set __GNUC__, too.\ndnl msvc is listed for completeness.\nAC_CACHE_CHECK([for CC compiler name], [ac_cv_cc_name], [\ncat > conftest.c \u003c\u003cEOF\n#if defined(__INTEL_COMPILER) || defined(__ICC)\n icc\n#elif defined(__ibmxl__) || defined(__xlc__) || defined(__xlC__)\n xlc\n#elif defined(_MSC_VER)\n msvc\n#elif defined(__clang__)\n clang\n#elif defined(__GNUC__)\n gcc\n#else\n# error unknown compiler\n#endif\nEOF\n\nif $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then\n ac_cv_cc_name=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' \t'`\nelse\n ac_cv_cc_name=\"unknown\"\nfi\nrm -f conftest.c conftest.out\n])\n```\n\nor this,\n\n```sh\ncase $CC in\n *clang*)\n cc_is_clang=1\n ;;\n *)\n if $CC --version 2>&1 | grep -q clang\n then\n cc_is_clang=1\n else\n cc_is_clang=\n fi\nesac\n```\n\nWe then have a bunch of tests against `$CC`:\n\n```sh\nif test \"$Py_LTO\" = 'true' ; then\n case $CC in\n *clang*)\n```\n\n(most BSDs patch this code to say `*clang*|cc)`)\n\n```sh\nif test \"$ac_cv_gcc_asm_for_x87\" = yes; then\n # Some versions of gcc miscompile inline asm:\n # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491\n # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html\n case $CC in\n *gcc*)\n```\netc…\nFor gcc we actually have a special variable, `$GCC`, except it doesn't seem to reliably work:\n\n```sh\nif test \"${OPT-unset}\" = \"unset\"\nthen\n case $GCC in\n yes)\n if test -n \"${cc_is_clang}\"\n then\n```\n\n### How to fix this?\n\nautoconf (2.71?) seems to automatically detect GCC, setting a convenient `$GCC` variable. For clang, we can either reuse the `$cc_is_clang` code, moving it just after `AC_PROG_CC`, setting a `$CLANG` variable, or reuse the code that sets `$ac_cv_cc_name`, again, maybe setting a $CLANG variable for convenience.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nOther","author":{"url":"https://github.com/igalic","@type":"Person","name":"igalic"},"datePublished":"2023-09-28T16:15:34Z","url":"https://github.com/python/cpython/issues/110034"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2b6a6f52-5155-0630-f9fc-b32f48034d48 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A564:20D634:D5A64E:11CD895:6AFE9548 |
| html-safe-nonce | dd277921d07b7c0650b6b5335cd82deba4fe9339dd598e4b91902c509a469db1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTY0OjIwRDYzNDpENUE2NEU6MTFDRDg5NTo2QUZFOTU0OCIsInZpc2l0b3JfaWQiOiI2NzkxNzcwNDI0MjA5MjE2ODQwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3bfec192b68c2b178115410e3c663459648af904258bd8d88a5fb16057d7416f |
| hovercard-subject-tag | issue:1917862759 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/110034/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9dc226c91435157bbde850b590f65c8cfa9b668dac37901b2d8f173622f2cbe7/python/cpython/issues/110034 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9dc226c91435157bbde850b590f65c8cfa9b668dac37901b2d8f173622f2cbe7/python/cpython/issues/110034 |
| og:image:alt | Bug report Bug description: There are several attempts in configure.ac to detect what the compiler we're dealing with actually is: dnl detect compiler name dnl check for xlc before clang, newer xlc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | igalic |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width