]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
gnulib-tool: Don't insist on ACLOCAL_AMFLAGS.
authorBruno Haible <bruno@clisp.org>
Sun, 19 Dec 2021 11:49:16 +0000 (12:49 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 19 Dec 2021 11:49:16 +0000 (12:49 +0100)
Reported by Bjarni Ingi Gislason <bjarniig@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.

ChangeLog
gnulib-tool

index 10dcb92425aad0d942a32b55f89a228d5ac24dec..e29003d07e01d4fee3f0e78906e0c6cf5a668267 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2021-12-19  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool: Don't insist on ACLOCAL_AMFLAGS.
+       Reported by Bjarni Ingi Gislason <bjarniig@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.
+
 2021-12-18  Bruno Haible  <bruno@clisp.org>
 
        nstrftime: Update meta info.
index 0a0314e3cb4288e72c68e58788f564d35efa0a7e..678d334250d55dcc808aed33f71ca3e2b92b227a 100755 (executable)
@@ -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