From e802d381a168789a593cdf583562758c3f26f305 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Tue, 16 Mar 2021 12:52:31 +0100 Subject: meson: Fix logind backend auto mode --- meson.build | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index ff56845..fe9ab21 100644 --- a/meson.build +++ b/meson.build @@ -111,25 +111,25 @@ if get_option('seatd').enabled() endif logind_provider = '' -if get_option('logind').enabled() - # Check for libelogind first, as elogind may provide a libsystemd wrapper - # which can cause issues. - logind = dependency('libelogind', required: false) - add_project_arguments('-DLOGIND_ENABLED=1', language: 'c') +if not get_option('logind').disabled() + foreach logind_provider : ['elogind', 'systemd'] + logind = dependency('lib@0@'.format(logind_provider), required: false) + if logind.found() + break + endif + endforeach + if logind.found() - add_project_arguments('-DHAVE_ELOGIND=1', language: 'c') - logind_provider = 'elogind' - else - logind = dependency('libsystemd') - add_project_arguments('-DHAVE_SYSTEMD=1', language: 'c') - logind_provider = 'systemd' + add_project_arguments('-DLOGIND_ENABLED=1', language: 'c') + add_project_arguments('-DHAVE_@0@=1'.format(logind_provider.to_upper()), language: 'c') + private_files += [ + 'libseat/backend/logind.c', + 'common/drm.c', + ] + private_deps += logind + elif get_option('logind').enabled() + error('logind backend was enabled but no supported logind provider was found') endif - - private_files += [ - 'libseat/backend/logind.c', - 'common/drm.c', - ] - private_deps += logind endif if get_option('builtin').enabled() -- cgit v1.2.3