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