[PATCH] Remove AM_PO_SUBDIRS from configure.ac

Pietro Monteiro pietro@sociotechnical.xyz
Fri Jul 11 02:56:58 GMT 2025


On Thu, Jul 10, 2025, at 9:15 AM, Alan Modra wrote:
> On Thu, Jul 10, 2025 at 09:17:33AM +0200, Jan Beulich wrote:
>> On 10.07.2025 03:34, Pietro Monteiro wrote:
>> > Some configure.ac files use both AM_PO_SUBDIRS and
>> > ZW_GNU_GETTEXT_SISTER_DIR macros.  In-tree gettext build support
>> > requires ZW_GNU_GETTEXT_SISTER_DIR, which also indirectly AC_REQUIRE's
>> > AM_PO_SUBDIRS, causing double expansion.
>> 
>> Yet the invocation of AM_GNU_GETTEXT() is conditional in
>> ZW_GNU_GETTEXT_SISTER_DIR(). What about the other path there?

That "if; then else fi" is in the shell code output the macro. You can
see it by substituting "gettext_cfg" with it's value and grepping the
configure scripts in the tree, ex:

$ grep -n -A5 'if test -f ../gettext/uninstalled-config.sh' binutils/configure
13564:if test -f ../gettext/uninstalled-config.sh; then
13565-  relative_builddir='$(top_builddir)/../gettext'
13566-  .  ../gettext/uninstalled-config.sh
13567-else
13568-  # The sister gettext directory doesn't exist and won't collect information on
13569-  # using gettext for us.  Call a bundled AM_GNU_GETTEXT.

> AC_REQUIRE doesn't care about conditionals.  The result of Pietro's
> patch will be the same as swapping the order of AM_PO_SUBDIRS and
> ZW_GNU_GETTEXT_SISTER_DIR invocations.  I favour doing that rather
> than deleting AM_PO_SUBDIRS.

I guess that's a matter of taste :) . I think the AM_PO_SUBDIRS is
redundant, which is why I removed it. I just checked the rest of the
tree and GCC and the files in this patch are the only ones that have
AM_PO_SUBDIRS.

>> Not being overly familiar with autoconf, "double expansion" of what
>> specifically? Causing what kind of problem?
>
> No problem, just duplicate code in configure.

Maybe I should've added more details. Currently the only issue is the
code duplication, so slightly longer files and a negligible impact on
the runtime of the configure scripts. I got here by running
"autoreconf -v -f -Wall" on the binutils/gdb/gcc trees and fixing the
warnings from autoconf and automake. I hope that will make it easier
to upgrade to newer versions of those tools.

Anyway, AM_PO_SUBDIRS uses the obsolete macro AC_OUTPUT_COMMANDS. I
was testing updating it to AC_CONFIG_COMMANDS following the autoconf
documentation, but that caused issues with the files that had both
AM_PO_SUBDIRS and ZW_GNU_GETTEXT_SISTER_DIR. AC_OUTPUT_COMMANDS uses a
key in the format "default-$number", where "$number" is auto
incremented for each command. AC_CONFIG_COMMANDS requires a unique
key.

When AM_PO_SUBDIRS is updated to use AC_CONFIG_COMMANDS autoconf
errors out because the duplicated AM_PO_SUBDIRS use the same key.

And that's how we arrived at this patch.

>> Jan
>> 
>> >  Remove the direct uses of
>> > AM_PO_SUBDIRS to get rid of the duplicated code.
>
> -- 
> Alan Modra

pietro


More information about the Binutils mailing list