Both the Autoconf and CMake build systems are updated to detect linker support for symbol versioning.
Currently, Linux, Solaris, and FreeBSD are tested and working. Windows (COFF) and macOS (Mach-O) have no symbol versioning.
There is an Autoconf/CMake flag to opt out of the versioning behaviour.
Fixes to enable the code to build with a simple `CC=xlc ./configure --enable-ebcdic --disable-unicode`.
Fixes to the tests, so that `make check` passes on EBCDIC platforms.
Add a CI job to do z/OS testing.
The pcre2test utility needs quite a few changes to accommodate this.
It is simpler to add a new mode to it, than to make it fully
EBCDIC-native. On an ASCII system, pcre2test performs ASCII I/O, but
tranlates the input when passing it to the fully-EBCDIC-supporting
library.
* autotools: retire conditional for debug build
likely added by mistake, the functionality works through `--enable-debug`
instead.
* maint: allow selecting compiler for ManyConfigTests
Instead of hardcoding the compiler as `cc`, let a CC environment
variable dictate which compiler to use.
For example, in macOS/arm64 where the GNU compiler is provided by
brew the following will allow using it instead of the system compiler
(which ALSO answers to `gcc` even though is `clang`)
% CC=gcc-13 maint/ManyConfigTests
Part of #651
* Use much stricter windows warnings (`/W3` rather than `/W1`). This requires quite a few fixes for all the sloppy places where we do implicit assignment of 64-bit values to 32-bit storage.
* Use and test CMake build & install on FreeBSD and Solaris
* Add 64 bit Solaris build (`cc -m64`) and fix existing Solaris warnings
* Make compile flags used in CI consistent across platforms. Previously Mac & Linux were building with different warning flags.
* Add `--enable-Werror` to `configure.ac`. This means that you can build with `-Werror` in a clean way. Previously, you had to hackily override the CPPFLAGS when calling `make` since you can't pass `-Werror` as a CFLAG into `./configure` (it messes with compiler feature detection).
I believe this is the correct procedure, based on Philip's documentation.
The libpcre2-posix interface is completely unchanged, but the source code has been updated.
The libpcre2-NN interface has been extended in backwards-compatible ways, with new enum values and API functions, so callers compiled and linked against the old version may use the newer as a drop-in replacement, but callers compiled against the 10.45 headers will fail when used against the old version (if they require any newly-added functions).
* Add details on new maintainership
* Remove checked-in autoconf outputs
* Sync & cleanup files with Detrail
* Add CI job for ensuring PrepareRelease is run
* Add Ubuntu-20.04 autoconf runner
* Make CMake installed files match autoconf
* Update acknowledgements
__builting_unreachable() implementation is not defined and has
been known to not trigger failures under some compilers.
Default instead to using assert(), which has the added benefit
of printing a descriptive message and it is also likely more
portable as it is part of ANSI C.
While at it, really allow configuring builtins with cmake.
Move them out from the public API header and improve detection
by making sure the code used wouldn't trigger false positives.
While at it, migrate two more opem coded assertions and avoid
use of -Werror on AIX with xlc as well as clear a warning
triggered in Windows since the original commit.
Assume that a compatible `-fvisibility=hidden` option is available
and that the compiler handles correctly `#warning` macros.
Restrict the visibility test if `-Werror` is unrealiable to protect
for compilers like xlc or systems like cygwin that might allow the
compiler flag without errors but wouldn't work.
While at it, lower the minimum autoconf required to the one that
introduced the latest macros and tested in OpenBSD 7.5 with automake
1.9.
When using a DLL in Windows, the function declarations (and definitions)
that are public are decorated with attributes but those declarations would
conflict with the ones that are selected when the compiler supports the
visibility feature.
Define instead a new macro that would be added to the corresponding
macros independently and while at it allow setting visibility with cmake.
Use <stddef.h> as a source for size_t as suggested by ANSI in preference
to <sys/types.h> (as suggested by POSIX), and make sure that the check
includes linkin so it won't result in a false positive in platforms that
allow link time resolution of unknown objects (ex: AIX with lxc)
Compilers had become far more creative about optimizing code that
might be considered undefined behaviour, so improve our integer
overflow checking to prevent any possible miscompilations.
While at it, expand the use of the checks to pcre2test to fix a
similar problem to the one that was tackled in pcre2_compile.
Prefer (if available) a builtin provided by the compiler.
Recent code uses C99 syntax (as reported in #163, and therefore it
will fail to build unless C99 (or higher) support is required by the
compiler (gcc >= 5 does it by default).
For those unfortunate to need an older compiler that does require a
flag to enable that, make sure that both autoconf and cmake make it
explicit.
While testing the change with the ancient autoconf version listed as
a prerequisite, noticed that the LT_INIT syntax introduced with 91485e5
(Update configure.ac for latest version of autoconf., 2021-02-02), was
not supported, so update the autoconf minimum as well.
At least in OpenBSD, there is a libedit library in base, but without
public headers. Public headers for readline are available but since
15db5d36 (pcre2test: avoid using readline headers with libedit,
2022-04-07) won't be picked up automatically.
Allow pointing cmake to those headers by doing (for example):
$ cmake -DEDITLINE_INCLUDE_DIR=/usr/include/readline
Or using custom CPPFLAGS with configure (for example):
$ CPPFLAGS=-I/usr/include/readline ./configure --enable-pcre2test-libedit
Since the headers from readline.h would be otherwise incomplete, detect
that case and pull the extra headers that are required automagically and
while at it, cleanup the NCURSES dependency that was unnecessarily copied
from readline.
* pcre2test: use the right header for libedit in FreeBSD with autoconf
When `./configure --enable-pcre2test-libedit` is used in FreeBSD,
the resulting test will succeed but won't set the necessary flag
to distinguish between libedit and readline header files, therefore
using readline's at built time (if installed)
Consolidate all header tests into one and use instead the corresponding
autogenerated defines to check for each possibility.
* pcre2test: really allow libedit with cmake
Using cmake to configure and enable linking pcre2test with libedit,
could result in a broken build, because the header used was instead
pointing to readline.
In cases were the build will succeed (because both libraries were
available), it would likely show warnings, because several history
functions were being used without declarations, since readline
requires including "history.h" for those.
Additionally, since PCRE2_SUPPORT_READLINE is ON by default (unlike
configure), turning PCRE2_SUPPORT_LIBEDIT=ON, would require setting
that other option to OFF explicitly (even if readline wasn't available)
or the setup would abort.
Lastly, in systems with no default sysroot (ex: macOS), the use of
absolute paths for searching for libedit's readline.h could fail so
use instead relative PATH_SUFFIXES.
* pcre2test: avoid using readline headers with libedit
When asked to enable libedit in a system that ALSO has readline,
the headers of the former would be found and used by the earlier.
While that would mostly work, some functions will be missing
definitions (which is forbidden in C99), so instead abort the
configuration and let the user provide for them.
Since d5a61ee8 (Patch to detect (and ignore) symlink loops in
pcre2grep., 2021-08-28), there is optional code that depends
on readlink and PATH_MAX but that had only detection added for
the first.
GNU Hurd doesn't have the later so it fails to build.
Improve the detection to include both dependencies in autotools
and cmake to fix that.
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>