On Thu, May 14, 2026 at 04:17:52PM +0200, Kamila Szewczyk wrote:
> Some projects want to offer a recently-added archive format (such as
> dist-bzip3, which entered Automake in 1.18 - bug#73795, or dist-lzip)
> while remaining portable to systems whose installed Automake predates
> the option, or whose maintainer host lacks the matching compressor or
> archiver.  Listing dist-bzip3 or dist-lzip in AM_INIT_AUTOMAKE on such a
> system either fails at automake-time because the option is not
> recognized, or at make-dist-time because the tool is not on PATH.

This is already technically possible without any changes to Automake, as
you can just just leave out the dist-xxx options from AM_INIT_AUTOMAKE
and then call the specific dist targets for each format directly:

  % ./configure
  [...]
  % make dist-bzip3
  [...]
  % make dist-lzip
  [...]

That being said, I personally think that the current behaviour of the
dist-XXX automake options is awful, because requiring users to have
specific compressor programs installed just so they can run distcheck
tests is very unfriendly (it is possible for users to work around such
problems by overriding DIST_TARGETS and/or DIST_ARCHIVES on the make
command line, but that is annoying).

Skipping formats for which the user lacks a corresponding compressor
program should really be the normal behaviour of these options.

> The new AM_OPTIONAL_AUTOMAKE macro covers exactly this case.  It
> sidesteps the default machinery offering more fault tolerance: at
> configure time it AC_CHECK_PROGs each requested tool; at config.status
> time it appends a guarded 'am--optional-dist-TOOL' rule to the generated
> top-level Makefile and pushes that rule onto DIST_TARGETS.  The recipe
> re-probes the tool with 'command -v' before running it,

Have you tested that this works as expected on traditional shells which
lack the "command" builtin, such as heirloom-sh or Solaris 10 /bin/sh?

Personally I don't think it is worth worrying about handling the scenario
where tools magically go missing between running "configure" and running
"make dist".  Users can re-run configure.

Cheers,
  Nick



Reply via email to