Hello.

Thank you for reporting the issue.

I believe I have fixed the defect. The attached patch assumes that
"no-dist-built-sources" is the right option name, following the
documentation and the Options.pm file.

Automake itself has been changed to process the option correctly,
distdir.am got the reversed condition fixed (!) and a new test has
been added based on the one provided in the defect report (thank you!).

All tests with "dist" in the name pass.

--
Regards - Bogdan ('bogdro') D.                 (GNU/Linux & FreeDOS)
X86 assembly (DOS, GNU/Linux):    http://bogdro.evai.pl/index-en.php
Soft(EN): http://bogdro.evai.pl/soft  http://bogdro.evai.pl/soft4asm
www.Xiph.org  www.TorProject.org  www.LibreOffice.org  www.GnuPG.org
From 2eeff35bcb64c9f3c6651773344483d404c6580a Mon Sep 17 00:00:00 2001
From: Bogdan Drozdowski <>
Date: Thu, 22 Aug 2024 23:10:38 +0200
Subject: [PATCH] Fix no-dist-built-sources

---
 bin/automake.in            | 2 +-
 lib/am/distdir.am          | 4 ++--
 t/dist-no-built-sources.sh | 7 +++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/bin/automake.in b/bin/automake.in
index a17f45236..ee196f28b 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -6903,7 +6903,7 @@ sub preprocess_file
 		 'SHAR'        => !! option 'dist-shar',
 		 'ZIP'         => !! option 'dist-zip',
 		 'ZSTD'        => !! option 'dist-zstd',
-		 'DIST_BUILT_SOURCES' => !! option 'dist-built-sources',
+		 'DIST_BUILT_SOURCES' => ! option 'no-dist-built-sources',
 
 		 'INSTALL-INFO' =>  ! option 'no-installinfo',
 		 'INSTALL-MAN'  =>  ! option 'no-installman',
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index c85f6a325..810290477 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -76,10 +76,10 @@ AM_RECURSIVE_TARGETS += distdir distdir-am
 endif %?SUBDIRS%
 
 if %?DIST_BUILT_SOURCES%
-distdir:
+distdir: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) distdir-am
 else !%?DIST_BUILT_SOURCES%
-distdir: $(BUILT_SOURCES)
+distdir:
 	$(MAKE) $(AM_MAKEFLAGS) distdir-am
 endif !%?DIST_BUILT_SOURCES%
 
diff --git a/t/dist-no-built-sources.sh b/t/dist-no-built-sources.sh
index d891f3a13..f5891bab4 100644
--- a/t/dist-no-built-sources.sh
+++ b/t/dist-no-built-sources.sh
@@ -26,6 +26,11 @@ for testopt in no-built-sources dist-built-sources; do
         configure.ac >configure.tmp
     cmp configure.ac configure.tmp && fatal_ 'failed to edit configure.ac'
     mv -f configure.tmp configure.ac
+  else
+    sed -e 's/AM_INIT_AUTOMAKE(\[no-dist-built-sources\])/AM_INIT_AUTOMAKE/' \
+        configure.ac >configure.tmp
+    cmp configure.ac configure.tmp && fatal_ 'failed to edit configure.ac'
+    mv -f configure.tmp configure.ac
   fi
 
   cat >> configure.ac << 'END'
@@ -66,9 +71,11 @@ EOF
   if test "$testopt" = no-built-sources; then
     # no-built-sources should not have generated this
     ! test -e x.c
+    $EGREP "distdir:$" Makefile
   else
     # built-sources build should have it
     test -e x.c
+    grep "distdir: \$(BUILT_SOURCES)" Makefile
   fi
 
   # If the test runs fast enough, the make dist second time through
-- 
2.35.1

Reply via email to