From f476c0a09c0d0dd22d22f447cae9fa02eb560506 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 6 Oct 2022 00:38:36 +0000 Subject: 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 --- configure.ac | 15 ++++++--------- src/util/replace.h | 6 ------ 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 #include -#if defined(HAVE_LIBBSD) && defined(HAVE_REALLOCARRAY) -#include /* 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 -#if defined(HAVE_LIBBSD) && defined(HAVE_STRLCPY) -#include /* for strlcpy, strlcat */ -#endif #ifndef HAVE_STRLCPY extern _X_HIDDEN size_t -- cgit v1.2.3