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