Commit Graph

56 Commits

Author SHA1 Message Date
Guillem Jover
a4e0db2b97 build: Use a single variable to track libraries to link against
Using various variables means we have to keep these in sync in various
places. Just use a single variable that we can use anywhere where this
is needed.
2021-02-09 06:23:38 +01:00
Guillem Jover
43d34c9d3b build: Fix message digest library checks
They were not failing when not finding the SHA-2 functions and
were hardcoding -lmd regardless of what library had been found.
2021-02-09 06:23:38 +01:00
Guillem Jover
edea268ce9 Release libbsd 0.11.2 2021-02-08 04:02:46 +01:00
Guillem Jover
a4de4d95a6 Release libbsd 0.11.1 2021-02-07 02:03:59 +01:00
Guillem Jover
2462cd8888 Release libbsd 0.11.0 2021-02-07 01:28:27 +01:00
Guillem Jover
847e682f8d Use libmd hashing function implementations instead of embedding our own
This splits the implementation responsibilities, and reduces embedded
code copies, which was one of the driving points with this project to
start with, so it's nice to give a good example.
2021-02-07 01:28:27 +01:00
Guillem Jover
37a9b56c05 Import pwcache module from OpenBSD 2021-02-07 01:28:27 +01:00
Guillem Jover
3d6b6ead64 build: Detect support for --version-script in ld 2020-12-21 17:43:11 +01:00
Guillem Jover
a11c98a6b5 Release libbsd 0.10.0 2019-08-08 17:07:25 +02:00
Aaron Dierking
4bed48398f build: Detect Windows/MinGW at configure time
Extend the host OS checks to define an OS_WINDOWS automake conditional if
the host is MinGW-like. This will be useful for future Windows-specific
build tweaks.

[guillem@hadrons.org:
 - Rename WINDOWS conditional to OS_WINDOWS. ]

Signed-off-by: Guillem Jover <guillem@hadrons.org>
2019-08-08 03:22:09 +02:00
Guillem Jover
b0ebb0d4c2 build: Use __register_atfork() only if really available
This is a glibc-specific symbol that has no public declaration. But is
being used by the OpenBSD and this implementation as a hack to avoid
having to link against the pthread library. This interface is at least
included in LSB 5.0 [L], and using pthread_atfork() is otherwise
problematic anyway [P].

 [L] <https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib---register-atfork.html>
 [P] <http://austingroupbugs.net/view.php?id=851>

One problem is that we were using it whenever __GLIBC__ is defined,
which is supposed to be defined only on an actual glibc, but uClibc
defines that macro, but it does not provide the symbol on its noMMU
variant.

We add a new configure check that will try to link a program that uses
that symbol to make sure it is present.

Closes: !2
Reported-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-08-08 03:21:49 +02:00
Guillem Jover
73aea4f808 build: Fix check for clock_gettime() within librt
The check was always setting the libraries to link to include -lrt,
as the success case includes the builtin one. Handle the various
values.
2019-08-07 00:03:25 +02:00
Guillem Jover
574c7a1365 Protect C language extensions with two leading and trailing underscores
This should make their usage safer against user macros.
2018-06-18 04:31:00 +02:00
Aaron Dierking
0500a1bd08 Don't require <grp.h>
This is only used in the overlay test and Windows does not provide it.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
2018-06-18 04:31:00 +02:00
Guillem Jover
1ca09c18f7 Release libbsd 0.9.1 2018-05-22 16:07:42 +02:00
Guillem Jover
e007233cf0 Release libbsd 0.9.0 2018-05-21 04:48:32 +02:00
Guillem Jover
0b61c5ffed Release libbsd 0.8.7 2018-01-13 16:20:35 +01:00
Guillem Jover
bbf90ac3cd Release libbsd 0.8.6 2017-07-17 01:01:13 +02:00
Guillem Jover
415e3cb266 Release libbsd 0.8.5 2017-06-24 16:10:14 +02:00
Guillem Jover
8bff4b1fab Release libbsd 0.8.4 2017-06-19 03:17:21 +02:00
Guillem Jover
c8a1b08b74 build: Match any glibc and musl ABIs on the host_os AS_CASE
Reported-by: Helmut Grohne <helmut@subdivi.de>
2017-06-09 05:47:07 +02:00
Guillem Jover
4fec871c79 build: Quote the arguments to AC_CONDITIONAL 2017-06-09 05:47:07 +02:00
Guillem Jover
3945693ebe build: Move AC_TYPE_UID_T close to the other AC_TYPE_* checks 2017-06-09 05:47:07 +02:00
Guillem Jover
c253365d65 build: Move configure.ac comment into actual AC_CASE 2017-06-09 05:47:06 +02:00
Guillem Jover
8248e5f7a6 build: Use src/strlcpy.c in AC_CONFIG_SRCDIR
The src/fgetln.c file contains a function considered obsolete, use one
that is not.
2017-06-09 05:46:34 +02:00
Guillem Jover
d6c35f618c Do not provide funopen() on musl
Fixes: https://bugs.debian.org/818246
2017-06-05 05:52:07 +02:00
Guillem Jover
368af99f55 Fix the __progname check to avoid the optimizer discarding the symbol
Because we were assigning to another unused variable, when building the
check with optimizations enabled, which is the default when using gcc
as the compiler, the variable was being discarded. Instead pass it to
printf() so that it cannot do so.
2017-06-05 05:52:07 +02:00
Guillem Jover
9bed430ee3 Release libbsd 0.8.3 2016-04-23 10:13:23 +02:00
Guillem Jover
b7ce33cf51 build: Support clock_gettime() provided in librt
In older glibc versions (< 2.17) clock_gettime() is in librt. Add a
check for this to avoid build breakage for programs/libraries that
use libbsd on such systems.

Based-on-patch-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2016-02-13 08:46:47 +01:00
Guillem Jover
2fb148a290 Release libbsd 0.8.2 2016-01-27 15:25:23 +01:00
Guillem Jover
229f85794f Release libbsd 0.8.1 2015-12-14 03:39:48 +01:00
Guillem Jover
2b030da016 Release libbsd 0.8.0 2015-11-30 23:48:50 +01:00
Guillem Jover
874a0e51d3 Update arc4random module from OpenBSD and LibreSSL
Rework arc4random_stir() and arc4random_addrandom() code over the new
internal API, and documentation in the man page. Adapt the code to the
local build system.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85827
2015-11-30 23:48:50 +01:00
Guillem Jover
9a9a8b2dba Add private getentropy module from OpenBSD and LibreSSL
Adapt the code to the local build system.
2015-11-30 23:48:50 +01:00
Guillem Jover
58bef83f41 test: Add unit test for arc4random() 2015-11-30 23:02:23 +01:00
Guillem Jover
3881c4fc68 Update closefrom() function
Import from sudo. Adapt the build system to detect the required features.
2015-09-23 07:59:34 +02:00
Guillem Jover
e390651b64 Release libbsd 0.7.0 2014-07-29 03:19:15 +02:00
Guillem Jover
e8d3d04177 build: Remove hard requirement for GNU .init_array section support
In case the support is not available, just stop building the
libbsd-ctor.a library, which is a nice to have thing, but should not
have been a hard requirement from the start. This should allow to
build libbsd on non-glibc based systems using another libc.
2014-07-20 02:09:20 +02:00
Guillem Jover
f41fdcf186 Add funopen() function
This is a wrapper over the glibc fopencookie() function.

We diverge from the FreeBSD, OpenBSD and DragonFlyBSD declarations,
because seekfn() there wrongly uses fpos_t, assuming it's an integral
type, and any code using that on a system where fpos_t is a struct
(such as GNU-based systems or NetBSD) will fail to build. In which case,
as the code has to be modified anyway, we might just as well use the
correct declaration.
2013-10-21 05:35:44 +02:00
Guillem Jover
ee04e8de14 build: Set subdir-objects automake option
Bump automake minimal version to 1.9.
2013-10-21 05:33:08 +02:00
Guillem Jover
119417462e Release libbsd 0.6.0 2013-07-14 13:34:07 +02:00
Guillem Jover
c5b9590287 Move setproctitle() automatic initialization to its own library
The automatic initialization cannot be part of the main shared library,
because there is no thread-safe way to change the environ global
variable. This is not a problem if the initializaion happens just at
program load time, but becomes one if the shared library is directly or
indirectly dlopen()ed during the execution of the program, which could
have either kept references to the old environ or could change it in
some other thread. This has been observed for example on systems using
Samba NSS modules.

To avoid any other possible fallout, the constructor is split into a
new static library that needs to be linked explicitly into programs
using setproctitle(). As an additional safety measure the pkg-config
linker flags will mark the program as not allowing to be dlopen()ed
so that we avoid the problem described above.

Reported-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=66679
2013-07-14 13:32:11 +02:00
Guillem Jover
3077d2fffc build: Move version ABI from Makefile to configure.ac
It's easier to find there, and the value can be reused in case we have
to provide another shared library.
2013-07-14 10:27:25 +02:00
Guillem Jover
6faea4d2a0 Force setproctitle() into .init_array section
The GNU .init_array support is an extension over the standard System V
ABI .init_array support, which passes the main() arguments to the init
function.

This support comes in three parts. First the dynamic linker (from glibc)
needs to support it. Then function pointers need to be placed in the
section, for example by using __attribute__((constructor)), that the
compiler (gcc or clang for example) might place in section .ctors and
the linker (from binutils) will move to .init_array on the output
object, or by placing them directly into .init_array by the compiler
when compiling. If this does not happen and the function pointers end
up in .ctors, then they will not get passed the main() arguments, which
we do really need in this case.

But this relies on recent binutils or gcc having native .init_array
support, and not having it disabled through --disable-initfini-array.

To guarantee we get the correct behaviour, let's just place the function
pointer in the .init_array section directly, so we only require a recent
enough glibc.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=65029
2013-06-08 18:09:29 +02:00
Guillem Jover
06f0585c48 build: Compress the distribution tarball with xz instead of gzip 2013-05-27 04:05:17 +02:00
Guillem Jover
e9933255d4 Make setproctitle() available in 0.2 and 0.5 version nodes
Make the 0.5 version the default, so that code wanting the actual
implemented version can get a proper versioned depdendency. For code
linked against the old version, make it available as an alias.
2013-05-27 03:24:22 +02:00
Guillem Jover
35785f8dd1 Modify setproctitle() to conform to project coding style
Use local getprogname()/setprogname() instead of reimplementing them
locally. Use clearenv() if available, not just on glibc. Use bool
instead of _Bool. Use paranthesis on sizeof. Fold the SPT_MIN macro
into spt_min(). Make spt_init() static. Avoid unnecessary gotos.
2013-05-27 03:20:17 +02:00
Guillem Jover
14524b545d build: Set default compiler variables from configure
This centralizes the setting so there's no duplication anymore,
makes sure the user supplied variables are never overridden, and
are only set when using gcc.

Reported-by: Samuli Suominen <ssuominen@gentoo.org>
2012-06-03 07:46:00 +02:00
Guillem Jover
752997462a Base getprogname() on program_invocation_short_name presence instead of glibc 2012-05-29 04:51:04 +02:00
Guillem Jover
d5d9186937 Base fpurge() implementation on __fpurge presence instead of glibc 2012-05-29 04:51:04 +02:00