Repository navigation
Autotools: read configure.ac and Makefile.am for C and C++ flags and make check tests - #522
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #522 +/- ##
==========================================
+ Coverage 99.44% 99.45% +0.01%
==========================================
Files 374 378 +4
Lines 27250 27932 +682
Branches 3429 3550 +121
==========================================
+ Hits 27099 27781 +682
Misses 151 151 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Dec 1, 2026
leftibot
force-pushed
the
autotools-make
branch
2 times, most recently
from
December 1, 2026 19:49
2f41179 to
556dbb4
Compare
… a line says so
data-wellformed failed files that are not data until they are rendered:
redis/docker-library-redis's Dockerfile.template (a jq template) and
trailofbits/algo's files/cloud-init/base.yml (a Jinja2 template Ansible's
lookup('template', ...) renders). A file that does not parse is now noted as
a template, not failed, when a word of its name after the first says so
(`Dockerfile.template`, `values.tpl.yaml`, `*.j2`) or when a template block
opens one of its lines (`{%` or `{{` after its indentation). A file that
parses is data whatever its name (CloudFormation's `*.template.json`). The
words and openers are a new policy table, `policy/templates.toml`.
Part of cpp-best-practices#473
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
On curl, evaluating CMakeLists.txt exhausted memory: the loop that writes libcurl.pc sets `_explicit_libs` again for each of CURL_LIBS' conditional items, so the variable gained an item per pass, each with a "last writer" condition over every pass after it, and with the requirements named in a bad order (each `TARGET CURL::x` after every option) the diagrams grew exponentially. - A variable set again to the same value where it was set before is one item, in the builds of both sides: each build holds one side's items alone, so merging changes nothing a build sees, and the condition no longer grows with every pass. - A build file's evaluation is bounded: one command's operations on conditions add at most `policy/limits.toml`'s `most_nodes` (10000) nodes. Past it a condition is a requirement of its own, "the builds at CMakeLists.txt:2197 (too complex to follow)", the value is kept, and the file is noted as read in part (a PartlyRead fact), never dropped. curl's whole run now takes about two minutes and 600 MB under `ulimit -v 6000000`. Fixes cpp-best-practices#469 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
…est-practices#469) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
The maintainer asked that no limit be hard-coded. Beside the CMake conditions' most_nodes, limits.toml now holds, with unchanged values: the conditions' most_disjuncts and most_choices; every nesting depth of limits.py (CMake calls, GitLab includes/extends/references, .bazelrc imports, Azure templates, make includes, reusable workflows, composite actions, tsconfig extends, GitHub expressions, shell substitutions, compounds and quoting, JSON); the CMake evaluation's most_iterations, most_commands, most_calls and most_values; Meson's most_iterations and most_statements; the file sizes read (--max-file-size's default, data files parsed, archives decompressed, a license file's head); and the YAML places recorded. test_policy checks the table against each reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
…make check tests
Autotools projects (jq, tmux, curl, libzmq) had no C build system, so their
warning flags and `make check` tests were missed, and every make command CI
ran was unknown ("the makefile: none is found where make runs"): configure
writes the makefile, so it is not in the checkout.
- configure.ac is evaluated without running m4 or the shell
(build_systems/autotools/configure_syntax.py, configure.py): macro calls
and shell statements, `if`/`case` branches, AS_IF, AS_CASE, AC_ARG_ENABLE,
AC_ARG_WITH, the flag macros (AX_CHECK_COMPILE_FLAG, AX_APPEND_COMPILE_FLAGS,
AX_APPEND_FLAG, gl_WARN_ADD) where the compiler accepts the flag, macros
the file defines, AC_SUBST and AM_CONDITIONAL. `test "x$GCC" = xyes` is
the GCC-like compilers; any other test is a requirement as written.
tmux's LTO probe, which sets -Werror for one compile check and restores
CFLAGS, leaves no -Werror.
- Each Makefile.am is read with the configure.ac above it (automake.py):
AM_CFLAGS, AM_CXXFLAGS, AM_CPPFLAGS and each built target's own flags,
through Automake conditionals, with configure's substitutions expanded.
- Autotools (Makefile.am) is a build system of C and C++; `make check`,
`distcheck` or `recheck` where a Makefile.am is (or in a build tree
outside the checkout) runs the tests TESTS and check_PROGRAMS name.
- Where no makefile is in the checkout but a Makefile.am is, make reads the
Makefile.am's rules, and Automake's own targets (policy/automake.toml) are
known, not unknown.
Part of cpp-best-practices#470
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
…ctices#470) Brackets around a shell test (an m4 quote, stripped), several assignments on a line, a case pattern on a line of its own, AS_IF and AS_CASE without their last branch, AC_SUBST with a value, unquoted arguments holding parentheses, a body-less AC_DEFUN, a stray else or fi, an assignment no build reaches, a configure.ac past the bound on conditions, and a Makefile.am variable set only where it is not used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
) Like configure.ac's most_defined_calls, how deep a Makefile.am reference is followed is a limit, not a constant in the code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
…ystem (cpp-best-practices#470) The maintainer asked that the message read the same for every build system: "warnings are not treated as errors in CI configuration or the build files", rather than listing CMake files, presets and meson.build (leaving out configure.ac), or fpm's flags for Fortran. The hints, which say how in each build system, are unchanged, as is CMake's own presets finding. test_warnings_as_errors' SEARCHED and the bare_c, bare_cpp, bare_fortran and buildable snapshots change to match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
leftibot
force-pushed
the
autotools-make
branch
from
December 1, 2026 22:22
556dbb4 to
2b01b8f
Compare
…pp-best-practices#470) Conditions are kept for the whole process, so a second reading of the same configure.ac builds no new nodes and never reaches the lowered bound. mutmut runs the suite more than once in one process, so the test failed in its clean run on cpp-best-practices#532 and cpp-best-practices#533. Each reading now gets names of its own, and the test reads twice to hold that in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #470
What
Autotools projects had no C build system. Every
makecommand CI ran in them was unknown ("the makefile: none is found where make runs"), because configure writes the makefile and it is not in the checkout. So jq and tmux were ERROR on most checks, and their warning flags andmake checktests were missed.The core this PR covers:
build_systems/autotools/configure_syntax.py,configure.py):if/elif/else/fi,casepatterns,test ... && X=.... Macros:AS_IF,AS_CASE,AC_ARG_ENABLE/AC_ARG_WITH(one action when the option is given, the other when not), and macros the file defines (AC_DEFUN).AX_CHECK_COMPILE_FLAG,AX_APPEND_COMPILE_FLAGS,AX_APPEND_FLAG,gl_WARN_ADD. The requirement is worded as CMake's flag checks are.AC_SUBSTandAM_CONDITIONAL. Other macros' arguments are read behind a requirement of their own.test "x$GCC" = xyes(andGXX,ac_cv_c_compiler_gnu) is the GCC-like compilers; any other test is a requirement as written.configure.ac:1207-Werror, which the issue cites, is an LTO probe: it setsCFLAGSfor one link check and restores it. It correctly leaves no-Werror.automake.py):AM_CFLAGS,AM_CXXFLAGS,AM_CPPFLAGSand each built target's own<target>_CFLAGS. They are read through Automake'sif/else/endifconditionals, which hold whereAM_CONDITIONAL's test holds (tmux'sIS_GCCis GCC-like compilers ∧IS_GCC). Configure's substitutions ($(WARN_CFLAGS),@VAR@) are expanded from configure.ac.Makefile.am. configure.ac alone does not count: opam's configure.ac configures an OCaml build.make checkruns the tests (MAKE_CHECKtest runner):make check,distcheckorrecheckwhere a Makefile.am is, or in a build tree outside the checkout (cd build && ../configure && make check), runs the testsTESTSandcheck_PROGRAMSname. tests-run is judged per unit, as for CTest.make.py): the Makefile.am's rules are read, with its conditionals as tests of configure's@NAME_TRUE@substitutions and its silent-rule prefixes ($(AM_V_GEN)) empty. Automake's own targets (all,check,install,distcheck, …, inpolicy/automake.toml) are the project's build and tests, not unknown. Any other target is unknown, as before.What the readers cannot follow is noted, never dropped: a configure.ac or Makefile.am read only in part gets a
PartlyReadnote (a macro call or quote never closed, a conditional never closed, defined macros nested pastlimits.toml'smost_defined_calls). The #469 condition bound applies here too.Left of #470
src/Makefile, antirez/kilo, libbpf, and redis'ssrc/Makefile: theirCFLAGS/CXXFLAGSandtest/checkgoals.m4/(aclocal's directory) are not followed. curl's warnings come fromCURL_CC_DEBUG_OPTSinm4/curl-compilers.m4, so curl's results don't change../configure --disable-debug) do not settleAC_ARG_ENABLEyet. tmux's-W...flags behindIS_DEBUGcount as an option, though tmux CI passes--disable-debug.case "$CC"per compiler, andAX_CFLAGS_WARN_ALL-style macros._CFLAGSreplacingAM_CFLAGSfor that target.check-localhooks, and the commands of theTESTSscripts themselves.-W, GCC's old spelling of-Wextra, is not recognised as-Wextra(tmux).Tests
tests/test_autotools.pyuses jq'sconfigure.ac/Makefile.am(flags,if WIN32,if ENABLE_ASAN,TESTS, thejq.1.prebuiltrule) and tmux's LTO probe andIS_GCC/IS_DEBUGconditionals. It covers:AS_IF/AS_CASE/case,AC_ARG_*,AC_LANG_PUSH,AC_DEFUN;make checkin-tree, in a build tree, and elsewhere;tests/test_policy.pycovers the newautomake.tomlandlimits.tomlentries. I wrote most of these tests after a first draft of the reader, not before it.Corpus (before → after, score)
make checkrunsTESTS)IS_DEBUG); warnings-as-errors FAIL (the -Werror was a probe); tests-run FAIL (CI runsregress/, notmake check)Existing tests and snapshots that changed
tests/checks/test_tests_run.py: the expected messages now list Automake's tests andmake checkamong the known runners ("no tests found (tests Automake's make check runs (...), tests defined by Bazel ...)", "no CI configuration runs make check, bazel test, ctest or meson test"). The issue asks for exactly this: the hint used to name only Bazel, CTest and Meson. The tests' intent is unchanged.bare_c.json,bare_cpp.json,buildable.json,well_configured_c.json,well_configured_cpp.json(the same tests-run wording, andmake checkamong the C/C++ test tools in the answers) andregistry.json(the newmake checktool). No result status changed.For the maintainer
pg_regressrunner (ecosystems/sql.py) claims anymake checkfor C. This is older behaviour that only shows now; it is outside this stack.configure.pyandautomake.pyreuse CMake'sScope/Item(build_systems/cmake/evaluation.py,values.py), rather than copying them. Moving them to a shared module is a small refactor I left out to keep the diff away from other stacks.Gates
gates2.shall passed: ruff, ruff format, mypy, lizard, 3506 tests, coverage 99%, jscpd, markdownlint, strict self-check.Coverage
codecov/patch was 98.76%.
tests/test_autotools.pyaddsConfigureFormsTestsplus one Makefile.am test, each a configure.ac or Makefile.am form taken from real projects:AS_IFwith no else, andAS_CASEwith no defaultAC_SUBSTwith a value$(uname -s)AC_DEFUN, and a strayelse/fiif DEBUGand used onlyif !DEBUGPatch coverage locally: 602/602 lines and branches for this PR's own diff, 740/740 for the stack against main.
Since review
policy/limits.toml'sautomake.most_references, following CMake: bound the growth of conditions in loops over conditional items #517's change.tests/checks/test_warnings_as_errors.py'sSEARCHEDconstant, and one line each in thebare_c,bare_cpp,bare_fortranandbuildablesnapshots.Test fix (later commit):
test_a_configure_too_complex_to_follow_is_notednow gives each reading fresh variable names and reads twice. Conditions are kept for the whole process, so a second reading of the same text built nothing new and never reached the lowered bound. mutmut runs the suite more than once in a process, so the test failed in its clean run on #532 and #533.🤖 Generated with Claude Code
https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt