]> git.ipfire.org Git - thirdparty/systemd.git/blame - meson.build
Merge pull request #17228 from bluca/bind_path_runtime
[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',
1612 'src/libsystemd/sd-netlink',
1613 'src/libsystemd/sd-network',
ceb26cdb 1614 'src/libsystemd/sd-resolve',
93379452
ZJS
1615 'src/login',
1616 'src/nspawn',
1617 'src/resolve',
1618 'src/shared',
1619 'src/shutdown',
1620 'src/systemd',
1621 'src/time-wait-sync',
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],
5e3cec87
ZJS
1668 link_whole : [libsystemd_static,
1669 libjournal_client],
37efbbd8
ZJS
1670 dependencies : [threads,
1671 librt,
1672 libxz,
ef5924aa 1673 libzstd,
37efbbd8
ZJS
1674 liblz4],
1675 link_depends : libsystemd_sym,
1676 install : true,
1677 install_dir : rootlibdir)
5c23128d 1678
70848ecf
DC
1679static_libsystemd = get_option('static-libsystemd')
1680static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
1681
1682install_libsystemd_static = static_library(
1683 'systemd',
1684 libsystemd_sources,
1685 journal_client_sources,
975464e0
ZJS
1686 basic_sources,
1687 basic_gcrypt_sources,
be44b572 1688 disable_mempool_c,
70848ecf 1689 include_directories : includes,
70848ecf
DC
1690 build_by_default : static_libsystemd != 'false',
1691 install : static_libsystemd != 'false',
1692 install_dir : rootlibdir,
1693 pic : static_libsystemd == 'true' or static_libsystemd == 'pic',
1694 dependencies : [threads,
1695 librt,
1696 libxz,
ef5924aa 1697 libzstd,
70848ecf 1698 liblz4,
975464e0
ZJS
1699 libcap,
1700 libblkid,
1701 libmount,
1702 libselinux,
70848ecf
DC
1703 libgcrypt],
1704 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1705
47354b44
ZJS
1706############################################################
1707
83b6af36
ZJS
1708# binaries that have --help and are intended for use by humans,
1709# usually, but not always, installed in /bin.
1710public_programs = []
1711
83b6af36
ZJS
1712subdir('src/shared')
1713subdir('src/core')
9e71f5d9 1714subdir('src/shutdown')
83b6af36
ZJS
1715subdir('src/udev')
1716subdir('src/network')
1717
1718subdir('src/analyze')
1719subdir('src/journal-remote')
1720subdir('src/coredump')
9b4abc69 1721subdir('src/pstore')
61ff7397 1722subdir('src/oom')
83b6af36
ZJS
1723subdir('src/hostname')
1724subdir('src/import')
e594a3b1 1725subdir('src/partition')
83b6af36
ZJS
1726subdir('src/kernel-install')
1727subdir('src/locale')
1728subdir('src/machine')
61d0578b 1729subdir('src/portable')
d093b62c 1730subdir('src/userdb')
70a5db58 1731subdir('src/home')
83b6af36
ZJS
1732subdir('src/nspawn')
1733subdir('src/resolve')
1734subdir('src/timedate')
1735subdir('src/timesync')
db64ba81 1736subdir('src/tmpfiles')
83b6af36 1737subdir('src/vconsole')
83b6af36
ZJS
1738subdir('src/boot/efi')
1739
1740subdir('src/test')
7db7d5b7 1741subdir('src/fuzz')
ef2ad30a 1742subdir('rules.d')
83b6af36
ZJS
1743subdir('test')
1744
1745############################################################
1746
1747# only static linking apart from libdl, to make sure that the
1748# module is linked to all libraries that it uses.
1749test_dlopen = executable(
37efbbd8
ZJS
1750 'test-dlopen',
1751 test_dlopen_c,
a5d8835c 1752 disable_mempool_c,
37efbbd8
ZJS
1753 include_directories : includes,
1754 link_with : [libbasic],
fd1939fb
YW
1755 dependencies : [libdl],
1756 build_by_default : want_tests != 'false')
83b6af36 1757
08540a95 1758foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
037b0a47 1759 ['systemd', 'ENABLE_NSS_SYSTEMD', 'src/nss-systemd/userdb-glue.c src/nss-systemd/userdb-glue.h src/nss-systemd/nss-systemd.h'],
08540a95
YW
1760 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
1761 ['resolve', 'ENABLE_NSS_RESOLVE']]
5c23128d 1762
349cc4a5 1763 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
37efbbd8
ZJS
1764 if condition
1765 module = tuple[0]
37efbbd8
ZJS
1766
1767 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1485aacb 1768 version_script_arg = join_paths(project_source_root, sym)
37efbbd8 1769
1684c56f
LP
1770 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
1771 if tuple.length() > 2
1772 sources += tuple[2].split()
1773 endif
1774
37efbbd8
ZJS
1775 nss = shared_library(
1776 'nss_' + module,
1684c56f 1777 sources,
a5d8835c 1778 disable_mempool_c,
37efbbd8
ZJS
1779 version : '2',
1780 include_directories : includes,
b4b36f44
LP
1781 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1782 link_args : ['-Wl,-z,nodelete',
1783 '-shared',
700805f6 1784 '-Wl,--version-script=' + version_script_arg],
37e4d7a8 1785 link_with : [libsystemd_static,
733cbd00 1786 libshared_static,
37efbbd8
ZJS
1787 libbasic],
1788 dependencies : [threads,
5486a31d 1789 librt],
37efbbd8
ZJS
1790 link_depends : sym,
1791 install : true,
1792 install_dir : rootlibdir)
1793
1794 # We cannot use shared_module because it does not support version suffix.
1795 # Unfortunately shared_library insists on creating the symlink…
1796 meson.add_install_script('sh', '-c',
1797 'rm $DESTDIR@0@/libnss_@1@.so'
1798 .format(rootlibdir, module))
1799
938be089
ZJS
1800 if want_tests != 'false'
1801 test('dlopen-nss_' + module,
1802 test_dlopen,
1803 # path to dlopen must include a slash
1804 args : nss.full_path())
1805 endif
37efbbd8 1806 endif
5c23128d
ZJS
1807endforeach
1808
1809############################################################
1810
6164ec4c
ZJS
1811executable(
1812 'systemd',
1813 systemd_sources,
1814 include_directories : includes,
1815 link_with : [libcore,
1816 libshared],
1817 dependencies : [versiondep,
1818 threads,
1819 librt,
1820 libseccomp,
1821 libselinux,
1822 libmount,
1823 libblkid],
1824 install_rpath : rootlibexecdir,
1825 install : true,
1826 install_dir : rootlibexecdir)
5c23128d 1827
ba7f4ae6
ZJS
1828meson.add_install_script(meson_make_symlink,
1829 join_paths(rootlibexecdir, 'systemd'),
1830 join_paths(rootsbindir, 'init'))
1831
6164ec4c
ZJS
1832public_programs += executable(
1833 'systemd-analyze',
1834 systemd_analyze_sources,
1835 include_directories : includes,
1836 link_with : [libcore,
1837 libshared],
1838 dependencies : [versiondep,
1839 threads,
1840 librt,
1841 libseccomp,
1842 libselinux,
1843 libmount,
1844 libblkid],
1845 install_rpath : rootlibexecdir,
b3259a6e 1846 install : conf.get('ENABLE_ANALYZE'))
5c23128d 1847
6164ec4c
ZJS
1848executable(
1849 'systemd-journald',
1850 systemd_journald_sources,
1851 include_directories : includes,
1852 link_with : [libjournal_core,
1853 libshared],
1854 dependencies : [threads,
1855 libxz,
1856 liblz4,
ef5924aa
NL
1857 libselinux,
1858 libzstd],
6164ec4c
ZJS
1859 install_rpath : rootlibexecdir,
1860 install : true,
1861 install_dir : rootlibexecdir)
5c23128d 1862
6164ec4c
ZJS
1863public_programs += executable(
1864 'systemd-cat',
1865 systemd_cat_sources,
1866 include_directories : includes,
1867 link_with : [libjournal_core,
1868 libshared],
1869 dependencies : [threads],
1870 install_rpath : rootlibexecdir,
1871 install : true)
1872
1873public_programs += executable(
1874 'journalctl',
1875 journalctl_sources,
1876 include_directories : includes,
1877 link_with : [libshared],
1878 dependencies : [threads,
e44b5004 1879 libdl,
6164ec4c
ZJS
1880 libxz,
1881 liblz4,
9200bb30
LP
1882 libzstd,
1883 libdl],
6164ec4c
ZJS
1884 install_rpath : rootlibexecdir,
1885 install : true,
1886 install_dir : rootbindir)
35a1ff4c 1887
6164ec4c
ZJS
1888executable(
1889 'systemd-getty-generator',
1890 'src/getty-generator/getty-generator.c',
1891 include_directories : includes,
1892 link_with : [libshared],
1893 install_rpath : rootlibexecdir,
1894 install : true,
1895 install_dir : systemgeneratordir)
5c23128d 1896
6164ec4c
ZJS
1897executable(
1898 'systemd-debug-generator',
1899 'src/debug-generator/debug-generator.c',
1900 include_directories : includes,
1901 link_with : [libshared],
1902 install_rpath : rootlibexecdir,
1903 install : true,
1904 install_dir : systemgeneratordir)
1905
1906executable(
1907 'systemd-run-generator',
1908 'src/run-generator/run-generator.c',
1909 include_directories : includes,
1910 link_with : [libshared],
1911 install_rpath : rootlibexecdir,
1912 install : true,
1913 install_dir : systemgeneratordir)
1914
1915executable(
1916 'systemd-fstab-generator',
1917 'src/fstab-generator/fstab-generator.c',
1918 include_directories : includes,
1919 link_with : [libcore_shared,
1920 libshared],
1921 install_rpath : rootlibexecdir,
1922 install : true,
1923 install_dir : systemgeneratordir)
5c23128d 1924
349cc4a5 1925if conf.get('ENABLE_ENVIRONMENT_D') == 1
6164ec4c
ZJS
1926 executable(
1927 '30-systemd-environment-d-generator',
1928 'src/environment-d-generator/environment-d-generator.c',
1929 include_directories : includes,
1930 link_with : [libshared],
1931 install_rpath : rootlibexecdir,
1932 install : true,
1933 install_dir : userenvgeneratordir)
7b76fce1 1934
37efbbd8
ZJS
1935 meson.add_install_script(meson_make_symlink,
1936 join_paths(sysconfdir, 'environment'),
1937 join_paths(environmentdir, '99-environment.conf'))
5c23128d
ZJS
1938endif
1939
349cc4a5 1940if conf.get('ENABLE_HIBERNATE') == 1
6164ec4c
ZJS
1941 executable(
1942 'systemd-hibernate-resume-generator',
1943 'src/hibernate-resume/hibernate-resume-generator.c',
1944 include_directories : includes,
1945 link_with : [libshared],
1946 install_rpath : rootlibexecdir,
1947 install : true,
1948 install_dir : systemgeneratordir)
1949
1950 executable(
1951 'systemd-hibernate-resume',
1952 'src/hibernate-resume/hibernate-resume.c',
1953 include_directories : includes,
1954 link_with : [libshared],
1955 install_rpath : rootlibexecdir,
1956 install : true,
1957 install_dir : rootlibexecdir)
37efbbd8
ZJS
1958endif
1959
349cc4a5 1960if conf.get('HAVE_BLKID') == 1
6164ec4c
ZJS
1961 executable(
1962 'systemd-gpt-auto-generator',
1963 'src/gpt-auto-generator/gpt-auto-generator.c',
1964 'src/shared/blkid-util.h',
1965 include_directories : includes,
1966 link_with : [libshared],
1967 dependencies : libblkid,
1968 install_rpath : rootlibexecdir,
1969 install : true,
1970 install_dir : systemgeneratordir)
1971
1972 public_programs += executable(
1973 'systemd-dissect',
1974 'src/dissect/dissect.c',
1975 include_directories : includes,
1976 link_with : [libshared],
1977 install_rpath : rootlibexecdir,
5a151082 1978 install : true)
5c23128d
ZJS
1979endif
1980
1ec57f33 1981if conf.get('ENABLE_RESOLVE') == 1
6164ec4c
ZJS
1982 executable(
1983 'systemd-resolved',
1984 systemd_resolved_sources,
1985 include_directories : includes,
1986 link_with : [libshared,
1987 libbasic_gcrypt,
1988 libsystemd_resolve_core],
1989 dependencies : systemd_resolved_dependencies,
1990 install_rpath : rootlibexecdir,
1991 install : true,
1992 install_dir : rootlibexecdir)
1993
1994 public_programs += executable(
1995 'resolvectl',
1996 resolvectl_sources,
1997 include_directories : includes,
1998 link_with : [libshared,
1999 libbasic_gcrypt,
2000 libsystemd_resolve_core],
2001 dependencies : [threads,
2002 libgpg_error,
2003 libm,
2004 libidn],
2005 install_rpath : rootlibexecdir,
2006 install : true)
088c1363
LP
2007
2008 meson.add_install_script(meson_make_symlink,
6164ec4c
ZJS
2009 join_paths(bindir, 'resolvectl'),
2010 join_paths(rootsbindir, 'resolvconf'))
c2e84cab
YW
2011
2012 meson.add_install_script(meson_make_symlink,
6164ec4c
ZJS
2013 join_paths(bindir, 'resolvectl'),
2014 join_paths(bindir, 'systemd-resolve'))
5c23128d
ZJS
2015endif
2016
349cc4a5 2017if conf.get('ENABLE_LOGIND') == 1
6164ec4c
ZJS
2018 executable(
2019 'systemd-logind',
2020 systemd_logind_sources,
2021 include_directories : includes,
2022 link_with : [liblogind_core,
2023 libshared],
2024 dependencies : [threads,
2025 libacl],
2026 install_rpath : rootlibexecdir,
2027 install : true,
2028 install_dir : rootlibexecdir)
2029
2030 public_programs += executable(
2031 'loginctl',
2032 loginctl_sources,
2033 include_directories : includes,
2034 link_with : [libshared],
2035 dependencies : [threads,
2036 liblz4,
ef5924aa
NL
2037 libxz,
2038 libzstd],
6164ec4c
ZJS
2039 install_rpath : rootlibexecdir,
2040 install : true,
2041 install_dir : rootbindir)
2042
2043 public_programs += executable(
2044 'systemd-inhibit',
2045 'src/login/inhibit.c',
2046 include_directories : includes,
2047 link_with : [libshared],
2048 install_rpath : rootlibexecdir,
2049 install : true,
2050 install_dir : rootbindir)
37efbbd8 2051
349cc4a5 2052 if conf.get('HAVE_PAM') == 1
1485aacb 2053 version_script_arg = join_paths(project_source_root, pam_systemd_sym)
37efbbd8
ZJS
2054 pam_systemd = shared_library(
2055 'pam_systemd',
2056 pam_systemd_c,
2057 name_prefix : '',
2058 include_directories : includes,
2059 link_args : ['-shared',
2060 '-Wl,--version-script=' + version_script_arg],
37e4d7a8 2061 link_with : [libsystemd_static,
37efbbd8
ZJS
2062 libshared_static],
2063 dependencies : [threads,
2064 libpam,
2065 libpam_misc],
2066 link_depends : pam_systemd_sym,
2067 install : true,
2068 install_dir : pamlibdir)
2069
938be089
ZJS
2070 if want_tests != 'false'
2071 test('dlopen-pam_systemd',
2072 test_dlopen,
2073 # path to dlopen must include a slash
c1cd6743 2074 args : pam_systemd.full_path())
938be089 2075 endif
37efbbd8 2076 endif
005a29f2 2077
6164ec4c
ZJS
2078 executable(
2079 'systemd-user-runtime-dir',
2080 user_runtime_dir_sources,
2081 include_directories : includes,
2082 link_with : [libshared],
2083 install_rpath : rootlibexecdir,
2084 install : true,
2085 install_dir : rootlibexecdir)
07ee5adb 2086endif
a9f0f5e5 2087
349cc4a5 2088if conf.get('HAVE_PAM') == 1
6164ec4c
ZJS
2089 executable(
2090 'systemd-user-sessions',
2091 'src/user-sessions/user-sessions.c',
2092 include_directories : includes,
2093 link_with : [libshared],
2094 install_rpath : rootlibexecdir,
2095 install : true,
2096 install_dir : rootlibexecdir)
5c23128d
ZJS
2097endif
2098
349cc4a5 2099if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
6164ec4c
ZJS
2100 public_programs += executable(
2101 'bootctl',
2102 'src/boot/bootctl.c',
2103 include_directories : includes,
2104 link_with : [libshared],
2105 dependencies : [libblkid],
2106 install_rpath : rootlibexecdir,
2107 install : true)
2108
2109 public_programs += executable(
2110 'systemd-bless-boot',
2111 'src/boot/bless-boot.c',
2112 include_directories : includes,
2113 link_with : [libshared],
2114 dependencies : [libblkid],
2115 install_rpath : rootlibexecdir,
2116 install : true,
2117 install_dir : rootlibexecdir)
2118
2119 executable(
2120 'systemd-bless-boot-generator',
2121 'src/boot/bless-boot-generator.c',
2122 include_directories : includes,
2123 link_with : [libshared],
2124 install_rpath : rootlibexecdir,
2125 install : true,
2126 install_dir : systemgeneratordir)
2127endif
2128
2129executable(
2130 'systemd-boot-check-no-failures',
2131 'src/boot/boot-check-no-failures.c',
2132 include_directories : includes,
2133 link_with : [libshared],
2134 dependencies : [libblkid],
2135 install_rpath : rootlibexecdir,
2136 install : true,
2137 install_dir : rootlibexecdir)
005a29f2 2138
6164ec4c
ZJS
2139public_programs += executable(
2140 'systemd-socket-activate',
2141 'src/activate/activate.c',
2142 include_directories : includes,
2143 link_with : [libshared],
2144 dependencies : [threads],
2145 install_rpath : rootlibexecdir,
2146 install : true)
f3794366
FS
2147
2148if get_option('link-systemctl-shared')
2149 systemctl_link_with = [libshared]
2150else
2151 systemctl_link_with = [libsystemd_static,
2152 libshared_static,
2153 libjournal_client,
2154 libbasic_gcrypt]
2155endif
2156
6164ec4c
ZJS
2157public_programs += executable(
2158 'systemctl',
daf71ef6
LP
2159 'src/systemctl/systemctl-add-dependency.c',
2160 'src/systemctl/systemctl-add-dependency.h',
2161 'src/systemctl/systemctl-cancel-job.c',
2162 'src/systemctl/systemctl-cancel-job.h',
2163 'src/systemctl/systemctl-clean-or-freeze.c',
2164 'src/systemctl/systemctl-clean-or-freeze.h',
2165 'src/systemctl/systemctl-compat-halt.c',
2166 'src/systemctl/systemctl-compat-halt.h',
2167 'src/systemctl/systemctl-compat-runlevel.c',
2168 'src/systemctl/systemctl-compat-runlevel.h',
2169 'src/systemctl/systemctl-compat-shutdown.c',
2170 'src/systemctl/systemctl-compat-shutdown.h',
2171 'src/systemctl/systemctl-compat-telinit.c',
2172 'src/systemctl/systemctl-compat-telinit.h',
2173 'src/systemctl/systemctl-daemon-reload.c',
2174 'src/systemctl/systemctl-daemon-reload.h',
2175 'src/systemctl/systemctl-edit.c',
2176 'src/systemctl/systemctl-edit.h',
2177 'src/systemctl/systemctl-enable.c',
2178 'src/systemctl/systemctl-enable.h',
2179 'src/systemctl/systemctl-is-active.c',
2180 'src/systemctl/systemctl-is-active.h',
2181 'src/systemctl/systemctl-is-enabled.c',
2182 'src/systemctl/systemctl-is-enabled.h',
2183 'src/systemctl/systemctl-is-system-running.c',
2184 'src/systemctl/systemctl-is-system-running.h',
2185 'src/systemctl/systemctl-kill.c',
2186 'src/systemctl/systemctl-kill.h',
2187 'src/systemctl/systemctl-list-dependencies.c',
2188 'src/systemctl/systemctl-list-dependencies.h',
2189 'src/systemctl/systemctl-list-jobs.c',
2190 'src/systemctl/systemctl-list-jobs.h',
2191 'src/systemctl/systemctl-list-machines.c',
2192 'src/systemctl/systemctl-list-machines.h',
2193 'src/systemctl/systemctl-list-unit-files.c',
2194 'src/systemctl/systemctl-list-unit-files.h',
2195 'src/systemctl/systemctl-list-units.c',
2196 'src/systemctl/systemctl-list-units.h',
2197 'src/systemctl/systemctl-log-setting.c',
2198 'src/systemctl/systemctl-log-setting.h',
2199 'src/systemctl/systemctl-logind.c',
2200 'src/systemctl/systemctl-logind.h',
5e8deb94
LB
2201 'src/systemctl/systemctl-mount.c',
2202 'src/systemctl/systemctl-mount.h',
daf71ef6
LP
2203 'src/systemctl/systemctl-preset-all.c',
2204 'src/systemctl/systemctl-preset-all.h',
2205 'src/systemctl/systemctl-reset-failed.c',
2206 'src/systemctl/systemctl-reset-failed.h',
2207 'src/systemctl/systemctl-service-watchdogs.c',
2208 'src/systemctl/systemctl-service-watchdogs.h',
2209 'src/systemctl/systemctl-set-default.c',
2210 'src/systemctl/systemctl-set-default.h',
2211 'src/systemctl/systemctl-set-environment.c',
2212 'src/systemctl/systemctl-set-environment.h',
2213 'src/systemctl/systemctl-set-property.c',
2214 'src/systemctl/systemctl-set-property.h',
2215 'src/systemctl/systemctl-show.c',
2216 'src/systemctl/systemctl-show.h',
2217 'src/systemctl/systemctl-start-special.c',
2218 'src/systemctl/systemctl-start-special.h',
2219 'src/systemctl/systemctl-start-unit.c',
2220 'src/systemctl/systemctl-start-unit.h',
2221 'src/systemctl/systemctl-switch-root.c',
2222 'src/systemctl/systemctl-switch-root.h',
2223 'src/systemctl/systemctl-sysv-compat.c',
2224 'src/systemctl/systemctl-sysv-compat.h',
2225 'src/systemctl/systemctl-trivial-method.c',
2226 'src/systemctl/systemctl-trivial-method.h',
2227 'src/systemctl/systemctl-util.c',
2228 'src/systemctl/systemctl-util.c',
2229 'src/systemctl/systemctl-util.h',
6164ec4c 2230 'src/systemctl/systemctl.c',
daf71ef6 2231 'src/systemctl/systemctl.h',
6164ec4c
ZJS
2232 include_directories : includes,
2233 link_with : systemctl_link_with,
2234 dependencies : [threads,
2235 libcap,
2236 libselinux,
2237 libxz,
ef5924aa
NL
2238 liblz4,
2239 libzstd],
6164ec4c
ZJS
2240 install_rpath : rootlibexecdir,
2241 install : true,
2242 install_dir : rootbindir)
5c23128d 2243
61d0578b 2244if conf.get('ENABLE_PORTABLED') == 1
6164ec4c
ZJS
2245 executable(
2246 'systemd-portabled',
2247 systemd_portabled_sources,
2248 include_directories : includes,
2249 link_with : [libshared],
2250 dependencies : [threads],
2251 install_rpath : rootlibexecdir,
2252 install : true,
2253 install_dir : rootlibexecdir)
2254
2255 public_programs += executable(
2256 'portablectl',
2257 'src/portable/portablectl.c',
2258 include_directories : includes,
2259 link_with : [libshared],
2260 dependencies : [threads],
2261 install_rpath : rootlibexecdir,
2262 install : true,
2263 install_dir : rootbindir)
61d0578b
LP
2264endif
2265
d093b62c 2266if conf.get('ENABLE_USERDB') == 1
6164ec4c
ZJS
2267 executable(
2268 'systemd-userwork',
2269 systemd_userwork_sources,
2270 include_directories : includes,
2271 link_with : [libshared],
2272 dependencies : [threads],
2273 install_rpath : rootlibexecdir,
2274 install : true,
2275 install_dir : rootlibexecdir)
2276
2277 executable(
2278 'systemd-userdbd',
2279 systemd_userdbd_sources,
2280 include_directories : includes,
2281 link_with : [libshared],
2282 dependencies : [threads],
2283 install_rpath : rootlibexecdir,
2284 install : true,
2285 install_dir : rootlibexecdir)
2286
460e5af0 2287 public_programs += executable(
6164ec4c
ZJS
2288 'userdbctl',
2289 userdbctl_sources,
2290 include_directories : includes,
2291 link_with : [libshared],
2292 dependencies : [threads],
2293 install_rpath : rootlibexecdir,
2294 install : true,
2295 install_dir : rootbindir)
d093b62c
LP
2296endif
2297
70a5db58 2298if conf.get('ENABLE_HOMED') == 1
6164ec4c
ZJS
2299 executable(
2300 'systemd-homework',
2301 systemd_homework_sources,
2302 include_directories : includes,
2303 link_with : [libshared],
2304 dependencies : [threads,
2305 libcryptsetup,
2306 libblkid,
2307 libcrypt,
2308 libopenssl,
2309 libfdisk,
69cb2896 2310 libp11kit],
6164ec4c
ZJS
2311 install_rpath : rootlibexecdir,
2312 install : true,
2313 install_dir : rootlibexecdir)
2314
2315 executable(
2316 'systemd-homed',
2317 systemd_homed_sources,
2318 include_directories : includes,
2319 link_with : [libshared],
2320 dependencies : [threads,
2321 libcrypt,
679badd7 2322 libopenssl],
6164ec4c
ZJS
2323 install_rpath : rootlibexecdir,
2324 install : true,
2325 install_dir : rootlibexecdir)
2326
460e5af0 2327 public_programs += executable(
6164ec4c
ZJS
2328 'homectl',
2329 homectl_sources,
2330 include_directories : includes,
2331 link_with : [libshared],
2332 dependencies : [threads,
2333 libcrypt,
2334 libopenssl,
2335 libp11kit,
da3920c3 2336 libdl],
6164ec4c
ZJS
2337 install_rpath : rootlibexecdir,
2338 install : true,
2339 install_dir : rootbindir)
26cf9fb7
LP
2340
2341 if conf.get('HAVE_PAM') == 1
2342 version_script_arg = join_paths(project_source_root, pam_systemd_home_sym)
2343 pam_systemd = shared_library(
2344 'pam_systemd_home',
2345 pam_systemd_home_c,
2346 name_prefix : '',
2347 include_directories : includes,
2348 link_args : ['-shared',
2349 '-Wl,--version-script=' + version_script_arg],
2350 link_with : [libsystemd_static,
2351 libshared_static],
2352 dependencies : [threads,
2353 libpam,
2354 libpam_misc,
2355 libcrypt],
2356 link_depends : pam_systemd_home_sym,
2357 install : true,
2358 install_dir : pamlibdir)
2359 endif
70a5db58
LP
2360endif
2361
6589a569
NL
2362foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2363 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
ba7f4ae6
ZJS
2364 meson.add_install_script(meson_make_symlink,
2365 join_paths(rootbindir, 'systemctl'),
2366 join_paths(rootsbindir, alias))
2367endforeach
2368
63e2d171
NL
2369meson.add_install_script(meson_make_symlink,
2370 join_paths(rootbindir, 'udevadm'),
2371 join_paths(rootlibexecdir, 'systemd-udevd'))
2372
349cc4a5 2373if conf.get('ENABLE_BACKLIGHT') == 1
6164ec4c
ZJS
2374 executable(
2375 'systemd-backlight',
2376 'src/backlight/backlight.c',
2377 include_directories : includes,
2378 link_with : [libshared],
2379 install_rpath : rootlibexecdir,
2380 install : true,
2381 install_dir : rootlibexecdir)
5c23128d
ZJS
2382endif
2383
349cc4a5 2384if conf.get('ENABLE_RFKILL') == 1
6164ec4c
ZJS
2385 executable(
2386 'systemd-rfkill',
2387 'src/rfkill/rfkill.c',
2388 include_directories : includes,
2389 link_with : [libshared],
2390 install_rpath : rootlibexecdir,
2391 install : true,
2392 install_dir : rootlibexecdir)
2393endif
2394
2395executable(
2396 'systemd-system-update-generator',
2397 'src/system-update-generator/system-update-generator.c',
2398 include_directories : includes,
2399 link_with : [libshared],
2400 install_rpath : rootlibexecdir,
2401 install : true,
2402 install_dir : systemgeneratordir)
5c23128d 2403
349cc4a5 2404if conf.get('HAVE_LIBCRYPTSETUP') == 1
08669709 2405 systemd_cryptsetup_sources = files('''
2bc5c425 2406 src/cryptsetup/cryptsetup-fido2.h
1e2f3230
LP
2407 src/cryptsetup/cryptsetup-keyfile.c
2408 src/cryptsetup/cryptsetup-keyfile.h
2bc5c425 2409 src/cryptsetup/cryptsetup-pkcs11.h
18843ecc 2410 src/cryptsetup/cryptsetup-tpm2.h
23769fb3 2411 src/cryptsetup/cryptsetup.c
08669709
LP
2412'''.split())
2413
2414 if conf.get('HAVE_P11KIT') == 1
2415 systemd_cryptsetup_sources += files('src/cryptsetup/cryptsetup-pkcs11.c')
2416 endif
2417
2bc5c425
LP
2418 if conf.get('HAVE_LIBFIDO2') == 1
2419 systemd_cryptsetup_sources += files('src/cryptsetup/cryptsetup-fido2.c')
2420 endif
2421
18843ecc
LP
2422 if conf.get('HAVE_TPM2') == 1
2423 systemd_cryptsetup_sources += files('src/cryptsetup/cryptsetup-tpm2.c')
2424 endif
2425
6164ec4c
ZJS
2426 executable(
2427 'systemd-cryptsetup',
2428 systemd_cryptsetup_sources,
2429 include_directories : includes,
2430 link_with : [libshared],
2431 dependencies : [libcryptsetup,
2432 libp11kit],
2433 install_rpath : rootlibexecdir,
2434 install : true,
2435 install_dir : rootlibexecdir)
2436
2437 executable(
2438 'systemd-cryptsetup-generator',
2439 'src/cryptsetup/cryptsetup-generator.c',
2440 include_directories : includes,
2441 link_with : [libshared],
6164ec4c
ZJS
2442 install_rpath : rootlibexecdir,
2443 install : true,
2444 install_dir : systemgeneratordir)
2445
2446 executable(
2447 'systemd-veritysetup',
2448 'src/veritysetup/veritysetup.c',
2449 include_directories : includes,
2450 link_with : [libshared],
2451 dependencies : [libcryptsetup],
2452 install_rpath : rootlibexecdir,
2453 install : true,
2454 install_dir : rootlibexecdir)
2455
2456 executable(
2457 'systemd-veritysetup-generator',
2458 'src/veritysetup/veritysetup-generator.c',
2459 include_directories : includes,
2460 link_with : [libshared],
6164ec4c
ZJS
2461 install_rpath : rootlibexecdir,
2462 install : true,
2463 install_dir : systemgeneratordir)
8710a681
LP
2464
2465 systemd_cryptenroll_sources = files('''
2466 src/cryptenroll/cryptenroll-fido2.h
d2fafc42
LP
2467 src/cryptenroll/cryptenroll-list.c
2468 src/cryptenroll/cryptenroll-list.h
8710a681
LP
2469 src/cryptenroll/cryptenroll-password.c
2470 src/cryptenroll/cryptenroll-password.h
2471 src/cryptenroll/cryptenroll-pkcs11.h
2472 src/cryptenroll/cryptenroll-recovery.c
2473 src/cryptenroll/cryptenroll-recovery.h
5e521624 2474 src/cryptenroll/cryptenroll-tpm2.h
d2fafc42
LP
2475 src/cryptenroll/cryptenroll-wipe.c
2476 src/cryptenroll/cryptenroll-wipe.h
8710a681 2477 src/cryptenroll/cryptenroll.c
d2fafc42 2478 src/cryptenroll/cryptenroll.h
8710a681
LP
2479'''.split())
2480
2481 if conf.get('HAVE_P11KIT') == 1 and conf.get('HAVE_OPENSSL') == 1
2482 systemd_cryptenroll_sources += files('src/cryptenroll/cryptenroll-pkcs11.c')
2483 endif
2484
2485 if conf.get('HAVE_LIBFIDO2') == 1
2486 systemd_cryptenroll_sources += files('src/cryptenroll/cryptenroll-fido2.c')
2487 endif
2488
5e521624
LP
2489 if conf.get('HAVE_TPM2') == 1
2490 systemd_cryptenroll_sources += files('src/cryptenroll/cryptenroll-tpm2.c')
2491 endif
2492
8710a681
LP
2493 executable(
2494 'systemd-cryptenroll',
2495 systemd_cryptenroll_sources,
2496 include_directories : includes,
2497 link_with : [libshared],
2498 dependencies : [libcryptsetup,
5e521624 2499 libdl,
8710a681
LP
2500 libopenssl,
2501 libp11kit],
2502 install_rpath : rootlibexecdir,
2503 install : true,
2504 install_dir : bindir)
5c23128d
ZJS
2505endif
2506
349cc4a5 2507if conf.get('HAVE_SYSV_COMPAT') == 1
6164ec4c
ZJS
2508 executable(
2509 'systemd-sysv-generator',
2510 'src/sysv-generator/sysv-generator.c',
2511 include_directories : includes,
2512 link_with : [libshared],
2513 install_rpath : rootlibexecdir,
2514 install : true,
2515 install_dir : systemgeneratordir)
2516
2517 executable(
2518 'systemd-rc-local-generator',
2519 'src/rc-local-generator/rc-local-generator.c',
2520 include_directories : includes,
2521 link_with : [libshared],
2522 install_rpath : rootlibexecdir,
2523 install : true,
2524 install_dir : systemgeneratordir)
5c23128d
ZJS
2525endif
2526
8feca247
BB
2527if conf.get('ENABLE_XDG_AUTOSTART') == 1
2528 executable(
2529 'systemd-xdg-autostart-generator',
2530 'src/xdg-autostart-generator/xdg-autostart-generator.c',
2531 'src/xdg-autostart-generator/xdg-autostart-service.c',
2532 include_directories : includes,
2533 link_with : [libshared],
2534 install_rpath : rootlibexecdir,
2535 install : true,
2536 install_dir : usergeneratordir)
2537
2538 executable(
2539 'systemd-xdg-autostart-condition',
2540 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2541 include_directories : includes,
2542 link_with : [libshared],
2543 install_rpath : rootlibexecdir,
2544 install : true,
2545 install_dir : rootlibexecdir)
2546endif
2547
349cc4a5 2548if conf.get('ENABLE_HOSTNAMED') == 1
6164ec4c
ZJS
2549 executable(
2550 'systemd-hostnamed',
2551 'src/hostname/hostnamed.c',
2552 include_directories : includes,
2553 link_with : [libshared],
2554 install_rpath : rootlibexecdir,
2555 install : true,
2556 install_dir : rootlibexecdir)
2557
2558 public_programs += executable(
2559 'hostnamectl',
2560 'src/hostname/hostnamectl.c',
2561 include_directories : includes,
2562 link_with : [libshared],
2563 install_rpath : rootlibexecdir,
2564 install : true)
5c23128d
ZJS
2565endif
2566
349cc4a5
ZJS
2567if conf.get('ENABLE_LOCALED') == 1
2568 if conf.get('HAVE_XKBCOMMON') == 1
37efbbd8
ZJS
2569 # logind will load libxkbcommon.so dynamically on its own
2570 deps = [libdl]
2571 else
2572 deps = []
2573 endif
2574
6164ec4c
ZJS
2575 executable(
2576 'systemd-localed',
2577 systemd_localed_sources,
2578 include_directories : includes,
2579 link_with : [libshared],
2580 dependencies : deps,
2581 install_rpath : rootlibexecdir,
2582 install : true,
2583 install_dir : rootlibexecdir)
2584
2585 public_programs += executable(
2586 'localectl',
2587 localectl_sources,
2588 include_directories : includes,
2589 link_with : [libshared],
2590 install_rpath : rootlibexecdir,
2591 install : true)
5c23128d
ZJS
2592endif
2593
349cc4a5 2594if conf.get('ENABLE_TIMEDATED') == 1
6164ec4c
ZJS
2595 executable(
2596 'systemd-timedated',
2597 'src/timedate/timedated.c',
2598 include_directories : includes,
2599 link_with : [libshared],
2600 install_rpath : rootlibexecdir,
2601 install : true,
2602 install_dir : rootlibexecdir)
6129ec85 2603endif
5c23128d 2604
6129ec85 2605if conf.get('ENABLE_TIMEDATECTL') == 1
6164ec4c
ZJS
2606 public_programs += executable(
2607 'timedatectl',
2608 'src/timedate/timedatectl.c',
2609 include_directories : includes,
2610 install_rpath : rootlibexecdir,
2611 link_with : [libshared],
2612 dependencies : [libm],
2613 install : true)
5c23128d
ZJS
2614endif
2615
349cc4a5 2616if conf.get('ENABLE_TIMESYNCD') == 1
fd74a13e
RS
2617 if get_option('link-timesyncd-shared')
2618 timesyncd_link_with = [libshared]
2619 else
2620 timesyncd_link_with = [libsystemd_static,
2621 libshared_static,
2622 libjournal_client,
2623 libbasic_gcrypt]
2624 endif
2625
6164ec4c
ZJS
2626 executable(
2627 'systemd-timesyncd',
2628 systemd_timesyncd_sources,
2629 include_directories : includes,
2630 link_with : [timesyncd_link_with],
2631 dependencies : [threads,
2632 libm],
2633 install_rpath : rootlibexecdir,
2634 install : true,
2635 install_dir : rootlibexecdir)
2636
2637 executable(
2638 'systemd-time-wait-sync',
2639 'src/time-wait-sync/time-wait-sync.c',
2640 include_directories : includes,
2641 link_with : [timesyncd_link_with],
2642 install_rpath : rootlibexecdir,
2643 install : true,
2644 install_dir : rootlibexecdir)
5c23128d
ZJS
2645endif
2646
349cc4a5 2647if conf.get('ENABLE_MACHINED') == 1
6164ec4c
ZJS
2648 executable(
2649 'systemd-machined',
2650 systemd_machined_sources,
2651 include_directories : includes,
2652 link_with : [libmachine_core,
2653 libshared],
2654 install_rpath : rootlibexecdir,
2655 install : true,
2656 install_dir : rootlibexecdir)
2657
2658 public_programs += executable(
2659 'machinectl',
2660 'src/machine/machinectl.c',
2661 include_directories : includes,
2662 link_with : [libshared],
2663 dependencies : [threads,
2664 libxz,
ef5924aa
NL
2665 liblz4,
2666 libzstd],
6164ec4c
ZJS
2667 install_rpath : rootlibexecdir,
2668 install : true,
2669 install_dir : rootbindir)
5c23128d
ZJS
2670endif
2671
349cc4a5 2672if conf.get('ENABLE_IMPORTD') == 1
6164ec4c
ZJS
2673 executable(
2674 'systemd-importd',
2675 systemd_importd_sources,
2676 include_directories : includes,
2677 link_with : [libshared],
2678 dependencies : [threads],
2679 install_rpath : rootlibexecdir,
2680 install : true,
2681 install_dir : rootlibexecdir)
2682
2683 systemd_pull = executable(
2684 'systemd-pull',
2685 systemd_pull_sources,
2686 include_directories : includes,
2687 link_with : [libshared],
2688 dependencies : [versiondep,
2689 libcurl,
2690 libz,
2691 libbzip2,
2692 libxz,
2693 libgcrypt],
2694 install_rpath : rootlibexecdir,
2695 install : true,
2696 install_dir : rootlibexecdir)
2697
2698 systemd_import = executable(
2699 'systemd-import',
2700 systemd_import_sources,
2701 include_directories : includes,
2702 link_with : [libshared],
2703 dependencies : [libcurl,
2704 libz,
2705 libbzip2,
2706 libxz],
2707 install_rpath : rootlibexecdir,
2708 install : true,
2709 install_dir : rootlibexecdir)
2710
2711 systemd_import_fs = executable(
2712 'systemd-import-fs',
2713 systemd_import_fs_sources,
2714 include_directories : includes,
2715 link_with : [libshared],
2716 install_rpath : rootlibexecdir,
2717 install : true,
2718 install_dir : rootlibexecdir)
2719
2720 systemd_export = executable(
2721 'systemd-export',
2722 systemd_export_sources,
2723 include_directories : includes,
2724 link_with : [libshared],
2725 dependencies : [libcurl,
2726 libz,
2727 libbzip2,
2728 libxz],
2729 install_rpath : rootlibexecdir,
2730 install : true,
2731 install_dir : rootlibexecdir)
1d7579c4
LP
2732
2733 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
37efbbd8
ZJS
2734endif
2735
349cc4a5 2736if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
6164ec4c
ZJS
2737 public_programs += executable(
2738 'systemd-journal-upload',
2739 systemd_journal_upload_sources,
2740 include_directories : includes,
2741 link_with : [libshared],
2742 dependencies : [versiondep,
2743 threads,
2744 libcurl,
2745 libgnutls,
2746 libxz,
ef5924aa
NL
2747 liblz4,
2748 libzstd],
6164ec4c
ZJS
2749 install_rpath : rootlibexecdir,
2750 install : true,
2751 install_dir : rootlibexecdir)
5c23128d
ZJS
2752endif
2753
349cc4a5 2754if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
6164ec4c
ZJS
2755 public_programs += executable(
2756 'systemd-journal-remote',
2757 systemd_journal_remote_sources,
2758 include_directories : includes,
2759 link_with : [libshared,
2760 libsystemd_journal_remote],
2761 dependencies : [threads,
2762 libmicrohttpd,
2763 libgnutls,
2764 libxz,
ef5924aa
NL
2765 liblz4,
2766 libzstd],
6164ec4c
ZJS
2767 install_rpath : rootlibexecdir,
2768 install : true,
2769 install_dir : rootlibexecdir)
2770
2771 public_programs += executable(
2772 'systemd-journal-gatewayd',
2773 systemd_journal_gatewayd_sources,
2774 include_directories : includes,
2775 link_with : [libshared],
2776 dependencies : [threads,
2777 libmicrohttpd,
2778 libgnutls,
2779 libxz,
ef5924aa
NL
2780 liblz4,
2781 libzstd],
6164ec4c
ZJS
2782 install_rpath : rootlibexecdir,
2783 install : true,
2784 install_dir : rootlibexecdir)
5c23128d
ZJS
2785endif
2786
349cc4a5 2787if conf.get('ENABLE_COREDUMP') == 1
6164ec4c
ZJS
2788 executable(
2789 'systemd-coredump',
2790 systemd_coredump_sources,
2791 include_directories : includes,
2792 link_with : [libshared],
2793 dependencies : [threads,
2794 libacl,
2795 libdw,
2796 libxz,
ef5924aa
NL
2797 liblz4,
2798 libzstd],
6164ec4c
ZJS
2799 install_rpath : rootlibexecdir,
2800 install : true,
2801 install_dir : rootlibexecdir)
2802
2803 public_programs += executable(
2804 'coredumpctl',
2805 coredumpctl_sources,
2806 include_directories : includes,
2807 link_with : [libshared],
2808 dependencies : [threads,
2809 libxz,
ef5924aa
NL
2810 liblz4,
2811 libzstd],
6164ec4c
ZJS
2812 install_rpath : rootlibexecdir,
2813 install : true)
5c23128d
ZJS
2814endif
2815
9b4abc69 2816if conf.get('ENABLE_PSTORE') == 1
6164ec4c
ZJS
2817 executable(
2818 'systemd-pstore',
2819 systemd_pstore_sources,
2820 include_directories : includes,
2821 link_with : [libshared],
2822 dependencies : [threads,
2823 libacl,
2824 libdw,
2825 libxz,
ef5924aa
NL
2826 liblz4,
2827 libzstd],
6164ec4c
ZJS
2828 install_rpath : rootlibexecdir,
2829 install : true,
2830 install_dir : rootlibexecdir)
9b4abc69
ED
2831endif
2832
9de5e321
AZ
2833if conf.get('ENABLE_OOMD') == 1
2834 executable('systemd-oomd',
2835 systemd_oomd_sources,
2836 include_directories : includes,
2837 link_with : [libshared],
2838 dependencies : [],
2839 install_rpath : rootlibexecdir,
2840 install : true,
2841 install_dir : rootlibexecdir)
5c616ecf
AZ
2842
2843 public_programs += executable(
2844 'oomctl',
2845 oomctl_sources,
2846 include_directories : includes,
2847 link_with : [libshared],
2848 dependencies : [],
2849 install_rpath : rootlibexecdir,
2850 install : true,
2851 install_dir : rootbindir)
9de5e321
AZ
2852endif
2853
349cc4a5 2854if conf.get('ENABLE_BINFMT') == 1
6164ec4c
ZJS
2855 public_programs += executable(
2856 'systemd-binfmt',
2857 'src/binfmt/binfmt.c',
2858 include_directories : includes,
2859 link_with : [libshared],
2860 install_rpath : rootlibexecdir,
2861 install : true,
2862 install_dir : rootlibexecdir)
37efbbd8
ZJS
2863
2864 meson.add_install_script('sh', '-c',
2865 mkdir_p.format(binfmtdir))
d7aa78c3
JT
2866 if install_sysconfdir
2867 meson.add_install_script('sh', '-c',
2868 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2869 endif
37efbbd8
ZJS
2870endif
2871
e594a3b1 2872if conf.get('ENABLE_REPART') == 1
6164ec4c
ZJS
2873 exe = executable(
2874 'systemd-repart',
2875 systemd_repart_sources,
2876 include_directories : includes,
2877 link_with : [libshared],
2878 dependencies : [threads,
6164ec4c
ZJS
2879 libblkid,
2880 libfdisk,
2881 libopenssl],
2882 install_rpath : rootlibexecdir,
2883 install : true,
2884 install_dir : rootbindir)
2d2d0a57 2885 public_programs += exe
e29e4d57
ZJS
2886
2887 if want_tests != 'false'
2888 test('test-repart',
2889 test_repart_sh,
2890 args : exe.full_path())
2891 endif
e594a3b1
LP
2892endif
2893
349cc4a5 2894if conf.get('ENABLE_VCONSOLE') == 1
6164ec4c
ZJS
2895 executable(
2896 'systemd-vconsole-setup',
2897 'src/vconsole/vconsole-setup.c',
2898 include_directories : includes,
2899 link_with : [libshared],
2900 install_rpath : rootlibexecdir,
2901 install : true,
2902 install_dir : rootlibexecdir)
5c23128d
ZJS
2903endif
2904
349cc4a5 2905if conf.get('ENABLE_RANDOMSEED') == 1
6164ec4c
ZJS
2906 executable(
2907 'systemd-random-seed',
2908 'src/random-seed/random-seed.c',
2909 include_directories : includes,
2910 link_with : [libshared],
2911 install_rpath : rootlibexecdir,
2912 install : true,
2913 install_dir : rootlibexecdir)
5c23128d
ZJS
2914endif
2915
349cc4a5 2916if conf.get('ENABLE_FIRSTBOOT') == 1
6164ec4c
ZJS
2917 executable(
2918 'systemd-firstboot',
2919 'src/firstboot/firstboot.c',
2920 include_directories : includes,
2921 link_with : [libshared],
2922 dependencies : [libcrypt],
2923 install_rpath : rootlibexecdir,
2924 install : true,
2925 install_dir : rootbindir)
2926endif
2927
2928executable(
2929 'systemd-remount-fs',
2930 'src/remount-fs/remount-fs.c',
2931 include_directories : includes,
2932 link_with : [libcore_shared,
2933 libshared],
2934 install_rpath : rootlibexecdir,
2935 install : true,
2936 install_dir : rootlibexecdir)
5c23128d 2937
6164ec4c
ZJS
2938executable(
2939 'systemd-machine-id-setup',
2940 'src/machine-id-setup/machine-id-setup-main.c',
2941 include_directories : includes,
2942 link_with : [libcore_shared,
2943 libshared],
2944 install_rpath : rootlibexecdir,
2945 install : true,
2946 install_dir : rootbindir)
5c23128d 2947
6164ec4c
ZJS
2948executable(
2949 'systemd-fsck',
2950 'src/fsck/fsck.c',
2951 include_directories : includes,
2952 link_with : [libshared],
2953 install_rpath : rootlibexecdir,
2954 install : true,
2955 install_dir : rootlibexecdir)
5c23128d 2956
80750adb
ZJS
2957executable('systemd-growfs',
2958 'src/partition/growfs.c',
2959 include_directories : includes,
2960 link_with : [libshared],
2961 install_rpath : rootlibexecdir,
2962 install : true,
2963 install_dir : rootlibexecdir)
2964
6164ec4c
ZJS
2965executable(
2966 'systemd-makefs',
2967 'src/partition/makefs.c',
2968 include_directories : includes,
2969 link_with : [libshared],
2970 install_rpath : rootlibexecdir,
2971 install : true,
2972 install_dir : rootlibexecdir)
b7f28ac5 2973
6164ec4c
ZJS
2974executable(
2975 'systemd-sleep',
2976 'src/sleep/sleep.c',
2977 include_directories : includes,
2978 link_with : [libshared],
2979 install_rpath : rootlibexecdir,
2980 install : true,
2981 install_dir : rootlibexecdir)
5c23128d 2982
225d08b8 2983if install_sysconfdir_samples
d7aa78c3
JT
2984 install_data('src/sleep/sleep.conf',
2985 install_dir : pkgsysconfdir)
2986endif
d25e127d 2987
6164ec4c
ZJS
2988public_programs += executable(
2989 'systemd-sysctl',
2990 'src/sysctl/sysctl.c',
2991 include_directories : includes,
2992 link_with : [libshared],
2993 install_rpath : rootlibexecdir,
2994 install : true,
2995 install_dir : rootlibexecdir)
5c23128d 2996
6164ec4c
ZJS
2997executable(
2998 'systemd-ac-power',
2999 'src/ac-power/ac-power.c',
3000 include_directories : includes,
3001 link_with : [libshared],
3002 install_rpath : rootlibexecdir,
3003 install : true,
3004 install_dir : rootlibexecdir)
5c23128d 3005
6164ec4c
ZJS
3006public_programs += executable(
3007 'systemd-detect-virt',
3008 'src/detect-virt/detect-virt.c',
3009 include_directories : includes,
3010 link_with : [libshared],
3011 install_rpath : rootlibexecdir,
3012 install : true)
5c23128d 3013
6164ec4c
ZJS
3014public_programs += executable(
3015 'systemd-delta',
3016 'src/delta/delta.c',
3017 include_directories : includes,
3018 link_with : [libshared],
3019 install_rpath : rootlibexecdir,
3020 install : true)
5c23128d 3021
6164ec4c
ZJS
3022public_programs += executable(
3023 'systemd-escape',
3024 'src/escape/escape.c',
3025 include_directories : includes,
3026 link_with : [libshared],
3027 install_rpath : rootlibexecdir,
3028 install : true,
3029 install_dir : rootbindir)
3030
3031public_programs += executable(
3032 'systemd-notify',
3033 'src/notify/notify.c',
3034 include_directories : includes,
3035 link_with : [libshared],
3036 install_rpath : rootlibexecdir,
3037 install : true,
3038 install_dir : rootbindir)
3039
3040executable(
3041 'systemd-volatile-root',
3042 'src/volatile-root/volatile-root.c',
3043 include_directories : includes,
3044 link_with : [libshared],
3045 install_rpath : rootlibexecdir,
cdf7ad38 3046 install : conf.get('ENABLE_INITRD') == 1,
6164ec4c
ZJS
3047 install_dir : rootlibexecdir)
3048
3049executable(
3050 'systemd-cgroups-agent',
3051 'src/cgroups-agent/cgroups-agent.c',
3052 include_directories : includes,
3053 link_with : [libshared],
3054 install_rpath : rootlibexecdir,
3055 install : true,
3056 install_dir : rootlibexecdir)
3057
3058public_programs += executable(
3059 'systemd-id128',
3060 'src/id128/id128.c',
3061 include_directories : includes,
3062 link_with : [libshared],
3063 install_rpath : rootlibexecdir,
3064 install : true)
3065
3066public_programs += executable(
3067 'systemd-path',
3068 'src/path/path.c',
3069 include_directories : includes,
3070 link_with : [libshared],
3071 install_rpath : rootlibexecdir,
3072 install : true)
3073
3074public_programs += executable(
3075 'systemd-ask-password',
3076 'src/ask-password/ask-password.c',
3077 include_directories : includes,
3078 link_with : [libshared],
3079 install_rpath : rootlibexecdir,
3080 install : true,
3081 install_dir : rootbindir)
3082
3083executable(
3084 'systemd-reply-password',
3085 'src/reply-password/reply-password.c',
3086 include_directories : includes,
3087 link_with : [libshared],
3088 install_rpath : rootlibexecdir,
3089 install : true,
3090 install_dir : rootlibexecdir)
3091
3092public_programs += executable(
3093 'systemd-tty-ask-password-agent',
3094 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3095 include_directories : includes,
3096 link_with : [libshared],
3097 install_rpath : rootlibexecdir,
3098 install : true,
3099 install_dir : rootbindir)
3100
3101public_programs += executable(
3102 'systemd-cgls',
3103 'src/cgls/cgls.c',
3104 include_directories : includes,
3105 link_with : [libshared],
3106 install_rpath : rootlibexecdir,
3107 install : true)
3108
3109public_programs += executable(
3110 'systemd-cgtop',
3111 'src/cgtop/cgtop.c',
3112 include_directories : includes,
3113 link_with : [libshared],
3114 install_rpath : rootlibexecdir,
3115 install : true)
3116
3117executable(
3118 'systemd-initctl',
3119 'src/initctl/initctl.c',
3120 include_directories : includes,
3121 link_with : [libshared],
3122 install_rpath : rootlibexecdir,
6589a569 3123 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
6164ec4c 3124 install_dir : rootlibexecdir)
5c23128d 3125
6164ec4c
ZJS
3126public_programs += executable(
3127 'systemd-mount',
3128 'src/mount/mount-tool.c',
3129 include_directories : includes,
3130 link_with : [libshared],
3131 dependencies: [libmount],
3132 install_rpath : rootlibexecdir,
3133 install : true)
5c23128d 3134
7b76fce1 3135meson.add_install_script(meson_make_symlink,
e17e5ba9 3136 'systemd-mount', join_paths(bindir, 'systemd-umount'))
7b76fce1 3137
6164ec4c
ZJS
3138public_programs += executable(
3139 'systemd-run',
3140 'src/run/run.c',
3141 include_directories : includes,
3142 link_with : [libshared],
3143 install_rpath : rootlibexecdir,
3144 install : true)
3145
3146public_programs += executable(
3147 'systemd-stdio-bridge',
3148 'src/stdio-bridge/stdio-bridge.c',
3149 include_directories : includes,
3150 link_with : [libshared],
3151 dependencies : [versiondep],
3152 install_rpath : rootlibexecdir,
3153 install : true)
3154
3155public_programs += executable(
3156 'busctl',
3157 'src/busctl/busctl.c',
3158 'src/busctl/busctl-introspect.c',
3159 'src/busctl/busctl-introspect.h',
3160 include_directories : includes,
3161 link_with : [libshared],
3162 install_rpath : rootlibexecdir,
3163 install : true)
5c23128d 3164
bd7e6aa7
ZJS
3165if enable_sysusers
3166 exe = executable(
6164ec4c
ZJS
3167 'systemd-sysusers',
3168 'src/sysusers/sysusers.c',
3169 include_directories : includes,
3170 link_with : [libshared],
3171 install_rpath : rootlibexecdir,
3172 install : true,
3173 install_dir : rootbindir)
bd7e6aa7
ZJS
3174 public_programs += exe
3175
3176 if want_tests != 'false'
3177 test('test-sysusers',
3178 test_sysusers_sh,
3179 # https://github.com/mesonbuild/meson/issues/2681
3180 args : exe.full_path())
3181 endif
8ef8f3d5
FB
3182
3183 if have_standalone_binaries
bd7e6aa7 3184 exe = executable(
8ef8f3d5
FB
3185 'systemd-sysusers.standalone',
3186 'src/sysusers/sysusers.c',
3187 include_directories : includes,
3537577c 3188 c_args : '-DSTANDALONE',
8ef8f3d5
FB
3189 link_with : [libshared_static,
3190 libbasic,
3191 libbasic_gcrypt,
3192 libsystemd_static,
3193 libjournal_client],
3194 install : true,
3195 install_dir : rootbindir)
bd7e6aa7
ZJS
3196 public_programs += exe
3197
3198 if want_tests != 'false'
3199 test('test-sysusers.standalone',
3200 test_sysusers_sh,
3201 # https://github.com/mesonbuild/meson/issues/2681
3202 args : exe.full_path())
3203 endif
8ef8f3d5 3204 endif
5c23128d
ZJS
3205endif
3206
349cc4a5 3207if conf.get('ENABLE_TMPFILES') == 1
6164ec4c
ZJS
3208 exe = executable(
3209 'systemd-tmpfiles',
db64ba81 3210 systemd_tmpfiles_sources,
6164ec4c
ZJS
3211 include_directories : includes,
3212 link_with : [libshared],
3213 dependencies : [libacl],
3214 install_rpath : rootlibexecdir,
3215 install : true,
3216 install_dir : rootbindir)
5a8b1640 3217 public_programs += exe
d9daae55 3218
938be089
ZJS
3219 if want_tests != 'false'
3220 test('test-systemd-tmpfiles',
3221 test_systemd_tmpfiles_py,
3222 # https://github.com/mesonbuild/meson/issues/2681
3223 args : exe.full_path())
3224 endif
db64ba81
FB
3225
3226 if have_standalone_binaries
3227 public_programs += executable(
3228 'systemd-tmpfiles.standalone',
3229 systemd_tmpfiles_sources,
3230 include_directories : includes,
3537577c 3231 c_args : '-DSTANDALONE',
db64ba81
FB
3232 link_with : [libshared_static,
3233 libbasic,
3234 libbasic_gcrypt,
3235 libsystemd_static,
3236 libjournal_client],
3237 dependencies : [libacl],
3238 install : true,
3239 install_dir : rootbindir)
3240 endif
5c23128d
ZJS
3241endif
3242
349cc4a5 3243if conf.get('ENABLE_HWDB') == 1
6164ec4c
ZJS
3244 public_programs += executable(
3245 'systemd-hwdb',
3246 'src/hwdb/hwdb.c',
3247 'src/libsystemd/sd-hwdb/hwdb-internal.h',
3248 include_directories : includes,
e4b127e2 3249 link_with : udev_link_with,
6164ec4c
ZJS
3250 install_rpath : udev_rpath,
3251 install : true,
3252 install_dir : rootbindir)
37efbbd8
ZJS
3253endif
3254
349cc4a5 3255if conf.get('ENABLE_QUOTACHECK') == 1
6164ec4c
ZJS
3256 executable(
3257 'systemd-quotacheck',
3258 'src/quotacheck/quotacheck.c',
3259 include_directories : includes,
3260 link_with : [libshared],
3261 install_rpath : rootlibexecdir,
3262 install : true,
3263 install_dir : rootlibexecdir)
3264endif
3265
3266public_programs += executable(
3267 'systemd-socket-proxyd',
3268 'src/socket-proxy/socket-proxyd.c',
3269 include_directories : includes,
3270 link_with : [libshared],
3271 dependencies : [threads],
3272 install_rpath : rootlibexecdir,
3273 install : true,
3274 install_dir : rootlibexecdir)
5c23128d 3275
6164ec4c
ZJS
3276public_programs += executable(
3277 'udevadm',
3278 udevadm_sources,
3279 c_args : '-DLOG_REALM=LOG_REALM_UDEV',
3280 include_directories : includes,
e4b127e2 3281 link_with : [libudevd_core],
6164ec4c
ZJS
3282 dependencies : [versiondep,
3283 threads,
3284 libkmod,
3285 libidn,
3286 libacl,
3287 libblkid],
3288 install_rpath : udev_rpath,
3289 install : true,
3290 install_dir : rootbindir)
3291
3292executable(
3293 'systemd-shutdown',
3294 systemd_shutdown_sources,
3295 include_directories : includes,
3296 link_with : [libcore_shared,
3297 libshared],
3298 dependencies : [libmount],
3299 install_rpath : rootlibexecdir,
3300 install : true,
3301 install_dir : rootlibexecdir)
3302
3303executable(
3304 'systemd-update-done',
3305 'src/update-done/update-done.c',
3306 include_directories : includes,
3307 link_with : [libshared],
3308 install_rpath : rootlibexecdir,
3309 install : true,
3310 install_dir : rootlibexecdir)
3311
3312executable(
3313 'systemd-update-utmp',
3314 'src/update-utmp/update-utmp.c',
3315 include_directories : includes,
3316 link_with : [libshared],
3317 dependencies : [libaudit],
3318 install_rpath : rootlibexecdir,
55678b9e 3319 install : (conf.get('ENABLE_UTMP') == 1),
6164ec4c 3320 install_dir : rootlibexecdir)
5c23128d 3321
349cc4a5 3322if conf.get('HAVE_KMOD') == 1
6164ec4c
ZJS
3323 executable(
3324 'systemd-modules-load',
3325 'src/modules-load/modules-load.c',
3326 include_directories : includes,
3327 link_with : [libshared],
3328 dependencies : [libkmod],
3329 install_rpath : rootlibexecdir,
3330 install : true,
3331 install_dir : rootlibexecdir)
94e75a54 3332
37efbbd8
ZJS
3333 meson.add_install_script('sh', '-c',
3334 mkdir_p.format(modulesloaddir))
d7aa78c3
JT
3335 if install_sysconfdir
3336 meson.add_install_script('sh', '-c',
3337 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
3338 endif
5c23128d
ZJS
3339endif
3340
6164ec4c
ZJS
3341public_programs += executable(
3342 'systemd-nspawn',
3343 systemd_nspawn_sources,
3344 include_directories : includes,
3345 link_with : [libcore_shared,
3346 libnspawn_core,
3347 libshared],
3348 dependencies : [libblkid,
3349 libseccomp],
3350 install_rpath : rootlibexecdir,
3351 install : true)
5c23128d 3352
349cc4a5 3353if conf.get('ENABLE_NETWORKD') == 1
6164ec4c
ZJS
3354 executable(
3355 'systemd-networkd',
3356 systemd_networkd_sources,
3357 include_directories : network_include_dir,
3358 link_with : [libnetworkd_core,
3359 libsystemd_network,
6164ec4c
ZJS
3360 networkd_link_with],
3361 dependencies : [threads],
3362 install_rpath : rootlibexecdir,
3363 install : true,
3364 install_dir : rootlibexecdir)
3365
3366 executable(
3367 'systemd-networkd-wait-online',
3368 systemd_networkd_wait_online_sources,
3369 include_directories : includes,
3370 link_with : [libnetworkd_core,
3371 networkd_link_with],
3372 install_rpath : rootlibexecdir,
3373 install : true,
3374 install_dir : rootlibexecdir)
3375
3376 public_programs += executable(
3377 'networkctl',
3378 networkctl_sources,
3379 include_directories : includes,
3380 link_with : [libsystemd_network,
3381 networkd_link_with],
3382 install_rpath : rootlibexecdir,
3383 install : true,
3384 install_dir : rootbindir)
3385
3386 exe = executable(
3387 'systemd-network-generator',
3388 network_generator_sources,
3389 include_directories : includes,
3390 link_with : [networkd_link_with],
3391 install_rpath : rootlibexecdir,
3392 install : true,
3393 install_dir : rootlibexecdir)
fbaa1137
ZJS
3394
3395 if want_tests != 'false'
3396 test('test-network-generator-conversion',
3397 test_network_generator_conversion_sh,
3398 # https://github.com/mesonbuild/meson/issues/2681
3399 args : exe.full_path())
3400 endif
dcfe072a 3401endif
e821f6a9 3402
6164ec4c
ZJS
3403executable(
3404 'systemd-sulogin-shell',
3405 ['src/sulogin-shell/sulogin-shell.c'],
3406 include_directories : includes,
3407 link_with : [libshared],
3408 install_rpath : rootlibexecdir,
3409 install : true,
3410 install_dir : rootlibexecdir)
e821f6a9 3411
69e96427
ZJS
3412############################################################
3413
e2d41370
FB
3414custom_target(
3415 'systemd-runtest.env',
3416 output : 'systemd-runtest.env',
3417 command : ['sh', '-c', '{ ' +
1485aacb 3418 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
81e06775 3419 'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(project_build_root, 'catalog')) +
e2d41370
FB
3420 '} >@OUTPUT@'],
3421 build_by_default : true)
3422
69e96427 3423foreach tuple : tests
37efbbd8
ZJS
3424 sources = tuple[0]
3425 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
3426 dependencies = tuple[2]
3427 condition = tuple.length() >= 4 ? tuple[3] : ''
3428 type = tuple.length() >= 5 ? tuple[4] : ''
3429 defs = tuple.length() >= 6 ? tuple[5] : []
3430 incs = tuple.length() >= 7 ? tuple[6] : includes
f93ba375 3431 parallel = tuple.length() >= 8 ? tuple[7] : true
37efbbd8
ZJS
3432 timeout = 30
3433
3434 name = sources[0].split('/')[-1].split('.')[0]
3435 if type.startswith('timeout=')
3436 timeout = type.split('=')[1].to_int()
3437 type = ''
3438 endif
3b2bdd62
ZJS
3439
3440 if condition == '' or conf.get(condition) == 1
37efbbd8
ZJS
3441 exe = executable(
3442 name,
3443 sources,
3444 include_directories : incs,
3445 link_with : link_with,
60722ad7
ZJS
3446 dependencies : [versiondep,
3447 dependencies],
37efbbd8 3448 c_args : defs,
3b2bdd62 3449 build_by_default : want_tests != 'false',
37efbbd8 3450 install_rpath : rootlibexecdir,
7cdd9783
MB
3451 install : install_tests,
3452 install_dir : join_paths(testsdir, type))
37efbbd8
ZJS
3453
3454 if type == 'manual'
3455 message('@0@ is a manual test'.format(name))
3456 elif type == 'unsafe' and want_tests != 'unsafe'
3457 message('@0@ is an unsafe test'.format(name))
3b2bdd62 3458 elif want_tests != 'false'
37efbbd8
ZJS
3459 test(name, exe,
3460 env : test_env,
3461 timeout : timeout)
3462 endif
3463 else
3464 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3465 endif
69e96427
ZJS
3466endforeach
3467
0632b4cd 3468exe = executable(
37efbbd8
ZJS
3469 'test-libsystemd-sym',
3470 test_libsystemd_sym_c,
3471 include_directories : includes,
3472 link_with : [libsystemd],
fd1939fb 3473 build_by_default : want_tests != 'false',
37efbbd8
ZJS
3474 install : install_tests,
3475 install_dir : testsdir)
938be089
ZJS
3476if want_tests != 'false'
3477 test('test-libsystemd-sym', exe)
3478endif
37ab1a25 3479
0632b4cd
ZJS
3480exe = executable(
3481 'test-libsystemd-static-sym',
3482 test_libsystemd_sym_c,
3483 include_directories : includes,
0632b4cd
ZJS
3484 link_with : [install_libsystemd_static],
3485 dependencies : [threads], # threads is already included in dependencies on the library,
3486 # but does not seem to get propagated. Add here as a work-around.
fd1939fb 3487 build_by_default : want_tests != 'false' and static_libsystemd_pic,
20f3d32d 3488 install : install_tests and static_libsystemd_pic,
0632b4cd 3489 install_dir : testsdir)
938be089 3490if want_tests != 'false' and static_libsystemd_pic
0632b4cd
ZJS
3491 test('test-libsystemd-static-sym', exe)
3492endif
37ab1a25 3493
0632b4cd 3494exe = executable(
37efbbd8
ZJS
3495 'test-libudev-sym',
3496 test_libudev_sym_c,
e4b127e2 3497 include_directories : libudev_includes,
c1cd6743 3498 c_args : '-Wno-deprecated-declarations',
37efbbd8 3499 link_with : [libudev],
fd1939fb 3500 build_by_default : want_tests != 'false',
37efbbd8
ZJS
3501 install : install_tests,
3502 install_dir : testsdir)
938be089
ZJS
3503if want_tests != 'false'
3504 test('test-libudev-sym', exe)
3505endif
0632b4cd
ZJS
3506
3507exe = executable(
3508 'test-libudev-static-sym',
3509 test_libudev_sym_c,
e4b127e2 3510 include_directories : libudev_includes,
c1cd6743 3511 c_args : '-Wno-deprecated-declarations',
0632b4cd 3512 link_with : [install_libudev_static],
fd1939fb 3513 build_by_default : want_tests != 'false' and static_libudev_pic,
20f3d32d 3514 install : install_tests and static_libudev_pic,
0632b4cd 3515 install_dir : testsdir)
938be089 3516if want_tests != 'false' and static_libudev_pic
0632b4cd
ZJS
3517 test('test-libudev-static-sym', exe)
3518endif
e0bec52f 3519
69e96427 3520############################################################
5c23128d 3521
7db7d5b7
JR
3522fuzzer_exes = []
3523
7e299ffe
ZJS
3524foreach tuple : fuzzers
3525 sources = tuple[0]
3526 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
3527 dependencies = tuple[2]
3528 defs = tuple.length() >= 4 ? tuple[3] : []
3529 incs = tuple.length() >= 5 ? tuple[4] : includes
3530 link_args = []
3531
3532 if want_ossfuzz
3533 dependencies += fuzzing_engine
3534 elif want_libfuzzer
3535 if fuzzing_engine.found()
9c5c4677
EV
3536 dependencies += fuzzing_engine
3537 else
7e299ffe 3538 link_args += ['-fsanitize=fuzzer']
9c5c4677 3539 endif
7e299ffe
ZJS
3540 else
3541 sources += 'src/fuzz/fuzz-main.c'
3542 endif
7db7d5b7 3543
7e299ffe 3544 name = sources[0].split('/')[-1].split('.')[0]
7db7d5b7 3545
7e299ffe
ZJS
3546 fuzzer_exes += executable(
3547 name,
3548 sources,
3549 include_directories : [incs, include_directories('src/fuzz')],
3550 link_with : link_with,
3551 dependencies : dependencies,
3552 c_args : defs,
3553 link_args: link_args,
3554 install : false,
3555 build_by_default : fuzz_tests or fuzzer_build)
3556endforeach
7db7d5b7 3557
6164ec4c
ZJS
3558run_target(
3559 'fuzzers',
63058f43 3560 depends : fuzzer_exes,
7db7d5b7
JR
3561 command : ['true'])
3562
3563############################################################
3564
5c23128d
ZJS
3565subdir('sysctl.d')
3566subdir('sysusers.d')
3567subdir('tmpfiles.d')
4f10b807
ZJS
3568subdir('hwdb.d')
3569subdir('units')
e783f957 3570subdir('presets')
5c23128d
ZJS
3571subdir('network')
3572subdir('man')
3573subdir('shell-completion/bash')
3574subdir('shell-completion/zsh')
9e825ebf
FB
3575subdir('docs/sysvinit')
3576subdir('docs/var-log')
5c23128d 3577
5c23128d
ZJS
3578install_subdir('factory/etc',
3579 install_dir : factorydir)
3580
d7aa78c3
JT
3581if install_sysconfdir
3582 install_data('xorg/50-systemd-user.sh',
3583 install_dir : xinitrcdir)
3584endif
582faeb4
DJL
3585install_data('modprobe.d/systemd.conf',
3586 install_dir : modprobedir)
f09eb768 3587install_data('LICENSE.GPL2',
5c23128d 3588 'LICENSE.LGPL2.1',
f09eb768
LP
3589 'NEWS',
3590 'README',
eea98402 3591 'docs/CODING_STYLE.md',
1d1cb168 3592 'docs/DISTRO_PORTING.md',
9e825ebf 3593 'docs/ENVIRONMENT.md',
5425f8a5 3594 'docs/HACKING.md',
9e825ebf 3595 'docs/TRANSIENT-SETTINGS.md',
b6dc0d7d 3596 'docs/TRANSLATORS.md',
9e825ebf 3597 'docs/UIDS-GIDS.md',
5c23128d
ZJS
3598 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
3599 install_dir : docdir)
d68b342b 3600
94e75a54
ZJS
3601meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3602meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3603
d68b342b
ZJS
3604############################################################
3605
dd1e33c8 3606check_help = find_program('tools/check-help.sh')
005a29f2
ZJS
3607
3608foreach exec : public_programs
37efbbd8 3609 name = exec.full_path().split('/')[-1]
938be089
ZJS
3610 if want_tests != 'false'
3611 test('check-help-' + name,
dd1e33c8 3612 check_help,
c1cd6743 3613 args : exec.full_path())
938be089 3614 endif
005a29f2
ZJS
3615endforeach
3616
3617############################################################
3618
c6448ee3
ZJS
3619check_directives_sh = find_program('tools/check-directives.sh')
3620
3621if want_tests != 'false'
3622 test('check-directives',
3623 check_directives_sh,
3624 args : project_source_root)
3625endif
3626
3627############################################################
3628
52d4d1d3
ZJS
3629# Enable tests for all supported sanitizers
3630foreach tuple : sanitizers
3631 sanitizer = tuple[0]
3632 build = tuple[1]
b68dfb9e 3633
7a6397d2 3634 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
52d4d1d3
ZJS
3635 prev = ''
3636 foreach p : fuzz_regression_tests
3637 b = p.split('/')[-2]
3638 c = p.split('/')[-1]
3639
3640 name = '@0@:@1@'.format(b, sanitizer)
3641
3642 if name != prev
3643 if want_tests == 'false'
3644 message('Not compiling @0@ because tests is set to false'.format(name))
1763ef1d 3645 elif fuzz_tests
52d4d1d3
ZJS
3646 exe = custom_target(
3647 name,
3648 output : name,
3649 depends : build,
3650 command : [env, 'ln', '-fs',
3651 join_paths(build.full_path(), b),
3652 '@OUTPUT@'],
3653 build_by_default : true)
3654 else
1763ef1d 3655 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
52d4d1d3
ZJS
3656 endif
3657 endif
3658 prev = name
3659
1763ef1d 3660 if fuzz_tests
0f82a2ab 3661 test('@0@_@1@_@2@'.format(b, c, sanitizer),
52d4d1d3 3662 env,
89767158
EV
3663 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3664 timeout : 60,
52d4d1d3 3665 args : [exe.full_path(),
1485aacb 3666 join_paths(project_source_root, p)])
52d4d1d3
ZJS
3667 endif
3668 endforeach
b68dfb9e
ZJS
3669 endif
3670endforeach
3671
52d4d1d3 3672
b68dfb9e
ZJS
3673############################################################
3674
0700e8ba 3675if git.found()
37efbbd8 3676 all_files = run_command(
a412ec57 3677 'env', '-u', 'GIT_WORK_TREE',
37efbbd8 3678 git,
a412ec57
ZJS
3679 '--git-dir=@0@/.git'.format(project_source_root),
3680 'ls-files', ':/*.[ch]')
3681
37efbbd8 3682 all_files = files(all_files.stdout().split())
d68b342b 3683
e85a690b 3684 custom_target(
0700e8ba 3685 'tags',
e85a690b 3686 output : 'tags',
1485aacb 3687 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
2f09974f 3688 run_target(
0700e8ba 3689 'ctags',
1485aacb 3690 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
d68b342b 3691endif
177929c2
ZJS
3692
3693if git.found()
dd1e33c8 3694 git_contrib_sh = find_program('tools/git-contrib.sh')
a923e085 3695 run_target(
37efbbd8 3696 'git-contrib',
dd1e33c8 3697 command : [git_contrib_sh])
177929c2 3698endif
dd6ab3df
ZJS
3699
3700if git.found()
3701 git_head = run_command(
3702 git,
1485aacb 3703 ['--git-dir=@0@/.git'.format(project_source_root),
dd6ab3df
ZJS
3704 'rev-parse', 'HEAD']).stdout().strip()
3705 git_head_short = run_command(
3706 git,
1485aacb 3707 ['--git-dir=@0@/.git'.format(project_source_root),
dd6ab3df
ZJS
3708 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3709
3710 run_target(
3711 'git-snapshot',
3712 command : ['git', 'archive',
1485aacb 3713 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
dd6ab3df
ZJS
3714 git_head_short),
3715 '--prefix', 'systemd-@0@/'.format(git_head),
3716 'HEAD'])
3717endif
829257d1
ZJS
3718
3719############################################################
3720
dd1e33c8 3721check_api_docs_sh = find_program('tools/check-api-docs.sh')
51b13863
LP
3722run_target(
3723 'check-api-docs',
3724 depends : [man, libsystemd, libudev],
dd1e33c8 3725 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
51b13863
LP
3726
3727############################################################
7bc9ea51 3728watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog
51b13863 3729
829257d1
ZJS
3730status = [
3731 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3732
4c8e5f44 3733 'build mode: @0@'.format(get_option('mode')),
2675413e 3734 'split /usr: @0@'.format(split_usr),
157baa87 3735 'split bin-sbin: @0@'.format(split_bin),
359b496f
YW
3736 'prefix directory: @0@'.format(prefixdir),
3737 'rootprefix directory: @0@'.format(rootprefixdir),
3738 'sysconf directory: @0@'.format(sysconfdir),
3739 'include directory: @0@'.format(includedir),
3740 'lib directory: @0@'.format(libdir),
3741 'rootlib directory: @0@'.format(rootlibdir),
829257d1
ZJS
3742 'SysV init scripts: @0@'.format(sysvinit_path),
3743 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
359b496f
YW
3744 'PAM modules directory: @0@'.format(pamlibdir),
3745 'PAM configuration directory: @0@'.format(pamconfdir),
3746 'RPM macros directory: @0@'.format(rpmmacrosdir),
3747 'modprobe.d directory: @0@'.format(modprobedir),
3748 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3749 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3750 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3751 'bash completions directory: @0@'.format(bashcompletiondir),
3752 'zsh completions directory: @0@'.format(zshcompletiondir),
829257d1 3753 'extra start script: @0@'.format(get_option('rc-local')),
829257d1
ZJS
3754 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3755 get_option('debug-tty')),
3756 'TTY GID: @0@'.format(tty_gid),
ac09340e 3757 'users GID: @0@'.format(substs.get('USERS_GID')),
fc1a5d1a
ZJS
3758 'system UIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
3759 conf.get('SYSTEM_ALLOC_UID_MIN')),
3760 'system GIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
3761 conf.get('SYSTEM_ALLOC_GID_MIN')),
3762 'dynamic UIDs: @0@–@1@'.format(dynamic_uid_min, dynamic_uid_max),
3763 'container UID bases: @0@–@1@'.format(container_uid_base_min, container_uid_base_max),
829257d1 3764 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
4e15a734 3765 'render group access mode: @0@'.format(get_option('group-render-mode')),
359b496f 3766 'certificate root directory: @0@'.format(get_option('certificate-root')),
829257d1 3767 'support URL: @0@'.format(support_url),
afde4574
LP
3768 'nobody user name: @0@'.format(nobody_user),
3769 'nobody group name: @0@'.format(nobody_group),
829257d1
ZJS
3770 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3771
3772 'default DNSSEC mode: @0@'.format(default_dnssec),
c9299be2 3773 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
3614df05
ZJS
3774 'default mDNS mode: @0@'.format(default_mdns),
3775 'default LLMNR mode: @0@'.format(default_llmnr),
829257d1 3776 'default cgroup hierarchy: @0@'.format(default_hierarchy),
06da5c63 3777 'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
8ca9e92c 3778 'default KillUserProcesses setting: @0@'.format(kill_user_processes),
21d0dd5a 3779 'default locale: @0@'.format(default_locale),
5bc655cd 3780 'default user $PATH: @0@'.format(default_user_path_display),
7bc9ea51 3781 'systemd service watchdog: @0@'.format(watchdog_opt)]
829257d1
ZJS
3782
3783alt_dns_servers = '\n '.join(dns_servers.split(' '))
3784alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3785status += [
3786 'default DNS servers: @0@'.format(alt_dns_servers),
3787 'default NTP servers: @0@'.format(alt_ntp_servers)]
3788
3789alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3790 '@@0@'.format(time_epoch)).stdout().strip()
3791status += [
3792 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3793
19d8c9c9 3794status += [
abc8caf7
ZJS
3795 'static libsystemd: @0@'.format(static_libsystemd),
3796 'static libudev: @0@'.format(static_libudev)]
19d8c9c9 3797
829257d1
ZJS
3798# TODO:
3799# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3800# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3801# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3802
349cc4a5 3803if conf.get('ENABLE_EFI') == 1
5a8b1640 3804 status += 'efi arch: @0@'.format(efi_arch)
829257d1
ZJS
3805
3806 if have_gnu_efi
3807 status += [
3808 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
c512dfb9 3809 'EFI CC @0@'.format(' '.join(efi_cc)),
ce4121c6
ZJS
3810 'EFI lds: @0@'.format(efi_lds),
3811 'EFI crt0: @0@'.format(efi_crt0),
359b496f 3812 'EFI include directory: @0@'.format(efi_incdir)]
829257d1
ZJS
3813 endif
3814endif
3815
3816found = []
3817missing = []
3818
3819foreach tuple : [
3820 ['libcryptsetup'],
3821 ['PAM'],
70a5db58 3822 ['pwquality'],
c757517d 3823 ['libfdisk'],
839fddbe 3824 ['p11kit'],
af4fbd46 3825 ['libfido2'],
5e521624 3826 ['tpm2'],
829257d1
ZJS
3827 ['AUDIT'],
3828 ['IMA'],
3829 ['AppArmor'],
3830 ['SELinux'],
3831 ['SECCOMP'],
3832 ['SMACK'],
3833 ['zlib'],
3834 ['xz'],
ef5924aa 3835 ['zstd'],
829257d1
ZJS
3836 ['lz4'],
3837 ['bzip2'],
3838 ['ACL'],
3839 ['gcrypt'],
3840 ['qrencode'],
3841 ['microhttpd'],
3842 ['gnutls'],
096cbdce 3843 ['openssl'],
829257d1 3844 ['libcurl'],
d1bf5675 3845 ['idn'],
cdf7ad38 3846 ['initrd'],
53393c89 3847 ['compat-mutable-uid-boundaries'],
7e0079f9 3848 ['nscd'],
87057e24 3849 ['libidn2'],
829257d1
ZJS
3850 ['libidn'],
3851 ['libiptc'],
3852 ['elfutils'],
3853 ['binfmt'],
e594a3b1 3854 ['repart'],
829257d1
ZJS
3855 ['vconsole'],
3856 ['quotacheck'],
3857 ['tmpfiles'],
3858 ['environment.d'],
3859 ['sysusers'],
3860 ['firstboot'],
3861 ['randomseed'],
3862 ['backlight'],
3863 ['rfkill'],
8feca247 3864 ['xdg-autostart'],
829257d1
ZJS
3865 ['logind'],
3866 ['machined'],
61d0578b 3867 ['portabled'],
d093b62c 3868 ['userdb'],
70a5db58 3869 ['homed'],
829257d1
ZJS
3870 ['importd'],
3871 ['hostnamed'],
3872 ['timedated'],
3873 ['timesyncd'],
3874 ['localed'],
3875 ['networkd'],
a7456af5 3876 ['resolve'],
096cbdce
IT
3877 ['DNS-over-TLS(gnutls)', conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1],
3878 ['DNS-over-TLS(openssl)', conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1],
829257d1 3879 ['coredump'],
9b4abc69 3880 ['pstore'],
61ff7397 3881 ['oomd'],
829257d1
ZJS
3882 ['polkit'],
3883 ['legacy pkla', install_polkit_pkla],
3884 ['efi'],
3885 ['gnu-efi', have_gnu_efi],
3886 ['kmod'],
3887 ['xkbcommon'],
c4c978a0 3888 ['pcre2'],
829257d1
ZJS
3889 ['blkid'],
3890 ['dbus'],
3891 ['glib'],
6bd2bc8e
ZJS
3892 ['nss-myhostname'],
3893 ['nss-mymachines'],
3894 ['nss-resolve'],
3895 ['nss-systemd'],
829257d1
ZJS
3896 ['hwdb'],
3897 ['tpm'],
3898 ['man pages', want_man],
3899 ['html pages', want_html],
3900 ['man page indices', want_man and have_lxml],
829257d1
ZJS
3901 ['SysV compat'],
3902 ['utmp'],
3903 ['ldconfig'],
3904 ['hibernate'],
3905 ['adm group', get_option('adm-group')],
3906 ['wheel group', get_option('wheel-group')],
b14e1b43 3907 ['gshadow'],
829257d1
ZJS
3908 ['debug hashmap'],
3909 ['debug mmap cache'],
d6601495 3910 ['debug siphash'],
d18cb393 3911 ['valgrind', conf.get('VALGRIND') == 1],
fd5dec9a 3912 ['trace logging', conf.get('LOG_TRACE') == 1],
b6261be8 3913 ['install tests', install_tests],
19d8c9c9
LP
3914 ['link-udev-shared', get_option('link-udev-shared')],
3915 ['link-systemctl-shared', get_option('link-systemctl-shared')],
5ac8b50d 3916 ['link-networkd-shared', get_option('link-networkd-shared')],
fd74a13e 3917 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
f30bf4d9 3918 ['kernel-install', get_option('kernel-install')],
b3259a6e 3919 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
ceedbf81 3920 ['fexecve'],
829257d1
ZJS
3921]
3922
af4d7860
ZJS
3923 if tuple.length() >= 2
3924 cond = tuple[1]
3925 else
829257d1
ZJS
3926 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3927 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
349cc4a5 3928 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
829257d1
ZJS
3929 endif
3930 if cond
5a8b1640 3931 found += tuple[0]
829257d1 3932 else
5a8b1640 3933 missing += tuple[0]
829257d1
ZJS
3934 endif
3935endforeach
3936
3937status += [
9d39c1bf 3938 '',
829257d1 3939 'enabled features: @0@'.format(', '.join(found)),
9d39c1bf
ZJS
3940 '',
3941 'disabled features: @0@'.format(', '.join(missing)),
3942 '']
829257d1 3943message('\n '.join(status))
9a8e64b0
ZJS
3944
3945if rootprefixdir != rootprefix_default
8ea9fad7
YW
3946 warning('\n' +
3947 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3948 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3949 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
9a8e64b0 3950endif