summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2022-10-06 00:38:36 +0000
committerGuillem Jover <guillem@hadrons.org>2022-10-06 00:39:38 +0000
commitf476c0a09c0d0dd22d22f447cae9fa02eb560506 (patch)
treed682b49ff6a7821ff6f5686f6961d608f50e25a2
parentd54aaf2483df6a1f98fadc09004157e657b7f73e (diff)
Switch from libbsd to libbsd-overlay
This is the preferred usage form for libbsd, as it makes the code more portable and requires no special includes for libbsd, by transparently injects the needed standard headers that would be used on a BSD. Signed-off-by: Guillem Jover <guillem@hadrons.org>
-rw-r--r--configure.ac15
-rw-r--r--src/util/replace.h6
2 files changed, 6 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index b78b90e..701f9fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,21 +51,18 @@ XORG_CHECK_SGML_DOCTOOLS(1.7)
AC_CHECK_HEADERS([endian.h poll.h sys/poll.h])
# Checks for library functions.
-AC_CHECK_FUNCS([poll readlink])
-AC_SEARCH_LIBS([strlcat], [bsd])
-if test "$ac_cv_search_strlcat" = "-lbsd"; then
- AC_DEFINE(HAVE_LIBBSD,1,[Has libbsd])
-fi
+PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [
+ CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
+ LIBS="$LIBS $LIBBSD_LIBS"
+], [:])
+
+AC_CHECK_FUNCS([poll readlink strlcat])
AC_CONFIG_LIBOBJ_DIR([src/util])
AC_REPLACE_FUNCS([reallocarray realpath strlcat strlcpy])
# Check for BSDish err.h
AC_CHECK_HEADERS([err.h])
-# If the first PKG_CHECK_MODULES appears inside a conditional, pkg-config
-# must first be located explicitly.
-PKG_PROG_PKG_CONFIG
-
#
# select libraries to include
#
diff --git a/src/util/replace.h b/src/util/replace.h
index 53a81a2..367a1fd 100644
--- a/src/util/replace.h
+++ b/src/util/replace.h
@@ -32,9 +32,6 @@
#include <X11/Xfuncproto.h>
#include <stdlib.h>
-#if defined(HAVE_LIBBSD) && defined(HAVE_REALLOCARRAY)
-#include <bsd/stdlib.h> /* for reallocarray */
-#endif
#ifndef HAVE_REALLOCARRAY
extern _X_HIDDEN void *
@@ -46,9 +43,6 @@ reallocarray(void *optr, size_t nmemb, size_t size);
#endif
#include <string.h>
-#if defined(HAVE_LIBBSD) && defined(HAVE_STRLCPY)
-#include <bsd/string.h> /* for strlcpy, strlcat */
-#endif
#ifndef HAVE_STRLCPY
extern _X_HIDDEN size_t