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 — Improve and simplify configure.ac checks · Issue #89886 · python/cpython

Improve and simplify configure.ac checks #89886

New issue
Copy link
New issue
Copy link
Closed
Closed
Improve and simplify configure.ac checks#89886
Copy link
Assignees
tiran
Labels
3.13only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-buildtype-featureA feature request or enhancementA feature request or enhancement

Description

@tiran
tiran
opened on Nov 5, 2021
Issue body actions
BPO 45723
Nosy @tiran, @erlend-aasland
PRs
Details
  • bpo-45723: Add helper macros and more caching to configure.ac (GH-29429) #29429
  • bpo-45723: Prepare support for autoconf 2.71 (GH-29441) #29441
  • bpo-45723: Detect missing pkg-config (GH-29442) #29442
  • bpo-45723: Add macro for disabling/enabling CC warnings (GH-29466) #29466
  • bpo-45723: Improve and simplify more configure.ac checks (GH-29485) #29485
  • bpo-45723: Remove obsolete AC_EXEEXT from configure.ac #29486
  • bpo-45723: Remove dead code for obsolete --with-dyld option #29500
  • bpo-45723: Add --with-pkg-config to configure (GH-29517) #29517
  • bpo-45723: Add helpers for save/restore env (GH-29637) #29637
  • bpo-45723: Use SAVE/RESTORE macros in configure.ac #29701
  • bpo-45723: Sort the grand AC_CHECK_HEADERS check #29846
  • bpo-45723: Normalise configure user communication (GH-30024) #30024
  • bpo-89886: Clean up MACHDEP and _PYTHON_HOST_PLATFORM checks #30026
  • gh-89886: Use AC_CHECK_TYPES iso. AC_CHECK_TYPE #30029
  • bpo-45723: Fix detection of epoll #30449
  • Note: 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:

    assignee = 'https://github.com/tiran'
    closed_at = None
    created_at = <Date 2021-11-05.10:05:47.030>
    labels = ['type-feature', 'build', '3.11']
    title = 'Improve and simplify configure.ac checks'
    updated_at = <Date 2022-01-12.04:40:54.295>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2022-01-12.04:40:54.295>
    actor = 'zach.ware'
    assignee = 'christian.heimes'
    closed = False
    closed_date = None
    closer = None
    components = ['Build']
    creation = <Date 2021-11-05.10:05:47.030>
    creator = 'christian.heimes'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45723
    keywords = ['patch']
    message_count = 18.0
    messages = ['405780', '405799', '405865', '405896', '405932', '405977', '405978', '406021', '406027', '406054', '406104', '406137', '406745', '407281', '408191', '409946', '409951', '409953']
    nosy_count = 3.0
    nosy_names = ['christian.heimes', 'erlendaasland', 'byllyfish']
    pr_nums = ['29429', '29441', '29442', '29466', '29485', '29486', '29500', '29517', '29637', '29701', '29846', '30024', '30026', '30029', '30449']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue45723'
    versions = ['Python 3.11']

    Linked PRs

    • bpo-45723: Add helper macros and more caching to configure.ac (GH-29429) #29429
    • bpo-45723: Prepare support for autoconf 2.71 (GH-29441) #29441
    • bpo-45723: Detect missing pkg-config (GH-29442) #29442
    • bpo-45723: Add macro for disabling/enabling CC warnings (GH-29466) #29466
    • bpo-45723: Improve and simplify more configure.ac checks (GH-29485) #29485
    • bpo-45723: Remove obsolete AC_EXEEXT from configure.ac #29486
    • bpo-45723: Remove dead code for obsolete --with-dyld option #29500
    • bpo-45723: Add --with-pkg-config to configure (GH-29517) #29517
    • bpo-45723: Add helpers for save/restore env (GH-29637) #29637
    • bpo-45723: Use SAVE/RESTORE macros in configure.ac #29701
    • bpo-45723: Sort the grand AC_CHECK_HEADERS check #29846
    • bpo-45723: Normalise configure user communication (GH-30024) #30024
    • bpo-89886: Clean up MACHDEP and _PYTHON_HOST_PLATFORM checks #30026
    • gh-89886: Use AC_CHECK_TYPES iso. AC_CHECK_TYPE #30029
    • bpo-45723: Fix detection of epoll #30449
    • GH-89886: Bump autoconf to version 2.71 #104925
    • gh-89886: Rely on HAVE_SYS_TIME_H #105058
    • gh-89886: Properly quote Autoconf macro arguments #105062
    • [3.12] gh-89886: Properly quote Autoconf macro arguments (#105062) #105118
    • [3.12] gh-89886: Rely on HAVE_SYS_TIME_H (GH-105058) #105192
    • [3.12] GH-89886: Bump to GNU Autoconf v2.71 (#104925) #105207
    • gh-89886: Use Autoconf quadrigraphs where appropriate #105226
    • [3.12] gh-89886: Use Autoconf quadrigraphs where appropriate (#105226) #105423

    Activity

    Next
    1. tiran commented on Nov 5, 2021

      @tiran
      tiran
      on Nov 5, 2021
      MemberAuthor
      More actions

      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.

    2. tiran
      added
      type-featureA feature request or enhancementA feature request or enhancement
      3.11only security fixesonly security fixes
      on Nov 5, 2021
    3. tiran
      self-assigned this
      on Nov 5, 2021
    4. tiran
      added
      buildThe build process and cross-buildThe build process and cross-build
      type-featureA feature request or enhancementA feature request or enhancement
      3.11only security fixesonly security fixes
      on Nov 5, 2021
    5. tiran
      self-assigned this
      on Nov 5, 2021
    6. tiran
      added
      buildThe build process and cross-buildThe build process and cross-build
      on Nov 5, 2021
    7. tiran commented on Nov 5, 2021

      @tiran
      tiran
      on Nov 5, 2021
      MemberAuthor
      More actions

      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

    8. tiran commented on Nov 6, 2021

      @tiran
      tiran
      on Nov 6, 2021
      MemberAuthor
      More actions

      #73627 introduces forward compatibility issues with autoconf 2.71. I took the output of autoupdate and resolved all warnings.

    9. tiran commented on Nov 7, 2021

      @tiran
      tiran
      on Nov 7, 2021
      MemberAuthor
      More actions

      New changeset be3cd5c by Christian Heimes in branch 'main':
      bpo-45723: Detect missing pkg-config (GH-29442)
      be3cd5c

    10. tiran commented on Nov 8, 2021

      @tiran
      tiran
      on Nov 8, 2021
      MemberAuthor
      More actions

      New changeset 57c50c9 by Christian Heimes in branch 'main':
      bpo-45723: Add helper macros and more caching to configure.ac (GH-29429)
      57c50c9

    11. tiran commented on Nov 8, 2021

      @tiran
      tiran
      on Nov 8, 2021
      MemberAuthor
      More actions

      New changeset 9bd0cf5 by Erlend Egeberg Aasland in branch 'main':
      bpo-45723: Add macro for disabling/enabling CC warnings (GH-29466)
      9bd0cf5

    12. tiran commented on Nov 8, 2021

      @tiran
      tiran
      on Nov 8, 2021
      MemberAuthor
      More actions

      New changeset cbab997 by Christian Heimes in branch 'main':
      bpo-45723: Prepare support for autoconf 2.71 (GH-29441)
      cbab997

    13. 129 remaining items

    14. erlend-aasland
      added 2 commits that reference this issue on Jun 7, 2023

      gh-89886: Use Autoconf quadrigraphs where appropriate (#105226)

      27c68a6

      [3.12] pythongh-89886: Use Autoconf quadrigraphs where appropriate (p…

      879bb67
    15. erlend-aasland
      added
      3.12only security fixesonly security fixes
      3.13only security fixesonly security fixes
      and removed
      3.11only security fixesonly security fixes
      3.12only security fixesonly security fixes
      on Jun 7, 2023
    16. erlend-aasland
      added a commit that references this issue on Jun 7, 2023

      [3.12] gh-89886: Use Autoconf quadrigraphs where appropriate (#105226) (

      c607551
    17. erlend-aasland commented on Jun 19, 2023

      @erlend-aasland
      erlend-aasland
      on Jun 19, 2023
      Contributor
      More actions

      autoconf bumping to 2.71+ is a little annoying because LTS ubuntu 20.04 only ships with 2.69

      should 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. Gerlach
    18. erlend-aasland commented on Jun 19, 2023

      @erlend-aasland
      erlend-aasland
      on Jun 19, 2023
      Contributor
      More actions

      I'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)

    19. erlend-aasland
      closed this as completedon Jun 19, 2023
    20. asottile commented on Jun 19, 2023

      @asottile
      asottile
      on Jun 19, 2023
      Contributor
      More actions

      @erlend-aasland my fear is that 2.71+ syntax / features will get used -- what should I do then?

    21. erlend-aasland commented on Jun 19, 2023

      @erlend-aasland
      erlend-aasland
      on Jun 19, 2023
      Contributor
      More actions

      @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 269 tag iso. 271 for 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 the configure script shipped with the source code) :)

    22. asottile commented on Jun 19, 2023

      @asottile
      asottile
      on Jun 19, 2023
      Contributor
      More actions

      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

    23. erlend-aasland commented on Jun 19, 2023

      @erlend-aasland
      erlend-aasland
      on Jun 19, 2023
      Contributor
      More actions

      Well, on the bright side, no "2.71+ syntax" did sneak in yet, so deadsnakes should be fine for now :)

    24. vstinner
      added a commit that references this issue on Aug 29, 2023

      Document Python build requirements

      76cfe6f
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    • @tiran
      tiran

    Labels

    3.13only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-buildtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.