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.
This commit is contained in:
parent
69cf5c36e0
commit
d92fa01f88
2 changed files with 8 additions and 15 deletions
|
@ -13,10 +13,10 @@
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#if defined(HAVE_ELOGIND)
|
#if defined(HAVE_LIBELOGIND)
|
||||||
#include <elogind/sd-bus.h>
|
#include <elogind/sd-bus.h>
|
||||||
#include <elogind/sd-login.h>
|
#include <elogind/sd-login.h>
|
||||||
#elif defined(HAVE_SYSTEMD)
|
#elif defined(HAVE_LIBSYSTEMD)
|
||||||
#include <systemd/sd-bus.h>
|
#include <systemd/sd-bus.h>
|
||||||
#include <systemd/sd-login.h>
|
#include <systemd/sd-login.h>
|
||||||
#else
|
#else
|
||||||
|
|
19
meson.build
19
meson.build
|
@ -3,7 +3,7 @@ project(
|
||||||
'c',
|
'c',
|
||||||
version: '0.6.3',
|
version: '0.6.3',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=0.56.0',
|
meson_version: '>=0.60.0',
|
||||||
default_options: [
|
default_options: [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
'warning_level=3',
|
'warning_level=3',
|
||||||
|
@ -126,26 +126,19 @@ if with_seatd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
logind = disabler()
|
logind = disabler()
|
||||||
logind_provider = ''
|
|
||||||
if get_option('libseat-logind') != 'disabled'
|
if get_option('libseat-logind') != 'disabled'
|
||||||
if get_option('libseat-logind') == 'auto' and get_option('auto_features').disabled()
|
if get_option('libseat-logind') == 'auto' and get_option('auto_features').disabled()
|
||||||
# Disable logind
|
# Disable logind
|
||||||
elif get_option('libseat-logind') == 'auto'
|
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')
|
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(['libelogind', 'libsystemd'], required: false)
|
||||||
logind = dependency('lib@0@'.format(logind_provider), required: false)
|
|
||||||
if logind.found()
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
endforeach
|
|
||||||
else
|
else
|
||||||
logind_provider = get_option('libseat-logind')
|
logind = dependency('lib@0@'.format(get_option('libseat-logind')))
|
||||||
logind = dependency('lib@0@'.format(logind_provider))
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if logind.found()
|
if logind.found()
|
||||||
add_project_arguments('-DLOGIND_ENABLED=1', language: 'c')
|
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 += [
|
private_files += [
|
||||||
'libseat/backend/logind.c',
|
'libseat/backend/logind.c',
|
||||||
'common/drm.c',
|
'common/drm.c',
|
||||||
|
@ -278,7 +271,7 @@ endif
|
||||||
summary({
|
summary({
|
||||||
'libseat-seatd': with_seatd,
|
'libseat-seatd': with_seatd,
|
||||||
'libseat-builtin': with_builtin,
|
'libseat-builtin': with_builtin,
|
||||||
'libseat-systemd': logind.found() and logind_provider == 'systemd',
|
'libseat-systemd': logind.found() and logind.name() == 'libsystemd',
|
||||||
'libseat-elogind': logind.found() and logind_provider == 'elogind',
|
'libseat-elogind': logind.found() and logind.name() == 'libelogind',
|
||||||
'server': with_server,
|
'server': with_server,
|
||||||
}, bool_yn: true)
|
}, bool_yn: true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue