Bjarni Ingi Gislason wrote: > In the output of "bootstrap" there is a reminder: > > [...] > Don't forget to > [...] > - mention "-I gnulib_m4" in ACLOCAL_AMFLAGS in Makefile.am, > [...] > > End of quotation. > > "ACLOCAL_AMFLAGS" in "Makefile.am" is going to be replaced by > "AC_CONFIG_MARCO_DIRS" (in configure.ac) according to file "NEWS-2.0" > in the "automake" repository: > > [...] > * WARNING: Future backward-incompatibilities! > > [...] > - The ACLOCAL_AMFLAGS special make variable will be fully deprecated in > Automake 2.0: it will raise warnings in the "obsolete" category (but > still no hard error of course, for compatibilities with the many, many > packages that still relies on that variable). You are advised to > start relying on the new Automake support for AC_CONFIG_MACRO_DIRS > instead (which was introduced in Automake 1.13). > > End of quotation from NEWS-2.0.
Thanks for the report. Indeed, gnulib-tool does not handle AC_CONFIG_MACRO_DIR nor AC_CONFIG_MACRO_DIRS so far. > To avoid a confusion, adding something like: > > - or "gnulib_m4" in its replacement > "AC_CONFIG_MACRO_DIRS([DIR1 ...])" in "configure.ac", > > to the output of "bootstrap" could be advisable to avert uncertainty. The idea is good, thanks. Although I wouldn't call AC_CONFIG_MACRO_DIRS the "replacement" of ACLOCAL_AMFLAGS, since we don't know when Automake 2.0 will get into beta. To me, they are just alternatives for specifying the same thing. 2021-12-19 Bruno Haible <br...@clisp.org> gnulib-tool: Don't insist on ACLOCAL_AMFLAGS. Reported by Bjarni Ingi Gislason <bjarn...@rhi.hi.is> in <https://lists.gnu.org/archive/html/bug-gnulib/2021-12/msg00112.html>. * gnulib-tool (func_import): Mention an AC_CONFIG_MACRO_DIRS invocation as an alternative to augmenting ACLOCAL_AMFLAGS. (--import, --add-import, --remove-import, --update): To find the m4 directories, look also for AC_CONFIG_MACRO_DIR and AC_CONFIG_MACRO_DIRS invocations in configure.ac. diff --git a/gnulib-tool b/gnulib-tool index 0a0314e3c..678d33425 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -5606,7 +5606,7 @@ s,^\(.................................................[^ ]*\) *, func_note_Makefile_am_edit "$testsbase_dir" SUBDIRS "$testsbase_base" true fi fi - func_note_Makefile_am_edit "" ACLOCAL_AMFLAGS "-I ${m4base}" + func_note_Makefile_am_edit "" ACLOCAL_AMFLAGS "${m4base}" { # Find the first parent directory of $m4base that contains or will contain # a Makefile.am. @@ -6267,7 +6267,12 @@ s,//*$,/,' eval var=\"\$makefile_am_edit${edit}_var\" eval val=\"\$makefile_am_edit${edit}_val\" if test -n "$var"; then - echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am," + if test "$var" = ACLOCAL_AMFLAGS; then + echo " - mention \"-I ${val}\" in ${var} in ${dir}Makefile.am" + echo " or add an AC_CONFIG_MACRO_DIRS([${val}]) invocation in $configure_ac," + else + echo " - mention \"${val}\" in ${var} in ${dir}Makefile.am," + fi fi done if grep '^ *AC_PROG_CC_STDC' "$configure_ac" > /dev/null; then @@ -7110,6 +7115,7 @@ s/\([.*$]\)/[\1]/g' # Analyze configure.ac. guessed_auxdir="." guessed_libtool=false + guessed_m4dirs= my_sed_traces=' s,#.*$,, s,^dnl .*$,, @@ -7119,6 +7125,12 @@ s/\([.*$]\)/[\1]/g' } /A[CM]_PROG_LIBTOOL/ { s,^.*$,guessed_libtool=true,p + } + /AC_CONFIG_MACRO_DIR/ { + s,^.*AC_CONFIG_MACRO_DIR([[ ]*\([^]"$`\\)]*\).*$,guessed_m4dirs="${guessed_m4dirs} \1",p + } + /AC_CONFIG_MACRO_DIRS/ { + s,^.*AC_CONFIG_MACRO_DIRS([[ ]*\([^]"$`\\)]*\).*$,guessed_m4dirs="${guessed_m4dirs} \1",p }' eval `sed -n -e "$my_sed_traces" < "$configure_ac"` @@ -7183,6 +7195,18 @@ s/\([.*$]\)/[\1]/g' fi fi done + for arg in $guessed_m4dirs; do + # Ignore absolute directory pathnames, like /usr/local/share/aclocal. + case "$arg" in + /*) ;; + *) + if test -f "$destdir/$arg"/gnulib-cache.m4; then + func_append m4dirs " $arg" + m4dirs_count=`expr $m4dirs_count + 1` + fi + ;; + esac + done else # No Makefile.am! Oh well. Look at the last generated aclocal.m4. if test -f "$destdir"/aclocal.m4; then