aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-11-26 21:17:51 +0000
committerKenny Levinsen <kl@kl.wtf>2021-11-28 15:40:56 +0100
commitd92fa01f884e94262e4c7184be62efaf8a00a634 (patch)
tree73692d7c197519a341501f80bd19e65ddb7ea286
parent69cf5c36e05c64597063dd8c4d83d3e036547451 (diff)
build: use list for logind dep
This reduces the boilerplate a bit. Use logind.name() instead of having a separate source of truth. Requires adapting the checks a bit because the dep name has a "lib" prefix.
-rw-r--r--libseat/backend/logind.c4
-rw-r--r--meson.build19
2 files changed, 8 insertions, 15 deletions
diff --git a/libseat/backend/logind.c b/libseat/backend/logind.c
index 5a10c75..bfb02cf 100644
--- a/libseat/backend/logind.c
+++ b/libseat/backend/logind.c
@@ -13,10 +13,10 @@
#include <sys/un.h>
#include <unistd.h>
-#if defined(HAVE_ELOGIND)
+#if defined(HAVE_LIBELOGIND)
#include <elogind/sd-bus.h>
#include <elogind/sd-login.h>
-#elif defined(HAVE_SYSTEMD)
+#elif defined(HAVE_LIBSYSTEMD)
#include <systemd/sd-bus.h>
#include <systemd/sd-login.h>
#else
diff --git a/meson.build b/meson.build
index 206cde1..b5d00c6 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project(
'c',
version: '0.6.3',
license: 'MIT',
- meson_version: '>=0.56.0',
+ meson_version: '>=0.60.0',
default_options: [
'c_std=c11',
'warning_level=3',
@@ -126,26 +126,19 @@ if with_seatd
endif
logind = disabler()
-logind_provider = ''
if get_option('libseat-logind') != 'disabled'
if get_option('libseat-logind') == 'auto' and get_option('auto_features').disabled()
# Disable logind
elif get_option('libseat-logind') == 'auto'
assert(get_option('auto_features').auto(), '-Dlibseat-logind must be set to systemd or elogind since auto_features != auto')
- foreach logind_provider : ['elogind', 'systemd']
- logind = dependency('lib@0@'.format(logind_provider), required: false)
- if logind.found()
- break
- endif
- endforeach
+ logind = dependency(['libelogind', 'libsystemd'], required: false)
else
- logind_provider = get_option('libseat-logind')
- logind = dependency('lib@0@'.format(logind_provider))
+ logind = dependency('lib@0@'.format(get_option('libseat-logind')))
endif
if logind.found()
add_project_arguments('-DLOGIND_ENABLED=1', language: 'c')
- add_project_arguments('-DHAVE_@0@=1'.format(logind_provider.to_upper()), language: 'c')
+ add_project_arguments('-DHAVE_@0@=1'.format(logind.name().to_upper()), language: 'c')
private_files += [
'libseat/backend/logind.c',
'common/drm.c',
@@ -278,7 +271,7 @@ endif
summary({
'libseat-seatd': with_seatd,
'libseat-builtin': with_builtin,
- 'libseat-systemd': logind.found() and logind_provider == 'systemd',
- 'libseat-elogind': logind.found() and logind_provider == 'elogind',
+ 'libseat-systemd': logind.found() and logind.name() == 'libsystemd',
+ 'libseat-elogind': logind.found() and logind.name() == 'libelogind',
'server': with_server,
}, bool_yn: true)