On 3/1/22 07:36, Lars Ingebrigtsen wrote:

My latest attempt wasn't from a bare checkout -- it was from my normal
development tree, though.

Well, that's annoying. :-)

I looked into the problem some more and found what I think is the underlying problem: gnulib-tool generated lib/gnulib.mk.in before it generates m4/gnulib-comp.m4, which Makefile-generation relies upon. I reverted my recent hack to emacs/admin/merge-gnulib and installed the attached Gnulib patch. Please update to the latest Emacs and Gnulib and try again.
From 8c4f4d7a3c28f88b64fce2fb1d0dc0e570d1a482 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Tue, 1 Mar 2022 10:01:22 -0800
Subject: [PATCH] Create lib/Makefile.am after gnulib-comp.m4

* gnulib-tool (func_import): Create library makefile after
creating gnulib-comp.m4.  With --gnu-make, the latter depends on
the former.  See <https://bugs.gnu.org/32452#109>.
---
 ChangeLog   |  7 ++++++
 gnulib-tool | 68 +++++++++++++++++++++++++++--------------------------
 2 files changed, 42 insertions(+), 33 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 629ec803fd..c5a80fd3f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-03-01  Paul Eggert  <[email protected]>
+
+	Create lib/Makefile.am after gnulib-comp.m4
+	* gnulib-tool (func_import): Create library makefile after
+	creating gnulib-comp.m4.  With --gnu-make, the latter depends on
+	the former.  See <https://bugs.gnu.org/32452#109>.
+
 2022-02-26  Paul Eggert  <[email protected]>
 
 	gettime-res: fix unlikely overflow bug
diff --git a/gnulib-tool b/gnulib-tool
index 9ee7560209..e420b321d2 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -5692,39 +5692,6 @@ s,//*$,/,'
     func_note_Makefile_am_edit "$dir1" EXTRA_DIST "${dir2}gnulib-cache.m4"
   }
 
-  # Create library makefile.
-  func_dest_tmpfilename $sourcebase/$source_makefile_am
-  destfile="$sourcebase/$source_makefile_am"
-  modules="$main_modules"
-  if $automake_subdir; then
-    func_emit_lib_Makefile_am | "$gnulib_dir"/build-aux/prefix-gnulib-mk --from-gnulib-tool --lib-name="$libname" --prefix="$sourcebase/" > "$tmpfile"
-  else
-    func_emit_lib_Makefile_am > "$tmpfile"
-  fi
-  if test -f "$destdir"/$sourcebase/$source_makefile_am; then
-    if cmp -s "$destdir"/$sourcebase/$source_makefile_am "$tmpfile"; then
-      rm -f "$tmpfile"
-    else
-      if $doit; then
-        echo "Updating $sourcebase/$source_makefile_am (backup in $sourcebase/$source_makefile_am~)"
-        mv -f "$destdir"/$sourcebase/$source_makefile_am "$destdir"/$sourcebase/$source_makefile_am~
-        mv -f "$tmpfile" "$destdir"/$sourcebase/$source_makefile_am
-      else
-        echo "Update $sourcebase/$source_makefile_am (backup in $sourcebase/$source_makefile_am~)"
-        rm -f "$tmpfile"
-      fi
-    fi
-  else
-    if $doit; then
-      echo "Creating $sourcebase/$source_makefile_am"
-      mv -f "$tmpfile" "$destdir"/$sourcebase/$source_makefile_am
-    else
-      echo "Create $sourcebase/$source_makefile_am"
-      rm -f "$tmpfile"
-    fi
-    func_append added_files "$sourcebase/$source_makefile_am$nl"
-  fi
-
   # Create po/ directory.
   if test -n "$pobase"; then
     # Create po makefile and auxiliary files.
@@ -6131,6 +6098,41 @@ s,//*$,/,'
     fi
   fi
 
+  # Create library makefile.
+  # Do this after creating gnulib-comp.m4, because func_emit_lib_Makefile_am
+  # can run 'autoconf -t', which reads gnulib-comp.m4.
+  func_dest_tmpfilename $sourcebase/$source_makefile_am
+  destfile="$sourcebase/$source_makefile_am"
+  modules="$main_modules"
+  if $automake_subdir; then
+    func_emit_lib_Makefile_am | "$gnulib_dir"/build-aux/prefix-gnulib-mk --from-gnulib-tool --lib-name="$libname" --prefix="$sourcebase/" > "$tmpfile"
+  else
+    func_emit_lib_Makefile_am > "$tmpfile"
+  fi
+  if test -f "$destdir"/$sourcebase/$source_makefile_am; then
+    if cmp -s "$destdir"/$sourcebase/$source_makefile_am "$tmpfile"; then
+      rm -f "$tmpfile"
+    else
+      if $doit; then
+        echo "Updating $sourcebase/$source_makefile_am (backup in $sourcebase/$source_makefile_am~)"
+        mv -f "$destdir"/$sourcebase/$source_makefile_am "$destdir"/$sourcebase/$source_makefile_am~
+        mv -f "$tmpfile" "$destdir"/$sourcebase/$source_makefile_am
+      else
+        echo "Update $sourcebase/$source_makefile_am (backup in $sourcebase/$source_makefile_am~)"
+        rm -f "$tmpfile"
+      fi
+    fi
+  else
+    if $doit; then
+      echo "Creating $sourcebase/$source_makefile_am"
+      mv -f "$tmpfile" "$destdir"/$sourcebase/$source_makefile_am
+    else
+      echo "Create $sourcebase/$source_makefile_am"
+      rm -f "$tmpfile"
+    fi
+    func_append added_files "$sourcebase/$source_makefile_am$nl"
+  fi
+
   if $gentests; then
     # Create tests makefile.
     func_dest_tmpfilename $testsbase/$tests_makefile_am
-- 
2.32.0

Reply via email to