bug#81303: Build issue with busybox tar

Karl Berry <[email protected]> Thu, 25 Jun 2026 16:01:31 -0600
Newsgroups gmane.comp.sysutils.automake.bugs
Message-ID <[email protected]>
    busybox tar depending on configuration does support --version:

Thanks Hendrik. I pushed the change below. I figured the --version
checks in both the gnutar and plaintar cases should be checked.
As long as busybox tar --version doesn't contain the string "GNU" ...

Thanks,
Karl

-----------------------------------------------------------------------------
m4: better detection of GNU tar.	

From https://bugs.gnu.org/81303 (Hendrik Donner).

* m4/tar.m4: grep for GNU in the tar --version before concluding
this is GNU tar, because busybox tar also understands GNU tar.
diff --git a/m4/tar.m4 b/m4/tar.m4
index 461c74830..fa6d12a93 100644
--- a/m4/tar.m4
+++ b/m4/tar.m4
@@ -79,7 +79,7 @@ m4_if([$1], [v7],
     case $_am_tool in
     gnutar)
       for _am_tar in tar gnutar gtar; do
-        AM_RUN_LOG([$_am_tar --version]) && break
+        AM_RUN_LOG([$_am_tar --version | grep GNU >/dev/null]) && break
       done
       am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
       am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
@@ -88,7 +88,7 @@ m4_if([$1], [v7],
     plaintar)
       # Must skip GNU tar: if it does not support --format= it doesn't create
       # ustar tarball either.
-      (tar --version) >/dev/null 2>&1 && continue
+      (tar --version | grep GNU) >/dev/null 2>&1 && continue
       am__tar='tar chf - "$$tardir"'
       am__tar_='tar chf - "$tardir"'
       am__untar='tar xf -'
Running command: git commit \-q \-F \.\/vc\-dwim\-log\-Q3BZlt \-\-author\=Karl\ Berry\ \<karl\@freefriends\.org\> \-\- ChangeLog
+ set +x

compile finished at Thu Jun 25 14:58:11 2026