summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2022-10-06 00:26:11 +0000
committerGuillem Jover <guillem@hadrons.org>2022-10-06 00:26:11 +0000
commit81da58f39d274ab7f822fb22e56b5b2027597a51 (patch)
treee7bd76861ae9a669b8810aa682487c82aec441bb
parent96c84e563610d5c7846e601605f675f3d3840dd2 (diff)
downloadxorg-lib-libICE-81da58f39d274ab7f822fb22e56b5b2027597a51.tar.gz
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.ac11
-rw-r--r--ice.pc.in2
-rw-r--r--src/iceauth.c4
3 files changed, 7 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index e131ba8..1c9bcf8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,17 +31,14 @@ XORG_CHECK_SGML_DOCTOOLS(1.8)
# Obtain compiler/linker options for dependencies
PKG_CHECK_MODULES(ICE, [xproto >= 7.0.25 xtrans])
+PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [
+ CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
+ LIBS="$LIBS $LIBBSD_LIBS"
+], [:])
# Checks for library functions.
-AC_SEARCH_LIBS([arc4random_buf], [bsd])
AC_CHECK_FUNCS([asprintf arc4random_buf getentropy])
-if test "x$ac_cv_search_arc4random_buf" = x-lbsd; then
- AC_DEFINE([HAVE_LIBBSD], [1], [Define to use libbsd])
- BSDLIB=-lbsd
-fi
-AC_SUBST(BSDLIB)
-
# Transport selection macro from xtrans.m4
XTRANS_CONNECTION_FLAGS
AC_DEFINE(ICE_t, 1, [Xtrans transport type])
diff --git a/ice.pc.in b/ice.pc.in
index c88962d..b126404 100644
--- a/ice.pc.in
+++ b/ice.pc.in
@@ -9,4 +9,4 @@ Version: @PACKAGE_VERSION@
Requires: xproto
Cflags: -I${includedir}
Libs: -L${libdir} -lICE
-Libs.Private: @BSDLIB@
+Libs.Private: @LIBBSD_LIBS@
diff --git a/src/iceauth.c b/src/iceauth.c
index 807e5d7..5a4d400 100644
--- a/src/iceauth.c
+++ b/src/iceauth.c
@@ -35,8 +35,8 @@ Author: Ralph Mor, X Consortium
#include <time.h>
-#ifdef HAVE_LIBBSD
-#include <bsd/stdlib.h> /* for arc4random_buf() */
+#ifdef HAVE_ARC4RANDOM_BUF
+#include <stdlib.h> /* for arc4random_buf() */
#endif
#include <unistd.h>