From 385cc0039db13448856f4241b05d46533dc98b16 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 7 Apr 2021 13:24:19 +0200 Subject: build: add explicit logind provider option, auto-detect by default Allow package maintainers to explicitly select a logind provider by passing -Dlogind=systemd or -Dlogind=elogind. In case both are available (e.g. for distributions which support both), this makes it possible to gte deterministic behavior. By default, auto-detect the logind provider. That way, users which have systemd or elogind installed get the backend built by default. --- meson.build | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index beb121c..5454053 100644 --- a/meson.build +++ b/meson.build @@ -109,13 +109,19 @@ endif logind = disabler() logind_provider = '' -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 get_option('logind') != 'disabled' + if get_option('logind') == 'auto' + assert(get_option('auto_features').auto(), '-Dlogind 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 + else + logind_provider = get_option('logind') + logind = dependency('lib@0@'.format(logind_provider)) + endif if logind.found() add_project_arguments('-DLOGIND_ENABLED=1', language: 'c') @@ -125,8 +131,6 @@ if not get_option('logind').disabled() 'common/drm.c', ] private_deps += logind - elif get_option('logind').enabled() - error('logind backend was enabled but no supported logind provider was found') endif endif -- cgit v1.2.3