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