Subject: bug#61828: aclocal warns when specifying the m4 macro dirs through AC_CONFIG_MACRO_DIRS

From: Bruno Haible <[email-masked]>
Date: Sun, 26 Feb 2023 23:07:30 +0100

According to the Autoconf documentation
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/html_node/Input.html
  "Packages that use aclocal to generate aclocal.m4 should declare where
   local macros can be found using AC_CONFIG_MACRO_DIRS."
and
  "Note that if you use aclocal from an Automake release prior to 1.13 to
   generate aclocal.m4, you must also set
     ACLOCAL_AMFLAGS = -I dir1 [-I dir2 ... -I dirN]
   in your top-level Makefile.am."

it sounds like

1) specifying the m4 macro dirs through AC_CONFIG_MACRO_DIRS is
   equivalent to specifying them through 'aclocal' command-line options
   or ACLOCAL_AMFLAGS.

2) specifying them through AC_CONFIG_MACRO_DIRS is better than through
   'aclocal' command-line options because is allows 'autoreconf' to
   see which -I options to pass to 'aclocal'.

3) specifying them through AC_CONFIG_MACRO_DIRS is better than through
   ACLOCAL_AMFLAGS. Citing automake/NEWS:
     "- The special make variable ACLOCAL_AMFLAGS is deprecated; future
        Automake versions will warn about its use, and later version will
        remove support for it altogether."

So, this is what I'm trying to do. In the attached hello.tar.gz you find
  - a 'hello1' directory which uses ACLOCAL_AMFLAGS (old style),
  - a 'hello2' directory which uses AC_CONFIG_MACRO_DIRS (new style).

In both cases, the generated aclocal.m4 files are the same.

The problem is that migrating from hello1 to hello2 introduces an
undesired warning:

hello1$ aclocal -I m4
(no warning)

hello2$ aclocal
configure.ac:13: warning: macro 'AM_GNU_GETTEXT' not found in library

$ diff hello1/aclocal.m4 hello2/aclocal.m4
(no differences)

For reference:

$ aclocal --version
aclocal (GNU automake) 1.16.5
...
$ autoconf --version
autoconf (GNU Autoconf) 2.71
...