diff --git a/meson.build b/meson.build index cd7c37b28..bb83c8e85 100644 --- a/meson.build +++ b/meson.build @@ -273,6 +273,10 @@ summary({'systemd conf data': systemd.found()}, bool_yn: true) summary({'libsystemd': systemd_dep.found()}, bool_yn: true) cdata.set('HAVE_SYSTEMD', systemd.found() and systemd_dep.found()) +logind_dep = dependency(get_option('logind-provider'), required: get_option('logind')) +summary({'logind': logind_dep.found()}, bool_yn: true) +cdata.set('HAVE_LOGIND', logind_dep.found()) + selinux_dep = dependency('libselinux', required: get_option('selinux')) summary({'libselinux': selinux_dep.found()}, bool_yn: true) cdata.set('HAVE_SELINUX', selinux_dep.found()) diff --git a/meson_options.txt b/meson_options.txt index f3e60b252..dc52fd39a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -34,6 +34,15 @@ option('systemd', description: 'Enable systemd integration', type: 'feature', value: 'auto') +option('logind', + description: 'Enable logind integration', + type: 'feature', + value: 'auto') +option('logind-provider', + description: 'Provider for logind integration', + type: 'combo', + choices: ['libelogind', 'libsystemd'], + value: 'libsystemd') option('systemd-system-service', description: 'Install systemd system service file', type: 'feature', diff --git a/spa/plugins/v4l2/meson.build b/spa/plugins/v4l2/meson.build index 7ce729b0f..e7d09fe2a 100644 --- a/spa/plugins/v4l2/meson.build +++ b/spa/plugins/v4l2/meson.build @@ -6,8 +6,8 @@ v4l2_dependencies = [ spa_dep, libinotify_dep ] if libudev_dep.found() v4l2_sources += [ 'v4l2-udev.c' ] v4l2_dependencies += [ libudev_dep ] - if systemd_dep.found() - v4l2_dependencies += [ systemd_dep ] + if logind_dep.found() + v4l2_dependencies += [ logind_dep ] endif endif diff --git a/spa/plugins/v4l2/v4l2-udev.c b/spa/plugins/v4l2/v4l2-udev.c index 714188acb..c45ef06ff 100644 --- a/spa/plugins/v4l2/v4l2-udev.c +++ b/spa/plugins/v4l2/v4l2-udev.c @@ -27,7 +27,7 @@ #include "config.h" #include "v4l2.h" -#ifdef HAVE_SYSTEMD +#ifdef HAVE_LOGIND #include #endif @@ -66,7 +66,7 @@ struct impl { struct spa_source source; struct spa_source notify; -#ifdef HAVE_SYSTEMD +#ifdef HAVE_LOGIND struct spa_source logind; sd_login_monitor *logind_monitor; #endif @@ -472,7 +472,7 @@ static int start_inotify(struct impl *this) { int notify_fd; -#ifdef HAVE_SYSTEMD +#ifdef HAVE_LOGIND /* Do not use inotify when using logind session monitoring */ if (this->logind_monitor) return 0; @@ -495,7 +495,7 @@ static int start_inotify(struct impl *this) return 0; } -#ifdef HAVE_SYSTEMD +#ifdef HAVE_LOGIND static void impl_on_logind_events(struct spa_source *source) { struct impl *this = source->data; @@ -769,7 +769,7 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->notify.fd = -1; -#ifdef HAVE_SYSTEMD +#ifdef HAVE_LOGIND this->logind_monitor = NULL; #endif