1 # SPDX-License-Identifier: LGPL-2.1-or-later
3 project('systemd', 'c',
13 meson_version : '>= 0.60.0',
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', native : false, 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', 1)
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_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
537 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.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.full_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)
1057 #####################################################################
1059 threads = dependency('threads')
1060 librt = cc.find_library('rt')
1061 libm = cc.find_library('m')
1062 libdl = cc.find_library('dl')
1063 libcrypt = cc.find_library('crypt')
1065 # On some architectures, libatomic is required. But on some installations,
1066 # it is found, but actual linking fails. So let's try to use it opportunistically.
1067 # If it is installed, but not needed, it will be dropped because of --as-needed.
1068 if cc.links('''int main(int argc, char **argv) { return 0; }''',
1071 libatomic = declare_dependency(link_args : '-latomic')
1076 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
1078 ['crypt_ra', crypt_header],
1079 ['crypt_preferred_method', crypt_header],
1080 ['crypt_gensalt_ra', crypt_header]]
1082 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
1083 dependencies : libcrypt)
1084 conf.set10('HAVE_' + ident[0].to_upper(), have)
1087 libcap = dependency('libcap', required : false)
1088 if not libcap.found()
1089 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
1090 libcap = cc.find_library('cap')
1093 want_bpf_framework = get_option('bpf-framework')
1094 bpf_compiler = get_option('bpf-compiler')
1095 bpf_framework_required = want_bpf_framework == 'true'
1097 libbpf_version_requirement = '>= 0.1.0'
1098 if bpf_compiler == 'gcc'
1099 libbpf_version_requirement = '>= 1.0.0'
1101 libbpf = dependency('libbpf', required : bpf_framework_required, version : libbpf_version_requirement)
1102 conf.set10('HAVE_LIBBPF', libbpf.found())
1104 bpftool_strip_version_requirement = '>= 5.13.0'
1105 if bpf_compiler == 'gcc'
1106 bpftool_strip_version_requirement = '>= 7.0.0'
1109 if want_bpf_framework == 'false' or not libbpf.found() or skip_deps
1110 conf.set10('BPF_FRAMEWORK', false)
1113 clang_supports_bpf = false
1114 bpf_gcc_found = false
1115 bpftool_strip = false
1118 if bpf_compiler == 'clang'
1119 # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
1120 # (like clang-10/llvm-strip-10)
1121 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')
1122 r = find_program('clang', required : bpf_framework_required, version : '>= 10.0.0')
1123 clang_found = r.found()
1125 clang = r.full_path()
1129 clang = cc.cmd_array()
1133 # Check if 'clang -target bpf' is supported.
1134 clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
1136 elif bpf_compiler == 'gcc'
1137 bpf_gcc = find_program('bpf-gcc',
1140 version : '>= 13.1.0')
1141 bpf_gcc_found = bpf_gcc.found()
1144 if clang_supports_bpf or bpf_gcc_found
1145 # Debian installs this in /usr/sbin/ which is not in $PATH.
1146 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1147 # We use 'bpftool gen object' subcommand for bpftool strip, it was added by d80b2fcbe0a023619e0fc73112f2a02c2662f6ab (v5.13).
1148 bpftool_strip_required = bpf_framework_required and bpf_compiler == 'gcc'
1149 bpftool = find_program('bpftool',
1150 '/usr/sbin/bpftool',
1151 required : bpftool_strip_required,
1152 version : bpftool_strip_version_requirement)
1155 bpftool_strip = true
1157 elif bpf_compiler == 'clang'
1158 # We require the 'bpftool gen skeleton' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
1159 bpftool = find_program('bpftool',
1160 '/usr/sbin/bpftool',
1161 required : bpf_framework_required,
1162 version : '>= 5.6.0')
1165 # We use `llvm-strip` as a fallback if `bpftool gen object` strip support is not available.
1166 if not bpftool_strip and bpftool.found() and clang_supports_bpf
1167 if not meson.is_cross_build()
1168 llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
1169 check : true).stdout().strip()
1171 llvm_strip_bin = 'llvm-strip'
1173 llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
1174 deps_found = llvm_strip.found()
1178 # Can build BPF program from source code in restricted C
1179 conf.set10('BPF_FRAMEWORK', deps_found)
1182 libmount = dependency('mount',
1183 version : fuzzer_build ? '>= 0' : '>= 2.30')
1185 want_libfdisk = get_option('fdisk')
1186 if want_libfdisk != 'false' and not skip_deps
1187 libfdisk = dependency('fdisk',
1188 version : '>= 2.32',
1189 required : want_libfdisk == 'true')
1190 have = libfdisk.found()
1195 conf.set10('HAVE_LIBFDISK', have)
1197 want_pwquality = get_option('pwquality')
1198 if want_pwquality != 'false' and not skip_deps
1199 libpwquality = dependency('pwquality',
1200 version : '>= 1.4.1',
1201 required : want_pwquality == 'true')
1202 have = libpwquality.found()
1207 conf.set10('HAVE_PWQUALITY', have)
1209 want_seccomp = get_option('seccomp')
1210 if want_seccomp != 'false' and not skip_deps
1211 libseccomp = dependency('libseccomp',
1212 version : '>= 2.3.1',
1213 required : want_seccomp == 'true')
1214 have = libseccomp.found()
1219 conf.set10('HAVE_SECCOMP', have)
1221 want_selinux = get_option('selinux')
1222 if want_selinux != 'false' and not skip_deps
1223 libselinux = dependency('libselinux',
1224 version : '>= 2.1.9',
1225 required : want_selinux == 'true')
1226 have = libselinux.found()
1231 conf.set10('HAVE_SELINUX', have)
1233 want_apparmor = get_option('apparmor')
1234 if want_apparmor != 'false' and not skip_deps
1235 libapparmor = dependency('libapparmor',
1236 version : '>= 2.13',
1237 required : want_apparmor == 'true')
1238 have = libapparmor.found()
1243 conf.set10('HAVE_APPARMOR', have)
1245 have = get_option('smack') and get_option('smack-run-label') != ''
1246 conf.set10('HAVE_SMACK_RUN_LABEL', have)
1248 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1251 have = get_option('smack') and get_option('smack-default-process-label') != ''
1253 conf.set_quoted('SMACK_DEFAULT_PROCESS_LABEL', get_option('smack-default-process-label'))
1256 want_polkit = get_option('polkit')
1257 install_polkit = false
1258 install_polkit_pkla = false
1259 if want_polkit != 'false' and not skip_deps
1260 install_polkit = true
1262 libpolkit = dependency('polkit-gobject-1',
1264 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1265 message('Old polkit detected, will install pkla files')
1266 install_polkit_pkla = true
1269 conf.set10('ENABLE_POLKIT', install_polkit)
1271 want_acl = get_option('acl')
1272 if want_acl != 'false' and not skip_deps
1273 libacl = cc.find_library('acl', required : want_acl == 'true')
1274 have = libacl.found()
1279 conf.set10('HAVE_ACL', have)
1281 want_audit = get_option('audit')
1282 if want_audit != 'false' and not skip_deps
1283 libaudit = dependency('audit', required : want_audit == 'true')
1284 have = libaudit.found()
1289 conf.set10('HAVE_AUDIT', have)
1291 want_blkid = get_option('blkid')
1292 if want_blkid != 'false' and not skip_deps
1293 libblkid = dependency('blkid', required : want_blkid == 'true')
1294 have = libblkid.found()
1296 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1297 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1302 conf.set10('HAVE_BLKID', have)
1304 want_kmod = get_option('kmod')
1305 if want_kmod != 'false' and not skip_deps
1306 libkmod = dependency('libkmod',
1308 required : want_kmod == 'true')
1309 have = libkmod.found()
1314 conf.set10('HAVE_KMOD', have)
1316 want_xenctrl = get_option('xenctrl')
1317 if want_xenctrl != 'false' and not skip_deps
1318 libxenctrl = dependency('xencontrol',
1320 required : want_xenctrl == 'true')
1321 have = libxenctrl.found()
1326 conf.set10('HAVE_XENCTRL', have)
1328 want_pam = get_option('pam')
1329 if want_pam != 'false' and not skip_deps
1330 libpam = cc.find_library('pam', required : want_pam == 'true')
1331 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1332 have = libpam.found() and libpam_misc.found()
1338 conf.set10('HAVE_PAM', have)
1340 want_microhttpd = get_option('microhttpd')
1341 if want_microhttpd != 'false' and not skip_deps
1342 libmicrohttpd = dependency('libmicrohttpd',
1343 version : '>= 0.9.33',
1344 required : want_microhttpd == 'true')
1345 have = libmicrohttpd.found()
1350 conf.set10('HAVE_MICROHTTPD', have)
1352 want_libcryptsetup = get_option('libcryptsetup')
1353 want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1355 if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1356 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1359 if want_libcryptsetup != 'false' and not skip_deps
1360 libcryptsetup = dependency('libcryptsetup',
1361 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1362 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
1363 have = libcryptsetup.found()
1365 foreach ident : ['crypt_set_metadata_size',
1366 'crypt_activate_by_signed_key',
1368 'crypt_reencrypt_init_by_passphrase',
1370 'crypt_set_data_offset']
1371 have_ident = have and cc.has_function(
1373 prefix : '#include <libcryptsetup.h>',
1374 dependencies : libcryptsetup)
1375 conf.set10('HAVE_' + ident.to_upper(), have_ident)
1381 conf.set10('HAVE_LIBCRYPTSETUP', have)
1383 if want_libcryptsetup_plugins != 'false' and not skip_deps
1384 have = (cc.has_function(
1385 'crypt_activate_by_token_pin',
1386 prefix : '#include <libcryptsetup.h>',
1387 dependencies : libcryptsetup) and
1389 'crypt_token_external_path',
1390 prefix : '#include <libcryptsetup.h>',
1391 dependencies : libcryptsetup))
1395 conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1397 want_libcurl = get_option('libcurl')
1398 if want_libcurl != 'false' and not skip_deps
1399 libcurl = dependency('libcurl',
1400 version : '>= 7.32.0',
1401 required : want_libcurl == 'true')
1402 have = libcurl.found()
1407 conf.set10('HAVE_LIBCURL', have)
1408 conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
1410 want_libidn = get_option('libidn')
1411 want_libidn2 = get_option('libidn2')
1412 if want_libidn == 'true' and want_libidn2 == 'true'
1413 error('libidn and libidn2 cannot be requested simultaneously')
1416 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1417 libidn = dependency('libidn2',
1418 required : want_libidn2 == 'true')
1419 have = libidn.found()
1424 conf.set10('HAVE_LIBIDN2', have)
1425 if not have and want_libidn != 'false' and not skip_deps
1426 # libidn is used for both libidn and libidn2 objects
1427 libidn = dependency('libidn',
1428 required : want_libidn == 'true')
1429 have = libidn.found()
1433 conf.set10('HAVE_LIBIDN', have)
1435 want_libiptc = get_option('libiptc')
1436 if want_libiptc != 'false' and not skip_deps
1437 libiptc = dependency('libiptc',
1438 required : want_libiptc == 'true')
1439 have = libiptc.found()
1444 conf.set10('HAVE_LIBIPTC', have)
1446 want_qrencode = get_option('qrencode')
1447 if want_qrencode != 'false' and not skip_deps
1448 libqrencode = dependency('libqrencode',
1450 required : want_qrencode == 'true')
1451 have = libqrencode.found()
1456 conf.set10('HAVE_QRENCODE', have)
1458 want_gcrypt = get_option('gcrypt')
1459 if want_gcrypt != 'false' and not skip_deps
1460 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1461 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1462 have = libgcrypt.found() and libgpg_error.found()
1467 # link to neither of the libs if one is not found
1471 conf.set10('HAVE_GCRYPT', have)
1473 want_gnutls = get_option('gnutls')
1474 if want_gnutls != 'false' and not skip_deps
1475 libgnutls = dependency('gnutls',
1476 version : '>= 3.1.4',
1477 required : want_gnutls == 'true')
1478 have = libgnutls.found()
1483 conf.set10('HAVE_GNUTLS', have)
1485 want_openssl = get_option('openssl')
1486 if want_openssl != 'false' and not skip_deps
1487 libopenssl = dependency('openssl',
1488 version : '>= 1.1.0',
1489 required : want_openssl == 'true')
1490 have = libopenssl.found()
1495 conf.set10('HAVE_OPENSSL', have)
1497 want_p11kit = get_option('p11kit')
1498 if want_p11kit != 'false' and not skip_deps
1499 libp11kit = dependency('p11-kit-1',
1500 version : '>= 0.23.3',
1501 required : want_p11kit == 'true')
1502 have = libp11kit.found()
1503 libp11kit_cflags = libp11kit.partial_dependency(includes: true, compile_args: true)
1506 libp11kit_cflags = []
1509 conf.set10('HAVE_P11KIT', have)
1511 want_libfido2 = get_option('libfido2')
1512 if want_libfido2 != 'false' and not skip_deps
1513 if conf.get('HAVE_OPENSSL') == 1
1514 libfido2 = dependency('libfido2',
1515 required : want_libfido2 == 'true')
1516 have = libfido2.found()
1517 elif want_libfido2 == 'true'
1518 error('libfido2=true requires openssl')
1527 conf.set10('HAVE_LIBFIDO2', have)
1529 want_tpm2 = get_option('tpm2')
1530 if want_tpm2 != 'false' and not skip_deps
1531 tpm2 = dependency('tss2-esys tss2-rc tss2-mu tss2-tcti-device',
1532 required : want_tpm2 == 'true')
1534 have_esys3 = tpm2.version().version_compare('>= 3.0.0')
1540 conf.set10('HAVE_TPM2', have)
1541 conf.set10('HAVE_TSS2_ESYS3', have_esys3)
1543 want_elfutils = get_option('elfutils')
1544 if want_elfutils != 'false' and not skip_deps
1545 libdw = dependency('libdw',
1546 required : want_elfutils == 'true')
1547 have = libdw.found()
1549 # New in elfutils 0.177
1550 conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING',
1551 have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw))
1556 conf.set10('HAVE_ELFUTILS', have)
1558 want_zlib = get_option('zlib')
1559 if want_zlib != 'false' and not skip_deps
1560 libz = dependency('zlib',
1561 required : want_zlib == 'true')
1567 conf.set10('HAVE_ZLIB', have)
1569 want_bzip2 = get_option('bzip2')
1570 if want_bzip2 != 'false' and not skip_deps
1571 libbzip2 = cc.find_library('bz2',
1572 required : want_bzip2 == 'true')
1573 have = libbzip2.found()
1578 conf.set10('HAVE_BZIP2', have)
1580 want_xz = get_option('xz')
1581 if want_xz != 'false' and not skip_deps
1582 libxz = dependency('liblzma',
1583 required : want_xz == 'true')
1584 have_xz = libxz.found()
1589 conf.set10('HAVE_XZ', have_xz)
1591 want_lz4 = get_option('lz4')
1592 if want_lz4 != 'false' and not skip_deps
1593 liblz4 = dependency('liblz4',
1594 version : '>= 1.3.0',
1595 required : want_lz4 == 'true')
1596 have_lz4 = liblz4.found()
1601 conf.set10('HAVE_LZ4', have_lz4)
1603 want_zstd = get_option('zstd')
1604 if want_zstd != 'false' and not skip_deps
1605 libzstd = dependency('libzstd',
1606 required : want_zstd == 'true',
1607 version : '>= 1.4.0')
1608 have_zstd = libzstd.found()
1613 conf.set10('HAVE_ZSTD', have_zstd)
1615 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1617 compression = get_option('default-compression')
1618 if compression == 'auto'
1620 compression = 'zstd'
1626 compression = 'none'
1628 elif compression == 'zstd' and not have_zstd
1629 error('default-compression=zstd requires zstd')
1630 elif compression == 'lz4' and not have_lz4
1631 error('default-compression=lz4 requires lz4')
1632 elif compression == 'xz' and not have_xz
1633 error('default-compression=xz requires xz')
1635 conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper()))
1637 want_xkbcommon = get_option('xkbcommon')
1638 if want_xkbcommon != 'false' and not skip_deps
1639 libxkbcommon = dependency('xkbcommon',
1640 version : '>= 0.3.0',
1641 required : want_xkbcommon == 'true')
1642 have = libxkbcommon.found()
1647 conf.set10('HAVE_XKBCOMMON', have)
1649 want_pcre2 = get_option('pcre2')
1650 if want_pcre2 != 'false' and not skip_deps
1651 libpcre2 = dependency('libpcre2-8',
1652 required : want_pcre2 == 'true')
1653 have = libpcre2.found()
1658 conf.set10('HAVE_PCRE2', have)
1660 want_glib = get_option('glib')
1661 if want_glib != 'false' and not skip_deps
1662 libglib = dependency('glib-2.0',
1663 version : '>= 2.22.0',
1664 required : want_glib == 'true')
1665 libgobject = dependency('gobject-2.0',
1666 version : '>= 2.22.0',
1667 required : want_glib == 'true')
1668 libgio = dependency('gio-2.0',
1669 required : want_glib == 'true')
1670 have = libglib.found() and libgobject.found() and libgio.found()
1677 conf.set10('HAVE_GLIB', have)
1679 want_dbus = get_option('dbus')
1680 if want_dbus != 'false' and not skip_deps
1681 libdbus = dependency('dbus-1',
1682 version : '>= 1.3.2',
1683 required : want_dbus == 'true')
1684 have = libdbus.found()
1689 conf.set10('HAVE_DBUS', have)
1691 dbusdatadir = datadir / 'dbus-1'
1692 if conf.get('HAVE_DBUS') == 1
1693 dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
1696 dbuspolicydir = get_option('dbuspolicydir')
1697 if dbuspolicydir == ''
1698 dbuspolicydir = dbusdatadir / 'system.d'
1701 dbussessionservicedir = get_option('dbussessionservicedir')
1702 if dbussessionservicedir == ''
1703 dbussessionservicedir = dbusdatadir / 'services'
1704 if conf.get('HAVE_DBUS') == 1
1705 dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
1709 dbussystemservicedir = get_option('dbussystemservicedir')
1710 if dbussystemservicedir == ''
1711 dbussystemservicedir = dbusdatadir / 'system-services'
1712 if conf.get('HAVE_DBUS') == 1
1713 dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
1717 dbus_interfaces_dir = get_option('dbus-interfaces-dir')
1718 if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
1719 if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
1720 dbus_interfaces_dir = 'no'
1721 warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
1723 dbus_interfaces_dir = dbusdatadir / 'interfaces'
1724 if conf.get('HAVE_DBUS') == 1
1725 dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
1730 # We support one or the other. If gcrypt is available, we assume it's there to
1731 # be used, and use it in preference.
1732 opt = get_option('cryptolib')
1733 if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1734 error('openssl requested as the default cryptolib, but not available')
1736 conf.set10('PREFER_OPENSSL',
1737 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1738 conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1739 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
1740 lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? [libopenssl] : [libgcrypt, libgpg_error]
1742 dns_over_tls = get_option('dns-over-tls')
1743 if dns_over_tls != 'false'
1744 if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1
1745 error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib')
1748 if dns_over_tls == 'gnutls'
1749 have_openssl = false
1751 have_openssl = conf.get('HAVE_OPENSSL') == 1
1752 if dns_over_tls == 'openssl' and not have_openssl
1753 error('DNS-over-TLS support was requested with openssl, but dependencies are not available')
1756 if dns_over_tls == 'openssl' or have_openssl
1759 have_gnutls = conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0')
1760 if dns_over_tls != 'auto' and not have_gnutls
1761 str = dns_over_tls == 'gnutls' ? ' with gnutls' : ''
1762 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1765 have = have_gnutls or have_openssl
1769 have_openssl = false
1771 conf.set10('ENABLE_DNS_OVER_TLS', have)
1772 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1773 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1775 default_dns_over_tls = get_option('default-dns-over-tls')
1777 default_dns_over_tls = 'no'
1779 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1780 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.')
1781 default_dns_over_tls = 'no'
1783 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1784 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1785 conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
1787 default_mdns = get_option('default-mdns')
1788 conf.set('DEFAULT_MDNS_MODE',
1789 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1790 conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
1792 default_llmnr = get_option('default-llmnr')
1793 conf.set('DEFAULT_LLMNR_MODE',
1794 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1795 conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
1797 want_repart = get_option('repart')
1798 if want_repart != 'false'
1799 have = conf.get('HAVE_LIBFDISK') == 1
1800 if want_repart == 'true' and not have
1801 error('repart support was requested, but dependencies are not available')
1806 conf.set10('ENABLE_REPART', have)
1808 default_dnssec = get_option('default-dnssec')
1810 default_dnssec = 'no'
1812 if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0
1813 message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.')
1814 default_dnssec = 'no'
1816 conf.set('DEFAULT_DNSSEC_MODE',
1817 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1818 conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1820 want_sysupdate = get_option('sysupdate')
1821 if want_sysupdate != 'false'
1822 have = (conf.get('HAVE_OPENSSL') == 1 and
1823 conf.get('HAVE_LIBFDISK') == 1)
1824 if want_sysupdate == 'true' and not have
1825 error('sysupdate support was requested, but dependencies are not available')
1830 conf.set10('ENABLE_SYSUPDATE', have)
1832 want_importd = get_option('importd')
1833 if want_importd != 'false'
1834 have = (conf.get('HAVE_LIBCURL') == 1 and
1835 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
1836 conf.get('HAVE_ZLIB') == 1 and
1837 conf.get('HAVE_XZ') == 1)
1838 if want_importd == 'true' and not have
1839 error('importd support was requested, but dependencies are not available')
1844 conf.set10('ENABLE_IMPORTD', have)
1846 want_homed = get_option('homed')
1847 if want_homed != 'false'
1848 have = (conf.get('HAVE_OPENSSL') == 1 and
1849 conf.get('HAVE_LIBFDISK') == 1 and
1850 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1851 if want_homed == 'true' and not have
1852 error('homed support was requested, but dependencies are not available')
1857 conf.set10('ENABLE_HOMED', have)
1859 have = have and conf.get('HAVE_PAM') == 1
1860 conf.set10('ENABLE_PAM_HOME', have)
1862 want_remote = get_option('remote')
1863 if want_remote != 'false'
1864 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1865 conf.get('HAVE_LIBCURL') == 1]
1866 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1867 # it's possible to build one without the other. Complain only if
1868 # support was explicitly requested. The auxiliary files like sysusers
1869 # config should be installed when any of the programs are built.
1870 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1871 error('remote support was requested, but dependencies are not available')
1873 have = have_deps[0] or have_deps[1]
1877 conf.set10('ENABLE_REMOTE', have)
1879 foreach term : ['analyze',
1882 'compat-mutable-uid-boundaries',
1921 have = get_option(term)
1922 name = 'ENABLE_' + term.underscorify().to_upper()
1923 conf.set10(name, have)
1926 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1928 foreach tuple : [['nss-mymachines', 'machined'],
1929 ['nss-resolve', 'resolve']]
1930 want = get_option(tuple[0])
1932 have = get_option(tuple[1])
1933 if want == 'true' and not have
1934 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1939 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1940 conf.set10(name, have)
1944 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1945 'ENABLE_NSS_MYMACHINES',
1946 'ENABLE_NSS_RESOLVE',
1947 'ENABLE_NSS_SYSTEMD']
1948 if conf.get(term) == 1
1952 conf.set10('ENABLE_NSS', enable_nss)
1954 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1956 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1958 ############################################################
1966 ############################################################
1968 pymod = import('python')
1969 python = pymod.find_installation('python3', required : true, modules : ['jinja2'])
1970 python_39 = python.language_version().version_compare('>=3.9')
1972 ############################################################
1974 if conf.get('BPF_FRAMEWORK') == 1
1977 '-Wno-compare-distinct-pointer-types',
1978 '-fno-stack-protector',
1988 '-fno-stack-protector',
1997 # Generate defines that are appropriate to tell the compiler what architecture
1998 # we're compiling for. By default we just map meson's cpu_family to __<cpu_family>__.
1999 # This dictionary contains the exceptions where this doesn't work.
2001 # C.f. https://mesonbuild.com/Reference-tables.html#cpu-families
2002 # and src/basic/missing_syscall_def.h.
2003 cpu_arch_defines = {
2004 'ppc' : ['-D__powerpc__'],
2005 'ppc64' : ['-D__powerpc64__', '-D_CALL_ELF=2'],
2006 'riscv32' : ['-D__riscv', '-D__riscv_xlen=32'],
2007 'riscv64' : ['-D__riscv', '-D__riscv_xlen=64'],
2008 'x86' : ['-D__i386__'],
2010 # For arm, assume hardware fp is available.
2011 'arm' : ['-D__arm__', '-D__ARM_PCS_VFP'],
2014 bpf_arch_flags = cpu_arch_defines.get(host_machine.cpu_family(),
2015 ['-D__@0@__'.format(host_machine.cpu_family())])
2016 if bpf_compiler == 'gcc'
2017 bpf_arch_flags += ['-m' + host_machine.endian() + '-endian']
2020 libbpf_include_dir = libbpf.get_variable(pkgconfig : 'includedir')
2022 bpf_o_unstripped_cmd = []
2023 if bpf_compiler == 'clang'
2024 bpf_o_unstripped_cmd += [
2029 elif bpf_compiler == 'gcc'
2030 bpf_o_unstripped_cmd += [
2037 bpf_o_unstripped_cmd += ['-I.']
2039 if not meson.is_cross_build() and bpf_compiler == 'clang'
2040 target_triplet_cmd = run_command('gcc', '-dumpmachine', check: false)
2041 if target_triplet_cmd.returncode() == 0
2042 target_triplet = target_triplet_cmd.stdout().strip()
2043 bpf_o_unstripped_cmd += [
2045 '/usr/include/@0@'.format(target_triplet)
2050 bpf_o_unstripped_cmd += [
2066 elif bpf_compiler == 'clang'
2084 #####################################################################
2089 'loongarch32' : 'loongarch32',
2090 'loongarch64' : 'loongarch64',
2091 'riscv32' : 'riscv32',
2092 'riscv64' : 'riscv64',
2095 }.get(host_machine.cpu_family(), '')
2097 if get_option('bootloader') != 'false' and efi_arch != ''
2098 conf.set_quoted('EFI_MACHINE_TYPE_NAME', efi_arch)
2099 elif get_option('bootloader') == 'true' and efi_arch == ''
2100 error('EFI not supported for this arch.')
2104 if efi_arch == 'x64' and cc.links('''
2106 int main(int argc, char *argv[]) {
2107 return __builtin_popcount(argc - CHAR_MAX);
2108 }''', args : ['-m32', '-march=i686'], name : '32bit build possible')
2109 efi_arch_alt = 'ia32'
2112 have_pyelftools = pymod.find_installation('python3', required : false, modules : ['elftools']).found()
2113 if get_option('bootloader') == 'true' and (not python_39 or not have_pyelftools)
2114 error('EFI bootloader support requires Python >= 3.9 and pyelftools.')
2118 'ENABLE_BOOTLOADER',
2119 get_option('efi') and
2120 get_option('bootloader') in ['auto', 'true'] and
2126 if get_option('ukify') == 'auto'
2127 want_ukify = python_39 and conf.get('ENABLE_BOOTLOADER') == 1
2128 elif get_option('ukify') == 'true' and (not python_39 or conf.get('ENABLE_BOOTLOADER') != 1)
2129 error('ukify requires Python >= 3.9 and -Dbootloader=true')
2131 want_ukify = get_option('ukify') == 'true'
2133 conf.set10('ENABLE_UKIFY', want_ukify)
2135 ############################################################
2137 elf2efi_lds = project_source_root / 'tools/elf2efi.lds'
2138 elf2efi_py = find_program('tools/elf2efi.py')
2139 export_dbus_interfaces_py = find_program('tools/dbus_exporter.py')
2140 generate_gperfs = find_program('tools/generate-gperfs.py')
2141 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
2142 make_directive_index_py = find_program('tools/make-directive-index.py')
2143 make_man_index_py = find_program('tools/make-man-index.py')
2144 meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
2145 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
2146 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
2147 update_hwdb_sh = find_program('tools/update-hwdb.sh')
2148 update_man_rules_py = find_program('tools/update-man-rules.py')
2149 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
2150 xml_helper_py = find_program('tools/xml_helper.py')
2152 ############################################################
2154 if get_option('b_coverage')
2155 userspace_c_args += ['-include', 'src/basic/coverage.h']
2158 ############################################################
2160 config_h = configure_file(
2161 output : 'config.h',
2162 configuration : conf)
2164 userspace_c_args += ['-include', 'config.h']
2166 jinja2_cmdline = [meson_render_jinja2, config_h, version_h]
2168 userspace = declare_dependency(
2169 compile_args : userspace_c_args,
2170 link_args : userspace_c_ld_args,
2173 man_page_depends = []
2175 ############################################################
2177 # binaries that have --help and are intended for use by humans,
2178 # usually, but not always, installed in /bin.
2179 public_programs = []
2181 # D-Bus introspection XML export
2184 # A list of boot stubs. Required for testing of ukify.
2187 basic_includes = include_directories(
2193 libsystemd_includes = [basic_includes, include_directories(
2194 'src/libsystemd/sd-bus',
2195 'src/libsystemd/sd-device',
2196 'src/libsystemd/sd-event',
2197 'src/libsystemd/sd-hwdb',
2198 'src/libsystemd/sd-id128',
2199 'src/libsystemd/sd-journal',
2200 'src/libsystemd/sd-netlink',
2201 'src/libsystemd/sd-network',
2202 'src/libsystemd/sd-resolve')]
2204 includes = [libsystemd_includes, include_directories('src/shared')]
2208 subdir('src/fundamental')
2210 subdir('src/libsystemd')
2211 subdir('src/shared')
2213 subdir('src/libudev')
2214 subdir('src/cryptsetup/cryptsetup-tokens')
2216 libsystemd = shared_library(
2218 version : libsystemd_version,
2219 include_directories : libsystemd_includes,
2220 link_args : ['-shared',
2221 '-Wl,--version-script=' + libsystemd_sym_path],
2222 link_with : [libbasic,
2225 link_whole : [libsystemd_static],
2226 dependencies : [librt,
2229 link_depends : libsystemd_sym,
2231 install_tag: 'libsystemd',
2232 install_dir : rootlibdir)
2234 alias_target('libsystemd', libsystemd)
2236 install_libsystemd_static = static_library(
2240 basic_gcrypt_sources,
2241 basic_compress_sources,
2242 fundamental_sources,
2243 include_directories : libsystemd_includes,
2244 build_by_default : static_libsystemd != 'false',
2245 install : static_libsystemd != 'false',
2246 install_tag: 'libsystemd',
2247 install_dir : rootlibdir,
2248 pic : static_libsystemd_pic,
2249 dependencies : [libblkid,
2262 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
2264 libudev = shared_library(
2266 version : libudev_version,
2267 include_directories : includes,
2268 link_args : ['-shared',
2269 '-Wl,--version-script=' + libudev_sym_path],
2270 link_with : [libsystemd_static, libshared_static],
2271 link_whole : libudev_basic,
2272 dependencies : [threads,
2274 link_depends : libudev_sym,
2276 install_tag: 'libudev',
2277 install_dir : rootlibdir)
2279 alias_target('libudev', libudev)
2281 install_libudev_static = static_library(
2284 fundamental_sources,
2288 include_directories : includes,
2289 build_by_default : static_libudev != 'false',
2290 install : static_libudev != 'false',
2291 install_tag: 'libudev',
2292 install_dir : rootlibdir,
2293 link_depends : libudev_sym,
2294 dependencies : [libmount,
2298 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
2299 pic : static_libudev_pic)
2301 if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
2302 if conf.get('HAVE_TPM2') == 1
2304 'cryptsetup-token-systemd-tpm2',
2305 cryptsetup_token_systemd_tpm2_sources,
2306 include_directories : includes,
2307 link_args : ['-shared',
2308 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2309 link_with : [lib_cryptsetup_token_common,
2311 dependencies : [libcryptsetup,
2315 link_depends : cryptsetup_token_sym,
2316 install_rpath : rootpkglibdir,
2318 install_dir : libcryptsetup_plugins_dir)
2321 if conf.get('HAVE_LIBFIDO2') == 1
2323 'cryptsetup-token-systemd-fido2',
2324 cryptsetup_token_systemd_fido2_sources,
2325 include_directories : includes,
2326 link_args : ['-shared',
2327 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2328 link_with : [lib_cryptsetup_token_common,
2330 dependencies : [libcryptsetup,
2334 link_depends : cryptsetup_token_sym,
2335 install_rpath : rootpkglibdir,
2337 install_dir : libcryptsetup_plugins_dir)
2340 if conf.get('HAVE_P11KIT') == 1
2342 'cryptsetup-token-systemd-pkcs11',
2343 cryptsetup_token_systemd_pkcs11_sources,
2344 include_directories : includes,
2345 link_args : ['-shared',
2346 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2347 link_with : [lib_cryptsetup_token_common,
2349 dependencies : [libcryptsetup,
2353 link_depends : cryptsetup_token_sym,
2354 install_rpath : rootpkglibdir,
2356 install_dir : libcryptsetup_plugins_dir)
2360 ############################################################
2362 # systemd-analyze requires 'libcore'
2364 # systemd-journal-remote requires 'libjournal_core'
2365 subdir('src/journal')
2366 # systemd-networkd requires 'libsystemd_network'
2367 subdir('src/libsystemd-network')
2369 subdir('src/analyze')
2371 subdir('src/boot/efi')
2372 subdir('src/busctl')
2373 subdir('src/coredump')
2374 subdir('src/cryptenroll')
2375 subdir('src/cryptsetup')
2377 subdir('src/hostname')
2378 subdir('src/import')
2379 subdir('src/journal-remote')
2380 subdir('src/kernel-install')
2381 subdir('src/locale')
2383 subdir('src/machine')
2384 subdir('src/network')
2385 subdir('src/nspawn')
2387 subdir('src/partition')
2388 subdir('src/portable')
2389 subdir('src/pstore')
2390 subdir('src/resolve')
2392 subdir('src/shutdown')
2393 subdir('src/sysext')
2394 subdir('src/systemctl')
2395 subdir('src/sysupdate')
2396 subdir('src/timedate')
2397 subdir('src/timesync')
2398 subdir('src/tmpfiles')
2399 subdir('src/userdb')
2400 subdir('src/xdg-autostart-generator')
2402 subdir('src/systemd')
2408 subdir('src/ukify/test') # needs to be last for test_env variable
2410 alias_target('devel', libsystemd_pc, libudev_pc, systemd_pc, udev_pc)
2412 ############################################################
2414 # only static linking apart from libdl, to make sure that the
2415 # module is linked to all libraries that it uses.
2416 test_dlopen = executable(
2419 include_directories : includes,
2420 link_with : [libbasic],
2421 dependencies : [libdl,
2423 build_by_default : want_tests != 'false')
2425 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
2426 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
2427 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
2428 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
2430 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
2434 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
2435 version_script_arg = project_source_root / sym
2437 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
2438 if tuple.length() > 2
2439 foreach s : tuple[2]
2440 sources += ['src/nss-@0@/@1@'.format(module, s)]
2444 incs = tuple.length() > 3 ? tuple[3] : includes
2446 nss = shared_library(
2450 include_directories : incs,
2451 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
2452 link_args : ['-Wl,-z,nodelete',
2454 '-Wl,--version-script=' + version_script_arg],
2455 link_with : [libsystemd_static,
2458 dependencies : [librt,
2463 install_tag : 'nss',
2464 install_dir : rootlibdir)
2466 # We cannot use shared_module because it does not support version suffix.
2467 # Unfortunately shared_library insists on creating the symlink…
2468 meson.add_install_script('sh', '-c',
2469 'rm $DESTDIR@0@/libnss_@1@.so'
2470 .format(rootlibdir, module),
2474 if want_tests != 'false'
2475 test('dlopen-nss_' + module,
2477 # path to dlopen must include a slash
2478 args : nss.full_path(),
2484 ############################################################
2489 include_directories : includes,
2490 link_with : [libcore,
2492 dependencies : [libseccomp,
2495 install_rpath : rootpkglibdir,
2497 install_dir : rootlibexecdir)
2498 dbus_programs += exe
2499 public_programs += exe
2501 meson.add_install_script(meson_make_symlink,
2502 rootlibexecdir / 'systemd',
2503 rootsbindir / 'init')
2507 systemd_analyze_sources,
2508 include_directories : core_includes,
2509 link_with : [libcore,
2511 dependencies : [libseccomp,
2514 install_rpath : rootpkglibdir,
2515 install : conf.get('ENABLE_ANALYZE') == 1)
2516 if conf.get('ENABLE_ANALYZE') == 1
2517 public_programs += exe
2520 if want_tests != 'false'
2521 test('test-compare-versions',
2522 test_compare_versions_sh,
2523 args : exe.full_path())
2528 systemd_journald_sources,
2529 include_directories : includes,
2530 link_with : [libjournal_core,
2532 dependencies : [liblz4,
2539 install_rpath : rootpkglibdir,
2541 install_dir : rootlibexecdir)
2543 public_programs += executable(
2545 systemd_cat_sources,
2546 include_directories : includes,
2547 link_with : [libjournal_core,
2549 dependencies : [threads,
2552 install_rpath : rootpkglibdir,
2555 if get_option('link-journalctl-shared')
2556 journalctl_link_with = [libshared]
2558 journalctl_link_with = [libsystemd_static,
2563 public_programs += executable(
2566 include_directories : includes,
2567 link_with : [journalctl_link_with],
2568 dependencies : [libdl,
2575 install_rpath : rootpkglibdir,
2577 install_dir : rootbindir)
2580 'systemd-getty-generator',
2581 'src/getty-generator/getty-generator.c',
2582 include_directories : includes,
2583 link_with : [libshared],
2584 dependencies : userspace,
2585 install_rpath : rootpkglibdir,
2587 install_dir : systemgeneratordir)
2590 'systemd-debug-generator',
2591 'src/debug-generator/debug-generator.c',
2592 include_directories : includes,
2593 link_with : [libshared],
2594 dependencies : userspace,
2595 install_rpath : rootpkglibdir,
2597 install_dir : systemgeneratordir)
2600 'systemd-run-generator',
2601 'src/run-generator/run-generator.c',
2602 include_directories : includes,
2603 link_with : [libshared],
2604 dependencies : userspace,
2605 install_rpath : rootpkglibdir,
2607 install_dir : systemgeneratordir)
2610 'systemd-fstab-generator',
2611 'src/fstab-generator/fstab-generator.c',
2612 include_directories : includes,
2613 link_with : [libshared],
2614 dependencies : userspace,
2615 install_rpath : rootpkglibdir,
2617 install_dir : systemgeneratordir)
2619 meson.add_install_script(meson_make_symlink,
2620 systemgeneratordir / 'systemd-fstab-generator',
2621 rootlibexecdir / 'systemd-sysroot-fstab-check')
2623 if want_tests != 'false'
2624 test('test-fstab-generator',
2625 test_fstab_generator_sh,
2626 # https://github.com/mesonbuild/meson/issues/2681
2627 args : exe.full_path(),
2631 if conf.get('ENABLE_ENVIRONMENT_D') == 1
2633 '30-systemd-environment-d-generator',
2634 'src/environment-d-generator/environment-d-generator.c',
2635 include_directories : includes,
2636 link_with : [libshared],
2637 dependencies : userspace,
2638 install_rpath : rootpkglibdir,
2640 install_dir : userenvgeneratordir)
2642 meson.add_install_script(meson_make_symlink,
2643 sysconfdir / 'environment',
2644 environmentdir / '99-environment.conf')
2647 if conf.get('ENABLE_HIBERNATE') == 1
2649 'systemd-hibernate-resume-generator',
2650 'src/hibernate-resume/hibernate-resume-generator.c',
2651 include_directories : includes,
2652 link_with : [libshared],
2653 dependencies : userspace,
2654 install_rpath : rootpkglibdir,
2656 install_dir : systemgeneratordir)
2659 'systemd-hibernate-resume',
2660 'src/hibernate-resume/hibernate-resume.c',
2661 include_directories : includes,
2662 link_with : [libshared],
2663 dependencies : userspace,
2664 install_rpath : rootpkglibdir,
2666 install_dir : rootlibexecdir)
2669 if conf.get('HAVE_BLKID') == 1
2671 'systemd-gpt-auto-generator',
2672 'src/gpt-auto-generator/gpt-auto-generator.c',
2673 include_directories : includes,
2674 link_with : [libshared],
2675 dependencies : [libblkid,
2677 install_rpath : rootpkglibdir,
2679 install_dir : systemgeneratordir)
2681 public_programs += executable(
2683 'src/dissect/dissect.c',
2684 include_directories : includes,
2685 link_with : [libshared],
2686 dependencies : [userspace,
2688 install_rpath : rootpkglibdir,
2691 meson.add_install_script(meson_make_symlink,
2692 bindir / 'systemd-dissect',
2693 rootsbindir / 'mount.ddi')
2696 if conf.get('ENABLE_RESOLVE') == 1
2697 dbus_programs += executable(
2699 systemd_resolved_sources,
2700 include_directories : resolve_includes,
2701 link_with : [libshared,
2703 libsystemd_resolve_core],
2704 dependencies : [systemd_resolved_dependencies,
2706 install_rpath : rootpkglibdir,
2708 install_dir : rootlibexecdir)
2710 public_programs += executable(
2713 include_directories : includes,
2714 link_with : [libshared,
2716 libsystemd_resolve_core],
2717 dependencies : [lib_openssl_or_gcrypt,
2723 install_rpath : rootpkglibdir,
2726 meson.add_install_script(meson_make_symlink,
2727 bindir / 'resolvectl',
2728 rootsbindir / 'resolvconf')
2730 meson.add_install_script(meson_make_symlink,
2731 bindir / 'resolvectl',
2732 bindir / 'systemd-resolve')
2735 if conf.get('ENABLE_LOGIND') == 1
2736 dbus_programs += executable(
2738 systemd_logind_sources,
2739 include_directories : includes,
2740 link_with : [liblogind_core,
2742 dependencies : [libacl,
2746 install_rpath : rootpkglibdir,
2748 install_dir : rootlibexecdir)
2750 public_programs += executable(
2753 include_directories : includes,
2754 link_with : [libshared],
2755 dependencies : [liblz4,
2761 install_rpath : rootpkglibdir,
2763 install_dir : rootbindir)
2765 public_programs += executable(
2767 'src/login/inhibit.c',
2768 include_directories : includes,
2769 link_with : [libshared],
2770 dependencies : [userspace,
2772 install_rpath : rootpkglibdir,
2774 install_dir : rootbindir)
2776 if conf.get('HAVE_PAM') == 1
2777 version_script_arg = project_source_root / pam_systemd_sym
2778 pam_systemd = shared_library(
2782 include_directories : includes,
2783 link_args : ['-shared',
2784 '-Wl,--version-script=' + version_script_arg],
2785 link_with : [libsystemd_static,
2787 dependencies : [libpam_misc,
2792 link_depends : pam_systemd_sym,
2794 install_tag : 'pam',
2795 install_dir : pamlibdir)
2797 if want_tests != 'false'
2798 test('dlopen-pam_systemd',
2800 # path to dlopen must include a slash
2801 args : pam_systemd.full_path(),
2802 depends : pam_systemd)
2807 'systemd-user-runtime-dir',
2808 user_runtime_dir_sources,
2809 include_directories : includes,
2810 link_with : [libshared],
2811 dependencies : userspace,
2812 install_rpath : rootpkglibdir,
2814 install_dir : rootlibexecdir)
2817 if conf.get('HAVE_PAM') == 1
2819 'systemd-user-sessions',
2820 'src/user-sessions/user-sessions.c',
2821 include_directories : includes,
2822 link_with : [libshared],
2823 dependencies : userspace,
2824 install_rpath : rootpkglibdir,
2826 install_dir : rootlibexecdir)
2829 if conf.get('HAVE_BLKID') == 1 and conf.get('ENABLE_BOOTLOADER') == 1
2830 if get_option('link-boot-shared')
2831 boot_link_with = [libshared]
2833 boot_link_with = [libsystemd_static, libshared_static]
2839 include_directories : includes,
2840 link_with : [boot_link_with],
2841 dependencies : [libblkid,
2844 install_rpath : rootpkglibdir,
2846 public_programs += exe
2848 if want_tests != 'false'
2849 test('test-bootctl-json',
2850 test_bootctl_json_sh,
2851 args : exe.full_path(),
2855 public_programs += executable(
2856 'systemd-bless-boot',
2857 'src/boot/bless-boot.c',
2858 include_directories : includes,
2859 link_with : [boot_link_with],
2860 dependencies : [libblkid,
2863 install_rpath : rootpkglibdir,
2865 install_dir : rootlibexecdir)
2868 'systemd-bless-boot-generator',
2869 'src/boot/bless-boot-generator.c',
2870 include_directories : includes,
2871 link_with : [boot_link_with],
2872 dependencies : userspace,
2873 install_rpath : rootpkglibdir,
2875 install_dir : systemgeneratordir)
2877 if conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_TPM2') == 1
2880 'src/boot/measure.c',
2881 include_directories : includes,
2882 link_with : [libshared],
2883 dependencies : [libopenssl,
2886 install_rpath : rootpkglibdir,
2888 install_dir : rootlibexecdir)
2891 'src/boot/pcrphase.c',
2892 include_directories : includes,
2893 link_with : [libshared],
2894 dependencies : [libblkid,
2899 install_rpath : rootpkglibdir,
2901 install_dir : rootlibexecdir)
2906 'systemd-boot-check-no-failures',
2907 'src/boot/boot-check-no-failures.c',
2908 include_directories : includes,
2909 link_with : [libshared],
2910 dependencies : [libblkid,
2913 install_rpath : rootpkglibdir,
2915 install_dir : rootlibexecdir)
2917 public_programs += executable(
2918 'systemd-socket-activate',
2919 'src/socket-activate/socket-activate.c',
2920 include_directories : includes,
2921 link_with : [libshared],
2922 dependencies : [threads,
2925 install_rpath : rootpkglibdir,
2928 systemctl = executable(
2931 include_directories : includes,
2932 link_with : systemctl_link_with,
2933 dependencies : [libcap,
2941 install_rpath : rootpkglibdir,
2943 install_dir : rootbindir)
2944 public_programs += systemctl
2946 if conf.get('ENABLE_PORTABLED') == 1
2947 if get_option('link-portabled-shared')
2948 portabled_link_with = [libshared]
2950 portabled_link_with = [libsystemd_static,
2954 dbus_programs += executable(
2955 'systemd-portabled',
2956 systemd_portabled_sources,
2957 include_directories : includes,
2958 link_with : [portabled_link_with],
2959 dependencies : [libselinux,
2963 install_rpath : rootpkglibdir,
2965 install_dir : rootlibexecdir)
2967 public_programs += executable(
2969 'src/portable/portablectl.c',
2970 include_directories : includes,
2971 link_with : [portabled_link_with],
2972 dependencies : [threads,
2975 install_rpath : rootpkglibdir,
2977 install_dir : rootbindir)
2980 if conf.get('ENABLE_SYSEXT') == 1
2981 public_programs += executable(
2983 systemd_sysext_sources,
2984 include_directories : includes,
2985 link_with : [libshared],
2986 dependencies : [userspace,
2988 install_rpath : rootpkglibdir,
2990 install_dir : rootbindir)
2993 if conf.get('ENABLE_USERDB') == 1
2996 systemd_userwork_sources,
2997 include_directories : includes,
2998 link_with : [libshared],
2999 dependencies : [threads,
3002 install_rpath : rootpkglibdir,
3004 install_dir : rootlibexecdir)
3008 systemd_userdbd_sources,
3009 include_directories : includes,
3010 link_with : [libshared],
3011 dependencies : [threads,
3014 install_rpath : rootpkglibdir,
3016 install_dir : rootlibexecdir)
3018 public_programs += executable(
3021 include_directories : includes,
3022 link_with : [libshared],
3023 dependencies : [threads,
3026 install_rpath : rootpkglibdir,
3030 if conf.get('ENABLE_HOMED') == 1
3033 systemd_homework_sources,
3034 include_directories : includes,
3035 link_with : [libshared,
3037 dependencies : [libblkid,
3045 install_rpath : rootpkglibdir,
3047 install_dir : rootlibexecdir)
3049 dbus_programs += executable(
3051 systemd_homed_sources,
3052 include_directories : home_includes,
3053 link_with : [libshared],
3054 dependencies : [libcrypt,
3060 install_rpath : rootpkglibdir,
3062 install_dir : rootlibexecdir)
3064 public_programs += executable(
3067 include_directories : includes,
3068 link_with : [libshared],
3069 dependencies : [libcrypt,
3076 install_rpath : rootpkglibdir,
3079 if conf.get('HAVE_PAM') == 1
3080 version_script_arg = project_source_root / pam_systemd_home_sym
3081 pam_systemd_home = shared_library(
3085 include_directories : includes,
3086 link_args : ['-shared',
3087 '-Wl,--version-script=' + version_script_arg],
3088 link_with : [libsystemd_static,
3090 dependencies : [libcrypt,
3096 link_depends : pam_systemd_home_sym,
3098 install_tag : 'pam',
3099 install_dir : pamlibdir)
3101 if want_tests != 'false'
3102 test('dlopen-pam_systemd_home',
3104 # path to dlopen must include a slash
3105 args : pam_systemd_home.full_path(),
3106 depends : pam_systemd_home)
3111 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
3112 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
3113 meson.add_install_script(meson_make_symlink,
3114 rootbindir / 'systemctl',
3115 rootsbindir / alias)
3118 meson.add_install_script(meson_make_symlink,
3119 rootbindir / 'udevadm',
3120 rootlibexecdir / 'systemd-udevd')
3122 if conf.get('ENABLE_BACKLIGHT') == 1
3124 'systemd-backlight',
3125 'src/backlight/backlight.c',
3126 include_directories : includes,
3127 link_with : [libshared],
3128 dependencies : userspace,
3129 install_rpath : rootpkglibdir,
3131 install_dir : rootlibexecdir)
3134 if conf.get('ENABLE_RFKILL') == 1
3137 'src/rfkill/rfkill.c',
3138 include_directories : includes,
3139 link_with : [libshared],
3140 dependencies : userspace,
3141 install_rpath : rootpkglibdir,
3143 install_dir : rootlibexecdir)
3147 'systemd-system-update-generator',
3148 'src/system-update-generator/system-update-generator.c',
3149 include_directories : includes,
3150 link_with : [libshared],
3151 dependencies : userspace,
3152 install_rpath : rootpkglibdir,
3154 install_dir : systemgeneratordir)
3156 if conf.get('HAVE_LIBCRYPTSETUP') == 1
3158 'systemd-cryptsetup',
3159 systemd_cryptsetup_sources,
3160 include_directories : includes,
3161 link_with : [libshared],
3162 dependencies : [libcryptsetup,
3167 install_rpath : rootpkglibdir,
3169 install_dir : rootlibexecdir)
3172 'systemd-cryptsetup-generator',
3173 'src/cryptsetup/cryptsetup-generator.c',
3174 include_directories : includes,
3175 link_with : [libshared],
3176 dependencies : userspace,
3177 install_rpath : rootpkglibdir,
3179 install_dir : systemgeneratordir)
3182 'systemd-veritysetup',
3183 'src/veritysetup/veritysetup.c',
3184 include_directories : includes,
3185 link_with : [libshared],
3186 dependencies : [libcryptsetup,
3189 install_rpath : rootpkglibdir,
3191 install_dir : rootlibexecdir)
3194 'systemd-veritysetup-generator',
3195 'src/veritysetup/veritysetup-generator.c',
3196 include_directories : includes,
3197 link_with : [libshared],
3198 dependencies : [userspace,
3200 install_rpath : rootpkglibdir,
3202 install_dir : systemgeneratordir)
3204 public_programs += executable(
3205 'systemd-cryptenroll',
3206 systemd_cryptenroll_sources,
3207 include_directories : includes,
3208 link_with : [libshared],
3209 dependencies : [libcryptsetup,
3215 install_rpath : rootpkglibdir,
3219 'systemd-integritysetup',
3220 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
3221 include_directories : includes,
3222 link_with : [libshared],
3223 dependencies : [libcryptsetup,
3226 install_rpath : rootpkglibdir,
3228 install_dir : rootlibexecdir)
3231 'systemd-integritysetup-generator',
3232 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
3233 include_directories : includes,
3234 link_with : [libshared],
3235 dependencies : userspace,
3236 install_rpath : rootpkglibdir,
3238 install_dir : systemgeneratordir)
3241 if conf.get('HAVE_SYSV_COMPAT') == 1
3243 'systemd-sysv-generator',
3244 'src/sysv-generator/sysv-generator.c',
3245 include_directories : includes,
3246 link_with : [libshared],
3247 dependencies : userspace,
3248 install_rpath : rootpkglibdir,
3250 install_dir : systemgeneratordir)
3252 sysv_generator_test_py = find_program('test/sysv-generator-test.py')
3253 if want_tests != 'false'
3254 test('sysv-generator-test',
3255 sysv_generator_test_py,
3260 'systemd-rc-local-generator',
3261 'src/rc-local-generator/rc-local-generator.c',
3262 include_directories : includes,
3263 link_with : [libshared],
3264 dependencies : userspace,
3265 install_rpath : rootpkglibdir,
3267 install_dir : systemgeneratordir)
3270 if conf.get('ENABLE_XDG_AUTOSTART') == 1
3272 'systemd-xdg-autostart-generator',
3273 systemd_xdg_autostart_generator_sources,
3274 include_directories : includes,
3275 link_with : [libshared],
3276 dependencies : userspace,
3277 install_rpath : rootpkglibdir,
3279 install_dir : usergeneratordir)
3282 'systemd-xdg-autostart-condition',
3283 'src/xdg-autostart-generator/xdg-autostart-condition.c',
3284 include_directories : includes,
3285 link_with : [libshared],
3286 dependencies : userspace,
3287 install_rpath : rootpkglibdir,
3289 install_dir : rootlibexecdir)
3292 if conf.get('ENABLE_HOSTNAMED') == 1
3293 dbus_programs += executable(
3294 'systemd-hostnamed',
3295 'src/hostname/hostnamed.c',
3296 include_directories : includes,
3297 link_with : [libshared],
3298 dependencies : userspace,
3299 install_rpath : rootpkglibdir,
3301 install_dir : rootlibexecdir)
3303 public_programs += executable(
3305 'src/hostname/hostnamectl.c',
3306 include_directories : includes,
3307 link_with : [libshared],
3308 dependencies : [userspace,
3310 install_rpath : rootpkglibdir,
3314 if conf.get('ENABLE_LOCALED') == 1
3315 dbus_programs += executable(
3317 systemd_localed_sources,
3318 include_directories : includes,
3319 link_with : [libshared],
3320 dependencies : libxkbcommon_deps +
3323 install_rpath : rootpkglibdir,
3325 install_dir : rootlibexecdir)
3327 public_programs += executable(
3330 include_directories : includes,
3331 link_with : [libshared],
3332 dependencies : [userspace,
3334 install_rpath : rootpkglibdir,
3338 if conf.get('ENABLE_TIMEDATED') == 1
3339 dbus_programs += executable(
3340 'systemd-timedated',
3341 'src/timedate/timedated.c',
3342 include_directories : includes,
3343 link_with : [libshared],
3344 dependencies : userspace,
3345 install_rpath : rootpkglibdir,
3347 install_dir : rootlibexecdir)
3350 if conf.get('ENABLE_TIMEDATECTL') == 1
3351 public_programs += executable(
3353 'src/timedate/timedatectl.c',
3354 include_directories : includes,
3355 install_rpath : rootpkglibdir,
3356 link_with : [libshared],
3357 dependencies : [libm,
3363 if conf.get('ENABLE_TIMESYNCD') == 1
3365 'systemd-timesyncd',
3366 systemd_timesyncd_sources,
3367 include_directories : includes,
3368 link_with : [libtimesyncd_core],
3369 dependencies : [libm,
3373 install_rpath : rootpkglibdir,
3375 install_dir : rootlibexecdir)
3378 'systemd-time-wait-sync',
3379 'src/timesync/wait-sync.c',
3380 include_directories : includes,
3381 link_with : [libtimesyncd_core],
3382 dependencies : userspace,
3383 install_rpath : rootpkglibdir,
3385 install_dir : rootlibexecdir)
3388 if conf.get('ENABLE_MACHINED') == 1
3389 dbus_programs += executable(
3391 systemd_machined_sources,
3392 include_directories : includes,
3393 link_with : [libmachine_core,
3395 dependencies : userspace,
3396 install_rpath : rootpkglibdir,
3398 install_dir : rootlibexecdir)
3400 public_programs += executable(
3402 'src/machine/machinectl.c',
3403 include_directories : includes,
3404 link_with : [libshared],
3405 dependencies : [liblz4,
3411 install_rpath : rootpkglibdir,
3413 install_dir : rootbindir)
3416 if conf.get('ENABLE_IMPORTD') == 1
3417 dbus_programs += executable(
3419 systemd_importd_sources,
3420 include_directories : includes,
3421 link_with : [libshared],
3422 dependencies : [threads,
3425 install_rpath : rootpkglibdir,
3427 install_dir : rootlibexecdir)
3429 systemd_pull = executable(
3431 systemd_pull_sources,
3432 include_directories : includes,
3433 link_with : [libshared,
3435 dependencies : [lib_openssl_or_gcrypt,
3442 install_rpath : rootpkglibdir,
3444 install_dir : rootlibexecdir)
3446 systemd_import = executable(
3448 systemd_import_sources,
3449 include_directories : includes,
3450 link_with : [libshared,
3452 dependencies : [libbzip2,
3458 install_rpath : rootpkglibdir,
3460 install_dir : rootlibexecdir)
3462 systemd_import_fs = executable(
3463 'systemd-import-fs',
3464 systemd_import_fs_sources,
3465 include_directories : includes,
3466 link_with : [libshared,
3468 dependencies : [userspace,
3470 install_rpath : rootpkglibdir,
3472 install_dir : rootlibexecdir)
3474 systemd_export = executable(
3476 systemd_export_sources,
3477 include_directories : includes,
3478 link_with : [libshared,
3480 dependencies : [libbzip2,
3486 install_rpath : rootpkglibdir,
3488 install_dir : rootlibexecdir)
3490 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
3493 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
3494 public_programs += executable(
3495 'systemd-journal-upload',
3496 systemd_journal_upload_sources,
3497 include_directories : includes,
3498 link_with : [libshared],
3499 dependencies : [libcurl,
3507 install_rpath : rootpkglibdir,
3509 install_dir : rootlibexecdir)
3512 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
3513 public_programs += executable(
3514 'systemd-journal-remote',
3515 systemd_journal_remote_sources,
3516 include_directories : journal_includes,
3517 link_with : [libshared,
3518 libsystemd_journal_remote],
3519 dependencies : [libgnutls,
3527 install_rpath : rootpkglibdir,
3529 install_dir : rootlibexecdir)
3531 public_programs += executable(
3532 'systemd-journal-gatewayd',
3533 systemd_journal_gatewayd_sources,
3534 include_directories : journal_includes,
3535 link_with : [libshared],
3536 dependencies : [libgnutls,
3544 install_rpath : rootpkglibdir,
3546 install_dir : rootlibexecdir)
3549 if conf.get('ENABLE_COREDUMP') == 1
3552 systemd_coredump_sources,
3553 include_directories : includes,
3554 link_with : [libshared,
3556 dependencies : [libacl,
3563 install_rpath : rootpkglibdir,
3565 install_dir : rootlibexecdir)
3567 public_programs += executable(
3569 coredumpctl_sources,
3570 include_directories : includes,
3571 link_with : [libshared,
3573 dependencies : [liblz4,
3579 install_rpath : rootpkglibdir,
3583 if conf.get('ENABLE_PSTORE') == 1
3586 systemd_pstore_sources,
3587 include_directories : includes,
3588 link_with : [libshared],
3589 dependencies : [libacl,
3596 install_rpath : rootpkglibdir,
3598 install_dir : rootlibexecdir)
3601 if conf.get('ENABLE_OOMD') == 1
3602 dbus_programs += executable('systemd-oomd',
3603 systemd_oomd_sources,
3604 include_directories : includes,
3605 link_with : [libshared],
3606 dependencies : [libatomic,
3609 install_rpath : rootpkglibdir,
3611 install_dir : rootlibexecdir)
3613 public_programs += executable(
3616 include_directories : includes,
3617 link_with : [libshared],
3618 dependencies : [userspace,
3620 install_rpath : rootpkglibdir,
3624 if conf.get('ENABLE_BINFMT') == 1
3625 public_programs += executable(
3627 'src/binfmt/binfmt.c',
3628 include_directories : includes,
3629 link_with : [libshared],
3630 dependencies : [userspace,
3632 install_rpath : rootpkglibdir,
3634 install_dir : rootlibexecdir)
3636 meson.add_install_script('sh', '-c',
3637 mkdir_p.format(binfmtdir))
3638 if install_sysconfdir
3639 meson.add_install_script('sh', '-c',
3640 mkdir_p.format(sysconfdir / 'binfmt.d'))
3644 if conf.get('ENABLE_SYSUPDATE') == 1
3646 'systemd-sysupdate',
3647 systemd_sysupdate_sources,
3648 include_directories : includes,
3649 link_with : [libshared,
3651 dependencies : [libblkid,
3657 install_rpath : rootpkglibdir,
3659 install_dir : rootlibexecdir)
3660 public_programs += exe
3663 if conf.get('ENABLE_VCONSOLE') == 1
3665 'systemd-vconsole-setup',
3666 'src/vconsole/vconsole-setup.c',
3667 include_directories : includes,
3668 link_with : [libshared],
3669 dependencies : userspace,
3670 install_rpath : rootpkglibdir,
3672 install_dir : rootlibexecdir)
3675 if conf.get('ENABLE_RANDOMSEED') == 1
3677 'systemd-random-seed',
3678 'src/random-seed/random-seed.c',
3679 include_directories : includes,
3680 link_with : [libshared],
3681 dependencies : [userspace,
3683 install_rpath : rootpkglibdir,
3685 install_dir : rootlibexecdir)
3688 if conf.get('ENABLE_FIRSTBOOT') == 1
3689 public_programs += executable(
3690 'systemd-firstboot',
3691 'src/firstboot/firstboot.c',
3692 include_directories : includes,
3693 link_with : [libshared],
3694 dependencies : [libcrypt,
3697 install_rpath : rootpkglibdir,
3699 install_dir : rootbindir)
3703 'systemd-remount-fs',
3704 'src/remount-fs/remount-fs.c',
3705 include_directories : includes,
3706 link_with : [libshared],
3707 dependencies : [userspace,
3709 install_rpath : rootpkglibdir,
3711 install_dir : rootlibexecdir)
3714 'systemd-machine-id-setup',
3715 'src/machine-id-setup/machine-id-setup-main.c',
3716 include_directories : includes,
3717 link_with : [libshared],
3718 dependencies : [userspace,
3720 install_rpath : rootpkglibdir,
3722 install_dir : rootbindir)
3727 include_directories : includes,
3728 link_with : [libshared],
3729 dependencies : [userspace,
3731 install_rpath : rootpkglibdir,
3733 install_dir : rootlibexecdir)
3737 'src/partition/growfs.c',
3738 include_directories : includes,
3739 link_with : [libshared],
3740 dependencies : [userspace,
3742 install_rpath : rootpkglibdir,
3744 install_dir : rootlibexecdir)
3748 'src/partition/makefs.c',
3749 include_directories : includes,
3750 link_with : [libshared],
3751 dependencies : [userspace,
3753 install_rpath : rootpkglibdir,
3755 install_dir : rootlibexecdir)
3759 'src/sleep/sleep.c',
3760 include_directories : includes,
3761 link_with : [libshared],
3762 dependencies : [userspace,
3764 install_rpath : rootpkglibdir,
3766 install_dir : rootlibexecdir)
3768 if install_sysconfdir_samples
3769 install_data('src/sleep/sleep.conf',
3770 install_dir : pkgsysconfdir)
3773 public_programs += executable(
3775 'src/sysctl/sysctl.c',
3776 include_directories : includes,
3777 link_with : [libshared],
3778 dependencies : [userspace,
3780 install_rpath : rootpkglibdir,
3782 install_dir : rootlibexecdir)
3784 public_programs += executable(
3786 'src/ac-power/ac-power.c',
3787 include_directories : includes,
3788 link_with : [libshared],
3789 dependencies : [userspace,
3791 install_rpath : rootpkglibdir,
3794 public_programs += executable(
3795 'systemd-detect-virt',
3796 'src/detect-virt/detect-virt.c',
3797 include_directories : includes,
3798 link_with : [libshared],
3799 dependencies : [userspace,
3801 install_rpath : rootpkglibdir,
3804 public_programs += executable(
3806 'src/delta/delta.c',
3807 include_directories : includes,
3808 link_with : [libshared],
3809 dependencies : [userspace,
3811 install_rpath : rootpkglibdir,
3814 public_programs += executable(
3816 'src/escape/escape.c',
3817 include_directories : includes,
3818 link_with : [libshared],
3819 dependencies : [userspace,
3821 install_rpath : rootpkglibdir,
3823 install_dir : rootbindir)
3825 public_programs += executable(
3827 'src/notify/notify.c',
3828 include_directories : includes,
3829 link_with : [libshared],
3830 dependencies : [userspace,
3832 install_rpath : rootpkglibdir,
3834 install_dir : rootbindir)
3836 public_programs += executable(
3838 'src/creds/creds.c',
3839 include_directories : includes,
3840 link_with : [libshared],
3841 dependencies : [threads,
3845 install_rpath : rootpkglibdir,
3847 install_dir : rootbindir)
3849 public_programs += executable(
3850 'systemd-battery-check',
3851 'src/battery-check/battery-check.c',
3852 include_directories : includes,
3853 link_with : [libshared],
3854 dependencies : [userspace, versiondep],
3855 install_rpath : rootpkglibdir,
3856 install_dir : rootlibexecdir,
3859 # Protecting files from the distro in /usr doesn't make sense since they can be trivially accessed otherwise,
3860 # so don't restrict the access mode in /usr. That doesn't apply to /etc, so we do restrict the access mode
3862 meson.add_install_script('sh', '-c', mkdir_p.format(credstoredir))
3863 if install_sysconfdir
3864 # Keep in sync with tmpfiles.d/credstore.conf
3865 meson.add_install_script('sh', '-c', mkdir_p_mode.format(sysconfdir / 'credstore', '0700'))
3866 meson.add_install_script('sh', '-c', mkdir_p_mode.format(sysconfdir / 'credstore.encrypted', '0700'))
3870 'systemd-volatile-root',
3871 'src/volatile-root/volatile-root.c',
3872 include_directories : includes,
3873 link_with : [libshared],
3874 dependencies : userspace,
3875 install_rpath : rootpkglibdir,
3876 install : conf.get('ENABLE_INITRD') == 1,
3877 install_dir : rootlibexecdir)
3880 'systemd-cgroups-agent',
3881 'src/cgroups-agent/cgroups-agent.c',
3882 include_directories : includes,
3883 link_with : [libshared],
3884 dependencies : userspace,
3885 install_rpath : rootpkglibdir,
3887 install_dir : rootlibexecdir)
3889 systemd_id128 = executable(
3891 'src/id128/id128.c',
3892 include_directories : includes,
3893 link_with : [libshared],
3894 dependencies : [userspace,
3896 install_rpath : rootpkglibdir,
3898 public_programs += systemd_id128
3900 if want_tests != 'false'
3901 test('test-systemctl-enable',
3902 test_systemctl_enable_sh,
3903 # https://github.com/mesonbuild/meson/issues/2681
3904 args : [systemctl.full_path(),
3905 systemd_id128.full_path()])
3908 public_programs += executable(
3911 include_directories : includes,
3912 link_with : [libshared],
3913 dependencies : [userspace,
3915 install_rpath : rootpkglibdir,
3918 public_programs += executable(
3919 'systemd-ask-password',
3920 'src/ask-password/ask-password.c',
3921 include_directories : includes,
3922 link_with : [libshared],
3923 dependencies : [userspace,
3925 install_rpath : rootpkglibdir,
3927 install_dir : rootbindir)
3930 'systemd-reply-password',
3931 'src/reply-password/reply-password.c',
3932 include_directories : includes,
3933 link_with : [libshared],
3934 dependencies : userspace,
3935 install_rpath : rootpkglibdir,
3937 install_dir : rootlibexecdir)
3939 public_programs += executable(
3940 'systemd-tty-ask-password-agent',
3941 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3942 include_directories : includes,
3943 link_with : [libshared],
3944 dependencies : [userspace,
3946 install_rpath : rootpkglibdir,
3948 install_dir : rootbindir)
3950 public_programs += executable(
3953 include_directories : includes,
3954 link_with : [libshared],
3955 dependencies : [userspace,
3957 install_rpath : rootpkglibdir,
3960 public_programs += executable(
3962 'src/cgtop/cgtop.c',
3963 include_directories : includes,
3964 link_with : [libshared],
3965 dependencies : [userspace,
3967 install_rpath : rootpkglibdir,
3972 'src/initctl/initctl.c',
3973 include_directories : includes,
3974 link_with : [libshared],
3975 dependencies : userspace,
3976 install_rpath : rootpkglibdir,
3977 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3978 install_dir : rootlibexecdir)
3980 public_programs += executable(
3982 'src/mount/mount-tool.c',
3983 include_directories : includes,
3984 link_with : [libshared],
3985 dependencies: [libmount,
3988 install_rpath : rootpkglibdir,
3991 meson.add_install_script(meson_make_symlink,
3992 'systemd-mount', bindir / 'systemd-umount')
3994 public_programs += executable(
3997 include_directories : includes,
3998 link_with : [libshared],
3999 dependencies : [userspace,
4001 install_rpath : rootpkglibdir,
4004 public_programs += executable(
4005 'systemd-stdio-bridge',
4006 'src/stdio-bridge/stdio-bridge.c',
4007 include_directories : includes,
4008 link_with : [libshared],
4009 dependencies : [userspace,
4011 install_rpath : rootpkglibdir,
4014 public_programs += executable(
4017 include_directories : includes,
4018 link_with : [libshared],
4019 dependencies : [userspace,
4021 install_rpath : rootpkglibdir,
4027 'src/sysusers/sysusers.c',
4028 include_directories : includes,
4029 link_with : [libshared],
4030 dependencies : [userspace,
4032 install_rpath : rootpkglibdir,
4034 install_dir : rootbindir)
4035 public_programs += exe
4037 if want_tests != 'false'
4038 test('test-sysusers',
4040 # https://github.com/mesonbuild/meson/issues/2681
4041 args : exe.full_path())
4045 'systemd-sysusers.standalone',
4046 'src/sysusers/sysusers.c',
4047 include_directories : includes,
4048 c_args : '-DSTANDALONE',
4049 link_with : [libshared_static,
4053 dependencies : [userspace,
4055 build_by_default: have_standalone_binaries,
4056 install : have_standalone_binaries,
4057 install_dir : rootbindir)
4058 if have_standalone_binaries
4059 public_programs += exe
4061 if want_tests != 'false'
4062 test('test-sysusers.standalone',
4064 # https://github.com/mesonbuild/meson/issues/2681
4065 args : exe.full_path())
4070 if conf.get('ENABLE_TMPFILES') == 1
4073 systemd_tmpfiles_sources,
4074 include_directories : includes,
4075 link_with : [libshared],
4076 dependencies : [libacl,
4079 install_rpath : rootpkglibdir,
4081 install_dir : rootbindir)
4082 public_programs += exe
4084 if want_tests != 'false'
4085 test('test-systemd-tmpfiles',
4086 test_systemd_tmpfiles_py,
4087 # https://github.com/mesonbuild/meson/issues/2681
4088 args : exe.full_path())
4092 'systemd-tmpfiles.standalone',
4093 systemd_tmpfiles_sources,
4094 include_directories : includes,
4095 c_args : '-DSTANDALONE',
4096 link_with : [libshared_static,
4100 dependencies : [libacl,
4103 build_by_default: have_standalone_binaries,
4104 install : have_standalone_binaries,
4105 install_dir : rootbindir)
4106 if have_standalone_binaries
4107 public_programs += exe
4109 if want_tests != 'false'
4110 test('test-systemd-tmpfiles.standalone',
4111 test_systemd_tmpfiles_py,
4112 # https://github.com/mesonbuild/meson/issues/2681
4113 args : exe.full_path())
4118 if conf.get('ENABLE_HWDB') == 1
4119 systemd_hwdb = executable(
4122 include_directories : includes,
4123 link_with : udev_link_with,
4124 dependencies : [userspace,
4126 install_rpath : udev_rpath,
4128 install_dir : rootbindir)
4129 public_programs += systemd_hwdb
4131 if want_tests != 'false'
4135 args : [systemd_hwdb.full_path()],
4140 if conf.get('ENABLE_QUOTACHECK') == 1
4142 'systemd-quotacheck',
4143 'src/quotacheck/quotacheck.c',
4144 include_directories : includes,
4145 link_with : [libshared],
4146 dependencies : userspace,
4147 install_rpath : rootpkglibdir,
4149 install_dir : rootlibexecdir)
4152 public_programs += executable(
4153 'systemd-socket-proxyd',
4154 'src/socket-proxy/socket-proxyd.c',
4155 include_directories : includes,
4156 link_with : [libshared],
4157 dependencies : [threads,
4160 install_rpath : rootpkglibdir,
4162 install_dir : rootlibexecdir)
4164 udevadm = executable(
4167 include_directories : includes,
4168 link_with : [libudevd_core],
4169 dependencies : [libacl,
4176 install_rpath : udev_rpath,
4178 install_dir : rootbindir)
4179 public_programs += udevadm
4181 if want_tests != 'false'
4182 test('udev-rules-check',
4185 args : ['verify', '--resolve-names=never', all_rules])
4188 if conf.get('ENABLE_REPART') == 1
4191 systemd_repart_sources,
4192 include_directories : includes,
4193 link_with : [libshared,
4195 dependencies : [libblkid,
4201 install_rpath : rootpkglibdir,
4203 install_dir : rootbindir)
4204 public_programs += exe
4207 'systemd-repart.standalone',
4208 systemd_repart_sources,
4209 include_directories : includes,
4210 c_args : '-DSTANDALONE',
4211 link_with : [libshared_static,
4216 dependencies : [libblkid,
4222 build_by_default: have_standalone_binaries,
4223 install_rpath : rootpkglibdir,
4224 install : have_standalone_binaries,
4225 install_dir : rootbindir)
4226 if have_standalone_binaries
4227 public_programs += exe
4233 systemd_shutdown_sources,
4234 include_directories : includes,
4235 link_with : [libshared],
4236 dependencies : [libmount,
4239 install_rpath : rootpkglibdir,
4241 install_dir : rootlibexecdir)
4244 'systemd-shutdown.standalone',
4245 systemd_shutdown_sources,
4246 include_directories : includes,
4247 c_args : '-DSTANDALONE',
4248 link_with : [libshared_static,
4251 dependencies : [libmount,
4254 build_by_default: have_standalone_binaries,
4255 install_rpath : rootpkglibdir,
4256 install : have_standalone_binaries,
4257 install_dir : rootlibexecdir)
4260 'systemd-update-done',
4261 'src/update-done/update-done.c',
4262 include_directories : includes,
4263 link_with : [libshared],
4264 dependencies : [userspace,
4266 install_rpath : rootpkglibdir,
4268 install_dir : rootlibexecdir)
4271 'systemd-update-utmp',
4272 'src/update-utmp/update-utmp.c',
4273 include_directories : includes,
4274 link_with : [libshared],
4275 dependencies : [libaudit,
4278 install_rpath : rootpkglibdir,
4279 install : (conf.get('ENABLE_UTMP') == 1),
4280 install_dir : rootlibexecdir)
4282 if conf.get('HAVE_KMOD') == 1
4284 'systemd-modules-load',
4285 'src/modules-load/modules-load.c',
4286 include_directories : includes,
4287 link_with : [libshared],
4288 dependencies : [libkmod,
4291 install_rpath : rootpkglibdir,
4293 install_dir : rootlibexecdir)
4295 meson.add_install_script('sh', '-c',
4296 mkdir_p.format(modulesloaddir))
4297 if install_sysconfdir
4298 meson.add_install_script('sh', '-c',
4299 mkdir_p.format(sysconfdir / 'modules-load.d'))
4303 public_programs += executable(
4305 systemd_nspawn_sources,
4306 include_directories : includes,
4307 link_with : [libnspawn_core,
4309 dependencies : [libblkid,
4313 install_rpath : rootpkglibdir,
4316 if conf.get('ENABLE_NETWORKD') == 1
4317 dbus_programs += executable(
4319 systemd_networkd_sources,
4320 include_directories : network_includes,
4321 link_with : [libnetworkd_core,
4323 networkd_link_with],
4324 dependencies : [threads,
4327 install_rpath : rootpkglibdir,
4329 install_dir : rootlibexecdir)
4331 public_programs += executable(
4332 'systemd-networkd-wait-online',
4333 systemd_networkd_wait_online_sources,
4334 include_directories : includes,
4335 link_with : [networkd_link_with],
4336 dependencies : [userspace,
4338 install_rpath : rootpkglibdir,
4340 install_dir : rootlibexecdir)
4342 public_programs += executable(
4345 include_directories : libsystemd_network_includes,
4346 link_with : [libsystemd_network,
4347 networkd_link_with],
4348 dependencies : [userspace,
4350 install_rpath : rootpkglibdir,
4352 install_dir : rootbindir)
4356 'systemd-network-generator',
4357 network_generator_sources,
4358 include_directories : includes,
4359 link_with : [networkd_link_with],
4360 dependencies : [userspace,
4362 install_rpath : rootpkglibdir,
4364 install_dir : rootlibexecdir)
4366 if want_tests != 'false'
4367 test('test-network-generator-conversion',
4368 test_network_generator_conversion_sh,
4369 # https://github.com/mesonbuild/meson/issues/2681
4370 args : exe.full_path(),
4375 'systemd-sulogin-shell',
4376 'src/sulogin-shell/sulogin-shell.c',
4377 include_directories : includes,
4378 link_with : [libshared],
4379 dependencies : [userspace,
4381 install_rpath : rootpkglibdir,
4383 install_dir : rootlibexecdir)
4385 kernel_install = executable(
4387 'src/kernel-install/kernel-install.c',
4388 include_directories : includes,
4389 link_with : [libshared],
4390 dependencies : [userspace,
4392 install_rpath : rootpkglibdir,
4393 install : want_kernel_install,
4394 install_dir : bindir)
4395 public_programs += kernel_install
4397 ukify = custom_target(
4399 input : 'src/ukify/ukify.py',
4401 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
4402 install : want_ukify,
4403 install_mode : 'rwxr-xr-x',
4404 install_dir : rootlibexecdir)
4406 public_programs += ukify
4409 if want_tests != 'false' and want_kernel_install
4410 args = [kernel_install.full_path(), loaderentry_install.full_path(), uki_copy_install]
4411 deps = [kernel_install, loaderentry_install]
4412 if want_ukify and boot_stubs.length() > 0
4413 args += [ukify.full_path(), ukify_install.full_path(), boot_stubs[0]]
4414 deps += [ukify, ukify_install, boot_stubs[0]]
4417 test('test-kernel-install',
4418 test_kernel_install_sh,
4424 ############################################################
4426 runtest_env = custom_target(
4427 'systemd-runtest.env',
4428 output : 'systemd-runtest.env',
4429 command : [sh, '-c',
4430 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
4431 project_source_root / 'test',
4432 project_build_root / 'catalog')],
4434 build_by_default : true)
4436 test_cflags = ['-DTEST_CODE=1']
4437 # We intentionally do not do inline initializations with definitions for a
4438 # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
4439 # use the variable unexpectedly. This triggers a lot of maybe-uninitialized
4440 # false positives when the combination of -O2 and -flto is used. Suppress them.
4441 if '-O2' in c_args and '-flto=auto' in c_args
4442 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
4445 foreach test : simple_tests
4446 tests += { 'sources' : [test] }
4450 foreach test : tests
4451 sources = test.get('sources')
4452 condition = test.get('condition', '')
4453 type = test.get('type', '')
4454 base = test.get('base', {})
4456 base.get('dependencies', []),
4457 test.get('dependencies', []),
4461 name = fs.name(sources[0])
4462 if not name.endswith('.cc')
4465 name = fs.stem(name)
4467 suite = fs.name(fs.parent(sources[0])).replace('sd-', '')
4469 if condition != '' and conf.get(condition) == 0
4470 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
4477 include_directories : [base.get('includes', []), test.get('includes', includes)],
4478 link_with : [base.get('link_with', []), test.get('link_with', libshared)],
4479 dependencies : deps,
4480 c_args : [test_cflags, test.get('c_args', [])],
4481 build_by_default : want_tests != 'false',
4482 install_rpath : rootpkglibdir,
4483 install : install_tests,
4484 install_dir : unittestsdir / type,
4485 link_depends : runtest_env)
4488 message('@0@ is a manual test'.format(name))
4489 elif type == 'unsafe' and want_tests != 'unsafe'
4490 message('@0@ is an unsafe test'.format(name))
4491 elif want_tests != 'false'
4494 timeout : test.get('timeout', 30),
4496 is_parallel : test.get('parallel', true))
4499 TESTS += { name : exe }
4503 'test-libsystemd-sym',
4504 test_libsystemd_sym_c,
4505 include_directories : includes,
4506 link_with : [libsystemd],
4507 dependencies : userspace,
4508 build_by_default : want_tests != 'false',
4509 install : install_tests,
4510 install_dir : unittestsdir)
4511 if want_tests != 'false'
4512 test('test-libsystemd-sym', exe)
4516 'test-libsystemd-static-sym',
4517 test_libsystemd_sym_c,
4518 include_directories : includes,
4519 link_with : [install_libsystemd_static],
4521 # threads is already included in dependencies on the library,
4522 # but does not seem to get propagated. Add here as a work-around.
4526 build_by_default : want_tests != 'false' and static_libsystemd != 'false',
4527 install : install_tests and static_libsystemd != 'false',
4528 install_dir : unittestsdir)
4529 if want_tests != 'false' and static_libsystemd != 'false'
4530 test('test-libsystemd-static-sym', exe)
4536 include_directories : libudev_includes,
4537 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
4538 link_with : [libudev],
4539 dependencies : userspace,
4540 build_by_default : want_tests != 'false',
4541 install : install_tests,
4542 install_dir : unittestsdir)
4543 if want_tests != 'false'
4544 test('test-libudev-sym', exe)
4548 'test-libudev-static-sym',
4550 include_directories : libudev_includes,
4551 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
4552 link_with : [install_libudev_static],
4553 dependencies : userspace,
4554 build_by_default : want_tests != 'false' and static_libudev != 'false',
4555 install : install_tests and static_libudev != 'false',
4556 install_dir : unittestsdir)
4557 if want_tests != 'false' and static_libudev != 'false'
4558 test('test-libudev-static-sym', exe)
4561 if want_tests != 'false'
4562 exe = TESTS.get('udev-rule-runner')
4566 env : ['UDEV_RULE_RUNNER=' + exe.full_path()],
4571 ############################################################
4573 foreach fuzzer : simple_fuzzers
4574 fuzzers += { 'sources' : [fuzzer] }
4579 foreach fuzzer : fuzzers
4580 sources = fuzzer.get('sources')
4581 base = fuzzer.get('base', {})
4582 dependencies = [base.get('dependencies', []), fuzzer.get('dependencies', [])]
4586 dependencies += fuzzing_engine
4588 if fuzzing_engine.found()
4589 dependencies += fuzzing_engine
4591 link_args += ['-fsanitize=fuzzer']
4594 sources += files('src/fuzz/fuzz-main.c')
4596 sources += fuzz_generated_directives
4598 name = fs.stem(sources[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 = fs.name(exec.full_path())
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)])
4761 ############################################################
4764 all_files = run_command(
4765 env, '-u', 'GIT_WORK_TREE',
4766 git, '--git-dir=@0@/.git'.format(project_source_root),
4767 'ls-files', ':/*.[ch]', ':/*.cc',
4769 if all_files.returncode() == 0
4770 all_files = files(all_files.stdout().split())
4775 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
4778 command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files)
4780 ############################################
4782 if want_tests != 'false' and conf.get('BUILD_MODE_DEVELOPER') == 1
4783 test('check-includes',
4784 files('tools/check-includes.py'),
4786 env : ['PROJECT_SOURCE_ROOT=@0@'.format(project_source_root)])
4790 ####################################################
4792 git_contrib_sh = find_program('tools/git-contrib.sh')
4795 command : [git_contrib_sh])
4797 ####################################################
4799 git_head = run_command(
4800 git, '--git-dir=@0@/.git'.format(project_source_root),
4801 'rev-parse', 'HEAD',
4802 check : false).stdout().strip()
4803 git_head_short = run_command(
4804 git, '--git-dir=@0@/.git'.format(project_source_root),
4805 'rev-parse', '--short=7', 'HEAD',
4806 check : false).stdout().strip()
4810 command : [git, 'archive',
4811 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
4813 '--prefix', 'systemd-@0@/'.format(git_head),
4817 ############################################################
4819 check_api_docs_sh = find_program('tools/check-api-docs.sh')
4822 depends : [man, libsystemd, libudev],
4823 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
4825 alias_target('update-dbus-docs', update_dbus_docs)
4826 alias_target('update-man-rules', update_man_rules)
4828 if not meson.is_cross_build()
4830 'export-dbus-interfaces',
4831 output : fs.name(dbus_interfaces_dir),
4832 install : dbus_interfaces_dir != 'no',
4833 install_dir : fs.parent(dbus_interfaces_dir),
4834 command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs])
4837 ############################################################
4839 alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
4840 check : true).stdout().strip()
4843 'split /usr' : split_usr,
4844 'split bin-sbin' : split_bin,
4845 'prefix directory' : prefixdir,
4846 'rootprefix directory' : rootprefixdir,
4847 'sysconf directory' : sysconfdir,
4848 'include directory' : includedir,
4849 'lib directory' : libdir,
4850 'rootlib directory' : rootlibdir,
4851 'SysV init scripts' : sysvinit_path,
4852 'SysV rc?.d directories' : sysvrcnd_path,
4853 'PAM modules directory' : pamlibdir,
4854 'PAM configuration directory' : pamconfdir,
4855 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
4856 'RPM macros directory' : rpmmacrosdir,
4857 'modprobe.d directory' : modprobedir,
4858 'D-Bus policy directory' : dbuspolicydir,
4859 'D-Bus session directory' : dbussessionservicedir,
4860 'D-Bus system directory' : dbussystemservicedir,
4861 'D-Bus interfaces directory' : dbus_interfaces_dir,
4862 'bash completions directory' : bashcompletiondir,
4863 'zsh completions directory' : zshcompletiondir,
4864 'private shared lib version tag' : shared_lib_tag,
4865 'extra start script' : get_option('rc-local'),
4866 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
4867 get_option('debug-tty')),
4868 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
4869 conf.get('SYSTEM_ALLOC_UID_MIN')),
4870 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
4871 conf.get('SYSTEM_ALLOC_GID_MIN')),
4872 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
4873 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
4874 'static UID/GID allocations' : ' '.join(static_ugids),
4875 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
4876 'render group access mode' : get_option('group-render-mode'),
4877 'certificate root directory' : get_option('certificate-root'),
4878 'support URL' : support_url,
4879 'nobody user name' : nobody_user,
4880 'nobody group name' : nobody_group,
4881 'fallback hostname' : get_option('fallback-hostname'),
4882 'default compression method' : compression,
4883 'default DNSSEC mode' : default_dnssec,
4884 'default DNS-over-TLS mode' : default_dns_over_tls,
4885 'default mDNS mode' : default_mdns,
4886 'default LLMNR mode' : default_llmnr,
4887 'default DNS servers' : dns_servers.split(' '),
4888 'default NTP servers' : ntp_servers.split(' '),
4889 'default cgroup hierarchy' : default_hierarchy,
4890 'default net.naming-scheme value' : default_net_naming_scheme,
4891 'default KillUserProcesses value' : kill_user_processes,
4892 'default locale' : default_locale,
4893 'default nspawn locale' : nspawn_locale,
4894 'default status unit format' : status_unit_format_default,
4895 'default user $PATH' :
4896 default_user_path != '' ? default_user_path : '(same as system services)',
4897 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
4898 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
4901 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
4902 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
4903 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
4924 ['libcryptsetup-plugins'],
4951 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
4980 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
4994 ['legacy-pkla', install_polkit_pkla],
5000 ['man pages', want_man],
5001 ['html pages', want_html],
5002 ['man page indices', want_man and have_lxml],
5004 ['compat-mutable-uid-boundaries'],
5007 ['adm group', get_option('adm-group')],
5008 ['wheel group', get_option('wheel-group')],
5011 ['debug mmap cache'],
5013 ['trace logging', conf.get('LOG_TRACE') == 1],
5014 ['slow tests', slow_tests],
5015 ['fuzz tests', fuzz_tests],
5016 ['install tests', install_tests],
5017 ['link-udev-shared', get_option('link-udev-shared')],
5018 ['link-systemctl-shared', get_option('link-systemctl-shared')],
5019 ['link-networkd-shared', get_option('link-networkd-shared')],
5020 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
5021 ['link-journalctl-shared', get_option('link-journalctl-shared')],
5022 ['link-boot-shared', get_option('link-boot-shared')],
5023 ['link-portabled-shared', get_option('link-portabled-shared')],
5024 ['first-boot-full-preset'],
5026 ['standalone-binaries', get_option('standalone-binaries')],
5027 ['coverage', get_option('b_coverage')],
5030 if tuple.length() >= 2
5033 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
5034 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
5035 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
5044 if static_libsystemd == 'false'
5045 missing += 'static-libsystemd'
5047 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
5050 if static_libudev == 'false'
5051 missing += 'static-libudev'
5053 found += 'static-libudev(@0@)'.format(static_libudev)
5056 if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
5057 found += 'cryptolib(openssl)'
5058 elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
5059 found += 'cryptolib(gcrypt)'
5061 missing += 'cryptolib'
5064 if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
5065 found += 'DNS-over-TLS(gnutls)'
5066 elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
5067 found += 'DNS-over-TLS(openssl)'
5069 missing += 'DNS-over-TLS'
5073 'enabled' : ', '.join(found),
5074 'disabled' : ', '.join(missing)},
5075 section : 'Features')
5077 if rootprefixdir != rootprefix_default
5079 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
5080 'systemd used fixed names for unit file directories and other paths, so anything\n' +
5081 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))