Commit Graph

117 Commits

Author SHA1 Message Date
Guillem Jover
04a24db27a Release libbsd 0.12.2 2024-03-18 03:17:06 +01:00
Guillem Jover
435825784f build: Fix typo in ABI selection description 2024-03-13 00:56:59 +01:00
Guillem Jover
31e9396bf2 build: Only install time struct conversion macros where missing
These macros are available in several systems, and we should not install
the man pages for them, otherwise we might end up shadowing the system
man pages if present.
2024-03-13 00:56:07 +01:00
Guillem Jover
9cbd935d92 build: Match also gnu* for GNU/Hurd on the glibc ABI selection
The GNU/Hurd system does not specify a kernel part, so we need to match
on both *-gnu* and gnu* (to avoid overmatching with just *gnu*).
2024-03-06 02:22:04 +01:00
Guillem Jover
70f49a7028 Release libbsd 0.12.1 2024-02-28 04:50:34 +01:00
Guillem Jover
08188f3c13 build: Install err.h if either of the err or errc modules are built
Both modules expose their functions in err.h, so we need to install it
whenever any of them is being built.

Reported-by: Alejandro Colomar <alx@kernel.org>
2024-02-28 04:37:44 +01:00
Guillem Jover
644062da40 Release libbsd 0.12.0 2024-02-27 05:52:53 +01:00
Guillem Jover
32d18dcf47 Add explicit time32 and time64 support
Handle the three potential system scenarios:

 - system time_t is time64
 - system time_t is time32 and supports time64
 - system time_t is time32 and does not support time64

Add the explicit time32 and time64 functions when necessary and map
them accordingly for each of these cases.
2024-02-27 05:47:50 +01:00
Guillem Jover
605614d642 build: Add support for AIX 2024-02-25 04:19:24 +01:00
Guillem Jover
ec7f5ee984 Add vasprintf() and asprintf() functions missing on AIX
These functions are used by code in the library, even though these
functions started as GNU extensions, they are present in all BSDs,
so we expose them as part of our interface on AIX.
2024-02-25 04:18:51 +01:00
Guillem Jover
5392f0c1a4 build: Add support for Solaris 2024-02-25 04:18:01 +01:00
Guillem Jover
be4aced4c5 build: Make almost all exposed interfaces use the new ABI selection
Explicitly select what to include as part of the target ABI, instead of
letting autoconfiguration potentially break ABI if the system grows
functionality provided by the library.

Make almost all the library selectable per target. Do not install manual
pages for interfaces not included in the library. Control inclusion of
symbols in map file via pre-processor macros, and move the comments
describing the ABI selection to configure.ac.

For now the header files are included as is and filtered through
pre-processor conditionals. Eventually they might get switched to be
autogenerated at build time.
2024-02-25 03:50:40 +01:00
Guillem Jover
27503a1066 build: Rework ABI selection logic
Add a new LIBBSD_SELECT_ABI m4 macro, and use it to setup the ABI
interfaces to expose and the various variables and conditionals
to be used by the build system.

Switch to set the initial values to unknown and then set every one
of the selections explicitly by supported target.

Update comments for rationale for things to DROP, or for why some
selections are enabled.
2024-02-25 03:49:15 +01:00
Guillem Jover
99739877be build: Rename ABI selection variables from need_ to abi_
This should make the purpose of these variables more clear.
2024-02-25 03:47:54 +01:00
Guillem Jover
0bdbc0787e build: Revert accidental testing aid change
This was accidentally included in the commit, but should have only been
used during development.

Fixes: commit de124dcafa
Changelog: silent
2024-02-21 02:29:15 +01:00
Guillem Jover
de124dcafa build: Make digest function checks conditional on their use
The digest function checks where unconditionally requiring the functions
to exist or they would error out. But these functions are not required
on all systems, they depend on the ABI to be exposed.
2024-02-21 02:25:24 +01:00
Guillem Jover
1d28729514 build: Move ABI selection at the top of configure.ac
Merge the existing host_os block for the OS detection with the ABI
selection one, as these are related. This way we will be able to make
some of the latter checks conditional on the selected ABI.
2024-02-21 02:25:21 +01:00
Guillem Jover
c8e5338a7c build: Rename LIBBSD_ABI to SOVERSION
This matches the semantics of the variable, and makes it independent of
the project, just as the package variables.
2024-02-21 02:09:48 +01:00
Guillem Jover
b6d6da4cd4 build: Refactor function checks into a new libbsd-funcs.m4 file
These are complex enough to clutter the main configure.ac. Move them
into their own file.
2024-02-21 02:09:48 +01:00
Guillem Jover
9fab225f26 Split errc family of functions from err ones
On most systems the err family of functions is already present, but are
missing the errc family of functions, which are also present on some
other systems. Splitting them into separate files will make it easer to
conditionally include one or the other.
2024-02-18 14:02:32 +01:00
Guillem Jover
10920c3084 build: Make name_from_id man pages conditional instead of id_from_name
The code is only making the name_from_id function conditional, and
assumes id_from_name are always to be included, so we need to match
the logic for the man page inclusion.
2024-02-17 05:00:58 +01:00
Guillem Jover
edddd806df Release libbsd 0.11.8 2024-01-08 02:16:12 +01:00
Guillem Jover
df116b5597 Adjust strlcpy() and strlcat() per glibc adoption
These functions were added in glibc 2.38, in anticipation of POSIX
adopting them too.

Closes: #26
2024-01-07 17:55:40 +01:00
Guillem Jover
f41d6c12aa build: Refactor GNU .init_array support check into a new m4 function 2023-09-05 03:02:12 +02:00
Guillem Jover
30b48ed9ea build: Refactor linker script detection into a new m4 function 2023-07-29 20:11:53 +02:00
Guillem Jover
5434ba169b build: Conditionalize wcslcpy() and wcslcat() functions on macOS
These functions are provided by the system libc.
2023-04-29 03:52:49 +02:00
Guillem Jover
dc1bd1a2cb build: Conditionalize only id-from-name functions not the entire pwcache
On macOS the name-from-id functions are present, but not the
id-from-name ones, so we want to provide those instead of suppressing
the entire file.
2023-04-29 03:52:42 +02:00
Guillem Jover
edc746ea7b build: Conditionalize getprogname()/setprogname on macOS
These functions are provided by the system libc, so there is no need for
us to provide them.
2023-04-22 22:47:33 +02:00
Guillem Jover
8f998d1d20 progname: Include <procinfo.h> if available
We need this header on AIX. Missed transplanting the code from the AIX
porting system.

Fixes: commit 9fa06763a1
2023-04-22 22:42:30 +02:00
Guillem Jover
d08163b4fe build: Check whether we need libperfstat on AIX
The getentropy() implementation makes use of this library on AIX.
2023-04-22 19:30:15 +02:00
Guillem Jover
1186cf8822 build: Annotate droppable functions for musl on next SOVERSION bump
These are already provided by the musl libc, and can thus be dropped on
the next SOVERSION bump.
2023-04-22 19:30:15 +02:00
Guillem Jover
6385ccc977 build: Conditionalize bsd_getopt() on macOS
The system library provides a getopt() with BSD semantics.
2023-04-22 19:30:05 +02:00
Guillem Jover
21d12b0211 build: On macOS do not build functions provided by the system
We have never built before on macOS, so we can exclude all the functions
that are currently provided in the system.

Closes: #1
Closes: !3
2023-04-17 04:12:42 +02:00
Guillem Jover
bc65806ce2 build: Select whether to include funopen() in the build system
This makes sure we include it when expected, alongside the man pages,
and the test cases, and do not accidentally break the ABI if the system
starts providing such interface.
2023-04-17 04:12:42 +02:00
Guillem Jover
8b7a4d9d3b build: Move Windows OS detection to the OS features section
This was placed here to make use of the same AS_CASE, but it does not
really fit with the section. Move it to the more appropriate place, and
detangle the AS_CASE.
2023-04-17 04:12:42 +02:00
Guillem Jover
ccbfd1c241 build: Remove __MUSL__ definition from configure
We stopped relying on this macro when we turned the funopen() cpp error
into a warning in commit e50896286c.
2023-04-17 04:12:42 +02:00
Guillem Jover
a5faf17090 Only use <stdio_ext.h> if present 2023-04-17 04:12:42 +02:00
Guillem Jover
44824aca3c Declare environ if the system does not do so
The environ variable is supposed to be defined by the code using it, but
on glibc-based systems it will get defined if we request it, by including
<unistd.h> and defining _GNU_SOURCE.
2023-04-17 04:12:42 +02:00
Guillem Jover
1fb6c3f4ce Use lockf() when flock() is not available
On Solaris flock() is not available, and we should use instead lockf()
or fcntl().
2023-04-17 04:12:42 +02:00
Guillem Jover
fe16f3863e test: Use open_memstream() only if available
On Solaris this function is not yet available.
2023-04-17 04:12:42 +02:00
Guillem Jover
257800a03c build: Add support for sanitizer compiler flags 2023-03-29 02:48:20 +02:00
Guillem Jover
dec783dce5 build: Fix version script linker support detection
When the linker uses --no-undefined-version either specified by the user
or as the default behavior (such as with newer clang >= 16 releases),
a missing symbol definition will cause a linker error if that symbol is
listed in the version script.
2023-02-13 00:42:02 +01:00
Florian Weimer
5dea9da38d build: Improve C99 compatibility of __progname configure check
The check uses printf, so it needs to include <stdio.h> for
compilers which do not support implicit function declarations.
(They were removed from C99.)

Closes: !23
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2022-12-13 03:49:29 +01:00
Guillem Jover
b9bf42ddc3 build: Enable -Wall for automake
This will make sure to warn about bogus or deprecated constructs.
2022-12-13 03:49:03 +01:00
Guillem Jover
e57c07875c build: Add missing AM_PROG_AR macro call to configure.ac
Warned-by: autoreconf
2022-12-13 03:48:51 +01:00
Guillem Jover
80f1927dcd build: Fix configure.ac indentation
Use the same style as the newly added code, which should make the code
more readable, and produce more conforming C output.
2022-12-13 03:48:31 +01:00
Guillem Jover
b7a8bc22c9 build: Require automake 1.11
This is a rather old release (from 2009), that provides AM_SILENT_RULES.
2022-12-13 03:10:28 +01:00
Guillem Jover
e50896286c build: Do not require funopen() to be ported
This function cannot be easily and (more importantly) correctly ported
without cooperation from the libc stdio layer. We already document that
users should be prepared to have the function not available on some
platforms and that they should ideally switch their code to other
more portable and better interfaces.

Instead of making the build fail, and requiring porters to add
exceptions for something that most probably cannot be ported correctly
anyway, simply print a warning and let it build. This will not be a
regression because on those systems libbsd would have never been built
before.

Prompted-by: Jens Finkhaeuser <jens@finkhaeuser.de>
2022-11-24 23:23:33 +01:00
Guillem Jover
5cfa39e5cd build: Use «yes» instead of «true» for AC_CHECK_FUNCS cache value
This autoconf macro sets the ac_cv_func_ cached variable to «yes» not
«true» so we were checking for an impossible condition.
2022-11-23 23:42:49 +01:00
Guillem Jover
084911ce87 Release libbsd 0.11.7 2022-10-06 04:07:52 +02:00