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