Commit Graph

53 Commits

Author SHA1 Message Date
Lasse Collin e99bff3ffb Add SPDX license identifiers to GPL, LGPL, and FSFULLR files. 2024-02-14 18:31:16 +02:00
Lasse Collin 22af94128b Add SPDX license identifier into 0BSD source code files. 2024-02-14 18:31:16 +02:00
Lasse Collin 689e0228ba Change most public domain parts to 0BSD.
Translations and doc/xz-file-format.txt and doc/lzma-file-format.txt
were not touched.

COPYING.0BSD was added.
2024-02-14 18:31:12 +02:00
Lasse Collin 2e2cd11535 Simplify detection of Capsicum support.
This removes support for FreeBSD 10.0 and 10.1 which used
<sys/capability.h> instead of <sys/capsicum.h>. Support for
FreeBSD 10.1 ended on 2016-12-31. So now FreeBSD >= 10.2 is
required to enable Capsicum support.

This also removes support for Capsicum on Linux (libcaprights)
which seems to have been unmaintained since 2017 and Linux 4.11:
https://github.com/google/capsicum-linux
2023-10-22 19:03:52 +03:00
Lasse Collin 2f81ac852b Build: Enabled unaligned access by default on PowerPC64LE and some RISC-V.
PowerPC64LE wasn't tested but it seems like a safe change.
POWER8 supports unaligned access in little endian mode. Testing
on godbolt.org shows that GCC uses unaligned access by default.

The RISC-V macro __riscv_misaligned_fast is very new and not
in any stable compiler release yet.

Documentation in INSTALL was updated to match.

Documentation about an autodetection bug when using ARM64 GCC
with -mstrict-align was added to INSTALL.

CMake files weren't updated yet.
2023-10-18 19:02:45 +03:00
Jia Tan f74f174006 Build: Update visibility.m4 from Gnulib.
Updating from version 6 -> 8 from upstream. Declarations for variables
and function bodies were added to avoid unnecessary failures with
-Werror.
2023-10-12 20:12:18 +08:00
Jia Tan be012b8097 Build: Change quoting style from `...' to '...'. 2023-09-24 22:09:16 +08:00
Jia Tan a6234f677d Build: Update getopt.m4 from Gnulib.
This file was modified from upstream since we do not need to replace
getopt() and can avoid complexity and feature tests.
2023-09-24 20:48:52 +08:00
Lasse Collin 0cc3313bd4 Build: Update comments about unaligned access to mention 64-bit. 2023-03-17 08:41:36 +02:00
Lasse Collin 73c9e6d6b9 Build: Fix config.h comments. 2023-01-02 17:05:07 +02:00
Jia Tan bb740e3b11
Build: Only define HAVE_PROGRAM_INVOCATION_NAME if it is set to 1.
HAVE_DECL_PROGRAM_INVOCATION_NAME is renamed to
HAVE_PROGRAM_INVOCATION_NAME. Previously,
HAVE_DECL_PROGRAM_INVOCATION_NAME was always set when
building with autotools. CMake would only set this when it was 1, and the
dos/config.h did not define it. The new macro definition is consistent
across build systems.
2023-01-02 22:33:48 +08:00
Lasse Collin 04f299b64e Build: Update m4/ax_pthread.m4 from Autoconf Archive. 2022-10-25 23:31:44 +03:00
Lasse Collin 2611c4d905 tuklib_cpucores: Use HW_NCPUONLINE on OpenBSD.
On OpenBSD the number of cores online is often less
than what HW_NCPU would return because OpenBSD disables
simultaneous multi-threading (SMT) by default.

Thanks to Christian Weisgerber.
2022-10-20 20:22:50 +03:00
Lasse Collin fae37ad2af tuklib_integer: Add 64-bit endianness-converting reads and writes.
Also update the comment in liblzma's memcmplen.h.

Thanks to Michał Górny for the original patch for the reads.
2022-10-05 14:26:00 +03:00
Lasse Collin a3148c0446 Build: Update m4/ax_pthread.m4 from Autoconf Archive (again). 2020-03-15 15:26:20 +02:00
Lasse Collin 21bd4701fc Update m4/.gitignore. 2020-02-24 23:37:07 +02:00
Lasse Collin e094d1d0f1 tuklib: Omit an unneeded <sys/types.h> from a tests.
tuklib_cpucores.c and tuklib_physmem.c don't include <sys/types.h>
even via other files in this package, so clearly that header isn't
needed in the tests either (no one has reported build problems due
to a missing header in a .c file).
2020-02-24 23:34:58 +02:00
Lasse Collin 59e6eb4840 Build: Add visibility.m4 from gnulib.
Appears that this file used to get included as a side effect of
gettext. After the change to gettext version requirements this file
no longer got copied to the package and so the build was broken.
2020-02-21 17:01:15 +02:00
Lasse Collin 524c2f12c7 tuklib_integer.m4: Optimize the check order.
The __builtin byteswapping is the preferred one so check for it first.
2020-02-21 01:24:18 +02:00
Lasse Collin 07208de92f Update m4/.gitignore. 2020-02-05 22:28:51 +02:00
Lasse Collin 6629ed929c Build: Update m4/ax_pthread.m4 from Autoconf Archive. 2020-02-03 22:03:50 +02:00
Lasse Collin 77bc5bc6dd Revise tuklib_integer.h and .m4.
Add a configure option --enable-unsafe-type-punning to get the
old non-conforming memory access methods. It can be useful with
old compilers or in some other less typical situations but
shouldn't normally be used.

Omit the packed struct trick for unaligned access. While it's
best in some cases, this is simpler. If the memcpy trick doesn't
work, one can request unsafe type punning from configure.

Because CRC32/CRC64 code needs fast aligned reads, if no very
safe way to do it is found, type punning is used as a fallback.
This sucks but since it currently works in practice, it seems to
be the least bad option. It's never needed with GCC >= 4.7 or
Clang >= 3.6 since these support __builtin_assume_aligned and
thus fast aligned access can be done with the memcpy trick.

Other things:
  - Support GCC/Clang __builtin_bswapXX
  - Cleaner bswap fallback macros
  - Minor cleanups
2019-12-31 00:18:24 +02:00
Lasse Collin e5f13a6656 tuklib_integer: Autodetect support for unaligned access on ARM.
The result is used as the default for --enable-unaligned-access.
The test should work with GCC and Clang.
2019-06-01 18:46:54 +03:00
Lasse Collin df8f446e3a tuklib_cpucores: Add support for sched_getaffinity().
It's available in glibc (GNU/Linux, GNU/kFreeBSD). It's better
than sysconf(_SC_NPROCESSORS_ONLN) because sched_getaffinity()
gives the number of cores available to the process instead of
the total number of cores online.

As a side effect, this commit fixes a bug on GNU/kFreeBSD where
configure would detect the FreeBSD-specific cpuset_getaffinity()
but it wouldn't actually work because on GNU/kFreeBSD it requires
using -lfreebsd-glue when linking. Now the glibc-specific function
will be used instead.

Thanks to Sebastian Andrzej Siewior for the original patch
and testing.
2016-10-24 18:51:36 +03:00
Lasse Collin 29a087fb5a Fix bugs and otherwise improve ax_check_capsicum.m4.
AU_ALIAS was removed because the new version is incompatible
with the old version.

It no longer checks for <sys/capability.h> separately.
It's enough to test for it as part of AC_CHECK_DECL.
The defines HAVE_CAPSICUM_SYS_CAPSICUM_H and
HAVE_CAPSICUM_SYS_CAPABILITY_H were removed as unneeded.
HAVE_SYS_CAPSICUM_H from AC_CHECK_HEADERS is enough.

It no longer does a useless search for the Capsicum library
if the header wasn't found.

Fixed a bug in ACTION-IF-FOUND (the first argument). Specifying
the argument omitted the default action but the given action
wasn't used instead.

AC_DEFINE([HAVE_CAPSICUM]) is now always called when Capsicum
support is found. Previously it was part of the default
ACTION-IF-FOUND which a custom action would override. Now
the default action only prepends ${CAPSICUM_LIB} to LIBS.

The documentation was updated.

Since there as no serial number, "#serial 2" was added.
2015-03-31 21:12:30 +03:00
Lasse Collin 6e845c6a3e Add m4/ax_check_capsicum.m4 for detecting Capsicum support.
The file was loaded from this web page:
https://github.com/google/capsicum-test/blob/dev/autoconf/m4/ax_check_capsicum.m4

Thanks to Loganaden Velvindron for pointing it out for me.
2015-03-31 19:20:24 +03:00
Lasse Collin 25263fd9e7 Fix the detection of installed RAM on QNX.
The earlier version compiled but didn't actually work
since sysconf(_SC_PHYS_PAGES) always fails (or so I was told).

Thanks to Ole André Vadla Ravnås for the patch and testing.
2015-03-29 22:13:48 +03:00
Lasse Collin 4c544d2410 Fix CPU core count detection on QNX.
It tried to use sysctl() on QNX but
  - it broke the build because sysctl() needs -lsocket on QNX;
  - sysctl() doesn't work for detecting the core count on QNX
    even if it compiled.

sysconf() works. An alternative would have been to use
QNX-specific SYSPAGE_ENTRY(num_cpu) from <sys/syspage.h>.

Thanks to Ole André Vadla Ravnås.
2015-03-27 22:39:07 +02:00
Lasse Collin d935b0cdf3 tuklib_cpucores: Use cpuset_getaffinity() on FreeBSD if available.
In FreeBSD, cpuset_getaffinity() is the preferred way to get
the number of available cores.

Thanks to Rui Paulo for the patch. I edited it slightly, but
hopefully I didn't break anything.
2015-02-10 15:28:30 +02:00
Lasse Collin 107a263d5b Build: Update m4/ax_pthread.m4 from Autoconf Archive. 2014-11-17 19:11:49 +02:00
Lasse Collin b13a781833 Build: Replace obsolete AC_HELP_STRING with AS_HELP_STRING. 2014-11-17 18:52:21 +02:00
Lasse Collin 4e4ae08bc7 Update .gitignore files. 2014-10-29 21:28:25 +02:00
Lasse Collin 076258cc45 Add support for AmigaOS/AROS to tuklib_physmem().
Thanks to Fredrik Wikstrom.
2014-10-09 19:41:51 +03:00
Lasse Collin 124eb69c78 Windows: Add Windows support to tuklib_cpucores().
It is used for Cygwin too. I'm not sure if that is
a good or bad idea.

Thanks to Vincent Torri.
2013-08-03 13:52:58 +03:00
Lasse Collin ab25b82a91 Build: Upgrade m4/acx_pthread.m4 to the latest version. 2012-05-24 18:33:54 +03:00
Lasse Collin db33117cc8 Build: Upgrade m4/acx_pthread.m4 to the latest version.
It was renamed to ax_pthread.m4 in Autoconf Archive.
2011-04-05 17:12:20 +03:00
Lasse Collin bb0b1004f8 xz: Multiple fixes.
The code assumed that printing numbers with thousand separators
and decimal points would always produce only US-ASCII characters.
This was used for buffer sizes (with snprintf(), no overflows)
and aligning columns of the progress indicator and --list. That
assumption was wrong (e.g. LC_ALL=fi_FI.UTF-8 with glibc), so
multibyte character support was added in this commit. The old
way is used if the operating system doesn't have enough multibyte
support (e.g. lacks wcwidth()).

The sizes of buffers were increased to accomodate multibyte
characters. I don't know how big they should be exactly, but
they aren't used for anything critical, so it's not too bad.
If they still aren't big enough, I hopefully get a bug report.
snprintf() takes care of avoiding buffer overflows.

Some static buffers were replaced with buffers allocated on
stack. double_to_str() was removed. uint64_to_str() and
uint64_to_nicestr() now share the static buffer and test
for thousand separator support.

Integrity check names "None" and "Unknown-N" (2 <= N <= 15)
were marked to be translated. I had forgot these, plus they
wouldn't have worked correctly anyway before this commit,
because printing tables with multibyte strings didn't work.

Thanks to Marek Černocký for reporting the bug about
misaligned table columns in --list output.
2010-09-10 10:30:33 +03:00
Lasse Collin 6548e30465 Updates to tuklib_physmem and tuklib_cpucores.
Don't use #error to generate compile error, because some
compilers actually don't take it as an error. This fixes
tuklib_physmem on IRIX.

Fix incorrect error check for sysconf() return values.

Add AIX, HP-UX, and Tru64 specific code to detect the
amount RAM.

Add HP-UX specific code to detect the number of CPU cores.

Thanks a lot to Peter O'Gorman for initial patches,
testing, and debugging these fixes.
2010-05-10 19:54:15 +03:00
Lasse Collin 153c7740c5 Add IRIX-specific code to tuklib_physmem and tuklib_cpucores.
This is untested but it will get tested soon and, if needed,
fixed before 5.0.0.

Thanks to Stuart Shelton.
2010-01-12 16:18:14 +02:00
Lasse Collin c74c132f7f Update tuklib_cpucores.m4 and tuklib_physmem.m4 from tuklib,
which now use AC_CACHE_CHECK. Using the cache variable,
configure now warns if there is no method to detect the amount
of RAM and recommends using --enable-assume-ram.
2009-11-20 12:51:19 +02:00
Lasse Collin ebfb2c5e1f Use a tuklib module for integer handling.
This replaces bswap.h and integer.h.

The tuklib module uses <byteswap.h> on GNU,
<sys/endian.h> on *BSDs and <sys/byteorder.h>
on Solaris, which may contain optimized code
like inline assembly.
2009-10-04 22:57:12 +03:00
Lasse Collin e599bba421 Various changes.
Separate a few reusable components from XZ Utils specific
code. The reusable code is now in "tuklib" modules. A few
more could be separated still, e.g. bswap.h.

Fix some bugs in lzmainfo.

Fix physmem and cpucores code on OS/2. Thanks to Elbert Pol
for help.

Add OpenVMS support into physmem. Add a few #ifdefs to ease
building XZ Utils on OpenVMS. Thanks to Jouk Jansen for the
original patch.
2009-09-19 09:47:30 +03:00
Lasse Collin 27414daadf Fix sysctl() usage.
This fixes build on *BSDs and Darwin.

Thanks to Jukka Salmi for the patches.
Richard Koch reported the problem too.
2009-08-29 13:39:21 +03:00
Lasse Collin 96e4b257e1 Major update to the xzgrep and other scripts based on
the latest versions found from gzip CVS repository.

configure will try to find a POSIX shell to be used by
the scripts. This should ease portability on systems
which have pre-POSIX /bin/sh.

xzgrep and xzdiff support .xz, .lzma, .gz, and .bz2 files.
xzmore and xzless support only .xz and .lzma files.

The name of the xz executable used in these scripts is
now correct even if --program-transform-name has been used.
2009-07-05 22:25:17 +03:00
Lasse Collin 390e69887f Fix wrong macro names in lc_cpucores.m4 and cpucores.h.
Thanks to Bert Wesarg.
2009-03-18 16:51:41 +02:00
Lasse Collin 0df9299e24 Test for Linux-specific sysinfo() only on Linux systems.
Some other systems have sysinfo() with different semantics.
2009-03-01 09:03:08 +02:00
Lasse Collin 63df14c57d Fix the Autoconf test for getopt_long replacement.
It was broken by e114502b2b.
2009-03-01 08:58:41 +02:00
Lasse Collin 3084d662d2 Cleanups to the code that detects the amount of RAM and
the number of CPU cores. Added support for using sysinfo()
on Linux systems whose libc lacks appropriate sysconf()
support (at least dietlibc). The Autoconf macros were
split into separate files, and CPU core count detection
was moved from hardware.c to cpucores.h. The core count
isn't used for anything real for now, so a problematic
part in process.c was commented out.
2009-02-14 00:45:29 +02:00
Mike Frysinger 3f86532407 add gitignore files
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-02-07 20:26:09 +02:00
Lasse Collin e114502b2b Oh well, big messy commit again. Some highlights:
- Updated to the latest, probably final file format version.
  - Command line tool reworked to not use threads anymore.
    Threading will probably go into liblzma anyway.
  - Memory usage limit is now about 30 % for uncompression
    and about 90 % for compression.
  - Progress indicator with --verbose
  - Simplified --help and full --long-help
  - Upgraded to the last LGPLv2.1+ getopt_long from gnulib.
  - Some bug fixes
2008-11-19 20:46:52 +02:00