build: Rename have_libsystemd to have_logind

We really only need the logind API which can be provided either by
libsystemd or libelogind.

This also pulls out finding a logind provider from the native backend
only code because we make use of it in the generic backend code as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4223>
This commit is contained in:
Sebastian Wick 2025-01-20 16:32:57 +01:00 committed by Marge Bot
parent 98519a344f
commit e7ca9cecea
5 changed files with 24 additions and 17 deletions

View File

@ -51,8 +51,8 @@
/* libwacom has get_num_rings() */ /* libwacom has get_num_rings() */
#mesondefine HAVE_LIBWACOM_GET_NUM_RINGS #mesondefine HAVE_LIBWACOM_GET_NUM_RINGS
/* Building with libsystemd */ /* Building with logind */
#mesondefine HAVE_LIBSYSTEMD #mesondefine HAVE_LOGIND
/* Define if you want to enable the native (KMS) backend based on systemd */ /* Define if you want to enable the native (KMS) backend based on systemd */
#mesondefine HAVE_NATIVE_BACKEND #mesondefine HAVE_NATIVE_BACKEND

View File

@ -239,6 +239,19 @@ if have_wayland
endif endif
endif endif
have_logind = get_option('logind')
if have_logind
logind_dep = dependency('libsystemd', required: false)
if not logind_dep.found()
logind_dep = dependency('libelogind', required: false)
endif
if not logind_dep.found()
error('No logind provider dependency found: tried libsystemd and libelogind')
endif
endif
have_libgudev = get_option('udev') have_libgudev = get_option('udev')
if have_libgudev if have_libgudev
libudev_dep = dependency('libudev', version: udev_req) libudev_dep = dependency('libudev', version: udev_req)
@ -251,18 +264,13 @@ if have_libgudev
endif endif
endif endif
have_libsystemd = get_option('systemd')
libsystemd_dep = dependency('libsystemd', required: have_libsystemd)
have_native_backend = get_option('native_backend') have_native_backend = get_option('native_backend')
if have_native_backend if have_native_backend
libgbm_dep = dependency('gbm', version: gbm_req) libgbm_dep = dependency('gbm', version: gbm_req)
libinput_dep = dependency('libinput', version: libinput_req) libinput_dep = dependency('libinput', version: libinput_req)
if libsystemd_dep.found() if not have_logind
logind_provider_dep = libsystemd_dep error('The native backend requires logind to be enabled')
else
logind_provider_dep = dependency('libelogind')
endif endif
if not have_egl if not have_egl
@ -557,7 +565,7 @@ cdata.set('HAVE_WAYLAND', have_wayland)
cdata.set('HAVE_XWAYLAND', have_xwayland) cdata.set('HAVE_XWAYLAND', have_xwayland)
cdata.set('HAVE_X11', have_x11) cdata.set('HAVE_X11', have_x11)
cdata.set('HAVE_X11_CLIENT', have_x11_client) cdata.set('HAVE_X11_CLIENT', have_x11_client)
cdata.set('HAVE_LIBSYSTEMD', have_libsystemd) cdata.set('HAVE_LOGIND', have_logind)
cdata.set('HAVE_NATIVE_BACKEND', have_native_backend) cdata.set('HAVE_NATIVE_BACKEND', have_native_backend)
cdata.set('HAVE_REMOTE_DESKTOP', have_remote_desktop) cdata.set('HAVE_REMOTE_DESKTOP', have_remote_desktop)
cdata.set('HAVE_GNOME_DESKTOP', have_gnome_desktop) cdata.set('HAVE_GNOME_DESKTOP', have_gnome_desktop)

View File

@ -51,10 +51,10 @@ option('x11',
description: 'Enable X11 support' description: 'Enable X11 support'
) )
option('systemd', option('logind',
type: 'boolean', type: 'boolean',
value: true, value: true,
description: 'Enable systemd support' description: 'Enable logind support'
) )
option('native_backend', option('native_backend',

View File

@ -109,7 +109,7 @@
#include "wayland/meta-window-xwayland.h" #include "wayland/meta-window-xwayland.h"
#endif #endif
#ifdef HAVE_LIBSYSTEMD #ifdef HAVE_LOGIND
#include <systemd/sd-login.h> #include <systemd/sd-login.h>
#endif #endif
@ -6813,7 +6813,7 @@ meta_window_get_pid (MetaWindow *window)
GFile * GFile *
meta_window_get_unit_cgroup (MetaWindow *window) meta_window_get_unit_cgroup (MetaWindow *window)
{ {
#ifdef HAVE_LIBSYSTEMD #ifdef HAVE_LOGIND
g_autofree char *contents = NULL; g_autofree char *contents = NULL;
g_autofree char *complete_path = NULL; g_autofree char *complete_path = NULL;
g_autofree char *unit_name = NULL; g_autofree char *unit_name = NULL;

View File

@ -135,9 +135,9 @@ if have_wayland
] ]
endif endif
if have_libsystemd if have_logind
mutter_pkg_private_deps += [ mutter_pkg_private_deps += [
libsystemd_dep, logind_dep,
] ]
endif endif
@ -145,7 +145,6 @@ if have_native_backend
mutter_pkg_private_deps += [ mutter_pkg_private_deps += [
libinput_dep, libinput_dep,
libgbm_dep, libgbm_dep,
logind_provider_dep,
xkbcommon_dep, xkbcommon_dep,
] ]
endif endif