Skip to content

Commit 194de1f

Browse files
Rewrite 'Regenerating configure' section of building guide (#1109)
1 parent 9b5ecd2 commit 194de1f

File tree

1 file changed

+36
-18
lines changed

1 file changed

+36
-18
lines changed

getting-started/setup-building.rst

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -477,31 +477,49 @@ Regenerate ``configure``
477477

478478
If a change is made to Python which relies on some POSIX system-specific
479479
functionality (such as using a new system call), it is necessary to update the
480-
``configure`` script to test for availability of the functionality.
480+
:cpy-file:`configure` script to test for availability of the functionality.
481+
Python's :file:`configure` script is generated from :cpy-file:`configure.ac`
482+
using `GNU Autoconf <https://www.gnu.org/software/autoconf/>`_.
481483

482-
Python's ``configure`` script is generated from ``configure.ac`` using Autoconf.
483-
Instead of editing ``configure``, edit ``configure.ac`` and then run
484-
``autoreconf`` to regenerate ``configure`` and a number of other files (such as
485-
``pyconfig.h``).
484+
After editing :file:`configure.ac`, run ``make regen-configure`` to generate
485+
:file:`configure`, :cpy-file:`pyconfig.h.in`, and :cpy-file:`aclocal.m4`.
486+
When submitting a pull request with changes made to :file:`configure.ac`,
487+
make sure you also commit the changes in the generated files.
486488

487-
When submitting a patch with changes made to ``configure.ac``, you should also
488-
include the generated files.
489+
The recommended and by far the easiest way to regenerate :file:`configure` is::
489490

490-
Note that running ``autoreconf`` is not the same as running ``autoconf``. For
491-
example, ``autoconf`` by itself will not regenerate ``pyconfig.h.in``.
492-
``autoreconf`` runs ``autoconf`` and a number of other tools repeatedly as is
493-
appropriate.
491+
$ make regen-configure
494492

495-
Python's ``configure.ac`` script typically requires a specific version of
496-
Autoconf. At the moment, this reads: ``AC_PREREQ(2.69)``. It also requires
497-
to have the ``autoconf-archive`` and ``pkg-config`` utilities installed in
498-
the system and the ``pkg.m4`` macro file located in the appropriate ``alocal``
499-
location. You can easily check if this is correctly configured by running::
493+
If you are regenerating :file:`configure` in a clean repo,
494+
run one of the following containers instead::
495+
496+
$ podman run --rm --pull=always -v $(pwd):/src:Z quay.io/tiran/cpython_autoconf:271
497+
498+
::
499+
500+
$ docker run --rm --pull=always -v $(pwd):/src quay.io/tiran/cpython_autoconf:271
501+
502+
Notice that the images are tagged with ``271``.
503+
Python's :file:`configure.ac` script requires a specific version of
504+
GNU Autoconf.
505+
For Python 3.12 and newer, GNU Autoconf v2.71 is required.
506+
For Python 3.11 and earlier, GNU Autoconf v2.69 is required.
507+
For GNU Autoconf v2.69, change the ``:271`` tag to ``:269``.
508+
509+
If you cannot (or don't want to) use the ``cpython_autoconf`` containers,
510+
install the :program:`autoconf-archive` and :program:`pkg-config` utilities,
511+
and make sure the :file:`pkg.m4` macro file located in the appropriate
512+
:program:`aclocal` location::
500513

501514
$ ls $(aclocal --print-ac-dir) | grep pkg.m4
502515

503-
If the system copy of Autoconf does not match this version, you will need to
504-
install your own copy of Autoconf.
516+
.. note::
517+
518+
Running :program:`autoreconf` is not the same as running :program:`autoconf`.
519+
For example, running :program:`autoconf` by itself will not regenerate
520+
:file:`pyconfig.h.in`.
521+
:program:`autoreconf` runs :program:`autoconf` and a number of other tools
522+
repeatedly as appropriate.
505523

506524
.. _build_troubleshooting:
507525

0 commit comments

Comments
 (0)