]> git.ipfire.org Git - thirdparty/systemd.git/blame - meson.build
test: skip tests if cgroup isn't mounted
[thirdparty/systemd.git] / meson.build
CommitLineData
db9ecf05 1# SPDX-License-Identifier: LGPL-2.1-or-later
3a726fcd 2
5c23128d 3project('systemd', 'c',
10f4d470 4 version : '248',
5c23128d
ZJS
5 license : 'LGPLv2+',
6 default_options: [
37efbbd8
ZJS
7 'c_std=gnu99',
8 'prefix=/usr',
9 'sysconfdir=/etc',
10 'localstatedir=/var',
827ca909 11 'warning_level=2',
5c23128d 12 ],
7a6397d2 13 meson_version : '>= 0.46',
5c23128d
ZJS
14 )
15
10f4d470 16libsystemd_version = '0.31.0'
3b684be0 17libudev_version = '1.7.0'
56d50ab1 18
348b4437 19# We need the same data in two different formats, ugh!
5c23128d
ZJS
20# Also, for hysterical reasons, we use different variable
21# names, sometimes. Not all variables are included in every
22# set. Ugh, ugh, ugh!
23conf = configuration_data()
6ffeca8c
ZJS
24conf.set('PROJECT_VERSION', meson.project_version(),
25 description : 'Numerical project version (used where a simple number is expected)')
5c23128d
ZJS
26
27substs = configuration_data()
a67c318d 28substs.set('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
6ffeca8c
ZJS
29substs.set('PROJECT_VERSION', meson.project_version(),
30 description : 'Numerical project version (used where a simple number is expected)')
5c23128d 31
1485aacb
DC
32# This is to be used instead of meson.source_root(), as the latter will return
33# the wrong result when systemd is being built as a meson subproject
34project_source_root = meson.current_source_dir()
81e06775 35project_build_root = meson.current_build_dir()
a0b15b41 36relative_source_path = run_command('realpath',
81e06775 37 '--relative-to=@0@'.format(project_build_root),
a0b15b41
ZJS
38 project_source_root).stdout().strip()
39conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
1485aacb 40
b8ee3493
ZJS
41conf.set('BUILD_MODE', 'BUILD_MODE_' + get_option('mode').to_upper(),
42 description : 'tailor build to development or release builds')
839bdf25 43
c09edc79
ZJS
44want_ossfuzz = get_option('oss-fuzz')
45want_libfuzzer = get_option('llvm-fuzz')
6b8d32ea
EV
46if want_ossfuzz + want_libfuzzer > 1
47 error('only one of oss-fuzz or llvm-fuzz can be specified')
c09edc79 48endif
87ac55a1
EV
49
50skip_deps = want_ossfuzz or want_libfuzzer
6b8d32ea 51fuzzer_build = want_ossfuzz or want_libfuzzer
c09edc79 52
5c23128d
ZJS
53#####################################################################
54
003c8879 55# Try to install the git pre-commit hook
e2d612a8
ZJS
56add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
57if add_git_hook_sh.found()
58 git_hook = run_command(add_git_hook_sh)
59 if git_hook.returncode() == 0
60 message(git_hook.stdout().strip())
61 endif
003c8879
ZJS
62endif
63
64#####################################################################
65
2675413e
ZJS
66if get_option('split-usr') == 'auto'
67 split_usr = run_command('test', '-L', '/bin').returncode() != 0
68else
69 split_usr = get_option('split-usr') == 'true'
70endif
9afd5e7b
ZJS
71if split_usr
72 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
73 + ' split-usr mode is going to be removed\n' +
74 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
75endif
671f0f8d
ZJS
76conf.set10('HAVE_SPLIT_USR', split_usr,
77 description : '/usr/bin and /bin directories are separate')
9a8e64b0 78
157baa87
ZJS
79if get_option('split-bin') == 'auto'
80 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
81else
82 split_bin = get_option('split-bin') == 'true'
83endif
671f0f8d
ZJS
84conf.set10('HAVE_SPLIT_BIN', split_bin,
85 description : 'bin and sbin directories are separate')
157baa87 86
74344a17 87rootprefixdir = get_option('rootprefix')
74344a17
ZJS
88# Unusual rootprefixdir values are used by some distros
89# (see https://github.com/systemd/systemd/pull/7461).
ba7f4ae6 90rootprefix_default = split_usr ? '/' : '/usr'
9a8e64b0
ZJS
91if rootprefixdir == ''
92 rootprefixdir = rootprefix_default
74344a17 93endif
23bdba61 94rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
5c23128d 95
8ef8f3d5
FB
96have_standalone_binaries = get_option('standalone-binaries')
97
5c23128d
ZJS
98sysvinit_path = get_option('sysvinit-path')
99sysvrcnd_path = get_option('sysvrcnd-path')
348b4437 100conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
349cc4a5 101 description : 'SysV init scripts and rcN.d links are supported')
5c23128d 102
cdf7ad38
NL
103if get_option('hibernate') and not get_option('initrd')
104 error('hibernate depends on initrd')
105endif
106
a8b627aa
LP
107conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
108conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
09dad04c 109conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
a8b627aa 110
23bdba61 111# join_paths ignores the preceding arguments if an absolute component is
5c23128d
ZJS
112# encountered, so this should canonicalize various paths when they are
113# absolute or relative.
114prefixdir = get_option('prefix')
115if not prefixdir.startswith('/')
37efbbd8 116 error('Prefix is not absolute: "@0@"'.format(prefixdir))
5c23128d
ZJS
117endif
118bindir = join_paths(prefixdir, get_option('bindir'))
119libdir = join_paths(prefixdir, get_option('libdir'))
120sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
121includedir = join_paths(prefixdir, get_option('includedir'))
122datadir = join_paths(prefixdir, get_option('datadir'))
123localstatedir = join_paths('/', get_option('localstatedir'))
124
125rootbindir = join_paths(rootprefixdir, 'bin')
157baa87 126rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
5c23128d
ZJS
127rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
128
129rootlibdir = get_option('rootlibdir')
130if rootlibdir == ''
37efbbd8 131 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
5c23128d
ZJS
132endif
133
225d08b8
JT
134install_sysconfdir = get_option('install-sysconfdir') != 'false'
135install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
5c23128d 136# Dirs of external packages
a95696e3
BM
137pkgconfigdatadir = get_option('pkgconfigdatadir') == '' ? join_paths(datadir, 'pkgconfig') : get_option('pkgconfigdatadir')
138pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgconfig') : get_option('pkgconfiglibdir')
e17e5ba9
MB
139polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
140polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
141polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
e17e5ba9 142xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
8a38aac3
YW
143rpmmacrosdir = get_option('rpmmacrosdir')
144if rpmmacrosdir != 'no'
145 rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
146endif
02fa054d 147modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
5c23128d
ZJS
148
149# Our own paths
e17e5ba9
MB
150pkgdatadir = join_paths(datadir, 'systemd')
151environmentdir = join_paths(prefixdir, 'lib/environment.d')
152pkgsysconfdir = join_paths(sysconfdir, 'systemd')
153userunitdir = join_paths(prefixdir, 'lib/systemd/user')
154userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
155tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
156sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
157sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
158binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
159modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
160networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
161pkgincludedir = join_paths(includedir, 'systemd')
162systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
163usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
164systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
165userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
166systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
167systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
168systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
169systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
170udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
e17e5ba9
MB
171udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
172udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
173catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
174kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
175factorydir = join_paths(datadir, 'factory')
e17e5ba9
MB
176bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
177testsdir = join_paths(prefixdir, 'lib/systemd/tests')
178systemdstatedir = join_paths(localstatedir, 'lib/systemd')
179catalogstatedir = join_paths(systemdstatedir, 'catalog')
180randomseeddir = join_paths(localstatedir, 'lib/systemd')
61d0578b 181profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
e5ea741c 182ntpservicelistdir = join_paths(rootprefixdir, 'lib/systemd/ntp-units.d')
5c23128d 183
75aaade1
TB
184docdir = get_option('docdir')
185if docdir == ''
186 docdir = join_paths(datadir, 'doc/systemd')
187endif
188
5c23128d
ZJS
189dbuspolicydir = get_option('dbuspolicydir')
190if dbuspolicydir == ''
37efbbd8 191 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
5c23128d
ZJS
192endif
193
194dbussessionservicedir = get_option('dbussessionservicedir')
195if dbussessionservicedir == ''
37efbbd8 196 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
5c23128d
ZJS
197endif
198
199dbussystemservicedir = get_option('dbussystemservicedir')
200if dbussystemservicedir == ''
37efbbd8 201 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
5c23128d
ZJS
202endif
203
204pamlibdir = get_option('pamlibdir')
205if pamlibdir == ''
37efbbd8 206 pamlibdir = join_paths(rootlibdir, 'security')
5c23128d
ZJS
207endif
208
209pamconfdir = get_option('pamconfdir')
210if pamconfdir == ''
bae66f4b 211 pamconfdir = join_paths(prefixdir, 'lib/pam.d')
5c23128d
ZJS
212endif
213
444d5863 214memory_accounting_default = get_option('memory-accounting-default')
36cf4507 215status_unit_format_default = get_option('status-unit-format-default')
444d5863 216
5c23128d 217conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
96d33e4a 218conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'system'))
5c23128d
ZJS
219conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
220conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
221conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
452d2dfd 222conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
96164a39 223
f7c5427c 224conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
ceedbf81 225conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
96164a39 226
96d33e4a
ZJS
227conf.set_quoted('USER_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'user'))
228conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
5c23128d 229conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
e17e5ba9 230conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
e17e5ba9 231conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
ce906769 232conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
e17e5ba9 233conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
7f2806d5 234conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
ce906769 235conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
e17e5ba9 236conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
e17e5ba9
MB
237conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
238conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
239conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
74344a17 240conf.set_quoted('ROOTPREFIX', rootprefixdir)
b612c26c 241conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
3131bfe3 242conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
e17e5ba9
MB
243conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
244conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
08b04ec7 245conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', join_paths(rootlibexecdir, 'systemd-veritysetup'))
96d33e4a
ZJS
246conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
247conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
248conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
249conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
5c23128d
ZJS
250conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
251conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
e17e5ba9
MB
252conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
253conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
e2d41370 254conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
49cdae63 255conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
5c23128d 256conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
e17e5ba9 257conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
5c23128d
ZJS
258conf.set_quoted('LIBDIR', libdir)
259conf.set_quoted('ROOTLIBDIR', rootlibdir)
260conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
261conf.set_quoted('BOOTLIBDIR', bootlibdir)
e17e5ba9
MB
262conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
263conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
1d7579c4 264conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', join_paths(rootlibexecdir, 'systemd-import-fs'))
e17e5ba9
MB
265conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
266conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
267conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
268conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
70a5db58 269conf.set_quoted('SYSTEMD_HOMEWORK_PATH', join_paths(rootlibexecdir, 'systemd-homework'))
d093b62c 270conf.set_quoted('SYSTEMD_USERWORK_PATH', join_paths(rootlibexecdir, 'systemd-userwork'))
30538ff1 271conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
7f672e86 272conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
36cf4507 273conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
5c23128d 274
5c23128d 275substs.set('prefix', prefixdir)
1c2c7c6c 276substs.set('rootprefix', rootprefixdir)
23bdba61 277substs.set('rootprefix_noslash', rootprefixdir_noslash)
3131bfe3
ZJS
278substs.set('exec_prefix', prefixdir)
279substs.set('libdir', libdir)
280substs.set('rootlibdir', rootlibdir)
281substs.set('includedir', includedir)
1c2c7c6c 282substs.set('sysconfdir', sysconfdir)
3131bfe3
ZJS
283substs.set('bindir', bindir)
284substs.set('rootbindir', rootbindir)
5c23128d
ZJS
285substs.set('rootlibexecdir', rootlibexecdir)
286substs.set('systemunitdir', systemunitdir)
287substs.set('userunitdir', userunitdir)
288substs.set('systempresetdir', systempresetdir)
289substs.set('userpresetdir', userpresetdir)
290substs.set('udevhwdbdir', udevhwdbdir)
291substs.set('udevrulesdir', udevrulesdir)
3131bfe3 292substs.set('udevlibexecdir', udevlibexecdir)
424e80b4 293substs.set('environmentdir', environmentdir)
5c23128d
ZJS
294substs.set('catalogdir', catalogdir)
295substs.set('tmpfilesdir', tmpfilesdir)
296substs.set('sysusersdir', sysusersdir)
297substs.set('sysctldir', sysctldir)
298substs.set('binfmtdir', binfmtdir)
299substs.set('modulesloaddir', modulesloaddir)
424e80b4 300substs.set('modprobedir', modprobedir)
5c23128d
ZJS
301substs.set('systemgeneratordir', systemgeneratordir)
302substs.set('usergeneratordir', usergeneratordir)
303substs.set('systemenvgeneratordir', systemenvgeneratordir)
304substs.set('userenvgeneratordir', userenvgeneratordir)
305substs.set('systemshutdowndir', systemshutdowndir)
306substs.set('systemsleepdir', systemsleepdir)
2a4c156d 307substs.set('CERTIFICATEROOT', get_option('certificate-root'))
e17e5ba9 308substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
2a4c156d
ZJS
309substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
310substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
bd7e6aa7 311substs.set('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
452d2dfd 312substs.set('RC_LOCAL_PATH', get_option('rc-local'))
444d5863 313substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
36cf4507 314substs.set('STATUS_UNIT_FORMAT_DEFAULT', status_unit_format_default)
c02b6ee4 315substs.set('HIGH_RLIMIT_NOFILE', conf.get('HIGH_RLIMIT_NOFILE'))
81e06775 316substs.set('BUILD_ROOT', project_build_root)
5c23128d
ZJS
317
318#####################################################################
319
320cc = meson.get_compiler('c')
321pkgconfig = import('pkgconfig')
dd1e33c8 322check_compilation_sh = find_program('tools/check-compilation.sh')
b68dfb9e 323meson_build_sh = find_program('tools/meson-build.sh')
5c23128d 324
d3da291e
ZJS
325want_tests = get_option('tests')
326slow_tests = want_tests != 'false' and get_option('slow-tests')
c56463fd 327fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
d3da291e
ZJS
328install_tests = get_option('install-tests')
329
46e63a2a 330if add_languages('cpp', required : fuzzer_build)
3b2bdd62 331 # Used only for tests
e9f4f566
ZJS
332 cxx = meson.get_compiler('cpp')
333 cxx_cmd = ' '.join(cxx.cmd_array())
1b2acaa7 334else
9b0ca019 335 cxx_cmd = ''
94e2523b
ZJS
336endif
337
31e57a35 338if want_libfuzzer
9c5c4677
EV
339 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
340 if fuzzing_engine.found()
341 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
342 elif cc.has_argument('-fsanitize=fuzzer-no-link')
343 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
344 else
345 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
346 endif
c09edc79 347elif want_ossfuzz
7db7d5b7
JR
348 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
349endif
350
e9f4f566
ZJS
351# Those generate many false positives, and we do not want to change the code to
352# avoid them.
353basic_disabled_warnings = [
354 '-Wno-unused-parameter',
355 '-Wno-missing-field-initializers',
356 '-Wno-unused-result',
357 '-Wno-format-signedness',
358]
e9f4f566 359
30a4ddff 360possible_cc_flags = [
30a4ddff
YW
361 '-Werror=undef',
362 '-Wlogical-op',
363 '-Wmissing-include-dirs',
364 '-Wold-style-definition',
365 '-Wpointer-arith',
366 '-Winit-self',
30a4ddff
YW
367 '-Wfloat-equal',
368 '-Wsuggest-attribute=noreturn',
369 '-Werror=missing-prototypes',
370 '-Werror=implicit-function-declaration',
371 '-Werror=missing-declarations',
372 '-Werror=return-type',
373 '-Werror=incompatible-pointer-types',
374 '-Werror=format=2',
375 '-Wstrict-prototypes',
376 '-Wredundant-decls',
377 '-Wmissing-noreturn',
378 '-Wimplicit-fallthrough=5',
379 '-Wshadow',
380 '-Wendif-labels',
381 '-Wstrict-aliasing=2',
382 '-Wwrite-strings',
383 '-Werror=overflow',
b05ecb8c 384 '-Werror=shift-count-overflow',
d28b67d4 385 '-Werror=shift-overflow=2',
30a4ddff
YW
386 '-Wdate-time',
387 '-Wnested-externs',
bf7efeb1
FB
388
389 # negative arguments are correctly detected starting with meson 0.46.
eed33623
ZJS
390 '-Wno-error=#warnings', # clang
391 '-Wno-string-plus-int', # clang
bf7efeb1 392
bf7efeb1
FB
393 # Disable -Wmaybe-uninitialized, since it's noisy on gcc 8 with
394 # optimizations enabled, producing essentially false positives.
395 '-Wno-maybe-uninitialized',
396
30a4ddff
YW
397 '-ffast-math',
398 '-fno-common',
399 '-fdiagnostics-show-option',
400 '-fno-strict-aliasing',
401 '-fvisibility=hidden',
402 '-fstack-protector',
403 '-fstack-protector-strong',
404 '--param=ssp-buffer-size=4',
405]
406
407# --as-needed and --no-undefined are provided by meson by default,
408# run mesonconf to see what is enabled
409possible_link_flags = [
410 '-Wl,-z,relro',
411 '-Wl,-z,now',
68e70ac2 412 '-fstack-protector',
30a4ddff 413]
5c23128d 414
30a4ddff
YW
415if cc.get_id() == 'clang'
416 possible_cc_flags += [
417 '-Wno-typedef-redefinition',
418 '-Wno-gnu-variable-sized-type-not-at-end',
419 ]
420endif
421
422if get_option('buildtype') != 'debug'
423 possible_cc_flags += [
424 '-ffunction-sections',
425 '-fdata-sections',
426 ]
427
428 possible_link_flags += '-Wl,--gc-sections'
429endif
430
e9f4f566 431add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
30a4ddff 432add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
7a6397d2 433add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
30a4ddff 434
94c0c5b7
ZJS
435have = cc.has_argument('-Wzero-length-bounds')
436conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
437
9e70f2f8 438if cc.compiles('''
5c23128d
ZJS
439 #include <time.h>
440 #include <inttypes.h>
441 typedef uint64_t usec_t;
442 usec_t now(clockid_t clock);
443 int main(void) {
444 struct timespec now;
445 return 0;
446 }
38c1c96d 447''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
37efbbd8 448 add_project_arguments('-Werror=shadow', language : 'c')
5c23128d
ZJS
449endif
450
e9f4f566
ZJS
451if cxx_cmd != ''
452 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
453endif
454
0e3cc902 455cpp = ' '.join(cc.cmd_array()) + ' -E'
9cc0e6e9 456
6695c200
ZJS
457has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
458
5c23128d
ZJS
459#####################################################################
460# compilation result tests
461
2c201c21
ZJS
462conf.set('_GNU_SOURCE', true)
463conf.set('__SANE_USERSPACE_TYPES__', true)
6695c200 464conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
5c23128d 465
5c23128d
ZJS
466conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
467conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
468conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
469conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
470
471decl_headers = '''
472#include <uchar.h>
4c2e1b39 473#include <sys/stat.h>
5c23128d 474'''
5c23128d
ZJS
475
476foreach decl : ['char16_t',
477 'char32_t',
4c2e1b39 478 'struct statx',
5c23128d 479 ]
2c201c21
ZJS
480
481 # We get -1 if the size cannot be determined
9c869d08
ZJS
482 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
483
484 if decl == 'struct statx'
485 if have
486 want_linux_stat_h = false
487 else
488 have = cc.sizeof(decl,
489 prefix : decl_headers + '#include <linux/stat.h>',
490 args : '-D_GNU_SOURCE') > 0
491 want_linux_stat_h = have
492 endif
493 endif
494
349cc4a5 495 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
5c23128d
ZJS
496endforeach
497
9c869d08 498conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
75720bff 499
5c23128d 500foreach ident : ['secure_getenv', '__secure_getenv']
349cc4a5 501 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
5c23128d
ZJS
502endforeach
503
504foreach ident : [
85db59b7 505 ['memfd_create', '''#include <sys/mman.h>'''],
7b961e40
LP
506 ['gettid', '''#include <sys/types.h>
507 #include <unistd.h>'''],
3c042add
LP
508 ['pivot_root', '''#include <stdlib.h>
509 #include <unistd.h>'''], # no known header declares pivot_root
85db59b7 510 ['name_to_handle_at', '''#include <sys/types.h>
37efbbd8
ZJS
511 #include <sys/stat.h>
512 #include <fcntl.h>'''],
85db59b7 513 ['setns', '''#include <sched.h>'''],
2acfd0ff
LP
514 ['renameat2', '''#include <stdio.h>
515 #include <fcntl.h>'''],
37efbbd8
ZJS
516 ['kcmp', '''#include <linux/kcmp.h>'''],
517 ['keyctl', '''#include <sys/types.h>
518 #include <keyutils.h>'''],
85db59b7 519 ['copy_file_range', '''#include <sys/syscall.h>
37efbbd8 520 #include <unistd.h>'''],
71e5200f
DM
521 ['bpf', '''#include <sys/syscall.h>
522 #include <unistd.h>'''],
4c2e1b39
LP
523 ['statx', '''#include <sys/types.h>
524 #include <sys/stat.h>
525 #include <unistd.h>'''],
aa484f35 526 ['explicit_bzero' , '''#include <string.h>'''],
5bb20fd3 527 ['reallocarray', '''#include <stdlib.h>'''],
b070c7c0
MS
528 ['set_mempolicy', '''#include <stdlib.h>
529 #include <unistd.h>'''],
530 ['get_mempolicy', '''#include <stdlib.h>
531 #include <unistd.h>'''],
5f152f43
LP
532 ['pidfd_send_signal', '''#include <stdlib.h>
533 #include <unistd.h>
534 #include <signal.h>
535 #include <sys/wait.h>'''],
536 ['pidfd_open', '''#include <stdlib.h>
537 #include <unistd.h>
538 #include <signal.h>
539 #include <sys/wait.h>'''],
5ead4e85
LP
540 ['rt_sigqueueinfo', '''#include <stdlib.h>
541 #include <unistd.h>
542 #include <signal.h>
543 #include <sys/wait.h>'''],
4b6f74f5 544 ['mallinfo', '''#include <malloc.h>'''],
8939eeae 545 ['execveat', '''#include <unistd.h>'''],
441e0fdb 546 ['close_range', '''#include <unistd.h>'''],
37efbbd8
ZJS
547]
548
85db59b7 549 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
4b9545f1 550 conf.set10('HAVE_' + ident[0].to_upper(), have)
5c23128d
ZJS
551endforeach
552
85db59b7 553if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
349cc4a5 554 conf.set10('USE_SYS_RANDOM_H', true)
4b9545f1 555 conf.set10('HAVE_GETRANDOM', true)
4984c8be
ZJS
556else
557 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
349cc4a5 558 conf.set10('USE_SYS_RANDOM_H', false)
4b9545f1 559 conf.set10('HAVE_GETRANDOM', have)
4984c8be
ZJS
560endif
561
5c23128d
ZJS
562#####################################################################
563
064b8e2c
DDM
564version_tag = get_option('version-tag')
565if version_tag != ''
566 vcs_data = configuration_data()
567 vcs_data.set('VCS_TAG', version_tag)
568 version_h = configure_file(configuration : vcs_data,
569 input : 'src/version/version.h.in',
570 output : 'version.h')
571else
572 vcs_tagger = [
573 project_source_root + '/tools/meson-vcs-tag.sh',
574 project_source_root,
575 meson.project_version()]
576
577 version_h = vcs_tag(
578 input : 'src/version/version.h.in',
579 output : 'version.h',
580 command: vcs_tagger)
581endif
d1084aa2
LT
582
583versiondep = declare_dependency(sources: version_h)
584
5c23128d 585sed = find_program('sed')
5c23128d 586awk = find_program('awk')
d730e2d1 587m4 = find_program('m4')
5c23128d 588stat = find_program('stat')
d68b342b 589git = find_program('git', required : false)
b68dfb9e 590env = find_program('env')
b1ffacb6 591perl = find_program('perl', required : false)
5c23128d 592
1485aacb 593meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
94e75a54 594mkdir_p = 'mkdir -p $DESTDIR/@0@'
d83f4f50
ZJS
595test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
596splash_bmp = files('test/splash.bmp')
94e75a54 597
5c23128d
ZJS
598# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
599# /usr/sbin, /sbin, and fall back to the default from middle column.
2fa645f1 600progs = [['quotaon', '/usr/sbin/quotaon' ],
5c23128d 601 ['quotacheck', '/usr/sbin/quotacheck' ],
5c23128d
ZJS
602 ['kmod', '/usr/bin/kmod' ],
603 ['kexec', '/usr/sbin/kexec' ],
604 ['sulogin', '/usr/sbin/sulogin' ],
605 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
606 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
607 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
608 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
6db90462 609 ['nologin', '/usr/sbin/nologin', ],
5c23128d
ZJS
610 ]
611foreach prog : progs
37efbbd8
ZJS
612 path = get_option(prog[0] + '-path')
613 if path != ''
614 message('Using @1@ for @0@'.format(prog[0], path))
615 else
616 exe = find_program(prog[0],
617 '/usr/sbin/' + prog[0],
618 '/sbin/' + prog[0],
619 required: false)
620 path = exe.found() ? exe.path() : prog[1]
621 endif
622 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
623 conf.set_quoted(name, path)
624 substs.set(name, path)
5c23128d
ZJS
625endforeach
626
2fa645f1
MG
627conf.set_quoted('TELINIT', get_option('telinit-path'))
628
1276a9f6 629if run_command('ln', '--relative', '--help').returncode() != 0
cd001016 630 error('ln does not support --relative (added in coreutils 8.16)')
1276a9f6 631endif
5c23128d
ZJS
632
633############################################################
634
635gperf = find_program('gperf')
636
637gperf_test_format = '''
638#include <string.h>
639const char * in_word_set(const char *, @0@);
640@1@
641'''
642gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
643gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
644gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
645if cc.compiles(gperf_test)
37efbbd8 646 gperf_len_type = 'size_t'
5c23128d 647else
37efbbd8
ZJS
648 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
649 if cc.compiles(gperf_test)
650 gperf_len_type = 'unsigned'
651 else
652 error('unable to determine gperf len type')
653 endif
5c23128d
ZJS
654endif
655message('gperf len type is @0@'.format(gperf_len_type))
37efbbd8
ZJS
656conf.set('GPERF_LEN_TYPE', gperf_len_type,
657 description : 'The type of gperf "len" parameter')
5c23128d
ZJS
658
659############################################################
660
661if not cc.has_header('sys/capability.h')
37efbbd8 662 error('POSIX caps headers not found')
5c23128d 663endif
9f555bba 664foreach header : ['crypt.h',
5c23128d
ZJS
665 'linux/memfd.h',
666 'linux/vm_sockets.h',
af8786b1 667 'sys/auxv.h',
5c23128d
ZJS
668 'valgrind/memcheck.h',
669 'valgrind/valgrind.h',
670 ]
2c201c21 671
349cc4a5
ZJS
672 conf.set10('HAVE_' + header.underscorify().to_upper(),
673 cc.has_header(header))
5c23128d
ZJS
674endforeach
675
676############################################################
677
eef4b800
ZJS
678fallback_hostname = get_option('fallback-hostname')
679if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
680 error('Invalid fallback-hostname configuration')
681 # A more extensive test is done in test-hostname-util. Let's catch
682 # the most obvious errors here so we don't fail with an assert later.
683endif
684conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
685
5c23128d
ZJS
686default_hierarchy = get_option('default-hierarchy')
687conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
688 description : 'default cgroup hierarchy as string')
689if default_hierarchy == 'legacy'
37efbbd8 690 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
5c23128d 691elif default_hierarchy == 'hybrid'
37efbbd8 692 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
5c23128d 693else
37efbbd8 694 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
5c23128d
ZJS
695endif
696
06da5c63
ZJS
697default_net_naming_scheme = get_option('default-net-naming-scheme')
698conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
699
5c23128d 700time_epoch = get_option('time-epoch')
ac09340e 701if time_epoch == -1
0390b094
ZJS
702 time_epoch = run_command('sh', ['-c', 'echo "$SOURCE_DATE_EPOCH"']).stdout().strip()
703 if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
bd190899
DDM
704 # If we're in a git repository, use the creation time of the latest git tag.
705 latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
0390b094
ZJS
706 time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout()
707 endif
708 if time_epoch == ''
6dbf352c 709 NEWS = files('NEWS')
0390b094 710 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
6dbf352c 711 endif
0390b094 712 time_epoch = time_epoch.to_int()
5c23128d 713endif
5c23128d
ZJS
714conf.set('TIME_EPOCH', time_epoch)
715
fc1a5d1a
ZJS
716foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
717 ['system-uid-max', 'SYS_UID_MAX', 999],
718 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
719 ['system-gid-max', 'SYS_GID_MAX', 999]]
720 v = get_option(tuple[0])
721 if v == -1
722 v = run_command(
723 awk,
724 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
725 '/etc/login.defs').stdout().strip()
726 if v == ''
727 v = tuple[2]
728 else
729 v = v.to_int()
730 endif
2f62cf35 731 endif
fc1a5d1a
ZJS
732 conf.set(tuple[0].underscorify().to_upper(), v)
733 substs.set(tuple[0].underscorify().to_upper(), v)
734endforeach
735if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
736 error('Invalid uid allocation range')
5c23128d 737endif
fc1a5d1a
ZJS
738if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
739 error('Invalid gid allocation range')
5c23128d 740endif
5c23128d 741
ac09340e
YW
742dynamic_uid_min = get_option('dynamic-uid-min')
743dynamic_uid_max = get_option('dynamic-uid-max')
87d5e4f2
LP
744conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
745conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
746substs.set('dynamicuidmin', dynamic_uid_min)
747substs.set('dynamicuidmax', dynamic_uid_max)
748
ac09340e
YW
749container_uid_base_min = get_option('container-uid-base-min')
750container_uid_base_max = get_option('container-uid-base-max')
87d5e4f2
LP
751conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
752conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
753substs.set('containeruidbasemin', container_uid_base_min)
754substs.set('containeruidbasemax', container_uid_base_max)
755
afde4574
LP
756nobody_user = get_option('nobody-user')
757nobody_group = get_option('nobody-group')
758
2484bff3
CQ
759if not meson.is_cross_build()
760 getent_result = run_command('getent', 'passwd', '65534')
761 if getent_result.returncode() == 0
762 name = getent_result.stdout().split(':')[0]
763 if name != nobody_user
764 warning('\n' +
765 'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
766 'Your build will result in an user table setup that is incompatible with the local system.')
767 endif
afde4574 768 endif
2484bff3
CQ
769 id_result = run_command('id', '-u', nobody_user)
770 if id_result.returncode() == 0
771 id = id_result.stdout().to_int()
772 if id != 65534
773 warning('\n' +
774 'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
775 'Your build will result in an user table setup that is incompatible with the local system.')
776 endif
afde4574 777 endif
afde4574 778
2484bff3
CQ
779 getent_result = run_command('getent', 'group', '65534')
780 if getent_result.returncode() == 0
781 name = getent_result.stdout().split(':')[0]
782 if name != nobody_group
783 warning('\n' +
784 'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
785 'Your build will result in an group table setup that is incompatible with the local system.')
786 endif
afde4574 787 endif
2484bff3
CQ
788 id_result = run_command('id', '-g', nobody_group)
789 if id_result.returncode() == 0
790 id = id_result.stdout().to_int()
791 if id != 65534
792 warning('\n' +
793 'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
794 'Your build will result in an group table setup that is incompatible with the local system.')
795 endif
afde4574
LP
796 endif
797endif
8374cc62 798if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
8ea9fad7
YW
799 warning('\n' +
800 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
801 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
8374cc62 802endif
afde4574
LP
803
804conf.set_quoted('NOBODY_USER_NAME', nobody_user)
805conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
60712021
YW
806substs.set('NOBODY_USER_NAME', nobody_user)
807substs.set('NOBODY_GROUP_NAME', nobody_group)
87d5e4f2 808
5c23128d
ZJS
809tty_gid = get_option('tty-gid')
810conf.set('TTY_GID', tty_gid)
2a4c156d 811substs.set('TTY_GID', tty_gid)
5c23128d 812
2aed63f4 813# Ensure provided GID argument is numeric, otherwise fall back to default assignment
ac09340e
YW
814users_gid = get_option('users-gid')
815substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid)
84786b8e 816
348b4437
YW
817conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
818conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
5c23128d 819
ace5e311
MB
820dev_kvm_mode = get_option('dev-kvm-mode')
821substs.set('DEV_KVM_MODE', dev_kvm_mode)
822conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
055a083a
MB
823group_render_mode = get_option('group-render-mode')
824substs.set('GROUP_RENDER_MODE', group_render_mode)
825conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
5c23128d 826
2a4c156d
ZJS
827kill_user_processes = get_option('default-kill-user-processes')
828conf.set10('KILL_USER_PROCESSES', kill_user_processes)
c7f7e859 829conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
2a4c156d 830substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
5c23128d 831
829257d1
ZJS
832dns_servers = get_option('dns-servers')
833conf.set_quoted('DNS_SERVERS', dns_servers)
834substs.set('DNS_SERVERS', dns_servers)
5c23128d 835
829257d1
ZJS
836ntp_servers = get_option('ntp-servers')
837conf.set_quoted('NTP_SERVERS', ntp_servers)
838substs.set('NTP_SERVERS', ntp_servers)
5c23128d 839
8ca9e92c 840default_locale = get_option('default-locale')
03475e22 841if default_locale == ''
50f2fc77
JH
842 if not meson.is_cross_build()
843 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
844 default_locale = run_command(choose_default_locale_sh).stdout().strip()
845 else
846 default_locale = 'C.UTF-8'
847 endif
03475e22 848endif
8ca9e92c
DR
849conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
850
8f20232f
MK
851localegen_path = get_option('localegen-path')
852have = false
853if localegen_path != ''
854 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
855 have = true
856endif
857conf.set10('HAVE_LOCALEGEN', have)
858
5c23128d
ZJS
859conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
860
21d0dd5a 861service_watchdog = get_option('service-watchdog')
7bc9ea51
AZ
862watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
863substs.set('SERVICE_WATCHDOG', watchdog_value)
21d0dd5a 864
3131bfe3
ZJS
865substs.set('SUSHELL', get_option('debug-shell'))
866substs.set('DEBUGTTY', get_option('debug-tty'))
93912e87 867conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
3131bfe3 868
349cc4a5
ZJS
869enable_debug_hashmap = false
870enable_debug_mmap_cache = false
d6601495 871enable_debug_siphash = false
8f6b442a 872foreach name : get_option('debug-extra')
ad7aa760
YW
873 if name == 'hashmap'
874 enable_debug_hashmap = true
875 elif name == 'mmap-cache'
876 enable_debug_mmap_cache = true
d6601495
YW
877 elif name == 'siphash'
878 enable_debug_siphash = true
ad7aa760
YW
879 else
880 message('unknown debug option "@0@", ignoring'.format(name))
881 endif
882endforeach
349cc4a5
ZJS
883conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
884conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
d6601495 885conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
671677da 886
d18cb393 887conf.set10('VALGRIND', get_option('valgrind'))
fd5dec9a 888conf.set10('LOG_TRACE', get_option('log-trace'))
d18cb393 889
3602ca6f
ZJS
890default_user_path = get_option('user-path')
891if default_user_path != ''
892 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
5bc655cd
ZJS
893 default_user_path_display = default_user_path
894else
895 # meson 0.49 fails when ?: is used in .format()
896 default_user_path_display = '(same as system services)'
3602ca6f
ZJS
897endif
898
5bc655cd 899
5c23128d
ZJS
900#####################################################################
901
902threads = dependency('threads')
903librt = cc.find_library('rt')
904libm = cc.find_library('m')
905libdl = cc.find_library('dl')
906libcrypt = cc.find_library('crypt')
907
06ca077b 908crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
e8644a41 909foreach ident : [
feee7f62
LB
910 ['crypt_ra', crypt_header],
911 ['crypt_preferred_method', crypt_header],
912 ['crypt_gensalt_ra', crypt_header]]
e8644a41
ZJS
913
914 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
915 dependencies : libcrypt)
916 conf.set10('HAVE_' + ident[0].to_upper(), have)
917endforeach
918
1800cc85
ZJS
919libcap = dependency('libcap', required : false)
920if not libcap.found()
921 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
922 libcap = cc.find_library('cap')
923endif
924
5c23128d 925libmount = dependency('mount',
c0b4b0f8 926 version : fuzzer_build ? '>= 0' : '>= 2.30')
5c23128d 927
e594a3b1
LP
928want_libfdisk = get_option('fdisk')
929if want_libfdisk != 'false' and not skip_deps
930 libfdisk = dependency('fdisk',
e71f5585 931 version : '>= 2.33',
e594a3b1
LP
932 required : want_libfdisk == 'true')
933 have = libfdisk.found()
934else
935 have = false
936 libfdisk = []
937endif
938conf.set10('HAVE_LIBFDISK', have)
939
70a5db58
LP
940want_pwquality = get_option('pwquality')
941if want_pwquality != 'false' and not skip_deps
942 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
943 have = libpwquality.found()
944else
945 have = false
946 libpwquality = []
947endif
948conf.set10('HAVE_PWQUALITY', have)
949
5c23128d 950want_seccomp = get_option('seccomp')
87ac55a1 951if want_seccomp != 'false' and not skip_deps
37efbbd8 952 libseccomp = dependency('libseccomp',
9f0e9c01 953 version : '>= 2.3.1',
37efbbd8 954 required : want_seccomp == 'true')
349cc4a5 955 have = libseccomp.found()
5c23128d 956else
349cc4a5 957 have = false
37efbbd8 958 libseccomp = []
5c23128d 959endif
349cc4a5 960conf.set10('HAVE_SECCOMP', have)
5c23128d
ZJS
961
962want_selinux = get_option('selinux')
87ac55a1 963if want_selinux != 'false' and not skip_deps
37efbbd8
ZJS
964 libselinux = dependency('libselinux',
965 version : '>= 2.1.9',
966 required : want_selinux == 'true')
349cc4a5 967 have = libselinux.found()
5c23128d 968else
349cc4a5 969 have = false
37efbbd8 970 libselinux = []
5c23128d 971endif
349cc4a5 972conf.set10('HAVE_SELINUX', have)
5c23128d
ZJS
973
974want_apparmor = get_option('apparmor')
87ac55a1 975if want_apparmor != 'false' and not skip_deps
37efbbd8 976 libapparmor = dependency('libapparmor',
2ffadd3c 977 version : '>= 2.13',
37efbbd8 978 required : want_apparmor == 'true')
349cc4a5 979 have = libapparmor.found()
5c23128d 980else
349cc4a5 981 have = false
37efbbd8 982 libapparmor = []
5c23128d 983endif
349cc4a5 984conf.set10('HAVE_APPARMOR', have)
5c23128d 985
5c23128d
ZJS
986smack_run_label = get_option('smack-run-label')
987if smack_run_label != ''
37efbbd8 988 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
5c23128d
ZJS
989endif
990
3ca0cb73
ZJS
991want_polkit = get_option('polkit')
992install_polkit = false
993install_polkit_pkla = false
87ac55a1 994if want_polkit != 'false' and not skip_deps
37efbbd8 995 install_polkit = true
3ca0cb73 996
37efbbd8
ZJS
997 libpolkit = dependency('polkit-gobject-1',
998 required : false)
999 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1000 message('Old polkit detected, will install pkla files')
1001 install_polkit_pkla = true
1002 endif
3ca0cb73 1003endif
349cc4a5 1004conf.set10('ENABLE_POLKIT', install_polkit)
3ca0cb73 1005
36f0387e 1006want_acl = get_option('acl')
87ac55a1 1007if want_acl != 'false' and not skip_deps
36f0387e 1008 libacl = cc.find_library('acl', required : want_acl == 'true')
349cc4a5 1009 have = libacl.found()
36f0387e 1010else
349cc4a5 1011 have = false
36f0387e
ZJS
1012 libacl = []
1013endif
349cc4a5 1014conf.set10('HAVE_ACL', have)
36f0387e 1015
5c23128d 1016want_audit = get_option('audit')
87ac55a1 1017if want_audit != 'false' and not skip_deps
37efbbd8 1018 libaudit = dependency('audit', required : want_audit == 'true')
349cc4a5 1019 have = libaudit.found()
5c23128d 1020else
349cc4a5 1021 have = false
37efbbd8 1022 libaudit = []
5c23128d 1023endif
349cc4a5 1024conf.set10('HAVE_AUDIT', have)
5c23128d
ZJS
1025
1026want_blkid = get_option('blkid')
87ac55a1 1027if want_blkid != 'false' and not skip_deps
37efbbd8 1028 libblkid = dependency('blkid', required : want_blkid == 'true')
349cc4a5 1029 have = libblkid.found()
4fcc033b
KZ
1030
1031 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1032 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
5c23128d 1033else
349cc4a5 1034 have = false
37efbbd8 1035 libblkid = []
5c23128d 1036endif
349cc4a5 1037conf.set10('HAVE_BLKID', have)
5c23128d
ZJS
1038
1039want_kmod = get_option('kmod')
87ac55a1 1040if want_kmod != 'false' and not skip_deps
37efbbd8
ZJS
1041 libkmod = dependency('libkmod',
1042 version : '>= 15',
1043 required : want_kmod == 'true')
349cc4a5 1044 have = libkmod.found()
5c23128d 1045else
349cc4a5 1046 have = false
37efbbd8 1047 libkmod = []
5c23128d 1048endif
349cc4a5 1049conf.set10('HAVE_KMOD', have)
5c23128d
ZJS
1050
1051want_pam = get_option('pam')
87ac55a1 1052if want_pam != 'false' and not skip_deps
37efbbd8
ZJS
1053 libpam = cc.find_library('pam', required : want_pam == 'true')
1054 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
349cc4a5 1055 have = libpam.found() and libpam_misc.found()
5c23128d 1056else
349cc4a5 1057 have = false
37efbbd8
ZJS
1058 libpam = []
1059 libpam_misc = []
5c23128d 1060endif
349cc4a5 1061conf.set10('HAVE_PAM', have)
5c23128d
ZJS
1062
1063want_microhttpd = get_option('microhttpd')
87ac55a1 1064if want_microhttpd != 'false' and not skip_deps
37efbbd8
ZJS
1065 libmicrohttpd = dependency('libmicrohttpd',
1066 version : '>= 0.9.33',
1067 required : want_microhttpd == 'true')
349cc4a5 1068 have = libmicrohttpd.found()
5c23128d 1069else
349cc4a5 1070 have = false
37efbbd8 1071 libmicrohttpd = []
5c23128d 1072endif
349cc4a5 1073conf.set10('HAVE_MICROHTTPD', have)
5c23128d
ZJS
1074
1075want_libcryptsetup = get_option('libcryptsetup')
87ac55a1 1076if want_libcryptsetup != 'false' and not skip_deps
37efbbd8 1077 libcryptsetup = dependency('libcryptsetup',
d90874b4 1078 version : '>= 2.0.1',
37efbbd8 1079 required : want_libcryptsetup == 'true')
349cc4a5 1080 have = libcryptsetup.found()
70a5db58
LP
1081
1082 conf.set10('HAVE_CRYPT_SET_METADATA_SIZE',
1083 have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup))
c2923fdc
LB
1084 conf.set10('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY',
1085 have and cc.has_function('crypt_activate_by_signed_key', dependencies : libcryptsetup))
3c2c8e62
LB
1086 conf.set10('HAVE_CRYPT_TOKEN_MAX',
1087 have and cc.has_function('crypt_token_max', dependencies : libcryptsetup))
5c23128d 1088else
349cc4a5 1089 have = false
37efbbd8 1090 libcryptsetup = []
5c23128d 1091endif
349cc4a5 1092conf.set10('HAVE_LIBCRYPTSETUP', have)
5c23128d
ZJS
1093
1094want_libcurl = get_option('libcurl')
87ac55a1 1095if want_libcurl != 'false' and not skip_deps
37efbbd8
ZJS
1096 libcurl = dependency('libcurl',
1097 version : '>= 7.32.0',
1098 required : want_libcurl == 'true')
349cc4a5 1099 have = libcurl.found()
5c23128d 1100else
349cc4a5 1101 have = false
37efbbd8 1102 libcurl = []
5c23128d 1103endif
349cc4a5 1104conf.set10('HAVE_LIBCURL', have)
435b5ba8 1105conf.set10('CURL_NO_OLDIES', get_option('mode') == 'developer')
5c23128d
ZJS
1106
1107want_libidn = get_option('libidn')
87057e24
ZJS
1108want_libidn2 = get_option('libidn2')
1109if want_libidn == 'true' and want_libidn2 == 'true'
1110 error('libidn and libidn2 cannot be requested simultaneously')
1111endif
1112
1b931399
YW
1113if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1114 libidn = dependency('libidn2',
1115 required : want_libidn2 == 'true')
349cc4a5 1116 have = libidn.found()
87057e24 1117else
349cc4a5 1118 have = false
87057e24
ZJS
1119 libidn = []
1120endif
1b931399
YW
1121conf.set10('HAVE_LIBIDN2', have)
1122if not have and want_libidn != 'false' and not skip_deps
7f7ab228 1123 # libidn is used for both libidn and libidn2 objects
1b931399
YW
1124 libidn = dependency('libidn',
1125 required : want_libidn == 'true')
349cc4a5
ZJS
1126 have = libidn.found()
1127else
1128 have = false
5c23128d 1129endif
1b931399 1130conf.set10('HAVE_LIBIDN', have)
5c23128d
ZJS
1131
1132want_libiptc = get_option('libiptc')
87ac55a1 1133if want_libiptc != 'false' and not skip_deps
37efbbd8
ZJS
1134 libiptc = dependency('libiptc',
1135 required : want_libiptc == 'true')
349cc4a5 1136 have = libiptc.found()
5c23128d 1137else
349cc4a5 1138 have = false
37efbbd8 1139 libiptc = []
5c23128d 1140endif
349cc4a5 1141conf.set10('HAVE_LIBIPTC', have)
5c23128d
ZJS
1142
1143want_qrencode = get_option('qrencode')
87ac55a1 1144if want_qrencode != 'false' and not skip_deps
37efbbd8 1145 libqrencode = dependency('libqrencode',
a6c7811f 1146 version : '>= 4',
37efbbd8 1147 required : want_qrencode == 'true')
349cc4a5 1148 have = libqrencode.found()
5c23128d 1149else
349cc4a5 1150 have = false
37efbbd8 1151 libqrencode = []
5c23128d 1152endif
349cc4a5 1153conf.set10('HAVE_QRENCODE', have)
5c23128d 1154
a44fb601 1155want_gcrypt = get_option('gcrypt')
87ac55a1 1156if want_gcrypt != 'false' and not skip_deps
a44fb601
ZJS
1157 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1158 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
349cc4a5 1159 have = libgcrypt.found() and libgpg_error.found()
a44fb601 1160else
349cc4a5
ZJS
1161 have = false
1162endif
1163if not have
1164 # link to neither of the libs if one is not found
a44fb601
ZJS
1165 libgcrypt = []
1166 libgpg_error = []
1167endif
349cc4a5 1168conf.set10('HAVE_GCRYPT', have)
a44fb601 1169
5c23128d 1170want_gnutls = get_option('gnutls')
87ac55a1 1171if want_gnutls != 'false' and not skip_deps
37efbbd8
ZJS
1172 libgnutls = dependency('gnutls',
1173 version : '>= 3.1.4',
1174 required : want_gnutls == 'true')
349cc4a5 1175 have = libgnutls.found()
5c23128d 1176else
349cc4a5 1177 have = false
37efbbd8 1178 libgnutls = []
5c23128d 1179endif
349cc4a5 1180conf.set10('HAVE_GNUTLS', have)
5c23128d 1181
096cbdce 1182want_openssl = get_option('openssl')
87ac55a1 1183if want_openssl != 'false' and not skip_deps
096cbdce
IT
1184 libopenssl = dependency('openssl',
1185 version : '>= 1.1.0',
1186 required : want_openssl == 'true')
1187 have = libopenssl.found()
1188else
1189 have = false
1190 libopenssl = []
1191endif
1192conf.set10('HAVE_OPENSSL', have)
1193
839fddbe
LP
1194want_p11kit = get_option('p11kit')
1195if want_p11kit != 'false' and not skip_deps
1196 libp11kit = dependency('p11-kit-1',
6164ec4c
ZJS
1197 version : '>= 0.23.3',
1198 required : want_p11kit == 'true')
839fddbe
LP
1199 have = libp11kit.found()
1200else
1201 have = false
1202 libp11kit = []
1203endif
1204conf.set10('HAVE_P11KIT', have)
1205
af4fbd46
LP
1206want_libfido2 = get_option('libfido2')
1207if want_libfido2 != 'false' and not skip_deps
1208 libfido2 = dependency('libfido2',
1209 required : want_libfido2 == 'true')
1210 have = libfido2.found()
1211else
1212 have = false
1213 libfido2 = []
1214endif
1215conf.set10('HAVE_LIBFIDO2', have)
1216
5e521624
LP
1217want_tpm2 = get_option('tpm2')
1218if want_tpm2 != 'false' and not skip_deps
1219 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1220 required : want_tpm2 == 'true')
1221 have = tpm2.found()
1222else
1223 have = false
1224 tpm2 = []
1225endif
1226conf.set10('HAVE_TPM2', have)
1227
5c23128d 1228want_elfutils = get_option('elfutils')
87ac55a1 1229if want_elfutils != 'false' and not skip_deps
37efbbd8
ZJS
1230 libdw = dependency('libdw',
1231 required : want_elfutils == 'true')
349cc4a5 1232 have = libdw.found()
5c23128d 1233else
349cc4a5 1234 have = false
37efbbd8 1235 libdw = []
5c23128d 1236endif
349cc4a5 1237conf.set10('HAVE_ELFUTILS', have)
5c23128d
ZJS
1238
1239want_zlib = get_option('zlib')
87ac55a1 1240if want_zlib != 'false' and not skip_deps
37efbbd8
ZJS
1241 libz = dependency('zlib',
1242 required : want_zlib == 'true')
349cc4a5 1243 have = libz.found()
5c23128d 1244else
349cc4a5 1245 have = false
37efbbd8 1246 libz = []
5c23128d 1247endif
349cc4a5 1248conf.set10('HAVE_ZLIB', have)
5c23128d
ZJS
1249
1250want_bzip2 = get_option('bzip2')
87ac55a1 1251if want_bzip2 != 'false' and not skip_deps
37efbbd8
ZJS
1252 libbzip2 = cc.find_library('bz2',
1253 required : want_bzip2 == 'true')
349cc4a5 1254 have = libbzip2.found()
5c23128d 1255else
349cc4a5 1256 have = false
37efbbd8 1257 libbzip2 = []
5c23128d 1258endif
349cc4a5 1259conf.set10('HAVE_BZIP2', have)
5c23128d
ZJS
1260
1261want_xz = get_option('xz')
87ac55a1 1262if want_xz != 'false' and not skip_deps
37efbbd8
ZJS
1263 libxz = dependency('liblzma',
1264 required : want_xz == 'true')
d80b051c 1265 have_xz = libxz.found()
5c23128d 1266else
d80b051c 1267 have_xz = false
37efbbd8 1268 libxz = []
5c23128d 1269endif
d80b051c 1270conf.set10('HAVE_XZ', have_xz)
5c23128d
ZJS
1271
1272want_lz4 = get_option('lz4')
87ac55a1 1273if want_lz4 != 'false' and not skip_deps
37efbbd8 1274 liblz4 = dependency('liblz4',
e0a1d4b0 1275 version : '>= 1.3.0',
37efbbd8 1276 required : want_lz4 == 'true')
d80b051c 1277 have_lz4 = liblz4.found()
5c23128d 1278else
d80b051c 1279 have_lz4 = false
37efbbd8 1280 liblz4 = []
5c23128d 1281endif
d80b051c 1282conf.set10('HAVE_LZ4', have_lz4)
5c23128d 1283
ef5924aa
NL
1284want_zstd = get_option('zstd')
1285if want_zstd != 'false' and not skip_deps
1286 libzstd = dependency('libzstd',
1287 required : want_zstd == 'true',
1288 version : '>= 1.4.0')
d80b051c 1289 have_zstd = libzstd.found()
ef5924aa 1290else
d80b051c 1291 have_zstd = false
ef5924aa
NL
1292 libzstd = []
1293endif
d80b051c
LP
1294conf.set10('HAVE_ZSTD', have_zstd)
1295
1296conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
ef5924aa 1297
a44fb601 1298want_xkbcommon = get_option('xkbcommon')
87ac55a1 1299if want_xkbcommon != 'false' and not skip_deps
a44fb601
ZJS
1300 libxkbcommon = dependency('xkbcommon',
1301 version : '>= 0.3.0',
1302 required : want_xkbcommon == 'true')
349cc4a5 1303 have = libxkbcommon.found()
a44fb601 1304else
349cc4a5 1305 have = false
a44fb601
ZJS
1306 libxkbcommon = []
1307endif
349cc4a5 1308conf.set10('HAVE_XKBCOMMON', have)
a44fb601 1309
c4c978a0
ZJS
1310want_pcre2 = get_option('pcre2')
1311if want_pcre2 != 'false'
1312 libpcre2 = dependency('libpcre2-8',
1313 required : want_pcre2 == 'true')
1314 have = libpcre2.found()
1315else
1316 have = false
1317 libpcre2 = []
1318endif
1319conf.set10('HAVE_PCRE2', have)
1320
69e96427 1321want_glib = get_option('glib')
87ac55a1 1322if want_glib != 'false' and not skip_deps
37efbbd8
ZJS
1323 libglib = dependency('glib-2.0',
1324 version : '>= 2.22.0',
1325 required : want_glib == 'true')
1326 libgobject = dependency('gobject-2.0',
1327 version : '>= 2.22.0',
1328 required : want_glib == 'true')
1329 libgio = dependency('gio-2.0',
1330 required : want_glib == 'true')
2c201c21 1331 have = libglib.found() and libgobject.found() and libgio.found()
69e96427 1332else
349cc4a5 1333 have = false
37efbbd8
ZJS
1334 libglib = []
1335 libgobject = []
1336 libgio = []
69e96427 1337endif
349cc4a5 1338conf.set10('HAVE_GLIB', have)
69e96427
ZJS
1339
1340want_dbus = get_option('dbus')
87ac55a1 1341if want_dbus != 'false' and not skip_deps
37efbbd8
ZJS
1342 libdbus = dependency('dbus-1',
1343 version : '>= 1.3.2',
1344 required : want_dbus == 'true')
349cc4a5 1345 have = libdbus.found()
69e96427 1346else
349cc4a5 1347 have = false
37efbbd8 1348 libdbus = []
69e96427 1349endif
349cc4a5 1350conf.set10('HAVE_DBUS', have)
69e96427 1351
42303dcb 1352default_dnssec = get_option('default-dnssec')
87ac55a1 1353if skip_deps
b4081f3e
JR
1354 default_dnssec = 'no'
1355endif
349cc4a5 1356if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
42303dcb
YW
1357 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1358 default_dnssec = 'no'
1359endif
1360conf.set('DEFAULT_DNSSEC_MODE',
1361 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1362substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1363
56ddbf10
YW
1364dns_over_tls = get_option('dns-over-tls')
1365if dns_over_tls != 'false'
096cbdce
IT
1366 if dns_over_tls == 'openssl'
1367 have_gnutls = false
1368 else
38e053c5 1369 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
096cbdce
IT
1370 if dns_over_tls == 'gnutls' and not have_gnutls
1371 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1372 endif
56ddbf10 1373 endif
096cbdce
IT
1374 if dns_over_tls == 'gnutls' or have_gnutls
1375 have_openssl = false
1376 else
1377 have_openssl = conf.get('HAVE_OPENSSL') == 1
1378 if dns_over_tls != 'auto' and not have_openssl
1379 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
b349bc59 1380 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
096cbdce
IT
1381 endif
1382 endif
1383 have = have_gnutls or have_openssl
56ddbf10 1384else
be5536a6
MO
1385 have = false
1386 have_gnutls = false
1387 have_openssl = false
56ddbf10
YW
1388endif
1389conf.set10('ENABLE_DNS_OVER_TLS', have)
096cbdce
IT
1390conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1391conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
56ddbf10 1392
c9299be2 1393default_dns_over_tls = get_option('default-dns-over-tls')
87ac55a1 1394if skip_deps
c9299be2 1395 default_dns_over_tls = 'no'
5d67a7ae 1396endif
56ddbf10 1397if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
4310bfc2 1398 message('default-dns-over-tls cannot be enabled or set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.')
c9299be2 1399 default_dns_over_tls = 'no'
5d67a7ae 1400endif
c9299be2
IT
1401conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1402 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1403substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls)
5d67a7ae 1404
3614df05
ZJS
1405default_mdns = get_option('default-mdns')
1406conf.set('DEFAULT_MDNS_MODE',
1407 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1408substs.set('DEFAULT_MDNS_MODE', default_mdns)
1409
1410default_llmnr = get_option('default-llmnr')
1411conf.set('DEFAULT_LLMNR_MODE',
1412 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1413substs.set('DEFAULT_LLMNR_MODE', default_llmnr)
1414
e594a3b1
LP
1415want_repart = get_option('repart')
1416if want_repart != 'false'
1417 have = (conf.get('HAVE_OPENSSL') == 1 and
1418 conf.get('HAVE_LIBFDISK') == 1)
1419 if want_repart == 'true' and not have
1420 error('repart support was requested, but dependencies are not available')
1421 endif
1422else
1423 have = false
1424endif
1425conf.set10('ENABLE_REPART', have)
1426
5c23128d 1427want_importd = get_option('importd')
4390be30 1428if want_importd != 'false'
349cc4a5
ZJS
1429 have = (conf.get('HAVE_LIBCURL') == 1 and
1430 conf.get('HAVE_ZLIB') == 1 and
349cc4a5
ZJS
1431 conf.get('HAVE_XZ') == 1 and
1432 conf.get('HAVE_GCRYPT') == 1)
1433 if want_importd == 'true' and not have
37efbbd8
ZJS
1434 error('importd support was requested, but dependencies are not available')
1435 endif
349cc4a5
ZJS
1436else
1437 have = false
5c23128d 1438endif
349cc4a5 1439conf.set10('ENABLE_IMPORTD', have)
5c23128d 1440
70a5db58
LP
1441want_homed = get_option('homed')
1442if want_homed != 'false'
1443 have = (conf.get('HAVE_OPENSSL') == 1 and
1444 conf.get('HAVE_LIBFDISK') == 1 and
1445 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1446 if want_homed == 'true' and not have
1447 error('homed support was requested, but dependencies are not available')
1448 endif
1449else
1450 have = false
1451endif
1452conf.set10('ENABLE_HOMED', have)
1453
af06ddf5
YW
1454have = have and conf.get('HAVE_PAM') == 1
1455conf.set10('ENABLE_PAM_HOME', have)
1456
d58c5f0f 1457have = get_option('oomd')
c199dd3f 1458conf.set10('ENABLE_OOMD', have)
a881d961 1459substs.set10('ENABLE_OOMD', have)
c199dd3f 1460
5c23128d 1461want_remote = get_option('remote')
4390be30 1462if want_remote != 'false'
349cc4a5
ZJS
1463 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1464 conf.get('HAVE_LIBCURL') == 1]
37efbbd8
ZJS
1465 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1466 # it's possible to build one without the other. Complain only if
5238e957 1467 # support was explicitly requested. The auxiliary files like sysusers
37efbbd8
ZJS
1468 # config should be installed when any of the programs are built.
1469 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1470 error('remote support was requested, but dependencies are not available')
1471 endif
349cc4a5
ZJS
1472 have = have_deps[0] or have_deps[1]
1473else
1474 have = false
5c23128d 1475endif
349cc4a5 1476conf.set10('ENABLE_REMOTE', have)
5c23128d 1477
b3259a6e
ZJS
1478foreach term : ['analyze',
1479 'backlight',
a9149d87
ZJS
1480 'binfmt',
1481 'coredump',
b3259a6e
ZJS
1482 'efi',
1483 'environment-d',
1484 'firstboot',
1485 'gshadow',
1486 'hibernate',
a9149d87 1487 'hostnamed',
b3259a6e
ZJS
1488 'hwdb',
1489 'idn',
1490 'ima',
1491 'initrd',
53393c89 1492 'compat-mutable-uid-boundaries',
7e0079f9 1493 'nscd',
b3259a6e 1494 'ldconfig',
a9149d87 1495 'localed',
b3259a6e 1496 'logind',
a9149d87
ZJS
1497 'machined',
1498 'networkd',
b3259a6e
ZJS
1499 'nss-myhostname',
1500 'nss-systemd',
1501 'portabled',
9bca4ae4 1502 'sysext',
b3259a6e 1503 'pstore',
a9149d87 1504 'quotacheck',
b3259a6e
ZJS
1505 'randomseed',
1506 'resolve',
1507 'rfkill',
1508 'smack',
a9149d87 1509 'sysusers',
b3259a6e
ZJS
1510 'timedated',
1511 'timesyncd',
a9149d87 1512 'tmpfiles',
a9149d87 1513 'tpm',
b3259a6e
ZJS
1514 'userdb',
1515 'utmp',
1516 'vconsole',
1517 'xdg-autostart']
a9149d87
ZJS
1518 have = get_option(term)
1519 name = 'ENABLE_' + term.underscorify().to_upper()
1520 conf.set10(name, have)
aa25270c 1521 substs.set10(name, have)
5c23128d
ZJS
1522endforeach
1523
bd7e6aa7
ZJS
1524enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1525
08540a95
YW
1526foreach tuple : [['nss-mymachines', 'machined'],
1527 ['nss-resolve', 'resolve']]
1528 want = get_option(tuple[0])
1529 if want != 'false'
1530 have = get_option(tuple[1])
1531 if want == 'true' and not have
1532 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1533 endif
1534 else
1535 have = false
1536 endif
1537 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1538 conf.set10(name, have)
1539endforeach
1540
1541enable_nss = false
1542foreach term : ['ENABLE_NSS_MYHOSTNAME',
1543 'ENABLE_NSS_MYMACHINES',
1544 'ENABLE_NSS_RESOLVE',
1545 'ENABLE_NSS_SYSTEMD']
1546 if conf.get(term) == 1
1547 enable_nss = true
1548 endif
1549endforeach
1550conf.set10('ENABLE_NSS', enable_nss)
1551
348b4437 1552conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
6129ec85 1553
b68dfb9e 1554conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
00d82c81 1555
5c23128d
ZJS
1556#####################################################################
1557
1558if get_option('efi')
37efbbd8 1559 efi_arch = host_machine.cpu_family()
b710072d 1560
6800fe7f 1561 if efi_arch == 'x86'
37efbbd8 1562 EFI_MACHINE_TYPE_NAME = 'ia32'
6800fe7f 1563 gnu_efi_arch = 'ia32'
37efbbd8
ZJS
1564 elif efi_arch == 'x86_64'
1565 EFI_MACHINE_TYPE_NAME = 'x64'
6800fe7f 1566 gnu_efi_arch = 'x86_64'
37efbbd8
ZJS
1567 elif efi_arch == 'arm'
1568 EFI_MACHINE_TYPE_NAME = 'arm'
6800fe7f 1569 gnu_efi_arch = 'arm'
37efbbd8
ZJS
1570 elif efi_arch == 'aarch64'
1571 EFI_MACHINE_TYPE_NAME = 'aa64'
6800fe7f 1572 gnu_efi_arch = 'aarch64'
37efbbd8
ZJS
1573 else
1574 EFI_MACHINE_TYPE_NAME = ''
6800fe7f 1575 gnu_efi_arch = ''
37efbbd8 1576 endif
5c23128d 1577
349cc4a5 1578 have = true
37efbbd8 1579 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
80c6fce8 1580
ac09340e 1581 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
349cc4a5
ZJS
1582else
1583 have = false
5c23128d 1584endif
349cc4a5 1585conf.set10('ENABLE_EFI', have)
5c23128d 1586
f6fe732f
YW
1587############################################################
1588
d3821a33 1589generate_gperfs = find_program('tools/generate-gperfs.py')
f6fe732f
YW
1590make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1591make_directive_index_py = find_program('tools/make-directive-index.py')
1592make_man_index_py = find_program('tools/make-man-index.py')
f6fe732f 1593meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
d3821a33
ZJS
1594update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1595update_hwdb_sh = find_program('tools/update-hwdb.sh')
1596update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1597update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1598xml_helper_py = find_program('tools/xml_helper.py')
f6fe732f 1599
5c23128d
ZJS
1600#####################################################################
1601
1602config_h = configure_file(
37efbbd8
ZJS
1603 output : 'config.h',
1604 configuration : conf)
5c23128d 1605
f6fe732f
YW
1606add_project_arguments('-include', 'config.h', language : 'c')
1607
1608############################################################
348b4437 1609
b61016f2
YW
1610# binaries that have --help and are intended for use by humans,
1611# usually, but not always, installed in /bin.
1612public_programs = []
1613
1614tests = []
1615fuzzers = []
1616
8d40961c
YW
1617basic_includes = include_directories(
1618 'src/basic',
e5bc5f1f 1619 'src/fundamental',
8d40961c
YW
1620 'src/systemd',
1621 '.')
1622
1623libsystemd_includes = [basic_includes, include_directories(
1624 'src/libsystemd/sd-bus',
1625 'src/libsystemd/sd-device',
1626 'src/libsystemd/sd-event',
1627 'src/libsystemd/sd-hwdb',
1628 'src/libsystemd/sd-id128',
1629 'src/libsystemd/sd-journal',
1630 'src/libsystemd/sd-netlink',
1631 'src/libsystemd/sd-network',
1632 'src/libsystemd/sd-resolve')]
1633
1634includes = [libsystemd_includes, include_directories('src/shared')]
5c23128d 1635
5c23128d
ZJS
1636subdir('po')
1637subdir('catalog')
e5bc5f1f 1638subdir('src/fundamental')
5c23128d
ZJS
1639subdir('src/basic')
1640subdir('src/libsystemd')
3976f372
YW
1641subdir('src/shared')
1642subdir('src/udev')
1643subdir('src/libudev')
5c23128d 1644
5c23128d 1645libsystemd = shared_library(
37efbbd8 1646 'systemd',
a5d8835c 1647 disable_mempool_c,
56d50ab1 1648 version : libsystemd_version,
8d40961c 1649 include_directories : libsystemd_includes,
37efbbd8
ZJS
1650 link_args : ['-shared',
1651 '-Wl,--version-script=' + libsystemd_sym_path],
34e221a5
ZJS
1652 link_with : [libbasic,
1653 libbasic_gcrypt],
99b9f8fd 1654 link_whole : [libsystemd_static],
37efbbd8
ZJS
1655 dependencies : [threads,
1656 librt,
1657 libxz,
ef5924aa 1658 libzstd,
37efbbd8
ZJS
1659 liblz4],
1660 link_depends : libsystemd_sym,
1661 install : true,
1662 install_dir : rootlibdir)
5c23128d 1663
70848ecf
DC
1664install_libsystemd_static = static_library(
1665 'systemd',
1666 libsystemd_sources,
975464e0
ZJS
1667 basic_sources,
1668 basic_gcrypt_sources,
e5bc5f1f 1669 fundamental_sources,
be44b572 1670 disable_mempool_c,
8d40961c 1671 include_directories : libsystemd_includes,
70848ecf
DC
1672 build_by_default : static_libsystemd != 'false',
1673 install : static_libsystemd != 'false',
1674 install_dir : rootlibdir,
40dbce36 1675 pic : static_libsystemd_pic,
70848ecf
DC
1676 dependencies : [threads,
1677 librt,
1678 libxz,
ef5924aa 1679 libzstd,
70848ecf 1680 liblz4,
975464e0
ZJS
1681 libcap,
1682 libblkid,
1683 libmount,
1684 libselinux,
70848ecf
DC
1685 libgcrypt],
1686 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1687
3976f372
YW
1688libudev = shared_library(
1689 'udev',
1690 disable_mempool_c,
1691 version : libudev_version,
1692 include_directories : includes,
1693 link_args : ['-shared',
1694 '-Wl,--version-script=' + libudev_sym_path],
1695 link_with : [libsystemd_static, libshared_static],
1696 link_whole : libudev_basic,
1697 dependencies : [threads],
1698 link_depends : libudev_sym,
1699 install : true,
1700 install_dir : rootlibdir)
1701
1702install_libudev_static = static_library(
1703 'udev',
1704 basic_sources,
e5bc5f1f 1705 fundamental_sources,
3976f372
YW
1706 shared_sources,
1707 libsystemd_sources,
1708 libudev_sources,
1709 disable_mempool_c,
1710 include_directories : includes,
1711 build_by_default : static_libudev != 'false',
1712 install : static_libudev != 'false',
1713 install_dir : rootlibdir,
1714 link_depends : libudev_sym,
1715 dependencies : libshared_deps + [libmount],
1716 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1717 pic : static_libudev_pic)
1718
47354b44
ZJS
1719############################################################
1720
b61016f2 1721# systemd-analyze requires 'libcore'
83b6af36 1722subdir('src/core')
b61016f2
YW
1723# systemd-journal-remote requires 'libjournal_core'
1724subdir('src/journal')
1725# systemd-networkd requires 'libsystemd_network'
1726subdir('src/libsystemd-network')
83b6af36
ZJS
1727
1728subdir('src/analyze')
b61016f2 1729subdir('src/boot/efi')
f98df767 1730subdir('src/busctl')
b61016f2 1731subdir('src/coredump')
2ad279cf 1732subdir('src/cryptenroll')
b4d1892a 1733subdir('src/cryptsetup')
b61016f2 1734subdir('src/home')
83b6af36
ZJS
1735subdir('src/hostname')
1736subdir('src/import')
b61016f2 1737subdir('src/journal-remote')
83b6af36
ZJS
1738subdir('src/kernel-install')
1739subdir('src/locale')
b61016f2 1740subdir('src/login')
83b6af36 1741subdir('src/machine')
b61016f2 1742subdir('src/network')
83b6af36 1743subdir('src/nspawn')
b61016f2
YW
1744subdir('src/oom')
1745subdir('src/partition')
1746subdir('src/portable')
1747subdir('src/pstore')
83b6af36 1748subdir('src/resolve')
2a9b4bbe 1749subdir('src/rpm')
b61016f2 1750subdir('src/shutdown')
9bca4ae4 1751subdir('src/sysext')
c3512573 1752subdir('src/systemctl')
83b6af36
ZJS
1753subdir('src/timedate')
1754subdir('src/timesync')
db64ba81 1755subdir('src/tmpfiles')
b61016f2 1756subdir('src/userdb')
83b6af36 1757subdir('src/vconsole')
0275e918 1758subdir('src/xdg-autostart-generator')
83b6af36 1759
3976f372
YW
1760subdir('src/systemd')
1761
83b6af36 1762subdir('src/test')
7db7d5b7 1763subdir('src/fuzz')
ef2ad30a 1764subdir('rules.d')
83b6af36
ZJS
1765subdir('test')
1766
1767############################################################
1768
1769# only static linking apart from libdl, to make sure that the
1770# module is linked to all libraries that it uses.
1771test_dlopen = executable(
37efbbd8
ZJS
1772 'test-dlopen',
1773 test_dlopen_c,
a5d8835c 1774 disable_mempool_c,
37efbbd8
ZJS
1775 include_directories : includes,
1776 link_with : [libbasic],
fd1939fb
YW
1777 dependencies : [libdl],
1778 build_by_default : want_tests != 'false')
83b6af36 1779
08540a95 1780foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
cbaaf7b9 1781 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
08540a95 1782 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
8d40961c 1783 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
5c23128d 1784
349cc4a5 1785 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
37efbbd8
ZJS
1786 if condition
1787 module = tuple[0]
37efbbd8
ZJS
1788
1789 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1485aacb 1790 version_script_arg = join_paths(project_source_root, sym)
37efbbd8 1791
1684c56f
LP
1792 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
1793 if tuple.length() > 2
cbaaf7b9
YW
1794 foreach s : tuple[2]
1795 sources += ['src/nss-@0@/@1@'.format(module, s)]
1796 endforeach
1684c56f
LP
1797 endif
1798
8d40961c
YW
1799 incs = tuple.length() > 3 ? tuple[3] : includes
1800
37efbbd8
ZJS
1801 nss = shared_library(
1802 'nss_' + module,
1684c56f 1803 sources,
a5d8835c 1804 disable_mempool_c,
37efbbd8 1805 version : '2',
8d40961c 1806 include_directories : incs,
b4b36f44
LP
1807 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1808 link_args : ['-Wl,-z,nodelete',
1809 '-shared',
700805f6 1810 '-Wl,--version-script=' + version_script_arg],
37e4d7a8 1811 link_with : [libsystemd_static,
733cbd00 1812 libshared_static,
37efbbd8
ZJS
1813 libbasic],
1814 dependencies : [threads,
5486a31d 1815 librt],
37efbbd8
ZJS
1816 link_depends : sym,
1817 install : true,
1818 install_dir : rootlibdir)
1819
1820 # We cannot use shared_module because it does not support version suffix.
1821 # Unfortunately shared_library insists on creating the symlink…
1822 meson.add_install_script('sh', '-c',
1823 'rm $DESTDIR@0@/libnss_@1@.so'
1824 .format(rootlibdir, module))
1825
938be089
ZJS
1826 if want_tests != 'false'
1827 test('dlopen-nss_' + module,
1828 test_dlopen,
1829 # path to dlopen must include a slash
1830 args : nss.full_path())
1831 endif
37efbbd8 1832 endif
5c23128d
ZJS
1833endforeach
1834
1835############################################################
1836
6164ec4c
ZJS
1837executable(
1838 'systemd',
1839 systemd_sources,
1840 include_directories : includes,
1841 link_with : [libcore,
1842 libshared],
1843 dependencies : [versiondep,
1844 threads,
1845 librt,
1846 libseccomp,
1847 libselinux,
1848 libmount,
1849 libblkid],
1850 install_rpath : rootlibexecdir,
1851 install : true,
1852 install_dir : rootlibexecdir)
5c23128d 1853
ba7f4ae6
ZJS
1854meson.add_install_script(meson_make_symlink,
1855 join_paths(rootlibexecdir, 'systemd'),
1856 join_paths(rootsbindir, 'init'))
1857
6164ec4c
ZJS
1858public_programs += executable(
1859 'systemd-analyze',
1860 systemd_analyze_sources,
8d40961c 1861 include_directories : core_includes,
6164ec4c
ZJS
1862 link_with : [libcore,
1863 libshared],
1864 dependencies : [versiondep,
1865 threads,
1866 librt,
1867 libseccomp,
1868 libselinux,
1869 libmount,
1870 libblkid],
1871 install_rpath : rootlibexecdir,
b3259a6e 1872 install : conf.get('ENABLE_ANALYZE'))
5c23128d 1873
6164ec4c
ZJS
1874executable(
1875 'systemd-journald',
1876 systemd_journald_sources,
1877 include_directories : includes,
1878 link_with : [libjournal_core,
1879 libshared],
1880 dependencies : [threads,
1881 libxz,
1882 liblz4,
ef5924aa
NL
1883 libselinux,
1884 libzstd],
6164ec4c
ZJS
1885 install_rpath : rootlibexecdir,
1886 install : true,
1887 install_dir : rootlibexecdir)
5c23128d 1888
6164ec4c
ZJS
1889public_programs += executable(
1890 'systemd-cat',
1891 systemd_cat_sources,
1892 include_directories : includes,
1893 link_with : [libjournal_core,
1894 libshared],
1895 dependencies : [threads],
1896 install_rpath : rootlibexecdir,
1897 install : true)
1898
1899public_programs += executable(
1900 'journalctl',
1901 journalctl_sources,
1902 include_directories : includes,
1903 link_with : [libshared],
1904 dependencies : [threads,
e44b5004 1905 libdl,
6164ec4c
ZJS
1906 libxz,
1907 liblz4,
9200bb30
LP
1908 libzstd,
1909 libdl],
6164ec4c
ZJS
1910 install_rpath : rootlibexecdir,
1911 install : true,
1912 install_dir : rootbindir)
35a1ff4c 1913
6164ec4c
ZJS
1914executable(
1915 'systemd-getty-generator',
1916 'src/getty-generator/getty-generator.c',
1917 include_directories : includes,
1918 link_with : [libshared],
1919 install_rpath : rootlibexecdir,
1920 install : true,
1921 install_dir : systemgeneratordir)
5c23128d 1922
6164ec4c
ZJS
1923executable(
1924 'systemd-debug-generator',
1925 'src/debug-generator/debug-generator.c',
1926 include_directories : includes,
1927 link_with : [libshared],
1928 install_rpath : rootlibexecdir,
1929 install : true,
1930 install_dir : systemgeneratordir)
1931
1932executable(
1933 'systemd-run-generator',
1934 'src/run-generator/run-generator.c',
1935 include_directories : includes,
1936 link_with : [libshared],
1937 install_rpath : rootlibexecdir,
1938 install : true,
1939 install_dir : systemgeneratordir)
1940
1941executable(
1942 'systemd-fstab-generator',
1943 'src/fstab-generator/fstab-generator.c',
1944 include_directories : includes,
bac11cd6 1945 link_with : [libshared],
6164ec4c
ZJS
1946 install_rpath : rootlibexecdir,
1947 install : true,
1948 install_dir : systemgeneratordir)
5c23128d 1949
349cc4a5 1950if conf.get('ENABLE_ENVIRONMENT_D') == 1
6164ec4c
ZJS
1951 executable(
1952 '30-systemd-environment-d-generator',
1953 'src/environment-d-generator/environment-d-generator.c',
1954 include_directories : includes,
1955 link_with : [libshared],
1956 install_rpath : rootlibexecdir,
1957 install : true,
1958 install_dir : userenvgeneratordir)
7b76fce1 1959
37efbbd8
ZJS
1960 meson.add_install_script(meson_make_symlink,
1961 join_paths(sysconfdir, 'environment'),
1962 join_paths(environmentdir, '99-environment.conf'))
5c23128d
ZJS
1963endif
1964
349cc4a5 1965if conf.get('ENABLE_HIBERNATE') == 1
6164ec4c
ZJS
1966 executable(
1967 'systemd-hibernate-resume-generator',
1968 'src/hibernate-resume/hibernate-resume-generator.c',
1969 include_directories : includes,
1970 link_with : [libshared],
1971 install_rpath : rootlibexecdir,
1972 install : true,
1973 install_dir : systemgeneratordir)
1974
1975 executable(
1976 'systemd-hibernate-resume',
1977 'src/hibernate-resume/hibernate-resume.c',
1978 include_directories : includes,
1979 link_with : [libshared],
1980 install_rpath : rootlibexecdir,
1981 install : true,
1982 install_dir : rootlibexecdir)
37efbbd8
ZJS
1983endif
1984
349cc4a5 1985if conf.get('HAVE_BLKID') == 1
6164ec4c
ZJS
1986 executable(
1987 'systemd-gpt-auto-generator',
1988 'src/gpt-auto-generator/gpt-auto-generator.c',
6164ec4c
ZJS
1989 include_directories : includes,
1990 link_with : [libshared],
1991 dependencies : libblkid,
1992 install_rpath : rootlibexecdir,
1993 install : true,
1994 install_dir : systemgeneratordir)
1995
1996 public_programs += executable(
1997 'systemd-dissect',
1998 'src/dissect/dissect.c',
1999 include_directories : includes,
2000 link_with : [libshared],
2001 install_rpath : rootlibexecdir,
5a151082 2002 install : true)
5c23128d
ZJS
2003endif
2004
1ec57f33 2005if conf.get('ENABLE_RESOLVE') == 1
6164ec4c
ZJS
2006 executable(
2007 'systemd-resolved',
2008 systemd_resolved_sources,
8d40961c 2009 include_directories : resolve_includes,
6164ec4c
ZJS
2010 link_with : [libshared,
2011 libbasic_gcrypt,
2012 libsystemd_resolve_core],
2013 dependencies : systemd_resolved_dependencies,
2014 install_rpath : rootlibexecdir,
2015 install : true,
2016 install_dir : rootlibexecdir)
2017
2018 public_programs += executable(
2019 'resolvectl',
2020 resolvectl_sources,
2021 include_directories : includes,
2022 link_with : [libshared,
2023 libbasic_gcrypt,
2024 libsystemd_resolve_core],
2025 dependencies : [threads,
2026 libgpg_error,
2027 libm,
2028 libidn],
2029 install_rpath : rootlibexecdir,
2030 install : true)
088c1363
LP
2031
2032 meson.add_install_script(meson_make_symlink,
6164ec4c
ZJS
2033 join_paths(bindir, 'resolvectl'),
2034 join_paths(rootsbindir, 'resolvconf'))
c2e84cab
YW
2035
2036 meson.add_install_script(meson_make_symlink,
6164ec4c
ZJS
2037 join_paths(bindir, 'resolvectl'),
2038 join_paths(bindir, 'systemd-resolve'))
5c23128d
ZJS
2039endif
2040
349cc4a5 2041if conf.get('ENABLE_LOGIND') == 1
6164ec4c
ZJS
2042 executable(
2043 'systemd-logind',
2044 systemd_logind_sources,
2045 include_directories : includes,
2046 link_with : [liblogind_core,
2047 libshared],
2048 dependencies : [threads,
2049 libacl],
2050 install_rpath : rootlibexecdir,
2051 install : true,
2052 install_dir : rootlibexecdir)
2053
2054 public_programs += executable(
2055 'loginctl',
2056 loginctl_sources,
2057 include_directories : includes,
2058 link_with : [libshared],
2059 dependencies : [threads,
2060 liblz4,
ef5924aa
NL
2061 libxz,
2062 libzstd],
6164ec4c
ZJS
2063 install_rpath : rootlibexecdir,
2064 install : true,
2065 install_dir : rootbindir)
2066
2067 public_programs += executable(
2068 'systemd-inhibit',
2069 'src/login/inhibit.c',
2070 include_directories : includes,
2071 link_with : [libshared],
2072 install_rpath : rootlibexecdir,
2073 install : true,
2074 install_dir : rootbindir)
37efbbd8 2075
349cc4a5 2076 if conf.get('HAVE_PAM') == 1
1485aacb 2077 version_script_arg = join_paths(project_source_root, pam_systemd_sym)
37efbbd8
ZJS
2078 pam_systemd = shared_library(
2079 'pam_systemd',
2080 pam_systemd_c,
2081 name_prefix : '',
2082 include_directories : includes,
2083 link_args : ['-shared',
2084 '-Wl,--version-script=' + version_script_arg],
37e4d7a8 2085 link_with : [libsystemd_static,
37efbbd8
ZJS
2086 libshared_static],
2087 dependencies : [threads,
2088 libpam,
2089 libpam_misc],
2090 link_depends : pam_systemd_sym,
2091 install : true,
2092 install_dir : pamlibdir)
2093
938be089
ZJS
2094 if want_tests != 'false'
2095 test('dlopen-pam_systemd',
2096 test_dlopen,
2097 # path to dlopen must include a slash
c1cd6743 2098 args : pam_systemd.full_path())
938be089 2099 endif
37efbbd8 2100 endif
005a29f2 2101
6164ec4c
ZJS
2102 executable(
2103 'systemd-user-runtime-dir',
2104 user_runtime_dir_sources,
2105 include_directories : includes,
2106 link_with : [libshared],
2107 install_rpath : rootlibexecdir,
2108 install : true,
2109 install_dir : rootlibexecdir)
07ee5adb 2110endif
a9f0f5e5 2111
349cc4a5 2112if conf.get('HAVE_PAM') == 1
6164ec4c
ZJS
2113 executable(
2114 'systemd-user-sessions',
2115 'src/user-sessions/user-sessions.c',
2116 include_directories : includes,
2117 link_with : [libshared],
2118 install_rpath : rootlibexecdir,
2119 install : true,
2120 install_dir : rootlibexecdir)
5c23128d
ZJS
2121endif
2122
349cc4a5 2123if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
6164ec4c
ZJS
2124 public_programs += executable(
2125 'bootctl',
2126 'src/boot/bootctl.c',
2127 include_directories : includes,
2128 link_with : [libshared],
2129 dependencies : [libblkid],
2130 install_rpath : rootlibexecdir,
2131 install : true)
2132
2133 public_programs += executable(
2134 'systemd-bless-boot',
2135 'src/boot/bless-boot.c',
2136 include_directories : includes,
2137 link_with : [libshared],
2138 dependencies : [libblkid],
2139 install_rpath : rootlibexecdir,
2140 install : true,
2141 install_dir : rootlibexecdir)
2142
2143 executable(
2144 'systemd-bless-boot-generator',
2145 'src/boot/bless-boot-generator.c',
2146 include_directories : includes,
2147 link_with : [libshared],
2148 install_rpath : rootlibexecdir,
2149 install : true,
2150 install_dir : systemgeneratordir)
2151endif
2152
2153executable(
2154 'systemd-boot-check-no-failures',
2155 'src/boot/boot-check-no-failures.c',
2156 include_directories : includes,
2157 link_with : [libshared],
2158 dependencies : [libblkid],
2159 install_rpath : rootlibexecdir,
2160 install : true,
2161 install_dir : rootlibexecdir)
005a29f2 2162
6164ec4c
ZJS
2163public_programs += executable(
2164 'systemd-socket-activate',
2165 'src/activate/activate.c',
2166 include_directories : includes,
2167 link_with : [libshared],
2168 dependencies : [threads],
2169 install_rpath : rootlibexecdir,
2170 install : true)
f3794366 2171
6164ec4c
ZJS
2172public_programs += executable(
2173 'systemctl',
c3512573 2174 systemctl_sources,
6164ec4c
ZJS
2175 include_directories : includes,
2176 link_with : systemctl_link_with,
2177 dependencies : [threads,
2178 libcap,
2179 libselinux,
2180 libxz,
ef5924aa
NL
2181 liblz4,
2182 libzstd],
6164ec4c
ZJS
2183 install_rpath : rootlibexecdir,
2184 install : true,
2185 install_dir : rootbindir)
5c23128d 2186
61d0578b 2187if conf.get('ENABLE_PORTABLED') == 1
6164ec4c
ZJS
2188 executable(
2189 'systemd-portabled',
2190 systemd_portabled_sources,
2191 include_directories : includes,
2192 link_with : [libshared],
2193 dependencies : [threads],
2194 install_rpath : rootlibexecdir,
2195 install : true,
2196 install_dir : rootlibexecdir)
2197
2198 public_programs += executable(
2199 'portablectl',
2200 'src/portable/portablectl.c',
2201 include_directories : includes,
2202 link_with : [libshared],
2203 dependencies : [threads],
2204 install_rpath : rootlibexecdir,
2205 install : true,
2206 install_dir : rootbindir)
61d0578b
LP
2207endif
2208
9bca4ae4
LP
2209if conf.get('ENABLE_SYSEXT') == 1
2210 public_programs += executable(
2211 'systemd-sysext',
2212 systemd_sysext_sources,
2213 include_directories : includes,
2214 link_with : [libshared],
2215 install_rpath : rootlibexecdir,
2216 install : true,
aac5fbff 2217 install_dir : rootbindir)
9bca4ae4
LP
2218endif
2219
d093b62c 2220if conf.get('ENABLE_USERDB') == 1
6164ec4c
ZJS
2221 executable(
2222 'systemd-userwork',
2223 systemd_userwork_sources,
2224 include_directories : includes,
2225 link_with : [libshared],
2226 dependencies : [threads],
2227 install_rpath : rootlibexecdir,
2228 install : true,
2229 install_dir : rootlibexecdir)
2230
2231 executable(
2232 'systemd-userdbd',
2233 systemd_userdbd_sources,
2234 include_directories : includes,
2235 link_with : [libshared],
2236 dependencies : [threads],
2237 install_rpath : rootlibexecdir,
2238 install : true,
2239 install_dir : rootlibexecdir)
2240
460e5af0 2241 public_programs += executable(
6164ec4c
ZJS
2242 'userdbctl',
2243 userdbctl_sources,
2244 include_directories : includes,
2245 link_with : [libshared],
2246 dependencies : [threads],
2247 install_rpath : rootlibexecdir,
2248 install : true,
2249 install_dir : rootbindir)
d093b62c
LP
2250endif
2251
70a5db58 2252if conf.get('ENABLE_HOMED') == 1
6164ec4c
ZJS
2253 executable(
2254 'systemd-homework',
2255 systemd_homework_sources,
2256 include_directories : includes,
2257 link_with : [libshared],
2258 dependencies : [threads,
2259 libcryptsetup,
2260 libblkid,
2261 libcrypt,
2262 libopenssl,
2263 libfdisk,
69cb2896 2264 libp11kit],
6164ec4c
ZJS
2265 install_rpath : rootlibexecdir,
2266 install : true,
2267 install_dir : rootlibexecdir)
2268
2269 executable(
2270 'systemd-homed',
2271 systemd_homed_sources,
8d40961c 2272 include_directories : home_includes,
6164ec4c
ZJS
2273 link_with : [libshared],
2274 dependencies : [threads,
2275 libcrypt,
679badd7 2276 libopenssl],
6164ec4c
ZJS
2277 install_rpath : rootlibexecdir,
2278 install : true,
2279 install_dir : rootlibexecdir)
2280
460e5af0 2281 public_programs += executable(
6164ec4c
ZJS
2282 'homectl',
2283 homectl_sources,
2284 include_directories : includes,
2285 link_with : [libshared],
2286 dependencies : [threads,
2287 libcrypt,
2288 libopenssl,
2289 libp11kit,
da3920c3 2290 libdl],
6164ec4c
ZJS
2291 install_rpath : rootlibexecdir,
2292 install : true,
2293 install_dir : rootbindir)
26cf9fb7
LP
2294
2295 if conf.get('HAVE_PAM') == 1
2296 version_script_arg = join_paths(project_source_root, pam_systemd_home_sym)
2297 pam_systemd = shared_library(
2298 'pam_systemd_home',
2299 pam_systemd_home_c,
2300 name_prefix : '',
2301 include_directories : includes,
2302 link_args : ['-shared',
2303 '-Wl,--version-script=' + version_script_arg],
2304 link_with : [libsystemd_static,
2305 libshared_static],
2306 dependencies : [threads,
2307 libpam,
2308 libpam_misc,
2309 libcrypt],
2310 link_depends : pam_systemd_home_sym,
2311 install : true,
2312 install_dir : pamlibdir)
2313 endif
70a5db58
LP
2314endif
2315
6589a569
NL
2316foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2317 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
ba7f4ae6
ZJS
2318 meson.add_install_script(meson_make_symlink,
2319 join_paths(rootbindir, 'systemctl'),
2320 join_paths(rootsbindir, alias))
2321endforeach
2322
63e2d171
NL
2323meson.add_install_script(meson_make_symlink,
2324 join_paths(rootbindir, 'udevadm'),
2325 join_paths(rootlibexecdir, 'systemd-udevd'))
2326
349cc4a5 2327if conf.get('ENABLE_BACKLIGHT') == 1
6164ec4c
ZJS
2328 executable(
2329 'systemd-backlight',
2330 'src/backlight/backlight.c',
2331 include_directories : includes,
2332 link_with : [libshared],
2333 install_rpath : rootlibexecdir,
2334 install : true,
2335 install_dir : rootlibexecdir)
5c23128d
ZJS
2336endif
2337
349cc4a5 2338if conf.get('ENABLE_RFKILL') == 1
6164ec4c
ZJS
2339 executable(
2340 'systemd-rfkill',
2341 'src/rfkill/rfkill.c',
2342 include_directories : includes,
2343 link_with : [libshared],
2344 install_rpath : rootlibexecdir,
2345 install : true,
2346 install_dir : rootlibexecdir)
2347endif
2348
2349executable(
2350 'systemd-system-update-generator',
2351 'src/system-update-generator/system-update-generator.c',
2352 include_directories : includes,
2353 link_with : [libshared],
2354 install_rpath : rootlibexecdir,
2355 install : true,
2356 install_dir : systemgeneratordir)
5c23128d 2357
349cc4a5 2358if conf.get('HAVE_LIBCRYPTSETUP') == 1
6164ec4c
ZJS
2359 executable(
2360 'systemd-cryptsetup',
2361 systemd_cryptsetup_sources,
2362 include_directories : includes,
2363 link_with : [libshared],
2364 dependencies : [libcryptsetup,
2365 libp11kit],
2366 install_rpath : rootlibexecdir,
2367 install : true,
2368 install_dir : rootlibexecdir)
2369
2370 executable(
2371 'systemd-cryptsetup-generator',
2372 'src/cryptsetup/cryptsetup-generator.c',
2373 include_directories : includes,
2374 link_with : [libshared],
6164ec4c
ZJS
2375 install_rpath : rootlibexecdir,
2376 install : true,
2377 install_dir : systemgeneratordir)
2378
2379 executable(
2380 'systemd-veritysetup',
2381 'src/veritysetup/veritysetup.c',
2382 include_directories : includes,
2383 link_with : [libshared],
2384 dependencies : [libcryptsetup],
2385 install_rpath : rootlibexecdir,
2386 install : true,
2387 install_dir : rootlibexecdir)
2388
2389 executable(
2390 'systemd-veritysetup-generator',
2391 'src/veritysetup/veritysetup-generator.c',
2392 include_directories : includes,
2393 link_with : [libshared],
6164ec4c
ZJS
2394 install_rpath : rootlibexecdir,
2395 install : true,
2396 install_dir : systemgeneratordir)
8710a681 2397
8710a681
LP
2398 executable(
2399 'systemd-cryptenroll',
2400 systemd_cryptenroll_sources,
2401 include_directories : includes,
2402 link_with : [libshared],
2403 dependencies : [libcryptsetup,
5e521624 2404 libdl,
8710a681
LP
2405 libopenssl,
2406 libp11kit],
2407 install_rpath : rootlibexecdir,
a1fd722b 2408 install : true)
5c23128d
ZJS
2409endif
2410
349cc4a5 2411if conf.get('HAVE_SYSV_COMPAT') == 1
6164ec4c
ZJS
2412 executable(
2413 'systemd-sysv-generator',
2414 'src/sysv-generator/sysv-generator.c',
2415 include_directories : includes,
2416 link_with : [libshared],
2417 install_rpath : rootlibexecdir,
2418 install : true,
2419 install_dir : systemgeneratordir)
2420
2421 executable(
2422 'systemd-rc-local-generator',
2423 'src/rc-local-generator/rc-local-generator.c',
2424 include_directories : includes,
2425 link_with : [libshared],
2426 install_rpath : rootlibexecdir,
2427 install : true,
2428 install_dir : systemgeneratordir)
5c23128d
ZJS
2429endif
2430
8feca247
BB
2431if conf.get('ENABLE_XDG_AUTOSTART') == 1
2432 executable(
2433 'systemd-xdg-autostart-generator',
0275e918 2434 systemd_xdg_autostart_generator_sources,
8feca247
BB
2435 include_directories : includes,
2436 link_with : [libshared],
2437 install_rpath : rootlibexecdir,
2438 install : true,
2439 install_dir : usergeneratordir)
2440
2441 executable(
2442 'systemd-xdg-autostart-condition',
2443 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2444 include_directories : includes,
2445 link_with : [libshared],
2446 install_rpath : rootlibexecdir,
2447 install : true,
2448 install_dir : rootlibexecdir)
2449endif
2450
349cc4a5 2451if conf.get('ENABLE_HOSTNAMED') == 1
6164ec4c
ZJS
2452 executable(
2453 'systemd-hostnamed',
2454 'src/hostname/hostnamed.c',
2455 include_directories : includes,
2456 link_with : [libshared],
2457 install_rpath : rootlibexecdir,
2458 install : true,
2459 install_dir : rootlibexecdir)
2460
2461 public_programs += executable(
2462 'hostnamectl',
2463 'src/hostname/hostnamectl.c',
2464 include_directories : includes,
2465 link_with : [libshared],
2466 install_rpath : rootlibexecdir,
2467 install : true)
5c23128d
ZJS
2468endif
2469
349cc4a5
ZJS
2470if conf.get('ENABLE_LOCALED') == 1
2471 if conf.get('HAVE_XKBCOMMON') == 1
37efbbd8
ZJS
2472 # logind will load libxkbcommon.so dynamically on its own
2473 deps = [libdl]
2474 else
2475 deps = []
2476 endif
2477
6164ec4c
ZJS
2478 executable(
2479 'systemd-localed',
2480 systemd_localed_sources,
2481 include_directories : includes,
2482 link_with : [libshared],
2483 dependencies : deps,
2484 install_rpath : rootlibexecdir,
2485 install : true,
2486 install_dir : rootlibexecdir)
2487
2488 public_programs += executable(
2489 'localectl',
2490 localectl_sources,
2491 include_directories : includes,
2492 link_with : [libshared],
2493 install_rpath : rootlibexecdir,
2494 install : true)
5c23128d
ZJS
2495endif
2496
349cc4a5 2497if conf.get('ENABLE_TIMEDATED') == 1
6164ec4c
ZJS
2498 executable(
2499 'systemd-timedated',
2500 'src/timedate/timedated.c',
2501 include_directories : includes,
2502 link_with : [libshared],
2503 install_rpath : rootlibexecdir,
2504 install : true,
2505 install_dir : rootlibexecdir)
6129ec85 2506endif
5c23128d 2507
6129ec85 2508if conf.get('ENABLE_TIMEDATECTL') == 1
6164ec4c
ZJS
2509 public_programs += executable(
2510 'timedatectl',
2511 'src/timedate/timedatectl.c',
2512 include_directories : includes,
2513 install_rpath : rootlibexecdir,
2514 link_with : [libshared],
2515 dependencies : [libm],
2516 install : true)
5c23128d
ZJS
2517endif
2518
349cc4a5 2519if conf.get('ENABLE_TIMESYNCD') == 1
6164ec4c
ZJS
2520 executable(
2521 'systemd-timesyncd',
2522 systemd_timesyncd_sources,
2523 include_directories : includes,
f5a5284e 2524 link_with : [libtimesyncd_core],
6164ec4c
ZJS
2525 dependencies : [threads,
2526 libm],
2527 install_rpath : rootlibexecdir,
2528 install : true,
2529 install_dir : rootlibexecdir)
2530
2531 executable(
2532 'systemd-time-wait-sync',
cf242350 2533 'src/timesync/wait-sync.c',
6164ec4c 2534 include_directories : includes,
f5a5284e 2535 link_with : [libtimesyncd_core],
6164ec4c
ZJS
2536 install_rpath : rootlibexecdir,
2537 install : true,
2538 install_dir : rootlibexecdir)
5c23128d
ZJS
2539endif
2540
349cc4a5 2541if conf.get('ENABLE_MACHINED') == 1
6164ec4c
ZJS
2542 executable(
2543 'systemd-machined',
2544 systemd_machined_sources,
2545 include_directories : includes,
2546 link_with : [libmachine_core,
2547 libshared],
2548 install_rpath : rootlibexecdir,
2549 install : true,
2550 install_dir : rootlibexecdir)
2551
2552 public_programs += executable(
2553 'machinectl',
2554 'src/machine/machinectl.c',
2555 include_directories : includes,
2556 link_with : [libshared],
2557 dependencies : [threads,
2558 libxz,
ef5924aa
NL
2559 liblz4,
2560 libzstd],
6164ec4c
ZJS
2561 install_rpath : rootlibexecdir,
2562 install : true,
2563 install_dir : rootbindir)
5c23128d
ZJS
2564endif
2565
349cc4a5 2566if conf.get('ENABLE_IMPORTD') == 1
6164ec4c
ZJS
2567 executable(
2568 'systemd-importd',
2569 systemd_importd_sources,
2570 include_directories : includes,
2571 link_with : [libshared],
2572 dependencies : [threads],
2573 install_rpath : rootlibexecdir,
2574 install : true,
2575 install_dir : rootlibexecdir)
2576
2577 systemd_pull = executable(
2578 'systemd-pull',
2579 systemd_pull_sources,
2580 include_directories : includes,
2581 link_with : [libshared],
2582 dependencies : [versiondep,
2583 libcurl,
2584 libz,
2585 libbzip2,
2586 libxz,
2587 libgcrypt],
2588 install_rpath : rootlibexecdir,
2589 install : true,
2590 install_dir : rootlibexecdir)
2591
2592 systemd_import = executable(
2593 'systemd-import',
2594 systemd_import_sources,
2595 include_directories : includes,
2596 link_with : [libshared],
2597 dependencies : [libcurl,
2598 libz,
2599 libbzip2,
2600 libxz],
2601 install_rpath : rootlibexecdir,
2602 install : true,
2603 install_dir : rootlibexecdir)
2604
2605 systemd_import_fs = executable(
2606 'systemd-import-fs',
2607 systemd_import_fs_sources,
2608 include_directories : includes,
2609 link_with : [libshared],
2610 install_rpath : rootlibexecdir,
2611 install : true,
2612 install_dir : rootlibexecdir)
2613
2614 systemd_export = executable(
2615 'systemd-export',
2616 systemd_export_sources,
2617 include_directories : includes,
2618 link_with : [libshared],
2619 dependencies : [libcurl,
2620 libz,
2621 libbzip2,
2622 libxz],
2623 install_rpath : rootlibexecdir,
2624 install : true,
2625 install_dir : rootlibexecdir)
1d7579c4
LP
2626
2627 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
37efbbd8
ZJS
2628endif
2629
349cc4a5 2630if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
6164ec4c
ZJS
2631 public_programs += executable(
2632 'systemd-journal-upload',
2633 systemd_journal_upload_sources,
2634 include_directories : includes,
2635 link_with : [libshared],
2636 dependencies : [versiondep,
2637 threads,
2638 libcurl,
2639 libgnutls,
2640 libxz,
ef5924aa
NL
2641 liblz4,
2642 libzstd],
6164ec4c
ZJS
2643 install_rpath : rootlibexecdir,
2644 install : true,
2645 install_dir : rootlibexecdir)
5c23128d
ZJS
2646endif
2647
349cc4a5 2648if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
6164ec4c
ZJS
2649 public_programs += executable(
2650 'systemd-journal-remote',
2651 systemd_journal_remote_sources,
2652 include_directories : includes,
2653 link_with : [libshared,
2654 libsystemd_journal_remote],
2655 dependencies : [threads,
2656 libmicrohttpd,
2657 libgnutls,
2658 libxz,
ef5924aa
NL
2659 liblz4,
2660 libzstd],
6164ec4c
ZJS
2661 install_rpath : rootlibexecdir,
2662 install : true,
2663 install_dir : rootlibexecdir)
2664
2665 public_programs += executable(
2666 'systemd-journal-gatewayd',
2667 systemd_journal_gatewayd_sources,
2668 include_directories : includes,
2669 link_with : [libshared],
2670 dependencies : [threads,
2671 libmicrohttpd,
2672 libgnutls,
2673 libxz,
ef5924aa
NL
2674 liblz4,
2675 libzstd],
6164ec4c
ZJS
2676 install_rpath : rootlibexecdir,
2677 install : true,
2678 install_dir : rootlibexecdir)
5c23128d
ZJS
2679endif
2680
349cc4a5 2681if conf.get('ENABLE_COREDUMP') == 1
6164ec4c
ZJS
2682 executable(
2683 'systemd-coredump',
2684 systemd_coredump_sources,
2685 include_directories : includes,
2686 link_with : [libshared],
2687 dependencies : [threads,
2688 libacl,
2689 libdw,
2690 libxz,
ef5924aa
NL
2691 liblz4,
2692 libzstd],
6164ec4c
ZJS
2693 install_rpath : rootlibexecdir,
2694 install : true,
2695 install_dir : rootlibexecdir)
2696
2697 public_programs += executable(
2698 'coredumpctl',
2699 coredumpctl_sources,
2700 include_directories : includes,
2701 link_with : [libshared],
2702 dependencies : [threads,
2703 libxz,
ef5924aa
NL
2704 liblz4,
2705 libzstd],
6164ec4c
ZJS
2706 install_rpath : rootlibexecdir,
2707 install : true)
5c23128d
ZJS
2708endif
2709
9b4abc69 2710if conf.get('ENABLE_PSTORE') == 1
6164ec4c
ZJS
2711 executable(
2712 'systemd-pstore',
2713 systemd_pstore_sources,
2714 include_directories : includes,
2715 link_with : [libshared],
2716 dependencies : [threads,
2717 libacl,
2718 libdw,
2719 libxz,
ef5924aa
NL
2720 liblz4,
2721 libzstd],
6164ec4c
ZJS
2722 install_rpath : rootlibexecdir,
2723 install : true,
2724 install_dir : rootlibexecdir)
9b4abc69
ED
2725endif
2726
9de5e321
AZ
2727if conf.get('ENABLE_OOMD') == 1
2728 executable('systemd-oomd',
2729 systemd_oomd_sources,
2730 include_directories : includes,
2731 link_with : [libshared],
2732 dependencies : [],
2733 install_rpath : rootlibexecdir,
2734 install : true,
2735 install_dir : rootlibexecdir)
5c616ecf
AZ
2736
2737 public_programs += executable(
2738 'oomctl',
2739 oomctl_sources,
2740 include_directories : includes,
2741 link_with : [libshared],
2742 dependencies : [],
2743 install_rpath : rootlibexecdir,
2744 install : true,
2745 install_dir : rootbindir)
9de5e321
AZ
2746endif
2747
349cc4a5 2748if conf.get('ENABLE_BINFMT') == 1
6164ec4c
ZJS
2749 public_programs += executable(
2750 'systemd-binfmt',
2751 'src/binfmt/binfmt.c',
2752 include_directories : includes,
2753 link_with : [libshared],
2754 install_rpath : rootlibexecdir,
2755 install : true,
2756 install_dir : rootlibexecdir)
37efbbd8
ZJS
2757
2758 meson.add_install_script('sh', '-c',
2759 mkdir_p.format(binfmtdir))
d7aa78c3
JT
2760 if install_sysconfdir
2761 meson.add_install_script('sh', '-c',
2762 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2763 endif
37efbbd8
ZJS
2764endif
2765
e594a3b1 2766if conf.get('ENABLE_REPART') == 1
6164ec4c
ZJS
2767 exe = executable(
2768 'systemd-repart',
2769 systemd_repart_sources,
2770 include_directories : includes,
2771 link_with : [libshared],
2772 dependencies : [threads,
6164ec4c
ZJS
2773 libblkid,
2774 libfdisk,
2775 libopenssl],
2776 install_rpath : rootlibexecdir,
2777 install : true,
2778 install_dir : rootbindir)
2d2d0a57 2779 public_programs += exe
e29e4d57
ZJS
2780
2781 if want_tests != 'false'
2782 test('test-repart',
2783 test_repart_sh,
2784 args : exe.full_path())
2785 endif
e594a3b1
LP
2786endif
2787
349cc4a5 2788if conf.get('ENABLE_VCONSOLE') == 1
6164ec4c
ZJS
2789 executable(
2790 'systemd-vconsole-setup',
2791 'src/vconsole/vconsole-setup.c',
2792 include_directories : includes,
2793 link_with : [libshared],
2794 install_rpath : rootlibexecdir,
2795 install : true,
2796 install_dir : rootlibexecdir)
5c23128d
ZJS
2797endif
2798
349cc4a5 2799if conf.get('ENABLE_RANDOMSEED') == 1
6164ec4c
ZJS
2800 executable(
2801 'systemd-random-seed',
2802 'src/random-seed/random-seed.c',
2803 include_directories : includes,
2804 link_with : [libshared],
2805 install_rpath : rootlibexecdir,
2806 install : true,
2807 install_dir : rootlibexecdir)
5c23128d
ZJS
2808endif
2809
349cc4a5 2810if conf.get('ENABLE_FIRSTBOOT') == 1
6164ec4c
ZJS
2811 executable(
2812 'systemd-firstboot',
2813 'src/firstboot/firstboot.c',
2814 include_directories : includes,
2815 link_with : [libshared],
2816 dependencies : [libcrypt],
2817 install_rpath : rootlibexecdir,
2818 install : true,
2819 install_dir : rootbindir)
2820endif
2821
2822executable(
2823 'systemd-remount-fs',
2824 'src/remount-fs/remount-fs.c',
2825 include_directories : includes,
bac11cd6 2826 link_with : [libshared],
6164ec4c
ZJS
2827 install_rpath : rootlibexecdir,
2828 install : true,
2829 install_dir : rootlibexecdir)
5c23128d 2830
6164ec4c
ZJS
2831executable(
2832 'systemd-machine-id-setup',
2833 'src/machine-id-setup/machine-id-setup-main.c',
2834 include_directories : includes,
bac11cd6 2835 link_with : [libshared],
6164ec4c
ZJS
2836 install_rpath : rootlibexecdir,
2837 install : true,
2838 install_dir : rootbindir)
5c23128d 2839
6164ec4c
ZJS
2840executable(
2841 'systemd-fsck',
2842 'src/fsck/fsck.c',
2843 include_directories : includes,
2844 link_with : [libshared],
2845 install_rpath : rootlibexecdir,
2846 install : true,
2847 install_dir : rootlibexecdir)
5c23128d 2848
80750adb
ZJS
2849executable('systemd-growfs',
2850 'src/partition/growfs.c',
2851 include_directories : includes,
2852 link_with : [libshared],
2853 install_rpath : rootlibexecdir,
2854 install : true,
2855 install_dir : rootlibexecdir)
2856
6164ec4c
ZJS
2857executable(
2858 'systemd-makefs',
2859 'src/partition/makefs.c',
2860 include_directories : includes,
2861 link_with : [libshared],
2862 install_rpath : rootlibexecdir,
2863 install : true,
2864 install_dir : rootlibexecdir)
b7f28ac5 2865
6164ec4c
ZJS
2866executable(
2867 'systemd-sleep',
2868 'src/sleep/sleep.c',
2869 include_directories : includes,
2870 link_with : [libshared],
2871 install_rpath : rootlibexecdir,
2872 install : true,
2873 install_dir : rootlibexecdir)
5c23128d 2874
225d08b8 2875if install_sysconfdir_samples
d7aa78c3
JT
2876 install_data('src/sleep/sleep.conf',
2877 install_dir : pkgsysconfdir)
2878endif
d25e127d 2879
6164ec4c
ZJS
2880public_programs += executable(
2881 'systemd-sysctl',
2882 'src/sysctl/sysctl.c',
2883 include_directories : includes,
2884 link_with : [libshared],
2885 install_rpath : rootlibexecdir,
2886 install : true,
2887 install_dir : rootlibexecdir)
5c23128d 2888
6164ec4c
ZJS
2889executable(
2890 'systemd-ac-power',
2891 'src/ac-power/ac-power.c',
2892 include_directories : includes,
2893 link_with : [libshared],
2894 install_rpath : rootlibexecdir,
2895 install : true,
2896 install_dir : rootlibexecdir)
5c23128d 2897
6164ec4c
ZJS
2898public_programs += executable(
2899 'systemd-detect-virt',
2900 'src/detect-virt/detect-virt.c',
2901 include_directories : includes,
2902 link_with : [libshared],
2903 install_rpath : rootlibexecdir,
2904 install : true)
5c23128d 2905
6164ec4c
ZJS
2906public_programs += executable(
2907 'systemd-delta',
2908 'src/delta/delta.c',
2909 include_directories : includes,
2910 link_with : [libshared],
2911 install_rpath : rootlibexecdir,
2912 install : true)
5c23128d 2913
6164ec4c
ZJS
2914public_programs += executable(
2915 'systemd-escape',
2916 'src/escape/escape.c',
2917 include_directories : includes,
2918 link_with : [libshared],
2919 install_rpath : rootlibexecdir,
2920 install : true,
2921 install_dir : rootbindir)
2922
2923public_programs += executable(
2924 'systemd-notify',
2925 'src/notify/notify.c',
2926 include_directories : includes,
2927 link_with : [libshared],
2928 install_rpath : rootlibexecdir,
2929 install : true,
2930 install_dir : rootbindir)
2931
2932executable(
2933 'systemd-volatile-root',
2934 'src/volatile-root/volatile-root.c',
2935 include_directories : includes,
2936 link_with : [libshared],
2937 install_rpath : rootlibexecdir,
cdf7ad38 2938 install : conf.get('ENABLE_INITRD') == 1,
6164ec4c
ZJS
2939 install_dir : rootlibexecdir)
2940
2941executable(
2942 'systemd-cgroups-agent',
2943 'src/cgroups-agent/cgroups-agent.c',
2944 include_directories : includes,
2945 link_with : [libshared],
2946 install_rpath : rootlibexecdir,
2947 install : true,
2948 install_dir : rootlibexecdir)
2949
2950public_programs += executable(
2951 'systemd-id128',
2952 'src/id128/id128.c',
2953 include_directories : includes,
2954 link_with : [libshared],
2955 install_rpath : rootlibexecdir,
2956 install : true)
2957
2958public_programs += executable(
2959 'systemd-path',
2960 'src/path/path.c',
2961 include_directories : includes,
2962 link_with : [libshared],
2963 install_rpath : rootlibexecdir,
2964 install : true)
2965
2966public_programs += executable(
2967 'systemd-ask-password',
2968 'src/ask-password/ask-password.c',
2969 include_directories : includes,
2970 link_with : [libshared],
2971 install_rpath : rootlibexecdir,
2972 install : true,
2973 install_dir : rootbindir)
2974
2975executable(
2976 'systemd-reply-password',
2977 'src/reply-password/reply-password.c',
2978 include_directories : includes,
2979 link_with : [libshared],
2980 install_rpath : rootlibexecdir,
2981 install : true,
2982 install_dir : rootlibexecdir)
2983
2984public_programs += executable(
2985 'systemd-tty-ask-password-agent',
2986 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2987 include_directories : includes,
2988 link_with : [libshared],
2989 install_rpath : rootlibexecdir,
2990 install : true,
2991 install_dir : rootbindir)
2992
2993public_programs += executable(
2994 'systemd-cgls',
2995 'src/cgls/cgls.c',
2996 include_directories : includes,
2997 link_with : [libshared],
2998 install_rpath : rootlibexecdir,
2999 install : true)
3000
3001public_programs += executable(
3002 'systemd-cgtop',
3003 'src/cgtop/cgtop.c',
3004 include_directories : includes,
3005 link_with : [libshared],
3006 install_rpath : rootlibexecdir,
3007 install : true)
3008
3009executable(
3010 'systemd-initctl',
3011 'src/initctl/initctl.c',
3012 include_directories : includes,
3013 link_with : [libshared],
3014 install_rpath : rootlibexecdir,
6589a569 3015 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
6164ec4c 3016 install_dir : rootlibexecdir)
5c23128d 3017
6164ec4c
ZJS
3018public_programs += executable(
3019 'systemd-mount',
3020 'src/mount/mount-tool.c',
3021 include_directories : includes,
3022 link_with : [libshared],
3023 dependencies: [libmount],
3024 install_rpath : rootlibexecdir,
3025 install : true)
5c23128d 3026
7b76fce1 3027meson.add_install_script(meson_make_symlink,
e17e5ba9 3028 'systemd-mount', join_paths(bindir, 'systemd-umount'))
7b76fce1 3029
6164ec4c
ZJS
3030public_programs += executable(
3031 'systemd-run',
3032 'src/run/run.c',
3033 include_directories : includes,
3034 link_with : [libshared],
3035 install_rpath : rootlibexecdir,
3036 install : true)
3037
3038public_programs += executable(
3039 'systemd-stdio-bridge',
3040 'src/stdio-bridge/stdio-bridge.c',
3041 include_directories : includes,
3042 link_with : [libshared],
3043 dependencies : [versiondep],
3044 install_rpath : rootlibexecdir,
3045 install : true)
3046
3047public_programs += executable(
3048 'busctl',
f98df767 3049 busctl_sources,
6164ec4c
ZJS
3050 include_directories : includes,
3051 link_with : [libshared],
3052 install_rpath : rootlibexecdir,
3053 install : true)
5c23128d 3054
bd7e6aa7
ZJS
3055if enable_sysusers
3056 exe = executable(
6164ec4c
ZJS
3057 'systemd-sysusers',
3058 'src/sysusers/sysusers.c',
3059 include_directories : includes,
3060 link_with : [libshared],
3061 install_rpath : rootlibexecdir,
3062 install : true,
3063 install_dir : rootbindir)
bd7e6aa7
ZJS
3064 public_programs += exe
3065
3066 if want_tests != 'false'
3067 test('test-sysusers',
3068 test_sysusers_sh,
3069 # https://github.com/mesonbuild/meson/issues/2681
3070 args : exe.full_path())
3071 endif
8ef8f3d5
FB
3072
3073 if have_standalone_binaries
bd7e6aa7 3074 exe = executable(
8ef8f3d5
FB
3075 'systemd-sysusers.standalone',
3076 'src/sysusers/sysusers.c',
3077 include_directories : includes,
3537577c 3078 c_args : '-DSTANDALONE',
8ef8f3d5
FB
3079 link_with : [libshared_static,
3080 libbasic,
3081 libbasic_gcrypt,
99b9f8fd 3082 libsystemd_static],
8ef8f3d5
FB
3083 install : true,
3084 install_dir : rootbindir)
bd7e6aa7
ZJS
3085 public_programs += exe
3086
3087 if want_tests != 'false'
3088 test('test-sysusers.standalone',
3089 test_sysusers_sh,
3090 # https://github.com/mesonbuild/meson/issues/2681
3091 args : exe.full_path())
3092 endif
8ef8f3d5 3093 endif
5c23128d
ZJS
3094endif
3095
349cc4a5 3096if conf.get('ENABLE_TMPFILES') == 1
6164ec4c
ZJS
3097 exe = executable(
3098 'systemd-tmpfiles',
db64ba81 3099 systemd_tmpfiles_sources,
6164ec4c
ZJS
3100 include_directories : includes,
3101 link_with : [libshared],
3102 dependencies : [libacl],
3103 install_rpath : rootlibexecdir,
3104 install : true,
3105 install_dir : rootbindir)
5a8b1640 3106 public_programs += exe
d9daae55 3107
938be089
ZJS
3108 if want_tests != 'false'
3109 test('test-systemd-tmpfiles',
3110 test_systemd_tmpfiles_py,
3111 # https://github.com/mesonbuild/meson/issues/2681
3112 args : exe.full_path())
3113 endif
db64ba81
FB
3114
3115 if have_standalone_binaries
3116 public_programs += executable(
3117 'systemd-tmpfiles.standalone',
3118 systemd_tmpfiles_sources,
3119 include_directories : includes,
3537577c 3120 c_args : '-DSTANDALONE',
db64ba81
FB
3121 link_with : [libshared_static,
3122 libbasic,
3123 libbasic_gcrypt,
99b9f8fd 3124 libsystemd_static],
db64ba81
FB
3125 dependencies : [libacl],
3126 install : true,
3127 install_dir : rootbindir)
3128 endif
5c23128d
ZJS
3129endif
3130
349cc4a5 3131if conf.get('ENABLE_HWDB') == 1
6164ec4c
ZJS
3132 public_programs += executable(
3133 'systemd-hwdb',
3134 'src/hwdb/hwdb.c',
6164ec4c 3135 include_directories : includes,
e4b127e2 3136 link_with : udev_link_with,
6164ec4c
ZJS
3137 install_rpath : udev_rpath,
3138 install : true,
3139 install_dir : rootbindir)
37efbbd8
ZJS
3140endif
3141
349cc4a5 3142if conf.get('ENABLE_QUOTACHECK') == 1
6164ec4c
ZJS
3143 executable(
3144 'systemd-quotacheck',
3145 'src/quotacheck/quotacheck.c',
3146 include_directories : includes,
3147 link_with : [libshared],
3148 install_rpath : rootlibexecdir,
3149 install : true,
3150 install_dir : rootlibexecdir)
3151endif
3152
3153public_programs += executable(
3154 'systemd-socket-proxyd',
3155 'src/socket-proxy/socket-proxyd.c',
3156 include_directories : includes,
3157 link_with : [libshared],
3158 dependencies : [threads],
3159 install_rpath : rootlibexecdir,
3160 install : true,
3161 install_dir : rootlibexecdir)
5c23128d 3162
6164ec4c
ZJS
3163public_programs += executable(
3164 'udevadm',
3165 udevadm_sources,
6164ec4c 3166 include_directories : includes,
e4b127e2 3167 link_with : [libudevd_core],
6164ec4c
ZJS
3168 dependencies : [versiondep,
3169 threads,
3170 libkmod,
3171 libidn,
3172 libacl,
3173 libblkid],
3174 install_rpath : udev_rpath,
3175 install : true,
3176 install_dir : rootbindir)
3177
3178executable(
3179 'systemd-shutdown',
3180 systemd_shutdown_sources,
3181 include_directories : includes,
bac11cd6 3182 link_with : [libshared],
6164ec4c
ZJS
3183 dependencies : [libmount],
3184 install_rpath : rootlibexecdir,
3185 install : true,
3186 install_dir : rootlibexecdir)
3187
3188executable(
3189 'systemd-update-done',
3190 'src/update-done/update-done.c',
3191 include_directories : includes,
3192 link_with : [libshared],
3193 install_rpath : rootlibexecdir,
3194 install : true,
3195 install_dir : rootlibexecdir)
3196
3197executable(
3198 'systemd-update-utmp',
3199 'src/update-utmp/update-utmp.c',
3200 include_directories : includes,
3201 link_with : [libshared],
3202 dependencies : [libaudit],
3203 install_rpath : rootlibexecdir,
55678b9e 3204 install : (conf.get('ENABLE_UTMP') == 1),
6164ec4c 3205 install_dir : rootlibexecdir)
5c23128d 3206
349cc4a5 3207if conf.get('HAVE_KMOD') == 1
6164ec4c
ZJS
3208 executable(
3209 'systemd-modules-load',
3210 'src/modules-load/modules-load.c',
3211 include_directories : includes,
3212 link_with : [libshared],
3213 dependencies : [libkmod],
3214 install_rpath : rootlibexecdir,
3215 install : true,
3216 install_dir : rootlibexecdir)
94e75a54 3217
37efbbd8
ZJS
3218 meson.add_install_script('sh', '-c',
3219 mkdir_p.format(modulesloaddir))
d7aa78c3
JT
3220 if install_sysconfdir
3221 meson.add_install_script('sh', '-c',
3222 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
3223 endif
5c23128d
ZJS
3224endif
3225
6164ec4c
ZJS
3226public_programs += executable(
3227 'systemd-nspawn',
3228 systemd_nspawn_sources,
3229 include_directories : includes,
bac11cd6 3230 link_with : [libnspawn_core,
6164ec4c
ZJS
3231 libshared],
3232 dependencies : [libblkid,
3233 libseccomp],
3234 install_rpath : rootlibexecdir,
3235 install : true)
5c23128d 3236
349cc4a5 3237if conf.get('ENABLE_NETWORKD') == 1
6164ec4c
ZJS
3238 executable(
3239 'systemd-networkd',
3240 systemd_networkd_sources,
8d40961c 3241 include_directories : network_includes,
6164ec4c
ZJS
3242 link_with : [libnetworkd_core,
3243 libsystemd_network,
6164ec4c
ZJS
3244 networkd_link_with],
3245 dependencies : [threads],
3246 install_rpath : rootlibexecdir,
3247 install : true,
3248 install_dir : rootlibexecdir)
3249
3250 executable(
3251 'systemd-networkd-wait-online',
3252 systemd_networkd_wait_online_sources,
3253 include_directories : includes,
8d40961c 3254 link_with : [networkd_link_with],
6164ec4c
ZJS
3255 install_rpath : rootlibexecdir,
3256 install : true,
3257 install_dir : rootlibexecdir)
3258
3259 public_programs += executable(
3260 'networkctl',
3261 networkctl_sources,
8d40961c 3262 include_directories : libsystemd_network_includes,
6164ec4c
ZJS
3263 link_with : [libsystemd_network,
3264 networkd_link_with],
3265 install_rpath : rootlibexecdir,
3266 install : true,
3267 install_dir : rootbindir)
3268
3269 exe = executable(
3270 'systemd-network-generator',
3271 network_generator_sources,
3272 include_directories : includes,
3273 link_with : [networkd_link_with],
3274 install_rpath : rootlibexecdir,
3275 install : true,
3276 install_dir : rootlibexecdir)
fbaa1137
ZJS
3277
3278 if want_tests != 'false'
3279 test('test-network-generator-conversion',
3280 test_network_generator_conversion_sh,
3281 # https://github.com/mesonbuild/meson/issues/2681
3282 args : exe.full_path())
3283 endif
dcfe072a 3284endif
e821f6a9 3285
6164ec4c
ZJS
3286executable(
3287 'systemd-sulogin-shell',
73e994f2 3288 'src/sulogin-shell/sulogin-shell.c',
6164ec4c
ZJS
3289 include_directories : includes,
3290 link_with : [libshared],
3291 install_rpath : rootlibexecdir,
3292 install : true,
3293 install_dir : rootlibexecdir)
e821f6a9 3294
69e96427
ZJS
3295############################################################
3296
e2d41370
FB
3297custom_target(
3298 'systemd-runtest.env',
3299 output : 'systemd-runtest.env',
3300 command : ['sh', '-c', '{ ' +
1485aacb 3301 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
81e06775 3302 'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(project_build_root, 'catalog')) +
e2d41370
FB
3303 '} >@OUTPUT@'],
3304 build_by_default : true)
3305
69e96427 3306foreach tuple : tests
37efbbd8 3307 sources = tuple[0]
5acb3cab
YW
3308 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3309 dependencies = tuple.length() > 2 ? tuple[2] : []
3310 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3311 condition = tuple.length() > 4 ? tuple[4] : ''
3312 type = tuple.length() > 5 ? tuple[5] : ''
3313 defs = tuple.length() > 6 ? tuple[6] : []
3314 parallel = tuple.length() > 7 ? tuple[7] : true
37efbbd8
ZJS
3315 timeout = 30
3316
3317 name = sources[0].split('/')[-1].split('.')[0]
3318 if type.startswith('timeout=')
3319 timeout = type.split('=')[1].to_int()
3320 type = ''
3321 endif
3b2bdd62
ZJS
3322
3323 if condition == '' or conf.get(condition) == 1
37efbbd8
ZJS
3324 exe = executable(
3325 name,
3326 sources,
3327 include_directories : incs,
3328 link_with : link_with,
60722ad7
ZJS
3329 dependencies : [versiondep,
3330 dependencies],
37efbbd8 3331 c_args : defs,
3b2bdd62 3332 build_by_default : want_tests != 'false',
37efbbd8 3333 install_rpath : rootlibexecdir,
7cdd9783
MB
3334 install : install_tests,
3335 install_dir : join_paths(testsdir, type))
37efbbd8
ZJS
3336
3337 if type == 'manual'
3338 message('@0@ is a manual test'.format(name))
3339 elif type == 'unsafe' and want_tests != 'unsafe'
3340 message('@0@ is an unsafe test'.format(name))
3b2bdd62 3341 elif want_tests != 'false'
37efbbd8
ZJS
3342 test(name, exe,
3343 env : test_env,
3344 timeout : timeout)
3345 endif
3346 else
3347 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3348 endif
69e96427
ZJS
3349endforeach
3350
0632b4cd 3351exe = executable(
37efbbd8
ZJS
3352 'test-libsystemd-sym',
3353 test_libsystemd_sym_c,
3354 include_directories : includes,
3355 link_with : [libsystemd],
fd1939fb 3356 build_by_default : want_tests != 'false',
37efbbd8
ZJS
3357 install : install_tests,
3358 install_dir : testsdir)
938be089
ZJS
3359if want_tests != 'false'
3360 test('test-libsystemd-sym', exe)
3361endif
37ab1a25 3362
0632b4cd
ZJS
3363exe = executable(
3364 'test-libsystemd-static-sym',
3365 test_libsystemd_sym_c,
3366 include_directories : includes,
0632b4cd
ZJS
3367 link_with : [install_libsystemd_static],
3368 dependencies : [threads], # threads is already included in dependencies on the library,
3369 # but does not seem to get propagated. Add here as a work-around.
fd1939fb 3370 build_by_default : want_tests != 'false' and static_libsystemd_pic,
20f3d32d 3371 install : install_tests and static_libsystemd_pic,
0632b4cd 3372 install_dir : testsdir)
938be089 3373if want_tests != 'false' and static_libsystemd_pic
0632b4cd
ZJS
3374 test('test-libsystemd-static-sym', exe)
3375endif
37ab1a25 3376
0632b4cd 3377exe = executable(
37efbbd8
ZJS
3378 'test-libudev-sym',
3379 test_libudev_sym_c,
e4b127e2 3380 include_directories : libudev_includes,
c1cd6743 3381 c_args : '-Wno-deprecated-declarations',
37efbbd8 3382 link_with : [libudev],
fd1939fb 3383 build_by_default : want_tests != 'false',
37efbbd8
ZJS
3384 install : install_tests,
3385 install_dir : testsdir)
938be089
ZJS
3386if want_tests != 'false'
3387 test('test-libudev-sym', exe)
3388endif
0632b4cd
ZJS
3389
3390exe = executable(
3391 'test-libudev-static-sym',
3392 test_libudev_sym_c,
e4b127e2 3393 include_directories : libudev_includes,
c1cd6743 3394 c_args : '-Wno-deprecated-declarations',
0632b4cd 3395 link_with : [install_libudev_static],
fd1939fb 3396 build_by_default : want_tests != 'false' and static_libudev_pic,
20f3d32d 3397 install : install_tests and static_libudev_pic,
0632b4cd 3398 install_dir : testsdir)
938be089 3399if want_tests != 'false' and static_libudev_pic
0632b4cd
ZJS
3400 test('test-libudev-static-sym', exe)
3401endif
e0bec52f 3402
69e96427 3403############################################################
5c23128d 3404
7db7d5b7
JR
3405fuzzer_exes = []
3406
7e299ffe
ZJS
3407foreach tuple : fuzzers
3408 sources = tuple[0]
5acb3cab
YW
3409 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3410 dependencies = tuple.length() > 2 ? tuple[2] : []
3411 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3412 defs = tuple.length() > 4 ? tuple[4] : []
7e299ffe
ZJS
3413 link_args = []
3414
3415 if want_ossfuzz
3416 dependencies += fuzzing_engine
3417 elif want_libfuzzer
3418 if fuzzing_engine.found()
9c5c4677
EV
3419 dependencies += fuzzing_engine
3420 else
7e299ffe 3421 link_args += ['-fsanitize=fuzzer']
9c5c4677 3422 endif
7e299ffe
ZJS
3423 else
3424 sources += 'src/fuzz/fuzz-main.c'
3425 endif
7db7d5b7 3426
7e299ffe 3427 name = sources[0].split('/')[-1].split('.')[0]
7db7d5b7 3428
7e299ffe
ZJS
3429 fuzzer_exes += executable(
3430 name,
3431 sources,
3432 include_directories : [incs, include_directories('src/fuzz')],
3433 link_with : link_with,
3434 dependencies : dependencies,
3435 c_args : defs,
3436 link_args: link_args,
3437 install : false,
3438 build_by_default : fuzz_tests or fuzzer_build)
3439endforeach
7db7d5b7 3440
6164ec4c
ZJS
3441run_target(
3442 'fuzzers',
63058f43 3443 depends : fuzzer_exes,
7db7d5b7
JR
3444 command : ['true'])
3445
3446############################################################
3447
5c23128d
ZJS
3448subdir('sysctl.d')
3449subdir('sysusers.d')
3450subdir('tmpfiles.d')
4f10b807
ZJS
3451subdir('hwdb.d')
3452subdir('units')
e783f957 3453subdir('presets')
5c23128d
ZJS
3454subdir('network')
3455subdir('man')
3456subdir('shell-completion/bash')
3457subdir('shell-completion/zsh')
9e825ebf
FB
3458subdir('docs/sysvinit')
3459subdir('docs/var-log')
5c23128d 3460
5c23128d
ZJS
3461install_subdir('factory/etc',
3462 install_dir : factorydir)
3463
d7aa78c3
JT
3464if install_sysconfdir
3465 install_data('xorg/50-systemd-user.sh',
3466 install_dir : xinitrcdir)
3467endif
582faeb4
DJL
3468install_data('modprobe.d/systemd.conf',
3469 install_dir : modprobedir)
f09eb768 3470install_data('LICENSE.GPL2',
5c23128d 3471 'LICENSE.LGPL2.1',
f09eb768
LP
3472 'NEWS',
3473 'README',
eea98402 3474 'docs/CODING_STYLE.md',
1d1cb168 3475 'docs/DISTRO_PORTING.md',
9e825ebf 3476 'docs/ENVIRONMENT.md',
5425f8a5 3477 'docs/HACKING.md',
9e825ebf 3478 'docs/TRANSIENT-SETTINGS.md',
b6dc0d7d 3479 'docs/TRANSLATORS.md',
9e825ebf 3480 'docs/UIDS-GIDS.md',
2bc48bbd 3481 'docs/GVARIANT-SERIALIZATION.md',
5c23128d 3482 install_dir : docdir)
d68b342b 3483
94e75a54
ZJS
3484meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3485meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3486
d68b342b
ZJS
3487############################################################
3488
dd1e33c8 3489check_help = find_program('tools/check-help.sh')
005a29f2
ZJS
3490
3491foreach exec : public_programs
37efbbd8 3492 name = exec.full_path().split('/')[-1]
938be089
ZJS
3493 if want_tests != 'false'
3494 test('check-help-' + name,
dd1e33c8 3495 check_help,
c1cd6743 3496 args : exec.full_path())
938be089 3497 endif
005a29f2
ZJS
3498endforeach
3499
3500############################################################
3501
c6448ee3
ZJS
3502check_directives_sh = find_program('tools/check-directives.sh')
3503
3504if want_tests != 'false'
3505 test('check-directives',
3506 check_directives_sh,
3507 args : project_source_root)
3508endif
3509
3510############################################################
3511
52d4d1d3
ZJS
3512# Enable tests for all supported sanitizers
3513foreach tuple : sanitizers
3514 sanitizer = tuple[0]
3515 build = tuple[1]
b68dfb9e 3516
7a6397d2 3517 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
52d4d1d3
ZJS
3518 prev = ''
3519 foreach p : fuzz_regression_tests
3520 b = p.split('/')[-2]
3521 c = p.split('/')[-1]
3522
3523 name = '@0@:@1@'.format(b, sanitizer)
3524
3525 if name != prev
3526 if want_tests == 'false'
3527 message('Not compiling @0@ because tests is set to false'.format(name))
1763ef1d 3528 elif fuzz_tests
52d4d1d3
ZJS
3529 exe = custom_target(
3530 name,
3531 output : name,
3532 depends : build,
3533 command : [env, 'ln', '-fs',
3534 join_paths(build.full_path(), b),
3535 '@OUTPUT@'],
3536 build_by_default : true)
3537 else
1763ef1d 3538 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
52d4d1d3
ZJS
3539 endif
3540 endif
3541 prev = name
3542
1763ef1d 3543 if fuzz_tests
0f82a2ab 3544 test('@0@_@1@_@2@'.format(b, c, sanitizer),
52d4d1d3 3545 env,
89767158
EV
3546 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3547 timeout : 60,
52d4d1d3 3548 args : [exe.full_path(),
1485aacb 3549 join_paths(project_source_root, p)])
52d4d1d3
ZJS
3550 endif
3551 endforeach
b68dfb9e
ZJS
3552 endif
3553endforeach
3554
52d4d1d3 3555
b68dfb9e
ZJS
3556############################################################
3557
0700e8ba 3558if git.found()
37efbbd8 3559 all_files = run_command(
a412ec57 3560 'env', '-u', 'GIT_WORK_TREE',
37efbbd8 3561 git,
a412ec57
ZJS
3562 '--git-dir=@0@/.git'.format(project_source_root),
3563 'ls-files', ':/*.[ch]')
3564
37efbbd8 3565 all_files = files(all_files.stdout().split())
d68b342b 3566
e85a690b 3567 custom_target(
0700e8ba 3568 'tags',
e85a690b 3569 output : 'tags',
1485aacb 3570 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
2f09974f 3571 run_target(
0700e8ba 3572 'ctags',
1485aacb 3573 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
d68b342b 3574endif
177929c2
ZJS
3575
3576if git.found()
dd1e33c8 3577 git_contrib_sh = find_program('tools/git-contrib.sh')
a923e085 3578 run_target(
37efbbd8 3579 'git-contrib',
dd1e33c8 3580 command : [git_contrib_sh])
177929c2 3581endif
dd6ab3df
ZJS
3582
3583if git.found()
3584 git_head = run_command(
3585 git,
1485aacb 3586 ['--git-dir=@0@/.git'.format(project_source_root),
dd6ab3df
ZJS
3587 'rev-parse', 'HEAD']).stdout().strip()
3588 git_head_short = run_command(
3589 git,
1485aacb 3590 ['--git-dir=@0@/.git'.format(project_source_root),
dd6ab3df
ZJS
3591 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3592
3593 run_target(
3594 'git-snapshot',
3595 command : ['git', 'archive',
1485aacb 3596 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
dd6ab3df
ZJS
3597 git_head_short),
3598 '--prefix', 'systemd-@0@/'.format(git_head),
3599 'HEAD'])
3600endif
829257d1
ZJS
3601
3602############################################################
3603
dd1e33c8 3604check_api_docs_sh = find_program('tools/check-api-docs.sh')
51b13863
LP
3605run_target(
3606 'check-api-docs',
3607 depends : [man, libsystemd, libudev],
dd1e33c8 3608 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
51b13863 3609
4c890ad3
ZJS
3610############################################################
3611
3612if dbus_docs.length() > 0
3613 custom_target(
3614 'update-dbus-docs',
3615 output : 'update-dbus-docs',
3616 command : [update_dbus_docs_py,
3617 '--build-dir=@0@'.format(project_build_root),
3618 '@INPUT@'],
3619 input : dbus_docs)
3620
3621 if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER'
3622 test('dbus-docs-fresh',
3623 update_dbus_docs_py,
3624 args : ['--build-dir=@0@'.format(project_build_root),
3625 '--test'] + dbus_docs)
3626 endif
3627endif
3628
e3c368f6
ZJS
3629custom_target(
3630 'update-man-rules',
3631 output : 'update-man-rules',
3632 command : ['sh', '-c',
3633 'cd @0@ && '.format(meson.build_root()) +
3634 'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) +
3635 'mv t @0@/man/rules/meson.build'.format(meson.current_source_dir())],
3636 depend_files : custom_entities_ent)
3637
51b13863 3638############################################################
7bc9ea51 3639watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog
51b13863 3640
829257d1
ZJS
3641status = [
3642 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3643
4c8e5f44 3644 'build mode: @0@'.format(get_option('mode')),
2675413e 3645 'split /usr: @0@'.format(split_usr),
157baa87 3646 'split bin-sbin: @0@'.format(split_bin),
359b496f
YW
3647 'prefix directory: @0@'.format(prefixdir),
3648 'rootprefix directory: @0@'.format(rootprefixdir),
3649 'sysconf directory: @0@'.format(sysconfdir),
3650 'include directory: @0@'.format(includedir),
3651 'lib directory: @0@'.format(libdir),
3652 'rootlib directory: @0@'.format(rootlibdir),
829257d1
ZJS
3653 'SysV init scripts: @0@'.format(sysvinit_path),
3654 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
359b496f
YW
3655 'PAM modules directory: @0@'.format(pamlibdir),
3656 'PAM configuration directory: @0@'.format(pamconfdir),
3657 'RPM macros directory: @0@'.format(rpmmacrosdir),
3658 'modprobe.d directory: @0@'.format(modprobedir),
3659 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3660 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3661 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3662 'bash completions directory: @0@'.format(bashcompletiondir),
3663 'zsh completions directory: @0@'.format(zshcompletiondir),
829257d1 3664 'extra start script: @0@'.format(get_option('rc-local')),
829257d1
ZJS
3665 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3666 get_option('debug-tty')),
3667 'TTY GID: @0@'.format(tty_gid),
ac09340e 3668 'users GID: @0@'.format(substs.get('USERS_GID')),
fc1a5d1a
ZJS
3669 'system UIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
3670 conf.get('SYSTEM_ALLOC_UID_MIN')),
3671 'system GIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
3672 conf.get('SYSTEM_ALLOC_GID_MIN')),
0411a118
ZJS
3673 'dynamic UIDs: @0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
3674 'container UID bases: @0@…@1@'.format(container_uid_base_min, container_uid_base_max),
829257d1 3675 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
4e15a734 3676 'render group access mode: @0@'.format(get_option('group-render-mode')),
359b496f 3677 'certificate root directory: @0@'.format(get_option('certificate-root')),
829257d1 3678 'support URL: @0@'.format(support_url),
afde4574
LP
3679 'nobody user name: @0@'.format(nobody_user),
3680 'nobody group name: @0@'.format(nobody_group),
829257d1
ZJS
3681 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3682
3683 'default DNSSEC mode: @0@'.format(default_dnssec),
c9299be2 3684 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
3614df05
ZJS
3685 'default mDNS mode: @0@'.format(default_mdns),
3686 'default LLMNR mode: @0@'.format(default_llmnr),
829257d1 3687 'default cgroup hierarchy: @0@'.format(default_hierarchy),
06da5c63 3688 'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
8ca9e92c 3689 'default KillUserProcesses setting: @0@'.format(kill_user_processes),
21d0dd5a 3690 'default locale: @0@'.format(default_locale),
5bc655cd 3691 'default user $PATH: @0@'.format(default_user_path_display),
7bc9ea51 3692 'systemd service watchdog: @0@'.format(watchdog_opt)]
829257d1
ZJS
3693
3694alt_dns_servers = '\n '.join(dns_servers.split(' '))
3695alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3696status += [
3697 'default DNS servers: @0@'.format(alt_dns_servers),
3698 'default NTP servers: @0@'.format(alt_ntp_servers)]
3699
3700alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3701 '@@0@'.format(time_epoch)).stdout().strip()
3702status += [
3703 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3704
19d8c9c9 3705status += [
abc8caf7
ZJS
3706 'static libsystemd: @0@'.format(static_libsystemd),
3707 'static libudev: @0@'.format(static_libudev)]
19d8c9c9 3708
829257d1
ZJS
3709# TODO:
3710# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3711# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3712# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3713
349cc4a5 3714if conf.get('ENABLE_EFI') == 1
5a8b1640 3715 status += 'efi arch: @0@'.format(efi_arch)
829257d1
ZJS
3716
3717 if have_gnu_efi
3718 status += [
3719 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
c512dfb9 3720 'EFI CC @0@'.format(' '.join(efi_cc)),
ce4121c6
ZJS
3721 'EFI lds: @0@'.format(efi_lds),
3722 'EFI crt0: @0@'.format(efi_crt0),
359b496f 3723 'EFI include directory: @0@'.format(efi_incdir)]
829257d1
ZJS
3724 endif
3725endif
3726
3727found = []
3728missing = []
3729
3730foreach tuple : [
3731 ['libcryptsetup'],
3732 ['PAM'],
70a5db58 3733 ['pwquality'],
c757517d 3734 ['libfdisk'],
839fddbe 3735 ['p11kit'],
af4fbd46 3736 ['libfido2'],
5e521624 3737 ['tpm2'],
829257d1
ZJS
3738 ['AUDIT'],
3739 ['IMA'],
3740 ['AppArmor'],
3741 ['SELinux'],
3742 ['SECCOMP'],
3743 ['SMACK'],
3744 ['zlib'],
3745 ['xz'],
ef5924aa 3746 ['zstd'],
829257d1
ZJS
3747 ['lz4'],
3748 ['bzip2'],
3749 ['ACL'],
3750 ['gcrypt'],
3751 ['qrencode'],
3752 ['microhttpd'],
3753 ['gnutls'],
096cbdce 3754 ['openssl'],
829257d1 3755 ['libcurl'],
d1bf5675 3756 ['idn'],
cdf7ad38 3757 ['initrd'],
53393c89 3758 ['compat-mutable-uid-boundaries'],
7e0079f9 3759 ['nscd'],
87057e24 3760 ['libidn2'],
829257d1
ZJS
3761 ['libidn'],
3762 ['libiptc'],
3763 ['elfutils'],
3764 ['binfmt'],
e594a3b1 3765 ['repart'],
829257d1
ZJS
3766 ['vconsole'],
3767 ['quotacheck'],
3768 ['tmpfiles'],
3769 ['environment.d'],
3770 ['sysusers'],
3771 ['firstboot'],
3772 ['randomseed'],
3773 ['backlight'],
3774 ['rfkill'],
8feca247 3775 ['xdg-autostart'],
829257d1
ZJS
3776 ['logind'],
3777 ['machined'],
61d0578b 3778 ['portabled'],
9bca4ae4 3779 ['sysext'],
d093b62c 3780 ['userdb'],
70a5db58 3781 ['homed'],
829257d1
ZJS
3782 ['importd'],
3783 ['hostnamed'],
3784 ['timedated'],
3785 ['timesyncd'],
3786 ['localed'],
3787 ['networkd'],
a7456af5 3788 ['resolve'],
096cbdce
IT
3789 ['DNS-over-TLS(gnutls)', conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1],
3790 ['DNS-over-TLS(openssl)', conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1],
829257d1 3791 ['coredump'],
9b4abc69 3792 ['pstore'],
61ff7397 3793 ['oomd'],
829257d1
ZJS
3794 ['polkit'],
3795 ['legacy pkla', install_polkit_pkla],
3796 ['efi'],
3797 ['gnu-efi', have_gnu_efi],
3798 ['kmod'],
3799 ['xkbcommon'],
c4c978a0 3800 ['pcre2'],
829257d1
ZJS
3801 ['blkid'],
3802 ['dbus'],
3803 ['glib'],
6bd2bc8e
ZJS
3804 ['nss-myhostname'],
3805 ['nss-mymachines'],
3806 ['nss-resolve'],
3807 ['nss-systemd'],
829257d1
ZJS
3808 ['hwdb'],
3809 ['tpm'],
3810 ['man pages', want_man],
3811 ['html pages', want_html],
3812 ['man page indices', want_man and have_lxml],
829257d1
ZJS
3813 ['SysV compat'],
3814 ['utmp'],
3815 ['ldconfig'],
3816 ['hibernate'],
3817 ['adm group', get_option('adm-group')],
3818 ['wheel group', get_option('wheel-group')],
b14e1b43 3819 ['gshadow'],
829257d1
ZJS
3820 ['debug hashmap'],
3821 ['debug mmap cache'],
d6601495 3822 ['debug siphash'],
d18cb393 3823 ['valgrind', conf.get('VALGRIND') == 1],
fd5dec9a 3824 ['trace logging', conf.get('LOG_TRACE') == 1],
b6261be8 3825 ['install tests', install_tests],
19d8c9c9
LP
3826 ['link-udev-shared', get_option('link-udev-shared')],
3827 ['link-systemctl-shared', get_option('link-systemctl-shared')],
5ac8b50d 3828 ['link-networkd-shared', get_option('link-networkd-shared')],
fd74a13e 3829 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
f30bf4d9 3830 ['kernel-install', get_option('kernel-install')],
b3259a6e 3831 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
ceedbf81 3832 ['fexecve'],
18b49798 3833 ['standalone-binaries', get_option('standalone-binaries')],
829257d1
ZJS
3834]
3835
af4d7860
ZJS
3836 if tuple.length() >= 2
3837 cond = tuple[1]
3838 else
829257d1
ZJS
3839 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3840 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
349cc4a5 3841 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
829257d1
ZJS
3842 endif
3843 if cond
5a8b1640 3844 found += tuple[0]
829257d1 3845 else
5a8b1640 3846 missing += tuple[0]
829257d1
ZJS
3847 endif
3848endforeach
3849
3850status += [
9d39c1bf 3851 '',
829257d1 3852 'enabled features: @0@'.format(', '.join(found)),
9d39c1bf
ZJS
3853 '',
3854 'disabled features: @0@'.format(', '.join(missing)),
3855 '']
829257d1 3856message('\n '.join(status))
9a8e64b0
ZJS
3857
3858if rootprefixdir != rootprefix_default
8ea9fad7
YW
3859 warning('\n' +
3860 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3861 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3862 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
9a8e64b0 3863endif