1 # SPDX-License-Identifier: LGPL-2.1-or-later
3 project('systemd', 'c',
13 meson_version : '>= 0.53.2',
16 libsystemd_version = '0.36.0'
17 libudev_version = '1.7.6'
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)')
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),
31 check : true).stdout().strip()
32 conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
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
40 verification = verification == 'true'
42 conf.set10('LOG_MESSAGE_VERIFICATION', verification)
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')
50 skip_deps = want_ossfuzz or get_option('skip-deps')
51 fuzzer_build = want_ossfuzz or want_libfuzzer
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
56 conf.set10('FUZZ_USE_SIZE_LIMIT', fuzzer_build)
58 # We'll set this to '1' for EFI builds in a different place.
59 conf.set10('SD_BOOT', false)
61 # Create a title-less summary section early, so it ends up first in the output.
62 # More items are added later after they have been detected.
63 summary({'build mode' : get_option('mode')})
65 #####################################################################
67 # Try to install the git pre-commit hook
68 add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
69 if add_git_hook_sh.found()
70 git_hook = run_command(add_git_hook_sh, check : false)
71 if git_hook.returncode() == 0
72 message(git_hook.stdout().strip())
76 #####################################################################
79 if get_option('split-usr') == 'auto'
80 split_usr = not fs.is_symlink('/bin')
82 split_usr = get_option('split-usr') == 'true'
85 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
86 + ' split-usr mode is going to be removed\n' +
87 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
89 conf.set10('HAVE_SPLIT_USR', split_usr,
90 description : '/usr/bin and /bin directories are separate')
92 if get_option('split-bin') == 'auto'
93 split_bin = not fs.is_symlink('/usr/sbin')
95 split_bin = get_option('split-bin') == 'true'
97 conf.set10('HAVE_SPLIT_BIN', split_bin,
98 description : 'bin and sbin directories are separate')
100 rootprefixdir = get_option('rootprefix')
101 # Unusual rootprefixdir values are used by some distros
102 # (see https://github.com/systemd/systemd/pull/7461).
103 rootprefix_default = split_usr ? '/' : '/usr'
104 if rootprefixdir == ''
105 rootprefixdir = rootprefix_default
107 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
109 have_standalone_binaries = get_option('standalone-binaries')
111 sysvinit_path = get_option('sysvinit-path')
112 sysvrcnd_path = get_option('sysvrcnd-path')
113 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
114 description : 'SysV init scripts and rcN.d links are supported')
115 conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
117 if get_option('hibernate') and not get_option('initrd')
118 error('hibernate depends on initrd')
121 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
122 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
123 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
125 # Meson ignores the preceding arguments when joining paths if an absolute
126 # component is encountered, so this should canonicalize various paths when they
127 # are absolute or relative.
128 prefixdir = get_option('prefix')
129 if not prefixdir.startswith('/')
130 error('Prefix is not absolute: "@0@"'.format(prefixdir))
132 if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
133 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
134 rootprefixdir, prefixdir))
137 bindir = prefixdir / get_option('bindir')
138 libdir = prefixdir / get_option('libdir')
139 sysconfdir = prefixdir / get_option('sysconfdir')
140 includedir = prefixdir / get_option('includedir')
141 datadir = prefixdir / get_option('datadir')
142 localstatedir = '/' / get_option('localstatedir')
144 rootbindir = rootprefixdir / 'bin'
145 rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin')
146 rootlibexecdir = rootprefixdir / 'lib/systemd'
148 rootlibdir = get_option('rootlibdir')
150 # This will be a relative path if libdir is in prefix.
151 rootlibdir = get_option('libdir')
153 if not rootlibdir.startswith('/')
154 # If we have a relative path, add rootprefixdir to the front.
155 rootlibdir = rootprefixdir / rootlibdir
157 rootpkglibdir = rootlibdir / 'systemd'
159 install_sysconfdir = get_option('install-sysconfdir') != 'false'
160 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
161 # Dirs of external packages
162 pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig'
163 pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
164 polkitpolicydir = datadir / 'polkit-1/actions'
165 polkitrulesdir = datadir / 'polkit-1/rules.d'
166 polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
167 xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d'
168 rpmmacrosdir = get_option('rpmmacrosdir')
169 if rpmmacrosdir != 'no'
170 rpmmacrosdir = prefixdir / rpmmacrosdir
172 modprobedir = rootprefixdir / 'lib/modprobe.d'
175 pkgdatadir = datadir / 'systemd'
176 environmentdir = prefixdir / 'lib/environment.d'
177 pkgsysconfdir = sysconfdir / 'systemd'
178 userunitdir = prefixdir / 'lib/systemd/user'
179 userpresetdir = prefixdir / 'lib/systemd/user-preset'
180 tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
181 usertmpfilesdir = prefixdir / 'share/user-tmpfiles.d'
182 sysusersdir = prefixdir / 'lib/sysusers.d'
183 sysctldir = prefixdir / 'lib/sysctl.d'
184 binfmtdir = prefixdir / 'lib/binfmt.d'
185 modulesloaddir = prefixdir / 'lib/modules-load.d'
186 networkdir = rootprefixdir / 'lib/systemd/network'
187 systemgeneratordir = rootlibexecdir / 'system-generators'
188 usergeneratordir = prefixdir / 'lib/systemd/user-generators'
189 systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
190 userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
191 systemshutdowndir = rootlibexecdir / 'system-shutdown'
192 systemsleepdir = rootlibexecdir / 'system-sleep'
193 systemunitdir = rootprefixdir / 'lib/systemd/system'
194 systempresetdir = rootprefixdir / 'lib/systemd/system-preset'
195 udevlibexecdir = rootprefixdir / 'lib/udev'
196 udevrulesdir = udevlibexecdir / 'rules.d'
197 udevhwdbdir = udevlibexecdir / 'hwdb.d'
198 catalogdir = prefixdir / 'lib/systemd/catalog'
199 kerneldir = prefixdir / 'lib/kernel'
200 kernelinstalldir = kerneldir / 'install.d'
201 factorydir = datadir / 'factory'
202 bootlibdir = prefixdir / 'lib/systemd/boot/efi'
203 testsdir = prefixdir / 'lib/systemd/tests'
204 unittestsdir = testsdir / 'unit-tests'
205 testdata_dir = testsdir / 'testdata'
206 systemdstatedir = localstatedir / 'lib/systemd'
207 catalogstatedir = systemdstatedir / 'catalog'
208 randomseeddir = localstatedir / 'lib/systemd'
209 profiledir = rootlibexecdir / 'portable' / 'profile'
210 ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
211 credstoredir = prefixdir / 'lib/credstore'
213 docdir = get_option('docdir')
215 docdir = datadir / 'doc/systemd'
218 pamlibdir = get_option('pamlibdir')
220 pamlibdir = rootlibdir / 'security'
223 pamconfdir = get_option('pamconfdir')
225 pamconfdir = prefixdir / 'lib/pam.d'
228 libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir')
229 if libcryptsetup_plugins_dir == ''
230 libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup'
233 memory_accounting_default = get_option('memory-accounting-default')
234 status_unit_format_default = get_option('status-unit-format-default')
235 if status_unit_format_default == 'auto'
236 status_unit_format_default = conf.get('BUILD_MODE_DEVELOPER') == 1 ? 'name' : 'description'
239 conf.set_quoted('BINFMT_DIR', binfmtdir)
240 conf.set_quoted('BOOTLIBDIR', bootlibdir)
241 conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database')
242 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
243 conf.set_quoted('DOC_DIR', docdir)
244 conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd')
245 conf.set_quoted('ENVIRONMENT_DIR', environmentdir)
246 conf.set_quoted('INCLUDE_DIR', includedir)
247 conf.set_quoted('LIBDIR', libdir)
248 conf.set_quoted('MODPROBE_DIR', modprobedir)
249 conf.set_quoted('MODULESLOAD_DIR', modulesloaddir)
250 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
251 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent')
252 conf.set_quoted('PREFIX', prefixdir)
253 conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed')
254 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
255 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
256 conf.set_quoted('ROOTBINDIR', rootbindir)
257 conf.set_quoted('ROOTLIBDIR', rootlibdir)
258 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
259 conf.set_quoted('ROOTPREFIX', rootprefixdir)
260 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
261 conf.set_quoted('SYSCONF_DIR', sysconfdir)
262 conf.set_quoted('SYSCTL_DIR', sysctldir)
263 conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl')
264 conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd')
265 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
266 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent')
267 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup')
268 conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export')
269 conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck')
270 conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs')
271 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework')
272 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs')
273 conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import')
274 conf.set_quoted('SYSTEMD_INTEGRITYSETUP_PATH', rootlibexecdir / 'systemd-integritysetup')
275 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map')
276 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map')
277 conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs')
278 conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull')
279 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown')
280 conf.set_quoted('SYSTEMD_TEST_DATA', testdata_dir)
281 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent')
282 conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper')
283 conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork')
284 conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup')
285 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system')
286 conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir)
287 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
288 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
289 conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
290 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
291 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
292 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
293 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
294 conf.set_quoted('SYSUSERS_DIR', sysusersdir)
295 conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
296 conf.set_quoted('USER_TMPFILES_DIR', usertmpfilesdir)
297 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
298 conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
299 conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
300 conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user')
301 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
302 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
303 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
304 conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg')
305 conf.set_quoted('USER_PRESET_DIR', userpresetdir)
306 conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg')
308 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
309 conf.set10('ENABLE_URLIFY', get_option('urlify'))
310 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
311 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
312 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
313 conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default)
315 conf.set('DEFAULT_TIMEOUT_SEC', get_option('default-timeout-sec'))
316 conf.set('DEFAULT_USER_TIMEOUT_SEC', get_option('default-user-timeout-sec'))
317 conf.set('UPDATE_HELPER_USER_TIMEOUT_SEC', get_option('update-helper-user-timeout-sec'))
319 conf.set10('FIRST_BOOT_FULL_PRESET', get_option('first-boot-full-preset'))
321 #####################################################################
323 cc = meson.get_compiler('c')
324 userspace_c_args = []
325 userspace_c_ld_args = []
326 meson_build_sh = find_program('tools/meson-build.sh')
328 want_tests = get_option('tests')
329 slow_tests = want_tests != 'false' and get_option('slow-tests')
330 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
331 install_tests = get_option('install-tests')
333 if add_languages('cpp', required : fuzzer_build)
334 # Used only for tests
335 cxx = meson.get_compiler('cpp')
336 cxx_cmd = ' '.join(cxx.cmd_array())
342 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
343 if fuzzing_engine.found()
344 userspace_c_args += '-fsanitize-coverage=trace-pc-guard,trace-cmp'
345 elif cc.has_argument('-fsanitize=fuzzer-no-link')
346 userspace_c_args += '-fsanitize=fuzzer-no-link'
348 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
351 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
354 # Those generate many false positives, and we do not want to change the code to
356 basic_disabled_warnings = [
357 '-Wno-missing-field-initializers',
358 '-Wno-unused-parameter',
361 possible_common_cc_flags = [
362 '-Warray-bounds', # clang
367 '-Werror=format-signedness',
368 '-Werror=implicit-function-declaration',
369 '-Werror=implicit-int',
370 '-Werror=incompatible-pointer-types',
371 '-Werror=int-conversion',
372 '-Werror=missing-declarations',
373 '-Werror=missing-prototypes',
375 '-Werror=override-init',
376 '-Werror=return-type',
377 '-Werror=shift-count-overflow',
378 '-Werror=shift-overflow=2',
379 '-Werror=strict-flex-arrays',
382 # gperf prevents us from enabling this because it does not emit fallthrough
383 # attribute with clang.
384 #'-Wimplicit-fallthrough',
385 '-Wimplicit-fallthrough=5',
388 '-Wmissing-include-dirs',
389 '-Wmissing-noreturn',
391 '-Wold-style-definition',
395 '-Wstrict-aliasing=2',
396 '-Wstrict-prototypes',
397 '-Wsuggest-attribute=noreturn',
400 '-Wzero-length-bounds',
402 # negative arguments are correctly detected starting with meson 0.46.
403 '-Wno-error=#warnings', # clang
404 '-Wno-string-plus-int', # clang
406 '-fdiagnostics-show-option',
409 '-fstack-protector-strong',
410 '-fstrict-flex-arrays',
411 '--param=ssp-buffer-size=4',
414 possible_common_link_flags = [
418 c_args = get_option('c_args')
420 # Our json library does not support -ffinite-math-only, which is enabled by -Ofast or -ffast-math.
421 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)
422 error('-Ofast, -ffast-math, or -ffinite-math-only is specified in c_args.')
425 # Disable -Wmaybe-uninitialized when compiling with -Os/-O1/-O3/etc. There are
426 # too many false positives with gcc >= 8. Effectively, we only test with -O0
427 # and -O2; this should be enough to catch most important cases without too much
428 # busywork. See https://github.com/systemd/systemd/pull/19226.
429 if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
430 cc.version().version_compare('<10') or
435 possible_common_cc_flags += '-Wno-maybe-uninitialized'
438 # Disable -Wno-unused-result with gcc, see
439 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
440 if cc.get_id() == 'gcc'
441 possible_common_cc_flags += '-Wno-unused-result'
444 # --as-needed and --no-undefined are provided by meson by default,
445 # run 'meson configure' to see what is enabled
446 possible_link_flags = [
447 '-Wl,--fatal-warnings',
452 if get_option('b_sanitize') == 'none'
453 possible_link_flags += '-Wl,--warn-common'
456 if cc.get_id() == 'clang'
457 possible_common_cc_flags += [
458 '-Wno-typedef-redefinition',
459 '-Wno-gnu-variable-sized-type-not-at-end',
463 if get_option('mode') == 'release'
464 # We could enable 'pattern' for developer mode, but that can interfere with
465 # valgrind and sanitizer builds. Also, clang does not zero-initialize unions,
466 # breaking some of our code (https://reviews.llvm.org/D68115).
467 possible_common_cc_flags += '-ftrivial-auto-var-init=zero'
470 possible_cc_flags = [
471 '-fno-strict-aliasing',
472 '-fstrict-flex-arrays=1',
473 '-fvisibility=hidden',
476 if get_option('buildtype') != 'debug'
477 possible_cc_flags += [
478 '-ffunction-sections',
482 possible_link_flags += '-Wl,--gc-sections'
485 if get_option('mode') == 'developer'
486 possible_cc_flags += '-fno-omit-frame-pointer'
489 add_project_arguments(
490 cc.get_supported_arguments(
491 basic_disabled_warnings,
492 possible_common_cc_flags
496 add_project_link_arguments(
497 cc.get_supported_link_arguments(possible_common_link_flags),
500 userspace_c_args += cc.get_supported_arguments(possible_cc_flags)
501 userspace_c_ld_args += cc.get_supported_link_arguments(possible_link_flags)
503 have = cc.has_argument('-Wzero-length-bounds')
504 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
508 #include <inttypes.h>
509 typedef uint64_t usec_t;
510 usec_t now(clockid_t clock);
515 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
516 add_project_arguments('-Werror=shadow', language : 'c')
520 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
523 cpp = ' '.join(cc.cmd_array()) + ' -E'
525 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
527 #####################################################################
528 # compilation result tests
530 conf.set('_GNU_SOURCE', true)
531 conf.set('__SANE_USERSPACE_TYPES__', true)
532 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
534 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
535 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
536 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
537 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
538 conf.set('SIZEOF_TIMEX_MEMBER', cc.sizeof('typeof(((struct timex *)0)->freq)', prefix : '#include <sys/timex.h>'))
540 long_max = cc.compute_int(
542 prefix : '#include <limits.h>',
543 guess : 0x7FFFFFFFFFFFFFFF,
544 high : 0x7FFFFFFFFFFFFFFF)
545 assert(long_max > 100000)
546 conf.set_quoted('LONG_MAX_STR', '@0@'.format(long_max))
551 #include <sys/mount.h>
552 #include <sys/stat.h>
555 foreach decl : ['char16_t',
562 # We get -1 if the size cannot be determined
563 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
565 if decl == 'struct mount_attr'
567 want_linux_fs_h = false
569 have = cc.sizeof(decl,
570 prefix : decl_headers + '#include <linux/fs.h>',
571 args : '-D_GNU_SOURCE') > 0
572 want_linux_fs_h = have
576 if decl == 'struct statx'
578 want_linux_stat_h = false
580 have = cc.sizeof(decl,
581 prefix : decl_headers + '#include <linux/stat.h>',
582 args : '-D_GNU_SOURCE') > 0
583 want_linux_stat_h = have
587 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
590 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
591 conf.set10('WANT_LINUX_FS_H', want_linux_fs_h)
593 foreach ident : ['secure_getenv', '__secure_getenv']
594 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
598 ['memfd_create', '''#include <sys/mman.h>'''],
599 ['gettid', '''#include <sys/types.h>
600 #include <unistd.h>'''],
601 ['pivot_root', '''#include <stdlib.h>
602 #include <unistd.h>'''], # no known header declares pivot_root
603 ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get
604 ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set
605 ['name_to_handle_at', '''#include <sys/types.h>
606 #include <sys/stat.h>
607 #include <fcntl.h>'''],
608 ['setns', '''#include <sched.h>'''],
609 ['renameat2', '''#include <stdio.h>
610 #include <fcntl.h>'''],
611 ['kcmp', '''#include <linux/kcmp.h>'''],
612 ['keyctl', '''#include <sys/types.h>
613 #include <keyutils.h>'''],
614 ['copy_file_range', '''#include <sys/syscall.h>
615 #include <unistd.h>'''],
616 ['bpf', '''#include <sys/syscall.h>
617 #include <unistd.h>'''],
618 ['statx', '''#include <sys/types.h>
619 #include <sys/stat.h>
620 #include <unistd.h>'''],
621 ['explicit_bzero' , '''#include <string.h>'''],
622 ['reallocarray', '''#include <stdlib.h>'''],
623 ['set_mempolicy', '''#include <stdlib.h>
624 #include <unistd.h>'''],
625 ['get_mempolicy', '''#include <stdlib.h>
626 #include <unistd.h>'''],
627 ['pidfd_send_signal', '''#include <stdlib.h>
630 #include <sys/wait.h>'''],
631 ['pidfd_open', '''#include <stdlib.h>
634 #include <sys/wait.h>'''],
635 ['rt_sigqueueinfo', '''#include <stdlib.h>
638 #include <sys/wait.h>'''],
639 ['rt_tgsigqueueinfo', '''#include <stdlib.h>
642 #include <sys/wait.h>'''],
643 ['mallinfo', '''#include <malloc.h>'''],
644 ['mallinfo2', '''#include <malloc.h>'''],
645 ['execveat', '''#include <unistd.h>'''],
646 ['close_range', '''#include <unistd.h>'''],
647 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
648 ['mount_setattr', '''#include <sys/mount.h>'''],
649 ['move_mount', '''#include <sys/mount.h>'''],
650 ['open_tree', '''#include <sys/mount.h>'''],
651 ['fsopen', '''#include <sys/mount.h>'''],
652 ['fsconfig', '''#include <sys/mount.h>'''],
653 ['fsmount', '''#include <sys/mount.h>'''],
654 ['getdents64', '''#include <dirent.h>'''],
657 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
658 conf.set10('HAVE_' + ident[0].to_upper(), have)
661 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
662 conf.set10('USE_SYS_RANDOM_H', true)
663 conf.set10('HAVE_GETRANDOM', true)
665 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
666 conf.set10('USE_SYS_RANDOM_H', false)
667 conf.set10('HAVE_GETRANDOM', have)
670 #####################################################################
672 version_tag = get_option('version-tag')
674 vcs_data = configuration_data()
675 vcs_data.set('VCS_TAG', version_tag)
676 version_h = configure_file(configuration : vcs_data,
677 input : 'src/version/version.h.in',
678 output : 'version.h')
681 project_source_root + '/tools/meson-vcs-tag.sh',
683 meson.project_version()]
686 input : 'src/version/version.h.in',
687 output : 'version.h',
691 versiondep = declare_dependency(
693 include_directories : include_directories('.'))
695 shared_lib_tag = get_option('shared-lib-tag')
696 if shared_lib_tag == ''
697 shared_lib_tag = meson.project_version()
700 sh = find_program('sh')
701 echo = find_program('echo')
702 sed = find_program('sed')
703 awk = find_program('awk')
704 stat = find_program('stat')
705 ln = find_program('ln')
706 git = find_program('git', required : false)
707 env = find_program('env')
708 rsync = find_program('rsync', required : false)
709 diff = find_program('diff')
710 find = find_program('find')
711 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
713 mkdir_p = 'mkdir -p $DESTDIR/@0@'
714 mkdir_p_mode = 'mkdir -p $DESTDIR/@0@ -m @1@'
716 # If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
717 # /usr/sbin, /sbin, and fall back to the default from middle column.
718 progs = [['quotaon', '/usr/sbin/quotaon' ],
719 ['quotacheck', '/usr/sbin/quotacheck' ],
720 ['kmod', '/usr/bin/kmod' ],
721 ['kexec', '/usr/sbin/kexec' ],
722 ['sulogin', '/usr/sbin/sulogin' ],
723 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
724 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
725 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
726 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
727 ['nologin', '/usr/sbin/nologin', ],
730 path = get_option(prog[0] + '-path')
732 message('Using @1@ for @0@'.format(prog[0], path))
734 exe = find_program(prog[0],
735 '/usr/sbin/' + prog[0],
738 path = exe.found() ? exe.path() : prog[1]
740 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
741 conf.set_quoted(name, path)
744 conf.set_quoted('TELINIT', get_option('telinit-path'))
746 if run_command(ln, '--relative', '--help', check : false).returncode() != 0
747 error('ln does not support --relative (added in coreutils 8.16)')
750 ############################################################
752 gperf = find_program('gperf')
754 gperf_test_format = '''
756 const char * in_word_set(const char *, @0@);
759 gperf_snippet = run_command(sh, '-c', 'echo foo,bar | "$1" -L ANSI-C', '_', gperf,
761 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
762 if cc.compiles(gperf_test)
763 gperf_len_type = 'size_t'
765 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
766 if cc.compiles(gperf_test)
767 gperf_len_type = 'unsigned'
769 error('unable to determine gperf len type')
772 message('gperf len type is @0@'.format(gperf_len_type))
773 conf.set('GPERF_LEN_TYPE', gperf_len_type,
774 description : 'The type of gperf "len" parameter')
776 ############################################################
778 if not cc.has_header('sys/capability.h')
779 error('POSIX caps headers not found')
781 foreach header : ['crypt.h',
783 'linux/vm_sockets.h',
786 'valgrind/memcheck.h',
787 'valgrind/valgrind.h',
788 'linux/time_types.h',
792 conf.set10('HAVE_' + header.underscorify().to_upper(),
793 cc.has_header(header))
796 ############################################################
798 fallback_hostname = get_option('fallback-hostname')
799 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
800 error('Invalid fallback-hostname configuration')
801 # A more extensive test is done in test-hostname-util. Let's catch
802 # the most obvious errors here so we don't fail with an assert later.
804 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
806 default_hierarchy = get_option('default-hierarchy')
807 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
808 description : 'default cgroup hierarchy as string')
809 if default_hierarchy == 'legacy'
810 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
811 elif default_hierarchy == 'hybrid'
812 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
814 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
817 extra_net_naming_schemes = []
818 extra_net_naming_map = []
819 foreach scheme: get_option('extra-net-naming-schemes').split(',')
821 name = scheme.split('=')[0]
822 value = scheme.split('=')[1]
823 NAME = name.underscorify().to_upper()
825 foreach field: value.split('+')
826 VALUE += 'NAMING_' + field.underscorify().to_upper()
828 extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE))
829 extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME)
832 conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes))
833 conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map))
835 default_net_naming_scheme = get_option('default-net-naming-scheme')
836 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
837 if default_net_naming_scheme != 'latest'
838 conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST',
839 'NAMING_' + default_net_naming_scheme.underscorify().to_upper())
842 time_epoch = get_option('time-epoch')
844 time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check : true).stdout().strip()
845 if time_epoch == '' and git.found() and fs.is_dir('.git')
846 # If we're in a git repository, use the creation time of the latest git tag.
847 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags',
849 if latest_tag.returncode() == 0
850 time_epoch = run_command(
851 git, 'log', '--no-show-signature', '-1', '--format=%at',
852 latest_tag.stdout().strip(),
853 check : false).stdout()
858 time_epoch = run_command(stat, '-c', '%Y', NEWS,
859 check : true).stdout()
861 time_epoch = time_epoch.strip().to_int()
863 conf.set('TIME_EPOCH', time_epoch)
865 conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max'))
867 default_user_shell = get_option('default-user-shell')
868 conf.set_quoted('DEFAULT_USER_SHELL', default_user_shell)
869 conf.set_quoted('DEFAULT_USER_SHELL_NAME', fs.name(default_user_shell))
871 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
872 ['system-uid-max', 'SYS_UID_MAX', 999],
873 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
874 ['system-gid-max', 'SYS_GID_MAX', 999]]
875 v = get_option(tuple[0])
879 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
881 check : false).stdout().strip()
888 conf.set(tuple[0].underscorify().to_upper(), v)
890 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
891 error('Invalid uid allocation range')
893 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
894 error('Invalid gid allocation range')
897 dynamic_uid_min = get_option('dynamic-uid-min')
898 dynamic_uid_max = get_option('dynamic-uid-max')
899 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
900 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
902 container_uid_base_min = get_option('container-uid-base-min')
903 container_uid_base_max = get_option('container-uid-base-max')
904 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
905 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
907 nobody_user = get_option('nobody-user')
908 nobody_group = get_option('nobody-group')
910 if not meson.is_cross_build()
911 getent_result = run_command('getent', 'passwd', '65534', check : false)
912 if getent_result.returncode() == 0
913 name = getent_result.stdout().split(':')[0]
914 if name != nobody_user
916 '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) +
917 'Your build will result in an user table setup that is incompatible with the local system.')
920 id_result = run_command('id', '-u', nobody_user, check : false)
921 if id_result.returncode() == 0
922 id = id_result.stdout().strip().to_int()
925 '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) +
926 'Your build will result in an user table setup that is incompatible with the local system.')
930 getent_result = run_command('getent', 'group', '65534', check : false)
931 if getent_result.returncode() == 0
932 name = getent_result.stdout().split(':')[0]
933 if name != nobody_group
935 '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) +
936 'Your build will result in an group table setup that is incompatible with the local system.')
939 id_result = run_command('id', '-g', nobody_group, check : false)
940 if id_result.returncode() == 0
941 id = id_result.stdout().strip().to_int()
944 '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) +
945 'Your build will result in an group table setup that is incompatible with the local system.')
949 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
951 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
952 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
955 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
956 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
959 foreach option : ['adm-gid',
976 'systemd-journal-gid',
977 'systemd-network-uid',
978 'systemd-resolve-uid',
979 'systemd-timesync-uid']
980 name = option.underscorify().to_upper()
981 val = get_option(option)
983 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
984 conf.set(name, val > 0 ? val : '-')
986 static_ugids += '@0@:@1@'.format(option, val)
990 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
991 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
993 dev_kvm_mode = get_option('dev-kvm-mode')
994 conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation
995 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
996 group_render_mode = get_option('group-render-mode')
997 conf.set_quoted('GROUP_RENDER_MODE', group_render_mode)
998 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
1000 kill_user_processes = get_option('default-kill-user-processes')
1001 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
1003 dns_servers = get_option('dns-servers')
1004 conf.set_quoted('DNS_SERVERS', dns_servers)
1006 ntp_servers = get_option('ntp-servers')
1007 conf.set_quoted('NTP_SERVERS', ntp_servers)
1009 default_locale = get_option('default-locale')
1010 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
1012 nspawn_locale = get_option('nspawn-locale')
1013 conf.set_quoted('SYSTEMD_NSPAWN_LOCALE', nspawn_locale)
1015 default_keymap = get_option('default-keymap')
1016 conf.set_quoted('SYSTEMD_DEFAULT_KEYMAP', default_keymap)
1018 localegen_path = get_option('localegen-path')
1019 if localegen_path != ''
1020 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
1022 conf.set10('HAVE_LOCALEGEN', localegen_path != '')
1024 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
1026 service_watchdog = get_option('service-watchdog')
1027 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
1028 conf.set_quoted('SERVICE_WATCHDOG', watchdog_value)
1030 conf.set_quoted('SUSHELL', get_option('debug-shell'))
1031 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
1033 enable_debug_hashmap = false
1034 enable_debug_mmap_cache = false
1035 enable_debug_siphash = false
1036 foreach name : get_option('debug-extra')
1037 if name == 'hashmap'
1038 enable_debug_hashmap = true
1039 elif name == 'mmap-cache'
1040 enable_debug_mmap_cache = true
1041 elif name == 'siphash'
1042 enable_debug_siphash = true
1044 message('unknown debug option "@0@", ignoring'.format(name))
1047 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
1048 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
1049 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
1050 conf.set10('LOG_TRACE', get_option('log-trace'))
1052 default_user_path = get_option('user-path')
1053 if default_user_path != ''
1054 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
1058 #####################################################################
1060 threads = dependency('threads')
1061 librt = cc.find_library('rt')
1062 libm = cc.find_library('m')
1063 libdl = cc.find_library('dl')
1064 libcrypt = cc.find_library('crypt')
1066 # On some architectures, libatomic is required. But on some installations,
1067 # it is found, but actual linking fails. So let's try to use it opportunistically.
1068 # If it is installed, but not needed, it will be dropped because of --as-needed.
1069 if cc.links('''int main(int argc, char **argv) { return 0; }''',
1072 libatomic = declare_dependency(link_args : '-latomic')
1077 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
1079 ['crypt_ra', crypt_header],
1080 ['crypt_preferred_method', crypt_header],
1081 ['crypt_gensalt_ra', crypt_header]]
1083 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
1084 dependencies : libcrypt)
1085 conf.set10('HAVE_' + ident[0].to_upper(), have)
1088 libcap = dependency('libcap', required : false)
1089 if not libcap.found()
1090 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
1091 libcap = cc.find_library('cap')
1094 want_bpf_framework = get_option('bpf-framework')
1095 bpf_compiler = get_option('bpf-compiler')
1096 bpf_framework_required = want_bpf_framework == 'true'
1098 libbpf_version_requirement = '>= 0.1.0'
1099 if bpf_compiler == 'gcc'
1100 libbpf_version_requirement = '>= 1.0.0'
1102 libbpf = dependency('libbpf', required : bpf_framework_required, version : libbpf_version_requirement)
1103 conf.set10('HAVE_LIBBPF', libbpf.found())
1105 bpftool_strip_version_requirement = '>= 5.13.0'
1106 if bpf_compiler == 'gcc'
1107 bpftool_strip_version_requirement = '>= 7.0.0'
1110 if want_bpf_framework == 'false' or not libbpf.found() or skip_deps
1111 conf.set10('BPF_FRAMEWORK', false)
1114 clang_supports_bpf = false
1115 bpf_gcc_found = false
1116 bpftool_strip = false
1119 if bpf_compiler == 'clang'
1120 # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
1121 # (like clang-10/llvm-strip-10)
1122 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')
1123 r = find_program('clang', required : bpf_framework_required, version : '>= 10.0.0')
1124 clang_found = r.found()
1130 clang = cc.cmd_array()
1134 # Check if 'clang -target bpf' is supported.
1135 clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
1137 elif bpf_compiler == 'gcc'
1138 bpf_gcc = find_program('bpf-gcc',
1141 version : '>= 13.1.0')
1142 bpf_gcc_found = bpf_gcc.found()
1145 if clang_supports_bpf or bpf_gcc_found
1146 # Debian installs this in /usr/sbin/ which is not in $PATH.
1147 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1148 # We use 'bpftool gen object' subcommand for bpftool strip, it was added by d80b2fcbe0a023619e0fc73112f2a02c2662f6ab (v5.13).
1149 bpftool_strip_required = bpf_framework_required and bpf_compiler == 'gcc'
1150 bpftool = find_program('bpftool',
1151 '/usr/sbin/bpftool',
1152 required : bpftool_strip_required,
1153 version : bpftool_strip_version_requirement)
1156 bpftool_strip = true
1158 elif bpf_compiler == 'clang'
1159 # We require the 'bpftool gen skeleton' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
1160 bpftool = find_program('bpftool',
1161 '/usr/sbin/bpftool',
1162 required : bpf_framework_required,
1163 version : '>= 5.6.0')
1166 # We use `llvm-strip` as a fallback if `bpftool gen object` strip support is not available.
1167 if not bpftool_strip and bpftool.found() and clang_supports_bpf
1168 if not meson.is_cross_build()
1169 llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
1170 check : true).stdout().strip()
1172 llvm_strip_bin = 'llvm-strip'
1174 llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
1175 deps_found = llvm_strip.found()
1179 # Can build BPF program from source code in restricted C
1180 conf.set10('BPF_FRAMEWORK', deps_found)
1183 libmount = dependency('mount',
1184 version : fuzzer_build ? '>= 0' : '>= 2.30')
1186 want_libfdisk = get_option('fdisk')
1187 if want_libfdisk != 'false' and not skip_deps
1188 libfdisk = dependency('fdisk',
1189 version : '>= 2.32',
1190 required : want_libfdisk == 'true')
1191 have = libfdisk.found()
1196 conf.set10('HAVE_LIBFDISK', have)
1198 want_pwquality = get_option('pwquality')
1199 if want_pwquality != 'false' and not skip_deps
1200 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1201 have = libpwquality.found()
1206 conf.set10('HAVE_PWQUALITY', have)
1208 want_seccomp = get_option('seccomp')
1209 if want_seccomp != 'false' and not skip_deps
1210 libseccomp = dependency('libseccomp',
1211 version : '>= 2.3.1',
1212 required : want_seccomp == 'true')
1213 have = libseccomp.found()
1218 conf.set10('HAVE_SECCOMP', have)
1220 want_selinux = get_option('selinux')
1221 if want_selinux != 'false' and not skip_deps
1222 libselinux = dependency('libselinux',
1223 version : '>= 2.1.9',
1224 required : want_selinux == 'true')
1225 have = libselinux.found()
1230 conf.set10('HAVE_SELINUX', have)
1232 want_apparmor = get_option('apparmor')
1233 if want_apparmor != 'false' and not skip_deps
1234 libapparmor = dependency('libapparmor',
1235 version : '>= 2.13',
1236 required : want_apparmor == 'true')
1237 have = libapparmor.found()
1242 conf.set10('HAVE_APPARMOR', have)
1244 have = get_option('smack') and get_option('smack-run-label') != ''
1245 conf.set10('HAVE_SMACK_RUN_LABEL', have)
1247 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1250 have = get_option('smack') and get_option('smack-default-process-label') != ''
1252 conf.set_quoted('SMACK_DEFAULT_PROCESS_LABEL', get_option('smack-default-process-label'))
1255 want_polkit = get_option('polkit')
1256 install_polkit = false
1257 install_polkit_pkla = false
1258 if want_polkit != 'false' and not skip_deps
1259 install_polkit = true
1261 libpolkit = dependency('polkit-gobject-1',
1263 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1264 message('Old polkit detected, will install pkla files')
1265 install_polkit_pkla = true
1268 conf.set10('ENABLE_POLKIT', install_polkit)
1270 want_acl = get_option('acl')
1271 if want_acl != 'false' and not skip_deps
1272 libacl = cc.find_library('acl', required : want_acl == 'true')
1273 have = libacl.found()
1278 conf.set10('HAVE_ACL', have)
1280 want_audit = get_option('audit')
1281 if want_audit != 'false' and not skip_deps
1282 libaudit = dependency('audit', required : want_audit == 'true')
1283 have = libaudit.found()
1288 conf.set10('HAVE_AUDIT', have)
1290 want_blkid = get_option('blkid')
1291 if want_blkid != 'false' and not skip_deps
1292 libblkid = dependency('blkid', required : want_blkid == 'true')
1293 have = libblkid.found()
1295 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1296 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1301 conf.set10('HAVE_BLKID', have)
1303 want_kmod = get_option('kmod')
1304 if want_kmod != 'false' and not skip_deps
1305 libkmod = dependency('libkmod',
1307 required : want_kmod == 'true')
1308 have = libkmod.found()
1313 conf.set10('HAVE_KMOD', have)
1315 want_xenctrl = get_option('xenctrl')
1316 if want_xenctrl != 'false' and not skip_deps
1317 libxenctrl = dependency('xencontrol',
1319 required : want_xenctrl == 'true')
1320 have = libxenctrl.found()
1325 conf.set10('HAVE_XENCTRL', have)
1327 want_pam = get_option('pam')
1328 if want_pam != 'false' and not skip_deps
1329 libpam = cc.find_library('pam', required : want_pam == 'true')
1330 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1331 have = libpam.found() and libpam_misc.found()
1337 conf.set10('HAVE_PAM', have)
1339 want_microhttpd = get_option('microhttpd')
1340 if want_microhttpd != 'false' and not skip_deps
1341 libmicrohttpd = dependency('libmicrohttpd',
1342 version : '>= 0.9.33',
1343 required : want_microhttpd == 'true')
1344 have = libmicrohttpd.found()
1349 conf.set10('HAVE_MICROHTTPD', have)
1351 want_libcryptsetup = get_option('libcryptsetup')
1352 want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1354 if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1355 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1358 if want_libcryptsetup != 'false' and not skip_deps
1359 libcryptsetup = dependency('libcryptsetup',
1360 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1361 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
1362 have = libcryptsetup.found()
1364 foreach ident : ['crypt_set_metadata_size',
1365 'crypt_activate_by_signed_key',
1367 'crypt_reencrypt_init_by_passphrase',
1369 'crypt_set_data_offset']
1370 have_ident = have and cc.has_function(
1372 prefix : '#include <libcryptsetup.h>',
1373 dependencies : libcryptsetup)
1374 conf.set10('HAVE_' + ident.to_upper(), have_ident)
1380 conf.set10('HAVE_LIBCRYPTSETUP', have)
1382 if want_libcryptsetup_plugins != 'false' and not skip_deps
1383 have = (cc.has_function(
1384 'crypt_activate_by_token_pin',
1385 prefix : '#include <libcryptsetup.h>',
1386 dependencies : libcryptsetup) and
1388 'crypt_token_external_path',
1389 prefix : '#include <libcryptsetup.h>',
1390 dependencies : libcryptsetup))
1394 conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1396 want_libcurl = get_option('libcurl')
1397 if want_libcurl != 'false' and not skip_deps
1398 libcurl = dependency('libcurl',
1399 version : '>= 7.32.0',
1400 required : want_libcurl == 'true')
1401 have = libcurl.found()
1406 conf.set10('HAVE_LIBCURL', have)
1407 conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
1409 want_libidn = get_option('libidn')
1410 want_libidn2 = get_option('libidn2')
1411 if want_libidn == 'true' and want_libidn2 == 'true'
1412 error('libidn and libidn2 cannot be requested simultaneously')
1415 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1416 libidn = dependency('libidn2',
1417 required : want_libidn2 == 'true')
1418 have = libidn.found()
1423 conf.set10('HAVE_LIBIDN2', have)
1424 if not have and want_libidn != 'false' and not skip_deps
1425 # libidn is used for both libidn and libidn2 objects
1426 libidn = dependency('libidn',
1427 required : want_libidn == 'true')
1428 have = libidn.found()
1432 conf.set10('HAVE_LIBIDN', have)
1434 want_libiptc = get_option('libiptc')
1435 if want_libiptc != 'false' and not skip_deps
1436 libiptc = dependency('libiptc',
1437 required : want_libiptc == 'true')
1438 have = libiptc.found()
1443 conf.set10('HAVE_LIBIPTC', have)
1445 want_qrencode = get_option('qrencode')
1446 if want_qrencode != 'false' and not skip_deps
1447 libqrencode = dependency('libqrencode',
1449 required : want_qrencode == 'true')
1450 have = libqrencode.found()
1455 conf.set10('HAVE_QRENCODE', have)
1457 want_gcrypt = get_option('gcrypt')
1458 if want_gcrypt != 'false' and not skip_deps
1459 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1460 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1461 have = libgcrypt.found() and libgpg_error.found()
1466 # link to neither of the libs if one is not found
1470 conf.set10('HAVE_GCRYPT', have)
1472 want_gnutls = get_option('gnutls')
1473 if want_gnutls != 'false' and not skip_deps
1474 libgnutls = dependency('gnutls',
1475 version : '>= 3.1.4',
1476 required : want_gnutls == 'true')
1477 have = libgnutls.found()
1482 conf.set10('HAVE_GNUTLS', have)
1484 want_openssl = get_option('openssl')
1485 if want_openssl != 'false' and not skip_deps
1486 libopenssl = dependency('openssl',
1487 version : '>= 1.1.0',
1488 required : want_openssl == 'true')
1489 have = libopenssl.found()
1494 conf.set10('HAVE_OPENSSL', have)
1496 want_p11kit = get_option('p11kit')
1497 if want_p11kit != 'false' and not skip_deps
1498 libp11kit = dependency('p11-kit-1',
1499 version : '>= 0.23.3',
1500 required : want_p11kit == 'true')
1501 have = libp11kit.found()
1502 libp11kit_cflags = libp11kit.partial_dependency(includes: true, compile_args: true)
1505 libp11kit_cflags = []
1508 conf.set10('HAVE_P11KIT', have)
1510 want_libfido2 = get_option('libfido2')
1511 if want_libfido2 != 'false' and not skip_deps
1512 if conf.get('HAVE_OPENSSL') == 1
1513 libfido2 = dependency('libfido2',
1514 required : want_libfido2 == 'true')
1515 have = libfido2.found()
1516 elif want_libfido2 == 'true'
1517 error('libfido2=true requires openssl')
1526 conf.set10('HAVE_LIBFIDO2', have)
1528 want_tpm2 = get_option('tpm2')
1529 if want_tpm2 != 'false' and not skip_deps
1530 tpm2 = dependency('tss2-esys tss2-rc tss2-mu tss2-tcti-device',
1531 required : want_tpm2 == 'true')
1533 have_esys3 = tpm2.version().version_compare('>= 3.0.0')
1539 conf.set10('HAVE_TPM2', have)
1540 conf.set10('HAVE_TSS2_ESYS3', have_esys3)
1542 want_elfutils = get_option('elfutils')
1543 if want_elfutils != 'false' and not skip_deps
1544 libdw = dependency('libdw',
1545 required : want_elfutils == 'true')
1546 have = libdw.found()
1548 # New in elfutils 0.177
1549 conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING',
1550 have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw))
1555 conf.set10('HAVE_ELFUTILS', have)
1557 want_zlib = get_option('zlib')
1558 if want_zlib != 'false' and not skip_deps
1559 libz = dependency('zlib',
1560 required : want_zlib == 'true')
1566 conf.set10('HAVE_ZLIB', have)
1568 want_bzip2 = get_option('bzip2')
1569 if want_bzip2 != 'false' and not skip_deps
1570 libbzip2 = cc.find_library('bz2',
1571 required : want_bzip2 == 'true')
1572 have = libbzip2.found()
1577 conf.set10('HAVE_BZIP2', have)
1579 want_xz = get_option('xz')
1580 if want_xz != 'false' and not skip_deps
1581 libxz = dependency('liblzma',
1582 required : want_xz == 'true')
1583 have_xz = libxz.found()
1588 conf.set10('HAVE_XZ', have_xz)
1590 want_lz4 = get_option('lz4')
1591 if want_lz4 != 'false' and not skip_deps
1592 liblz4 = dependency('liblz4',
1593 version : '>= 1.3.0',
1594 required : want_lz4 == 'true')
1595 have_lz4 = liblz4.found()
1600 conf.set10('HAVE_LZ4', have_lz4)
1602 want_zstd = get_option('zstd')
1603 if want_zstd != 'false' and not skip_deps
1604 libzstd = dependency('libzstd',
1605 required : want_zstd == 'true',
1606 version : '>= 1.4.0')
1607 have_zstd = libzstd.found()
1612 conf.set10('HAVE_ZSTD', have_zstd)
1614 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1616 compression = get_option('default-compression')
1617 if compression == 'auto'
1619 compression = 'zstd'
1625 compression = 'none'
1627 elif compression == 'zstd' and not have_zstd
1628 error('default-compression=zstd requires zstd')
1629 elif compression == 'lz4' and not have_lz4
1630 error('default-compression=lz4 requires lz4')
1631 elif compression == 'xz' and not have_xz
1632 error('default-compression=xz requires xz')
1634 conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper()))
1636 want_xkbcommon = get_option('xkbcommon')
1637 if want_xkbcommon != 'false' and not skip_deps
1638 libxkbcommon = dependency('xkbcommon',
1639 version : '>= 0.3.0',
1640 required : want_xkbcommon == 'true')
1641 have = libxkbcommon.found()
1646 conf.set10('HAVE_XKBCOMMON', have)
1648 want_pcre2 = get_option('pcre2')
1649 if want_pcre2 != 'false' and not skip_deps
1650 libpcre2 = dependency('libpcre2-8',
1651 required : want_pcre2 == 'true')
1652 have = libpcre2.found()
1657 conf.set10('HAVE_PCRE2', have)
1659 want_glib = get_option('glib')
1660 if want_glib != 'false' and not skip_deps
1661 libglib = dependency('glib-2.0',
1662 version : '>= 2.22.0',
1663 required : want_glib == 'true')
1664 libgobject = dependency('gobject-2.0',
1665 version : '>= 2.22.0',
1666 required : want_glib == 'true')
1667 libgio = dependency('gio-2.0',
1668 required : want_glib == 'true')
1669 have = libglib.found() and libgobject.found() and libgio.found()
1676 conf.set10('HAVE_GLIB', have)
1678 want_dbus = get_option('dbus')
1679 if want_dbus != 'false' and not skip_deps
1680 libdbus = dependency('dbus-1',
1681 version : '>= 1.3.2',
1682 required : want_dbus == 'true')
1683 have = libdbus.found()
1688 conf.set10('HAVE_DBUS', have)
1690 dbusdatadir = datadir / 'dbus-1'
1691 if conf.get('HAVE_DBUS') == 1
1692 dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
1695 dbuspolicydir = get_option('dbuspolicydir')
1696 if dbuspolicydir == ''
1697 dbuspolicydir = dbusdatadir / 'system.d'
1700 dbussessionservicedir = get_option('dbussessionservicedir')
1701 if dbussessionservicedir == ''
1702 dbussessionservicedir = dbusdatadir / 'services'
1703 if conf.get('HAVE_DBUS') == 1
1704 dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
1708 dbussystemservicedir = get_option('dbussystemservicedir')
1709 if dbussystemservicedir == ''
1710 dbussystemservicedir = dbusdatadir / 'system-services'
1711 if conf.get('HAVE_DBUS') == 1
1712 dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
1716 dbus_interfaces_dir = get_option('dbus-interfaces-dir')
1717 if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
1718 if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
1719 dbus_interfaces_dir = 'no'
1720 warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
1722 dbus_interfaces_dir = dbusdatadir / 'interfaces'
1723 if conf.get('HAVE_DBUS') == 1
1724 dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
1729 # We support one or the other. If gcrypt is available, we assume it's there to
1730 # be used, and use it in preference.
1731 opt = get_option('cryptolib')
1732 if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1733 error('openssl requested as the default cryptolib, but not available')
1735 conf.set10('PREFER_OPENSSL',
1736 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1737 conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1738 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
1739 lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? [libopenssl] : [libgcrypt, libgpg_error]
1741 dns_over_tls = get_option('dns-over-tls')
1742 if dns_over_tls != 'false'
1743 if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1
1744 error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib')
1747 if dns_over_tls == 'gnutls'
1748 have_openssl = false
1750 have_openssl = conf.get('HAVE_OPENSSL') == 1
1751 if dns_over_tls == 'openssl' and not have_openssl
1752 error('DNS-over-TLS support was requested with openssl, but dependencies are not available')
1755 if dns_over_tls == 'openssl' or have_openssl
1758 have_gnutls = conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0')
1759 if dns_over_tls != 'auto' and not have_gnutls
1760 str = dns_over_tls == 'gnutls' ? ' with gnutls' : ''
1761 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1764 have = have_gnutls or have_openssl
1768 have_openssl = false
1770 conf.set10('ENABLE_DNS_OVER_TLS', have)
1771 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1772 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1774 default_dns_over_tls = get_option('default-dns-over-tls')
1776 default_dns_over_tls = 'no'
1778 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1779 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.')
1780 default_dns_over_tls = 'no'
1782 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1783 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1784 conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
1786 default_mdns = get_option('default-mdns')
1787 conf.set('DEFAULT_MDNS_MODE',
1788 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1789 conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
1791 default_llmnr = get_option('default-llmnr')
1792 conf.set('DEFAULT_LLMNR_MODE',
1793 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1794 conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
1796 want_repart = get_option('repart')
1797 if want_repart != 'false'
1798 have = conf.get('HAVE_LIBFDISK') == 1
1799 if want_repart == 'true' and not have
1800 error('repart support was requested, but dependencies are not available')
1805 conf.set10('ENABLE_REPART', have)
1807 default_dnssec = get_option('default-dnssec')
1809 default_dnssec = 'no'
1811 if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0
1812 message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.')
1813 default_dnssec = 'no'
1815 conf.set('DEFAULT_DNSSEC_MODE',
1816 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1817 conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1819 want_sysupdate = get_option('sysupdate')
1820 if want_sysupdate != 'false'
1821 have = (conf.get('HAVE_OPENSSL') == 1 and
1822 conf.get('HAVE_LIBFDISK') == 1)
1823 if want_sysupdate == 'true' and not have
1824 error('sysupdate support was requested, but dependencies are not available')
1829 conf.set10('ENABLE_SYSUPDATE', have)
1831 want_importd = get_option('importd')
1832 if want_importd != 'false'
1833 have = (conf.get('HAVE_LIBCURL') == 1 and
1834 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
1835 conf.get('HAVE_ZLIB') == 1 and
1836 conf.get('HAVE_XZ') == 1)
1837 if want_importd == 'true' and not have
1838 error('importd support was requested, but dependencies are not available')
1843 conf.set10('ENABLE_IMPORTD', have)
1845 want_kernel_install = get_option('kernel-install')
1846 conf.set10('ENABLE_KERNEL_INSTALL', want_kernel_install)
1848 want_homed = get_option('homed')
1849 if want_homed != 'false'
1850 have = (conf.get('HAVE_OPENSSL') == 1 and
1851 conf.get('HAVE_LIBFDISK') == 1 and
1852 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1853 if want_homed == 'true' and not have
1854 error('homed support was requested, but dependencies are not available')
1859 conf.set10('ENABLE_HOMED', have)
1861 have = have and conf.get('HAVE_PAM') == 1
1862 conf.set10('ENABLE_PAM_HOME', have)
1864 have = get_option('oomd')
1865 conf.set10('ENABLE_OOMD', have)
1867 want_remote = get_option('remote')
1868 if want_remote != 'false'
1869 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1870 conf.get('HAVE_LIBCURL') == 1]
1871 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1872 # it's possible to build one without the other. Complain only if
1873 # support was explicitly requested. The auxiliary files like sysusers
1874 # config should be installed when any of the programs are built.
1875 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1876 error('remote support was requested, but dependencies are not available')
1878 have = have_deps[0] or have_deps[1]
1882 conf.set10('ENABLE_REMOTE', have)
1884 foreach term : ['analyze',
1887 'compat-mutable-uid-boundaries',
1924 have = get_option(term)
1925 name = 'ENABLE_' + term.underscorify().to_upper()
1926 conf.set10(name, have)
1929 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1931 foreach tuple : [['nss-mymachines', 'machined'],
1932 ['nss-resolve', 'resolve']]
1933 want = get_option(tuple[0])
1935 have = get_option(tuple[1])
1936 if want == 'true' and not have
1937 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1942 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1943 conf.set10(name, have)
1947 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1948 'ENABLE_NSS_MYMACHINES',
1949 'ENABLE_NSS_RESOLVE',
1950 'ENABLE_NSS_SYSTEMD']
1951 if conf.get(term) == 1
1955 conf.set10('ENABLE_NSS', enable_nss)
1957 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1959 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1961 ############################################################
1969 ############################################################
1971 pymod = import('python')
1972 python = pymod.find_installation('python3', required : true, modules : ['jinja2'])
1973 python_39 = python.language_version().version_compare('>=3.9')
1975 ############################################################
1977 if conf.get('BPF_FRAMEWORK') == 1
1980 '-Wno-compare-distinct-pointer-types',
1981 '-fno-stack-protector',
1991 '-fno-stack-protector',
2000 # Generate defines that are appropriate to tell the compiler what architecture
2001 # we're compiling for. By default we just map meson's cpu_family to __<cpu_family>__.
2002 # This dictionary contains the exceptions where this doesn't work.
2004 # C.f. https://mesonbuild.com/Reference-tables.html#cpu-families
2005 # and src/basic/missing_syscall_def.h.
2006 cpu_arch_defines = {
2007 'ppc' : ['-D__powerpc__'],
2008 'ppc64' : ['-D__powerpc64__', '-D_CALL_ELF=2'],
2009 'riscv32' : ['-D__riscv', '-D__riscv_xlen=32'],
2010 'riscv64' : ['-D__riscv', '-D__riscv_xlen=64'],
2011 'x86' : ['-D__i386__'],
2013 # For arm, assume hardware fp is available.
2014 'arm' : ['-D__arm__', '-D__ARM_PCS_VFP'],
2017 bpf_arch_flags = cpu_arch_defines.get(host_machine.cpu_family(),
2018 ['-D__@0@__'.format(host_machine.cpu_family())])
2019 if bpf_compiler == 'gcc'
2020 bpf_arch_flags += ['-m' + host_machine.endian() + '-endian']
2023 libbpf_include_dir = libbpf.get_variable(pkgconfig : 'includedir')
2025 bpf_o_unstripped_cmd = []
2026 if bpf_compiler == 'clang'
2027 bpf_o_unstripped_cmd += [
2032 elif bpf_compiler == 'gcc'
2033 bpf_o_unstripped_cmd += [
2040 bpf_o_unstripped_cmd += ['-I.']
2042 if not meson.is_cross_build() and bpf_compiler == 'clang'
2043 target_triplet_cmd = run_command('gcc', '-dumpmachine', check: false)
2044 if target_triplet_cmd.returncode() == 0
2045 target_triplet = target_triplet_cmd.stdout().strip()
2046 bpf_o_unstripped_cmd += [
2048 '/usr/include/@0@'.format(target_triplet)
2053 bpf_o_unstripped_cmd += [
2069 elif bpf_compiler == 'clang'
2087 #####################################################################
2092 'loongarch32' : 'loongarch32',
2093 'loongarch64' : 'loongarch64',
2094 'riscv32' : 'riscv32',
2095 'riscv64' : 'riscv64',
2098 }.get(host_machine.cpu_family(), '')
2100 if get_option('bootloader') != 'false' and efi_arch != ''
2101 conf.set_quoted('EFI_MACHINE_TYPE_NAME', efi_arch)
2102 elif get_option('bootloader') == 'true' and efi_arch == ''
2103 error('EFI not supported for this arch.')
2107 if efi_arch == 'x64' and cc.links('''
2109 int main(int argc, char *argv[]) {
2110 return __builtin_popcount(argc - CHAR_MAX);
2111 }''', args : ['-m32', '-march=i686'], name : '32bit build possible')
2112 efi_arch_alt = 'ia32'
2115 have_pyelftools = pymod.find_installation('python3', required : false, modules : ['elftools']).found()
2116 if get_option('bootloader') == 'true' and (not python_39 or not have_pyelftools)
2117 error('EFI bootloader support requires Python >= 3.9 and pyelftools.')
2121 'ENABLE_BOOTLOADER',
2122 get_option('efi') and
2123 get_option('bootloader') in ['auto', 'true'] and
2129 if get_option('ukify') == 'auto'
2130 want_ukify = python_39 and conf.get('ENABLE_BOOTLOADER') == 1
2131 elif get_option('ukify') == 'true' and (not python_39 or conf.get('ENABLE_BOOTLOADER') != 1)
2132 error('ukify requires Python >= 3.9 and -Dbootloader=true')
2134 want_ukify = get_option('ukify') == 'true'
2136 conf.set10('ENABLE_UKIFY', want_ukify)
2138 ############################################################
2140 elf2efi_lds = project_source_root / 'tools/elf2efi.lds'
2141 elf2efi_py = find_program('tools/elf2efi.py')
2142 export_dbus_interfaces_py = find_program('tools/dbus_exporter.py')
2143 generate_gperfs = find_program('tools/generate-gperfs.py')
2144 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
2145 make_directive_index_py = find_program('tools/make-directive-index.py')
2146 make_man_index_py = find_program('tools/make-man-index.py')
2147 meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
2148 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
2149 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
2150 update_hwdb_sh = find_program('tools/update-hwdb.sh')
2151 update_man_rules_py = find_program('tools/update-man-rules.py')
2152 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
2153 xml_helper_py = find_program('tools/xml_helper.py')
2155 ############################################################
2157 if get_option('b_coverage')
2158 userspace_c_args += ['-include', 'src/basic/coverage.h']
2161 ############################################################
2163 config_h = configure_file(
2164 output : 'config.h',
2165 configuration : conf)
2167 userspace_c_args += ['-include', 'config.h']
2169 jinja2_cmdline = [meson_render_jinja2, config_h, version_h]
2171 userspace = declare_dependency(
2172 compile_args : userspace_c_args,
2173 link_args : userspace_c_ld_args,
2176 man_page_depends = []
2178 ############################################################
2180 # binaries that have --help and are intended for use by humans,
2181 # usually, but not always, installed in /bin.
2182 public_programs = []
2184 # D-Bus introspection XML export
2187 # A list of boot stubs. Required for testing of ukify.
2190 basic_includes = include_directories(
2196 libsystemd_includes = [basic_includes, include_directories(
2197 'src/libsystemd/sd-bus',
2198 'src/libsystemd/sd-device',
2199 'src/libsystemd/sd-event',
2200 'src/libsystemd/sd-hwdb',
2201 'src/libsystemd/sd-id128',
2202 'src/libsystemd/sd-journal',
2203 'src/libsystemd/sd-netlink',
2204 'src/libsystemd/sd-network',
2205 'src/libsystemd/sd-resolve')]
2207 includes = [libsystemd_includes, include_directories('src/shared')]
2211 subdir('src/fundamental')
2213 subdir('src/libsystemd')
2214 subdir('src/shared')
2216 subdir('src/libudev')
2217 subdir('src/cryptsetup/cryptsetup-tokens')
2219 libsystemd = shared_library(
2221 version : libsystemd_version,
2222 include_directories : libsystemd_includes,
2223 link_args : ['-shared',
2224 '-Wl,--version-script=' + libsystemd_sym_path],
2225 link_with : [libbasic,
2228 link_whole : [libsystemd_static],
2229 dependencies : [librt,
2232 link_depends : libsystemd_sym,
2234 install_tag: 'libsystemd',
2235 install_dir : rootlibdir)
2237 alias_target('libsystemd', libsystemd)
2239 install_libsystemd_static = static_library(
2243 basic_gcrypt_sources,
2244 basic_compress_sources,
2245 fundamental_sources,
2246 include_directories : libsystemd_includes,
2247 build_by_default : static_libsystemd != 'false',
2248 install : static_libsystemd != 'false',
2249 install_tag: 'libsystemd',
2250 install_dir : rootlibdir,
2251 pic : static_libsystemd_pic,
2252 dependencies : [libblkid,
2265 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
2267 libudev = shared_library(
2269 version : libudev_version,
2270 include_directories : includes,
2271 link_args : ['-shared',
2272 '-Wl,--version-script=' + libudev_sym_path],
2273 link_with : [libsystemd_static, libshared_static],
2274 link_whole : libudev_basic,
2275 dependencies : [threads,
2277 link_depends : libudev_sym,
2279 install_tag: 'libudev',
2280 install_dir : rootlibdir)
2282 alias_target('libudev', libudev)
2284 install_libudev_static = static_library(
2287 fundamental_sources,
2291 include_directories : includes,
2292 build_by_default : static_libudev != 'false',
2293 install : static_libudev != 'false',
2294 install_tag: 'libudev',
2295 install_dir : rootlibdir,
2296 link_depends : libudev_sym,
2297 dependencies : [libmount,
2301 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
2302 pic : static_libudev_pic)
2304 if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
2305 if conf.get('HAVE_TPM2') == 1
2307 'cryptsetup-token-systemd-tpm2',
2308 cryptsetup_token_systemd_tpm2_sources,
2309 include_directories : includes,
2310 link_args : ['-shared',
2311 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2312 link_with : [lib_cryptsetup_token_common,
2314 dependencies : [libcryptsetup,
2318 link_depends : cryptsetup_token_sym,
2319 install_rpath : rootpkglibdir,
2321 install_dir : libcryptsetup_plugins_dir)
2324 if conf.get('HAVE_LIBFIDO2') == 1
2326 'cryptsetup-token-systemd-fido2',
2327 cryptsetup_token_systemd_fido2_sources,
2328 include_directories : includes,
2329 link_args : ['-shared',
2330 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2331 link_with : [lib_cryptsetup_token_common,
2333 dependencies : [libcryptsetup,
2337 link_depends : cryptsetup_token_sym,
2338 install_rpath : rootpkglibdir,
2340 install_dir : libcryptsetup_plugins_dir)
2343 if conf.get('HAVE_P11KIT') == 1
2345 'cryptsetup-token-systemd-pkcs11',
2346 cryptsetup_token_systemd_pkcs11_sources,
2347 include_directories : includes,
2348 link_args : ['-shared',
2349 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2350 link_with : [lib_cryptsetup_token_common,
2352 dependencies : [libcryptsetup,
2356 link_depends : cryptsetup_token_sym,
2357 install_rpath : rootpkglibdir,
2359 install_dir : libcryptsetup_plugins_dir)
2363 ############################################################
2365 # systemd-analyze requires 'libcore'
2367 # systemd-journal-remote requires 'libjournal_core'
2368 subdir('src/journal')
2369 # systemd-networkd requires 'libsystemd_network'
2370 subdir('src/libsystemd-network')
2372 subdir('src/analyze')
2374 subdir('src/boot/efi')
2375 subdir('src/busctl')
2376 subdir('src/coredump')
2377 subdir('src/cryptenroll')
2378 subdir('src/cryptsetup')
2380 subdir('src/hostname')
2381 subdir('src/import')
2382 subdir('src/journal-remote')
2383 subdir('src/kernel-install')
2384 subdir('src/locale')
2386 subdir('src/machine')
2387 subdir('src/network')
2388 subdir('src/nspawn')
2390 subdir('src/partition')
2391 subdir('src/portable')
2392 subdir('src/pstore')
2393 subdir('src/resolve')
2395 subdir('src/shutdown')
2396 subdir('src/sysext')
2397 subdir('src/systemctl')
2398 subdir('src/sysupdate')
2399 subdir('src/timedate')
2400 subdir('src/timesync')
2401 subdir('src/tmpfiles')
2402 subdir('src/userdb')
2403 subdir('src/xdg-autostart-generator')
2405 subdir('src/systemd')
2411 subdir('src/ukify/test') # needs to be last for test_env variable
2413 alias_target('devel', libsystemd_pc, libudev_pc, systemd_pc, udev_pc)
2415 ############################################################
2417 # only static linking apart from libdl, to make sure that the
2418 # module is linked to all libraries that it uses.
2419 test_dlopen = executable(
2422 include_directories : includes,
2423 link_with : [libbasic],
2424 dependencies : [libdl,
2426 build_by_default : want_tests != 'false')
2428 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
2429 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
2430 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
2431 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
2433 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
2437 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
2438 version_script_arg = project_source_root / sym
2440 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
2441 if tuple.length() > 2
2442 foreach s : tuple[2]
2443 sources += ['src/nss-@0@/@1@'.format(module, s)]
2447 incs = tuple.length() > 3 ? tuple[3] : includes
2449 nss = shared_library(
2453 include_directories : incs,
2454 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
2455 link_args : ['-Wl,-z,nodelete',
2457 '-Wl,--version-script=' + version_script_arg],
2458 link_with : [libsystemd_static,
2461 dependencies : [librt,
2466 install_tag : 'nss',
2467 install_dir : rootlibdir)
2469 # We cannot use shared_module because it does not support version suffix.
2470 # Unfortunately shared_library insists on creating the symlink…
2471 meson.add_install_script('sh', '-c',
2472 'rm $DESTDIR@0@/libnss_@1@.so'
2473 .format(rootlibdir, module),
2477 if want_tests != 'false'
2478 test('dlopen-nss_' + module,
2480 # path to dlopen must include a slash
2481 args : nss.full_path(),
2487 ############################################################
2492 include_directories : includes,
2493 link_with : [libcore,
2495 dependencies : [libseccomp,
2498 install_rpath : rootpkglibdir,
2500 install_dir : rootlibexecdir)
2501 dbus_programs += exe
2502 public_programs += exe
2504 meson.add_install_script(meson_make_symlink,
2505 rootlibexecdir / 'systemd',
2506 rootsbindir / 'init')
2510 systemd_analyze_sources,
2511 include_directories : core_includes,
2512 link_with : [libcore,
2514 dependencies : [libseccomp,
2517 install_rpath : rootpkglibdir,
2518 install : conf.get('ENABLE_ANALYZE') == 1)
2519 if conf.get('ENABLE_ANALYZE') == 1
2520 public_programs += exe
2523 if want_tests != 'false'
2524 test('test-compare-versions',
2525 test_compare_versions_sh,
2526 args : exe.full_path())
2531 systemd_journald_sources,
2532 include_directories : includes,
2533 link_with : [libjournal_core,
2535 dependencies : [liblz4,
2542 install_rpath : rootpkglibdir,
2544 install_dir : rootlibexecdir)
2546 public_programs += executable(
2548 systemd_cat_sources,
2549 include_directories : includes,
2550 link_with : [libjournal_core,
2552 dependencies : [threads,
2555 install_rpath : rootpkglibdir,
2558 if get_option('link-journalctl-shared')
2559 journalctl_link_with = [libshared]
2561 journalctl_link_with = [libsystemd_static,
2566 public_programs += executable(
2569 include_directories : includes,
2570 link_with : [journalctl_link_with],
2571 dependencies : [libdl,
2578 install_rpath : rootpkglibdir,
2580 install_dir : rootbindir)
2583 'systemd-getty-generator',
2584 'src/getty-generator/getty-generator.c',
2585 include_directories : includes,
2586 link_with : [libshared],
2587 dependencies : userspace,
2588 install_rpath : rootpkglibdir,
2590 install_dir : systemgeneratordir)
2593 'systemd-debug-generator',
2594 'src/debug-generator/debug-generator.c',
2595 include_directories : includes,
2596 link_with : [libshared],
2597 dependencies : userspace,
2598 install_rpath : rootpkglibdir,
2600 install_dir : systemgeneratordir)
2603 'systemd-run-generator',
2604 'src/run-generator/run-generator.c',
2605 include_directories : includes,
2606 link_with : [libshared],
2607 dependencies : userspace,
2608 install_rpath : rootpkglibdir,
2610 install_dir : systemgeneratordir)
2613 'systemd-fstab-generator',
2614 'src/fstab-generator/fstab-generator.c',
2615 include_directories : includes,
2616 link_with : [libshared],
2617 dependencies : userspace,
2618 install_rpath : rootpkglibdir,
2620 install_dir : systemgeneratordir)
2622 meson.add_install_script(meson_make_symlink,
2623 systemgeneratordir / 'systemd-fstab-generator',
2624 rootlibexecdir / 'systemd-sysroot-fstab-check')
2626 if want_tests != 'false'
2627 test('test-fstab-generator',
2628 test_fstab_generator_sh,
2629 # https://github.com/mesonbuild/meson/issues/2681
2630 args : exe.full_path(),
2634 if conf.get('ENABLE_ENVIRONMENT_D') == 1
2636 '30-systemd-environment-d-generator',
2637 'src/environment-d-generator/environment-d-generator.c',
2638 include_directories : includes,
2639 link_with : [libshared],
2640 dependencies : userspace,
2641 install_rpath : rootpkglibdir,
2643 install_dir : userenvgeneratordir)
2645 meson.add_install_script(meson_make_symlink,
2646 sysconfdir / 'environment',
2647 environmentdir / '99-environment.conf')
2650 if conf.get('ENABLE_HIBERNATE') == 1
2652 'systemd-hibernate-resume-generator',
2653 'src/hibernate-resume/hibernate-resume-generator.c',
2654 include_directories : includes,
2655 link_with : [libshared],
2656 dependencies : userspace,
2657 install_rpath : rootpkglibdir,
2659 install_dir : systemgeneratordir)
2662 'systemd-hibernate-resume',
2663 'src/hibernate-resume/hibernate-resume.c',
2664 include_directories : includes,
2665 link_with : [libshared],
2666 dependencies : userspace,
2667 install_rpath : rootpkglibdir,
2669 install_dir : rootlibexecdir)
2672 if conf.get('HAVE_BLKID') == 1
2674 'systemd-gpt-auto-generator',
2675 'src/gpt-auto-generator/gpt-auto-generator.c',
2676 include_directories : includes,
2677 link_with : [libshared],
2678 dependencies : [libblkid,
2680 install_rpath : rootpkglibdir,
2682 install_dir : systemgeneratordir)
2684 public_programs += executable(
2686 'src/dissect/dissect.c',
2687 include_directories : includes,
2688 link_with : [libshared],
2689 dependencies : [userspace,
2691 install_rpath : rootpkglibdir,
2694 meson.add_install_script(meson_make_symlink,
2695 bindir / 'systemd-dissect',
2696 rootsbindir / 'mount.ddi')
2699 if conf.get('ENABLE_RESOLVE') == 1
2700 dbus_programs += executable(
2702 systemd_resolved_sources,
2703 include_directories : resolve_includes,
2704 link_with : [libshared,
2706 libsystemd_resolve_core],
2707 dependencies : [systemd_resolved_dependencies,
2709 install_rpath : rootpkglibdir,
2711 install_dir : rootlibexecdir)
2713 public_programs += executable(
2716 include_directories : includes,
2717 link_with : [libshared,
2719 libsystemd_resolve_core],
2720 dependencies : [lib_openssl_or_gcrypt,
2726 install_rpath : rootpkglibdir,
2729 meson.add_install_script(meson_make_symlink,
2730 bindir / 'resolvectl',
2731 rootsbindir / 'resolvconf')
2733 meson.add_install_script(meson_make_symlink,
2734 bindir / 'resolvectl',
2735 bindir / 'systemd-resolve')
2738 if conf.get('ENABLE_LOGIND') == 1
2739 dbus_programs += executable(
2741 systemd_logind_sources,
2742 include_directories : includes,
2743 link_with : [liblogind_core,
2745 dependencies : [libacl,
2749 install_rpath : rootpkglibdir,
2751 install_dir : rootlibexecdir)
2753 public_programs += executable(
2756 include_directories : includes,
2757 link_with : [libshared],
2758 dependencies : [liblz4,
2764 install_rpath : rootpkglibdir,
2766 install_dir : rootbindir)
2768 public_programs += executable(
2770 'src/login/inhibit.c',
2771 include_directories : includes,
2772 link_with : [libshared],
2773 dependencies : [userspace,
2775 install_rpath : rootpkglibdir,
2777 install_dir : rootbindir)
2779 if conf.get('HAVE_PAM') == 1
2780 version_script_arg = project_source_root / pam_systemd_sym
2781 pam_systemd = shared_library(
2785 include_directories : includes,
2786 link_args : ['-shared',
2787 '-Wl,--version-script=' + version_script_arg],
2788 link_with : [libsystemd_static,
2790 dependencies : [libpam_misc,
2795 link_depends : pam_systemd_sym,
2797 install_tag : 'pam',
2798 install_dir : pamlibdir)
2800 if want_tests != 'false'
2801 test('dlopen-pam_systemd',
2803 # path to dlopen must include a slash
2804 args : pam_systemd.full_path(),
2805 depends : pam_systemd)
2810 'systemd-user-runtime-dir',
2811 user_runtime_dir_sources,
2812 include_directories : includes,
2813 link_with : [libshared],
2814 dependencies : userspace,
2815 install_rpath : rootpkglibdir,
2817 install_dir : rootlibexecdir)
2820 if conf.get('HAVE_PAM') == 1
2822 'systemd-user-sessions',
2823 'src/user-sessions/user-sessions.c',
2824 include_directories : includes,
2825 link_with : [libshared],
2826 dependencies : userspace,
2827 install_rpath : rootpkglibdir,
2829 install_dir : rootlibexecdir)
2832 if conf.get('HAVE_BLKID') == 1 and conf.get('ENABLE_BOOTLOADER') == 1
2833 if get_option('link-boot-shared')
2834 boot_link_with = [libshared]
2836 boot_link_with = [libsystemd_static, libshared_static]
2842 include_directories : includes,
2843 link_with : [boot_link_with],
2844 dependencies : [libblkid,
2847 install_rpath : rootpkglibdir,
2849 public_programs += exe
2851 if want_tests != 'false'
2852 test('test-bootctl-json',
2853 test_bootctl_json_sh,
2854 args : exe.full_path(),
2858 public_programs += executable(
2859 'systemd-bless-boot',
2860 'src/boot/bless-boot.c',
2861 include_directories : includes,
2862 link_with : [boot_link_with],
2863 dependencies : [libblkid,
2866 install_rpath : rootpkglibdir,
2868 install_dir : rootlibexecdir)
2871 'systemd-bless-boot-generator',
2872 'src/boot/bless-boot-generator.c',
2873 include_directories : includes,
2874 link_with : [boot_link_with],
2875 dependencies : userspace,
2876 install_rpath : rootpkglibdir,
2878 install_dir : systemgeneratordir)
2880 if conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_TPM2') == 1
2883 'src/boot/measure.c',
2884 include_directories : includes,
2885 link_with : [libshared],
2886 dependencies : [libopenssl,
2889 install_rpath : rootpkglibdir,
2891 install_dir : rootlibexecdir)
2894 'src/boot/pcrphase.c',
2895 include_directories : includes,
2896 link_with : [libshared],
2897 dependencies : [libblkid,
2902 install_rpath : rootpkglibdir,
2904 install_dir : rootlibexecdir)
2909 'systemd-boot-check-no-failures',
2910 'src/boot/boot-check-no-failures.c',
2911 include_directories : includes,
2912 link_with : [libshared],
2913 dependencies : [libblkid,
2916 install_rpath : rootpkglibdir,
2918 install_dir : rootlibexecdir)
2920 public_programs += executable(
2921 'systemd-socket-activate',
2922 'src/activate/activate.c',
2923 include_directories : includes,
2924 link_with : [libshared],
2925 dependencies : [threads,
2928 install_rpath : rootpkglibdir,
2931 systemctl = executable(
2934 include_directories : includes,
2935 link_with : systemctl_link_with,
2936 dependencies : [libcap,
2944 install_rpath : rootpkglibdir,
2946 install_dir : rootbindir)
2947 public_programs += systemctl
2949 if conf.get('ENABLE_PORTABLED') == 1
2950 if get_option('link-portabled-shared')
2951 portabled_link_with = [libshared]
2953 portabled_link_with = [libsystemd_static,
2957 dbus_programs += executable(
2958 'systemd-portabled',
2959 systemd_portabled_sources,
2960 include_directories : includes,
2961 link_with : [portabled_link_with],
2962 dependencies : [libselinux,
2966 install_rpath : rootpkglibdir,
2968 install_dir : rootlibexecdir)
2970 public_programs += executable(
2972 'src/portable/portablectl.c',
2973 include_directories : includes,
2974 link_with : [portabled_link_with],
2975 dependencies : [threads,
2978 install_rpath : rootpkglibdir,
2980 install_dir : rootbindir)
2983 if conf.get('ENABLE_SYSEXT') == 1
2984 public_programs += executable(
2986 systemd_sysext_sources,
2987 include_directories : includes,
2988 link_with : [libshared],
2989 dependencies : [userspace,
2991 install_rpath : rootpkglibdir,
2993 install_dir : rootbindir)
2996 if conf.get('ENABLE_USERDB') == 1
2999 systemd_userwork_sources,
3000 include_directories : includes,
3001 link_with : [libshared],
3002 dependencies : [threads,
3005 install_rpath : rootpkglibdir,
3007 install_dir : rootlibexecdir)
3011 systemd_userdbd_sources,
3012 include_directories : includes,
3013 link_with : [libshared],
3014 dependencies : [threads,
3017 install_rpath : rootpkglibdir,
3019 install_dir : rootlibexecdir)
3021 public_programs += executable(
3024 include_directories : includes,
3025 link_with : [libshared],
3026 dependencies : [threads,
3029 install_rpath : rootpkglibdir,
3033 if conf.get('ENABLE_HOMED') == 1
3036 systemd_homework_sources,
3037 include_directories : includes,
3038 link_with : [libshared,
3040 dependencies : [libblkid,
3048 install_rpath : rootpkglibdir,
3050 install_dir : rootlibexecdir)
3052 dbus_programs += executable(
3054 systemd_homed_sources,
3055 include_directories : home_includes,
3056 link_with : [libshared],
3057 dependencies : [libcrypt,
3063 install_rpath : rootpkglibdir,
3065 install_dir : rootlibexecdir)
3067 public_programs += executable(
3070 include_directories : includes,
3071 link_with : [libshared],
3072 dependencies : [libcrypt,
3079 install_rpath : rootpkglibdir,
3082 if conf.get('HAVE_PAM') == 1
3083 version_script_arg = project_source_root / pam_systemd_home_sym
3084 pam_systemd_home = shared_library(
3088 include_directories : includes,
3089 link_args : ['-shared',
3090 '-Wl,--version-script=' + version_script_arg],
3091 link_with : [libsystemd_static,
3093 dependencies : [libcrypt,
3099 link_depends : pam_systemd_home_sym,
3101 install_tag : 'pam',
3102 install_dir : pamlibdir)
3104 if want_tests != 'false'
3105 test('dlopen-pam_systemd_home',
3107 # path to dlopen must include a slash
3108 args : pam_systemd_home.full_path(),
3109 depends : pam_systemd_home)
3114 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
3115 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
3116 meson.add_install_script(meson_make_symlink,
3117 rootbindir / 'systemctl',
3118 rootsbindir / alias)
3121 meson.add_install_script(meson_make_symlink,
3122 rootbindir / 'udevadm',
3123 rootlibexecdir / 'systemd-udevd')
3125 if conf.get('ENABLE_BACKLIGHT') == 1
3127 'systemd-backlight',
3128 'src/backlight/backlight.c',
3129 include_directories : includes,
3130 link_with : [libshared],
3131 dependencies : userspace,
3132 install_rpath : rootpkglibdir,
3134 install_dir : rootlibexecdir)
3137 if conf.get('ENABLE_RFKILL') == 1
3140 'src/rfkill/rfkill.c',
3141 include_directories : includes,
3142 link_with : [libshared],
3143 dependencies : userspace,
3144 install_rpath : rootpkglibdir,
3146 install_dir : rootlibexecdir)
3150 'systemd-system-update-generator',
3151 'src/system-update-generator/system-update-generator.c',
3152 include_directories : includes,
3153 link_with : [libshared],
3154 dependencies : userspace,
3155 install_rpath : rootpkglibdir,
3157 install_dir : systemgeneratordir)
3159 if conf.get('HAVE_LIBCRYPTSETUP') == 1
3161 'systemd-cryptsetup',
3162 systemd_cryptsetup_sources,
3163 include_directories : includes,
3164 link_with : [libshared],
3165 dependencies : [libcryptsetup,
3170 install_rpath : rootpkglibdir,
3172 install_dir : rootlibexecdir)
3175 'systemd-cryptsetup-generator',
3176 'src/cryptsetup/cryptsetup-generator.c',
3177 include_directories : includes,
3178 link_with : [libshared],
3179 dependencies : userspace,
3180 install_rpath : rootpkglibdir,
3182 install_dir : systemgeneratordir)
3185 'systemd-veritysetup',
3186 'src/veritysetup/veritysetup.c',
3187 include_directories : includes,
3188 link_with : [libshared],
3189 dependencies : [libcryptsetup,
3192 install_rpath : rootpkglibdir,
3194 install_dir : rootlibexecdir)
3197 'systemd-veritysetup-generator',
3198 'src/veritysetup/veritysetup-generator.c',
3199 include_directories : includes,
3200 link_with : [libshared],
3201 dependencies : [userspace,
3203 install_rpath : rootpkglibdir,
3205 install_dir : systemgeneratordir)
3207 public_programs += executable(
3208 'systemd-cryptenroll',
3209 systemd_cryptenroll_sources,
3210 include_directories : includes,
3211 link_with : [libshared],
3212 dependencies : [libcryptsetup,
3218 install_rpath : rootpkglibdir,
3222 'systemd-integritysetup',
3223 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
3224 include_directories : includes,
3225 link_with : [libshared],
3226 dependencies : [libcryptsetup,
3229 install_rpath : rootpkglibdir,
3231 install_dir : rootlibexecdir)
3234 'systemd-integritysetup-generator',
3235 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
3236 include_directories : includes,
3237 link_with : [libshared],
3238 dependencies : userspace,
3239 install_rpath : rootpkglibdir,
3241 install_dir : systemgeneratordir)
3244 if conf.get('HAVE_SYSV_COMPAT') == 1
3246 'systemd-sysv-generator',
3247 'src/sysv-generator/sysv-generator.c',
3248 include_directories : includes,
3249 link_with : [libshared],
3250 dependencies : userspace,
3251 install_rpath : rootpkglibdir,
3253 install_dir : systemgeneratordir)
3255 sysv_generator_test_py = find_program('test/sysv-generator-test.py')
3256 if want_tests != 'false'
3257 test('sysv-generator-test',
3258 sysv_generator_test_py,
3263 'systemd-rc-local-generator',
3264 'src/rc-local-generator/rc-local-generator.c',
3265 include_directories : includes,
3266 link_with : [libshared],
3267 dependencies : userspace,
3268 install_rpath : rootpkglibdir,
3270 install_dir : systemgeneratordir)
3273 if conf.get('ENABLE_XDG_AUTOSTART') == 1
3275 'systemd-xdg-autostart-generator',
3276 systemd_xdg_autostart_generator_sources,
3277 include_directories : includes,
3278 link_with : [libshared],
3279 dependencies : userspace,
3280 install_rpath : rootpkglibdir,
3282 install_dir : usergeneratordir)
3285 'systemd-xdg-autostart-condition',
3286 'src/xdg-autostart-generator/xdg-autostart-condition.c',
3287 include_directories : includes,
3288 link_with : [libshared],
3289 dependencies : userspace,
3290 install_rpath : rootpkglibdir,
3292 install_dir : rootlibexecdir)
3295 if conf.get('ENABLE_HOSTNAMED') == 1
3296 dbus_programs += executable(
3297 'systemd-hostnamed',
3298 'src/hostname/hostnamed.c',
3299 include_directories : includes,
3300 link_with : [libshared],
3301 dependencies : userspace,
3302 install_rpath : rootpkglibdir,
3304 install_dir : rootlibexecdir)
3306 public_programs += executable(
3308 'src/hostname/hostnamectl.c',
3309 include_directories : includes,
3310 link_with : [libshared],
3311 dependencies : [userspace,
3313 install_rpath : rootpkglibdir,
3317 if conf.get('ENABLE_LOCALED') == 1
3318 dbus_programs += executable(
3320 systemd_localed_sources,
3321 include_directories : includes,
3322 link_with : [libshared],
3323 dependencies : libxkbcommon_deps +
3326 install_rpath : rootpkglibdir,
3328 install_dir : rootlibexecdir)
3330 public_programs += executable(
3333 include_directories : includes,
3334 link_with : [libshared],
3335 dependencies : [userspace,
3337 install_rpath : rootpkglibdir,
3341 if conf.get('ENABLE_TIMEDATED') == 1
3342 dbus_programs += executable(
3343 'systemd-timedated',
3344 'src/timedate/timedated.c',
3345 include_directories : includes,
3346 link_with : [libshared],
3347 dependencies : userspace,
3348 install_rpath : rootpkglibdir,
3350 install_dir : rootlibexecdir)
3353 if conf.get('ENABLE_TIMEDATECTL') == 1
3354 public_programs += executable(
3356 'src/timedate/timedatectl.c',
3357 include_directories : includes,
3358 install_rpath : rootpkglibdir,
3359 link_with : [libshared],
3360 dependencies : [libm,
3366 if conf.get('ENABLE_TIMESYNCD') == 1
3368 'systemd-timesyncd',
3369 systemd_timesyncd_sources,
3370 include_directories : includes,
3371 link_with : [libtimesyncd_core],
3372 dependencies : [libm,
3376 install_rpath : rootpkglibdir,
3378 install_dir : rootlibexecdir)
3381 'systemd-time-wait-sync',
3382 'src/timesync/wait-sync.c',
3383 include_directories : includes,
3384 link_with : [libtimesyncd_core],
3385 dependencies : userspace,
3386 install_rpath : rootpkglibdir,
3388 install_dir : rootlibexecdir)
3391 if conf.get('ENABLE_MACHINED') == 1
3392 dbus_programs += executable(
3394 systemd_machined_sources,
3395 include_directories : includes,
3396 link_with : [libmachine_core,
3398 dependencies : userspace,
3399 install_rpath : rootpkglibdir,
3401 install_dir : rootlibexecdir)
3403 public_programs += executable(
3405 'src/machine/machinectl.c',
3406 include_directories : includes,
3407 link_with : [libshared],
3408 dependencies : [liblz4,
3414 install_rpath : rootpkglibdir,
3416 install_dir : rootbindir)
3419 if conf.get('ENABLE_IMPORTD') == 1
3420 dbus_programs += executable(
3422 systemd_importd_sources,
3423 include_directories : includes,
3424 link_with : [libshared],
3425 dependencies : [threads,
3428 install_rpath : rootpkglibdir,
3430 install_dir : rootlibexecdir)
3432 systemd_pull = executable(
3434 systemd_pull_sources,
3435 include_directories : includes,
3436 link_with : [libshared,
3438 dependencies : [lib_openssl_or_gcrypt,
3445 install_rpath : rootpkglibdir,
3447 install_dir : rootlibexecdir)
3449 systemd_import = executable(
3451 systemd_import_sources,
3452 include_directories : includes,
3453 link_with : [libshared,
3455 dependencies : [libbzip2,
3461 install_rpath : rootpkglibdir,
3463 install_dir : rootlibexecdir)
3465 systemd_import_fs = executable(
3466 'systemd-import-fs',
3467 systemd_import_fs_sources,
3468 include_directories : includes,
3469 link_with : [libshared,
3471 dependencies : [userspace,
3473 install_rpath : rootpkglibdir,
3475 install_dir : rootlibexecdir)
3477 systemd_export = executable(
3479 systemd_export_sources,
3480 include_directories : includes,
3481 link_with : [libshared,
3483 dependencies : [libbzip2,
3489 install_rpath : rootpkglibdir,
3491 install_dir : rootlibexecdir)
3493 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
3496 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
3497 public_programs += executable(
3498 'systemd-journal-upload',
3499 systemd_journal_upload_sources,
3500 include_directories : includes,
3501 link_with : [libshared],
3502 dependencies : [libcurl,
3510 install_rpath : rootpkglibdir,
3512 install_dir : rootlibexecdir)
3515 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
3516 public_programs += executable(
3517 'systemd-journal-remote',
3518 systemd_journal_remote_sources,
3519 include_directories : journal_includes,
3520 link_with : [libshared,
3521 libsystemd_journal_remote],
3522 dependencies : [libgnutls,
3530 install_rpath : rootpkglibdir,
3532 install_dir : rootlibexecdir)
3534 public_programs += executable(
3535 'systemd-journal-gatewayd',
3536 systemd_journal_gatewayd_sources,
3537 include_directories : journal_includes,
3538 link_with : [libshared],
3539 dependencies : [libgnutls,
3547 install_rpath : rootpkglibdir,
3549 install_dir : rootlibexecdir)
3552 if conf.get('ENABLE_COREDUMP') == 1
3555 systemd_coredump_sources,
3556 include_directories : includes,
3557 link_with : [libshared,
3559 dependencies : [libacl,
3566 install_rpath : rootpkglibdir,
3568 install_dir : rootlibexecdir)
3570 public_programs += executable(
3572 coredumpctl_sources,
3573 include_directories : includes,
3574 link_with : [libshared,
3576 dependencies : [liblz4,
3582 install_rpath : rootpkglibdir,
3586 if conf.get('ENABLE_PSTORE') == 1
3589 systemd_pstore_sources,
3590 include_directories : includes,
3591 link_with : [libshared],
3592 dependencies : [libacl,
3599 install_rpath : rootpkglibdir,
3601 install_dir : rootlibexecdir)
3604 if conf.get('ENABLE_OOMD') == 1
3605 dbus_programs += executable('systemd-oomd',
3606 systemd_oomd_sources,
3607 include_directories : includes,
3608 link_with : [libshared],
3609 dependencies : [libatomic,
3612 install_rpath : rootpkglibdir,
3614 install_dir : rootlibexecdir)
3616 public_programs += executable(
3619 include_directories : includes,
3620 link_with : [libshared],
3621 dependencies : [userspace,
3623 install_rpath : rootpkglibdir,
3627 if conf.get('ENABLE_BINFMT') == 1
3628 public_programs += executable(
3630 'src/binfmt/binfmt.c',
3631 include_directories : includes,
3632 link_with : [libshared],
3633 dependencies : [userspace,
3635 install_rpath : rootpkglibdir,
3637 install_dir : rootlibexecdir)
3639 meson.add_install_script('sh', '-c',
3640 mkdir_p.format(binfmtdir))
3641 if install_sysconfdir
3642 meson.add_install_script('sh', '-c',
3643 mkdir_p.format(sysconfdir / 'binfmt.d'))
3647 if conf.get('ENABLE_SYSUPDATE') == 1
3649 'systemd-sysupdate',
3650 systemd_sysupdate_sources,
3651 include_directories : includes,
3652 link_with : [libshared,
3654 dependencies : [libblkid,
3660 install_rpath : rootpkglibdir,
3662 install_dir : rootlibexecdir)
3663 public_programs += exe
3666 if conf.get('ENABLE_VCONSOLE') == 1
3668 'systemd-vconsole-setup',
3669 'src/vconsole/vconsole-setup.c',
3670 include_directories : includes,
3671 link_with : [libshared],
3672 dependencies : userspace,
3673 install_rpath : rootpkglibdir,
3675 install_dir : rootlibexecdir)
3678 if conf.get('ENABLE_RANDOMSEED') == 1
3680 'systemd-random-seed',
3681 'src/random-seed/random-seed.c',
3682 include_directories : includes,
3683 link_with : [libshared],
3684 dependencies : [userspace,
3686 install_rpath : rootpkglibdir,
3688 install_dir : rootlibexecdir)
3691 if conf.get('ENABLE_FIRSTBOOT') == 1
3692 public_programs += executable(
3693 'systemd-firstboot',
3694 'src/firstboot/firstboot.c',
3695 include_directories : includes,
3696 link_with : [libshared],
3697 dependencies : [libcrypt,
3700 install_rpath : rootpkglibdir,
3702 install_dir : rootbindir)
3706 'systemd-remount-fs',
3707 'src/remount-fs/remount-fs.c',
3708 include_directories : includes,
3709 link_with : [libshared],
3710 dependencies : [userspace,
3712 install_rpath : rootpkglibdir,
3714 install_dir : rootlibexecdir)
3717 'systemd-machine-id-setup',
3718 'src/machine-id-setup/machine-id-setup-main.c',
3719 include_directories : includes,
3720 link_with : [libshared],
3721 dependencies : [userspace,
3723 install_rpath : rootpkglibdir,
3725 install_dir : rootbindir)
3730 include_directories : includes,
3731 link_with : [libshared],
3732 dependencies : [userspace,
3734 install_rpath : rootpkglibdir,
3736 install_dir : rootlibexecdir)
3740 'src/partition/growfs.c',
3741 include_directories : includes,
3742 link_with : [libshared],
3743 dependencies : [userspace,
3745 install_rpath : rootpkglibdir,
3747 install_dir : rootlibexecdir)
3751 'src/partition/makefs.c',
3752 include_directories : includes,
3753 link_with : [libshared],
3754 dependencies : [userspace,
3756 install_rpath : rootpkglibdir,
3758 install_dir : rootlibexecdir)
3762 'src/sleep/sleep.c',
3763 include_directories : includes,
3764 link_with : [libshared],
3765 dependencies : [userspace,
3767 install_rpath : rootpkglibdir,
3769 install_dir : rootlibexecdir)
3771 if install_sysconfdir_samples
3772 install_data('src/sleep/sleep.conf',
3773 install_dir : pkgsysconfdir)
3776 public_programs += executable(
3778 'src/sysctl/sysctl.c',
3779 include_directories : includes,
3780 link_with : [libshared],
3781 dependencies : [userspace,
3783 install_rpath : rootpkglibdir,
3785 install_dir : rootlibexecdir)
3787 public_programs += executable(
3789 'src/ac-power/ac-power.c',
3790 include_directories : includes,
3791 link_with : [libshared],
3792 dependencies : [userspace,
3794 install_rpath : rootpkglibdir,
3797 public_programs += executable(
3798 'systemd-detect-virt',
3799 'src/detect-virt/detect-virt.c',
3800 include_directories : includes,
3801 link_with : [libshared],
3802 dependencies : [userspace,
3804 install_rpath : rootpkglibdir,
3807 public_programs += executable(
3809 'src/delta/delta.c',
3810 include_directories : includes,
3811 link_with : [libshared],
3812 dependencies : [userspace,
3814 install_rpath : rootpkglibdir,
3817 public_programs += executable(
3819 'src/escape/escape.c',
3820 include_directories : includes,
3821 link_with : [libshared],
3822 dependencies : [userspace,
3824 install_rpath : rootpkglibdir,
3826 install_dir : rootbindir)
3828 public_programs += executable(
3830 'src/notify/notify.c',
3831 include_directories : includes,
3832 link_with : [libshared],
3833 dependencies : [userspace,
3835 install_rpath : rootpkglibdir,
3837 install_dir : rootbindir)
3839 public_programs += executable(
3841 'src/creds/creds.c',
3842 include_directories : includes,
3843 link_with : [libshared],
3844 dependencies : [threads,
3848 install_rpath : rootpkglibdir,
3850 install_dir : rootbindir)
3852 # Protecting files from the distro in /usr doesn't make sense since they can be trivially accessed otherwise,
3853 # so don't restrict the access mode in /usr. That doesn't apply to /etc, so we do restrict the access mode
3855 meson.add_install_script('sh', '-c', mkdir_p.format(credstoredir))
3856 if install_sysconfdir
3857 # Keep in sync with tmpfiles.d/credstore.conf
3858 meson.add_install_script('sh', '-c', mkdir_p_mode.format(sysconfdir / 'credstore', '0700'))
3859 meson.add_install_script('sh', '-c', mkdir_p_mode.format(sysconfdir / 'credstore.encrypted', '0700'))
3863 'systemd-volatile-root',
3864 'src/volatile-root/volatile-root.c',
3865 include_directories : includes,
3866 link_with : [libshared],
3867 dependencies : userspace,
3868 install_rpath : rootpkglibdir,
3869 install : conf.get('ENABLE_INITRD') == 1,
3870 install_dir : rootlibexecdir)
3873 'systemd-cgroups-agent',
3874 'src/cgroups-agent/cgroups-agent.c',
3875 include_directories : includes,
3876 link_with : [libshared],
3877 dependencies : userspace,
3878 install_rpath : rootpkglibdir,
3880 install_dir : rootlibexecdir)
3882 systemd_id128 = executable(
3884 'src/id128/id128.c',
3885 include_directories : includes,
3886 link_with : [libshared],
3887 dependencies : [userspace,
3889 install_rpath : rootpkglibdir,
3891 public_programs += systemd_id128
3893 if want_tests != 'false'
3894 test('test-systemctl-enable',
3895 test_systemctl_enable_sh,
3896 # https://github.com/mesonbuild/meson/issues/2681
3897 args : [systemctl.full_path(),
3898 systemd_id128.full_path()])
3901 public_programs += executable(
3904 include_directories : includes,
3905 link_with : [libshared],
3906 dependencies : [userspace,
3908 install_rpath : rootpkglibdir,
3911 public_programs += executable(
3912 'systemd-ask-password',
3913 'src/ask-password/ask-password.c',
3914 include_directories : includes,
3915 link_with : [libshared],
3916 dependencies : [userspace,
3918 install_rpath : rootpkglibdir,
3920 install_dir : rootbindir)
3923 'systemd-reply-password',
3924 'src/reply-password/reply-password.c',
3925 include_directories : includes,
3926 link_with : [libshared],
3927 dependencies : userspace,
3928 install_rpath : rootpkglibdir,
3930 install_dir : rootlibexecdir)
3932 public_programs += executable(
3933 'systemd-tty-ask-password-agent',
3934 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3935 include_directories : includes,
3936 link_with : [libshared],
3937 dependencies : [userspace,
3939 install_rpath : rootpkglibdir,
3941 install_dir : rootbindir)
3943 public_programs += executable(
3946 include_directories : includes,
3947 link_with : [libshared],
3948 dependencies : [userspace,
3950 install_rpath : rootpkglibdir,
3953 public_programs += executable(
3955 'src/cgtop/cgtop.c',
3956 include_directories : includes,
3957 link_with : [libshared],
3958 dependencies : [userspace,
3960 install_rpath : rootpkglibdir,
3965 'src/initctl/initctl.c',
3966 include_directories : includes,
3967 link_with : [libshared],
3968 dependencies : userspace,
3969 install_rpath : rootpkglibdir,
3970 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3971 install_dir : rootlibexecdir)
3973 public_programs += executable(
3975 'src/mount/mount-tool.c',
3976 include_directories : includes,
3977 link_with : [libshared],
3978 dependencies: [libmount,
3981 install_rpath : rootpkglibdir,
3984 meson.add_install_script(meson_make_symlink,
3985 'systemd-mount', bindir / 'systemd-umount')
3987 public_programs += executable(
3990 include_directories : includes,
3991 link_with : [libshared],
3992 dependencies : [userspace,
3994 install_rpath : rootpkglibdir,
3997 public_programs += executable(
3998 'systemd-stdio-bridge',
3999 'src/stdio-bridge/stdio-bridge.c',
4000 include_directories : includes,
4001 link_with : [libshared],
4002 dependencies : [userspace,
4004 install_rpath : rootpkglibdir,
4007 public_programs += executable(
4010 include_directories : includes,
4011 link_with : [libshared],
4012 dependencies : [userspace,
4014 install_rpath : rootpkglibdir,
4020 'src/sysusers/sysusers.c',
4021 include_directories : includes,
4022 link_with : [libshared],
4023 dependencies : [userspace,
4025 install_rpath : rootpkglibdir,
4027 install_dir : rootbindir)
4028 public_programs += exe
4030 if want_tests != 'false'
4031 test('test-sysusers',
4033 # https://github.com/mesonbuild/meson/issues/2681
4034 args : exe.full_path())
4038 'systemd-sysusers.standalone',
4039 'src/sysusers/sysusers.c',
4040 include_directories : includes,
4041 c_args : '-DSTANDALONE',
4042 link_with : [libshared_static,
4046 dependencies : [userspace,
4048 build_by_default: have_standalone_binaries,
4049 install : have_standalone_binaries,
4050 install_dir : rootbindir)
4051 if have_standalone_binaries
4052 public_programs += exe
4054 if want_tests != 'false'
4055 test('test-sysusers.standalone',
4057 # https://github.com/mesonbuild/meson/issues/2681
4058 args : exe.full_path())
4063 if conf.get('ENABLE_TMPFILES') == 1
4066 systemd_tmpfiles_sources,
4067 include_directories : includes,
4068 link_with : [libshared],
4069 dependencies : [libacl,
4072 install_rpath : rootpkglibdir,
4074 install_dir : rootbindir)
4075 public_programs += exe
4077 if want_tests != 'false'
4078 test('test-systemd-tmpfiles',
4079 test_systemd_tmpfiles_py,
4080 # https://github.com/mesonbuild/meson/issues/2681
4081 args : exe.full_path())
4085 'systemd-tmpfiles.standalone',
4086 systemd_tmpfiles_sources,
4087 include_directories : includes,
4088 c_args : '-DSTANDALONE',
4089 link_with : [libshared_static,
4093 dependencies : [libacl,
4096 build_by_default: have_standalone_binaries,
4097 install : have_standalone_binaries,
4098 install_dir : rootbindir)
4099 if have_standalone_binaries
4100 public_programs += exe
4102 if want_tests != 'false'
4103 test('test-systemd-tmpfiles.standalone',
4104 test_systemd_tmpfiles_py,
4105 # https://github.com/mesonbuild/meson/issues/2681
4106 args : exe.full_path())
4111 if conf.get('ENABLE_HWDB') == 1
4112 systemd_hwdb = executable(
4115 include_directories : includes,
4116 link_with : udev_link_with,
4117 dependencies : [userspace,
4119 install_rpath : udev_rpath,
4121 install_dir : rootbindir)
4122 public_programs += systemd_hwdb
4124 if want_tests != 'false'
4128 args : [systemd_hwdb.full_path()],
4133 if conf.get('ENABLE_QUOTACHECK') == 1
4135 'systemd-quotacheck',
4136 'src/quotacheck/quotacheck.c',
4137 include_directories : includes,
4138 link_with : [libshared],
4139 dependencies : userspace,
4140 install_rpath : rootpkglibdir,
4142 install_dir : rootlibexecdir)
4145 public_programs += executable(
4146 'systemd-socket-proxyd',
4147 'src/socket-proxy/socket-proxyd.c',
4148 include_directories : includes,
4149 link_with : [libshared],
4150 dependencies : [threads,
4153 install_rpath : rootpkglibdir,
4155 install_dir : rootlibexecdir)
4157 udevadm = executable(
4160 include_directories : includes,
4161 link_with : [libudevd_core],
4162 dependencies : [libacl,
4169 install_rpath : udev_rpath,
4171 install_dir : rootbindir)
4172 public_programs += udevadm
4174 if want_tests != 'false'
4175 test('udev-rules-check',
4178 args : ['verify', '--resolve-names=never', all_rules])
4181 if conf.get('ENABLE_REPART') == 1
4184 systemd_repart_sources,
4185 include_directories : includes,
4186 link_with : [libshared,
4188 dependencies : [libblkid,
4194 install_rpath : rootpkglibdir,
4196 install_dir : rootbindir)
4197 public_programs += exe
4200 'systemd-repart.standalone',
4201 systemd_repart_sources,
4202 include_directories : includes,
4203 c_args : '-DSTANDALONE',
4204 link_with : [libshared_static,
4209 dependencies : [libblkid,
4215 build_by_default: have_standalone_binaries,
4216 install_rpath : rootpkglibdir,
4217 install : have_standalone_binaries,
4218 install_dir : rootbindir)
4219 if have_standalone_binaries
4220 public_programs += exe
4226 systemd_shutdown_sources,
4227 include_directories : includes,
4228 link_with : [libshared],
4229 dependencies : [libmount,
4232 install_rpath : rootpkglibdir,
4234 install_dir : rootlibexecdir)
4237 'systemd-shutdown.standalone',
4238 systemd_shutdown_sources,
4239 include_directories : includes,
4240 c_args : '-DSTANDALONE',
4241 link_with : [libshared_static,
4244 dependencies : [libmount,
4247 build_by_default: have_standalone_binaries,
4248 install_rpath : rootpkglibdir,
4249 install : have_standalone_binaries,
4250 install_dir : rootlibexecdir)
4251 if have_standalone_binaries
4252 public_programs += exe
4256 'systemd-update-done',
4257 'src/update-done/update-done.c',
4258 include_directories : includes,
4259 link_with : [libshared],
4260 dependencies : [userspace,
4262 install_rpath : rootpkglibdir,
4264 install_dir : rootlibexecdir)
4267 'systemd-update-utmp',
4268 'src/update-utmp/update-utmp.c',
4269 include_directories : includes,
4270 link_with : [libshared],
4271 dependencies : [libaudit,
4274 install_rpath : rootpkglibdir,
4275 install : (conf.get('ENABLE_UTMP') == 1),
4276 install_dir : rootlibexecdir)
4278 if conf.get('HAVE_KMOD') == 1
4280 'systemd-modules-load',
4281 'src/modules-load/modules-load.c',
4282 include_directories : includes,
4283 link_with : [libshared],
4284 dependencies : [libkmod,
4287 install_rpath : rootpkglibdir,
4289 install_dir : rootlibexecdir)
4291 meson.add_install_script('sh', '-c',
4292 mkdir_p.format(modulesloaddir))
4293 if install_sysconfdir
4294 meson.add_install_script('sh', '-c',
4295 mkdir_p.format(sysconfdir / 'modules-load.d'))
4299 public_programs += executable(
4301 systemd_nspawn_sources,
4302 include_directories : includes,
4303 link_with : [libnspawn_core,
4305 dependencies : [libblkid,
4309 install_rpath : rootpkglibdir,
4312 if conf.get('ENABLE_NETWORKD') == 1
4313 dbus_programs += executable(
4315 systemd_networkd_sources,
4316 include_directories : network_includes,
4317 link_with : [libnetworkd_core,
4319 networkd_link_with],
4320 dependencies : [threads,
4323 install_rpath : rootpkglibdir,
4325 install_dir : rootlibexecdir)
4327 public_programs += executable(
4328 'systemd-networkd-wait-online',
4329 systemd_networkd_wait_online_sources,
4330 include_directories : includes,
4331 link_with : [networkd_link_with],
4332 dependencies : [userspace,
4334 install_rpath : rootpkglibdir,
4336 install_dir : rootlibexecdir)
4338 public_programs += executable(
4341 include_directories : libsystemd_network_includes,
4342 link_with : [libsystemd_network,
4343 networkd_link_with],
4344 dependencies : [userspace,
4346 install_rpath : rootpkglibdir,
4348 install_dir : rootbindir)
4352 'systemd-network-generator',
4353 network_generator_sources,
4354 include_directories : includes,
4355 link_with : [networkd_link_with],
4356 dependencies : [userspace,
4358 install_rpath : rootpkglibdir,
4360 install_dir : rootlibexecdir)
4362 if want_tests != 'false'
4363 test('test-network-generator-conversion',
4364 test_network_generator_conversion_sh,
4365 # https://github.com/mesonbuild/meson/issues/2681
4366 args : exe.full_path(),
4371 'systemd-sulogin-shell',
4372 'src/sulogin-shell/sulogin-shell.c',
4373 include_directories : includes,
4374 link_with : [libshared],
4375 dependencies : [userspace,
4377 install_rpath : rootpkglibdir,
4379 install_dir : rootlibexecdir)
4381 kernel_install = executable(
4383 'src/kernel-install/kernel-install.c',
4384 include_directories : includes,
4385 link_with : [libshared],
4386 dependencies : [userspace,
4388 install_rpath : rootpkglibdir,
4389 install : want_kernel_install,
4390 install_dir : bindir)
4391 public_programs += kernel_install
4393 ukify = custom_target(
4395 input : 'src/ukify/ukify.py',
4397 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
4398 install : want_ukify,
4399 install_mode : 'rwxr-xr-x',
4400 install_dir : rootlibexecdir)
4402 public_programs += ukify
4405 if want_tests != 'false' and want_kernel_install
4406 args = [kernel_install.full_path(), loaderentry_install.full_path(), uki_copy_install]
4407 deps = [kernel_install, loaderentry_install]
4408 if want_ukify and boot_stubs.length() > 0
4409 args += [ukify.full_path(), ukify_install.full_path(), boot_stubs[0]]
4410 deps += [ukify, ukify_install, boot_stubs[0]]
4413 test('test-kernel-install',
4414 test_kernel_install_sh,
4420 ############################################################
4422 runtest_env = custom_target(
4423 'systemd-runtest.env',
4424 output : 'systemd-runtest.env',
4425 command : [sh, '-c',
4426 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
4427 project_source_root / 'test',
4428 project_build_root / 'catalog')],
4430 build_by_default : true)
4432 test_cflags = ['-DTEST_CODE=1']
4433 # We intentionally do not do inline initializations with definitions for a
4434 # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
4435 # use the variable unexpectedly. This triggers a lot of maybe-uninitialized
4436 # false positives when the combination of -O2 and -flto is used. Suppress them.
4437 if '-O2' in c_args and '-flto=auto' in c_args
4438 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
4441 foreach test : simple_tests
4442 tests += { 'sources' : [test] }
4446 foreach test : tests
4447 sources = test.get('sources')
4448 condition = test.get('condition', '')
4449 type = test.get('type', '')
4450 base = test.get('base', {})
4452 base.get('dependencies', []),
4453 test.get('dependencies', []),
4457 # FIXME: Use fs.stem() with meson >= 0.54.0
4458 name = '@0@'.format(sources[0]).split('/')[-1]
4459 if not name.endswith('.cc')
4462 name = name.split('.')[0]
4464 suite = fs.name(fs.parent('@0@'.format(sources[0])))
4465 # FIXME: Use str.replace() with meson >= 0.58.0
4466 suite = suite.split('sd-')[-1]
4468 if condition != '' and conf.get(condition) == 0
4469 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
4476 include_directories : [base.get('includes', []), test.get('includes', includes)],
4477 link_with : [base.get('link_with', []), test.get('link_with', libshared)],
4478 dependencies : deps,
4479 c_args : [test_cflags, test.get('c_args', [])],
4480 build_by_default : want_tests != 'false',
4481 install_rpath : rootpkglibdir,
4482 install : install_tests,
4483 install_dir : unittestsdir / type,
4484 link_depends : runtest_env)
4487 message('@0@ is a manual test'.format(name))
4488 elif type == 'unsafe' and want_tests != 'unsafe'
4489 message('@0@ is an unsafe test'.format(name))
4490 elif want_tests != 'false'
4493 timeout : test.get('timeout', 30),
4495 is_parallel : test.get('parallel', true))
4498 TESTS += { name : exe }
4502 'test-libsystemd-sym',
4503 test_libsystemd_sym_c,
4504 include_directories : includes,
4505 link_with : [libsystemd],
4506 dependencies : userspace,
4507 build_by_default : want_tests != 'false',
4508 install : install_tests,
4509 install_dir : unittestsdir)
4510 if want_tests != 'false'
4511 test('test-libsystemd-sym', exe)
4515 'test-libsystemd-static-sym',
4516 test_libsystemd_sym_c,
4517 include_directories : includes,
4518 link_with : [install_libsystemd_static],
4520 # threads is already included in dependencies on the library,
4521 # but does not seem to get propagated. Add here as a work-around.
4525 build_by_default : want_tests != 'false' and static_libsystemd_pic,
4526 install : install_tests and static_libsystemd_pic,
4527 install_dir : unittestsdir)
4528 if want_tests != 'false' and static_libsystemd_pic
4529 test('test-libsystemd-static-sym', exe)
4535 include_directories : libudev_includes,
4536 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
4537 link_with : [libudev],
4538 dependencies : userspace,
4539 build_by_default : want_tests != 'false',
4540 install : install_tests,
4541 install_dir : unittestsdir)
4542 if want_tests != 'false'
4543 test('test-libudev-sym', exe)
4547 'test-libudev-static-sym',
4549 include_directories : libudev_includes,
4550 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
4551 link_with : [install_libudev_static],
4552 dependencies : userspace,
4553 build_by_default : want_tests != 'false' and static_libudev_pic,
4554 install : install_tests and static_libudev_pic,
4555 install_dir : unittestsdir)
4556 if want_tests != 'false' and static_libudev_pic
4557 test('test-libudev-static-sym', exe)
4560 if want_tests != 'false'
4561 udev_rule_runner = TESTS['udev-rule-runner'].full_path()
4566 env : ['UDEV_RULE_RUNNER=@0@'.format(udev_rule_runner)],
4570 ############################################################
4572 foreach fuzzer : simple_fuzzers
4573 fuzzers += { 'sources' : [fuzzer] }
4578 foreach fuzzer : fuzzers
4579 sources = fuzzer.get('sources')
4580 base = fuzzer.get('base', {})
4581 dependencies = [base.get('dependencies', []), fuzzer.get('dependencies', [])]
4585 dependencies += fuzzing_engine
4587 if fuzzing_engine.found()
4588 dependencies += fuzzing_engine
4590 link_args += ['-fsanitize=fuzzer']
4593 sources += files('src/fuzz/fuzz-main.c')
4595 sources += fuzz_generated_directives
4597 # FIXME: Use fs.stem() with meson >= 0.54.0
4598 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
4603 include_directories : [
4604 base.get('includes', []),
4605 fuzzer.get('includes', includes),
4606 include_directories('src/fuzz'),
4608 link_with : [base.get('link_with', []), fuzzer.get('link_with', libshared)],
4614 c_args : [test_cflags, fuzzer.get('c_args', [])],
4615 link_args: link_args,
4617 build_by_default : fuzzer_build)
4620 if want_tests != 'false' and name in fuzz_regression_tests
4621 # Run the fuzz regression tests without any sanitizers enabled.
4622 # Additional invocations with sanitizers may be added below.
4623 foreach tuple : fuzz_regression_tests[name]
4626 test('@0@_@1@'.format(name, fuzz_in),
4629 args : [fuzz_dir != '' ? project_source_root / fuzz_dir / name / fuzz_in
4630 : fuzz_generated_in_dir / '@0@_@1@'.format(name, fuzz_in)])
4635 alias_target('fuzzers', fuzzer_exes)
4637 ############################################################
4639 subdir('docs/sysvinit')
4640 subdir('docs/var-log')
4643 subdir('modprobe.d')
4646 subdir('shell-completion/bash')
4647 subdir('shell-completion/zsh')
4649 subdir('sysusers.d')
4650 subdir('tmpfiles.d')
4653 install_subdir('factory/etc',
4654 install_dir : factorydir)
4655 subdir('factory/templates')
4657 if install_sysconfdir
4658 install_data('xorg/50-systemd-user.sh',
4659 install_dir : xinitrcdir)
4661 install_data('LICENSE.GPL2',
4665 'docs/CODING_STYLE.md',
4666 'docs/DISTRO_PORTING.md',
4667 'docs/ENVIRONMENT.md',
4669 'docs/TRANSIENT-SETTINGS.md',
4670 'docs/TRANSLATORS.md',
4671 'docs/UIDS-GIDS.md',
4672 install_dir : docdir)
4674 install_subdir('LICENSES',
4675 install_dir : docdir)
4677 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
4678 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
4680 ############################################################
4682 # Ensure that changes to the docs/ directory do not break the
4683 # basic Github pages build. But only run it in developer mode,
4684 # as it might be fragile due to changes in the tooling, and it is
4685 # not generally useful for users.
4686 jekyll = find_program('jekyll', required : false)
4687 if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
4688 test('github-pages',
4692 '--source', project_source_root / 'docs',
4693 '--destination', project_build_root / '_site'])
4696 ############################################################
4698 check_help = find_program('tools/check-help.sh')
4699 check_version = find_program('tools/check-version.sh')
4701 foreach exec : public_programs
4702 name = exec.full_path().split('/')[-1]
4703 if want_tests != 'false'
4704 test('check-help-' + name,
4707 args : exec.full_path(),
4710 test('check-version-' + name,
4713 args : [exec.full_path(),
4714 meson.project_version()],
4719 # Enable tests for all supported sanitizers
4720 foreach tuple : fuzz_sanitizers
4721 sanitizer = tuple[0]
4724 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
4725 foreach fuzzer, fuzz_ins : fuzz_regression_tests
4726 name = '@0@:@1@'.format(fuzzer, sanitizer)
4727 if want_tests == 'false'
4728 message('Not compiling @0@ because tests is set to false'.format(name))
4732 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
4735 exe = custom_target(
4738 depends : [build] + fuzz_generated_directives,
4739 command : [ln, '-fs',
4740 build.full_path() / fuzzer,
4742 build_by_default : true)
4744 foreach tuple : fuzz_ins
4748 test('@0@_@1@_@2@'.format(fuzzer, fuzz_in, sanitizer),
4751 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
4753 args : [exe.full_path(),
4754 fuzz_dir != '' ? project_source_root / fuzz_dir / fuzzer / fuzz_in
4755 : fuzz_generated_in_dir / '@0@_@1@'.format(fuzzer, fuzz_in)])
4762 ############################################################
4765 all_files = run_command(
4766 env, '-u', 'GIT_WORK_TREE',
4767 git, '--git-dir=@0@/.git'.format(project_source_root),
4768 'ls-files', ':/*.[ch]', ':/*.cc',
4770 if all_files.returncode() == 0
4771 all_files = files(all_files.stdout().split())
4776 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
4779 command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files)
4781 ############################################
4783 if want_tests != 'false' and conf.get('BUILD_MODE_DEVELOPER') == 1
4784 test('check-includes',
4785 files('tools/check-includes.py'),
4787 env : ['PROJECT_SOURCE_ROOT=@0@'.format(project_source_root)])
4791 ####################################################
4793 git_contrib_sh = find_program('tools/git-contrib.sh')
4796 command : [git_contrib_sh])
4798 ####################################################
4800 git_head = run_command(
4801 git, '--git-dir=@0@/.git'.format(project_source_root),
4802 'rev-parse', 'HEAD',
4803 check : false).stdout().strip()
4804 git_head_short = run_command(
4805 git, '--git-dir=@0@/.git'.format(project_source_root),
4806 'rev-parse', '--short=7', 'HEAD',
4807 check : false).stdout().strip()
4811 command : [git, 'archive',
4812 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
4814 '--prefix', 'systemd-@0@/'.format(git_head),
4818 ############################################################
4820 check_api_docs_sh = find_program('tools/check-api-docs.sh')
4823 depends : [man, libsystemd, libudev],
4824 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
4826 alias_target('update-dbus-docs', update_dbus_docs)
4827 alias_target('update-man-rules', update_man_rules)
4829 if not meson.is_cross_build()
4831 'export-dbus-interfaces',
4832 output : fs.name(dbus_interfaces_dir),
4833 install : dbus_interfaces_dir != 'no',
4834 install_dir : fs.parent(dbus_interfaces_dir),
4835 command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs])
4838 ############################################################
4840 alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
4841 check : true).stdout().strip()
4844 'split /usr' : split_usr,
4845 'split bin-sbin' : split_bin,
4846 'prefix directory' : prefixdir,
4847 'rootprefix directory' : rootprefixdir,
4848 'sysconf directory' : sysconfdir,
4849 'include directory' : includedir,
4850 'lib directory' : libdir,
4851 'rootlib directory' : rootlibdir,
4852 'SysV init scripts' : sysvinit_path,
4853 'SysV rc?.d directories' : sysvrcnd_path,
4854 'PAM modules directory' : pamlibdir,
4855 'PAM configuration directory' : pamconfdir,
4856 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
4857 'RPM macros directory' : rpmmacrosdir,
4858 'modprobe.d directory' : modprobedir,
4859 'D-Bus policy directory' : dbuspolicydir,
4860 'D-Bus session directory' : dbussessionservicedir,
4861 'D-Bus system directory' : dbussystemservicedir,
4862 'D-Bus interfaces directory' : dbus_interfaces_dir,
4863 'bash completions directory' : bashcompletiondir,
4864 'zsh completions directory' : zshcompletiondir,
4865 'private shared lib version tag' : shared_lib_tag,
4866 'extra start script' : get_option('rc-local'),
4867 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
4868 get_option('debug-tty')),
4869 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
4870 conf.get('SYSTEM_ALLOC_UID_MIN')),
4871 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
4872 conf.get('SYSTEM_ALLOC_GID_MIN')),
4873 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
4874 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
4875 'static UID/GID allocations' : ' '.join(static_ugids),
4876 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
4877 'render group access mode' : get_option('group-render-mode'),
4878 'certificate root directory' : get_option('certificate-root'),
4879 'support URL' : support_url,
4880 'nobody user name' : nobody_user,
4881 'nobody group name' : nobody_group,
4882 'fallback hostname' : get_option('fallback-hostname'),
4883 'default compression method' : compression,
4884 'default DNSSEC mode' : default_dnssec,
4885 'default DNS-over-TLS mode' : default_dns_over_tls,
4886 'default mDNS mode' : default_mdns,
4887 'default LLMNR mode' : default_llmnr,
4888 'default DNS servers' : dns_servers.split(' '),
4889 'default NTP servers' : ntp_servers.split(' '),
4890 'default cgroup hierarchy' : default_hierarchy,
4891 'default net.naming-scheme value' : default_net_naming_scheme,
4892 'default KillUserProcesses value' : kill_user_processes,
4893 'default locale' : default_locale,
4894 'default nspawn locale' : nspawn_locale,
4895 'default status unit format' : status_unit_format_default,
4896 'default user $PATH' :
4897 default_user_path != '' ? default_user_path : '(same as system services)',
4898 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
4899 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
4902 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
4903 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
4904 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
4925 ['libcryptsetup-plugins'],
4952 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
4981 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
4995 ['legacy-pkla', install_polkit_pkla],
5001 ['man pages', want_man],
5002 ['html pages', want_html],
5003 ['man page indices', want_man and have_lxml],
5005 ['compat-mutable-uid-boundaries'],
5008 ['adm group', get_option('adm-group')],
5009 ['wheel group', get_option('wheel-group')],
5012 ['debug mmap cache'],
5014 ['trace logging', conf.get('LOG_TRACE') == 1],
5015 ['slow tests', slow_tests],
5016 ['fuzz tests', fuzz_tests],
5017 ['install tests', install_tests],
5018 ['link-udev-shared', get_option('link-udev-shared')],
5019 ['link-systemctl-shared', get_option('link-systemctl-shared')],
5020 ['link-networkd-shared', get_option('link-networkd-shared')],
5021 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
5022 ['link-journalctl-shared', get_option('link-journalctl-shared')],
5023 ['link-boot-shared', get_option('link-boot-shared')],
5024 ['link-portabled-shared', get_option('link-portabled-shared')],
5025 ['first-boot-full-preset'],
5027 ['standalone-binaries', get_option('standalone-binaries')],
5028 ['coverage', get_option('b_coverage')],
5031 if tuple.length() >= 2
5034 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
5035 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
5036 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
5045 if static_libsystemd == 'false'
5046 missing += 'static-libsystemd'
5048 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
5051 if static_libudev == 'false'
5052 missing += 'static-libudev'
5054 found += 'static-libudev(@0@)'.format(static_libudev)
5057 if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
5058 found += 'cryptolib(openssl)'
5059 elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
5060 found += 'cryptolib(gcrypt)'
5062 missing += 'cryptolib'
5065 if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
5066 found += 'DNS-over-TLS(gnutls)'
5067 elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
5068 found += 'DNS-over-TLS(openssl)'
5070 missing += 'DNS-over-TLS'
5074 'enabled' : ', '.join(found),
5075 'disabled' : ', '.join(missing)},
5076 section : 'Features')
5078 if rootprefixdir != rootprefix_default
5080 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
5081 'systemd used fixed names for unit file directories and other paths, so anything\n' +
5082 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))