1 # SPDX-License-Identifier: LGPL-2.1-or-later
3 project('systemd', 'c',
13 meson_version : '>= 0.53.2',
16 libsystemd_version = '0.36.0'
17 libudev_version = '1.7.6'
19 conf = configuration_data()
20 conf.set_quoted('PROJECT_URL', 'https://systemd.io/')
21 conf.set('PROJECT_VERSION', meson.project_version(),
22 description : 'Numerical project version (used where a simple number is expected)')
24 # This is to be used instead of meson.source_root(), as the latter will return
25 # the wrong result when systemd is being built as a meson subproject
26 project_source_root = meson.current_source_dir()
27 project_build_root = meson.current_build_dir()
28 relative_source_path = run_command('realpath',
29 '--relative-to=@0@'.format(project_build_root),
31 check : true).stdout().strip()
32 conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
34 conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer',
35 description : 'tailor build to development or release builds')
36 verification = get_option('log-message-verification')
37 if verification == 'auto'
38 verification = conf.get('BUILD_MODE_DEVELOPER') == 1
40 verification = verification == 'true'
42 conf.set10('LOG_MESSAGE_VERIFICATION', verification)
44 want_ossfuzz = get_option('oss-fuzz')
45 want_libfuzzer = get_option('llvm-fuzz')
46 if want_ossfuzz and want_libfuzzer
47 error('only one of oss-fuzz or llvm-fuzz can be specified')
50 skip_deps = want_ossfuzz or get_option('skip-deps')
51 fuzzer_build = want_ossfuzz or want_libfuzzer
53 # If we're building *not* for actual fuzzing, allow input samples of any size
54 # (for testing and for reproduction of issues discovered with previously-higher
56 conf.set10('FUZZ_USE_SIZE_LIMIT', fuzzer_build)
58 # We'll set this to '1' for EFI builds in a different place.
59 conf.set10('SD_BOOT', false)
61 # Create a title-less summary section early, so it ends up first in the output.
62 # More items are added later after they have been detected.
63 summary({'build mode' : get_option('mode')})
65 #####################################################################
67 # Try to install the git pre-commit hook
68 add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
69 if add_git_hook_sh.found()
70 git_hook = run_command(add_git_hook_sh, check : false)
71 if git_hook.returncode() == 0
72 message(git_hook.stdout().strip())
76 #####################################################################
79 if get_option('split-usr') == 'auto'
80 split_usr = not fs.is_symlink('/bin')
82 split_usr = get_option('split-usr') == 'true'
85 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
86 + ' split-usr mode is going to be removed\n' +
87 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
89 conf.set10('HAVE_SPLIT_USR', split_usr,
90 description : '/usr/bin and /bin directories are separate')
92 if get_option('split-bin') == 'auto'
93 split_bin = not fs.is_symlink('/usr/sbin')
95 split_bin = get_option('split-bin') == 'true'
97 conf.set10('HAVE_SPLIT_BIN', split_bin,
98 description : 'bin and sbin directories are separate')
100 rootprefixdir = get_option('rootprefix')
101 # Unusual rootprefixdir values are used by some distros
102 # (see https://github.com/systemd/systemd/pull/7461).
103 rootprefix_default = split_usr ? '/' : '/usr'
104 if rootprefixdir == ''
105 rootprefixdir = rootprefix_default
107 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
109 have_standalone_binaries = get_option('standalone-binaries')
111 sysvinit_path = get_option('sysvinit-path')
112 sysvrcnd_path = get_option('sysvrcnd-path')
113 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
114 description : 'SysV init scripts and rcN.d links are supported')
115 conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
117 if get_option('hibernate') and not get_option('initrd')
118 error('hibernate depends on initrd')
121 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
122 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
123 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
125 # Meson ignores the preceding arguments when joining paths if an absolute
126 # component is encountered, so this should canonicalize various paths when they
127 # are absolute or relative.
128 prefixdir = get_option('prefix')
129 if not prefixdir.startswith('/')
130 error('Prefix is not absolute: "@0@"'.format(prefixdir))
132 if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
133 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
134 rootprefixdir, prefixdir))
137 bindir = prefixdir / get_option('bindir')
138 libdir = prefixdir / get_option('libdir')
139 sysconfdir = prefixdir / get_option('sysconfdir')
140 includedir = prefixdir / get_option('includedir')
141 datadir = prefixdir / get_option('datadir')
142 localstatedir = '/' / get_option('localstatedir')
144 rootbindir = rootprefixdir / 'bin'
145 rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin')
146 rootlibexecdir = rootprefixdir / 'lib/systemd'
148 rootlibdir = get_option('rootlibdir')
150 # This will be a relative path if libdir is in prefix.
151 rootlibdir = get_option('libdir')
153 if not rootlibdir.startswith('/')
154 # If we have a relative path, add rootprefixdir to the front.
155 rootlibdir = rootprefixdir / rootlibdir
157 rootpkglibdir = rootlibdir / 'systemd'
159 install_sysconfdir = get_option('install-sysconfdir') != 'false'
160 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
161 # Dirs of external packages
162 pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig'
163 pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
164 polkitpolicydir = datadir / 'polkit-1/actions'
165 polkitrulesdir = datadir / 'polkit-1/rules.d'
166 polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
167 xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d'
168 rpmmacrosdir = get_option('rpmmacrosdir')
169 if rpmmacrosdir != 'no'
170 rpmmacrosdir = prefixdir / rpmmacrosdir
172 modprobedir = rootprefixdir / 'lib/modprobe.d'
175 pkgdatadir = datadir / 'systemd'
176 environmentdir = prefixdir / 'lib/environment.d'
177 pkgsysconfdir = sysconfdir / 'systemd'
178 userunitdir = prefixdir / 'lib/systemd/user'
179 userpresetdir = prefixdir / 'lib/systemd/user-preset'
180 tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
181 usertmpfilesdir = prefixdir / 'share/user-tmpfiles.d'
182 sysusersdir = prefixdir / 'lib/sysusers.d'
183 sysctldir = prefixdir / 'lib/sysctl.d'
184 binfmtdir = prefixdir / 'lib/binfmt.d'
185 modulesloaddir = prefixdir / 'lib/modules-load.d'
186 networkdir = rootprefixdir / 'lib/systemd/network'
187 systemgeneratordir = rootlibexecdir / 'system-generators'
188 usergeneratordir = prefixdir / 'lib/systemd/user-generators'
189 systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
190 userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
191 systemshutdowndir = rootlibexecdir / 'system-shutdown'
192 systemsleepdir = rootlibexecdir / 'system-sleep'
193 systemunitdir = rootprefixdir / 'lib/systemd/system'
194 systempresetdir = rootprefixdir / 'lib/systemd/system-preset'
195 udevlibexecdir = rootprefixdir / 'lib/udev'
196 udevrulesdir = udevlibexecdir / 'rules.d'
197 udevhwdbdir = udevlibexecdir / 'hwdb.d'
198 catalogdir = prefixdir / 'lib/systemd/catalog'
199 kerneldir = prefixdir / 'lib/kernel'
200 kernelinstalldir = kerneldir / 'install.d'
201 factorydir = datadir / 'factory'
202 bootlibdir = prefixdir / 'lib/systemd/boot/efi'
203 testsdir = prefixdir / 'lib/systemd/tests'
204 unittestsdir = testsdir / 'unit-tests'
205 testdata_dir = testsdir / 'testdata'
206 systemdstatedir = localstatedir / 'lib/systemd'
207 catalogstatedir = systemdstatedir / 'catalog'
208 randomseeddir = localstatedir / 'lib/systemd'
209 profiledir = rootlibexecdir / 'portable' / 'profile'
210 ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
212 docdir = get_option('docdir')
214 docdir = datadir / 'doc/systemd'
217 pamlibdir = get_option('pamlibdir')
219 pamlibdir = rootlibdir / 'security'
222 pamconfdir = get_option('pamconfdir')
224 pamconfdir = prefixdir / 'lib/pam.d'
227 libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir')
228 if libcryptsetup_plugins_dir == ''
229 libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup'
232 memory_accounting_default = get_option('memory-accounting-default')
233 status_unit_format_default = get_option('status-unit-format-default')
234 if status_unit_format_default == 'auto'
235 status_unit_format_default = conf.get('BUILD_MODE_DEVELOPER') == 1 ? 'name' : 'description'
238 conf.set_quoted('BINFMT_DIR', binfmtdir)
239 conf.set_quoted('BOOTLIBDIR', bootlibdir)
240 conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database')
241 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
242 conf.set_quoted('DOC_DIR', docdir)
243 conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd')
244 conf.set_quoted('ENVIRONMENT_DIR', environmentdir)
245 conf.set_quoted('INCLUDE_DIR', includedir)
246 conf.set_quoted('LIBDIR', libdir)
247 conf.set_quoted('MODPROBE_DIR', modprobedir)
248 conf.set_quoted('MODULESLOAD_DIR', modulesloaddir)
249 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
250 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent')
251 conf.set_quoted('PREFIX', prefixdir)
252 conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed')
253 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
254 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
255 conf.set_quoted('ROOTBINDIR', rootbindir)
256 conf.set_quoted('ROOTLIBDIR', rootlibdir)
257 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
258 conf.set_quoted('ROOTPREFIX', rootprefixdir)
259 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
260 conf.set_quoted('SYSCONF_DIR', sysconfdir)
261 conf.set_quoted('SYSCTL_DIR', sysctldir)
262 conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl')
263 conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd')
264 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
265 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent')
266 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup')
267 conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export')
268 conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck')
269 conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs')
270 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework')
271 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs')
272 conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import')
273 conf.set_quoted('SYSTEMD_INTEGRITYSETUP_PATH', rootlibexecdir / 'systemd-integritysetup')
274 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map')
275 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map')
276 conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs')
277 conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull')
278 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown')
279 conf.set_quoted('SYSTEMD_TEST_DATA', testdata_dir)
280 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent')
281 conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper')
282 conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork')
283 conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup')
284 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system')
285 conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir)
286 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
287 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
288 conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
289 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
290 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
291 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
292 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
293 conf.set_quoted('SYSUSERS_DIR', sysusersdir)
294 conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
295 conf.set_quoted('USER_TMPFILES_DIR', usertmpfilesdir)
296 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
297 conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
298 conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
299 conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user')
300 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
301 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
302 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
303 conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg')
304 conf.set_quoted('USER_PRESET_DIR', userpresetdir)
305 conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg')
307 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
308 conf.set10('ENABLE_URLIFY', get_option('urlify'))
309 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
310 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
311 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
312 conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default)
314 conf.set('DEFAULT_TIMEOUT_SEC', get_option('default-timeout-sec'))
315 conf.set('DEFAULT_USER_TIMEOUT_SEC', get_option('default-user-timeout-sec'))
316 conf.set('UPDATE_HELPER_USER_TIMEOUT_SEC', get_option('update-helper-user-timeout-sec'))
318 conf.set10('FIRST_BOOT_FULL_PRESET', get_option('first-boot-full-preset'))
320 #####################################################################
322 cc = meson.get_compiler('c')
323 userspace_c_args = []
324 userspace_c_ld_args = []
325 meson_build_sh = find_program('tools/meson-build.sh')
327 want_tests = get_option('tests')
328 slow_tests = want_tests != 'false' and get_option('slow-tests')
329 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
330 install_tests = get_option('install-tests')
332 if add_languages('cpp', required : fuzzer_build)
333 # Used only for tests
334 cxx = meson.get_compiler('cpp')
335 cxx_cmd = ' '.join(cxx.cmd_array())
341 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
342 if fuzzing_engine.found()
343 userspace_c_args += '-fsanitize-coverage=trace-pc-guard,trace-cmp'
344 elif cc.has_argument('-fsanitize=fuzzer-no-link')
345 userspace_c_args += '-fsanitize=fuzzer-no-link'
347 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
350 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
353 # Those generate many false positives, and we do not want to change the code to
355 basic_disabled_warnings = [
356 '-Wno-missing-field-initializers',
357 '-Wno-unused-parameter',
360 possible_common_cc_flags = [
361 '-Warray-bounds', # clang
366 '-Werror=format-signedness',
367 '-Werror=implicit-function-declaration',
368 '-Werror=implicit-int',
369 '-Werror=incompatible-pointer-types',
370 '-Werror=int-conversion',
371 '-Werror=missing-declarations',
372 '-Werror=missing-prototypes',
374 '-Werror=override-init',
375 '-Werror=return-type',
376 '-Werror=shift-count-overflow',
377 '-Werror=shift-overflow=2',
380 # gperf prevents us from enabling this because it does not emit fallthrough
381 # attribute with clang.
382 #'-Wimplicit-fallthrough',
383 '-Wimplicit-fallthrough=5',
386 '-Wmissing-include-dirs',
387 '-Wmissing-noreturn',
389 '-Wold-style-definition',
393 '-Wstrict-aliasing=2',
394 '-Wstrict-prototypes',
395 '-Wsuggest-attribute=noreturn',
398 '-Wzero-length-bounds',
400 # negative arguments are correctly detected starting with meson 0.46.
401 '-Wno-error=#warnings', # clang
402 '-Wno-string-plus-int', # clang
404 '-fdiagnostics-show-option',
407 '-fstack-protector-strong',
408 '-fstrict-flex-arrays',
409 '--param=ssp-buffer-size=4',
412 possible_common_link_flags = [
416 c_args = get_option('c_args')
418 # Our json library does not support -ffinite-math-only, which is enabled by -Ofast or -ffast-math.
419 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)
420 error('-Ofast, -ffast-math, or -ffinite-math-only is specified in c_args.')
423 # Disable -Wmaybe-uninitialized when compiling with -Os/-O1/-O3/etc. There are
424 # too many false positives with gcc >= 8. Effectively, we only test with -O0
425 # and -O2; this should be enough to catch most important cases without too much
426 # busywork. See https://github.com/systemd/systemd/pull/19226.
427 if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
428 cc.version().version_compare('<10') or
433 possible_common_cc_flags += '-Wno-maybe-uninitialized'
436 # Disable -Wno-unused-result with gcc, see
437 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
438 if cc.get_id() == 'gcc'
439 possible_common_cc_flags += '-Wno-unused-result'
442 # --as-needed and --no-undefined are provided by meson by default,
443 # run 'meson configure' to see what is enabled
444 possible_link_flags = [
445 '-Wl,--fatal-warnings',
450 if get_option('b_sanitize') == 'none'
451 possible_link_flags += '-Wl,--warn-common'
454 if cc.get_id() == 'clang'
455 possible_common_cc_flags += [
456 '-Wno-typedef-redefinition',
457 '-Wno-gnu-variable-sized-type-not-at-end',
461 if get_option('mode') == 'release'
462 # We could enable 'pattern' for developer mode, but that can interfere with
463 # valgrind and sanitizer builds. Also, clang does not zero-initialize unions,
464 # breaking some of our code (https://reviews.llvm.org/D68115).
465 possible_common_cc_flags += '-ftrivial-auto-var-init=zero'
468 possible_cc_flags = [
469 '-fno-strict-aliasing',
470 '-fstrict-flex-arrays=1',
471 '-fvisibility=hidden',
474 if get_option('buildtype') != 'debug'
475 possible_cc_flags += [
476 '-ffunction-sections',
480 possible_link_flags += '-Wl,--gc-sections'
483 if get_option('mode') == 'developer'
484 possible_cc_flags += '-fno-omit-frame-pointer'
487 add_project_arguments(
488 cc.get_supported_arguments(
489 basic_disabled_warnings,
490 possible_common_cc_flags
494 add_project_link_arguments(
495 cc.get_supported_link_arguments(possible_common_link_flags),
498 userspace_c_args += cc.get_supported_arguments(possible_cc_flags)
499 userspace_c_ld_args += cc.get_supported_link_arguments(possible_link_flags)
501 have = cc.has_argument('-Wzero-length-bounds')
502 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
506 #include <inttypes.h>
507 typedef uint64_t usec_t;
508 usec_t now(clockid_t clock);
513 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
514 add_project_arguments('-Werror=shadow', language : 'c')
518 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
521 cpp = ' '.join(cc.cmd_array()) + ' -E'
523 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
525 #####################################################################
526 # compilation result tests
528 conf.set('_GNU_SOURCE', true)
529 conf.set('__SANE_USERSPACE_TYPES__', true)
530 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
532 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
533 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
534 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
535 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
536 conf.set('SIZEOF_TIMEX_MEMBER', cc.sizeof('typeof(((struct timex *)0)->freq)', prefix : '#include <sys/timex.h>'))
538 long_max = cc.compute_int(
540 prefix : '#include <limits.h>',
541 guess : 0x7FFFFFFFFFFFFFFF,
542 high : 0x7FFFFFFFFFFFFFFF)
543 assert(long_max > 100000)
544 conf.set_quoted('LONG_MAX_STR', '@0@'.format(long_max))
549 #include <sys/mount.h>
550 #include <sys/stat.h>
553 foreach decl : ['char16_t',
560 # We get -1 if the size cannot be determined
561 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
563 if decl == 'struct mount_attr'
565 want_linux_fs_h = false
567 have = cc.sizeof(decl,
568 prefix : decl_headers + '#include <linux/fs.h>',
569 args : '-D_GNU_SOURCE') > 0
570 want_linux_fs_h = have
574 if decl == 'struct statx'
576 want_linux_stat_h = false
578 have = cc.sizeof(decl,
579 prefix : decl_headers + '#include <linux/stat.h>',
580 args : '-D_GNU_SOURCE') > 0
581 want_linux_stat_h = have
585 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
588 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
589 conf.set10('WANT_LINUX_FS_H', want_linux_fs_h)
591 foreach ident : ['secure_getenv', '__secure_getenv']
592 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
596 ['memfd_create', '''#include <sys/mman.h>'''],
597 ['gettid', '''#include <sys/types.h>
598 #include <unistd.h>'''],
599 ['pivot_root', '''#include <stdlib.h>
600 #include <unistd.h>'''], # no known header declares pivot_root
601 ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get
602 ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set
603 ['name_to_handle_at', '''#include <sys/types.h>
604 #include <sys/stat.h>
605 #include <fcntl.h>'''],
606 ['setns', '''#include <sched.h>'''],
607 ['renameat2', '''#include <stdio.h>
608 #include <fcntl.h>'''],
609 ['kcmp', '''#include <linux/kcmp.h>'''],
610 ['keyctl', '''#include <sys/types.h>
611 #include <keyutils.h>'''],
612 ['copy_file_range', '''#include <sys/syscall.h>
613 #include <unistd.h>'''],
614 ['bpf', '''#include <sys/syscall.h>
615 #include <unistd.h>'''],
616 ['statx', '''#include <sys/types.h>
617 #include <sys/stat.h>
618 #include <unistd.h>'''],
619 ['explicit_bzero' , '''#include <string.h>'''],
620 ['reallocarray', '''#include <stdlib.h>'''],
621 ['set_mempolicy', '''#include <stdlib.h>
622 #include <unistd.h>'''],
623 ['get_mempolicy', '''#include <stdlib.h>
624 #include <unistd.h>'''],
625 ['pidfd_send_signal', '''#include <stdlib.h>
628 #include <sys/wait.h>'''],
629 ['pidfd_open', '''#include <stdlib.h>
632 #include <sys/wait.h>'''],
633 ['rt_sigqueueinfo', '''#include <stdlib.h>
636 #include <sys/wait.h>'''],
637 ['rt_tgsigqueueinfo', '''#include <stdlib.h>
640 #include <sys/wait.h>'''],
641 ['mallinfo', '''#include <malloc.h>'''],
642 ['mallinfo2', '''#include <malloc.h>'''],
643 ['execveat', '''#include <unistd.h>'''],
644 ['close_range', '''#include <unistd.h>'''],
645 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
646 ['mount_setattr', '''#include <sys/mount.h>'''],
647 ['move_mount', '''#include <sys/mount.h>'''],
648 ['open_tree', '''#include <sys/mount.h>'''],
649 ['fsopen', '''#include <sys/mount.h>'''],
650 ['fsconfig', '''#include <sys/mount.h>'''],
651 ['fsmount', '''#include <sys/mount.h>'''],
652 ['getdents64', '''#include <dirent.h>'''],
655 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
656 conf.set10('HAVE_' + ident[0].to_upper(), have)
659 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
660 conf.set10('USE_SYS_RANDOM_H', true)
661 conf.set10('HAVE_GETRANDOM', true)
663 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
664 conf.set10('USE_SYS_RANDOM_H', false)
665 conf.set10('HAVE_GETRANDOM', have)
668 #####################################################################
670 version_tag = get_option('version-tag')
672 vcs_data = configuration_data()
673 vcs_data.set('VCS_TAG', version_tag)
674 version_h = configure_file(configuration : vcs_data,
675 input : 'src/version/version.h.in',
676 output : 'version.h')
679 project_source_root + '/tools/meson-vcs-tag.sh',
681 meson.project_version()]
684 input : 'src/version/version.h.in',
685 output : 'version.h',
689 versiondep = declare_dependency(
691 include_directories : include_directories('.'))
693 shared_lib_tag = get_option('shared-lib-tag')
694 if shared_lib_tag == ''
695 shared_lib_tag = meson.project_version()
698 sh = find_program('sh')
699 echo = find_program('echo')
700 sed = find_program('sed')
701 awk = find_program('awk')
702 stat = find_program('stat')
703 ln = find_program('ln')
704 git = find_program('git', required : false)
705 env = find_program('env')
706 rsync = find_program('rsync', required : false)
707 diff = find_program('diff')
708 find = find_program('find')
709 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
711 mkdir_p = 'mkdir -p $DESTDIR/@0@'
713 # If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
714 # /usr/sbin, /sbin, and fall back to the default from middle column.
715 progs = [['quotaon', '/usr/sbin/quotaon' ],
716 ['quotacheck', '/usr/sbin/quotacheck' ],
717 ['kmod', '/usr/bin/kmod' ],
718 ['kexec', '/usr/sbin/kexec' ],
719 ['sulogin', '/usr/sbin/sulogin' ],
720 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
721 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
722 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
723 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
724 ['nologin', '/usr/sbin/nologin', ],
727 path = get_option(prog[0] + '-path')
729 message('Using @1@ for @0@'.format(prog[0], path))
731 exe = find_program(prog[0],
732 '/usr/sbin/' + prog[0],
735 path = exe.found() ? exe.path() : prog[1]
737 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
738 conf.set_quoted(name, path)
741 conf.set_quoted('TELINIT', get_option('telinit-path'))
743 if run_command(ln, '--relative', '--help', check : false).returncode() != 0
744 error('ln does not support --relative (added in coreutils 8.16)')
747 ############################################################
749 gperf = find_program('gperf')
751 gperf_test_format = '''
753 const char * in_word_set(const char *, @0@);
756 gperf_snippet = run_command(sh, '-c', 'echo foo,bar | "$1" -L ANSI-C', '_', gperf,
758 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
759 if cc.compiles(gperf_test)
760 gperf_len_type = 'size_t'
762 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
763 if cc.compiles(gperf_test)
764 gperf_len_type = 'unsigned'
766 error('unable to determine gperf len type')
769 message('gperf len type is @0@'.format(gperf_len_type))
770 conf.set('GPERF_LEN_TYPE', gperf_len_type,
771 description : 'The type of gperf "len" parameter')
773 ############################################################
775 if not cc.has_header('sys/capability.h')
776 error('POSIX caps headers not found')
778 foreach header : ['crypt.h',
780 'linux/vm_sockets.h',
783 'valgrind/memcheck.h',
784 'valgrind/valgrind.h',
785 'linux/time_types.h',
789 conf.set10('HAVE_' + header.underscorify().to_upper(),
790 cc.has_header(header))
793 ############################################################
795 fallback_hostname = get_option('fallback-hostname')
796 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
797 error('Invalid fallback-hostname configuration')
798 # A more extensive test is done in test-hostname-util. Let's catch
799 # the most obvious errors here so we don't fail with an assert later.
801 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
803 default_hierarchy = get_option('default-hierarchy')
804 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
805 description : 'default cgroup hierarchy as string')
806 if default_hierarchy == 'legacy'
807 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
808 elif default_hierarchy == 'hybrid'
809 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
811 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
814 extra_net_naming_schemes = []
815 extra_net_naming_map = []
816 foreach scheme: get_option('extra-net-naming-schemes').split(',')
818 name = scheme.split('=')[0]
819 value = scheme.split('=')[1]
820 NAME = name.underscorify().to_upper()
822 foreach field: value.split('+')
823 VALUE += 'NAMING_' + field.underscorify().to_upper()
825 extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE))
826 extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME)
829 conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes))
830 conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map))
832 default_net_naming_scheme = get_option('default-net-naming-scheme')
833 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
834 if default_net_naming_scheme != 'latest'
835 conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST',
836 'NAMING_' + default_net_naming_scheme.underscorify().to_upper())
839 time_epoch = get_option('time-epoch')
841 time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check : true).stdout().strip()
842 if time_epoch == '' and git.found() and fs.is_dir('.git')
843 # If we're in a git repository, use the creation time of the latest git tag.
844 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags',
846 if latest_tag.returncode() == 0
847 time_epoch = run_command(
848 git, 'log', '--no-show-signature', '-1', '--format=%at',
849 latest_tag.stdout().strip(),
850 check : false).stdout()
855 time_epoch = run_command(stat, '-c', '%Y', NEWS,
856 check : true).stdout()
858 time_epoch = time_epoch.strip().to_int()
860 conf.set('TIME_EPOCH', time_epoch)
862 conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max'))
864 default_user_shell = get_option('default-user-shell')
865 conf.set_quoted('DEFAULT_USER_SHELL', default_user_shell)
866 conf.set_quoted('DEFAULT_USER_SHELL_NAME', fs.name(default_user_shell))
868 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
869 ['system-uid-max', 'SYS_UID_MAX', 999],
870 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
871 ['system-gid-max', 'SYS_GID_MAX', 999]]
872 v = get_option(tuple[0])
876 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
878 check : false).stdout().strip()
885 conf.set(tuple[0].underscorify().to_upper(), v)
887 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
888 error('Invalid uid allocation range')
890 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
891 error('Invalid gid allocation range')
894 dynamic_uid_min = get_option('dynamic-uid-min')
895 dynamic_uid_max = get_option('dynamic-uid-max')
896 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
897 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
899 container_uid_base_min = get_option('container-uid-base-min')
900 container_uid_base_max = get_option('container-uid-base-max')
901 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
902 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
904 nobody_user = get_option('nobody-user')
905 nobody_group = get_option('nobody-group')
907 if not meson.is_cross_build()
908 getent_result = run_command('getent', 'passwd', '65534', check : false)
909 if getent_result.returncode() == 0
910 name = getent_result.stdout().split(':')[0]
911 if name != nobody_user
913 '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) +
914 'Your build will result in an user table setup that is incompatible with the local system.')
917 id_result = run_command('id', '-u', nobody_user, check : false)
918 if id_result.returncode() == 0
919 id = id_result.stdout().strip().to_int()
922 '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) +
923 'Your build will result in an user table setup that is incompatible with the local system.')
927 getent_result = run_command('getent', 'group', '65534', check : false)
928 if getent_result.returncode() == 0
929 name = getent_result.stdout().split(':')[0]
930 if name != nobody_group
932 '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) +
933 'Your build will result in an group table setup that is incompatible with the local system.')
936 id_result = run_command('id', '-g', nobody_group, check : false)
937 if id_result.returncode() == 0
938 id = id_result.stdout().strip().to_int()
941 '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) +
942 'Your build will result in an group table setup that is incompatible with the local system.')
946 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
948 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
949 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
952 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
953 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
956 foreach option : ['adm-gid',
973 'systemd-journal-gid',
974 'systemd-network-uid',
975 'systemd-resolve-uid',
976 'systemd-timesync-uid']
977 name = option.underscorify().to_upper()
978 val = get_option(option)
980 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
981 conf.set(name, val > 0 ? val : '-')
983 static_ugids += '@0@:@1@'.format(option, val)
987 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
988 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
990 dev_kvm_mode = get_option('dev-kvm-mode')
991 conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation
992 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
993 group_render_mode = get_option('group-render-mode')
994 conf.set_quoted('GROUP_RENDER_MODE', group_render_mode)
995 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
997 kill_user_processes = get_option('default-kill-user-processes')
998 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
1000 dns_servers = get_option('dns-servers')
1001 conf.set_quoted('DNS_SERVERS', dns_servers)
1003 ntp_servers = get_option('ntp-servers')
1004 conf.set_quoted('NTP_SERVERS', ntp_servers)
1006 default_locale = get_option('default-locale')
1007 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
1009 nspawn_locale = get_option('nspawn-locale')
1010 conf.set_quoted('SYSTEMD_NSPAWN_LOCALE', nspawn_locale)
1012 default_keymap = get_option('default-keymap')
1013 conf.set_quoted('SYSTEMD_DEFAULT_KEYMAP', default_keymap)
1015 localegen_path = get_option('localegen-path')
1016 if localegen_path != ''
1017 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
1019 conf.set10('HAVE_LOCALEGEN', localegen_path != '')
1021 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
1023 service_watchdog = get_option('service-watchdog')
1024 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
1025 conf.set_quoted('SERVICE_WATCHDOG', watchdog_value)
1027 conf.set_quoted('SUSHELL', get_option('debug-shell'))
1028 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
1030 enable_debug_hashmap = false
1031 enable_debug_mmap_cache = false
1032 enable_debug_siphash = false
1033 foreach name : get_option('debug-extra')
1034 if name == 'hashmap'
1035 enable_debug_hashmap = true
1036 elif name == 'mmap-cache'
1037 enable_debug_mmap_cache = true
1038 elif name == 'siphash'
1039 enable_debug_siphash = true
1041 message('unknown debug option "@0@", ignoring'.format(name))
1044 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
1045 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
1046 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
1047 conf.set10('LOG_TRACE', get_option('log-trace'))
1049 default_user_path = get_option('user-path')
1050 if default_user_path != ''
1051 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
1055 #####################################################################
1057 threads = dependency('threads')
1058 librt = cc.find_library('rt')
1059 libm = cc.find_library('m')
1060 libdl = cc.find_library('dl')
1061 libcrypt = cc.find_library('crypt')
1063 # On some architectures, libatomic is required. But on some installations,
1064 # it is found, but actual linking fails. So let's try to use it opportunistically.
1065 # If it is installed, but not needed, it will be dropped because of --as-needed.
1066 if cc.links('''int main(int argc, char **argv) { return 0; }''',
1069 libatomic = declare_dependency(link_args : '-latomic')
1074 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
1076 ['crypt_ra', crypt_header],
1077 ['crypt_preferred_method', crypt_header],
1078 ['crypt_gensalt_ra', crypt_header]]
1080 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
1081 dependencies : libcrypt)
1082 conf.set10('HAVE_' + ident[0].to_upper(), have)
1085 libcap = dependency('libcap', required : false)
1086 if not libcap.found()
1087 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
1088 libcap = cc.find_library('cap')
1091 want_bpf_framework = get_option('bpf-framework')
1092 bpf_compiler = get_option('bpf-compiler')
1093 bpf_framework_required = want_bpf_framework == 'true'
1095 libbpf_version_requirement = '>= 0.1.0'
1096 if bpf_compiler == 'gcc'
1097 libbpf_version_requirement = '>= 1.0.0'
1099 libbpf = dependency('libbpf', required : bpf_framework_required, version : libbpf_version_requirement)
1100 conf.set10('HAVE_LIBBPF', libbpf.found())
1102 bpftool_strip_version_requirement = '>= 5.13.0'
1103 if bpf_compiler == 'gcc'
1104 bpftool_strip_version_requirement = '>= 7.0.0'
1107 if want_bpf_framework == 'false' or not libbpf.found() or skip_deps
1108 conf.set10('BPF_FRAMEWORK', false)
1111 clang_supports_bpf = false
1112 bpf_gcc_found = false
1113 bpftool_strip = false
1116 if bpf_compiler == 'clang'
1117 # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
1118 # (like clang-10/llvm-strip-10)
1119 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')
1120 r = find_program('clang', required : bpf_framework_required, version : '>= 10.0.0')
1121 clang_found = r.found()
1127 clang = cc.cmd_array()
1131 # Check if 'clang -target bpf' is supported.
1132 clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
1134 elif bpf_compiler == 'gcc'
1135 warning('GCC BPF Compiler support is experimental and not recommended.')
1136 bpf_gcc = find_program('bpf-gcc',
1138 version : '>= 12.1.0')
1139 bpf_gcc_found = bpf_gcc.found()
1142 if clang_supports_bpf or bpf_gcc_found
1143 # Debian installs this in /usr/sbin/ which is not in $PATH.
1144 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1145 # We use 'bpftool gen object' subcommand for bpftool strip, it was added by d80b2fcbe0a023619e0fc73112f2a02c2662f6ab (v5.13).
1146 bpftool_strip_required = bpf_framework_required and bpf_compiler == 'gcc'
1147 bpftool = find_program('bpftool',
1148 '/usr/sbin/bpftool',
1149 required : bpftool_strip_required,
1150 version : bpftool_strip_version_requirement)
1153 bpftool_strip = true
1155 elif bpf_compiler == 'clang'
1156 # We require the 'bpftool gen skeleton' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
1157 bpftool = find_program('bpftool',
1158 '/usr/sbin/bpftool',
1159 required : bpf_framework_required,
1160 version : '>= 5.6.0')
1163 # We use `llvm-strip` as a fallback if `bpftool gen object` strip support is not available.
1164 if not bpftool_strip and bpftool.found() and clang_supports_bpf
1165 if not meson.is_cross_build()
1166 llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
1167 check : true).stdout().strip()
1169 llvm_strip_bin = 'llvm-strip'
1171 llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
1172 deps_found = llvm_strip.found()
1176 # Can build BPF program from source code in restricted C
1177 conf.set10('BPF_FRAMEWORK', deps_found)
1180 libmount = dependency('mount',
1181 version : fuzzer_build ? '>= 0' : '>= 2.30')
1183 want_libfdisk = get_option('fdisk')
1184 if want_libfdisk != 'false' and not skip_deps
1185 libfdisk = dependency('fdisk',
1186 version : '>= 2.32',
1187 required : want_libfdisk == 'true')
1188 have = libfdisk.found()
1193 conf.set10('HAVE_LIBFDISK', have)
1195 want_pwquality = get_option('pwquality')
1196 if want_pwquality != 'false' and not skip_deps
1197 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1198 have = libpwquality.found()
1203 conf.set10('HAVE_PWQUALITY', have)
1205 want_seccomp = get_option('seccomp')
1206 if want_seccomp != 'false' and not skip_deps
1207 libseccomp = dependency('libseccomp',
1208 version : '>= 2.3.1',
1209 required : want_seccomp == 'true')
1210 have = libseccomp.found()
1215 conf.set10('HAVE_SECCOMP', have)
1217 want_selinux = get_option('selinux')
1218 if want_selinux != 'false' and not skip_deps
1219 libselinux = dependency('libselinux',
1220 version : '>= 2.1.9',
1221 required : want_selinux == 'true')
1222 have = libselinux.found()
1227 conf.set10('HAVE_SELINUX', have)
1229 want_apparmor = get_option('apparmor')
1230 if want_apparmor != 'false' and not skip_deps
1231 libapparmor = dependency('libapparmor',
1232 version : '>= 2.13',
1233 required : want_apparmor == 'true')
1234 have = libapparmor.found()
1239 conf.set10('HAVE_APPARMOR', have)
1241 have = get_option('smack') and get_option('smack-run-label') != ''
1242 conf.set10('HAVE_SMACK_RUN_LABEL', have)
1244 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1247 have = get_option('smack') and get_option('smack-default-process-label') != ''
1249 conf.set_quoted('SMACK_DEFAULT_PROCESS_LABEL', get_option('smack-default-process-label'))
1252 want_polkit = get_option('polkit')
1253 install_polkit = false
1254 install_polkit_pkla = false
1255 if want_polkit != 'false' and not skip_deps
1256 install_polkit = true
1258 libpolkit = dependency('polkit-gobject-1',
1260 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1261 message('Old polkit detected, will install pkla files')
1262 install_polkit_pkla = true
1265 conf.set10('ENABLE_POLKIT', install_polkit)
1267 want_acl = get_option('acl')
1268 if want_acl != 'false' and not skip_deps
1269 libacl = cc.find_library('acl', required : want_acl == 'true')
1270 have = libacl.found()
1275 conf.set10('HAVE_ACL', have)
1277 want_audit = get_option('audit')
1278 if want_audit != 'false' and not skip_deps
1279 libaudit = dependency('audit', required : want_audit == 'true')
1280 have = libaudit.found()
1285 conf.set10('HAVE_AUDIT', have)
1287 want_blkid = get_option('blkid')
1288 if want_blkid != 'false' and not skip_deps
1289 libblkid = dependency('blkid', required : want_blkid == 'true')
1290 have = libblkid.found()
1292 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1293 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1298 conf.set10('HAVE_BLKID', have)
1300 want_kmod = get_option('kmod')
1301 if want_kmod != 'false' and not skip_deps
1302 libkmod = dependency('libkmod',
1304 required : want_kmod == 'true')
1305 have = libkmod.found()
1310 conf.set10('HAVE_KMOD', have)
1312 want_xenctrl = get_option('xenctrl')
1313 if want_xenctrl != 'false' and not skip_deps
1314 libxenctrl = dependency('xencontrol',
1316 required : want_xenctrl == 'true')
1317 have = libxenctrl.found()
1322 conf.set10('HAVE_XENCTRL', have)
1324 want_pam = get_option('pam')
1325 if want_pam != 'false' and not skip_deps
1326 libpam = cc.find_library('pam', required : want_pam == 'true')
1327 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1328 have = libpam.found() and libpam_misc.found()
1334 conf.set10('HAVE_PAM', have)
1336 want_microhttpd = get_option('microhttpd')
1337 if want_microhttpd != 'false' and not skip_deps
1338 libmicrohttpd = dependency('libmicrohttpd',
1339 version : '>= 0.9.33',
1340 required : want_microhttpd == 'true')
1341 have = libmicrohttpd.found()
1346 conf.set10('HAVE_MICROHTTPD', have)
1348 want_libcryptsetup = get_option('libcryptsetup')
1349 want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1351 if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1352 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1355 if want_libcryptsetup != 'false' and not skip_deps
1356 libcryptsetup = dependency('libcryptsetup',
1357 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1358 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
1359 have = libcryptsetup.found()
1361 foreach ident : ['crypt_set_metadata_size',
1362 'crypt_activate_by_signed_key',
1364 'crypt_reencrypt_init_by_passphrase',
1366 'crypt_set_data_offset']
1367 have_ident = have and cc.has_function(
1369 prefix : '#include <libcryptsetup.h>',
1370 dependencies : libcryptsetup)
1371 conf.set10('HAVE_' + ident.to_upper(), have_ident)
1377 conf.set10('HAVE_LIBCRYPTSETUP', have)
1379 if want_libcryptsetup_plugins != 'false' and not skip_deps
1380 have = (cc.has_function(
1381 'crypt_activate_by_token_pin',
1382 prefix : '#include <libcryptsetup.h>',
1383 dependencies : libcryptsetup) and
1385 'crypt_token_external_path',
1386 prefix : '#include <libcryptsetup.h>',
1387 dependencies : libcryptsetup))
1391 conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1393 want_libcurl = get_option('libcurl')
1394 if want_libcurl != 'false' and not skip_deps
1395 libcurl = dependency('libcurl',
1396 version : '>= 7.32.0',
1397 required : want_libcurl == 'true')
1398 have = libcurl.found()
1403 conf.set10('HAVE_LIBCURL', have)
1404 conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
1406 want_libidn = get_option('libidn')
1407 want_libidn2 = get_option('libidn2')
1408 if want_libidn == 'true' and want_libidn2 == 'true'
1409 error('libidn and libidn2 cannot be requested simultaneously')
1412 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1413 libidn = dependency('libidn2',
1414 required : want_libidn2 == 'true')
1415 have = libidn.found()
1420 conf.set10('HAVE_LIBIDN2', have)
1421 if not have and want_libidn != 'false' and not skip_deps
1422 # libidn is used for both libidn and libidn2 objects
1423 libidn = dependency('libidn',
1424 required : want_libidn == 'true')
1425 have = libidn.found()
1429 conf.set10('HAVE_LIBIDN', have)
1431 want_libiptc = get_option('libiptc')
1432 if want_libiptc != 'false' and not skip_deps
1433 libiptc = dependency('libiptc',
1434 required : want_libiptc == 'true')
1435 have = libiptc.found()
1440 conf.set10('HAVE_LIBIPTC', have)
1442 want_qrencode = get_option('qrencode')
1443 if want_qrencode != 'false' and not skip_deps
1444 libqrencode = dependency('libqrencode',
1446 required : want_qrencode == 'true')
1447 have = libqrencode.found()
1452 conf.set10('HAVE_QRENCODE', have)
1454 want_gcrypt = get_option('gcrypt')
1455 if want_gcrypt != 'false' and not skip_deps
1456 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1457 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1458 have = libgcrypt.found() and libgpg_error.found()
1463 # link to neither of the libs if one is not found
1467 conf.set10('HAVE_GCRYPT', have)
1469 want_gnutls = get_option('gnutls')
1470 if want_gnutls != 'false' and not skip_deps
1471 libgnutls = dependency('gnutls',
1472 version : '>= 3.1.4',
1473 required : want_gnutls == 'true')
1474 have = libgnutls.found()
1479 conf.set10('HAVE_GNUTLS', have)
1481 want_openssl = get_option('openssl')
1482 if want_openssl != 'false' and not skip_deps
1483 libopenssl = dependency('openssl',
1484 version : '>= 1.1.0',
1485 required : want_openssl == 'true')
1486 have = libopenssl.found()
1491 conf.set10('HAVE_OPENSSL', have)
1493 want_p11kit = get_option('p11kit')
1494 if want_p11kit != 'false' and not skip_deps
1495 libp11kit = dependency('p11-kit-1',
1496 version : '>= 0.23.3',
1497 required : want_p11kit == 'true')
1498 have = libp11kit.found()
1499 libp11kit_cflags = libp11kit.partial_dependency(includes: true, compile_args: true)
1502 libp11kit_cflags = []
1505 conf.set10('HAVE_P11KIT', have)
1507 want_libfido2 = get_option('libfido2')
1508 if want_libfido2 != 'false' and not skip_deps
1509 if conf.get('HAVE_OPENSSL') == 1
1510 libfido2 = dependency('libfido2',
1511 required : want_libfido2 == 'true')
1512 have = libfido2.found()
1513 elif want_libfido2 == 'true'
1514 error('libfido2=true requires openssl')
1523 conf.set10('HAVE_LIBFIDO2', have)
1525 want_tpm2 = get_option('tpm2')
1526 if want_tpm2 != 'false' and not skip_deps
1527 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1528 required : want_tpm2 == 'true')
1530 have_esys3 = tpm2.version().version_compare('>= 3.0.0')
1536 conf.set10('HAVE_TPM2', have)
1537 conf.set10('HAVE_TSS2_ESYS3', have_esys3)
1539 want_elfutils = get_option('elfutils')
1540 if want_elfutils != 'false' and not skip_deps
1541 libdw = dependency('libdw',
1542 required : want_elfutils == 'true')
1543 have = libdw.found()
1545 # New in elfutils 0.177
1546 conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING',
1547 have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw))
1552 conf.set10('HAVE_ELFUTILS', have)
1554 want_zlib = get_option('zlib')
1555 if want_zlib != 'false' and not skip_deps
1556 libz = dependency('zlib',
1557 required : want_zlib == 'true')
1563 conf.set10('HAVE_ZLIB', have)
1565 want_bzip2 = get_option('bzip2')
1566 if want_bzip2 != 'false' and not skip_deps
1567 libbzip2 = cc.find_library('bz2',
1568 required : want_bzip2 == 'true')
1569 have = libbzip2.found()
1574 conf.set10('HAVE_BZIP2', have)
1576 want_xz = get_option('xz')
1577 if want_xz != 'false' and not skip_deps
1578 libxz = dependency('liblzma',
1579 required : want_xz == 'true')
1580 have_xz = libxz.found()
1585 conf.set10('HAVE_XZ', have_xz)
1587 want_lz4 = get_option('lz4')
1588 if want_lz4 != 'false' and not skip_deps
1589 liblz4 = dependency('liblz4',
1590 version : '>= 1.3.0',
1591 required : want_lz4 == 'true')
1592 have_lz4 = liblz4.found()
1597 conf.set10('HAVE_LZ4', have_lz4)
1599 want_zstd = get_option('zstd')
1600 if want_zstd != 'false' and not skip_deps
1601 libzstd = dependency('libzstd',
1602 required : want_zstd == 'true',
1603 version : '>= 1.4.0')
1604 have_zstd = libzstd.found()
1609 conf.set10('HAVE_ZSTD', have_zstd)
1611 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1613 compression = get_option('default-compression')
1614 if compression == 'auto'
1616 compression = 'zstd'
1622 compression = 'none'
1624 elif compression == 'zstd' and not have_zstd
1625 error('default-compression=zstd requires zstd')
1626 elif compression == 'lz4' and not have_lz4
1627 error('default-compression=lz4 requires lz4')
1628 elif compression == 'xz' and not have_xz
1629 error('default-compression=xz requires xz')
1631 conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper()))
1633 want_xkbcommon = get_option('xkbcommon')
1634 if want_xkbcommon != 'false' and not skip_deps
1635 libxkbcommon = dependency('xkbcommon',
1636 version : '>= 0.3.0',
1637 required : want_xkbcommon == 'true')
1638 have = libxkbcommon.found()
1643 conf.set10('HAVE_XKBCOMMON', have)
1645 want_pcre2 = get_option('pcre2')
1646 if want_pcre2 != 'false' and not skip_deps
1647 libpcre2 = dependency('libpcre2-8',
1648 required : want_pcre2 == 'true')
1649 have = libpcre2.found()
1654 conf.set10('HAVE_PCRE2', have)
1656 want_glib = get_option('glib')
1657 if want_glib != 'false' and not skip_deps
1658 libglib = dependency('glib-2.0',
1659 version : '>= 2.22.0',
1660 required : want_glib == 'true')
1661 libgobject = dependency('gobject-2.0',
1662 version : '>= 2.22.0',
1663 required : want_glib == 'true')
1664 libgio = dependency('gio-2.0',
1665 required : want_glib == 'true')
1666 have = libglib.found() and libgobject.found() and libgio.found()
1673 conf.set10('HAVE_GLIB', have)
1675 want_dbus = get_option('dbus')
1676 if want_dbus != 'false' and not skip_deps
1677 libdbus = dependency('dbus-1',
1678 version : '>= 1.3.2',
1679 required : want_dbus == 'true')
1680 have = libdbus.found()
1685 conf.set10('HAVE_DBUS', have)
1687 dbusdatadir = datadir / 'dbus-1'
1688 if conf.get('HAVE_DBUS') == 1
1689 dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
1692 dbuspolicydir = get_option('dbuspolicydir')
1693 if dbuspolicydir == ''
1694 dbuspolicydir = dbusdatadir / 'system.d'
1697 dbussessionservicedir = get_option('dbussessionservicedir')
1698 if dbussessionservicedir == ''
1699 dbussessionservicedir = dbusdatadir / 'services'
1700 if conf.get('HAVE_DBUS') == 1
1701 dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
1705 dbussystemservicedir = get_option('dbussystemservicedir')
1706 if dbussystemservicedir == ''
1707 dbussystemservicedir = dbusdatadir / 'system-services'
1708 if conf.get('HAVE_DBUS') == 1
1709 dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
1713 dbus_interfaces_dir = get_option('dbus-interfaces-dir')
1714 if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
1715 if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
1716 dbus_interfaces_dir = 'no'
1717 warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
1719 dbus_interfaces_dir = dbusdatadir / 'interfaces'
1720 if conf.get('HAVE_DBUS') == 1
1721 dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
1726 # We support one or the other. If gcrypt is available, we assume it's there to
1727 # be used, and use it in preference.
1728 opt = get_option('cryptolib')
1729 if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1730 error('openssl requested as the default cryptolib, but not available')
1732 conf.set10('PREFER_OPENSSL',
1733 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1734 conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1735 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
1736 lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? [libopenssl] : [libgcrypt, libgpg_error]
1738 dns_over_tls = get_option('dns-over-tls')
1739 if dns_over_tls != 'false'
1740 if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1
1741 error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib')
1744 if dns_over_tls == 'gnutls'
1745 have_openssl = false
1747 have_openssl = conf.get('HAVE_OPENSSL') == 1
1748 if dns_over_tls == 'openssl' and not have_openssl
1749 error('DNS-over-TLS support was requested with openssl, but dependencies are not available')
1752 if dns_over_tls == 'openssl' or have_openssl
1755 have_gnutls = conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0')
1756 if dns_over_tls != 'auto' and not have_gnutls
1757 str = dns_over_tls == 'gnutls' ? ' with gnutls' : ''
1758 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1761 have = have_gnutls or have_openssl
1765 have_openssl = false
1767 conf.set10('ENABLE_DNS_OVER_TLS', have)
1768 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1769 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1771 default_dns_over_tls = get_option('default-dns-over-tls')
1773 default_dns_over_tls = 'no'
1775 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1776 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.')
1777 default_dns_over_tls = 'no'
1779 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1780 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1781 conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
1783 default_mdns = get_option('default-mdns')
1784 conf.set('DEFAULT_MDNS_MODE',
1785 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1786 conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
1788 default_llmnr = get_option('default-llmnr')
1789 conf.set('DEFAULT_LLMNR_MODE',
1790 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1791 conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
1793 want_repart = get_option('repart')
1794 if want_repart != 'false'
1795 have = conf.get('HAVE_LIBFDISK') == 1
1796 if want_repart == 'true' and not have
1797 error('repart support was requested, but dependencies are not available')
1802 conf.set10('ENABLE_REPART', have)
1804 default_dnssec = get_option('default-dnssec')
1806 default_dnssec = 'no'
1808 if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0
1809 message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.')
1810 default_dnssec = 'no'
1812 conf.set('DEFAULT_DNSSEC_MODE',
1813 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1814 conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1816 want_sysupdate = get_option('sysupdate')
1817 if want_sysupdate != 'false'
1818 have = (conf.get('HAVE_OPENSSL') == 1 and
1819 conf.get('HAVE_LIBFDISK') == 1)
1820 if want_sysupdate == 'true' and not have
1821 error('sysupdate support was requested, but dependencies are not available')
1826 conf.set10('ENABLE_SYSUPDATE', have)
1828 want_importd = get_option('importd')
1829 if want_importd != 'false'
1830 have = (conf.get('HAVE_LIBCURL') == 1 and
1831 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
1832 conf.get('HAVE_ZLIB') == 1 and
1833 conf.get('HAVE_XZ') == 1)
1834 if want_importd == 'true' and not have
1835 error('importd support was requested, but dependencies are not available')
1840 conf.set10('ENABLE_IMPORTD', have)
1842 want_kernel_install = get_option('kernel-install')
1843 conf.set10('ENABLE_KERNEL_INSTALL', want_kernel_install)
1845 want_homed = get_option('homed')
1846 if want_homed != 'false'
1847 have = (conf.get('HAVE_OPENSSL') == 1 and
1848 conf.get('HAVE_LIBFDISK') == 1 and
1849 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1850 if want_homed == 'true' and not have
1851 error('homed support was requested, but dependencies are not available')
1856 conf.set10('ENABLE_HOMED', have)
1858 have = have and conf.get('HAVE_PAM') == 1
1859 conf.set10('ENABLE_PAM_HOME', have)
1861 have = get_option('oomd')
1862 conf.set10('ENABLE_OOMD', have)
1864 want_remote = get_option('remote')
1865 if want_remote != 'false'
1866 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1867 conf.get('HAVE_LIBCURL') == 1]
1868 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1869 # it's possible to build one without the other. Complain only if
1870 # support was explicitly requested. The auxiliary files like sysusers
1871 # config should be installed when any of the programs are built.
1872 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1873 error('remote support was requested, but dependencies are not available')
1875 have = have_deps[0] or have_deps[1]
1879 conf.set10('ENABLE_REMOTE', have)
1881 foreach term : ['analyze',
1884 '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 ############################################################
2175 # binaries that have --help and are intended for use by humans,
2176 # usually, but not always, installed in /bin.
2177 public_programs = []
2179 # D-Bus introspection XML export
2182 # A list of boot stubs. Required for testing of ukify.
2185 basic_includes = include_directories(
2191 libsystemd_includes = [basic_includes, include_directories(
2192 'src/libsystemd/sd-bus',
2193 'src/libsystemd/sd-device',
2194 'src/libsystemd/sd-event',
2195 'src/libsystemd/sd-hwdb',
2196 'src/libsystemd/sd-id128',
2197 'src/libsystemd/sd-journal',
2198 'src/libsystemd/sd-netlink',
2199 'src/libsystemd/sd-network',
2200 'src/libsystemd/sd-resolve')]
2202 includes = [libsystemd_includes, include_directories('src/shared')]
2206 subdir('src/fundamental')
2208 subdir('src/libsystemd')
2209 subdir('src/shared')
2211 subdir('src/libudev')
2212 subdir('src/cryptsetup/cryptsetup-tokens')
2214 alias_target('devel', libsystemd_pc, libudev_pc)
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 ############################################################
2412 # only static linking apart from libdl, to make sure that the
2413 # module is linked to all libraries that it uses.
2414 test_dlopen = executable(
2417 include_directories : includes,
2418 link_with : [libbasic],
2419 dependencies : [libdl,
2421 build_by_default : want_tests != 'false')
2423 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
2424 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
2425 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
2426 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
2428 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
2432 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
2433 version_script_arg = project_source_root / sym
2435 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
2436 if tuple.length() > 2
2437 foreach s : tuple[2]
2438 sources += ['src/nss-@0@/@1@'.format(module, s)]
2442 incs = tuple.length() > 3 ? tuple[3] : includes
2444 nss = shared_library(
2448 include_directories : incs,
2449 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
2450 link_args : ['-Wl,-z,nodelete',
2452 '-Wl,--version-script=' + version_script_arg],
2453 link_with : [libsystemd_static,
2456 dependencies : [librt,
2461 install_tag : 'nss',
2462 install_dir : rootlibdir)
2464 # We cannot use shared_module because it does not support version suffix.
2465 # Unfortunately shared_library insists on creating the symlink…
2466 meson.add_install_script('sh', '-c',
2467 'rm $DESTDIR@0@/libnss_@1@.so'
2468 .format(rootlibdir, module),
2472 if want_tests != 'false'
2473 test('dlopen-nss_' + module,
2475 # path to dlopen must include a slash
2476 args : nss.full_path(),
2482 ############################################################
2487 include_directories : includes,
2488 link_with : [libcore,
2490 dependencies : [libseccomp,
2493 install_rpath : rootpkglibdir,
2495 install_dir : rootlibexecdir)
2496 dbus_programs += exe
2497 public_programs += exe
2499 meson.add_install_script(meson_make_symlink,
2500 rootlibexecdir / 'systemd',
2501 rootsbindir / 'init')
2505 systemd_analyze_sources,
2506 include_directories : core_includes,
2507 link_with : [libcore,
2509 dependencies : [libseccomp,
2512 install_rpath : rootpkglibdir,
2513 install : conf.get('ENABLE_ANALYZE') == 1)
2514 if conf.get('ENABLE_ANALYZE') == 1
2515 public_programs += exe
2518 if want_tests != 'false'
2519 test('test-compare-versions',
2520 test_compare_versions_sh,
2521 args : exe.full_path())
2526 systemd_journald_sources,
2527 include_directories : includes,
2528 link_with : [libjournal_core,
2530 dependencies : [liblz4,
2537 install_rpath : rootpkglibdir,
2539 install_dir : rootlibexecdir)
2541 public_programs += executable(
2543 systemd_cat_sources,
2544 include_directories : includes,
2545 link_with : [libjournal_core,
2547 dependencies : [threads,
2550 install_rpath : rootpkglibdir,
2553 if get_option('link-journalctl-shared')
2554 journalctl_link_with = [libshared]
2556 journalctl_link_with = [libsystemd_static,
2561 public_programs += executable(
2564 include_directories : includes,
2565 link_with : [journalctl_link_with],
2566 dependencies : [libdl,
2573 install_rpath : rootpkglibdir,
2575 install_dir : rootbindir)
2578 'systemd-getty-generator',
2579 'src/getty-generator/getty-generator.c',
2580 include_directories : includes,
2581 link_with : [libshared],
2582 dependencies : userspace,
2583 install_rpath : rootpkglibdir,
2585 install_dir : systemgeneratordir)
2588 'systemd-debug-generator',
2589 'src/debug-generator/debug-generator.c',
2590 include_directories : includes,
2591 link_with : [libshared],
2592 dependencies : userspace,
2593 install_rpath : rootpkglibdir,
2595 install_dir : systemgeneratordir)
2598 'systemd-run-generator',
2599 'src/run-generator/run-generator.c',
2600 include_directories : includes,
2601 link_with : [libshared],
2602 dependencies : userspace,
2603 install_rpath : rootpkglibdir,
2605 install_dir : systemgeneratordir)
2608 'systemd-fstab-generator',
2609 'src/fstab-generator/fstab-generator.c',
2610 include_directories : includes,
2611 link_with : [libshared],
2612 dependencies : userspace,
2613 install_rpath : rootpkglibdir,
2615 install_dir : systemgeneratordir)
2617 meson.add_install_script(meson_make_symlink,
2618 systemgeneratordir / 'systemd-fstab-generator',
2619 rootlibexecdir / 'systemd-sysroot-fstab-check')
2621 if want_tests != 'false'
2622 test('test-fstab-generator',
2623 test_fstab_generator_sh,
2624 # https://github.com/mesonbuild/meson/issues/2681
2625 args : exe.full_path(),
2629 if conf.get('ENABLE_ENVIRONMENT_D') == 1
2631 '30-systemd-environment-d-generator',
2632 'src/environment-d-generator/environment-d-generator.c',
2633 include_directories : includes,
2634 link_with : [libshared],
2635 dependencies : userspace,
2636 install_rpath : rootpkglibdir,
2638 install_dir : userenvgeneratordir)
2640 meson.add_install_script(meson_make_symlink,
2641 sysconfdir / 'environment',
2642 environmentdir / '99-environment.conf')
2645 if conf.get('ENABLE_HIBERNATE') == 1
2647 'systemd-hibernate-resume-generator',
2648 'src/hibernate-resume/hibernate-resume-generator.c',
2649 include_directories : includes,
2650 link_with : [libshared],
2651 dependencies : userspace,
2652 install_rpath : rootpkglibdir,
2654 install_dir : systemgeneratordir)
2657 'systemd-hibernate-resume',
2658 'src/hibernate-resume/hibernate-resume.c',
2659 include_directories : includes,
2660 link_with : [libshared],
2661 dependencies : userspace,
2662 install_rpath : rootpkglibdir,
2664 install_dir : rootlibexecdir)
2667 if conf.get('HAVE_BLKID') == 1
2669 'systemd-gpt-auto-generator',
2670 'src/gpt-auto-generator/gpt-auto-generator.c',
2671 include_directories : includes,
2672 link_with : [libshared],
2673 dependencies : [libblkid,
2675 install_rpath : rootpkglibdir,
2677 install_dir : systemgeneratordir)
2679 public_programs += executable(
2681 'src/dissect/dissect.c',
2682 include_directories : includes,
2683 link_with : [libshared],
2684 dependencies : [userspace,
2686 install_rpath : rootpkglibdir,
2689 meson.add_install_script(meson_make_symlink,
2690 bindir / 'systemd-dissect',
2691 rootsbindir / 'mount.ddi')
2694 if conf.get('ENABLE_RESOLVE') == 1
2695 dbus_programs += executable(
2697 systemd_resolved_sources,
2698 include_directories : resolve_includes,
2699 link_with : [libshared,
2701 libsystemd_resolve_core],
2702 dependencies : [systemd_resolved_dependencies,
2704 install_rpath : rootpkglibdir,
2706 install_dir : rootlibexecdir)
2708 public_programs += executable(
2711 include_directories : includes,
2712 link_with : [libshared,
2714 libsystemd_resolve_core],
2715 dependencies : [lib_openssl_or_gcrypt,
2721 install_rpath : rootpkglibdir,
2724 meson.add_install_script(meson_make_symlink,
2725 bindir / 'resolvectl',
2726 rootsbindir / 'resolvconf')
2728 meson.add_install_script(meson_make_symlink,
2729 bindir / 'resolvectl',
2730 bindir / 'systemd-resolve')
2733 if conf.get('ENABLE_LOGIND') == 1
2734 dbus_programs += executable(
2736 systemd_logind_sources,
2737 include_directories : includes,
2738 link_with : [liblogind_core,
2740 dependencies : [libacl,
2744 install_rpath : rootpkglibdir,
2746 install_dir : rootlibexecdir)
2748 public_programs += executable(
2751 include_directories : includes,
2752 link_with : [libshared],
2753 dependencies : [liblz4,
2759 install_rpath : rootpkglibdir,
2761 install_dir : rootbindir)
2763 public_programs += executable(
2765 'src/login/inhibit.c',
2766 include_directories : includes,
2767 link_with : [libshared],
2768 dependencies : [userspace,
2770 install_rpath : rootpkglibdir,
2772 install_dir : rootbindir)
2774 if conf.get('HAVE_PAM') == 1
2775 version_script_arg = project_source_root / pam_systemd_sym
2776 pam_systemd = shared_library(
2780 include_directories : includes,
2781 link_args : ['-shared',
2782 '-Wl,--version-script=' + version_script_arg],
2783 link_with : [libsystemd_static,
2785 dependencies : [libpam_misc,
2790 link_depends : pam_systemd_sym,
2792 install_tag : 'pam',
2793 install_dir : pamlibdir)
2795 if want_tests != 'false'
2796 test('dlopen-pam_systemd',
2798 # path to dlopen must include a slash
2799 args : pam_systemd.full_path(),
2800 depends : pam_systemd)
2805 'systemd-user-runtime-dir',
2806 user_runtime_dir_sources,
2807 include_directories : includes,
2808 link_with : [libshared],
2809 dependencies : userspace,
2810 install_rpath : rootpkglibdir,
2812 install_dir : rootlibexecdir)
2815 if conf.get('HAVE_PAM') == 1
2817 'systemd-user-sessions',
2818 'src/user-sessions/user-sessions.c',
2819 include_directories : includes,
2820 link_with : [libshared],
2821 dependencies : userspace,
2822 install_rpath : rootpkglibdir,
2824 install_dir : rootlibexecdir)
2827 if conf.get('HAVE_BLKID') == 1 and conf.get('ENABLE_BOOTLOADER') == 1
2828 if get_option('link-boot-shared')
2829 boot_link_with = [libshared]
2831 boot_link_with = [libsystemd_static, libshared_static]
2837 include_directories : includes,
2838 link_with : [boot_link_with],
2839 dependencies : [libblkid,
2842 install_rpath : rootpkglibdir,
2844 public_programs += exe
2846 if want_tests != 'false'
2847 test('test-bootctl-json',
2848 test_bootctl_json_sh,
2849 args : exe.full_path(),
2853 public_programs += executable(
2854 'systemd-bless-boot',
2855 'src/boot/bless-boot.c',
2856 include_directories : includes,
2857 link_with : [boot_link_with],
2858 dependencies : [libblkid,
2861 install_rpath : rootpkglibdir,
2863 install_dir : rootlibexecdir)
2866 'systemd-bless-boot-generator',
2867 'src/boot/bless-boot-generator.c',
2868 include_directories : includes,
2869 link_with : [boot_link_with],
2870 dependencies : userspace,
2871 install_rpath : rootpkglibdir,
2873 install_dir : systemgeneratordir)
2875 if conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_TPM2') == 1
2878 'src/boot/measure.c',
2879 include_directories : includes,
2880 link_with : [libshared],
2881 dependencies : [libopenssl,
2884 install_rpath : rootpkglibdir,
2886 install_dir : rootlibexecdir)
2889 'src/boot/pcrphase.c',
2890 include_directories : includes,
2891 link_with : [libshared],
2892 dependencies : [libblkid,
2897 install_rpath : rootpkglibdir,
2899 install_dir : rootlibexecdir)
2904 'systemd-boot-check-no-failures',
2905 'src/boot/boot-check-no-failures.c',
2906 include_directories : includes,
2907 link_with : [libshared],
2908 dependencies : [libblkid,
2911 install_rpath : rootpkglibdir,
2913 install_dir : rootlibexecdir)
2915 public_programs += executable(
2916 'systemd-socket-activate',
2917 'src/activate/activate.c',
2918 include_directories : includes,
2919 link_with : [libshared],
2920 dependencies : [threads,
2923 install_rpath : rootpkglibdir,
2926 systemctl = executable(
2929 include_directories : includes,
2930 link_with : systemctl_link_with,
2931 dependencies : [libcap,
2939 install_rpath : rootpkglibdir,
2941 install_dir : rootbindir)
2942 public_programs += systemctl
2944 if conf.get('ENABLE_PORTABLED') == 1
2945 if get_option('link-portabled-shared')
2946 portabled_link_with = [libshared]
2948 portabled_link_with = [libsystemd_static,
2952 dbus_programs += executable(
2953 'systemd-portabled',
2954 systemd_portabled_sources,
2955 include_directories : includes,
2956 link_with : [portabled_link_with],
2957 dependencies : [libselinux,
2961 install_rpath : rootpkglibdir,
2963 install_dir : rootlibexecdir)
2965 public_programs += executable(
2967 'src/portable/portablectl.c',
2968 include_directories : includes,
2969 link_with : [portabled_link_with],
2970 dependencies : [threads,
2973 install_rpath : rootpkglibdir,
2975 install_dir : rootbindir)
2978 if conf.get('ENABLE_SYSEXT') == 1
2979 public_programs += executable(
2981 systemd_sysext_sources,
2982 include_directories : includes,
2983 link_with : [libshared],
2984 dependencies : [userspace,
2986 install_rpath : rootpkglibdir,
2988 install_dir : rootbindir)
2991 if conf.get('ENABLE_USERDB') == 1
2994 systemd_userwork_sources,
2995 include_directories : includes,
2996 link_with : [libshared],
2997 dependencies : [threads,
3000 install_rpath : rootpkglibdir,
3002 install_dir : rootlibexecdir)
3006 systemd_userdbd_sources,
3007 include_directories : includes,
3008 link_with : [libshared],
3009 dependencies : [threads,
3012 install_rpath : rootpkglibdir,
3014 install_dir : rootlibexecdir)
3016 public_programs += executable(
3019 include_directories : includes,
3020 link_with : [libshared],
3021 dependencies : [threads,
3024 install_rpath : rootpkglibdir,
3028 if conf.get('ENABLE_HOMED') == 1
3031 systemd_homework_sources,
3032 include_directories : includes,
3033 link_with : [libshared,
3035 dependencies : [libblkid,
3043 install_rpath : rootpkglibdir,
3045 install_dir : rootlibexecdir)
3047 dbus_programs += executable(
3049 systemd_homed_sources,
3050 include_directories : home_includes,
3051 link_with : [libshared],
3052 dependencies : [libcrypt,
3058 install_rpath : rootpkglibdir,
3060 install_dir : rootlibexecdir)
3062 public_programs += executable(
3065 include_directories : includes,
3066 link_with : [libshared],
3067 dependencies : [libcrypt,
3074 install_rpath : rootpkglibdir,
3077 if conf.get('HAVE_PAM') == 1
3078 version_script_arg = project_source_root / pam_systemd_home_sym
3079 pam_systemd_home = shared_library(
3083 include_directories : includes,
3084 link_args : ['-shared',
3085 '-Wl,--version-script=' + version_script_arg],
3086 link_with : [libsystemd_static,
3088 dependencies : [libcrypt,
3094 link_depends : pam_systemd_home_sym,
3096 install_tag : 'pam',
3097 install_dir : pamlibdir)
3099 if want_tests != 'false'
3100 test('dlopen-pam_systemd_home',
3102 # path to dlopen must include a slash
3103 args : pam_systemd_home.full_path(),
3104 depends : pam_systemd_home)
3109 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
3110 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
3111 meson.add_install_script(meson_make_symlink,
3112 rootbindir / 'systemctl',
3113 rootsbindir / alias)
3116 meson.add_install_script(meson_make_symlink,
3117 rootbindir / 'udevadm',
3118 rootlibexecdir / 'systemd-udevd')
3120 if conf.get('ENABLE_BACKLIGHT') == 1
3122 'systemd-backlight',
3123 'src/backlight/backlight.c',
3124 include_directories : includes,
3125 link_with : [libshared],
3126 dependencies : userspace,
3127 install_rpath : rootpkglibdir,
3129 install_dir : rootlibexecdir)
3132 if conf.get('ENABLE_RFKILL') == 1
3135 'src/rfkill/rfkill.c',
3136 include_directories : includes,
3137 link_with : [libshared],
3138 dependencies : userspace,
3139 install_rpath : rootpkglibdir,
3141 install_dir : rootlibexecdir)
3145 'systemd-system-update-generator',
3146 'src/system-update-generator/system-update-generator.c',
3147 include_directories : includes,
3148 link_with : [libshared],
3149 dependencies : userspace,
3150 install_rpath : rootpkglibdir,
3152 install_dir : systemgeneratordir)
3154 if conf.get('HAVE_LIBCRYPTSETUP') == 1
3156 'systemd-cryptsetup',
3157 systemd_cryptsetup_sources,
3158 include_directories : includes,
3159 link_with : [libshared],
3160 dependencies : [libcryptsetup,
3165 install_rpath : rootpkglibdir,
3167 install_dir : rootlibexecdir)
3170 'systemd-cryptsetup-generator',
3171 'src/cryptsetup/cryptsetup-generator.c',
3172 include_directories : includes,
3173 link_with : [libshared],
3174 dependencies : userspace,
3175 install_rpath : rootpkglibdir,
3177 install_dir : systemgeneratordir)
3180 'systemd-veritysetup',
3181 'src/veritysetup/veritysetup.c',
3182 include_directories : includes,
3183 link_with : [libshared],
3184 dependencies : [libcryptsetup,
3187 install_rpath : rootpkglibdir,
3189 install_dir : rootlibexecdir)
3192 'systemd-veritysetup-generator',
3193 'src/veritysetup/veritysetup-generator.c',
3194 include_directories : includes,
3195 link_with : [libshared],
3196 dependencies : [userspace,
3198 install_rpath : rootpkglibdir,
3200 install_dir : systemgeneratordir)
3202 public_programs += executable(
3203 'systemd-cryptenroll',
3204 systemd_cryptenroll_sources,
3205 include_directories : includes,
3206 link_with : [libshared],
3207 dependencies : [libcryptsetup,
3213 install_rpath : rootpkglibdir,
3217 'systemd-integritysetup',
3218 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
3219 include_directories : includes,
3220 link_with : [libshared],
3221 dependencies : [libcryptsetup,
3224 install_rpath : rootpkglibdir,
3226 install_dir : rootlibexecdir)
3229 'systemd-integritysetup-generator',
3230 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
3231 include_directories : includes,
3232 link_with : [libshared],
3233 dependencies : userspace,
3234 install_rpath : rootpkglibdir,
3236 install_dir : systemgeneratordir)
3239 if conf.get('HAVE_SYSV_COMPAT') == 1
3241 'systemd-sysv-generator',
3242 'src/sysv-generator/sysv-generator.c',
3243 include_directories : includes,
3244 link_with : [libshared],
3245 dependencies : userspace,
3246 install_rpath : rootpkglibdir,
3248 install_dir : systemgeneratordir)
3250 sysv_generator_test_py = find_program('test/sysv-generator-test.py')
3251 if want_tests != 'false'
3252 test('sysv-generator-test',
3253 sysv_generator_test_py,
3258 'systemd-rc-local-generator',
3259 'src/rc-local-generator/rc-local-generator.c',
3260 include_directories : includes,
3261 link_with : [libshared],
3262 dependencies : userspace,
3263 install_rpath : rootpkglibdir,
3265 install_dir : systemgeneratordir)
3268 if conf.get('ENABLE_XDG_AUTOSTART') == 1
3270 'systemd-xdg-autostart-generator',
3271 systemd_xdg_autostart_generator_sources,
3272 include_directories : includes,
3273 link_with : [libshared],
3274 dependencies : userspace,
3275 install_rpath : rootpkglibdir,
3277 install_dir : usergeneratordir)
3280 'systemd-xdg-autostart-condition',
3281 'src/xdg-autostart-generator/xdg-autostart-condition.c',
3282 include_directories : includes,
3283 link_with : [libshared],
3284 dependencies : userspace,
3285 install_rpath : rootpkglibdir,
3287 install_dir : rootlibexecdir)
3290 if conf.get('ENABLE_HOSTNAMED') == 1
3291 dbus_programs += executable(
3292 'systemd-hostnamed',
3293 'src/hostname/hostnamed.c',
3294 include_directories : includes,
3295 link_with : [libshared],
3296 dependencies : userspace,
3297 install_rpath : rootpkglibdir,
3299 install_dir : rootlibexecdir)
3301 public_programs += executable(
3303 'src/hostname/hostnamectl.c',
3304 include_directories : includes,
3305 link_with : [libshared],
3306 dependencies : [userspace,
3308 install_rpath : rootpkglibdir,
3312 if conf.get('ENABLE_LOCALED') == 1
3313 dbus_programs += executable(
3315 systemd_localed_sources,
3316 include_directories : includes,
3317 link_with : [libshared],
3318 dependencies : libxkbcommon_deps +
3321 install_rpath : rootpkglibdir,
3323 install_dir : rootlibexecdir)
3325 public_programs += executable(
3328 include_directories : includes,
3329 link_with : [libshared],
3330 dependencies : [userspace,
3332 install_rpath : rootpkglibdir,
3336 if conf.get('ENABLE_TIMEDATED') == 1
3337 dbus_programs += executable(
3338 'systemd-timedated',
3339 'src/timedate/timedated.c',
3340 include_directories : includes,
3341 link_with : [libshared],
3342 dependencies : userspace,
3343 install_rpath : rootpkglibdir,
3345 install_dir : rootlibexecdir)
3348 if conf.get('ENABLE_TIMEDATECTL') == 1
3349 public_programs += executable(
3351 'src/timedate/timedatectl.c',
3352 include_directories : includes,
3353 install_rpath : rootpkglibdir,
3354 link_with : [libshared],
3355 dependencies : [libm,
3361 if conf.get('ENABLE_TIMESYNCD') == 1
3363 'systemd-timesyncd',
3364 systemd_timesyncd_sources,
3365 include_directories : includes,
3366 link_with : [libtimesyncd_core],
3367 dependencies : [libm,
3371 install_rpath : rootpkglibdir,
3373 install_dir : rootlibexecdir)
3376 'systemd-time-wait-sync',
3377 'src/timesync/wait-sync.c',
3378 include_directories : includes,
3379 link_with : [libtimesyncd_core],
3380 dependencies : userspace,
3381 install_rpath : rootpkglibdir,
3383 install_dir : rootlibexecdir)
3386 if conf.get('ENABLE_MACHINED') == 1
3387 dbus_programs += executable(
3389 systemd_machined_sources,
3390 include_directories : includes,
3391 link_with : [libmachine_core,
3393 dependencies : userspace,
3394 install_rpath : rootpkglibdir,
3396 install_dir : rootlibexecdir)
3398 public_programs += executable(
3400 'src/machine/machinectl.c',
3401 include_directories : includes,
3402 link_with : [libshared],
3403 dependencies : [liblz4,
3409 install_rpath : rootpkglibdir,
3411 install_dir : rootbindir)
3414 if conf.get('ENABLE_IMPORTD') == 1
3415 dbus_programs += executable(
3417 systemd_importd_sources,
3418 include_directories : includes,
3419 link_with : [libshared],
3420 dependencies : [threads,
3423 install_rpath : rootpkglibdir,
3425 install_dir : rootlibexecdir)
3427 systemd_pull = executable(
3429 systemd_pull_sources,
3430 include_directories : includes,
3431 link_with : [libshared,
3433 dependencies : [lib_openssl_or_gcrypt,
3440 install_rpath : rootpkglibdir,
3442 install_dir : rootlibexecdir)
3444 systemd_import = executable(
3446 systemd_import_sources,
3447 include_directories : includes,
3448 link_with : [libshared,
3450 dependencies : [libbzip2,
3456 install_rpath : rootpkglibdir,
3458 install_dir : rootlibexecdir)
3460 systemd_import_fs = executable(
3461 'systemd-import-fs',
3462 systemd_import_fs_sources,
3463 include_directories : includes,
3464 link_with : [libshared,
3466 dependencies : [userspace,
3468 install_rpath : rootpkglibdir,
3470 install_dir : rootlibexecdir)
3472 systemd_export = executable(
3474 systemd_export_sources,
3475 include_directories : includes,
3476 link_with : [libshared,
3478 dependencies : [libbzip2,
3484 install_rpath : rootpkglibdir,
3486 install_dir : rootlibexecdir)
3488 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
3491 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
3492 public_programs += executable(
3493 'systemd-journal-upload',
3494 systemd_journal_upload_sources,
3495 include_directories : includes,
3496 link_with : [libshared],
3497 dependencies : [libcurl,
3505 install_rpath : rootpkglibdir,
3507 install_dir : rootlibexecdir)
3510 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
3511 public_programs += executable(
3512 'systemd-journal-remote',
3513 systemd_journal_remote_sources,
3514 include_directories : journal_includes,
3515 link_with : [libshared,
3516 libsystemd_journal_remote],
3517 dependencies : [libgnutls,
3525 install_rpath : rootpkglibdir,
3527 install_dir : rootlibexecdir)
3529 public_programs += executable(
3530 'systemd-journal-gatewayd',
3531 systemd_journal_gatewayd_sources,
3532 include_directories : journal_includes,
3533 link_with : [libshared],
3534 dependencies : [libgnutls,
3542 install_rpath : rootpkglibdir,
3544 install_dir : rootlibexecdir)
3547 if conf.get('ENABLE_COREDUMP') == 1
3550 systemd_coredump_sources,
3551 include_directories : includes,
3552 link_with : [libshared,
3554 dependencies : [libacl,
3561 install_rpath : rootpkglibdir,
3563 install_dir : rootlibexecdir)
3565 public_programs += executable(
3567 coredumpctl_sources,
3568 include_directories : includes,
3569 link_with : [libshared,
3571 dependencies : [liblz4,
3577 install_rpath : rootpkglibdir,
3581 if conf.get('ENABLE_PSTORE') == 1
3584 systemd_pstore_sources,
3585 include_directories : includes,
3586 link_with : [libshared],
3587 dependencies : [libacl,
3594 install_rpath : rootpkglibdir,
3596 install_dir : rootlibexecdir)
3599 if conf.get('ENABLE_OOMD') == 1
3600 dbus_programs += executable('systemd-oomd',
3601 systemd_oomd_sources,
3602 include_directories : includes,
3603 link_with : [libshared],
3604 dependencies : [libatomic,
3607 install_rpath : rootpkglibdir,
3609 install_dir : rootlibexecdir)
3611 public_programs += executable(
3614 include_directories : includes,
3615 link_with : [libshared],
3616 dependencies : [userspace,
3618 install_rpath : rootpkglibdir,
3622 if conf.get('ENABLE_BINFMT') == 1
3623 public_programs += executable(
3625 'src/binfmt/binfmt.c',
3626 include_directories : includes,
3627 link_with : [libshared],
3628 dependencies : [userspace,
3630 install_rpath : rootpkglibdir,
3632 install_dir : rootlibexecdir)
3634 meson.add_install_script('sh', '-c',
3635 mkdir_p.format(binfmtdir))
3636 if install_sysconfdir
3637 meson.add_install_script('sh', '-c',
3638 mkdir_p.format(sysconfdir / 'binfmt.d'))
3642 if conf.get('ENABLE_SYSUPDATE') == 1
3644 'systemd-sysupdate',
3645 systemd_sysupdate_sources,
3646 include_directories : includes,
3647 link_with : [libshared,
3649 dependencies : [libblkid,
3655 install_rpath : rootpkglibdir,
3657 install_dir : rootlibexecdir)
3658 public_programs += exe
3661 if conf.get('ENABLE_VCONSOLE') == 1
3663 'systemd-vconsole-setup',
3664 'src/vconsole/vconsole-setup.c',
3665 include_directories : includes,
3666 link_with : [libshared],
3667 dependencies : userspace,
3668 install_rpath : rootpkglibdir,
3670 install_dir : rootlibexecdir)
3673 if conf.get('ENABLE_RANDOMSEED') == 1
3675 'systemd-random-seed',
3676 'src/random-seed/random-seed.c',
3677 include_directories : includes,
3678 link_with : [libshared],
3679 dependencies : [userspace,
3681 install_rpath : rootpkglibdir,
3683 install_dir : rootlibexecdir)
3686 if conf.get('ENABLE_FIRSTBOOT') == 1
3687 public_programs += executable(
3688 'systemd-firstboot',
3689 'src/firstboot/firstboot.c',
3690 include_directories : includes,
3691 link_with : [libshared],
3692 dependencies : [libcrypt,
3695 install_rpath : rootpkglibdir,
3697 install_dir : rootbindir)
3701 'systemd-remount-fs',
3702 'src/remount-fs/remount-fs.c',
3703 include_directories : includes,
3704 link_with : [libshared],
3705 dependencies : [userspace,
3707 install_rpath : rootpkglibdir,
3709 install_dir : rootlibexecdir)
3712 'systemd-machine-id-setup',
3713 'src/machine-id-setup/machine-id-setup-main.c',
3714 include_directories : includes,
3715 link_with : [libshared],
3716 dependencies : [userspace,
3718 install_rpath : rootpkglibdir,
3720 install_dir : rootbindir)
3725 include_directories : includes,
3726 link_with : [libshared],
3727 dependencies : [userspace,
3729 install_rpath : rootpkglibdir,
3731 install_dir : rootlibexecdir)
3735 'src/partition/growfs.c',
3736 include_directories : includes,
3737 link_with : [libshared],
3738 dependencies : [userspace,
3740 install_rpath : rootpkglibdir,
3742 install_dir : rootlibexecdir)
3746 'src/partition/makefs.c',
3747 include_directories : includes,
3748 link_with : [libshared],
3749 dependencies : [userspace,
3751 install_rpath : rootpkglibdir,
3753 install_dir : rootlibexecdir)
3757 'src/sleep/sleep.c',
3758 include_directories : includes,
3759 link_with : [libshared],
3760 dependencies : [userspace,
3762 install_rpath : rootpkglibdir,
3764 install_dir : rootlibexecdir)
3766 if install_sysconfdir_samples
3767 install_data('src/sleep/sleep.conf',
3768 install_dir : pkgsysconfdir)
3771 public_programs += executable(
3773 'src/sysctl/sysctl.c',
3774 include_directories : includes,
3775 link_with : [libshared],
3776 dependencies : [userspace,
3778 install_rpath : rootpkglibdir,
3780 install_dir : rootlibexecdir)
3782 public_programs += executable(
3784 'src/ac-power/ac-power.c',
3785 include_directories : includes,
3786 link_with : [libshared],
3787 dependencies : [userspace,
3789 install_rpath : rootpkglibdir,
3792 public_programs += executable(
3793 'systemd-detect-virt',
3794 'src/detect-virt/detect-virt.c',
3795 include_directories : includes,
3796 link_with : [libshared],
3797 dependencies : [userspace,
3799 install_rpath : rootpkglibdir,
3802 public_programs += executable(
3804 'src/delta/delta.c',
3805 include_directories : includes,
3806 link_with : [libshared],
3807 dependencies : [userspace,
3809 install_rpath : rootpkglibdir,
3812 public_programs += executable(
3814 'src/escape/escape.c',
3815 include_directories : includes,
3816 link_with : [libshared],
3817 dependencies : [userspace,
3819 install_rpath : rootpkglibdir,
3821 install_dir : rootbindir)
3823 public_programs += executable(
3825 'src/notify/notify.c',
3826 include_directories : includes,
3827 link_with : [libshared],
3828 dependencies : [userspace,
3830 install_rpath : rootpkglibdir,
3832 install_dir : rootbindir)
3834 public_programs += executable(
3836 'src/creds/creds.c',
3837 include_directories : includes,
3838 link_with : [libshared],
3839 dependencies : [threads,
3843 install_rpath : rootpkglibdir,
3845 install_dir : rootbindir)
3848 'systemd-volatile-root',
3849 'src/volatile-root/volatile-root.c',
3850 include_directories : includes,
3851 link_with : [libshared],
3852 dependencies : userspace,
3853 install_rpath : rootpkglibdir,
3854 install : conf.get('ENABLE_INITRD') == 1,
3855 install_dir : rootlibexecdir)
3858 'systemd-cgroups-agent',
3859 'src/cgroups-agent/cgroups-agent.c',
3860 include_directories : includes,
3861 link_with : [libshared],
3862 dependencies : userspace,
3863 install_rpath : rootpkglibdir,
3865 install_dir : rootlibexecdir)
3867 systemd_id128 = executable(
3869 'src/id128/id128.c',
3870 include_directories : includes,
3871 link_with : [libshared],
3872 dependencies : [userspace,
3874 install_rpath : rootpkglibdir,
3876 public_programs += systemd_id128
3878 if want_tests != 'false'
3879 test('test-systemctl-enable',
3880 test_systemctl_enable_sh,
3881 # https://github.com/mesonbuild/meson/issues/2681
3882 args : [systemctl.full_path(),
3883 systemd_id128.full_path()])
3886 public_programs += executable(
3889 include_directories : includes,
3890 link_with : [libshared],
3891 dependencies : [userspace,
3893 install_rpath : rootpkglibdir,
3896 public_programs += executable(
3897 'systemd-ask-password',
3898 'src/ask-password/ask-password.c',
3899 include_directories : includes,
3900 link_with : [libshared],
3901 dependencies : [userspace,
3903 install_rpath : rootpkglibdir,
3905 install_dir : rootbindir)
3908 'systemd-reply-password',
3909 'src/reply-password/reply-password.c',
3910 include_directories : includes,
3911 link_with : [libshared],
3912 dependencies : userspace,
3913 install_rpath : rootpkglibdir,
3915 install_dir : rootlibexecdir)
3917 public_programs += executable(
3918 'systemd-tty-ask-password-agent',
3919 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3920 include_directories : includes,
3921 link_with : [libshared],
3922 dependencies : [userspace,
3924 install_rpath : rootpkglibdir,
3926 install_dir : rootbindir)
3928 public_programs += executable(
3931 include_directories : includes,
3932 link_with : [libshared],
3933 dependencies : [userspace,
3935 install_rpath : rootpkglibdir,
3938 public_programs += executable(
3940 'src/cgtop/cgtop.c',
3941 include_directories : includes,
3942 link_with : [libshared],
3943 dependencies : [userspace,
3945 install_rpath : rootpkglibdir,
3950 'src/initctl/initctl.c',
3951 include_directories : includes,
3952 link_with : [libshared],
3953 dependencies : userspace,
3954 install_rpath : rootpkglibdir,
3955 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3956 install_dir : rootlibexecdir)
3958 public_programs += executable(
3960 'src/mount/mount-tool.c',
3961 include_directories : includes,
3962 link_with : [libshared],
3963 dependencies: [libmount,
3966 install_rpath : rootpkglibdir,
3969 meson.add_install_script(meson_make_symlink,
3970 'systemd-mount', bindir / 'systemd-umount')
3972 public_programs += executable(
3975 include_directories : includes,
3976 link_with : [libshared],
3977 dependencies : [userspace,
3979 install_rpath : rootpkglibdir,
3982 public_programs += executable(
3983 'systemd-stdio-bridge',
3984 'src/stdio-bridge/stdio-bridge.c',
3985 include_directories : includes,
3986 link_with : [libshared],
3987 dependencies : [userspace,
3989 install_rpath : rootpkglibdir,
3992 public_programs += executable(
3995 include_directories : includes,
3996 link_with : [libshared],
3997 dependencies : [userspace,
3999 install_rpath : rootpkglibdir,
4005 'src/sysusers/sysusers.c',
4006 include_directories : includes,
4007 link_with : [libshared],
4008 dependencies : [userspace,
4010 install_rpath : rootpkglibdir,
4012 install_dir : rootbindir)
4013 public_programs += exe
4015 if want_tests != 'false'
4016 test('test-sysusers',
4018 # https://github.com/mesonbuild/meson/issues/2681
4019 args : exe.full_path())
4023 'systemd-sysusers.standalone',
4024 'src/sysusers/sysusers.c',
4025 include_directories : includes,
4026 c_args : '-DSTANDALONE',
4027 link_with : [libshared_static,
4031 dependencies : [userspace,
4033 build_by_default: have_standalone_binaries,
4034 install : have_standalone_binaries,
4035 install_dir : rootbindir)
4036 if have_standalone_binaries
4037 public_programs += exe
4039 if want_tests != 'false'
4040 test('test-sysusers.standalone',
4042 # https://github.com/mesonbuild/meson/issues/2681
4043 args : exe.full_path())
4048 if conf.get('ENABLE_TMPFILES') == 1
4051 systemd_tmpfiles_sources,
4052 include_directories : includes,
4053 link_with : [libshared],
4054 dependencies : [libacl,
4057 install_rpath : rootpkglibdir,
4059 install_dir : rootbindir)
4060 public_programs += exe
4062 if want_tests != 'false'
4063 test('test-systemd-tmpfiles',
4064 test_systemd_tmpfiles_py,
4065 # https://github.com/mesonbuild/meson/issues/2681
4066 args : exe.full_path())
4070 'systemd-tmpfiles.standalone',
4071 systemd_tmpfiles_sources,
4072 include_directories : includes,
4073 c_args : '-DSTANDALONE',
4074 link_with : [libshared_static,
4078 dependencies : [libacl,
4081 build_by_default: have_standalone_binaries,
4082 install : have_standalone_binaries,
4083 install_dir : rootbindir)
4084 if have_standalone_binaries
4085 public_programs += exe
4087 if want_tests != 'false'
4088 test('test-systemd-tmpfiles.standalone',
4089 test_systemd_tmpfiles_py,
4090 # https://github.com/mesonbuild/meson/issues/2681
4091 args : exe.full_path())
4096 if conf.get('ENABLE_HWDB') == 1
4097 systemd_hwdb = executable(
4100 include_directories : includes,
4101 link_with : udev_link_with,
4102 dependencies : [userspace,
4104 install_rpath : udev_rpath,
4106 install_dir : rootbindir)
4107 public_programs += systemd_hwdb
4109 if want_tests != 'false'
4113 args : [systemd_hwdb.full_path()],
4118 if conf.get('ENABLE_QUOTACHECK') == 1
4120 'systemd-quotacheck',
4121 'src/quotacheck/quotacheck.c',
4122 include_directories : includes,
4123 link_with : [libshared],
4124 dependencies : userspace,
4125 install_rpath : rootpkglibdir,
4127 install_dir : rootlibexecdir)
4130 public_programs += executable(
4131 'systemd-socket-proxyd',
4132 'src/socket-proxy/socket-proxyd.c',
4133 include_directories : includes,
4134 link_with : [libshared],
4135 dependencies : [threads,
4138 install_rpath : rootpkglibdir,
4140 install_dir : rootlibexecdir)
4142 udevadm = executable(
4145 include_directories : includes,
4146 link_with : [libudevd_core],
4147 dependencies : [libacl,
4154 install_rpath : udev_rpath,
4156 install_dir : rootbindir)
4157 public_programs += udevadm
4159 if want_tests != 'false'
4160 test('udev-rules-check',
4163 args : ['verify', '--resolve-names=never', all_rules])
4166 if conf.get('ENABLE_REPART') == 1
4169 systemd_repart_sources,
4170 include_directories : includes,
4171 link_with : [libshared,
4173 dependencies : [libblkid,
4179 install_rpath : rootpkglibdir,
4181 install_dir : rootbindir)
4182 public_programs += exe
4185 'systemd-repart.standalone',
4186 systemd_repart_sources,
4187 include_directories : includes,
4188 c_args : '-DSTANDALONE',
4189 link_with : [libshared_static,
4194 dependencies : [libblkid,
4200 build_by_default: have_standalone_binaries,
4201 install_rpath : rootpkglibdir,
4202 install : have_standalone_binaries,
4203 install_dir : rootbindir)
4204 if have_standalone_binaries
4205 public_programs += exe
4211 systemd_shutdown_sources,
4212 include_directories : includes,
4213 link_with : [libshared],
4214 dependencies : [libmount,
4217 install_rpath : rootpkglibdir,
4219 install_dir : rootlibexecdir)
4222 'systemd-shutdown.standalone',
4223 systemd_shutdown_sources,
4224 include_directories : includes,
4225 c_args : '-DSTANDALONE',
4226 link_with : [libshared_static,
4229 dependencies : [libmount,
4232 build_by_default: have_standalone_binaries,
4233 install_rpath : rootpkglibdir,
4234 install : have_standalone_binaries,
4235 install_dir : rootlibexecdir)
4236 if have_standalone_binaries
4237 public_programs += exe
4241 'systemd-update-done',
4242 'src/update-done/update-done.c',
4243 include_directories : includes,
4244 link_with : [libshared],
4245 dependencies : [userspace,
4247 install_rpath : rootpkglibdir,
4249 install_dir : rootlibexecdir)
4252 'systemd-update-utmp',
4253 'src/update-utmp/update-utmp.c',
4254 include_directories : includes,
4255 link_with : [libshared],
4256 dependencies : [libaudit,
4259 install_rpath : rootpkglibdir,
4260 install : (conf.get('ENABLE_UTMP') == 1),
4261 install_dir : rootlibexecdir)
4263 if conf.get('HAVE_KMOD') == 1
4265 'systemd-modules-load',
4266 'src/modules-load/modules-load.c',
4267 include_directories : includes,
4268 link_with : [libshared],
4269 dependencies : [libkmod,
4272 install_rpath : rootpkglibdir,
4274 install_dir : rootlibexecdir)
4276 meson.add_install_script('sh', '-c',
4277 mkdir_p.format(modulesloaddir))
4278 if install_sysconfdir
4279 meson.add_install_script('sh', '-c',
4280 mkdir_p.format(sysconfdir / 'modules-load.d'))
4284 public_programs += executable(
4286 systemd_nspawn_sources,
4287 include_directories : includes,
4288 link_with : [libnspawn_core,
4290 dependencies : [libblkid,
4294 install_rpath : rootpkglibdir,
4297 if conf.get('ENABLE_NETWORKD') == 1
4298 dbus_programs += executable(
4300 systemd_networkd_sources,
4301 include_directories : network_includes,
4302 link_with : [libnetworkd_core,
4304 networkd_link_with],
4305 dependencies : [threads,
4308 install_rpath : rootpkglibdir,
4310 install_dir : rootlibexecdir)
4312 public_programs += executable(
4313 'systemd-networkd-wait-online',
4314 systemd_networkd_wait_online_sources,
4315 include_directories : includes,
4316 link_with : [networkd_link_with],
4317 dependencies : [userspace,
4319 install_rpath : rootpkglibdir,
4321 install_dir : rootlibexecdir)
4323 public_programs += executable(
4326 include_directories : libsystemd_network_includes,
4327 link_with : [libsystemd_network,
4328 networkd_link_with],
4329 dependencies : [userspace,
4331 install_rpath : rootpkglibdir,
4333 install_dir : rootbindir)
4337 'systemd-network-generator',
4338 network_generator_sources,
4339 include_directories : includes,
4340 link_with : [networkd_link_with],
4341 dependencies : [userspace,
4343 install_rpath : rootpkglibdir,
4345 install_dir : rootlibexecdir)
4347 if want_tests != 'false'
4348 test('test-network-generator-conversion',
4349 test_network_generator_conversion_sh,
4350 # https://github.com/mesonbuild/meson/issues/2681
4351 args : exe.full_path(),
4356 'systemd-sulogin-shell',
4357 'src/sulogin-shell/sulogin-shell.c',
4358 include_directories : includes,
4359 link_with : [libshared],
4360 dependencies : [userspace,
4362 install_rpath : rootpkglibdir,
4364 install_dir : rootlibexecdir)
4366 kernel_install = custom_target(
4368 input : kernel_install_in,
4369 output : 'kernel-install',
4370 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
4371 install : want_kernel_install,
4372 install_mode : 'rwxr-xr-x',
4373 install_dir : bindir)
4374 if want_kernel_install
4375 public_programs += exe
4378 ukify = custom_target(
4380 input : 'src/ukify/ukify.py',
4382 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
4383 install : want_ukify,
4384 install_mode : 'rwxr-xr-x',
4385 install_dir : rootlibexecdir)
4387 public_programs += ukify
4390 if want_tests != 'false' and want_kernel_install
4391 args = [kernel_install.full_path(), loaderentry_install, uki_copy_install]
4392 if want_ukify and boot_stubs.length() > 0
4393 args += [ukify.full_path(), ukify_install, boot_stubs[0]]
4396 test('test-kernel-install',
4397 test_kernel_install_sh,
4402 ############################################################
4404 runtest_env = custom_target(
4405 'systemd-runtest.env',
4406 output : 'systemd-runtest.env',
4407 command : [sh, '-c',
4408 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
4409 project_source_root / 'test',
4410 project_build_root / 'catalog')],
4412 build_by_default : true)
4414 test_cflags = ['-DTEST_CODE=1']
4415 # We intentionally do not do inline initializations with definitions for a
4416 # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
4417 # use the variable unexpectedly. This triggers a lot of maybe-uninitialized
4418 # false positives when the combination of -O2 and -flto is used. Suppress them.
4419 if '-O2' in c_args and '-flto=auto' in c_args
4420 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
4423 foreach test : simple_tests
4424 tests += { 'sources' : [test] }
4428 foreach test : tests
4429 sources = test.get('sources')
4430 condition = test.get('condition', '')
4431 type = test.get('type', '')
4432 base = test.get('base', {})
4434 base.get('dependencies', []),
4435 test.get('dependencies', []),
4439 # FIXME: Use fs.stem() with meson >= 0.54.0
4440 name = '@0@'.format(sources[0]).split('/')[-1]
4441 if not name.endswith('.cc')
4444 name = name.split('.')[0]
4446 suite = fs.name(fs.parent('@0@'.format(sources[0])))
4447 # FIXME: Use str.replace() with meson >= 0.58.0
4448 suite = suite.split('sd-')[-1]
4450 if condition != '' and conf.get(condition) == 0
4451 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
4458 include_directories : [base.get('includes', []), test.get('includes', includes)],
4459 link_with : [base.get('link_with', []), test.get('link_with', libshared)],
4460 dependencies : deps,
4461 c_args : [test_cflags, test.get('c_args', [])],
4462 build_by_default : want_tests != 'false',
4463 install_rpath : rootpkglibdir,
4464 install : install_tests,
4465 install_dir : unittestsdir / type,
4466 link_depends : runtest_env)
4469 message('@0@ is a manual test'.format(name))
4470 elif type == 'unsafe' and want_tests != 'unsafe'
4471 message('@0@ is an unsafe test'.format(name))
4472 elif want_tests != 'false'
4475 timeout : test.get('timeout', 30),
4477 is_parallel : test.get('parallel', true))
4480 TESTS += { name : exe }
4484 'test-libsystemd-sym',
4485 test_libsystemd_sym_c,
4486 include_directories : includes,
4487 link_with : [libsystemd],
4488 dependencies : userspace,
4489 build_by_default : want_tests != 'false',
4490 install : install_tests,
4491 install_dir : unittestsdir)
4492 if want_tests != 'false'
4493 test('test-libsystemd-sym', exe)
4497 'test-libsystemd-static-sym',
4498 test_libsystemd_sym_c,
4499 include_directories : includes,
4500 link_with : [install_libsystemd_static],
4502 # threads is already included in dependencies on the library,
4503 # but does not seem to get propagated. Add here as a work-around.
4507 build_by_default : want_tests != 'false' and static_libsystemd_pic,
4508 install : install_tests and static_libsystemd_pic,
4509 install_dir : unittestsdir)
4510 if want_tests != 'false' and static_libsystemd_pic
4511 test('test-libsystemd-static-sym', exe)
4517 include_directories : libudev_includes,
4518 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
4519 link_with : [libudev],
4520 dependencies : userspace,
4521 build_by_default : want_tests != 'false',
4522 install : install_tests,
4523 install_dir : unittestsdir)
4524 if want_tests != 'false'
4525 test('test-libudev-sym', exe)
4529 'test-libudev-static-sym',
4531 include_directories : libudev_includes,
4532 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
4533 link_with : [install_libudev_static],
4534 dependencies : userspace,
4535 build_by_default : want_tests != 'false' and static_libudev_pic,
4536 install : install_tests and static_libudev_pic,
4537 install_dir : unittestsdir)
4538 if want_tests != 'false' and static_libudev_pic
4539 test('test-libudev-static-sym', exe)
4542 if want_tests != 'false'
4543 udev_rule_runner = TESTS['udev-rule-runner'].full_path()
4548 env : ['UDEV_RULE_RUNNER=@0@'.format(udev_rule_runner)],
4552 ############################################################
4554 foreach fuzzer : simple_fuzzers
4555 fuzzers += { 'sources' : [fuzzer] }
4560 foreach fuzzer : fuzzers
4561 sources = fuzzer.get('sources')
4562 base = fuzzer.get('base', {})
4563 dependencies = [base.get('dependencies', []), fuzzer.get('dependencies', [])]
4567 dependencies += fuzzing_engine
4569 if fuzzing_engine.found()
4570 dependencies += fuzzing_engine
4572 link_args += ['-fsanitize=fuzzer']
4575 sources += files('src/fuzz/fuzz-main.c')
4577 sources += fuzz_generated_directives
4579 # FIXME: Use fs.stem() with meson >= 0.54.0
4580 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
4585 include_directories : [
4586 base.get('includes', []),
4587 fuzzer.get('includes', includes),
4588 include_directories('src/fuzz'),
4590 link_with : [base.get('link_with', []), fuzzer.get('link_with', libshared)],
4596 c_args : [test_cflags, fuzzer.get('c_args', [])],
4597 link_args: link_args,
4599 build_by_default : fuzzer_build)
4602 if want_tests != 'false' and name in fuzz_regression_tests
4603 # Run the fuzz regression tests without any sanitizers enabled.
4604 # Additional invocations with sanitizers may be added below.
4605 foreach tuple : fuzz_regression_tests[name]
4608 test('@0@_@1@'.format(name, fuzz_in),
4611 args : [fuzz_dir != '' ? project_source_root / fuzz_dir / name / fuzz_in
4612 : fuzz_generated_in_dir / '@0@_@1@'.format(name, fuzz_in)])
4617 alias_target('fuzzers', fuzzer_exes)
4619 ############################################################
4621 subdir('docs/sysvinit')
4622 subdir('docs/var-log')
4625 subdir('modprobe.d')
4628 subdir('shell-completion/bash')
4629 subdir('shell-completion/zsh')
4631 subdir('sysusers.d')
4632 subdir('tmpfiles.d')
4635 install_subdir('factory/etc',
4636 install_dir : factorydir)
4637 subdir('factory/templates')
4639 if install_sysconfdir
4640 install_data('xorg/50-systemd-user.sh',
4641 install_dir : xinitrcdir)
4643 install_data('LICENSE.GPL2',
4647 'docs/CODING_STYLE.md',
4648 'docs/DISTRO_PORTING.md',
4649 'docs/ENVIRONMENT.md',
4651 'docs/TRANSIENT-SETTINGS.md',
4652 'docs/TRANSLATORS.md',
4653 'docs/UIDS-GIDS.md',
4654 install_dir : docdir)
4656 install_subdir('LICENSES',
4657 install_dir : docdir)
4659 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
4660 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
4662 ############################################################
4664 # Ensure that changes to the docs/ directory do not break the
4665 # basic Github pages build. But only run it in developer mode,
4666 # as it might be fragile due to changes in the tooling, and it is
4667 # not generally useful for users.
4668 jekyll = find_program('jekyll', required : false)
4669 if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
4670 test('github-pages',
4674 '--source', project_source_root / 'docs',
4675 '--destination', project_build_root / '_site'])
4678 ############################################################
4680 check_help = find_program('tools/check-help.sh')
4681 check_version = find_program('tools/check-version.sh')
4683 foreach exec : public_programs
4684 name = exec.full_path().split('/')[-1]
4685 if want_tests != 'false'
4686 test('check-help-' + name,
4689 args : exec.full_path(),
4692 test('check-version-' + name,
4695 args : [exec.full_path(),
4696 meson.project_version()],
4701 # Enable tests for all supported sanitizers
4702 foreach tuple : fuzz_sanitizers
4703 sanitizer = tuple[0]
4706 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
4707 foreach fuzzer, fuzz_ins : fuzz_regression_tests
4708 name = '@0@:@1@'.format(fuzzer, sanitizer)
4709 if want_tests == 'false'
4710 message('Not compiling @0@ because tests is set to false'.format(name))
4714 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
4717 exe = custom_target(
4720 depends : [build] + fuzz_generated_directives,
4721 command : [ln, '-fs',
4722 build.full_path() / fuzzer,
4724 build_by_default : true)
4726 foreach tuple : fuzz_ins
4730 test('@0@_@1@_@2@'.format(fuzzer, fuzz_in, sanitizer),
4733 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
4735 args : [exe.full_path(),
4736 fuzz_dir != '' ? project_source_root / fuzz_dir / fuzzer / fuzz_in
4737 : fuzz_generated_in_dir / '@0@_@1@'.format(fuzzer, fuzz_in)])
4744 ############################################################
4747 all_files = run_command(
4748 env, '-u', 'GIT_WORK_TREE',
4749 git, '--git-dir=@0@/.git'.format(project_source_root),
4750 'ls-files', ':/*.[ch]', ':/*.cc',
4752 if all_files.returncode() == 0
4753 all_files = files(all_files.stdout().split())
4758 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
4761 command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files)
4763 ############################################
4765 if want_tests != 'false' and conf.get('BUILD_MODE_DEVELOPER') == 1
4766 test('check-includes',
4767 files('tools/check-includes.py'),
4769 env : ['PROJECT_SOURCE_ROOT=@0@'.format(project_source_root)])
4773 ####################################################
4775 git_contrib_sh = find_program('tools/git-contrib.sh')
4778 command : [git_contrib_sh])
4780 ####################################################
4782 git_head = run_command(
4783 git, '--git-dir=@0@/.git'.format(project_source_root),
4784 'rev-parse', 'HEAD',
4785 check : false).stdout().strip()
4786 git_head_short = run_command(
4787 git, '--git-dir=@0@/.git'.format(project_source_root),
4788 'rev-parse', '--short=7', 'HEAD',
4789 check : false).stdout().strip()
4793 command : [git, 'archive',
4794 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
4796 '--prefix', 'systemd-@0@/'.format(git_head),
4800 ############################################################
4802 check_api_docs_sh = find_program('tools/check-api-docs.sh')
4805 depends : [man, libsystemd, libudev],
4806 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
4808 alias_target('update-dbus-docs', update_dbus_docs)
4809 alias_target('update-man-rules', update_man_rules)
4811 if not meson.is_cross_build()
4813 'export-dbus-interfaces',
4814 output : fs.name(dbus_interfaces_dir),
4815 install : dbus_interfaces_dir != 'no',
4816 install_dir : fs.parent(dbus_interfaces_dir),
4817 command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs])
4820 ############################################################
4822 alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
4823 check : true).stdout().strip()
4826 'split /usr' : split_usr,
4827 'split bin-sbin' : split_bin,
4828 'prefix directory' : prefixdir,
4829 'rootprefix directory' : rootprefixdir,
4830 'sysconf directory' : sysconfdir,
4831 'include directory' : includedir,
4832 'lib directory' : libdir,
4833 'rootlib directory' : rootlibdir,
4834 'SysV init scripts' : sysvinit_path,
4835 'SysV rc?.d directories' : sysvrcnd_path,
4836 'PAM modules directory' : pamlibdir,
4837 'PAM configuration directory' : pamconfdir,
4838 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
4839 'RPM macros directory' : rpmmacrosdir,
4840 'modprobe.d directory' : modprobedir,
4841 'D-Bus policy directory' : dbuspolicydir,
4842 'D-Bus session directory' : dbussessionservicedir,
4843 'D-Bus system directory' : dbussystemservicedir,
4844 'D-Bus interfaces directory' : dbus_interfaces_dir,
4845 'bash completions directory' : bashcompletiondir,
4846 'zsh completions directory' : zshcompletiondir,
4847 'private shared lib version tag' : shared_lib_tag,
4848 'extra start script' : get_option('rc-local'),
4849 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
4850 get_option('debug-tty')),
4851 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
4852 conf.get('SYSTEM_ALLOC_UID_MIN')),
4853 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
4854 conf.get('SYSTEM_ALLOC_GID_MIN')),
4855 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
4856 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
4857 'static UID/GID allocations' : ' '.join(static_ugids),
4858 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
4859 'render group access mode' : get_option('group-render-mode'),
4860 'certificate root directory' : get_option('certificate-root'),
4861 'support URL' : support_url,
4862 'nobody user name' : nobody_user,
4863 'nobody group name' : nobody_group,
4864 'fallback hostname' : get_option('fallback-hostname'),
4865 'default compression method' : compression,
4866 'default DNSSEC mode' : default_dnssec,
4867 'default DNS-over-TLS mode' : default_dns_over_tls,
4868 'default mDNS mode' : default_mdns,
4869 'default LLMNR mode' : default_llmnr,
4870 'default DNS servers' : dns_servers.split(' '),
4871 'default NTP servers' : ntp_servers.split(' '),
4872 'default cgroup hierarchy' : default_hierarchy,
4873 'default net.naming-scheme value' : default_net_naming_scheme,
4874 'default KillUserProcesses value' : kill_user_processes,
4875 'default locale' : default_locale,
4876 'default nspawn locale' : nspawn_locale,
4877 'default status unit format' : status_unit_format_default,
4878 'default user $PATH' :
4879 default_user_path != '' ? default_user_path : '(same as system services)',
4880 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
4881 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
4884 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
4885 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
4886 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
4907 ['libcryptsetup-plugins'],
4934 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
4963 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
4977 ['legacy-pkla', install_polkit_pkla],
4983 ['man pages', want_man],
4984 ['html pages', want_html],
4985 ['man page indices', want_man and have_lxml],
4987 ['compat-mutable-uid-boundaries'],
4990 ['adm group', get_option('adm-group')],
4991 ['wheel group', get_option('wheel-group')],
4994 ['debug mmap cache'],
4996 ['trace logging', conf.get('LOG_TRACE') == 1],
4997 ['slow tests', slow_tests],
4998 ['fuzz tests', fuzz_tests],
4999 ['install tests', install_tests],
5000 ['link-udev-shared', get_option('link-udev-shared')],
5001 ['link-systemctl-shared', get_option('link-systemctl-shared')],
5002 ['link-networkd-shared', get_option('link-networkd-shared')],
5003 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
5004 ['link-journalctl-shared', get_option('link-journalctl-shared')],
5005 ['link-boot-shared', get_option('link-boot-shared')],
5006 ['link-portabled-shared', get_option('link-portabled-shared')],
5007 ['first-boot-full-preset'],
5009 ['standalone-binaries', get_option('standalone-binaries')],
5010 ['coverage', get_option('b_coverage')],
5013 if tuple.length() >= 2
5016 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
5017 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
5018 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
5027 if static_libsystemd == 'false'
5028 missing += 'static-libsystemd'
5030 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
5033 if static_libudev == 'false'
5034 missing += 'static-libudev'
5036 found += 'static-libudev(@0@)'.format(static_libudev)
5039 if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
5040 found += 'cryptolib(openssl)'
5041 elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
5042 found += 'cryptolib(gcrypt)'
5044 missing += 'cryptolib'
5047 if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
5048 found += 'DNS-over-TLS(gnutls)'
5049 elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
5050 found += 'DNS-over-TLS(openssl)'
5052 missing += 'DNS-over-TLS'
5056 'enabled' : ', '.join(found),
5057 'disabled' : ', '.join(missing)},
5058 section : 'Features')
5060 if rootprefixdir != rootprefix_default
5062 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
5063 'systemd used fixed names for unit file directories and other paths, so anything\n' +
5064 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))