summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2022-10-06 00:11:18 +0000
committerGuillem Jover <guillem@hadrons.org>2022-10-06 00:13:12 +0000
commit8a10c98d29d0ff2028f109b5671dfae2910df051 (patch)
tree1b9e60732da1d693fcb977209095b287ffbc2c9a
parent468b76023a2dfb750c4d5e9b184f230c5b6ec670 (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.ac10
-rw-r--r--xdm/choose.c7
-rw-r--r--xdm/genauth.c14
-rw-r--r--xdm/session.c6
4 files changed, 11 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index 02cedf9..4f91f01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,6 +58,12 @@ AM_CONDITIONAL(HAVE_MKTEMP_COMMAND, test x$MKTEMP_COMMAND != x)
# pre-pends the found library to $LIBS.
#
#------------------------------------------------------------------------------
+
+PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [
+ CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
+ LIBS="$LIBS $LIBBSD_LIBS"
+], [:])
+
# Function getifaddrs() comes from the C library, Solaris 11 -lsocket, or
# the -lnsl name service library
AC_SEARCH_LIBS([getifaddrs], [socket nsl])
@@ -67,13 +73,13 @@ AC_SEARCH_LIBS([getifaddrs], [socket nsl])
AC_SEARCH_LIBS([getspnam], [sec gen shadow])
# Function setproctitle() is in BSD -lutil or GNU systems -lbsd but N/A on Solaris
-AC_SEARCH_LIBS([setproctitle], [util bsd])
+AC_SEARCH_LIBS([setproctitle], [util])
# Function setusercontext() is in BSD -lutil but N/A on Solaris or GNU systems
AC_SEARCH_LIBS([setusercontext], [util])
# Function arc4random() is in BSD standard C or GNU systems -lbsd
-AC_SEARCH_LIBS([arc4random], [bsd], [HAVE_ARC4RANDOM="yes"])
+AC_SEARCH_LIBS([arc4random], [], [HAVE_ARC4RANDOM="yes"])
AC_SUBST(HAVE_ARC4RANDOM)
AM_CONDITIONAL(HAVE_ARC4RANDOM, test x$HAVE_ARC4RANDOM = xyes)
diff --git a/xdm/choose.c b/xdm/choose.c
index 5df0f67..9b2bc9b 100644
--- a/xdm/choose.c
+++ b/xdm/choose.c
@@ -47,13 +47,8 @@ in this Software without prior written authorization from The Open Group.
# include <ctype.h>
# include <errno.h>
-
# ifdef HAVE_SETPROCTITLE
-# ifdef __linux__
-# include <bsd/unistd.h>
-# else
-# include <unistd.h>
-# endif
+# include <unistd.h>
# endif
# include <time.h>
diff --git a/xdm/genauth.c b/xdm/genauth.c
index de7abfc..696d6ce 100644
--- a/xdm/genauth.c
+++ b/xdm/genauth.c
@@ -41,19 +41,7 @@ from The Open Group.
#include <errno.h>
#ifdef HAVE_ARC4RANDOM
-# ifdef __linux__
-# if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
-# if __GLIBC_PREREQ(2, 36)
-# include <stdlib.h>
-# else
-# include <bsd/stdlib.h>
-# endif
-# else
-# include <bsd/stdlib.h>
-# endif
-# else
-# include <stdlib.h>
-# endif
+# include <stdlib.h>
#endif
#include <time.h>
diff --git a/xdm/session.c b/xdm/session.c
index 4fd7d0a..a8aa429 100644
--- a/xdm/session.c
+++ b/xdm/session.c
@@ -53,11 +53,7 @@ from The Open Group.
# ifdef HAVE_SETPROCTITLE
# include <sys/types.h>
-# ifdef __linux__
-# include <bsd/unistd.h>
-# else
-# include <unistd.h>
-# endif
+# include <unistd.h>
# endif
#ifndef USE_PAM /* PAM modules should handle these */