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