1 # SPDX-License-Identifier: LGPL-2.1-or-later
3 project('systemd', 'c',
13 meson_version : '>= 0.53.2',
16 libsystemd_version = '0.34.0'
17 libudev_version = '1.7.4'
19 conf = configuration_data()
20 conf.set_quoted('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
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')
37 want_ossfuzz = get_option('oss-fuzz')
38 want_libfuzzer = get_option('llvm-fuzz')
39 if want_ossfuzz and want_libfuzzer
40 error('only one of oss-fuzz or llvm-fuzz can be specified')
43 skip_deps = want_ossfuzz or get_option('skip-deps')
44 fuzzer_build = want_ossfuzz or want_libfuzzer
46 # Create a title-less summary section early, so it ends up first in the output.
47 # More items are added later after they have been detected.
48 summary({'build mode' : get_option('mode')})
50 # GCOV doesn't define any macro when compiled with, so let's define it ourselves
51 conf.set10('BUILT_WITH_COVERAGE', get_option('b_coverage'))
53 #####################################################################
55 # Try to install the git pre-commit hook
56 add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
57 if add_git_hook_sh.found()
58 git_hook = run_command(add_git_hook_sh, check : false)
59 if git_hook.returncode() == 0
60 message(git_hook.stdout().strip())
64 #####################################################################
67 if get_option('split-usr') == 'auto'
68 split_usr = not fs.is_symlink('/bin')
70 split_usr = get_option('split-usr') == 'true'
73 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
74 + ' split-usr mode is going to be removed\n' +
75 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
77 conf.set10('HAVE_SPLIT_USR', split_usr,
78 description : '/usr/bin and /bin directories are separate')
80 if get_option('split-bin') == 'auto'
81 split_bin = not fs.is_symlink('/usr/sbin')
83 split_bin = get_option('split-bin') == 'true'
85 conf.set10('HAVE_SPLIT_BIN', split_bin,
86 description : 'bin and sbin directories are separate')
88 rootprefixdir = get_option('rootprefix')
89 # Unusual rootprefixdir values are used by some distros
90 # (see https://github.com/systemd/systemd/pull/7461).
91 rootprefix_default = split_usr ? '/' : '/usr'
92 if rootprefixdir == ''
93 rootprefixdir = rootprefix_default
95 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
97 have_standalone_binaries = get_option('standalone-binaries')
99 sysvinit_path = get_option('sysvinit-path')
100 sysvrcnd_path = get_option('sysvrcnd-path')
101 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
102 description : 'SysV init scripts and rcN.d links are supported')
103 conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
105 if get_option('hibernate') and not get_option('initrd')
106 error('hibernate depends on initrd')
109 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
110 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
111 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
113 # Meson ignores the preceding arguments when joining paths if an absolute
114 # component is encountered, so this should canonicalize various paths when they
115 # are absolute or relative.
116 prefixdir = get_option('prefix')
117 if not prefixdir.startswith('/')
118 error('Prefix is not absolute: "@0@"'.format(prefixdir))
120 if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
121 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
122 rootprefixdir, prefixdir))
125 bindir = prefixdir / get_option('bindir')
126 libdir = prefixdir / get_option('libdir')
127 sysconfdir = prefixdir / get_option('sysconfdir')
128 includedir = prefixdir / get_option('includedir')
129 datadir = prefixdir / get_option('datadir')
130 localstatedir = '/' / get_option('localstatedir')
132 rootbindir = rootprefixdir / 'bin'
133 rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin')
134 rootlibexecdir = rootprefixdir / 'lib/systemd'
136 rootlibdir = get_option('rootlibdir')
138 rootlibdir = rootprefixdir / libdir.split('/')[-1]
141 install_sysconfdir = get_option('install-sysconfdir') != 'false'
142 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
143 # Dirs of external packages
144 pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig'
145 pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
146 polkitpolicydir = datadir / 'polkit-1/actions'
147 polkitrulesdir = datadir / 'polkit-1/rules.d'
148 polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
149 xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d'
150 rpmmacrosdir = get_option('rpmmacrosdir')
151 if rpmmacrosdir != 'no'
152 rpmmacrosdir = prefixdir / rpmmacrosdir
154 modprobedir = rootprefixdir / 'lib/modprobe.d'
157 pkgdatadir = datadir / 'systemd'
158 environmentdir = prefixdir / 'lib/environment.d'
159 pkgsysconfdir = sysconfdir / 'systemd'
160 userunitdir = prefixdir / 'lib/systemd/user'
161 userpresetdir = prefixdir / 'lib/systemd/user-preset'
162 tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
163 sysusersdir = prefixdir / 'lib/sysusers.d'
164 sysctldir = prefixdir / 'lib/sysctl.d'
165 binfmtdir = prefixdir / 'lib/binfmt.d'
166 modulesloaddir = prefixdir / 'lib/modules-load.d'
167 networkdir = rootprefixdir / 'lib/systemd/network'
168 pkgincludedir = includedir / 'systemd'
169 systemgeneratordir = rootlibexecdir / 'system-generators'
170 usergeneratordir = prefixdir / 'lib/systemd/user-generators'
171 systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
172 userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
173 systemshutdowndir = rootlibexecdir / 'system-shutdown'
174 systemsleepdir = rootlibexecdir / 'system-sleep'
175 systemunitdir = rootprefixdir / 'lib/systemd/system'
176 systempresetdir = rootprefixdir / 'lib/systemd/system-preset'
177 udevlibexecdir = rootprefixdir / 'lib/udev'
178 udevrulesdir = udevlibexecdir / 'rules.d'
179 udevhwdbdir = udevlibexecdir / 'hwdb.d'
180 catalogdir = prefixdir / 'lib/systemd/catalog'
181 kerneldir = prefixdir / 'lib/kernel'
182 kernelinstalldir = kerneldir / 'install.d'
183 factorydir = datadir / 'factory'
184 bootlibdir = prefixdir / 'lib/systemd/boot/efi'
185 testsdir = prefixdir / 'lib/systemd/tests'
186 systemdstatedir = localstatedir / 'lib/systemd'
187 catalogstatedir = systemdstatedir / 'catalog'
188 randomseeddir = localstatedir / 'lib/systemd'
189 profiledir = rootlibexecdir / 'portable' / 'profile'
190 ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
192 docdir = get_option('docdir')
194 docdir = datadir / 'doc/systemd'
197 pamlibdir = get_option('pamlibdir')
199 pamlibdir = rootlibdir / 'security'
202 pamconfdir = get_option('pamconfdir')
204 pamconfdir = prefixdir / 'lib/pam.d'
207 libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir')
208 if libcryptsetup_plugins_dir == ''
209 libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup'
212 memory_accounting_default = get_option('memory-accounting-default')
213 status_unit_format_default = get_option('status-unit-format-default')
215 conf.set_quoted('BINFMT_DIR', binfmtdir)
216 conf.set_quoted('BOOTLIBDIR', bootlibdir)
217 conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database')
218 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
219 conf.set_quoted('DOC_DIR', docdir)
220 conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd')
221 conf.set_quoted('ENVIRONMENT_DIR', environmentdir)
222 conf.set_quoted('INCLUDE_DIR', includedir)
223 conf.set_quoted('LIBDIR', libdir)
224 conf.set_quoted('MODPROBE_DIR', modprobedir)
225 conf.set_quoted('MODULESLOAD_DIR', modulesloaddir)
226 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
227 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent')
228 conf.set_quoted('PREFIX', prefixdir)
229 conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed')
230 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
231 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
232 conf.set_quoted('ROOTBINDIR', rootbindir)
233 conf.set_quoted('ROOTLIBDIR', rootlibdir)
234 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
235 conf.set_quoted('ROOTPREFIX', rootprefixdir)
236 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
237 conf.set_quoted('SYSCONF_DIR', sysconfdir)
238 conf.set_quoted('SYSCTL_DIR', sysctldir)
239 conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl')
240 conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd')
241 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
242 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent')
243 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup')
244 conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export')
245 conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck')
246 conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs')
247 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework')
248 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs')
249 conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import')
250 conf.set_quoted('SYSTEMD_INTEGRITYSETUP_PATH', rootlibexecdir / 'systemd-integritysetup')
251 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map')
252 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map')
253 conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs')
254 conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull')
255 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown')
256 conf.set_quoted('SYSTEMD_TEST_DATA', testsdir / 'testdata')
257 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent')
258 conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper')
259 conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork')
260 conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup')
261 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system')
262 conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir)
263 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
264 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
265 conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
266 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
267 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
268 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
269 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
270 conf.set_quoted('SYSUSERS_DIR', sysusersdir)
271 conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
272 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
273 conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
274 conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
275 conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout'))
276 conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user')
277 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
278 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
279 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
280 conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg')
281 conf.set_quoted('USER_PRESET_DIR', userpresetdir)
282 conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg')
284 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
285 conf.set10('ENABLE_URLIFY', get_option('urlify'))
286 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
287 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
288 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
289 conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default)
291 #####################################################################
293 cc = meson.get_compiler('c')
294 pkgconfig = import('pkgconfig')
295 check_compilation_sh = find_program('tools/check-compilation.sh')
296 meson_build_sh = find_program('tools/meson-build.sh')
298 want_tests = get_option('tests')
299 slow_tests = want_tests != 'false' and get_option('slow-tests')
300 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
301 install_tests = get_option('install-tests')
303 if add_languages('cpp', required : fuzzer_build)
304 # Used only for tests
305 cxx = meson.get_compiler('cpp')
306 cxx_cmd = ' '.join(cxx.cmd_array())
312 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
313 if fuzzing_engine.found()
314 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
315 elif cc.has_argument('-fsanitize=fuzzer-no-link')
316 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
318 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
321 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
324 # Those generate many false positives, and we do not want to change the code to
326 basic_disabled_warnings = [
327 '-Wno-format-signedness',
328 '-Wno-missing-field-initializers',
329 '-Wno-unused-parameter',
332 possible_common_cc_flags = [
336 '-Werror=implicit-function-declaration',
337 '-Werror=incompatible-pointer-types',
338 '-Werror=int-conversion',
340 '-Werror=override-init',
341 '-Werror=return-type',
342 '-Werror=shift-count-overflow',
343 '-Werror=shift-overflow=2',
346 '-Wimplicit-fallthrough=5',
349 '-Wmissing-include-dirs',
350 '-Wmissing-noreturn',
352 '-Wold-style-definition',
356 '-Wstrict-aliasing=2',
357 '-Wstrict-prototypes',
358 '-Wsuggest-attribute=noreturn',
362 # negative arguments are correctly detected starting with meson 0.46.
363 '-Wno-error=#warnings', # clang
364 '-Wno-string-plus-int', # clang
367 # Disable -Wmaybe-uninitialized when compiling with -Os/-O1/-O3/etc. There are
368 # too many false positives with gcc >= 8. Effectively, we only test with -O0
369 # and -O2; this should be enough to catch most important cases without too much
370 # busywork. See https://github.com/systemd/systemd/pull/19226.
371 if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
372 cc.version().version_compare('<10'))
373 possible_common_cc_flags += '-Wno-maybe-uninitialized'
376 # Disable -Wno-unused-result with gcc, see
377 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
378 if cc.get_id() == 'gcc'
379 possible_common_cc_flags += '-Wno-unused-result'
382 # --as-needed and --no-undefined are provided by meson by default,
383 # run 'meson configure' to see what is enabled
384 possible_link_flags = [
385 '-Wl,--fatal-warnings',
391 if get_option('b_sanitize') == 'none'
392 possible_link_flags += '-Wl,--warn-common'
395 if cc.get_id() == 'clang'
396 possible_common_cc_flags += [
397 '-Wno-typedef-redefinition',
398 '-Wno-gnu-variable-sized-type-not-at-end',
402 possible_cc_flags = possible_common_cc_flags + [
403 '-Werror=missing-declarations',
404 '-Werror=missing-prototypes',
405 '-fdiagnostics-show-option',
407 '-fno-strict-aliasing',
409 '-fstack-protector-strong',
410 '-fvisibility=hidden',
411 '--param=ssp-buffer-size=4',
414 if get_option('buildtype') != 'debug'
415 possible_cc_flags += [
416 '-ffunction-sections',
420 possible_link_flags += '-Wl,--gc-sections'
423 add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
424 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
425 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
427 have = cc.has_argument('-Wzero-length-bounds')
428 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
432 #include <inttypes.h>
433 typedef uint64_t usec_t;
434 usec_t now(clockid_t clock);
439 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
440 add_project_arguments('-Werror=shadow', language : 'c')
444 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
447 cpp = ' '.join(cc.cmd_array()) + ' -E'
449 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
451 #####################################################################
452 # compilation result tests
454 conf.set('_GNU_SOURCE', true)
455 conf.set('__SANE_USERSPACE_TYPES__', true)
456 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
458 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
459 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
460 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
461 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
462 conf.set('SIZEOF_TIMEX_MEMBER', cc.sizeof('typeof(((struct timex *)0)->freq)', prefix : '#include <sys/timex.h>'))
466 #include <sys/mount.h>
467 #include <sys/stat.h>
468 #include <linux/fs.h>
471 foreach decl : ['char16_t',
477 # We get -1 if the size cannot be determined
478 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
480 if decl == 'struct statx'
482 want_linux_stat_h = false
484 have = cc.sizeof(decl,
485 prefix : decl_headers + '#include <linux/stat.h>',
486 args : '-D_GNU_SOURCE') > 0
487 want_linux_stat_h = have
491 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
494 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
496 foreach ident : ['secure_getenv', '__secure_getenv']
497 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
501 ['memfd_create', '''#include <sys/mman.h>'''],
502 ['gettid', '''#include <sys/types.h>
503 #include <unistd.h>'''],
504 ['pivot_root', '''#include <stdlib.h>
505 #include <unistd.h>'''], # no known header declares pivot_root
506 ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get
507 ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set
508 ['name_to_handle_at', '''#include <sys/types.h>
509 #include <sys/stat.h>
510 #include <fcntl.h>'''],
511 ['setns', '''#include <sched.h>'''],
512 ['renameat2', '''#include <stdio.h>
513 #include <fcntl.h>'''],
514 ['kcmp', '''#include <linux/kcmp.h>'''],
515 ['keyctl', '''#include <sys/types.h>
516 #include <keyutils.h>'''],
517 ['copy_file_range', '''#include <sys/syscall.h>
518 #include <unistd.h>'''],
519 ['bpf', '''#include <sys/syscall.h>
520 #include <unistd.h>'''],
521 ['statx', '''#include <sys/types.h>
522 #include <sys/stat.h>
523 #include <unistd.h>'''],
524 ['explicit_bzero' , '''#include <string.h>'''],
525 ['reallocarray', '''#include <stdlib.h>'''],
526 ['set_mempolicy', '''#include <stdlib.h>
527 #include <unistd.h>'''],
528 ['get_mempolicy', '''#include <stdlib.h>
529 #include <unistd.h>'''],
530 ['pidfd_send_signal', '''#include <stdlib.h>
533 #include <sys/wait.h>'''],
534 ['pidfd_open', '''#include <stdlib.h>
537 #include <sys/wait.h>'''],
538 ['rt_sigqueueinfo', '''#include <stdlib.h>
541 #include <sys/wait.h>'''],
542 ['mallinfo', '''#include <malloc.h>'''],
543 ['mallinfo2', '''#include <malloc.h>'''],
544 ['execveat', '''#include <unistd.h>'''],
545 ['close_range', '''#include <unistd.h>'''],
546 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
547 ['mount_setattr', '''#include <sys/mount.h>'''],
548 ['move_mount', '''#include <sys/mount.h>'''],
549 ['open_tree', '''#include <sys/mount.h>'''],
550 ['getdents64', '''#include <dirent.h>'''],
553 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
554 conf.set10('HAVE_' + ident[0].to_upper(), have)
557 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
558 conf.set10('USE_SYS_RANDOM_H', true)
559 conf.set10('HAVE_GETRANDOM', true)
561 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
562 conf.set10('USE_SYS_RANDOM_H', false)
563 conf.set10('HAVE_GETRANDOM', have)
566 #####################################################################
568 version_tag = get_option('version-tag')
570 vcs_data = configuration_data()
571 vcs_data.set('VCS_TAG', version_tag)
572 version_h = configure_file(configuration : vcs_data,
573 input : 'src/version/version.h.in',
574 output : 'version.h')
577 project_source_root + '/tools/meson-vcs-tag.sh',
579 meson.project_version()]
582 input : 'src/version/version.h.in',
583 output : 'version.h',
587 versiondep = declare_dependency(sources: version_h)
589 shared_lib_tag = get_option('shared-lib-tag')
590 if shared_lib_tag == ''
591 shared_lib_tag = meson.project_version()
594 sh = find_program('sh')
595 echo = find_program('echo')
596 sed = find_program('sed')
597 awk = find_program('awk')
598 stat = find_program('stat')
599 ln = find_program('ln')
600 git = find_program('git', required : false)
601 env = find_program('env')
602 perl = find_program('perl', required : false)
603 rsync = find_program('rsync', required : false)
604 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
606 mkdir_p = 'mkdir -p $DESTDIR/@0@'
608 # If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
609 # /usr/sbin, /sbin, and fall back to the default from middle column.
610 progs = [['quotaon', '/usr/sbin/quotaon' ],
611 ['quotacheck', '/usr/sbin/quotacheck' ],
612 ['kmod', '/usr/bin/kmod' ],
613 ['kexec', '/usr/sbin/kexec' ],
614 ['sulogin', '/usr/sbin/sulogin' ],
615 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
616 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
617 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
618 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
619 ['nologin', '/usr/sbin/nologin', ],
622 path = get_option(prog[0] + '-path')
624 message('Using @1@ for @0@'.format(prog[0], path))
626 exe = find_program(prog[0],
627 '/usr/sbin/' + prog[0],
630 path = exe.found() ? exe.path() : prog[1]
632 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
633 conf.set_quoted(name, path)
636 conf.set_quoted('TELINIT', get_option('telinit-path'))
638 if run_command(ln, '--relative', '--help', check : false).returncode() != 0
639 error('ln does not support --relative (added in coreutils 8.16)')
642 ############################################################
644 python = find_program('python3')
645 if run_command(python, '-c', 'import jinja2', check : false).returncode() != 0
646 error('python3 jinja2 missing')
649 ############################################################
651 gperf = find_program('gperf')
653 gperf_test_format = '''
655 const char * in_word_set(const char *, @0@);
658 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
659 gperf_snippet = run_command(sh, '-c', gperf_snippet_format.format(gperf.path()),
661 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
662 if cc.compiles(gperf_test)
663 gperf_len_type = 'size_t'
665 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
666 if cc.compiles(gperf_test)
667 gperf_len_type = 'unsigned'
669 error('unable to determine gperf len type')
672 message('gperf len type is @0@'.format(gperf_len_type))
673 conf.set('GPERF_LEN_TYPE', gperf_len_type,
674 description : 'The type of gperf "len" parameter')
676 ############################################################
678 if not cc.has_header('sys/capability.h')
679 error('POSIX caps headers not found')
681 foreach header : ['crypt.h',
683 'linux/vm_sockets.h',
685 'valgrind/memcheck.h',
686 'valgrind/valgrind.h',
687 'linux/time_types.h',
691 conf.set10('HAVE_' + header.underscorify().to_upper(),
692 cc.has_header(header))
695 ############################################################
697 fallback_hostname = get_option('fallback-hostname')
698 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
699 error('Invalid fallback-hostname configuration')
700 # A more extensive test is done in test-hostname-util. Let's catch
701 # the most obvious errors here so we don't fail with an assert later.
703 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
705 default_hierarchy = get_option('default-hierarchy')
706 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
707 description : 'default cgroup hierarchy as string')
708 if default_hierarchy == 'legacy'
709 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
710 elif default_hierarchy == 'hybrid'
711 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
713 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
716 extra_net_naming_schemes = []
717 extra_net_naming_map = []
718 foreach scheme: get_option('extra-net-naming-schemes').split(',')
720 name = scheme.split('=')[0]
721 value = scheme.split('=')[1]
722 NAME = name.underscorify().to_upper()
724 foreach field: value.split('+')
725 VALUE += 'NAMING_' + field.underscorify().to_upper()
727 extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE))
728 extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME)
731 conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes))
732 conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map))
734 default_net_naming_scheme = get_option('default-net-naming-scheme')
735 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
736 if default_net_naming_scheme != 'latest'
737 conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST',
738 'NAMING_' + default_net_naming_scheme.underscorify().to_upper())
741 time_epoch = get_option('time-epoch')
743 time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check : true).stdout().strip()
744 if time_epoch == '' and git.found() and fs.exists('.git')
745 # If we're in a git repository, use the creation time of the latest git tag.
746 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags',
748 if latest_tag.returncode() == 0
749 time_epoch = run_command(
750 git, 'log', '--no-show-signature', '-1', '--format=%at',
751 latest_tag.stdout().strip(),
752 check : false).stdout()
757 time_epoch = run_command(stat, '-c', '%Y', NEWS,
758 check : true).stdout()
760 time_epoch = time_epoch.to_int()
762 conf.set('TIME_EPOCH', time_epoch)
764 conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max'))
766 default_user_shell = get_option('default-user-shell')
767 conf.set_quoted('DEFAULT_USER_SHELL', default_user_shell)
768 conf.set_quoted('DEFAULT_USER_SHELL_NAME', fs.name(default_user_shell))
770 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
771 ['system-uid-max', 'SYS_UID_MAX', 999],
772 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
773 ['system-gid-max', 'SYS_GID_MAX', 999]]
774 v = get_option(tuple[0])
778 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
780 check : false).stdout().strip()
787 conf.set(tuple[0].underscorify().to_upper(), v)
789 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
790 error('Invalid uid allocation range')
792 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
793 error('Invalid gid allocation range')
796 dynamic_uid_min = get_option('dynamic-uid-min')
797 dynamic_uid_max = get_option('dynamic-uid-max')
798 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
799 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
801 container_uid_base_min = get_option('container-uid-base-min')
802 container_uid_base_max = get_option('container-uid-base-max')
803 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
804 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
806 nobody_user = get_option('nobody-user')
807 nobody_group = get_option('nobody-group')
809 if not meson.is_cross_build()
810 getent_result = run_command('getent', 'passwd', '65534', check : false)
811 if getent_result.returncode() == 0
812 name = getent_result.stdout().split(':')[0]
813 if name != nobody_user
815 '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) +
816 'Your build will result in an user table setup that is incompatible with the local system.')
819 id_result = run_command('id', '-u', nobody_user, check : false)
820 if id_result.returncode() == 0
821 id = id_result.stdout().to_int()
824 '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) +
825 'Your build will result in an user table setup that is incompatible with the local system.')
829 getent_result = run_command('getent', 'group', '65534', check : false)
830 if getent_result.returncode() == 0
831 name = getent_result.stdout().split(':')[0]
832 if name != nobody_group
834 '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) +
835 'Your build will result in an group table setup that is incompatible with the local system.')
838 id_result = run_command('id', '-g', nobody_group, check : false)
839 if id_result.returncode() == 0
840 id = id_result.stdout().to_int()
843 '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) +
844 'Your build will result in an group table setup that is incompatible with the local system.')
848 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
850 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
851 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
854 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
855 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
858 foreach option : ['adm-gid',
875 'systemd-journal-gid',
876 'systemd-network-uid',
877 'systemd-resolve-uid',
878 'systemd-timesync-uid']
879 name = option.underscorify().to_upper()
880 val = get_option(option)
882 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
883 conf.set(name, val >= 0 ? val : '-')
885 static_ugids += '@0@:@1@'.format(option, val)
889 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
890 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
892 dev_kvm_mode = get_option('dev-kvm-mode')
893 conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation
894 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
895 group_render_mode = get_option('group-render-mode')
896 conf.set_quoted('GROUP_RENDER_MODE', group_render_mode)
897 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
899 kill_user_processes = get_option('default-kill-user-processes')
900 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
902 dns_servers = get_option('dns-servers')
903 conf.set_quoted('DNS_SERVERS', dns_servers)
905 ntp_servers = get_option('ntp-servers')
906 conf.set_quoted('NTP_SERVERS', ntp_servers)
908 default_locale = get_option('default-locale')
909 if default_locale == ''
910 if not meson.is_cross_build()
911 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
912 default_locale = run_command(choose_default_locale_sh,
913 check : true).stdout().strip()
915 default_locale = 'C.UTF-8'
918 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
920 localegen_path = get_option('localegen-path')
921 if localegen_path != ''
922 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
924 conf.set10('HAVE_LOCALEGEN', localegen_path != '')
926 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
928 service_watchdog = get_option('service-watchdog')
929 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
930 conf.set_quoted('SERVICE_WATCHDOG', watchdog_value)
932 conf.set_quoted('SUSHELL', get_option('debug-shell'))
933 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
935 enable_debug_hashmap = false
936 enable_debug_mmap_cache = false
937 enable_debug_siphash = false
938 foreach name : get_option('debug-extra')
940 enable_debug_hashmap = true
941 elif name == 'mmap-cache'
942 enable_debug_mmap_cache = true
943 elif name == 'siphash'
944 enable_debug_siphash = true
946 message('unknown debug option "@0@", ignoring'.format(name))
949 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
950 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
951 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
953 conf.set10('VALGRIND', get_option('valgrind'))
954 conf.set10('LOG_TRACE', get_option('log-trace'))
956 default_user_path = get_option('user-path')
957 if default_user_path != ''
958 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
962 #####################################################################
964 threads = dependency('threads')
965 librt = cc.find_library('rt')
966 libm = cc.find_library('m')
967 libdl = cc.find_library('dl')
968 libcrypt = cc.find_library('crypt')
970 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
972 ['crypt_ra', crypt_header],
973 ['crypt_preferred_method', crypt_header],
974 ['crypt_gensalt_ra', crypt_header]]
976 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
977 dependencies : libcrypt)
978 conf.set10('HAVE_' + ident[0].to_upper(), have)
981 libcap = dependency('libcap', required : false)
982 if not libcap.found()
983 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
984 libcap = cc.find_library('cap')
987 want_bpf_framework = get_option('bpf-framework')
988 bpf_framework_required = want_bpf_framework == 'true'
990 libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2')
991 conf.set10('HAVE_LIBBPF', libbpf.found())
993 if want_bpf_framework == 'false' or not libbpf.found()
994 conf.set10('BPF_FRAMEWORK', 0)
996 # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
997 # (like clang-10/llvm-strip-10)
998 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')
999 r = find_program('clang', required : bpf_framework_required, version : '>= 10.0.0')
1000 clang_found = r.found()
1002 if meson.version().version_compare('>= 0.55')
1003 clang = [r.full_path()]
1008 # Assume that the required flags are supported by the found clang.
1009 clang_supports_flags = clang_found
1012 clang = cc.cmd_array()
1013 clang_supports_flags = cc.has_argument('-Wno-compare-distinct-pointer-types')
1017 # Check if 'clang -target bpf' is supported.
1018 clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
1020 clang_supports_bpf = false
1023 # Debian installs this in /usr/sbin/ which is not in $PATH.
1024 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1025 # We use 'bpftool gen' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
1026 bpftool = find_program('bpftool',
1027 '/usr/sbin/bpftool',
1029 version : '>= 5.13.0')
1032 bpftool_strip = true
1034 bpftool_strip = false
1035 bpftool = find_program('bpftool',
1036 '/usr/sbin/bpftool',
1037 required : bpf_framework_required,
1038 version : '>= 5.6.0')
1041 if not bpftool_strip
1042 if not meson.is_cross_build() and clang_found
1043 llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
1044 check : true).stdout().strip()
1046 llvm_strip_bin = 'llvm-strip'
1048 llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
1051 deps_found = clang_found and clang_supports_bpf and clang_supports_flags and (bpftool_strip or llvm_strip.found()) and bpftool.found()
1053 # Can build BPF program from source code in restricted C
1054 conf.set10('BPF_FRAMEWORK', deps_found)
1057 libmount = dependency('mount',
1058 version : fuzzer_build ? '>= 0' : '>= 2.30')
1060 want_libfdisk = get_option('fdisk')
1061 if want_libfdisk != 'false' and not skip_deps
1062 libfdisk = dependency('fdisk',
1063 version : '>= 2.32',
1064 required : want_libfdisk == 'true')
1065 have = libfdisk.found()
1070 conf.set10('HAVE_LIBFDISK', have)
1072 want_pwquality = get_option('pwquality')
1073 if want_pwquality != 'false' and not skip_deps
1074 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1075 have = libpwquality.found()
1080 conf.set10('HAVE_PWQUALITY', have)
1082 want_seccomp = get_option('seccomp')
1083 if want_seccomp != 'false' and not skip_deps
1084 libseccomp = dependency('libseccomp',
1085 version : '>= 2.3.1',
1086 required : want_seccomp == 'true')
1087 have = libseccomp.found()
1092 conf.set10('HAVE_SECCOMP', have)
1094 want_selinux = get_option('selinux')
1095 if want_selinux != 'false' and not skip_deps
1096 libselinux = dependency('libselinux',
1097 version : '>= 2.1.9',
1098 required : want_selinux == 'true')
1099 have = libselinux.found()
1104 conf.set10('HAVE_SELINUX', have)
1106 want_apparmor = get_option('apparmor')
1107 if want_apparmor != 'false' and not skip_deps
1108 libapparmor = dependency('libapparmor',
1109 version : '>= 2.13',
1110 required : want_apparmor == 'true')
1111 have = libapparmor.found()
1116 conf.set10('HAVE_APPARMOR', have)
1118 have = get_option('smack') and get_option('smack-run-label') != ''
1119 conf.set10('HAVE_SMACK_RUN_LABEL', have)
1121 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1124 want_polkit = get_option('polkit')
1125 install_polkit = false
1126 install_polkit_pkla = false
1127 if want_polkit != 'false' and not skip_deps
1128 install_polkit = true
1130 libpolkit = dependency('polkit-gobject-1',
1132 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1133 message('Old polkit detected, will install pkla files')
1134 install_polkit_pkla = true
1137 conf.set10('ENABLE_POLKIT', install_polkit)
1139 want_acl = get_option('acl')
1140 if want_acl != 'false' and not skip_deps
1141 libacl = cc.find_library('acl', required : want_acl == 'true')
1142 have = libacl.found()
1147 conf.set10('HAVE_ACL', have)
1149 want_audit = get_option('audit')
1150 if want_audit != 'false' and not skip_deps
1151 libaudit = dependency('audit', required : want_audit == 'true')
1152 have = libaudit.found()
1157 conf.set10('HAVE_AUDIT', have)
1159 want_blkid = get_option('blkid')
1160 if want_blkid != 'false' and not skip_deps
1161 libblkid = dependency('blkid', required : want_blkid == 'true')
1162 have = libblkid.found()
1164 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1165 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1170 conf.set10('HAVE_BLKID', have)
1172 want_kmod = get_option('kmod')
1173 if want_kmod != 'false' and not skip_deps
1174 libkmod = dependency('libkmod',
1176 required : want_kmod == 'true')
1177 have = libkmod.found()
1182 conf.set10('HAVE_KMOD', have)
1184 want_pam = get_option('pam')
1185 if want_pam != 'false' and not skip_deps
1186 libpam = cc.find_library('pam', required : want_pam == 'true')
1187 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1188 have = libpam.found() and libpam_misc.found()
1194 conf.set10('HAVE_PAM', have)
1196 want_microhttpd = get_option('microhttpd')
1197 if want_microhttpd != 'false' and not skip_deps
1198 libmicrohttpd = dependency('libmicrohttpd',
1199 version : '>= 0.9.33',
1200 required : want_microhttpd == 'true')
1201 have = libmicrohttpd.found()
1206 conf.set10('HAVE_MICROHTTPD', have)
1208 want_libcryptsetup = get_option('libcryptsetup')
1209 want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1211 if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1212 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1215 if want_libcryptsetup != 'false' and not skip_deps
1216 libcryptsetup = dependency('libcryptsetup',
1217 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1218 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
1219 have = libcryptsetup.found()
1221 foreach ident : ['crypt_set_metadata_size',
1222 'crypt_activate_by_signed_key',
1224 have_ident = have and cc.has_function(
1226 prefix : '#include <libcryptsetup.h>',
1227 dependencies : libcryptsetup)
1228 conf.set10('HAVE_' + ident.to_upper(), have_ident)
1234 conf.set10('HAVE_LIBCRYPTSETUP', have)
1236 if want_libcryptsetup_plugins != 'false' and not skip_deps
1237 have = (cc.has_function(
1238 'crypt_activate_by_token_pin',
1239 prefix : '#include <libcryptsetup.h>',
1240 dependencies : libcryptsetup) and
1242 'crypt_token_external_path',
1243 prefix : '#include <libcryptsetup.h>',
1244 dependencies : libcryptsetup))
1248 conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1250 want_libcurl = get_option('libcurl')
1251 if want_libcurl != 'false' and not skip_deps
1252 libcurl = dependency('libcurl',
1253 version : '>= 7.32.0',
1254 required : want_libcurl == 'true')
1255 have = libcurl.found()
1260 conf.set10('HAVE_LIBCURL', have)
1261 conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
1263 want_libidn = get_option('libidn')
1264 want_libidn2 = get_option('libidn2')
1265 if want_libidn == 'true' and want_libidn2 == 'true'
1266 error('libidn and libidn2 cannot be requested simultaneously')
1269 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1270 libidn = dependency('libidn2',
1271 required : want_libidn2 == 'true')
1272 have = libidn.found()
1277 conf.set10('HAVE_LIBIDN2', have)
1278 if not have and want_libidn != 'false' and not skip_deps
1279 # libidn is used for both libidn and libidn2 objects
1280 libidn = dependency('libidn',
1281 required : want_libidn == 'true')
1282 have = libidn.found()
1286 conf.set10('HAVE_LIBIDN', have)
1288 want_libiptc = get_option('libiptc')
1289 if want_libiptc != 'false' and not skip_deps
1290 libiptc = dependency('libiptc',
1291 required : want_libiptc == 'true')
1292 have = libiptc.found()
1297 conf.set10('HAVE_LIBIPTC', have)
1299 want_qrencode = get_option('qrencode')
1300 if want_qrencode != 'false' and not skip_deps
1301 libqrencode = dependency('libqrencode',
1303 required : want_qrencode == 'true')
1304 have = libqrencode.found()
1309 conf.set10('HAVE_QRENCODE', have)
1311 want_gcrypt = get_option('gcrypt')
1312 if want_gcrypt != 'false' and not skip_deps
1313 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1314 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1315 have = libgcrypt.found() and libgpg_error.found()
1320 # link to neither of the libs if one is not found
1324 conf.set10('HAVE_GCRYPT', have)
1326 want_gnutls = get_option('gnutls')
1327 if want_gnutls != 'false' and not skip_deps
1328 libgnutls = dependency('gnutls',
1329 version : '>= 3.1.4',
1330 required : want_gnutls == 'true')
1331 have = libgnutls.found()
1336 conf.set10('HAVE_GNUTLS', have)
1338 want_openssl = get_option('openssl')
1339 if want_openssl != 'false' and not skip_deps
1340 libopenssl = dependency('openssl',
1341 version : '>= 1.1.0',
1342 required : want_openssl == 'true')
1343 have = libopenssl.found()
1348 conf.set10('HAVE_OPENSSL', have)
1350 want_p11kit = get_option('p11kit')
1351 if want_p11kit != 'false' and not skip_deps
1352 libp11kit = dependency('p11-kit-1',
1353 version : '>= 0.23.3',
1354 required : want_p11kit == 'true')
1355 have = libp11kit.found()
1360 conf.set10('HAVE_P11KIT', have)
1362 want_libfido2 = get_option('libfido2')
1363 if want_libfido2 != 'false' and not skip_deps
1364 libfido2 = dependency('libfido2',
1365 required : want_libfido2 == 'true')
1366 have = libfido2.found()
1371 conf.set10('HAVE_LIBFIDO2', have)
1373 want_tpm2 = get_option('tpm2')
1374 if want_tpm2 != 'false' and not skip_deps
1375 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1376 required : want_tpm2 == 'true')
1382 conf.set10('HAVE_TPM2', have)
1384 want_elfutils = get_option('elfutils')
1385 if want_elfutils != 'false' and not skip_deps
1386 libdw = dependency('libdw',
1387 required : want_elfutils == 'true')
1388 have = libdw.found()
1390 # New in elfutils 0.177
1391 conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING',
1392 have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw))
1397 conf.set10('HAVE_ELFUTILS', have)
1399 want_zlib = get_option('zlib')
1400 if want_zlib != 'false' and not skip_deps
1401 libz = dependency('zlib',
1402 required : want_zlib == 'true')
1408 conf.set10('HAVE_ZLIB', have)
1410 want_bzip2 = get_option('bzip2')
1411 if want_bzip2 != 'false' and not skip_deps
1412 libbzip2 = cc.find_library('bz2',
1413 required : want_bzip2 == 'true')
1414 have = libbzip2.found()
1419 conf.set10('HAVE_BZIP2', have)
1421 want_xz = get_option('xz')
1422 if want_xz != 'false' and not skip_deps
1423 libxz = dependency('liblzma',
1424 required : want_xz == 'true')
1425 have_xz = libxz.found()
1430 conf.set10('HAVE_XZ', have_xz)
1432 want_lz4 = get_option('lz4')
1433 if want_lz4 != 'false' and not skip_deps
1434 liblz4 = dependency('liblz4',
1435 version : '>= 1.3.0',
1436 required : want_lz4 == 'true')
1437 have_lz4 = liblz4.found()
1442 conf.set10('HAVE_LZ4', have_lz4)
1444 want_zstd = get_option('zstd')
1445 if want_zstd != 'false' and not skip_deps
1446 libzstd = dependency('libzstd',
1447 required : want_zstd == 'true',
1448 version : '>= 1.4.0')
1449 have_zstd = libzstd.found()
1454 conf.set10('HAVE_ZSTD', have_zstd)
1456 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1458 want_xkbcommon = get_option('xkbcommon')
1459 if want_xkbcommon != 'false' and not skip_deps
1460 libxkbcommon = dependency('xkbcommon',
1461 version : '>= 0.3.0',
1462 required : want_xkbcommon == 'true')
1463 have = libxkbcommon.found()
1468 conf.set10('HAVE_XKBCOMMON', have)
1470 want_pcre2 = get_option('pcre2')
1471 if want_pcre2 != 'false'
1472 libpcre2 = dependency('libpcre2-8',
1473 required : want_pcre2 == 'true')
1474 have = libpcre2.found()
1479 conf.set10('HAVE_PCRE2', have)
1481 want_glib = get_option('glib')
1482 if want_glib != 'false' and not skip_deps
1483 libglib = dependency('glib-2.0',
1484 version : '>= 2.22.0',
1485 required : want_glib == 'true')
1486 libgobject = dependency('gobject-2.0',
1487 version : '>= 2.22.0',
1488 required : want_glib == 'true')
1489 libgio = dependency('gio-2.0',
1490 required : want_glib == 'true')
1491 have = libglib.found() and libgobject.found() and libgio.found()
1498 conf.set10('HAVE_GLIB', have)
1500 want_dbus = get_option('dbus')
1501 if want_dbus != 'false' and not skip_deps
1502 libdbus = dependency('dbus-1',
1503 version : '>= 1.3.2',
1504 required : want_dbus == 'true')
1505 have = libdbus.found()
1510 conf.set10('HAVE_DBUS', have)
1512 dbusdatadir = datadir / 'dbus-1'
1513 if conf.get('HAVE_DBUS') == 1
1514 dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
1517 dbuspolicydir = get_option('dbuspolicydir')
1518 if dbuspolicydir == ''
1519 dbuspolicydir = dbusdatadir / 'system.d'
1522 dbussessionservicedir = get_option('dbussessionservicedir')
1523 if dbussessionservicedir == ''
1524 dbussessionservicedir = dbusdatadir / 'services'
1525 if conf.get('HAVE_DBUS') == 1
1526 dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
1530 dbussystemservicedir = get_option('dbussystemservicedir')
1531 if dbussystemservicedir == ''
1532 dbussystemservicedir = dbusdatadir / 'system-services'
1533 if conf.get('HAVE_DBUS') == 1
1534 dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
1538 dbus_interfaces_dir = get_option('dbus-interfaces-dir')
1539 if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
1540 if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
1541 dbus_interfaces_dir = 'no'
1542 warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
1544 dbus_interfaces_dir = dbusdatadir / 'interfaces'
1545 if conf.get('HAVE_DBUS') == 1
1546 dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
1550 if dbus_interfaces_dir == dbusdatadir / 'interfaces' or dbus_interfaces_dir == 'no'
1551 dbus_interfaces_dir_name = 'interfaces'
1552 dbus_interfaces_dir_parent = dbusdatadir
1554 elements = dbus_interfaces_dir.split('/')
1555 dbus_interfaces_dir_name = elements[-1]
1556 dbus_interfaces_dir_parent = '/'
1557 foreach elem : elements
1558 if elem == dbus_interfaces_dir_name and dbus_interfaces_dir == dbus_interfaces_dir_parent / dbus_interfaces_dir_name
1561 dbus_interfaces_dir_parent = dbus_interfaces_dir_parent / elem
1565 # We support one or the other. If gcrypt is available, we assume it's there to
1566 # be used, and use it in preference.
1567 opt = get_option('cryptolib')
1568 if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1569 error('openssl requested as the default cryptolib, but not available')
1571 conf.set10('PREFER_OPENSSL',
1572 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1573 conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1574 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
1575 lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? [libopenssl] : [libgcrypt, libgpg_error]
1577 dns_over_tls = get_option('dns-over-tls')
1578 if dns_over_tls != 'false'
1579 if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1
1580 error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib')
1583 if dns_over_tls == 'openssl' or conf.get('PREFER_OPENSSL') == 1
1586 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
1587 if dns_over_tls == 'gnutls' and not have_gnutls
1588 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1591 if dns_over_tls == 'gnutls' or have_gnutls
1592 have_openssl = false
1594 have_openssl = conf.get('HAVE_OPENSSL') == 1
1595 if dns_over_tls != 'auto' and not have_openssl
1596 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
1597 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1600 have = have_gnutls or have_openssl
1604 have_openssl = false
1606 conf.set10('ENABLE_DNS_OVER_TLS', have)
1607 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1608 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1610 default_dns_over_tls = get_option('default-dns-over-tls')
1612 default_dns_over_tls = 'no'
1614 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1615 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.')
1616 default_dns_over_tls = 'no'
1618 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1619 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1620 conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
1622 default_mdns = get_option('default-mdns')
1623 conf.set('DEFAULT_MDNS_MODE',
1624 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1625 conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
1627 default_llmnr = get_option('default-llmnr')
1628 conf.set('DEFAULT_LLMNR_MODE',
1629 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1630 conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
1632 want_repart = get_option('repart')
1633 if want_repart != 'false'
1634 have = conf.get('HAVE_LIBFDISK') == 1
1635 if want_repart == 'true' and not have
1636 error('repart support was requested, but dependencies are not available')
1641 conf.set10('ENABLE_REPART', have)
1643 default_dnssec = get_option('default-dnssec')
1645 default_dnssec = 'no'
1647 if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0
1648 message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.')
1649 default_dnssec = 'no'
1651 conf.set('DEFAULT_DNSSEC_MODE',
1652 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1653 conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1655 want_sysupdate = get_option('sysupdate')
1656 if want_sysupdate != 'false'
1657 have = (conf.get('HAVE_OPENSSL') == 1 and
1658 conf.get('HAVE_LIBFDISK') == 1)
1659 if want_sysupdate == 'true' and not have
1660 error('sysupdate support was requested, but dependencies are not available')
1665 conf.set10('ENABLE_SYSUPDATE', have)
1667 want_importd = get_option('importd')
1668 if want_importd != 'false'
1669 have = (conf.get('HAVE_LIBCURL') == 1 and
1670 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
1671 conf.get('HAVE_ZLIB') == 1 and
1672 conf.get('HAVE_XZ') == 1)
1673 if want_importd == 'true' and not have
1674 error('importd support was requested, but dependencies are not available')
1679 conf.set10('ENABLE_IMPORTD', have)
1681 want_kernel_install = get_option('kernel-install')
1682 conf.set10('ENABLE_KERNEL_INSTALL', want_kernel_install)
1684 want_homed = get_option('homed')
1685 if want_homed != 'false'
1686 have = (conf.get('HAVE_OPENSSL') == 1 and
1687 conf.get('HAVE_LIBFDISK') == 1 and
1688 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1689 if want_homed == 'true' and not have
1690 error('homed support was requested, but dependencies are not available')
1695 conf.set10('ENABLE_HOMED', have)
1697 have = have and conf.get('HAVE_PAM') == 1
1698 conf.set10('ENABLE_PAM_HOME', have)
1700 have = get_option('oomd')
1701 conf.set10('ENABLE_OOMD', have)
1703 want_remote = get_option('remote')
1704 if want_remote != 'false'
1705 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1706 conf.get('HAVE_LIBCURL') == 1]
1707 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1708 # it's possible to build one without the other. Complain only if
1709 # support was explicitly requested. The auxiliary files like sysusers
1710 # config should be installed when any of the programs are built.
1711 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1712 error('remote support was requested, but dependencies are not available')
1714 have = have_deps[0] or have_deps[1]
1718 conf.set10('ENABLE_REMOTE', have)
1720 foreach term : ['analyze',
1734 'compat-mutable-uid-boundaries',
1760 have = get_option(term)
1761 name = 'ENABLE_' + term.underscorify().to_upper()
1762 conf.set10(name, have)
1765 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1767 foreach tuple : [['nss-mymachines', 'machined'],
1768 ['nss-resolve', 'resolve']]
1769 want = get_option(tuple[0])
1771 have = get_option(tuple[1])
1772 if want == 'true' and not have
1773 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1778 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1779 conf.set10(name, have)
1783 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1784 'ENABLE_NSS_MYMACHINES',
1785 'ENABLE_NSS_RESOLVE',
1786 'ENABLE_NSS_SYSTEMD']
1787 if conf.get(term) == 1
1791 conf.set10('ENABLE_NSS', enable_nss)
1793 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1795 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1797 ############################################################
1803 ############################################################
1805 # Include these now as they provide gnu-efi detection.
1806 subdir('src/fundamental')
1807 subdir('src/boot/efi')
1809 ############################################################
1811 generate_gperfs = find_program('tools/generate-gperfs.py')
1812 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1813 make_directive_index_py = find_program('tools/make-directive-index.py')
1814 make_man_index_py = find_program('tools/make-man-index.py')
1815 meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
1816 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1817 update_man_rules_py = find_program('tools/update-man-rules.py')
1818 update_hwdb_sh = find_program('tools/update-hwdb.sh')
1819 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1820 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1821 xml_helper_py = find_program('tools/xml_helper.py')
1822 export_dbus_interfaces_py = find_program('tools/dbus_exporter.py')
1824 ############################################################
1826 config_h = configure_file(
1827 output : 'config.h',
1828 configuration : conf)
1830 add_project_arguments('-include', 'config.h', language : 'c')
1832 jinja2_cmdline = [meson_render_jinja2, config_h, version_h]
1834 ############################################################
1836 # binaries that have --help and are intended for use by humans,
1837 # usually, but not always, installed in /bin.
1838 public_programs = []
1840 # D-Bus introspection XML export
1843 basic_includes = include_directories(
1849 libsystemd_includes = [basic_includes, include_directories(
1850 'src/libsystemd/sd-bus',
1851 'src/libsystemd/sd-device',
1852 'src/libsystemd/sd-event',
1853 'src/libsystemd/sd-hwdb',
1854 'src/libsystemd/sd-id128',
1855 'src/libsystemd/sd-journal',
1856 'src/libsystemd/sd-netlink',
1857 'src/libsystemd/sd-network',
1858 'src/libsystemd/sd-resolve')]
1860 includes = [libsystemd_includes, include_directories('src/shared')]
1865 subdir('src/libsystemd')
1866 subdir('src/shared')
1868 subdir('src/libudev')
1869 subdir('src/cryptsetup/cryptsetup-tokens')
1871 libsystemd = shared_library(
1874 version : libsystemd_version,
1875 include_directories : libsystemd_includes,
1876 link_args : ['-shared',
1877 '-Wl,--version-script=' + libsystemd_sym_path],
1878 link_with : [libbasic,
1880 link_whole : [libsystemd_static],
1881 dependencies : [threads,
1886 link_depends : libsystemd_sym,
1888 install_dir : rootlibdir)
1890 install_libsystemd_static = static_library(
1894 basic_gcrypt_sources,
1895 fundamental_sources,
1897 include_directories : libsystemd_includes,
1898 build_by_default : static_libsystemd != 'false',
1899 install : static_libsystemd != 'false',
1900 install_dir : rootlibdir,
1901 pic : static_libsystemd_pic,
1902 dependencies : [threads,
1913 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1915 libudev = shared_library(
1918 version : libudev_version,
1919 include_directories : includes,
1920 link_args : ['-shared',
1921 '-Wl,--version-script=' + libudev_sym_path],
1922 link_with : [libsystemd_static, libshared_static],
1923 link_whole : libudev_basic,
1924 dependencies : [threads],
1925 link_depends : libudev_sym,
1927 install_dir : rootlibdir)
1929 install_libudev_static = static_library(
1932 fundamental_sources,
1937 include_directories : includes,
1938 build_by_default : static_libudev != 'false',
1939 install : static_libudev != 'false',
1940 install_dir : rootlibdir,
1941 link_depends : libudev_sym,
1942 dependencies : libshared_deps + [libmount],
1943 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1944 pic : static_libudev_pic)
1946 if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
1947 if conf.get('HAVE_TPM2') == 1
1948 cryptsetup_token_systemd_tpm2 = shared_library(
1949 'cryptsetup-token-systemd-tpm2',
1950 cryptsetup_token_systemd_tpm2_sources,
1951 include_directories : includes,
1952 link_args : ['-shared',
1953 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1954 link_with : [lib_cryptsetup_token_common,
1956 dependencies : [libcryptsetup,
1959 link_depends : cryptsetup_token_sym,
1960 install_rpath : rootlibexecdir,
1962 install_dir : libcryptsetup_plugins_dir)
1965 if conf.get('HAVE_LIBFIDO2') == 1
1966 cryptsetup_token_systemd_fido2 = shared_library(
1967 'cryptsetup-token-systemd-fido2',
1968 cryptsetup_token_systemd_fido2_sources,
1969 include_directories : includes,
1970 link_args : ['-shared',
1971 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1972 link_with : [lib_cryptsetup_token_common,
1974 dependencies : [libcryptsetup,
1977 link_depends : cryptsetup_token_sym,
1978 install_rpath : rootlibexecdir,
1980 install_dir : libcryptsetup_plugins_dir)
1983 if conf.get('HAVE_P11KIT') == 1
1984 cryptsetup_token_systemd_pkcs11 = shared_library(
1985 'cryptsetup-token-systemd-pkcs11',
1986 cryptsetup_token_systemd_pkcs11_sources,
1987 include_directories : includes,
1988 link_args : ['-shared',
1989 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1990 link_with : [lib_cryptsetup_token_common,
1992 dependencies : [libcryptsetup,
1995 link_depends : cryptsetup_token_sym,
1996 install_rpath : rootlibexecdir,
1998 install_dir : libcryptsetup_plugins_dir)
2002 ############################################################
2004 # systemd-analyze requires 'libcore'
2006 # systemd-journal-remote requires 'libjournal_core'
2007 subdir('src/journal')
2008 # systemd-networkd requires 'libsystemd_network'
2009 subdir('src/libsystemd-network')
2011 subdir('src/analyze')
2012 subdir('src/busctl')
2013 subdir('src/coredump')
2014 subdir('src/cryptenroll')
2015 subdir('src/cryptsetup')
2017 subdir('src/hostname')
2018 subdir('src/import')
2019 subdir('src/journal-remote')
2020 subdir('src/kernel-install')
2021 subdir('src/locale')
2023 subdir('src/machine')
2024 subdir('src/network')
2025 subdir('src/nspawn')
2027 subdir('src/partition')
2028 subdir('src/portable')
2029 subdir('src/pstore')
2030 subdir('src/resolve')
2032 subdir('src/shutdown')
2033 subdir('src/sysext')
2034 subdir('src/systemctl')
2035 subdir('src/sysupdate')
2036 subdir('src/timedate')
2037 subdir('src/timesync')
2038 subdir('src/tmpfiles')
2039 subdir('src/userdb')
2040 subdir('src/vconsole')
2041 subdir('src/xdg-autostart-generator')
2043 subdir('src/systemd')
2050 ############################################################
2052 # only static linking apart from libdl, to make sure that the
2053 # module is linked to all libraries that it uses.
2054 test_dlopen = executable(
2058 include_directories : includes,
2059 link_with : [libbasic],
2060 dependencies : [libdl],
2061 build_by_default : want_tests != 'false')
2063 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
2064 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
2065 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
2066 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
2068 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
2072 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
2073 version_script_arg = project_source_root / sym
2075 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
2076 if tuple.length() > 2
2077 foreach s : tuple[2]
2078 sources += ['src/nss-@0@/@1@'.format(module, s)]
2082 incs = tuple.length() > 3 ? tuple[3] : includes
2084 nss = shared_library(
2089 include_directories : incs,
2090 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
2091 link_args : ['-Wl,-z,nodelete',
2093 '-Wl,--version-script=' + version_script_arg],
2094 link_with : [libsystemd_static,
2097 dependencies : [threads,
2101 install_dir : rootlibdir)
2103 # We cannot use shared_module because it does not support version suffix.
2104 # Unfortunately shared_library insists on creating the symlink…
2105 meson.add_install_script('sh', '-c',
2106 'rm $DESTDIR@0@/libnss_@1@.so'
2107 .format(rootlibdir, module))
2109 if want_tests != 'false'
2110 test('dlopen-nss_' + module,
2112 # path to dlopen must include a slash
2113 args : nss.full_path(),
2119 ############################################################
2124 include_directories : includes,
2125 link_with : [libcore,
2127 dependencies : [versiondep,
2129 install_rpath : rootlibexecdir,
2131 install_dir : rootlibexecdir)
2132 dbus_programs += exe
2133 public_programs += exe
2135 meson.add_install_script(meson_make_symlink,
2136 rootlibexecdir / 'systemd',
2137 rootsbindir / 'init')
2139 public_programs += executable(
2141 systemd_analyze_sources,
2142 include_directories : core_includes,
2143 link_with : [libcore,
2145 dependencies : [versiondep,
2147 install_rpath : rootlibexecdir,
2148 install : conf.get('ENABLE_ANALYZE'))
2152 systemd_journald_sources,
2153 include_directories : includes,
2154 link_with : [libjournal_core,
2156 dependencies : [threads,
2161 install_rpath : rootlibexecdir,
2163 install_dir : rootlibexecdir)
2165 public_programs += executable(
2167 systemd_cat_sources,
2168 include_directories : includes,
2169 link_with : [libjournal_core,
2171 dependencies : [threads],
2172 install_rpath : rootlibexecdir,
2175 public_programs += executable(
2178 include_directories : includes,
2179 link_with : [libshared],
2180 dependencies : [threads,
2186 install_rpath : rootlibexecdir,
2188 install_dir : rootbindir)
2191 'systemd-getty-generator',
2192 'src/getty-generator/getty-generator.c',
2193 include_directories : includes,
2194 link_with : [libshared],
2195 install_rpath : rootlibexecdir,
2197 install_dir : systemgeneratordir)
2200 'systemd-debug-generator',
2201 'src/debug-generator/debug-generator.c',
2202 include_directories : includes,
2203 link_with : [libshared],
2204 install_rpath : rootlibexecdir,
2206 install_dir : systemgeneratordir)
2209 'systemd-run-generator',
2210 'src/run-generator/run-generator.c',
2211 include_directories : includes,
2212 link_with : [libshared],
2213 install_rpath : rootlibexecdir,
2215 install_dir : systemgeneratordir)
2218 'systemd-fstab-generator',
2219 'src/fstab-generator/fstab-generator.c',
2220 include_directories : includes,
2221 link_with : [libshared],
2222 install_rpath : rootlibexecdir,
2224 install_dir : systemgeneratordir)
2226 if want_tests != 'false'
2227 test('test-fstab-generator',
2228 test_fstab_generator_sh,
2229 # https://github.com/mesonbuild/meson/issues/2681
2230 args : exe.full_path(),
2234 if conf.get('ENABLE_ENVIRONMENT_D') == 1
2236 '30-systemd-environment-d-generator',
2237 'src/environment-d-generator/environment-d-generator.c',
2238 include_directories : includes,
2239 link_with : [libshared],
2240 install_rpath : rootlibexecdir,
2242 install_dir : userenvgeneratordir)
2244 meson.add_install_script(meson_make_symlink,
2245 sysconfdir / 'environment',
2246 environmentdir / '99-environment.conf')
2249 if conf.get('ENABLE_HIBERNATE') == 1
2251 'systemd-hibernate-resume-generator',
2252 'src/hibernate-resume/hibernate-resume-generator.c',
2253 include_directories : includes,
2254 link_with : [libshared],
2255 install_rpath : rootlibexecdir,
2257 install_dir : systemgeneratordir)
2260 'systemd-hibernate-resume',
2261 'src/hibernate-resume/hibernate-resume.c',
2262 include_directories : includes,
2263 link_with : [libshared],
2264 install_rpath : rootlibexecdir,
2266 install_dir : rootlibexecdir)
2269 if conf.get('HAVE_BLKID') == 1
2271 'systemd-gpt-auto-generator',
2272 'src/gpt-auto-generator/gpt-auto-generator.c',
2273 include_directories : includes,
2274 link_with : [libshared],
2275 dependencies : libblkid,
2276 install_rpath : rootlibexecdir,
2278 install_dir : systemgeneratordir)
2280 public_programs += executable(
2282 'src/dissect/dissect.c',
2283 include_directories : includes,
2284 link_with : [libshared],
2285 install_rpath : rootlibexecdir,
2289 if conf.get('ENABLE_RESOLVE') == 1
2290 dbus_programs += executable(
2292 systemd_resolved_sources,
2293 include_directories : resolve_includes,
2294 link_with : [libshared,
2296 libsystemd_resolve_core],
2297 dependencies : systemd_resolved_dependencies,
2298 install_rpath : rootlibexecdir,
2300 install_dir : rootlibexecdir)
2302 public_programs += executable(
2305 include_directories : includes,
2306 link_with : [libshared,
2308 libsystemd_resolve_core],
2309 dependencies : [threads,
2310 lib_openssl_or_gcrypt,
2313 install_rpath : rootlibexecdir,
2316 meson.add_install_script(meson_make_symlink,
2317 bindir / 'resolvectl',
2318 rootsbindir / 'resolvconf')
2320 meson.add_install_script(meson_make_symlink,
2321 bindir / 'resolvectl',
2322 bindir / 'systemd-resolve')
2325 if conf.get('ENABLE_LOGIND') == 1
2326 dbus_programs += executable(
2328 systemd_logind_sources,
2329 include_directories : includes,
2330 link_with : [liblogind_core,
2332 dependencies : [threads,
2334 install_rpath : rootlibexecdir,
2336 install_dir : rootlibexecdir)
2338 public_programs += executable(
2341 include_directories : includes,
2342 link_with : [libshared],
2343 dependencies : [threads,
2347 install_rpath : rootlibexecdir,
2349 install_dir : rootbindir)
2351 public_programs += executable(
2353 'src/login/inhibit.c',
2354 include_directories : includes,
2355 link_with : [libshared],
2356 install_rpath : rootlibexecdir,
2358 install_dir : rootbindir)
2360 if conf.get('HAVE_PAM') == 1
2361 version_script_arg = project_source_root / pam_systemd_sym
2362 pam_systemd = shared_library(
2366 include_directories : includes,
2367 link_args : ['-shared',
2368 '-Wl,--version-script=' + version_script_arg],
2369 link_with : [libsystemd_static,
2371 dependencies : [threads,
2374 link_depends : pam_systemd_sym,
2376 install_dir : pamlibdir)
2378 if want_tests != 'false'
2379 test('dlopen-pam_systemd',
2381 # path to dlopen must include a slash
2382 args : pam_systemd.full_path(),
2383 depends : pam_systemd)
2388 'systemd-user-runtime-dir',
2389 user_runtime_dir_sources,
2390 include_directories : includes,
2391 link_with : [libshared],
2392 install_rpath : rootlibexecdir,
2394 install_dir : rootlibexecdir)
2397 if conf.get('HAVE_PAM') == 1
2399 'systemd-user-sessions',
2400 'src/user-sessions/user-sessions.c',
2401 include_directories : includes,
2402 link_with : [libshared],
2403 install_rpath : rootlibexecdir,
2405 install_dir : rootlibexecdir)
2408 if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
2409 if get_option('link-boot-shared')
2410 boot_link_with = [libshared]
2412 boot_link_with = [libsystemd_static, libshared_static]
2415 public_programs += executable(
2417 'src/boot/bootctl.c',
2418 include_directories : includes,
2419 link_with : [boot_link_with],
2420 dependencies : [libblkid],
2421 install_rpath : rootlibexecdir,
2424 public_programs += executable(
2425 'systemd-bless-boot',
2426 'src/boot/bless-boot.c',
2427 include_directories : includes,
2428 link_with : [boot_link_with],
2429 dependencies : [libblkid],
2430 install_rpath : rootlibexecdir,
2432 install_dir : rootlibexecdir)
2435 'systemd-bless-boot-generator',
2436 'src/boot/bless-boot-generator.c',
2437 include_directories : includes,
2438 link_with : [boot_link_with],
2439 install_rpath : rootlibexecdir,
2441 install_dir : systemgeneratordir)
2445 'systemd-boot-check-no-failures',
2446 'src/boot/boot-check-no-failures.c',
2447 include_directories : includes,
2448 link_with : [libshared],
2449 dependencies : [libblkid],
2450 install_rpath : rootlibexecdir,
2452 install_dir : rootlibexecdir)
2454 public_programs += executable(
2455 'systemd-socket-activate',
2456 'src/activate/activate.c',
2457 include_directories : includes,
2458 link_with : [libshared],
2459 dependencies : [threads],
2460 install_rpath : rootlibexecdir,
2463 systemctl = executable(
2466 include_directories : includes,
2467 link_with : systemctl_link_with,
2468 dependencies : [threads,
2474 install_rpath : rootlibexecdir,
2476 install_dir : rootbindir)
2477 public_programs += systemctl
2479 if conf.get('ENABLE_PORTABLED') == 1
2480 dbus_programs += executable(
2481 'systemd-portabled',
2482 systemd_portabled_sources,
2483 include_directories : includes,
2484 link_with : [libshared],
2485 dependencies : [threads, libselinux],
2486 install_rpath : rootlibexecdir,
2488 install_dir : rootlibexecdir)
2490 public_programs += executable(
2492 'src/portable/portablectl.c',
2493 include_directories : includes,
2494 link_with : [libshared],
2495 dependencies : [threads],
2496 install_rpath : rootlibexecdir,
2498 install_dir : rootbindir)
2501 if conf.get('ENABLE_SYSEXT') == 1
2502 public_programs += executable(
2504 systemd_sysext_sources,
2505 include_directories : includes,
2506 link_with : [libshared],
2507 install_rpath : rootlibexecdir,
2509 install_dir : rootbindir)
2512 if conf.get('ENABLE_USERDB') == 1
2515 systemd_userwork_sources,
2516 include_directories : includes,
2517 link_with : [libshared],
2518 dependencies : [threads],
2519 install_rpath : rootlibexecdir,
2521 install_dir : rootlibexecdir)
2525 systemd_userdbd_sources,
2526 include_directories : includes,
2527 link_with : [libshared],
2528 dependencies : [threads],
2529 install_rpath : rootlibexecdir,
2531 install_dir : rootlibexecdir)
2533 public_programs += executable(
2536 include_directories : includes,
2537 link_with : [libshared],
2538 dependencies : [threads],
2539 install_rpath : rootlibexecdir,
2541 install_dir : rootbindir)
2544 if conf.get('ENABLE_HOMED') == 1
2547 systemd_homework_sources,
2548 include_directories : includes,
2549 link_with : [libshared],
2550 dependencies : [threads,
2556 install_rpath : rootlibexecdir,
2558 install_dir : rootlibexecdir)
2560 dbus_programs += executable(
2562 systemd_homed_sources,
2563 include_directories : home_includes,
2564 link_with : [libshared],
2565 dependencies : [threads,
2569 install_rpath : rootlibexecdir,
2571 install_dir : rootlibexecdir)
2573 public_programs += executable(
2576 include_directories : includes,
2577 link_with : [libshared],
2578 dependencies : [threads,
2583 install_rpath : rootlibexecdir,
2585 install_dir : rootbindir)
2587 if conf.get('HAVE_PAM') == 1
2588 version_script_arg = project_source_root / pam_systemd_home_sym
2589 pam_systemd = shared_library(
2593 include_directories : includes,
2594 link_args : ['-shared',
2595 '-Wl,--version-script=' + version_script_arg],
2596 link_with : [libsystemd_static,
2598 dependencies : [threads,
2602 link_depends : pam_systemd_home_sym,
2604 install_dir : pamlibdir)
2608 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2609 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2610 meson.add_install_script(meson_make_symlink,
2611 rootbindir / 'systemctl',
2612 rootsbindir / alias)
2615 meson.add_install_script(meson_make_symlink,
2616 rootbindir / 'udevadm',
2617 rootlibexecdir / 'systemd-udevd')
2619 if conf.get('ENABLE_BACKLIGHT') == 1
2621 'systemd-backlight',
2622 'src/backlight/backlight.c',
2623 include_directories : includes,
2624 link_with : [libshared],
2625 install_rpath : rootlibexecdir,
2627 install_dir : rootlibexecdir)
2630 if conf.get('ENABLE_RFKILL') == 1
2633 'src/rfkill/rfkill.c',
2634 include_directories : includes,
2635 link_with : [libshared],
2636 install_rpath : rootlibexecdir,
2638 install_dir : rootlibexecdir)
2642 'systemd-system-update-generator',
2643 'src/system-update-generator/system-update-generator.c',
2644 include_directories : includes,
2645 link_with : [libshared],
2646 install_rpath : rootlibexecdir,
2648 install_dir : systemgeneratordir)
2650 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2652 'systemd-cryptsetup',
2653 systemd_cryptsetup_sources,
2654 include_directories : includes,
2655 link_with : [libshared],
2656 dependencies : [libcryptsetup,
2658 install_rpath : rootlibexecdir,
2660 install_dir : rootlibexecdir)
2663 'systemd-cryptsetup-generator',
2664 'src/cryptsetup/cryptsetup-generator.c',
2665 include_directories : includes,
2666 link_with : [libshared],
2667 install_rpath : rootlibexecdir,
2669 install_dir : systemgeneratordir)
2672 'systemd-veritysetup',
2673 'src/veritysetup/veritysetup.c',
2674 include_directories : includes,
2675 link_with : [libshared],
2676 dependencies : [libcryptsetup],
2677 install_rpath : rootlibexecdir,
2679 install_dir : rootlibexecdir)
2682 'systemd-veritysetup-generator',
2683 'src/veritysetup/veritysetup-generator.c',
2684 include_directories : includes,
2685 link_with : [libshared],
2686 install_rpath : rootlibexecdir,
2688 install_dir : systemgeneratordir)
2690 public_programs += executable(
2691 'systemd-cryptenroll',
2692 systemd_cryptenroll_sources,
2693 include_directories : includes,
2694 link_with : [libshared],
2695 dependencies : [libcryptsetup,
2699 install_rpath : rootlibexecdir,
2703 'systemd-integritysetup',
2704 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
2705 include_directories : includes,
2706 link_with : [libshared],
2707 dependencies : [libcryptsetup],
2708 install_rpath : rootlibexecdir,
2710 install_dir : rootlibexecdir)
2713 'systemd-integritysetup-generator',
2714 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
2715 include_directories : includes,
2716 link_with : [libshared],
2717 install_rpath : rootlibexecdir,
2719 install_dir : systemgeneratordir)
2722 if conf.get('HAVE_SYSV_COMPAT') == 1
2724 'systemd-sysv-generator',
2725 'src/sysv-generator/sysv-generator.c',
2726 include_directories : includes,
2727 link_with : [libshared],
2728 install_rpath : rootlibexecdir,
2730 install_dir : systemgeneratordir)
2732 sysv_generator_test_py = find_program('test/sysv-generator-test.py')
2733 if want_tests != 'false'
2734 test('sysv-generator-test',
2735 sysv_generator_test_py,
2740 'systemd-rc-local-generator',
2741 'src/rc-local-generator/rc-local-generator.c',
2742 include_directories : includes,
2743 link_with : [libshared],
2744 install_rpath : rootlibexecdir,
2746 install_dir : systemgeneratordir)
2749 if conf.get('ENABLE_XDG_AUTOSTART') == 1
2751 'systemd-xdg-autostart-generator',
2752 systemd_xdg_autostart_generator_sources,
2753 include_directories : includes,
2754 link_with : [libshared],
2755 install_rpath : rootlibexecdir,
2757 install_dir : usergeneratordir)
2760 'systemd-xdg-autostart-condition',
2761 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2762 include_directories : includes,
2763 link_with : [libshared],
2764 install_rpath : rootlibexecdir,
2766 install_dir : rootlibexecdir)
2769 if conf.get('ENABLE_HOSTNAMED') == 1
2770 dbus_programs += executable(
2771 'systemd-hostnamed',
2772 'src/hostname/hostnamed.c',
2773 include_directories : includes,
2774 link_with : [libshared],
2775 install_rpath : rootlibexecdir,
2777 install_dir : rootlibexecdir)
2779 public_programs += executable(
2781 'src/hostname/hostnamectl.c',
2782 include_directories : includes,
2783 link_with : [libshared],
2784 install_rpath : rootlibexecdir,
2788 if conf.get('ENABLE_LOCALED') == 1
2789 if conf.get('HAVE_XKBCOMMON') == 1
2790 # logind will load libxkbcommon.so dynamically on its own, but we still
2791 # need to specify where the headers are
2792 deps = [libdl, libxkbcommon.partial_dependency(compile_args: true)]
2797 dbus_programs += executable(
2799 systemd_localed_sources,
2800 include_directories : includes,
2801 link_with : [libshared],
2802 dependencies : deps,
2803 install_rpath : rootlibexecdir,
2805 install_dir : rootlibexecdir)
2807 public_programs += executable(
2810 include_directories : includes,
2811 link_with : [libshared],
2812 install_rpath : rootlibexecdir,
2816 if conf.get('ENABLE_TIMEDATED') == 1
2817 dbus_programs += executable(
2818 'systemd-timedated',
2819 'src/timedate/timedated.c',
2820 include_directories : includes,
2821 link_with : [libshared],
2822 install_rpath : rootlibexecdir,
2824 install_dir : rootlibexecdir)
2827 if conf.get('ENABLE_TIMEDATECTL') == 1
2828 public_programs += executable(
2830 'src/timedate/timedatectl.c',
2831 include_directories : includes,
2832 install_rpath : rootlibexecdir,
2833 link_with : [libshared],
2834 dependencies : [libm],
2838 if conf.get('ENABLE_TIMESYNCD') == 1
2840 'systemd-timesyncd',
2841 systemd_timesyncd_sources,
2842 include_directories : includes,
2843 link_with : [libtimesyncd_core],
2844 dependencies : [threads,
2846 install_rpath : rootlibexecdir,
2848 install_dir : rootlibexecdir)
2851 'systemd-time-wait-sync',
2852 'src/timesync/wait-sync.c',
2853 include_directories : includes,
2854 link_with : [libtimesyncd_core],
2855 install_rpath : rootlibexecdir,
2857 install_dir : rootlibexecdir)
2860 if conf.get('ENABLE_MACHINED') == 1
2861 dbus_programs += executable(
2863 systemd_machined_sources,
2864 include_directories : includes,
2865 link_with : [libmachine_core,
2867 install_rpath : rootlibexecdir,
2869 install_dir : rootlibexecdir)
2871 public_programs += executable(
2873 'src/machine/machinectl.c',
2874 include_directories : includes,
2875 link_with : [libshared],
2876 dependencies : [threads,
2880 install_rpath : rootlibexecdir,
2882 install_dir : rootbindir)
2885 if conf.get('ENABLE_IMPORTD') == 1
2886 dbus_programs += executable(
2888 systemd_importd_sources,
2889 include_directories : includes,
2890 link_with : [libshared],
2891 dependencies : [threads],
2892 install_rpath : rootlibexecdir,
2894 install_dir : rootlibexecdir)
2896 systemd_pull = executable(
2898 systemd_pull_sources,
2899 include_directories : includes,
2900 link_with : [libshared,
2902 dependencies : [versiondep,
2904 lib_openssl_or_gcrypt,
2908 install_rpath : rootlibexecdir,
2910 install_dir : rootlibexecdir)
2912 systemd_import = executable(
2914 systemd_import_sources,
2915 include_directories : includes,
2916 link_with : [libshared,
2918 dependencies : [libcurl,
2922 install_rpath : rootlibexecdir,
2924 install_dir : rootlibexecdir)
2926 systemd_import_fs = executable(
2927 'systemd-import-fs',
2928 systemd_import_fs_sources,
2929 include_directories : includes,
2930 link_with : [libshared,
2932 install_rpath : rootlibexecdir,
2934 install_dir : rootlibexecdir)
2936 systemd_export = executable(
2938 systemd_export_sources,
2939 include_directories : includes,
2940 link_with : [libshared,
2942 dependencies : [libcurl,
2946 install_rpath : rootlibexecdir,
2948 install_dir : rootlibexecdir)
2950 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2953 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2954 public_programs += executable(
2955 'systemd-journal-upload',
2956 systemd_journal_upload_sources,
2957 include_directories : includes,
2958 link_with : [libshared],
2959 dependencies : [versiondep,
2966 install_rpath : rootlibexecdir,
2968 install_dir : rootlibexecdir)
2971 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2972 public_programs += executable(
2973 'systemd-journal-remote',
2974 systemd_journal_remote_sources,
2975 include_directories : journal_includes,
2976 link_with : [libshared,
2977 libsystemd_journal_remote],
2978 dependencies : [threads,
2984 install_rpath : rootlibexecdir,
2986 install_dir : rootlibexecdir)
2988 public_programs += executable(
2989 'systemd-journal-gatewayd',
2990 systemd_journal_gatewayd_sources,
2991 include_directories : journal_includes,
2992 link_with : [libshared],
2993 dependencies : [threads,
2999 install_rpath : rootlibexecdir,
3001 install_dir : rootlibexecdir)
3004 if conf.get('ENABLE_COREDUMP') == 1
3007 systemd_coredump_sources,
3008 include_directories : includes,
3009 link_with : [libshared],
3010 dependencies : [threads,
3015 install_rpath : rootlibexecdir,
3017 install_dir : rootlibexecdir)
3019 public_programs += executable(
3021 coredumpctl_sources,
3022 include_directories : includes,
3023 link_with : [libshared],
3024 dependencies : [threads,
3028 install_rpath : rootlibexecdir,
3032 if conf.get('ENABLE_PSTORE') == 1
3035 systemd_pstore_sources,
3036 include_directories : includes,
3037 link_with : [libshared],
3038 dependencies : [threads,
3043 install_rpath : rootlibexecdir,
3045 install_dir : rootlibexecdir)
3048 if conf.get('ENABLE_OOMD') == 1
3049 dbus_programs += executable('systemd-oomd',
3050 systemd_oomd_sources,
3051 include_directories : includes,
3052 link_with : [libshared],
3054 install_rpath : rootlibexecdir,
3056 install_dir : rootlibexecdir)
3058 public_programs += executable(
3061 include_directories : includes,
3062 link_with : [libshared],
3064 install_rpath : rootlibexecdir,
3068 if conf.get('ENABLE_BINFMT') == 1
3069 public_programs += executable(
3071 'src/binfmt/binfmt.c',
3072 include_directories : includes,
3073 link_with : [libshared],
3074 install_rpath : rootlibexecdir,
3076 install_dir : rootlibexecdir)
3078 meson.add_install_script('sh', '-c',
3079 mkdir_p.format(binfmtdir))
3080 if install_sysconfdir
3081 meson.add_install_script('sh', '-c',
3082 mkdir_p.format(sysconfdir / 'binfmt.d'))
3086 if conf.get('ENABLE_SYSUPDATE') == 1
3088 'systemd-sysupdate',
3089 systemd_sysupdate_sources,
3090 include_directories : includes,
3091 link_with : [libshared],
3092 dependencies : [threads,
3096 install_rpath : rootlibexecdir,
3098 install_dir : rootlibexecdir)
3099 public_programs += exe
3102 if conf.get('ENABLE_VCONSOLE') == 1
3104 'systemd-vconsole-setup',
3105 'src/vconsole/vconsole-setup.c',
3106 include_directories : includes,
3107 link_with : [libshared],
3108 install_rpath : rootlibexecdir,
3110 install_dir : rootlibexecdir)
3113 if conf.get('ENABLE_RANDOMSEED') == 1
3115 'systemd-random-seed',
3116 'src/random-seed/random-seed.c',
3117 include_directories : includes,
3118 link_with : [libshared],
3119 install_rpath : rootlibexecdir,
3121 install_dir : rootlibexecdir)
3124 if conf.get('ENABLE_FIRSTBOOT') == 1
3125 public_programs += executable(
3126 'systemd-firstboot',
3127 'src/firstboot/firstboot.c',
3128 include_directories : includes,
3129 link_with : [libshared],
3130 dependencies : [libcrypt],
3131 install_rpath : rootlibexecdir,
3133 install_dir : rootbindir)
3137 'systemd-remount-fs',
3138 'src/remount-fs/remount-fs.c',
3139 include_directories : includes,
3140 link_with : [libshared],
3141 install_rpath : rootlibexecdir,
3143 install_dir : rootlibexecdir)
3146 'systemd-machine-id-setup',
3147 'src/machine-id-setup/machine-id-setup-main.c',
3148 include_directories : includes,
3149 link_with : [libshared],
3150 install_rpath : rootlibexecdir,
3152 install_dir : rootbindir)
3157 include_directories : includes,
3158 link_with : [libshared],
3159 install_rpath : rootlibexecdir,
3161 install_dir : rootlibexecdir)
3163 executable('systemd-growfs',
3164 'src/partition/growfs.c',
3165 include_directories : includes,
3166 link_with : [libshared],
3167 install_rpath : rootlibexecdir,
3169 install_dir : rootlibexecdir)
3173 'src/partition/makefs.c',
3174 include_directories : includes,
3175 link_with : [libshared],
3176 install_rpath : rootlibexecdir,
3178 install_dir : rootlibexecdir)
3182 'src/sleep/sleep.c',
3183 include_directories : includes,
3184 link_with : [libshared],
3185 install_rpath : rootlibexecdir,
3187 install_dir : rootlibexecdir)
3189 if install_sysconfdir_samples
3190 install_data('src/sleep/sleep.conf',
3191 install_dir : pkgsysconfdir)
3194 public_programs += executable(
3196 'src/sysctl/sysctl.c',
3197 include_directories : includes,
3198 link_with : [libshared],
3199 install_rpath : rootlibexecdir,
3201 install_dir : rootlibexecdir)
3205 'src/ac-power/ac-power.c',
3206 include_directories : includes,
3207 link_with : [libshared],
3208 install_rpath : rootlibexecdir,
3210 install_dir : rootlibexecdir)
3212 public_programs += executable(
3213 'systemd-detect-virt',
3214 'src/detect-virt/detect-virt.c',
3215 include_directories : includes,
3216 link_with : [libshared],
3217 install_rpath : rootlibexecdir,
3220 public_programs += executable(
3222 'src/delta/delta.c',
3223 include_directories : includes,
3224 link_with : [libshared],
3225 install_rpath : rootlibexecdir,
3228 public_programs += executable(
3230 'src/escape/escape.c',
3231 include_directories : includes,
3232 link_with : [libshared],
3233 install_rpath : rootlibexecdir,
3235 install_dir : rootbindir)
3237 public_programs += executable(
3239 'src/notify/notify.c',
3240 include_directories : includes,
3241 link_with : [libshared],
3242 install_rpath : rootlibexecdir,
3244 install_dir : rootbindir)
3246 public_programs += executable(
3248 'src/creds/creds.c',
3249 include_directories : includes,
3250 link_with : [libshared],
3251 dependencies : [threads,
3253 install_rpath : rootlibexecdir,
3255 install_dir : rootbindir)
3258 'systemd-volatile-root',
3259 'src/volatile-root/volatile-root.c',
3260 include_directories : includes,
3261 link_with : [libshared],
3262 install_rpath : rootlibexecdir,
3263 install : conf.get('ENABLE_INITRD') == 1,
3264 install_dir : rootlibexecdir)
3267 'systemd-cgroups-agent',
3268 'src/cgroups-agent/cgroups-agent.c',
3269 include_directories : includes,
3270 link_with : [libshared],
3271 install_rpath : rootlibexecdir,
3273 install_dir : rootlibexecdir)
3275 systemd_id128 = executable(
3277 'src/id128/id128.c',
3278 include_directories : includes,
3279 link_with : [libshared],
3280 install_rpath : rootlibexecdir,
3282 public_programs += systemd_id128
3284 if want_tests != 'false'
3285 test('test-systemctl-enable',
3286 test_systemctl_enable_sh,
3287 # https://github.com/mesonbuild/meson/issues/2681
3288 args : [systemctl.full_path(),
3289 systemd_id128.full_path()])
3292 public_programs += executable(
3295 include_directories : includes,
3296 link_with : [libshared],
3297 install_rpath : rootlibexecdir,
3300 public_programs += executable(
3301 'systemd-ask-password',
3302 'src/ask-password/ask-password.c',
3303 include_directories : includes,
3304 link_with : [libshared],
3305 install_rpath : rootlibexecdir,
3307 install_dir : rootbindir)
3310 'systemd-reply-password',
3311 'src/reply-password/reply-password.c',
3312 include_directories : includes,
3313 link_with : [libshared],
3314 install_rpath : rootlibexecdir,
3316 install_dir : rootlibexecdir)
3318 public_programs += executable(
3319 'systemd-tty-ask-password-agent',
3320 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3321 include_directories : includes,
3322 link_with : [libshared],
3323 install_rpath : rootlibexecdir,
3325 install_dir : rootbindir)
3327 public_programs += executable(
3330 include_directories : includes,
3331 link_with : [libshared],
3332 install_rpath : rootlibexecdir,
3335 public_programs += executable(
3337 'src/cgtop/cgtop.c',
3338 include_directories : includes,
3339 link_with : [libshared],
3340 install_rpath : rootlibexecdir,
3345 'src/initctl/initctl.c',
3346 include_directories : includes,
3347 link_with : [libshared],
3348 install_rpath : rootlibexecdir,
3349 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3350 install_dir : rootlibexecdir)
3352 public_programs += executable(
3354 'src/mount/mount-tool.c',
3355 include_directories : includes,
3356 link_with : [libshared],
3357 dependencies: [libmount],
3358 install_rpath : rootlibexecdir,
3361 meson.add_install_script(meson_make_symlink,
3362 'systemd-mount', bindir / 'systemd-umount')
3364 public_programs += executable(
3367 include_directories : includes,
3368 link_with : [libshared],
3369 install_rpath : rootlibexecdir,
3372 public_programs += executable(
3373 'systemd-stdio-bridge',
3374 'src/stdio-bridge/stdio-bridge.c',
3375 include_directories : includes,
3376 link_with : [libshared],
3377 dependencies : [versiondep],
3378 install_rpath : rootlibexecdir,
3381 public_programs += executable(
3384 include_directories : includes,
3385 link_with : [libshared],
3386 dependencies : [versiondep],
3387 install_rpath : rootlibexecdir,
3393 'src/sysusers/sysusers.c',
3394 include_directories : includes,
3395 link_with : [libshared],
3396 install_rpath : rootlibexecdir,
3398 install_dir : rootbindir)
3399 public_programs += exe
3401 if want_tests != 'false'
3402 test('test-sysusers',
3404 # https://github.com/mesonbuild/meson/issues/2681
3405 args : exe.full_path())
3408 if have_standalone_binaries
3410 'systemd-sysusers.standalone',
3411 'src/sysusers/sysusers.c',
3412 include_directories : includes,
3413 c_args : '-DSTANDALONE',
3414 link_with : [libshared_static,
3419 install_dir : rootbindir)
3420 public_programs += exe
3422 if want_tests != 'false'
3423 test('test-sysusers.standalone',
3425 # https://github.com/mesonbuild/meson/issues/2681
3426 args : exe.full_path())
3431 if conf.get('ENABLE_TMPFILES') == 1
3434 systemd_tmpfiles_sources,
3435 include_directories : includes,
3436 link_with : [libshared],
3437 dependencies : [libacl],
3438 install_rpath : rootlibexecdir,
3440 install_dir : rootbindir)
3441 public_programs += exe
3443 if want_tests != 'false'
3444 test('test-systemd-tmpfiles',
3445 test_systemd_tmpfiles_py,
3446 # https://github.com/mesonbuild/meson/issues/2681
3447 args : exe.full_path())
3450 if have_standalone_binaries
3451 public_programs += executable(
3452 'systemd-tmpfiles.standalone',
3453 systemd_tmpfiles_sources,
3454 include_directories : includes,
3455 c_args : '-DSTANDALONE',
3456 link_with : [libshared_static,
3460 dependencies : [libacl],
3462 install_dir : rootbindir)
3466 if conf.get('ENABLE_HWDB') == 1
3467 systemd_hwdb = executable(
3470 include_directories : includes,
3471 link_with : udev_link_with,
3472 install_rpath : udev_rpath,
3474 install_dir : rootbindir)
3475 public_programs += systemd_hwdb
3477 if want_tests != 'false'
3480 args : [systemd_hwdb.full_path()],
3485 if conf.get('ENABLE_QUOTACHECK') == 1
3487 'systemd-quotacheck',
3488 'src/quotacheck/quotacheck.c',
3489 include_directories : includes,
3490 link_with : [libshared],
3491 install_rpath : rootlibexecdir,
3493 install_dir : rootlibexecdir)
3496 public_programs += executable(
3497 'systemd-socket-proxyd',
3498 'src/socket-proxy/socket-proxyd.c',
3499 include_directories : includes,
3500 link_with : [libshared],
3501 dependencies : [threads],
3502 install_rpath : rootlibexecdir,
3504 install_dir : rootlibexecdir)
3506 udevadm = executable(
3509 include_directories : includes,
3510 link_with : [libudevd_core],
3511 dependencies : [versiondep,
3517 install_rpath : udev_rpath,
3519 install_dir : rootbindir)
3520 public_programs += udevadm
3522 if conf.get('ENABLE_REPART') == 1
3525 systemd_repart_sources,
3526 include_directories : includes,
3527 link_with : [libshared],
3528 dependencies : [threads,
3531 install_rpath : rootlibexecdir,
3533 install_dir : rootbindir)
3534 public_programs += exe
3536 if want_tests != 'false'
3539 args : [exe.full_path(), udevadm.full_path()])
3545 systemd_shutdown_sources,
3546 include_directories : includes,
3547 link_with : [libshared],
3548 dependencies : [libmount],
3549 install_rpath : rootlibexecdir,
3551 install_dir : rootlibexecdir)
3554 'systemd-update-done',
3555 'src/update-done/update-done.c',
3556 include_directories : includes,
3557 link_with : [libshared],
3558 install_rpath : rootlibexecdir,
3560 install_dir : rootlibexecdir)
3563 'systemd-update-utmp',
3564 'src/update-utmp/update-utmp.c',
3565 include_directories : includes,
3566 link_with : [libshared],
3567 dependencies : [libaudit],
3568 install_rpath : rootlibexecdir,
3569 install : (conf.get('ENABLE_UTMP') == 1),
3570 install_dir : rootlibexecdir)
3572 if conf.get('HAVE_KMOD') == 1
3574 'systemd-modules-load',
3575 'src/modules-load/modules-load.c',
3576 include_directories : includes,
3577 link_with : [libshared],
3578 dependencies : [libkmod],
3579 install_rpath : rootlibexecdir,
3581 install_dir : rootlibexecdir)
3583 meson.add_install_script('sh', '-c',
3584 mkdir_p.format(modulesloaddir))
3585 if install_sysconfdir
3586 meson.add_install_script('sh', '-c',
3587 mkdir_p.format(sysconfdir / 'modules-load.d'))
3591 public_programs += executable(
3593 systemd_nspawn_sources,
3594 include_directories : includes,
3595 link_with : [libnspawn_core,
3597 dependencies : [libblkid,
3599 install_rpath : rootlibexecdir,
3602 if conf.get('ENABLE_NETWORKD') == 1
3603 dbus_programs += executable(
3605 systemd_networkd_sources,
3606 include_directories : network_includes,
3607 link_with : [libnetworkd_core,
3609 networkd_link_with],
3610 dependencies : [threads],
3611 install_rpath : rootlibexecdir,
3613 install_dir : rootlibexecdir)
3615 public_programs += executable(
3616 'systemd-networkd-wait-online',
3617 systemd_networkd_wait_online_sources,
3618 include_directories : includes,
3619 link_with : [networkd_link_with],
3620 install_rpath : rootlibexecdir,
3622 install_dir : rootlibexecdir)
3624 public_programs += executable(
3627 include_directories : libsystemd_network_includes,
3628 link_with : [libsystemd_network,
3629 networkd_link_with],
3630 install_rpath : rootlibexecdir,
3632 install_dir : rootbindir)
3636 'systemd-network-generator',
3637 network_generator_sources,
3638 include_directories : includes,
3639 link_with : [networkd_link_with],
3640 install_rpath : rootlibexecdir,
3642 install_dir : rootlibexecdir)
3644 if want_tests != 'false'
3645 test('test-network-generator-conversion',
3646 test_network_generator_conversion_sh,
3647 # https://github.com/mesonbuild/meson/issues/2681
3648 args : exe.full_path(),
3653 'systemd-sulogin-shell',
3654 'src/sulogin-shell/sulogin-shell.c',
3655 include_directories : includes,
3656 link_with : [libshared],
3657 install_rpath : rootlibexecdir,
3659 install_dir : rootlibexecdir)
3661 public_programs += custom_target(
3663 input : kernel_install_in,
3664 output : 'kernel-install',
3665 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
3666 install : want_kernel_install,
3667 install_mode : 'rwxr-xr-x',
3668 install_dir : bindir)
3670 ############################################################
3672 runtest_env = custom_target(
3673 'systemd-runtest.env',
3674 output : 'systemd-runtest.env',
3675 command : [sh, '-c',
3676 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
3677 project_source_root / 'test',
3678 project_build_root / 'catalog')],
3680 build_by_default : true)
3682 test_cflags = ['-DTEST_CODE=1']
3683 # We intentionally do not do inline initializations with definitions for a
3684 # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
3685 # use the variable unexpectedly. This triggers a lot of maybe-uninitialized
3686 # false positives when the combination of -O2 and -flto is used. Suppress them.
3687 if '-O2' in get_option('c_args') and '-flto=auto' in get_option('c_args')
3688 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
3691 foreach tuple : tests
3693 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3694 dependencies = tuple.length() > 2 ? tuple[2] : []
3695 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3696 condition = tuple.length() > 4 ? tuple[4] : ''
3697 type = tuple.length() > 5 ? tuple[5] : ''
3698 defs = tuple.length() > 6 ? tuple[6] : []
3700 parallel = tuple.length() > 7 ? tuple[7] : true
3703 # FIXME: Use fs.stem() with meson >= 0.54.0
3704 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
3705 if type.startswith('timeout=')
3706 timeout = type.split('=')[1].to_int()
3710 if condition == '' or conf.get(condition) == 1
3714 include_directories : incs,
3715 link_with : link_with,
3716 dependencies : [versiondep,
3719 build_by_default : want_tests != 'false',
3720 install_rpath : rootlibexecdir,
3721 install : install_tests,
3722 install_dir : testsdir / type,
3723 link_depends : runtest_env)
3726 message('@0@ is a manual test'.format(name))
3727 elif type == 'unsafe' and want_tests != 'unsafe'
3728 message('@0@ is an unsafe test'.format(name))
3729 elif want_tests != 'false'
3735 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3740 'test-libsystemd-sym',
3741 test_libsystemd_sym_c,
3742 include_directories : includes,
3743 link_with : [libsystemd],
3744 build_by_default : want_tests != 'false',
3745 install : install_tests,
3746 install_dir : testsdir)
3747 if want_tests != 'false'
3748 test('test-libsystemd-sym', exe)
3752 'test-libsystemd-static-sym',
3753 test_libsystemd_sym_c,
3754 include_directories : includes,
3755 link_with : [install_libsystemd_static],
3756 dependencies : [threads], # threads is already included in dependencies on the library,
3757 # but does not seem to get propagated. Add here as a work-around.
3758 build_by_default : want_tests != 'false' and static_libsystemd_pic,
3759 install : install_tests and static_libsystemd_pic,
3760 install_dir : testsdir)
3761 if want_tests != 'false' and static_libsystemd_pic
3762 test('test-libsystemd-static-sym', exe)
3768 include_directories : libudev_includes,
3769 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3770 link_with : [libudev],
3771 build_by_default : want_tests != 'false',
3772 install : install_tests,
3773 install_dir : testsdir)
3774 if want_tests != 'false'
3775 test('test-libudev-sym', exe)
3779 'test-libudev-static-sym',
3781 include_directories : libudev_includes,
3782 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3783 link_with : [install_libudev_static],
3784 build_by_default : want_tests != 'false' and static_libudev_pic,
3785 install : install_tests and static_libudev_pic,
3786 install_dir : testsdir)
3787 if want_tests != 'false' and static_libudev_pic
3788 test('test-libudev-static-sym', exe)
3791 ############################################################
3795 foreach tuple : fuzzers
3797 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3798 dependencies = tuple.length() > 2 ? tuple[2] : []
3799 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3800 defs = tuple.length() > 4 ? tuple[4] : []
3804 dependencies += fuzzing_engine
3806 if fuzzing_engine.found()
3807 dependencies += fuzzing_engine
3809 link_args += ['-fsanitize=fuzzer']
3812 sources += 'src/fuzz/fuzz-main.c'
3815 # FIXME: Use fs.stem() with meson >= 0.54.0
3816 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
3821 include_directories : [incs, include_directories('src/fuzz')],
3822 link_with : link_with,
3823 dependencies : dependencies,
3824 c_args : defs + test_cflags,
3825 link_args: link_args,
3827 build_by_default : fuzzer_build)
3830 if want_tests != 'false'
3831 # Run the fuzz regression tests without any sanitizers enabled.
3832 # Additional invocations with sanitizers may be added below.
3833 foreach p : fuzz_regression_tests
3834 b = p.split('/')[-2]
3835 c = p.split('/')[-1]
3838 test('@0@_@1@'.format(b, c),
3840 args : [project_source_root / p])
3846 alias_target('fuzzers', fuzzer_exes)
3848 ############################################################
3850 subdir('modprobe.d')
3852 subdir('sysusers.d')
3853 subdir('tmpfiles.d')
3859 subdir('shell-completion/bash')
3860 subdir('shell-completion/zsh')
3861 subdir('docs/sysvinit')
3862 subdir('docs/var-log')
3864 install_subdir('factory/etc',
3865 install_dir : factorydir)
3866 subdir('factory/templates')
3868 if install_sysconfdir
3869 install_data('xorg/50-systemd-user.sh',
3870 install_dir : xinitrcdir)
3872 install_data('LICENSE.GPL2',
3876 'docs/CODING_STYLE.md',
3877 'docs/DISTRO_PORTING.md',
3878 'docs/ENVIRONMENT.md',
3880 'docs/TRANSIENT-SETTINGS.md',
3881 'docs/TRANSLATORS.md',
3882 'docs/UIDS-GIDS.md',
3883 'docs/GVARIANT-SERIALIZATION.md',
3884 install_dir : docdir)
3886 install_subdir('LICENSES',
3887 install_dir : docdir)
3889 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3890 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3892 ############################################################
3894 # Ensure that changes to the docs/ directory do not break the
3895 # basic Github pages build. But only run it in developer mode,
3896 # as it might be fragile due to changes in the tooling, and it is
3897 # not generally useful for users.
3898 jekyll = find_program('jekyll', required : false)
3899 if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
3900 test('github-pages',
3903 '--source', project_source_root / 'docs',
3904 '--destination', project_build_root / '_site'])
3907 ############################################################
3909 check_help = find_program('tools/check-help.sh')
3910 check_version = find_program('tools/check-version.sh')
3912 foreach exec : public_programs
3913 name = exec.full_path().split('/')[-1]
3914 if want_tests != 'false'
3915 test('check-help-' + name,
3917 args : exec.full_path(),
3920 test('check-version-' + name,
3922 args : [exec.full_path(),
3923 meson.project_version()],
3928 ############################################################
3930 check_directives_sh = find_program('tools/check-directives.sh')
3932 if want_tests != 'false'
3933 test('check-directives',
3934 check_directives_sh,
3935 args : [project_source_root, project_build_root])
3938 ############################################################
3940 # Enable tests for all supported sanitizers
3941 foreach tuple : sanitizers
3942 sanitizer = tuple[0]
3945 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3947 foreach p : fuzz_regression_tests
3948 b = p.split('/')[-2]
3949 c = p.split('/')[-1]
3951 name = '@0@:@1@'.format(b, sanitizer)
3954 if want_tests == 'false'
3955 message('Not compiling @0@ because tests is set to false'.format(name))
3957 exe = custom_target(
3961 command : [ln, '-fs',
3962 build.full_path() / b,
3964 build_by_default : true)
3966 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
3972 test('@0@_@1@_@2@'.format(b, c, sanitizer),
3974 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3976 args : [exe.full_path(),
3977 project_source_root / p])
3984 ############################################################
3987 all_files = run_command(
3988 env, '-u', 'GIT_WORK_TREE',
3989 git, '--git-dir=@0@/.git'.format(project_source_root),
3990 'ls-files', ':/*.[ch]',
3992 if all_files.returncode() == 0
3993 all_files = files(all_files.stdout().split())
3998 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
4001 command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files)
4006 git_contrib_sh = find_program('tools/git-contrib.sh')
4009 command : [git_contrib_sh])
4013 git_head = run_command(
4014 git, '--git-dir=@0@/.git'.format(project_source_root),
4015 'rev-parse', 'HEAD',
4016 check : false).stdout().strip()
4017 git_head_short = run_command(
4018 git, '--git-dir=@0@/.git'.format(project_source_root),
4019 'rev-parse', '--short=7', 'HEAD',
4020 check : false).stdout().strip()
4024 command : [git, 'archive',
4025 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
4027 '--prefix', 'systemd-@0@/'.format(git_head),
4031 ############################################################
4033 check_api_docs_sh = find_program('tools/check-api-docs.sh')
4036 depends : [man, libsystemd, libudev],
4037 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
4039 alias_target('update-dbus-docs', update_dbus_docs)
4040 alias_target('update-man-rules', update_man_rules)
4042 if not meson.is_cross_build()
4044 'export-dbus-interfaces',
4045 output : dbus_interfaces_dir_name,
4046 install : dbus_interfaces_dir != 'no',
4047 install_dir : dbus_interfaces_dir_parent,
4048 command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs])
4051 ############################################################
4053 alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
4054 check : true).stdout().strip()
4057 'split /usr' : split_usr,
4058 'split bin-sbin' : split_bin,
4059 'prefix directory' : prefixdir,
4060 'rootprefix directory' : rootprefixdir,
4061 'sysconf directory' : sysconfdir,
4062 'include directory' : includedir,
4063 'lib directory' : libdir,
4064 'rootlib directory' : rootlibdir,
4065 'SysV init scripts' : sysvinit_path,
4066 'SysV rc?.d directories' : sysvrcnd_path,
4067 'PAM modules directory' : pamlibdir,
4068 'PAM configuration directory' : pamconfdir,
4069 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
4070 'RPM macros directory' : rpmmacrosdir,
4071 'modprobe.d directory' : modprobedir,
4072 'D-Bus policy directory' : dbuspolicydir,
4073 'D-Bus session directory' : dbussessionservicedir,
4074 'D-Bus system directory' : dbussystemservicedir,
4075 'D-Bus interfaces directory' : dbus_interfaces_dir,
4076 'bash completions directory' : bashcompletiondir,
4077 'zsh completions directory' : zshcompletiondir,
4078 'private shared lib version tag' : shared_lib_tag,
4079 'extra start script' : get_option('rc-local'),
4080 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
4081 get_option('debug-tty')),
4082 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
4083 conf.get('SYSTEM_ALLOC_UID_MIN')),
4084 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
4085 conf.get('SYSTEM_ALLOC_GID_MIN')),
4086 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
4087 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
4088 'static UID/GID allocations' : ' '.join(static_ugids),
4089 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
4090 'render group access mode' : get_option('group-render-mode'),
4091 'certificate root directory' : get_option('certificate-root'),
4092 'support URL' : support_url,
4093 'nobody user name' : nobody_user,
4094 'nobody group name' : nobody_group,
4095 'fallback hostname' : get_option('fallback-hostname'),
4096 'default DNSSEC mode' : default_dnssec,
4097 'default DNS-over-TLS mode' : default_dns_over_tls,
4098 'default mDNS mode' : default_mdns,
4099 'default LLMNR mode' : default_llmnr,
4100 'default DNS servers' : dns_servers.split(' '),
4101 'default NTP servers' : ntp_servers.split(' '),
4102 'default cgroup hierarchy' : default_hierarchy,
4103 'default net.naming-scheme value' : default_net_naming_scheme,
4104 'default KillUserProcesses value' : kill_user_processes,
4105 'default locale' : default_locale,
4106 'default user $PATH' :
4107 default_user_path != '' ? default_user_path : '(same as system services)',
4108 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
4109 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
4112 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
4113 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
4114 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
4135 ['libcryptsetup-plugins'],
4161 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
4191 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
4205 ['legacy-pkla', install_polkit_pkla],
4210 ['man pages', want_man],
4211 ['html pages', want_html],
4212 ['man page indices', want_man and have_lxml],
4214 ['compat-mutable-uid-boundaries'],
4217 ['adm group', get_option('adm-group')],
4218 ['wheel group', get_option('wheel-group')],
4221 ['debug mmap cache'],
4223 ['valgrind', conf.get('VALGRIND') == 1],
4224 ['trace logging', conf.get('LOG_TRACE') == 1],
4225 ['install tests', install_tests],
4226 ['link-udev-shared', get_option('link-udev-shared')],
4227 ['link-systemctl-shared', get_option('link-systemctl-shared')],
4228 ['link-networkd-shared', get_option('link-networkd-shared')],
4229 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
4230 ['link-boot-shared', get_option('link-boot-shared')],
4232 ['standalone-binaries', get_option('standalone-binaries')],
4235 if tuple.length() >= 2
4238 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
4239 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
4240 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
4249 if static_libsystemd == 'false'
4250 missing += 'static-libsystemd'
4252 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
4255 if static_libudev == 'false'
4256 missing += 'static-libudev'
4258 found += 'static-libudev(@0@)'.format(static_libudev)
4261 if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
4262 found += 'cryptolib(openssl)'
4263 elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
4264 found += 'cryptolib(gcrypt)'
4266 missing += 'cryptolib'
4269 if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
4270 found += 'DNS-over-TLS(gnutls)'
4271 elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
4272 found += 'DNS-over-TLS(openssl)'
4274 missing += 'DNS-over-TLS'
4278 'enabled' : ', '.join(found),
4279 'disabled' : ', '.join(missing)},
4280 section : 'Features')
4282 if rootprefixdir != rootprefix_default
4284 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
4285 'systemd used fixed names for unit file directories and other paths, so anything\n' +
4286 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))