When running `libtoolize --ltdl`, a symlink to the source config-h.in is used rather than a copy of the file. This causes the build system to look at its old timestamp relative to the other generated files that are copied in, and then try to regenerate things, and update the config-h.in timestamp by touching the symlink (which will dereference things). This breaks `make distcheck` because when a few tests run that invoke `libtoolize --ltdl --install` w/out --copy, and then try to build the project, automake's rules trigger autoheader regen, and then update the timestamp, which updates the underlying file, and then causes libtool's own files to get out of sync. So the next time make is run in the tree, it tries to regenerate the source files, and fails as the source tree is read-only.
Change libtoolize to always copying the header over during install. It's not clear to me whether this is 100% the right answer, but it shouldn't make things worse beyond missing a case to use a symlink. We probably can't avoid this as long as aclocal.m4 itself is copied in instead of symlinked. This changed between v2.4.2 and v2.4.3 in commit 4e671d6ba69c889b1f9aee12de6c504d26dc6514 ("libtoolize: simplify file-copying and -linking call-graph."). Example failure log: $ make distcheck ... make[3]: Entering directory '.../libtool-2.4.7.62-3e11/_build/sub' GEN ../../libltdl/Makefile.in GEN ../../libltdl/configure autom4te-2.72: error: cannot create autom4te.cache in .../libtool-2.4.7.62-3e11/libltdl: Permission denied make[3]: *** [Makefile:2411: ../../libltdl/configure] Error 1 make[3]: *** Waiting for unfinished jobs.... autom4te-2.72: error: cannot create autom4te.cache in .../libtool-2.4.7.62-3e11/libltdl: Permission denied automake-1.16: error: autoconf failed with exit status: 1 make[3]: *** [Makefile:2387: ../../libltdl/Makefile.in] Error 1 We can see this in old-m4-iface.at:AC_WITH_LTDL which doesn't use --copy with libtoolize: $ stat libltdl/config-h.in | grep Modify Modify: 2024-01-18 01:18:52.998059970 -0500 $ make check-local TESTSUITEFLAGS=100 ... 100: AC_WITH_LTDL ok ... $ stat libltdl/config-h.in | grep Modify Modify: 2024-01-18 01:19:19.254727020 -0500 And in the test log we can see: 100. old-m4-iface.at:113: testing AC_WITH_LTDL ... ... libtoolize: linking file 'libltdl/config-h.in' ... ./old-m4-iface.at:161: : ${CONFIG_SHELL=/bin/sh}; export CONFIG_SHELL; $CONFIG_SHELL ./configure $configure_options --prefix="$prefix" --exec-prefix="$prefix" --bindir="$prefix/bin" --libdir="$prefix/lib" --with-included-ltdl ... ./old-m4-iface.at:161: $as_unset LIBTOOL; $as_unset LIBTOOLIZE; $MAKE $target stderr: stdout: cd libltdl && make make[1]: Entering directory '/usr/local/src/gnu/libtool/tests/testsuite.dir/100/libltdl' CDPATH="${ZSH_VERSION+.}:" && cd . && aclocal -I m4 cd . && automake --foreign CDPATH="${ZSH_VERSION+.}:" && cd . && autoconf /bin/sh ./config.status --recheck ... (CDPATH="${ZSH_VERSION+.}:" && cd . && autoheader) rm -f stamp-h1 touch config-h.in ... * libtoolize.in: Copy config-h.in. * tests/libtoolize.at: Change "linking" to "copying". --- libtoolize.in | 10 +++++++++- tests/libtoolize.at | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libtoolize.in b/libtoolize.in index 631069418eb0..336fc81bd5ea 100644 --- a/libtoolize.in +++ b/libtoolize.in @@ -947,7 +947,15 @@ func_install_pkgltdl_files () ;; config-h.in) - test subproject = "$ltdl_mode" || continue + test subproject = "$ltdl_mode" && { + # Always copy config-h.in, otherwise automake's autoheader rules + # will change the destination's timestamp if it is symlinked. + ( opt_copy=: + func_copy "$file" "$pkgltdldir" "$ltdl_dir" \ + pkgltdl_header "$my_copy_filter" + ) + } + continue ;; configure) diff --git a/tests/libtoolize.at b/tests/libtoolize.at index fec51c61c5e6..cbc21d68b61d 100644 --- a/tests/libtoolize.at +++ b/tests/libtoolize.at @@ -471,7 +471,7 @@ libtoolize: linking file 'ltdl/README' libtoolize: linking file 'ltdl/configure.ac' libtoolize: copying file 'ltdl/aclocal.m4' libtoolize: linking file 'ltdl/Makefile.in' -libtoolize: linking file 'ltdl/config-h.in' +libtoolize: copying file 'ltdl/config-h.in' libtoolize: copying file 'ltdl/configure' libtoolize: linking file 'ltdl/libltdl/lt__alloc.h' libtoolize: linking file 'ltdl/libltdl/lt__argz_.h' @@ -1047,7 +1047,7 @@ libtoolize: linking file 'ltdl/README' libtoolize: creating file 'ltdl/configure.ac' libtoolize: creating file 'ltdl/aclocal.m4' libtoolize: creating file 'ltdl/Makefile.in' -libtoolize: linking file 'ltdl/config-h.in' +libtoolize: copying file 'ltdl/config-h.in' libtoolize: creating file 'ltdl/configure' libtoolize: linking file 'ltdl/libltdl/lt__alloc.h' libtoolize: linking file 'ltdl/libltdl/lt__argz_.h' -- 2.43.0