summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am37
-rw-r--r--NEWS2
-rw-r--r--configure.ac10
-rw-r--r--gunzip.in2
-rw-r--r--gzexe.in8
-rw-r--r--zcat.in2
-rw-r--r--zcmp.in2
-rw-r--r--zdiff.in16
-rw-r--r--zegrep.in2
-rw-r--r--zfgrep.in2
-rw-r--r--zforce.in2
-rw-r--r--zgrep.in2
-rw-r--r--zless.in2
-rw-r--r--zmore.in2
-rw-r--r--znew.in8
15 files changed, 73 insertions, 26 deletions
diff --git a/Makefile.am b/Makefile.am
index 07f47a8..4f51b61 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,9 +92,12 @@ gzip.doc.gz: gzip.doc $(bin_PROGRAMS)
SUFFIXES = .in
.in:
$(AM_V_GEN)rm -f $@-t $@ \
- && sed \
+ && sed \
-e 's|/bin/sh|$(SHELL)|g' \
-e 's|[@]GREP@|$(GREP)|g' \
+ -e "s|'gzip'|$(GZIP_TRANSFORMED)|g" \
+ -e "s|'zdiff'|$(ZDIFF_TRANSFORMED)|g" \
+ -e "s|'zgrep'|$(ZGREP_TRANSFORMED)|g" \
-e 's|[@]VERSION@|$(VERSION)|g' \
$(srcdir)/$@.in >$@-t \
&& chmod a=rx $@-t \
@@ -173,3 +176,35 @@ MAINTAINERCLEANFILES = gzip.doc
MOSTLYCLEANFILES = _match.i match_.s _match.S gzip.doc.gz \
gunzip gzexe zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew
+
+# gzip, zdiff and zgrep are used by installed scripts, and installed names
+# might be transformed by 'configure' options like --program-transform-name.
+# Create executabls in the current directory by the transformed names,
+# for the benefit of 'make check'.
+if GZIP_IS_TRANSFORMED
+BUILT_SOURCES += $(GZIP_TRANSFORMED)
+MOSTLYCLEANFILES += $(GZIP_TRANSFORMED)
+$(GZIP_TRANSFORMED):
+ printf '%s\n' >'$@' \
+ '#!$(SHELL)' \
+ 'exec '\''$(abs_top_builddir)/gzip'\'' "$$@"'
+ chmod a+x $@
+endif
+if ZDIFF_IS_TRANSFORMED
+BUILT_SOURCES += $(ZDIFF_TRANSFORMED)
+MOSTLYCLEANFILES += $(ZDIFF_TRANSFORMED)
+$(ZDIFF_TRANSFORMED):
+ printf '%s\n' >'$@' \
+ '#!$(SHELL)' \
+ 'exec '\''$(abs_top_builddir)/zdiff'\'' "$$@"'
+ chmod a+x $@
+endif
+if ZGREP_IS_TRANSFORMED
+BUILT_SOURCES += $(ZGREP_TRANSFORMED)
+MOSTLYCLEANFILES += $(ZGREP_TRANSFORMED)
+$(ZGREP_TRANSFORMED):
+ printf '%s\n' >'$@' \
+ '#!$(SHELL)' \
+ 'exec '\''$(abs_top_builddir)/zgrep'\'' "$$@"'
+ chmod a+x $@
+endif
diff --git a/NEWS b/NEWS
index 95ffe49..c1159b0 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ GNU gzip NEWS -*- outline -*-
'zdiff -C 5' no longer misbehaves by treating '5' as a file name.
+ Configure-time options like --program-prefix now work.
+
* Noteworthy changes in release 1.11 (2021-09-03) [stable]
diff --git a/configure.ac b/configure.ac
index d9c77da..1809d4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,6 +278,16 @@ else
fi
AC_SUBST([ASFLAGS_config])
+GZIP_TRANSFORMED=` echo gzip | sed "$program_transform_name"`
+ZDIFF_TRANSFORMED=`echo zdiff | sed "$program_transform_name"`
+ZGREP_TRANSFORMED=`echo zgrep | sed "$program_transform_name"`
+AC_SUBST([GZIP_TRANSFORMED])
+AC_SUBST([ZDIFF_TRANSFORMED])
+AC_SUBST([ZGREP_TRANSFORMED])
+AM_CONDITIONAL([GZIP_IS_TRANSFORMED], [test "$GZIP_TRANSFORMED" != gzip])
+AM_CONDITIONAL([ZDIFF_IS_TRANSFORMED], [test "$ZDIFF_TRANSFORMED" != zdiff])
+AM_CONDITIONAL([ZGREP_IS_TRANSFORMED], [test "$ZGREP_TRANSFORMED" != zgrep])
+
AC_C_CONST
AC_CHECK_HEADERS_ONCE(fcntl.h limits.h memory.h time.h sys/sdt.h)
AC_CHECK_FUNCS_ONCE([chown fchmod fchown lstat siginterrupt])
diff --git a/gunzip.in b/gunzip.in
index 5f38270..6a84659 100644
--- a/gunzip.in
+++ b/gunzip.in
@@ -54,4 +54,4 @@ case $1 in
--version) printf '%s\n' "$version" || exit 1; exit;;
esac
-exec gzip -d "$@"
+exec 'gzip' -d "$@"
diff --git a/gzexe.in b/gzexe.in
index bb63292..04b06a9 100644
--- a/gzexe.in
+++ b/gzexe.in
@@ -106,7 +106,7 @@ for i do
fi
case /$file in
*/basename | */bash | */cat | */chmod | */cp | \
- */dirname | */expr | */gzip | \
+ */dirname | */expr | */'gzip' | \
*/ln | */mkdir | */mktemp | */mv | */printf | */rm | \
*/sed | */sh | */sleep | */test | */tail)
printf >&2 '%s\n' "$0: $i might depend on itself"; continue;;
@@ -183,7 +183,7 @@ case `printf 'X\n' | tail -n +1 2>/dev/null` in
X) tail_n=-n;;
*) tail_n=;;
esac
-if tail $tail_n +$skip <"$0" | gzip -cd > "$gztmp"; then
+if tail $tail_n +$skip <"$0" | 'gzip' -cd > "$gztmp"; then
umask $umask
chmod 700 "$gztmp"
(sleep 5; rm -fr "$gztmpdir") 2>/dev/null &
@@ -193,7 +193,7 @@ else
(exit 127); res=127
fi; exit $res
EOF
- gzip -cv9 "$file") > "$tmp" || {
+ 'gzip' -cv9 "$file") > "$tmp" || {
res=$?
printf >&2 '%s\n' "$0: compression not possible for $i, file unchanged."
continue
@@ -211,7 +211,7 @@ EOF
X) tail_n=-n;;
*) tail_n=;;
esac
- tail $tail_n +$skip "$file" | gzip -cd > "$tmp" || {
+ tail $tail_n +$skip "$file" | 'gzip' -cd > "$tmp" || {
res=$?
printf >&2 '%s\n' "$0: $i probably not in gzexe format, file unchanged."
continue
diff --git a/zcat.in b/zcat.in
index 4717b08..4f5fdcd 100644
--- a/zcat.in
+++ b/zcat.in
@@ -48,4 +48,4 @@ case $1 in
--version) printf '%s\n' "$version" || exit 1; exit;;
esac
-exec gzip -cd "$@"
+exec 'gzip' -cd "$@"
diff --git a/zcmp.in b/zcmp.in
index c084aab..d072231 100644
--- a/zcmp.in
+++ b/zcmp.in
@@ -41,4 +41,4 @@ case $1 in
--version) printf '%s\n' "$version" || exit 2; exit;;
esac
-exec zdiff --__cmp "$@"
+exec 'zdiff' --__cmp "$@"
diff --git a/zdiff.in b/zdiff.in
index 593cb6e..012024e 100644
--- a/zdiff.in
+++ b/zdiff.in
@@ -106,7 +106,7 @@ case $file2 in
FILE=`expr "X$file1" : 'X\(.*\)[-.][zZtga]*$'`
gzip_status=$(
exec 4>&1
- (gzip -cd -- "$file1" 4>&-; echo $? >&4) 3>&- |
+ ('gzip' -cd -- "$file1" 4>&-; echo $? >&4) 3>&- |
eval "$cmp" - '"$FILE"' >&3
);;
*)
@@ -118,7 +118,7 @@ case $file2 in
-,-)
gzip_status=$(
exec 4>&1
- (gzip -cdfq - 4>&-; echo $? >&4) 3>&- |
+ ('gzip' -cdfq - 4>&-; echo $? >&4) 3>&- |
eval "$cmp" - - >&3
);;
*)
@@ -134,8 +134,8 @@ case $file2 in
then
gzip_status=$(
exec 4>&1
- (gzip -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
- ((gzip -cdfq -- "$file2" 4>&-
+ ('gzip' -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
+ (('gzip' -cdfq -- "$file2" 4>&-
echo $? >&4) 3>&- 5<&- </dev/null |
eval "$cmp" /dev/fd/5 - >&3) 5<&0
)
@@ -163,10 +163,10 @@ case $file2 in
set -C
tmp=${TMPDIR}zdiff$$
fi
- gzip -cdfq -- "$file2" > "$tmp" || exit 2
+ 'gzip' -cdfq -- "$file2" > "$tmp" || exit 2
gzip_status=$(
exec 4>&1
- (gzip -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
+ ('gzip' -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
eval "$cmp" - '"$tmp"' >&3
)
cmp_status=$?
@@ -177,7 +177,7 @@ case $file2 in
*)
gzip_status=$(
exec 4>&1
- (gzip -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
+ ('gzip' -cdfq -- "$file1" 4>&-; echo $? >&4) 3>&- |
eval "$cmp" - '"$file2"' >&3
);;
esac;;
@@ -185,7 +185,7 @@ case $file2 in
*[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
gzip_status=$(
exec 4>&1
- (gzip -cdfq -- "$file2" 4>&-; echo $? >&4) 3>&- |
+ ('gzip' -cdfq -- "$file2" 4>&-; echo $? >&4) 3>&- |
eval "$cmp" '"$file1"' - >&3
);;
*) eval "$cmp" '"$file1"' '"$file2"';;
diff --git a/zegrep.in b/zegrep.in
index e5969b7..e81b27a 100644
--- a/zegrep.in
+++ b/zegrep.in
@@ -1,2 +1,2 @@
#!/bin/sh
-exec zgrep -E "$@"
+exec 'zgrep' -E "$@"
diff --git a/zfgrep.in b/zfgrep.in
index fd7be2b..f1c0af9 100644
--- a/zfgrep.in
+++ b/zfgrep.in
@@ -1,2 +1,2 @@
#!/bin/sh
-exec zgrep -F "$@"
+exec 'zgrep' -F "$@"
diff --git a/zforce.in b/zforce.in
index 3cb6204..aeb966a 100644
--- a/zforce.in
+++ b/zforce.in
@@ -56,7 +56,7 @@ for i do
continue
fi
- if gzip -lv < "$i" 2>/dev/null | grep '^defl' > /dev/null; then
+ if 'gzip' -lv < "$i" 2>/dev/null | grep '^defl' > /dev/null; then
new="$i.gz"
mv "$i" "$new" && printf '%s\n' "$i -- replaced with $new" || res=1
diff --git a/zgrep.in b/zgrep.in
index 7db4c69..345dae3 100644
--- a/zgrep.in
+++ b/zgrep.in
@@ -201,7 +201,7 @@ do
# Fail if gzip or grep (or sed) fails.
gzip_status=$(
exec 5>&1
- (gzip -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
+ ('gzip' -cdfq -- "$i" 5>&-; echo $? >&5) 3>&- |
if test $files_with_matches -eq 1; then
eval "$grep" >/dev/null && { printf '%s\n' "$i" || exit 2; }
elif test $files_without_matches -eq 1; then
diff --git a/zless.in b/zless.in
index e77e6b9..4638e94 100644
--- a/zless.in
+++ b/zless.in
@@ -65,7 +65,7 @@ less' '[1-9][0-9][0-9][0-9]*)
*) use_input_pipe_on_stdin='';;
esac
-LESSOPEN="|$check_exit_status${use_input_pipe_on_stdin}gzip -cdfq -- %s"
+LESSOPEN="|$check_exit_status${use_input_pipe_on_stdin}'gzip' -cdfq -- %s"
export LESSOPEN
exec less "$@"
diff --git a/zmore.in b/zmore.in
index 01fa7e8..bd007b4 100644
--- a/zmore.in
+++ b/zmore.in
@@ -50,5 +50,5 @@ for FILE
do
test $# -lt 2 ||
printf '::::::::::::::\n%s\n::::::::::::::\n' "$FILE" || break
- gzip -cdfq -- "$FILE"
+ 'gzip' -cdfq -- "$FILE"
done 2>&1 | eval ${PAGER-more}
diff --git a/znew.in b/znew.in
index 3e994b2..45d0764 100644
--- a/znew.in
+++ b/znew.in
@@ -94,7 +94,7 @@ for i do
fi
test $keep -eq 1 && old=`wc -c < "$n.Z"`
if test $pipe -eq 1; then
- if gzip -d < "$n.Z" | gzip $opt > "$n$ext"; then
+ if 'gzip' -d < "$n.Z" | 'gzip' $opt > "$n$ext"; then
# Copy file attributes from old file to new one, if possible.
touch -r"$n.Z" -- "$n$ext" 2>/dev/null
chmod --reference="$n.Z" -- "$n$ext" 2>/dev/null
@@ -111,14 +111,14 @@ for i do
res=1; continue
fi
fi
- if gzip -d "$n.Z"; then
+ if 'gzip' -d "$n.Z"; then
:
else
test $check -eq 1 && mv "$n.$$" "$n.Z"
printf '%s\n' "error while uncompressing $n.Z"
res=1; continue
fi
- if gzip $opt "$n"; then
+ if 'gzip' $opt "$n"; then
:
else
if test $check -eq 1; then
@@ -142,7 +142,7 @@ for i do
printf '%s\n' "$n.Z smaller than $n$ext -- unchanged"
elif test $check -eq 1; then
- if gzip -t "$n$ext" ; then
+ if 'gzip' -t "$n$ext" ; then
rm -f "$n.$$" "$n.Z"
else
test $pipe -eq 0 && mv "$n.$$" "$n.Z"