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