Subject: Re: bug#71847: Self-inflicted problem, libtool and automake installed to different prefixes

From: Karl Berry <[email-masked]>
Date: Tue, 2 Jul 2024 11:15:21 -0600

Hi Dave,

    # wget https://davehart.net/ntp/test/ntp-4.2.8p18-vcs.tar.xz
    # tar xf *p18-vcs*xz
    # cd *vcs
    # ./bootstrap

After more testing, I don't believe it is a regression. If I install
1.16.5 in its own prefix, say /tmp/am165, the ntp bootstrap fails in the
same way:
Makefile.am:161: error: Libtool library used but 'LIBTOOL' is undefined
..

This is because, as Nick described in
  https://lists.gnu.org/archive/html/automake/2024-06/msg00094.html
given a compile-time prefix of /tmp/whatever, there is nothing make
aclocal look into /usr/local/gnu (in your case, or whatever the real
<prefix>/share/aclocal is) to find the needed libtool.m4.

Thus, I was able to find libtool.m4 by explicitly telling aclocal about
the real system dir. Copying the invocation from what autoreconf was
doing (added -d to the autoreconf invocation in your bootstrap; BTW, you
might want to do that by default, because why not?):
  aclocal --system-acdir=/usr/local/gnu/share/aclocal --verbose -I sntp/m4 -I sntp/libevent/m4 -I sntp/libopts/m4
did find libtool.m4 .

The behavior is the same with all the post-1.16.5 pretests, as far as I
can see. Ok, I admit I didn't try the --system-acdir option with all
versions, but it did work with both 1.16.5 and 1.16.92.

For the record, I did install one change (mostly devised by Mike
Frysinger, though I tweaked it, so any bugs are my responsibility) into
aclocal in this regard that is only in 1.16.92 (and dev):
  https://lists.gnu.org/archive/html/automake-commit/2024-06/msg00019.html

It adds a command-line option --aclocal-path and adjust the --help
output to more accurately report the m4 search paths. That seemed
suspicious at first, but per above, I no longer think it's a factor.

(Unfortunately that list of search paths shown by aclocal --help is
still far from optimal, since the implementation of all the different
ways to set paths is rather convoluted and I did not feel like
untangling it. If anyone feels like working on that, great. I left some
comments in the source.)

Anyway, to sum up, I think there is nothing to change on the automake
side here?  Let me know if you see different behavior. And thanks again
for the report.  Helps to get to the bottom (I hope) of such things.

Happy syncing,
Karl