Commit c63d0173 authored by Olivier Fourdan's avatar Olivier Fourdan 🛠

xwayland: Fix build without <sys/random.h>

The include <sys/random.h> was added to glibc-2.25, previously was
<linux/random.h>.

Adjust meson build and code to accomodate both.

Fixes: a8984a81 "xwayland: Generate a Xauth file and pass this to
                  Xwayland when starting it"

GNOME/mutter!633
parent 7fcdd60a
......@@ -61,5 +61,6 @@
/* XKB base prefix */
#mesondefine XKB_BASE
/* Default rules for allowing Xwayland grabs */
#mesondefine XWAYLAND_GRAB_DEFAULT_ACCESS_RULES
/* Either <sys/random.h> or <linux/random.h> */
#mesondefine HAVE_SYS_RANDOM
#mesondefine HAVE_LINUX_RANDOM
......@@ -364,6 +364,15 @@ if have_wayland
xwayland_path = find_program('Xwayland').path()
endif
cdata.set_quoted('XWAYLAND_PATH', xwayland_path)
# For Xwayland authority file generation.
if cc.has_header_symbol('sys/random.h', 'getrandom')
cdata.set('HAVE_SYS_RANDOM', 1)
elif cc.has_header_symbol('linux/random.h', 'getrandom')
cdata.set('HAVE_LINUX_RANDOM', 1)
else
error('Required function getrandom not found')
endif
endif
xwayland_grab_default_access_rules = get_option('xwayland_grab_default_access_rules')
......
......@@ -31,7 +31,11 @@
#include <glib.h>
#include <sys/socket.h>
#include <sys/un.h>
#if defined(HAVE_SYS_RANDOM)
#include <sys/random.h>
#elif defined(HAVE_LINUX_RANDOM)
#include <linux/random.h>
#endif
#include <unistd.h>
#include <X11/Xauth.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment