75 Commits

Author SHA1 Message Date
Jim Meyering
50463e0899 maint: update copyright dates 2026-01-02 17:10:47 -08:00
Jim Meyering
f3e440f1c9 build: avoid test failure on systems lacking "more"
On such systems, treat "more" as optional, just as we treat "less".
If the primary program is not available, do not install zmore.
Reported by Bruno Haible in http://debbugs.gnu.org/77563 and noticed
on a 2025 x86_64 GNU/Hurd system.
* configure.ac: Check for more/MORE just like we do for less/LESS.
* tests/Makefile.am: Use the new variables.
* NEWS: Mention it.
2025-04-06 15:59:37 -07:00
Jim Meyering
98db945a34 maint: update all copyright dates via "make update-copyright" 2025-01-03 09:33:55 -08:00
Jim Meyering
34bec437e0 maint: modernize see...licenses comments
To accommodate a new syntax-check rule, ...
Adjust copyright notices that suggested to write to an old
Franklin Street address to reference the URL instead:

  git grep -l 'if not, write' |xargs \
  perl -0777 -pi -e 's{program; if not, write .*? USA\.}{program.  If not, see <https://www.gnu.org/licenses/>.}ms'

Also, run this:
  git grep -l 'License along$' | xargs \
  perl -0777 -pi -e 's{License along\n# with}{License\n# along with}ms'

to normalize a little more, changing comments like this:
  You should have received a copy of the GNU General Public License along
  with this program.  If not, see <https://www.gnu.org/licenses/>.

to this:
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <https://www.gnu.org/licenses/>.
2024-09-08 08:52:27 -07:00
Paul Eggert
22de20442e make update-copyright 2024-01-08 18:51:42 -08:00
Jim Meyering
7e6214bd1c maint: update copyright dates 2023-01-01 17:19:00 -08:00
Paul Eggert
567cbc0be8 maint: pacify GCC with recent x86 glibc
* configure.ac (WERROR_CFLAGS): Disable -Wtype-limits,
due to a false alarm on platforms where 'long' is 32 bits
and time_t is 64-bit, such as recent glibc on x86.
2022-04-06 00:32:18 -07:00
Paul Eggert
31193bbd13 build: support --program-prefix etc.
Problem reported by Antonio Diaz Diaz via Dagobert Michelsen in:
https://bugs.gnu.org/16876
* Makefile.am (.in): Substitute for 'gzip', 'zdiff', 'zgrep'.
($(GZIP_TRANSFORMED), $(ZDIFF_TRANSFORMED), $(ZGREP_TRANSFORMED)):
New rules to build forwarding shell scripts, if needed.
Add these files to BUILT_SOURCES and MOSTLY_CLEANFILES if needed.
* configure.ac (GZIP_TRANSFORMED, ZDIFF_TRANSFORMED, ZGREP_TRANSFORMED):
New substituted vars.
(GZIP_IS_TRANSFORMED, ZDIFF_IS_TRANSFORMED, ZGREP_IS_TRANSFORMED):
New Automake conditions.
* gunzip.in, gzexe.in, zcat.in, zcmp.in, zdiff.in, zegrep.in:
* zfgrep.in, zforce.in, zgrep.in, zless.in, zmore.in, znew.in:
Quote possibly-transformed subcommand names.
2022-04-04 12:00:44 -07:00
Paul Eggert
2fa0edbe05 zless: install only on platforms with 'less'
Problem reported by Michael Felt (Bug#30029).
* Makefile.am (ZLESS_MAN, ZLESS_PROG): New macros.
(man_MANS, bin_SCRIPTS): Use them.
* configure.ac: Check for 'less'.
* tests/Makefile.am (ZLESS_PROG): New macro.
(built_programs): Use it.
2022-03-31 16:01:29 -07:00
Jim Meyering
65696b0b18 build: disable some expensive compiler warnings by default
* configure.ac (gl_GCC_VERSION_IFELSE): Copy from coreutils.
(gcc-warnings): Update from coreutils.
2022-01-03 10:24:06 -08:00
Jim Meyering
54af561326 maint: make update-copyright 2022-01-03 10:16:37 -08:00
Jim Meyering
7d3a3c0a12 maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2021-01-01 17:36:52 -08:00
Jim Meyering
01458f8fdb maint: avoid another autoreconf warning
* configure.ac: modernize AC_TRY_COMPILE invocation
Use AC_COMPILE_IFELSE instead of AC_TRY_COMPILE.
2020-12-09 20:55:20 -08:00
Jim Meyering
fb973ec75a maint: remove uses of obsolete macros
* configure.ac (AC_TYPE_SIGNAL, AC_ISC_POSIX, AC_HEADER_STDC): Remove.
2020-12-09 20:41:43 -08:00
Jim Meyering
598fbc2396 maint: avoid autoreconf warnings
* configure.ac: Go back to using AC_PROG_CC rather than AC_PROG_CC_STDC,
as the latter is obsolescent and the Autoconf bug involving the former
has been fixed.
2020-12-09 20:38:36 -08:00
Jim Meyering
321b32d27f build: require autoconf-2.64
* configure.ac: Require autoconf-2.64, up from 2.63, to align with gnulib.
2020-12-09 20:33:08 -08:00
Ilya Leoshkevich
66448f9d12 IBM Z DFLTCC: fix three data corruption issues
SUSE maintainers have found an issue related to building zlib in 31-bit
mode, which also applies to gzip: STFLE instruction can be used only in
z/Architecture mode: https://build.opensuse.org/request/show/708284 --
I have integrated the fix into this patch.

* configure.ac (AC_CHECK_HEADERS_ONCE): Add feature detection for
sys/sdt.h probes.
* dfltcc.c (dfltcc_cc): Minor formatting improvements.
(HB_BITS): Remove.
(HB_SIZE): Likewise.
(is_dfltcc_enabled): Fix buffer overrun on newer models and incomplete
initialization on older models.
Add machine mode hint.
(dfltcc): Use sys/sdt.h feature detection.
(bi_load): New function.
(bi_close_block): Use bi_load.
(close_stream): Fix overwriting the End-of-block Symbol.
(dfltcc_deflate): Fix losing partial byte on flush.
Fix setting Block-Continuation Flag when DFLTCC-CMPR outputs 0 bits and
requests a retry.
Minor formatting improvements.
(dfltcc_inflate): Retry immediately if requested.
Print the hardware error code and flush the output buffer on error.
Minor formatting improvements.
* tests/hufts: Ignore the hardware error code.
2020-01-10 13:02:27 -08:00
Jim Meyering
89181137b9 maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2020-01-01 09:53:33 -08:00
Ilya Leoshkevich
7a6f9c9c32 bug#34918: [PATCH] Add support for IBM Z hardware-accelerated deflate
Future versions of IBM Z mainframes will provide DFLTCC instruction,
which implements deflate algorithm in hardware with estimated
compression and decompression performance orders of magnitude faster
than the current gzip and ratio comparable with that of level 1.

This patch adds DFLTCC support to gzip. In order to enable it, the
following build commands should be used:

    $ ./configure --enable-dfltcc
    $ make

When built like this, gzip would compress in hardware on level 1, and in
software on all other levels. Decompression will always happen in
hardware. In order to enable DFLTCC compression for levels 1-6 (i.e. to
make it used by default) one could either add -DDFLTCC_LEVEL_MASK=0x7e
at compile time, or set the environment variable DFLTCC_LEVEL_MASK to
0x7e at run time.

Two DFLTCC compression calls produce the same results only when they
both are made on machines of the same generation, and when the
respective buffers have the same offset relative to the start of the
page. Therefore care should be taken when using hardware compression
when reproducible results are desired. One such use case - reproducible
software builds - is handled explicitly: when SOURCE_DATE_EPOCH
environment variable is set, the hardware compression is disabled.

This patch tries to add DFLTCC support in a least intrusive way.
All SystemZ-specific code was placed into a separate file, but
unfortunately there is still a noticeable amount of changes in the
main gzip code. Below is the summary of those changes.

DFLTCC will refuse to write an End-of-block Symbol if there is no input
data, thus in some cases it is necessary to do this manually. In order
to achieve this, bi_buf and bi_valid were promoted to extern variables.

lm_init() function moves the input buffer into the window, which is not
desirable for DFLTCC. Therefore, its invocation was moved to
software-only deflate(). In addition to initializing the window, this
function also used to convert compression level to flags, which is still
needed for DFLTCC. This responsibility was handed off to zip() function.

To achieve maximum performance with DFLTCC, inbuf and outbuf must be
256k big and page-aligned. Additionally, for DFLTCC to work at all, the
window must be page-aligned.

In addition to compression, DFLTCC computes CRC-32 checksum, therefore,
whenever it's used, software checksumming needs to be suppressed and its
results replaced by those of dfltcc. This is achieved by introducing the
new getcrc() and setcrc() functions.

Unlike the current software implementation, DFLTCC decompresses data
into the output buffer, and not the window. Therefore, just like
flushing the window, flushing the output buffer must honor the test
flag.

Finally, znew-k test assumes that "znew -K" would not convert the test
.Z file to .gz, which is not the case with DFLTCC. Since this is not the
main point of the test, this assumption was relaxed.
2019-04-02 10:30:11 -07:00
Jim Meyering
20540be618 build: ensure no VLA is used
Cause developer builds to fail for any use of a VLA.
VLAs (variable length arrays) limit portability.
* configure.ac (nw): Remove -Wvla from the list of disabled warnings,
thus enabling the warning when configured with --enable-gcc-warnings.
(GNULIB_NO_VLA) Define, disabling use of VLAs in gnulib.  This commit
is functionally equivalent to coreutils' v8.30-44-gd26dece5d.
2019-01-20 22:24:06 -08:00
Jim Meyering
a604573c68 maint: update all copyright dates via "make update-copyright"
* gnulib: Also update submodule for its copyright updates.
2019-01-01 19:01:58 -08:00
Paul Eggert
9c2a2de9a4 build: enable -Wunreachable-code
* configure.ac (nw): Remove -Wunreachable-code from the list of
disabled warnings, now that all offending statements have been removed.
2018-12-23 16:50:41 -08:00
Jim Meyering
62e1b9e30b build: make the autoconf-2.63 requirement explicit
* configure.ac: AC_PREREQ: Require 2.63, not 2.59.
Autoconf-2.63 has been required for some time via gnulib.
This merely makes it explicit.
2018-12-21 20:55:57 -08:00
Jim Meyering
203e40cc45 build: remove -Wformat-truncation=2 to avoid avoid false-positive
* configure.ac (GNULIB_WARN_CFLAGS): Add -Wformat-truncation=2,
to disable it when building gnulib with --enable-gcc-warnings.
This avoids what looks like a false positive from GCC 9:
strerror_r.c: In function 'rpl_strerror_r':
strerror_r.c:453:35: error: 'Unknown error ' directive output \
 truncated writing 14 bytes into a region of size 2 \
 [-Werror=format-truncation=]
         snprintf (buf, buflen, "Unknown error %d", errnum);
                                 ~~^~~~~~~~~~~~
In file included from /usr/include/stdio.h:862,
                 from ./stdio.h:43,
                 from strerror_r.c:29:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' \
  output between 16 and 26 bytes into a destination of size 2
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
2018-06-30 19:28:09 -07:00
Jim Meyering
975508caa0 maint: update gnulib and copyright dates for 2018
* gnulib: Update to latest.
* bootstrap: Update from gnulib.
* all files: Run "make update-copyright".
2018-01-03 16:44:26 -08:00
Paul Eggert
d49274f4ed maint: prefer HTTPS to HTTP, FTP in URLs 2017-09-19 10:43:52 -07:00
Paul Eggert
6a692a8db1 maint: port to GCC 7.2
* configure.ac (WERROR_CFLAGS): Avoid -Wduplicated-branches.
* tailor.h (FALLTHROUGH): New macro, taken from Emacs.
* gzip.c (main): Use it.
2017-09-19 10:43:51 -07:00
Jim Meyering
e360d37956 maint: also distribute a zip-compressed tarball
* configure.ac (AM_INIT_AUTOMAKE): Add dist-zip, for
those lacking gzip, 7zip, etc.  Suggested by Karl Berry in
https://bugs.gnu.org/25538.
2017-05-07 12:40:19 -07:00
Jim Meyering
9110d11ac0 maint: update gnulib and copyright dates for 2017
* gnulib: Update to latest.
* all files: Run "make update-copyright".
2017-01-01 03:40:15 -08:00
Paul Eggert
a420fbafe8 Port to Oracle Solaris Studio 12.4
Problem reported by Kiyoshi KANAZAWA in: http://bugs.gnu.org/23133
* NEWS: Document this.
* configure.ac (ASMV): Do not define if NO_ASM is
anywhere in DEFS; it doesn't need to be surrounded by white space.
* lib/match.c: Do not use x86 version if __x86_64__ is defined.
2016-03-28 16:27:45 -07:00
Jim Meyering
2725db1000 maint: update copyright year, bootstrap, init.sh
Run "make update-copyright" and then...

* gzip.c: Transform the copyright notice via s/2015/2016/.
* gnulib: Update to latest.
* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.
2016-01-01 17:50:24 -08:00
Jim Meyering
3d2df61b0c maint: update copyright year ranges to include 2015; update gnulib 2015-01-01 21:43:33 -08:00
Jim Meyering
aef5feaf10 maint: enable more syntax checks
* cfg.mk (local-checks-to-skip): Remove several rule names from this
list, thus enabling the corresponding checks.  To fix some, I made
syntactic changes to source files.  In other cases, I exempted certain
files from the checks.
Add exemptions for these:
  sc_prohibit_atoi_atof = ^(gzip|sample/sub)\.c$$
  sc_space_tab = ^lib/match\.c$$
  sc_useless_cpp_parens = ^(lib/match\.c|tailor\.h)$$
* configure.ac: Add quotes to fix under-quoting.
* deflate.c: Remove unnecessary cpp parentheses.
* tests/Makefile.am (TEST_ENVIRONMENT): Remove space-before-TAB.
* unlzw.c: Change some TABs to spaces.
2014-11-10 08:40:00 -08:00
Jim Meyering
8b5725caaf maint: udpate all copyright notices via "make update-copyright" 2014-06-07 08:54:44 -07:00
Jim Meyering
22bd8cbbdf build: avoid automake warning that suggests use of subdir-objects
* configure.ac (AM_INIT_AUTOMAKE): Use the subdir-objects option.
2013-06-09 15:33:41 -07:00
Jim Meyering
6d08c4dbd3 build: avoid warning about deprecated use of automake's ACLOCAL_AMFLAGS
* Makefile.am (ACLOCAL_AMFLAGS): Don't use this deprecated variable.
* configure.ac: Do this instead: AC_CONFIG_MACRO_DIR([m4]).
2013-06-09 15:28:39 -07:00
Jim Meyering
00c348e658 maint: update all copyright year number ranges
Run "make update-copyright".
2013-01-04 12:05:02 +01:00
Paul Eggert
d897512340 maint: merge build improvements from coreutils
* configure.ac: Invoke gl_ASSERT_NO_GNULIB_POSIXCHECK.
(--enable-gcc-warnings): Change help message.
(gl_GCC_VERSION_IFELSE): New macro.
Do not omit -Wunused-macros for main code.
Adjust other -W options as per coreutils.
* lib/Makefile.am (AM_CFLAGS): Use GNULIB_WARN_CFLAGS, not WARN_CFLAGS.
* unlzw.c (REGISTERS, REG1, REG2, ..., REG16): Remove.
All uses removed.  These provoked -Wunused-macros warnings.
This sort of fiddling with registers hasn't been needed for years.
2012-11-16 13:45:26 -08:00
Eric Blake
aa90739c85 build: default to --enable-gcc-warnings in a git tree
Anyone building from cloned sources can be assumed to have a new
enough environment, such that enabling gcc warnings by default will
be useful.  Tarballs still default to no warnings, and the default
can still be overridden with --disable-gcc-warnings.
* configure.ac (gl_gcc_warnings): Set default based on environment.
2012-10-23 16:15:53 +02:00
Paul Eggert
60b3f4eb67 zgrep: do not assume standard 'grep' has -e
On Solaris 11, /usr/bin/grep -e does not work.
Problem reported by Petr Sumbera in
<http://lists.gnu.org/archive/html/bug-gzip/2012-10/msg00003.html>.
* Makefile.am (.in): Substitute @GREP@.
* configure.ac (AC_PROG_GREP): Invoke.
* zgrep.in (grep): Use @GREP@.
2012-10-20 23:16:05 -07:00
Jim Meyering
6f6a3d1589 maint: update all copyright year number ranges
Run "make update-copyright".
2012-01-01 09:53:58 +01:00
Jim Meyering
337e3ad58a build: accommodate gnulib's new warnings with --enable-gcc-warnings
* configure.ac (WERROR_CFLAGS): Disable two new warnings:
-Wno-format-nonliteral, -Wno-unsuffixed-float-constants.
* gzip.h (bi_reverse): Declare with _GL_ATTRIBUTE_CONST.
(gzip_base_name): Declare with _GL_ATTRIBUTE_PURE.
2011-11-29 18:33:36 +01:00
Jim Meyering
63b2937f0c build: use largefile module and update to latest gnulib
* configure.ac: Remove AC_SYS_LARGEFILE, subsumed by ...
* bootstrap.conf (gnulib_modules): ...this.  Use largefile module.
* gnulib: Update to latest.
2011-08-10 15:50:00 +02:00
Jim Meyering
70b787436a maint: update copyright year ranges to include 2011
Run "make update-copyright", so "make syntax-check" works in 2011.
2011-01-03 22:43:04 +01:00
Jim Meyering
6f8485944f tests: run most tests via tests/Makefile.am
* Makefile.am (SUBDIRS): List tests after ".".
Move most test-related things from here to ...
* tests/Makefile.am: ... here.
* configure.ac (AC_CONFIG_FILES): Add tests/Makefile.
* tests/helin-segv: Adjust.
* tests/help-version: Likewise.
* tests/hufts: Likewise.
* tests/memcpy-abuse: Likewise.
* tests/mixed: Likewise.
* tests/null-suffix-clobber: Likewise.
* tests/stdin: Likewise.
* tests/trailing-nul: Likewise.
* tests/zdiff: Likewise.
* tests/zgrep-f: Likewise.
* tests/zgrep-signal: Likewise.
* tests/znew-k: Likewise.
2010-04-06 18:28:57 +02:00
Jim Meyering
a7eb71b602 maint: let configure-invoked cpp emit diagnostics to config.log
* configure.ac: Do not discard CPP's stderr.
2010-04-06 08:24:41 +02:00
Jim Meyering
61af16213a use assembly code matcher when possible
* configure.ac (ASCPPPOST): Backslash-escape "#" in AC_SUBST'd
variable, to keep make from seeing it as a comment-introducer.
Based on a patch by Petr Pisar.
* lib/Makefile.am (match.$(OBJEXT)): Use AM_V_GEN and AM_V_at.
* lib/match.c: Don't include <config.h>.
It would impede configure-time assembler test.
* .x-sc_require_config_h: Exempt lib/match.c from syntax-check.
* .x-sc_require_config_h_first: Likewise.
2010-04-06 08:24:37 +02:00
Jim Meyering
3ea7fe86ac global: convert indentation-TABs to spaces
Transformed via this shell code:
t=$'\t'
git ls-files \
  | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \
  | grep -vE 'tests/pr/|help2man' \
  | xargs grep -lE "^ *$t" \
  | xargs perl -MText::Tabs -ni -le \
    '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2010-02-03 08:53:02 +01:00
Jim Meyering
00e333a22c maint: update all FSF copyright year lists to include 2010
Use this command:
git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \
env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright
2010-01-01 16:16:21 +01:00
Jim Meyering
957725f33b build: quiet warnings from util.c
* configure.ac (warnings): Add -Wno-overflow and -Wno-type-limits.
2009-12-30 17:33:55 +01:00