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