Switch to libbsd-overlay
This is more portable than libbsd as everything Just Works, even on BSD systems, and is the recommended method of consuming libbsd nowadays. It also helpfully lets things work with glibc-provided functions for new enough glibc. [For the 21.1.x backport, take inspiration from @alanc's commit to libxdmcp atc01da8ebd0
.] Closes: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/973 Co-authored-by: Guillem Jover <guillem@hadrons.org> (cherry picked from commit94945a5274
) Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
parent
b98fc07d34
commit
2c33ee9f1d
12
configure.ac
12
configure.ac
|
@ -164,8 +164,16 @@ AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\
|
||||||
timingsafe_memcmp])
|
timingsafe_memcmp])
|
||||||
AM_CONDITIONAL(POLL, [test "x$ac_cv_func_poll" = "xyes"])
|
AM_CONDITIONAL(POLL, [test "x$ac_cv_func_poll" = "xyes"])
|
||||||
|
|
||||||
AC_CHECK_LIB([bsd], [arc4random_buf])
|
# Checks for non-standard functions and fallback to libbsd if we can
|
||||||
AC_CHECK_FUNCS([arc4random_buf])
|
# We only check for arc4random_buf, because if we have that, we don't
|
||||||
|
# need/use getentropy.
|
||||||
|
AC_LINK_IFELSE([AC_LANG_CALL([], [arc4random_buf])],
|
||||||
|
[TRY_LIBBSD="no"], [TRY_LIBBSD="yes"])
|
||||||
|
AS_IF([test "x$TRY_LIBBSD" = "xyes"],
|
||||||
|
[PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay], [
|
||||||
|
CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
|
||||||
|
LIBS="$LIBS $LIBBSD_LIBS"
|
||||||
|
], [:])])
|
||||||
|
|
||||||
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
|
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
|
||||||
|
|
||||||
|
|
|
@ -50,16 +50,13 @@ SOFTWARE.
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#if defined(HAVE_REALLOCARRAY)
|
||||||
|
#include <stdlib.h> /* for reallocarray */
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef MONOTONIC_CLOCK
|
#ifdef MONOTONIC_CLOCK
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_LIBBSD) && defined(HAVE_REALLOCARRAY)
|
|
||||||
#include <bsd/stdlib.h> /* for reallocarray */
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_LIBBSD) && defined(HAVE_STRLCPY)
|
|
||||||
#include <bsd/string.h> /* for strlcpy, strlcat */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SCREEN_SAVER_ON 0
|
#define SCREEN_SAVER_ON 0
|
||||||
#define SCREEN_SAVER_OFF 1
|
#define SCREEN_SAVER_OFF 1
|
||||||
|
|
|
@ -96,7 +96,7 @@ applewmproto_dep = dependency('applewmproto', version: '>= 1.4', fallback: ['xor
|
||||||
xshmfence_dep = dependency('xshmfence', version: '>= 1.1', required: false)
|
xshmfence_dep = dependency('xshmfence', version: '>= 1.1', required: false)
|
||||||
|
|
||||||
pixman_dep = dependency('pixman-1')
|
pixman_dep = dependency('pixman-1')
|
||||||
libbsd_dep = dependency('libbsd', required: false)
|
libbsd_dep = dependency('libbsd-overlay', required: false)
|
||||||
xkbcomp_dep = dependency('xkbcomp', required: false)
|
xkbcomp_dep = dependency('xkbcomp', required: false)
|
||||||
xkbfile_dep = dependency('xkbfile')
|
xkbfile_dep = dependency('xkbfile')
|
||||||
xfont2_dep = dependency('xfont2', version: '>= 2.0')
|
xfont2_dep = dependency('xfont2', version: '>= 2.0')
|
||||||
|
|
|
@ -46,9 +46,7 @@ from The Open Group.
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <X11/Xw32defs.h>
|
#include <X11/Xw32defs.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIBBSD
|
#include <stdlib.h> /* for arc4random_buf() */
|
||||||
#include <bsd/stdlib.h> /* for arc4random_buf() */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct protocol {
|
struct protocol {
|
||||||
unsigned short name_length;
|
unsigned short name_length;
|
||||||
|
|
Loading…
Reference in New Issue