aboutsummaryrefslogtreecommitdiff
path: root/backend/session/meson.build
blob: 29fcf6e4ad776699f54bbbc50dad2dd16279820d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
wlr_files += files(
	'direct-ipc.c',
	'noop.c',
	'session.c',
)

if host_machine.system().startswith('freebsd')
	wlr_files += files('direct-freebsd.c')
else
	wlr_files += files('direct.c')
endif

# logind

msg = []
if get_option('logind').enabled()
	msg += 'Install "lib@0@" or pass "-Dlogind=disabled".'
endif
if not get_option('logind').disabled()
	msg += 'Required for logind support.'
	msg += 'You may need to pass "-Dlogind-provider=elogind" or "-Dlogind-provider=systemd" to ensure the correct library is detected.'
endif

logind_version = '>=237'
logind_found = false

if get_option('logind-provider') == 'auto'
	if not get_option('logind').disabled()
		assert(get_option('auto_features').auto(), '-Dlogind-provider must be set to systemd or elogind since auto_features != auto')
		logind = dependency('libsystemd',
			required: get_option('logind'),
			not_found_message: 'libsystemd not found, trying libelogind\n' + '\n'.join(msg),
			version: logind_version,
		)
		if logind.found()
			features += { 'systemd': true }
		else
			logind = dependency('libelogind',
				required: get_option('logind'),
				not_found_message: 'libelogind not found\n' + '\n'.join(msg),
				version: logind_version,
			)
			if logind.found()
				features += { 'elogind': true }
			endif
		endif
		logind_found = logind.found()
	endif
else
	logind = dependency('lib' + get_option('logind-provider'),
		required: get_option('logind'),
		not_found_message: '\n'.join(msg).format(get_option('logind-provider')),
		version: logind_version,
	)
	if logind.found()
		features += { get_option('logind-provider'): true }
		logind_found = true
	endif
endif

if logind_found
	wlr_files += files('logind.c')
	wlr_deps += logind
endif

# libseat

libseat = dependency('libseat', required: get_option('libseat'), version: '>=0.2.0')
if libseat.found()
	wlr_files += files('libseat.c')
	wlr_deps += libseat
	features += { 'libseat': true }
endif