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