Repository navigation
Improve and simplify configure.ac checks #89886
Description
Activity
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.
- addedtype-featureA feature request or enhancementA feature request or enhancement3.11only security fixesonly security fixes
on Nov 5, 2021 - addedbuildThe build process and cross-buildThe build process and cross-buildtype-featureA feature request or enhancementA feature request or enhancement3.11only security fixesonly security fixes
on Nov 5, 2021 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#73627 introduces forward compatibility issues with autoconf 2.71. I took the output of autoupdate and resolved all warnings.
129 remaining items
- added3.12only security fixesonly security fixes3.13only security fixesonly security fixesand removed3.11only security fixesonly security fixes3.12only security fixesonly security fixes
on Jun 7, 2023 autoconf bumping to 2.71+ is a little annoying because LTS ubuntu 20.04 only ships with
2.69should this have landed in 3.12 which is already in beta freeze? I'm building this for deadsnakes and it'd kind of suck to not ship 3.12 for ubuntu 20.04 especially when 3.12b1 built cleanly
Anthony: we've discussed this in the core dev group, and we reached the conclusion that we'll not be adjusting the hard requirement in the .ac file. For deadsnakes, I would suggest to simply patch the .ac file before regenerating
configure. You should be fine with the following patch:diff --git a/configure.ac b/configure.ac index a24cd68973..793cd859ad 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ dnl # Set VERSION so we only need to edit in one place (i.e., here) m4_define([PYTHON_VERSION], [3.13]) -AC_PREREQ([2.71]) +AC_PREREQ([2.69]) AC_INIT([python],[PYTHON_VERSION],[https://github.com/python/cpython/issues/])
Reacted by C.A.M. GerlachI'll close this issue for now; Christian and I made several improvements to the AC code back in 3.10 and 3.11. IMO, future improvements should get their own targeted issues.
(cc. @tiran, in case you're around)
@erlend-aasland my fear is that 2.71+ syntax / features will get used -- what should I do then?
@erlend-aasland my fear is that 2.71+ syntax / features will get used -- what should I do then?
I suggest sticking to the recommendations of the devguide:
$ podman run --rm --pull=always -v $(pwd):/src:Z quay.io/tiran/cpython_autoconf:271 # ... or: $ docker run --rm --pull=always -v $(pwd):/src quay.io/tiran/cpython_autoconf:271
Use the
269tag iso.271for GNU Autoconf 2.69. Note also, that the autoconf version we use for 3.11 and older is not the stock GNU Autoconf v2.69; it is a patched version. So, once again, you're better off by using the devguide recommendations (or just use theconfigurescript shipped with the source code) :)I can't just do that unfortunately. that's outside my control as debian packages both must build from source and use the packages of the distribution
when 2.71+ syntax is used I'll basically have no choice but to drop the packages which is unfortunate but understandable
Well, on the bright side, no "2.71+ syntax" did sneak in yet, so deadsnakes should be fine for now :)
- added a commit that references this issue
on Aug 29, 2023
Details
--with-dyldoption #29500Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
--with-dyldoption #29500