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