This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improve and simplify configure.ac checks
Type: enhancement Stage: patch review
Components: Build Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: byllyfish, christian.heimes, erlendaasland
Priority: normal Keywords: patch

Created on 2021-11-05 10:05 by christian.heimes, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 29429 merged christian.heimes, 2021-11-05 15:24
PR 29441 merged christian.heimes, 2021-11-06 16:01
PR 29442 merged christian.heimes, 2021-11-06 16:05
PR 29466 merged erlendaasland, 2021-11-08 09:24
PR 29485 merged erlendaasland, 2021-11-09 12:48
PR 29486 merged erlendaasland, 2021-11-09 13:39
PR 29500 merged erlendaasland, 2021-11-09 19:34
PR 29517 merged christian.heimes, 2021-11-10 15:06
PR 29637 merged erlendaasland, 2021-11-19 12:33
PR 29701 closed erlendaasland, 2021-11-22 12:13
PR 29846 merged erlendaasland, 2021-11-29 14:08
PR 30024 merged erlendaasland, 2021-12-10 10:59
PR 30026 open erlendaasland, 2021-12-10 12:16
PR 30029 open erlendaasland, 2021-12-10 14:31
PR 30449 merged christian.heimes, 2022-01-07 07:36
Messages (18)
msg405780 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-05 10:05
The autoconf-based build system has room for improvements. The configure.ac script can be simplified in several places by using AS and AC macros or by defining new custom macros.

For example we have a lot of blocks that look like this:

AC_MSG_CHECKING(for chroot)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[void x=chroot]])],
  [AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
   AC_MSG_RESULT(yes)],
  [AC_MSG_RESULT(no)
])

The block has an issue, too. It does not use AC_CACHE to cache the result. The entire block can be replaced by a custom macro that takes care of everything and implements correct caching:

  PY_CHECK_FUNC([chroot], [#include <unistd.h>])

We can also move several library and header checks from setup.py into configure.ac, e.g. check for soundcard.h or gdbm libs and headers.
msg405799 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-05 14:07
The first PR adds helper macros, AC_CACHE_CHECK() [1] and AS_VAR_IF() [2]. It also unified internal variables to use format "ac_cv_func_$funcname", "ac_cv_func_lib_$library_$funcname", or "ac_cv_header_$headername_h". "ac_cv" stands for autoconf cached value.

AC_CACHE_CHECK() replaces AC_MSG_CHECKING() and AC_MSG_RESULT(). The syntax is AC_CACHE_CHECK([text], [cache variable], [body]) where body is only excecuted when the cache variable is not set. The body has to set the cache variable to yes or no. Any output and AC_DEFINE must occur outside the body.

AS_VAR_IF() is a nicer way to write if test $variable = value; then; fi.

[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Caching-Results.html#Caching-Results
[2] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Polymorphic-Variables.html
msg405865 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-06 16:57
GH-29441 introduces forward compatibility issues with autoconf 2.71. I took the output of autoupdate and resolved all warnings.
msg405896 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-07 10:18
New changeset be3cd5c05d9fb1d1cdb55cb98ca6ef8f866774be by Christian Heimes in branch 'main':
bpo-45723: Detect missing pkg-config (GH-29442)
https://github.com/python/cpython/commit/be3cd5c05d9fb1d1cdb55cb98ca6ef8f866774be
msg405932 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-08 07:06
New changeset 57c50c9c7c701a8301c5a89b2b2d050550f62022 by Christian Heimes in branch 'main':
bpo-45723: Add helper macros and more caching to configure.ac (GH-29429)
https://github.com/python/cpython/commit/57c50c9c7c701a8301c5a89b2b2d050550f62022
msg405977 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-08 17:58
New changeset 9bd0cf5970997b63d296e30d51e7bb9a15dcabaf by Erlend Egeberg Aasland in branch 'main':
bpo-45723: Add macro for disabling/enabling CC warnings (GH-29466)
https://github.com/python/cpython/commit/9bd0cf5970997b63d296e30d51e7bb9a15dcabaf
msg405978 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-08 18:31
New changeset cbab997efb3ba5123dc8d9f706184fa8e634b3ec by Christian Heimes in branch 'main':
bpo-45723: Prepare support for autoconf 2.71 (GH-29441)
https://github.com/python/cpython/commit/cbab997efb3ba5123dc8d9f706184fa8e634b3ec
msg406021 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-11-09 13:45
AC_CHECK_TYPE is obsolete and it's use is discouraged. There are some gotchas we need to check before switching to AC_CHECK_TYPES.

See:
- https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Obsolete-Macros.html
- https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Generic-Types.html
msg406027 - (view) Author: miss-islington (miss-islington) Date: 2021-11-09 15:33
New changeset 185533639d6eddd42a28f9e3517067bd877e34c5 by Erlend Egeberg Aasland in branch 'main':
bpo-45723: Remove obsolete AC_EXEEXT from configure.ac (GH-29486)
https://github.com/python/cpython/commit/185533639d6eddd42a28f9e3517067bd877e34c5
msg406054 - (view) Author: miss-islington (miss-islington) Date: 2021-11-09 21:06
New changeset 49171aa91ab78c2608a26e5a75cdceab3bad6176 by Erlend Egeberg Aasland in branch 'main':
bpo-45723: Remove dead code for obsolete `--with-dyld` option (GH-29500)
https://github.com/python/cpython/commit/49171aa91ab78c2608a26e5a75cdceab3bad6176
msg406104 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-10 15:30
New changeset 76d14fac72479e0f5f5b144d6968ecd9e594db34 by Erlend Egeberg Aasland in branch 'main':
bpo-45723: Improve and simplify more configure.ac checks (GH-29485)
https://github.com/python/cpython/commit/76d14fac72479e0f5f5b144d6968ecd9e594db34
msg406137 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-10 22:02
New changeset fc9b62281931da8d20f85d5ed44cfc24f068d3f4 by Christian Heimes in branch 'main':
bpo-45723: Add --with-pkg-config to configure (GH-29517)
https://github.com/python/cpython/commit/fc9b62281931da8d20f85d5ed44cfc24f068d3f4
msg406745 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-11-22 08:05
New changeset db2277a114463d30a58d9066f2b47f7a53a1488c by Erlend Egeberg Aasland in branch 'main':
bpo-45723: Add helpers for save/restore env (GH-29637)
https://github.com/python/cpython/commit/db2277a114463d30a58d9066f2b47f7a53a1488c
msg407281 - (view) Author: miss-islington (miss-islington) Date: 2021-11-29 14:41
New changeset c1dec9540ab04691f8d4a131671e069913e6eee3 by Erlend Egeberg Aasland in branch 'main':
bpo-45723: Sort the grand AC_CHECK_HEADERS check (GH-29846)
https://github.com/python/cpython/commit/c1dec9540ab04691f8d4a131671e069913e6eee3
msg408191 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-12-10 11:27
New changeset 74b23c97cd5e178970a199066795cf0561f46b72 by Erlend Egeberg Aasland in branch 'main':
bpo-45723: Normalise configure user communication (GH-30024)
https://github.com/python/cpython/commit/74b23c97cd5e178970a199066795cf0561f46b72
msg409946 - (view) Author: William Fisher (byllyfish) Date: 2022-01-07 03:51
In the conversion to PY_CHECK_FUNC, there's a mistake in HAVE_EPOLL.

Python 3.10.1 defines HAVE_EPOLL by checking for the `epoll_create` function. Python 3.11.0a3 checks for the `epoll` function instead. There is no epoll() function so this always fails.

The effect is that `epoll` doesn't exist in the `select` module on Python 3.11.0a3. Most code that uses epoll falls back when it is not available, so this may not be failing any tests.
msg409951 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2022-01-07 07:37
Thanks William!
msg409953 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2022-01-07 08:15
New changeset 994f90c0772612780361e1dc5fa5223dce22f70a by Christian Heimes in branch 'main':
bpo-45723: Fix detection of epoll (#30449)
https://github.com/python/cpython/commit/994f90c0772612780361e1dc5fa5223dce22f70a
History
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 89886
2022-01-12 04:40:54zach.waresetnosy: - barry, terry.reedy, paul.moore, ronaldoussoren, vstinner, larry, tim.golden, ned.deily, ezio.melotti, eric.araujo, mrabarnett, r.david.murray, asvetlov, zach.ware, yselivanov, koobs, steve.dower, dstufft, Alex.Willmer, lys.nikolaou, pablogsal, miss-islington, alwaysasetup
type: security -> enhancement
components: - Demos and Tools, Distutils, Documentation, Extension Modules, IDLE, Installation, Interpreter Core, Library (Lib), macOS, Regular Expressions, Tests, Tkinter, Unicode, Windows, XML, 2to3 (2.x to 3.x conversion tool), ctypes, IO, Cross-Build, email, asyncio, Argument Clinic, FreeBSD, SSL, C API, Subinterpreters, Parser
2022-01-12 04:33:23alwaysasetupsetnosy: + alwaysasetup
2022-01-12 04:31:51alwaysasetupsetnosy: + terry.reedy, larry, pablogsal, paul.moore, tim.golden, lys.nikolaou, asvetlov, ezio.melotti, koobs, yselivanov, zach.ware, steve.dower, ned.deily, barry, Alex.Willmer, eric.araujo, dstufft, r.david.murray, vstinner, ronaldoussoren, mrabarnett
components: + Demos and Tools, Distutils, Documentation, Extension Modules, IDLE, Installation, Interpreter Core, Library (Lib), macOS, Regular Expressions, Tests, Tkinter, Unicode, Windows, XML, 2to3 (2.x to 3.x conversion tool), ctypes, IO, Cross-Build, email, asyncio, Argument Clinic, FreeBSD, SSL, C API, Subinterpreters, Parser
2022-01-12 04:31:14alwaysasetupsettype: enhancement -> security
2022-01-07 08:29:01christian.heimessetpriority: release blocker -> normal
2022-01-07 08:15:28christian.heimessetmessages: + msg409953
2022-01-07 07:41:08christian.heimessetpriority: normal -> release blocker
2022-01-07 07:37:36christian.heimessetmessages: + msg409951
2022-01-07 07:36:41christian.heimessetpull_requests: + pull_request28654
2022-01-07 03:51:34byllyfishsetnosy: + byllyfish
messages: + msg409946
2021-12-10 14:31:36erlendaaslandsetpull_requests: + pull_request28254
2021-12-10 12:16:07erlendaaslandsetpull_requests: + pull_request28251
2021-12-10 11:27:43christian.heimessetmessages: + msg408191
2021-12-10 10:59:42erlendaaslandsetpull_requests: + pull_request28248
2021-11-29 14:41:22miss-islingtonsetmessages: + msg407281
2021-11-29 14:08:09erlendaaslandsetpull_requests: + pull_request28075
2021-11-22 12:13:20erlendaaslandsetpull_requests: + pull_request27937
2021-11-22 08:05:15christian.heimessetmessages: + msg406745
2021-11-19 12:33:18erlendaaslandsetpull_requests: + pull_request27868
2021-11-10 22:02:27christian.heimessetmessages: + msg406137
2021-11-10 15:30:28christian.heimessetmessages: + msg406104
2021-11-10 15:06:38christian.heimessetpull_requests: + pull_request27769
2021-11-09 21:06:06miss-islingtonsetmessages: + msg406054
2021-11-09 19:34:03erlendaaslandsetpull_requests: + pull_request27749
2021-11-09 15:33:10miss-islingtonsetnosy: + miss-islington
messages: + msg406027
2021-11-09 13:45:36erlendaaslandsetmessages: + msg406021
2021-11-09 13:39:09erlendaaslandsetpull_requests: + pull_request27737
2021-11-09 12:48:53erlendaaslandsetpull_requests: + pull_request27736
2021-11-08 18:31:22christian.heimessetmessages: + msg405978
2021-11-08 17:58:32christian.heimessetmessages: + msg405977
2021-11-08 09:24:37erlendaaslandsetpull_requests: + pull_request27719
2021-11-08 09:18:34erlendaaslandsetnosy: + erlendaasland
2021-11-08 07:06:40christian.heimessetmessages: + msg405932
2021-11-07 10:18:49christian.heimessetmessages: + msg405896
2021-11-06 16:57:12christian.heimessetmessages: + msg405865
2021-11-06 16:05:00christian.heimessetpull_requests: + pull_request27697
2021-11-06 16:01:38christian.heimessetpull_requests: + pull_request27696
2021-11-05 15:24:24christian.heimessetkeywords: + patch
stage: patch review
pull_requests: + pull_request27684
2021-11-05 14:07:39christian.heimessetmessages: + msg405799
2021-11-05 10:05:47christian.heimescreate