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