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 #####################################################################
52 # Try to install the git pre-commit hook
53 add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
54 if add_git_hook_sh.found()
55 git_hook = run_command(add_git_hook_sh, check : false)
56 if git_hook.returncode() == 0
57 message(git_hook.stdout().strip())
61 #####################################################################
64 if get_option('split-usr') == 'auto'
65 split_usr = not fs.is_symlink('/bin')
67 split_usr = get_option('split-usr') == 'true'
70 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
71 + ' split-usr mode is going to be removed\n' +
72 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
74 conf.set10('HAVE_SPLIT_USR', split_usr,
75 description : '/usr/bin and /bin directories are separate')
77 if get_option('split-bin') == 'auto'
78 split_bin = not fs.is_symlink('/usr/sbin')
80 split_bin = get_option('split-bin') == 'true'
82 conf.set10('HAVE_SPLIT_BIN', split_bin,
83 description : 'bin and sbin directories are separate')
85 rootprefixdir = get_option('rootprefix')
86 # Unusual rootprefixdir values are used by some distros
87 # (see https://github.com/systemd/systemd/pull/7461).
88 rootprefix_default = split_usr ? '/' : '/usr'
89 if rootprefixdir == ''
90 rootprefixdir = rootprefix_default
92 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
94 have_standalone_binaries = get_option('standalone-binaries')
96 sysvinit_path = get_option('sysvinit-path')
97 sysvrcnd_path = get_option('sysvrcnd-path')
98 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
99 description : 'SysV init scripts and rcN.d links are supported')
100 conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
102 if get_option('hibernate') and not get_option('initrd')
103 error('hibernate depends on initrd')
106 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
107 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
108 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
110 # Meson ignores the preceding arguments when joining paths if an absolute
111 # component is encountered, so this should canonicalize various paths when they
112 # are absolute or relative.
113 prefixdir = get_option('prefix')
114 if not prefixdir.startswith('/')
115 error('Prefix is not absolute: "@0@"'.format(prefixdir))
117 if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
118 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
119 rootprefixdir, prefixdir))
122 bindir = prefixdir / get_option('bindir')
123 libdir = prefixdir / get_option('libdir')
124 sysconfdir = prefixdir / get_option('sysconfdir')
125 includedir = prefixdir / get_option('includedir')
126 datadir = prefixdir / get_option('datadir')
127 localstatedir = '/' / get_option('localstatedir')
129 rootbindir = rootprefixdir / 'bin'
130 rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin')
131 rootlibexecdir = rootprefixdir / 'lib/systemd'
133 rootlibdir = get_option('rootlibdir')
135 rootlibdir = rootprefixdir / libdir.split('/')[-1]
138 install_sysconfdir = get_option('install-sysconfdir') != 'false'
139 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
140 # Dirs of external packages
141 pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig'
142 pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
143 polkitpolicydir = datadir / 'polkit-1/actions'
144 polkitrulesdir = datadir / 'polkit-1/rules.d'
145 polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
146 xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d'
147 rpmmacrosdir = get_option('rpmmacrosdir')
148 if rpmmacrosdir != 'no'
149 rpmmacrosdir = prefixdir / rpmmacrosdir
151 modprobedir = rootprefixdir / 'lib/modprobe.d'
154 pkgdatadir = datadir / 'systemd'
155 environmentdir = prefixdir / 'lib/environment.d'
156 pkgsysconfdir = sysconfdir / 'systemd'
157 userunitdir = prefixdir / 'lib/systemd/user'
158 userpresetdir = prefixdir / 'lib/systemd/user-preset'
159 tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
160 sysusersdir = prefixdir / 'lib/sysusers.d'
161 sysctldir = prefixdir / 'lib/sysctl.d'
162 binfmtdir = prefixdir / 'lib/binfmt.d'
163 modulesloaddir = prefixdir / 'lib/modules-load.d'
164 networkdir = rootprefixdir / 'lib/systemd/network'
165 pkgincludedir = includedir / 'systemd'
166 systemgeneratordir = rootlibexecdir / 'system-generators'
167 usergeneratordir = prefixdir / 'lib/systemd/user-generators'
168 systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
169 userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
170 systemshutdowndir = rootlibexecdir / 'system-shutdown'
171 systemsleepdir = rootlibexecdir / 'system-sleep'
172 systemunitdir = rootprefixdir / 'lib/systemd/system'
173 systempresetdir = rootprefixdir / 'lib/systemd/system-preset'
174 udevlibexecdir = rootprefixdir / 'lib/udev'
175 udevrulesdir = udevlibexecdir / 'rules.d'
176 udevhwdbdir = udevlibexecdir / 'hwdb.d'
177 catalogdir = prefixdir / 'lib/systemd/catalog'
178 kerneldir = prefixdir / 'lib/kernel'
179 kernelinstalldir = kerneldir / 'install.d'
180 factorydir = datadir / 'factory'
181 bootlibdir = prefixdir / 'lib/systemd/boot/efi'
182 testsdir = prefixdir / 'lib/systemd/tests'
183 systemdstatedir = localstatedir / 'lib/systemd'
184 catalogstatedir = systemdstatedir / 'catalog'
185 randomseeddir = localstatedir / 'lib/systemd'
186 profiledir = rootlibexecdir / 'portable' / 'profile'
187 ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
189 docdir = get_option('docdir')
191 docdir = datadir / 'doc/systemd'
194 pamlibdir = get_option('pamlibdir')
196 pamlibdir = rootlibdir / 'security'
199 pamconfdir = get_option('pamconfdir')
201 pamconfdir = prefixdir / 'lib/pam.d'
204 libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir')
205 if libcryptsetup_plugins_dir == ''
206 libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup'
209 memory_accounting_default = get_option('memory-accounting-default')
210 status_unit_format_default = get_option('status-unit-format-default')
212 conf.set_quoted('BINFMT_DIR', binfmtdir)
213 conf.set_quoted('BOOTLIBDIR', bootlibdir)
214 conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database')
215 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
216 conf.set_quoted('DOC_DIR', docdir)
217 conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd')
218 conf.set_quoted('ENVIRONMENT_DIR', environmentdir)
219 conf.set_quoted('INCLUDE_DIR', includedir)
220 conf.set_quoted('LIBDIR', libdir)
221 conf.set_quoted('MODPROBE_DIR', modprobedir)
222 conf.set_quoted('MODULESLOAD_DIR', modulesloaddir)
223 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
224 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent')
225 conf.set_quoted('PREFIX', prefixdir)
226 conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed')
227 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
228 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
229 conf.set_quoted('ROOTBINDIR', rootbindir)
230 conf.set_quoted('ROOTLIBDIR', rootlibdir)
231 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
232 conf.set_quoted('ROOTPREFIX', rootprefixdir)
233 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
234 conf.set_quoted('SYSCONF_DIR', sysconfdir)
235 conf.set_quoted('SYSCTL_DIR', sysctldir)
236 conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl')
237 conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd')
238 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
239 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent')
240 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup')
241 conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export')
242 conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck')
243 conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs')
244 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework')
245 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs')
246 conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import')
247 conf.set_quoted('SYSTEMD_INTEGRITYSETUP_PATH', rootlibexecdir / 'systemd-integritysetup')
248 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map')
249 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map')
250 conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs')
251 conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull')
252 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown')
253 conf.set_quoted('SYSTEMD_TEST_DATA', testsdir / 'testdata')
254 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent')
255 conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper')
256 conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork')
257 conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup')
258 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system')
259 conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir)
260 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
261 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
262 conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
263 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
264 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
265 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
266 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
267 conf.set_quoted('SYSUSERS_DIR', sysusersdir)
268 conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
269 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
270 conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
271 conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
272 conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout'))
273 conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user')
274 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
275 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
276 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
277 conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg')
278 conf.set_quoted('USER_PRESET_DIR', userpresetdir)
279 conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg')
281 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
282 conf.set10('ENABLE_URLIFY', get_option('urlify'))
283 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
284 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
285 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
286 conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default)
288 #####################################################################
290 cc = meson.get_compiler('c')
291 pkgconfig = import('pkgconfig')
292 check_compilation_sh = find_program('tools/check-compilation.sh')
293 meson_build_sh = find_program('tools/meson-build.sh')
295 want_tests = get_option('tests')
296 slow_tests = want_tests != 'false' and get_option('slow-tests')
297 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
298 install_tests = get_option('install-tests')
300 if add_languages('cpp', required : fuzzer_build)
301 # Used only for tests
302 cxx = meson.get_compiler('cpp')
303 cxx_cmd = ' '.join(cxx.cmd_array())
309 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
310 if fuzzing_engine.found()
311 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
312 elif cc.has_argument('-fsanitize=fuzzer-no-link')
313 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
315 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
318 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
321 # Those generate many false positives, and we do not want to change the code to
323 basic_disabled_warnings = [
324 '-Wno-format-signedness',
325 '-Wno-missing-field-initializers',
326 '-Wno-unused-parameter',
329 possible_common_cc_flags = [
333 '-Werror=implicit-function-declaration',
334 '-Werror=incompatible-pointer-types',
335 '-Werror=int-conversion',
337 '-Werror=override-init',
338 '-Werror=return-type',
339 '-Werror=shift-count-overflow',
340 '-Werror=shift-overflow=2',
343 '-Wimplicit-fallthrough=5',
346 '-Wmissing-include-dirs',
347 '-Wmissing-noreturn',
349 '-Wold-style-definition',
353 '-Wstrict-aliasing=2',
354 '-Wstrict-prototypes',
355 '-Wsuggest-attribute=noreturn',
359 # negative arguments are correctly detected starting with meson 0.46.
360 '-Wno-error=#warnings', # clang
361 '-Wno-string-plus-int', # clang
364 # Disable -Wmaybe-uninitialized when compiling with -Os/-O1/-O3/etc. There are
365 # too many false positives with gcc >= 8. Effectively, we only test with -O0
366 # and -O2; this should be enough to catch most important cases without too much
367 # busywork. See https://github.com/systemd/systemd/pull/19226.
368 if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
369 cc.version().version_compare('<10'))
370 possible_common_cc_flags += '-Wno-maybe-uninitialized'
373 # Disable -Wno-unused-result with gcc, see
374 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
375 if cc.get_id() == 'gcc'
376 possible_common_cc_flags += '-Wno-unused-result'
379 # --as-needed and --no-undefined are provided by meson by default,
380 # run 'meson configure' to see what is enabled
381 possible_link_flags = [
382 '-Wl,--fatal-warnings',
388 if get_option('b_sanitize') == 'none'
389 possible_link_flags += '-Wl,--warn-common'
392 if cc.get_id() == 'clang'
393 possible_common_cc_flags += [
394 '-Wno-typedef-redefinition',
395 '-Wno-gnu-variable-sized-type-not-at-end',
399 possible_cc_flags = possible_common_cc_flags + [
400 '-Werror=missing-declarations',
401 '-Werror=missing-prototypes',
402 '-fdiagnostics-show-option',
404 '-fno-strict-aliasing',
406 '-fstack-protector-strong',
407 '-fvisibility=hidden',
408 '--param=ssp-buffer-size=4',
411 if get_option('buildtype') != 'debug'
412 possible_cc_flags += [
413 '-ffunction-sections',
417 possible_link_flags += '-Wl,--gc-sections'
420 add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
421 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
422 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
424 have = cc.has_argument('-Wzero-length-bounds')
425 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
429 #include <inttypes.h>
430 typedef uint64_t usec_t;
431 usec_t now(clockid_t clock);
436 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
437 add_project_arguments('-Werror=shadow', language : 'c')
441 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
444 cpp = ' '.join(cc.cmd_array()) + ' -E'
446 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
448 #####################################################################
449 # compilation result tests
451 conf.set('_GNU_SOURCE', true)
452 conf.set('__SANE_USERSPACE_TYPES__', true)
453 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
455 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
456 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
457 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
458 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
459 conf.set('SIZEOF_TIMEX_MEMBER', cc.sizeof('typeof(((struct timex *)0)->freq)', prefix : '#include <sys/timex.h>'))
463 #include <sys/mount.h>
464 #include <sys/stat.h>
465 #include <linux/fs.h>
468 foreach decl : ['char16_t',
474 # We get -1 if the size cannot be determined
475 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
477 if decl == 'struct statx'
479 want_linux_stat_h = false
481 have = cc.sizeof(decl,
482 prefix : decl_headers + '#include <linux/stat.h>',
483 args : '-D_GNU_SOURCE') > 0
484 want_linux_stat_h = have
488 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
491 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
493 foreach ident : ['secure_getenv', '__secure_getenv']
494 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
498 ['memfd_create', '''#include <sys/mman.h>'''],
499 ['gettid', '''#include <sys/types.h>
500 #include <unistd.h>'''],
501 ['pivot_root', '''#include <stdlib.h>
502 #include <unistd.h>'''], # no known header declares pivot_root
503 ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get
504 ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set
505 ['name_to_handle_at', '''#include <sys/types.h>
506 #include <sys/stat.h>
507 #include <fcntl.h>'''],
508 ['setns', '''#include <sched.h>'''],
509 ['renameat2', '''#include <stdio.h>
510 #include <fcntl.h>'''],
511 ['kcmp', '''#include <linux/kcmp.h>'''],
512 ['keyctl', '''#include <sys/types.h>
513 #include <keyutils.h>'''],
514 ['copy_file_range', '''#include <sys/syscall.h>
515 #include <unistd.h>'''],
516 ['bpf', '''#include <sys/syscall.h>
517 #include <unistd.h>'''],
518 ['statx', '''#include <sys/types.h>
519 #include <sys/stat.h>
520 #include <unistd.h>'''],
521 ['explicit_bzero' , '''#include <string.h>'''],
522 ['reallocarray', '''#include <stdlib.h>'''],
523 ['set_mempolicy', '''#include <stdlib.h>
524 #include <unistd.h>'''],
525 ['get_mempolicy', '''#include <stdlib.h>
526 #include <unistd.h>'''],
527 ['pidfd_send_signal', '''#include <stdlib.h>
530 #include <sys/wait.h>'''],
531 ['pidfd_open', '''#include <stdlib.h>
534 #include <sys/wait.h>'''],
535 ['rt_sigqueueinfo', '''#include <stdlib.h>
538 #include <sys/wait.h>'''],
539 ['mallinfo', '''#include <malloc.h>'''],
540 ['mallinfo2', '''#include <malloc.h>'''],
541 ['execveat', '''#include <unistd.h>'''],
542 ['close_range', '''#include <unistd.h>'''],
543 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
544 ['mount_setattr', '''#include <sys/mount.h>'''],
545 ['move_mount', '''#include <sys/mount.h>'''],
546 ['open_tree', '''#include <sys/mount.h>'''],
547 ['getdents64', '''#include <dirent.h>'''],
550 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
551 conf.set10('HAVE_' + ident[0].to_upper(), have)
554 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
555 conf.set10('USE_SYS_RANDOM_H', true)
556 conf.set10('HAVE_GETRANDOM', true)
558 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
559 conf.set10('USE_SYS_RANDOM_H', false)
560 conf.set10('HAVE_GETRANDOM', have)
563 #####################################################################
565 version_tag = get_option('version-tag')
567 vcs_data = configuration_data()
568 vcs_data.set('VCS_TAG', version_tag)
569 version_h = configure_file(configuration : vcs_data,
570 input : 'src/version/version.h.in',
571 output : 'version.h')
574 project_source_root + '/tools/meson-vcs-tag.sh',
576 meson.project_version()]
579 input : 'src/version/version.h.in',
580 output : 'version.h',
584 versiondep = declare_dependency(sources: version_h)
586 shared_lib_tag = get_option('shared-lib-tag')
587 if shared_lib_tag == ''
588 shared_lib_tag = meson.project_version()
591 sh = find_program('sh')
592 echo = find_program('echo')
593 sed = find_program('sed')
594 awk = find_program('awk')
595 stat = find_program('stat')
596 ln = find_program('ln')
597 git = find_program('git', required : false)
598 env = find_program('env')
599 perl = find_program('perl', required : false)
600 rsync = find_program('rsync', required : false)
601 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
603 mkdir_p = 'mkdir -p $DESTDIR/@0@'
605 # If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
606 # /usr/sbin, /sbin, and fall back to the default from middle column.
607 progs = [['quotaon', '/usr/sbin/quotaon' ],
608 ['quotacheck', '/usr/sbin/quotacheck' ],
609 ['kmod', '/usr/bin/kmod' ],
610 ['kexec', '/usr/sbin/kexec' ],
611 ['sulogin', '/usr/sbin/sulogin' ],
612 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
613 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
614 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
615 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
616 ['nologin', '/usr/sbin/nologin', ],
619 path = get_option(prog[0] + '-path')
621 message('Using @1@ for @0@'.format(prog[0], path))
623 exe = find_program(prog[0],
624 '/usr/sbin/' + prog[0],
627 path = exe.found() ? exe.path() : prog[1]
629 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
630 conf.set_quoted(name, path)
633 conf.set_quoted('TELINIT', get_option('telinit-path'))
635 if run_command(ln, '--relative', '--help', check : false).returncode() != 0
636 error('ln does not support --relative (added in coreutils 8.16)')
639 ############################################################
641 python = find_program('python3')
642 if run_command(python, '-c', 'import jinja2', check : false).returncode() != 0
643 error('python3 jinja2 missing')
646 ############################################################
648 gperf = find_program('gperf')
650 gperf_test_format = '''
652 const char * in_word_set(const char *, @0@);
655 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
656 gperf_snippet = run_command(sh, '-c', gperf_snippet_format.format(gperf.path()),
658 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
659 if cc.compiles(gperf_test)
660 gperf_len_type = 'size_t'
662 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
663 if cc.compiles(gperf_test)
664 gperf_len_type = 'unsigned'
666 error('unable to determine gperf len type')
669 message('gperf len type is @0@'.format(gperf_len_type))
670 conf.set('GPERF_LEN_TYPE', gperf_len_type,
671 description : 'The type of gperf "len" parameter')
673 ############################################################
675 if not cc.has_header('sys/capability.h')
676 error('POSIX caps headers not found')
678 foreach header : ['crypt.h',
680 'linux/vm_sockets.h',
682 'valgrind/memcheck.h',
683 'valgrind/valgrind.h',
684 'linux/time_types.h',
688 conf.set10('HAVE_' + header.underscorify().to_upper(),
689 cc.has_header(header))
692 ############################################################
694 fallback_hostname = get_option('fallback-hostname')
695 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
696 error('Invalid fallback-hostname configuration')
697 # A more extensive test is done in test-hostname-util. Let's catch
698 # the most obvious errors here so we don't fail with an assert later.
700 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
702 default_hierarchy = get_option('default-hierarchy')
703 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
704 description : 'default cgroup hierarchy as string')
705 if default_hierarchy == 'legacy'
706 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
707 elif default_hierarchy == 'hybrid'
708 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
710 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
713 extra_net_naming_schemes = []
714 extra_net_naming_map = []
715 foreach scheme: get_option('extra-net-naming-schemes').split(',')
717 name = scheme.split('=')[0]
718 value = scheme.split('=')[1]
719 NAME = name.underscorify().to_upper()
721 foreach field: value.split('+')
722 VALUE += 'NAMING_' + field.underscorify().to_upper()
724 extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE))
725 extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME)
728 conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes))
729 conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map))
731 default_net_naming_scheme = get_option('default-net-naming-scheme')
732 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
733 if default_net_naming_scheme != 'latest'
734 conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST',
735 'NAMING_' + default_net_naming_scheme.underscorify().to_upper())
738 time_epoch = get_option('time-epoch')
740 time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check : true).stdout().strip()
741 if time_epoch == '' and git.found() and fs.exists('.git')
742 # If we're in a git repository, use the creation time of the latest git tag.
743 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags',
745 if latest_tag.returncode() == 0
746 time_epoch = run_command(
747 git, 'log', '--no-show-signature', '-1', '--format=%at',
748 latest_tag.stdout().strip(),
749 check : false).stdout()
754 time_epoch = run_command(stat, '-c', '%Y', NEWS,
755 check : true).stdout()
757 time_epoch = time_epoch.to_int()
759 conf.set('TIME_EPOCH', time_epoch)
761 conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max'))
763 default_user_shell = get_option('default-user-shell')
764 conf.set_quoted('DEFAULT_USER_SHELL', default_user_shell)
765 conf.set_quoted('DEFAULT_USER_SHELL_NAME', fs.name(default_user_shell))
767 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
768 ['system-uid-max', 'SYS_UID_MAX', 999],
769 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
770 ['system-gid-max', 'SYS_GID_MAX', 999]]
771 v = get_option(tuple[0])
775 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
777 check : false).stdout().strip()
784 conf.set(tuple[0].underscorify().to_upper(), v)
786 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
787 error('Invalid uid allocation range')
789 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
790 error('Invalid gid allocation range')
793 dynamic_uid_min = get_option('dynamic-uid-min')
794 dynamic_uid_max = get_option('dynamic-uid-max')
795 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
796 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
798 container_uid_base_min = get_option('container-uid-base-min')
799 container_uid_base_max = get_option('container-uid-base-max')
800 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
801 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
803 nobody_user = get_option('nobody-user')
804 nobody_group = get_option('nobody-group')
806 if not meson.is_cross_build()
807 getent_result = run_command('getent', 'passwd', '65534', check : false)
808 if getent_result.returncode() == 0
809 name = getent_result.stdout().split(':')[0]
810 if name != nobody_user
812 '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) +
813 'Your build will result in an user table setup that is incompatible with the local system.')
816 id_result = run_command('id', '-u', nobody_user, check : false)
817 if id_result.returncode() == 0
818 id = id_result.stdout().to_int()
821 '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) +
822 'Your build will result in an user table setup that is incompatible with the local system.')
826 getent_result = run_command('getent', 'group', '65534', check : false)
827 if getent_result.returncode() == 0
828 name = getent_result.stdout().split(':')[0]
829 if name != nobody_group
831 '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) +
832 'Your build will result in an group table setup that is incompatible with the local system.')
835 id_result = run_command('id', '-g', nobody_group, check : false)
836 if id_result.returncode() == 0
837 id = id_result.stdout().to_int()
840 '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) +
841 'Your build will result in an group table setup that is incompatible with the local system.')
845 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
847 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
848 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
851 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
852 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
855 foreach option : ['adm-gid',
872 'systemd-journal-gid',
873 'systemd-network-uid',
874 'systemd-resolve-uid',
875 'systemd-timesync-uid']
876 name = option.underscorify().to_upper()
877 val = get_option(option)
879 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
880 conf.set(name, val >= 0 ? val : '-')
882 static_ugids += '@0@:@1@'.format(option, val)
886 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
887 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
889 dev_kvm_mode = get_option('dev-kvm-mode')
890 conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation
891 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
892 group_render_mode = get_option('group-render-mode')
893 conf.set_quoted('GROUP_RENDER_MODE', group_render_mode)
894 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
896 kill_user_processes = get_option('default-kill-user-processes')
897 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
899 dns_servers = get_option('dns-servers')
900 conf.set_quoted('DNS_SERVERS', dns_servers)
902 ntp_servers = get_option('ntp-servers')
903 conf.set_quoted('NTP_SERVERS', ntp_servers)
905 default_locale = get_option('default-locale')
906 if default_locale == ''
907 if not meson.is_cross_build()
908 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
909 default_locale = run_command(choose_default_locale_sh,
910 check : true).stdout().strip()
912 default_locale = 'C.UTF-8'
915 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
917 localegen_path = get_option('localegen-path')
918 if localegen_path != ''
919 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
921 conf.set10('HAVE_LOCALEGEN', localegen_path != '')
923 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
925 service_watchdog = get_option('service-watchdog')
926 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
927 conf.set_quoted('SERVICE_WATCHDOG', watchdog_value)
929 conf.set_quoted('SUSHELL', get_option('debug-shell'))
930 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
932 enable_debug_hashmap = false
933 enable_debug_mmap_cache = false
934 enable_debug_siphash = false
935 foreach name : get_option('debug-extra')
937 enable_debug_hashmap = true
938 elif name == 'mmap-cache'
939 enable_debug_mmap_cache = true
940 elif name == 'siphash'
941 enable_debug_siphash = true
943 message('unknown debug option "@0@", ignoring'.format(name))
946 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
947 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
948 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
950 conf.set10('VALGRIND', get_option('valgrind'))
951 conf.set10('LOG_TRACE', get_option('log-trace'))
953 default_user_path = get_option('user-path')
954 if default_user_path != ''
955 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
959 #####################################################################
961 threads = dependency('threads')
962 librt = cc.find_library('rt')
963 libm = cc.find_library('m')
964 libdl = cc.find_library('dl')
965 libcrypt = cc.find_library('crypt')
967 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
969 ['crypt_ra', crypt_header],
970 ['crypt_preferred_method', crypt_header],
971 ['crypt_gensalt_ra', crypt_header]]
973 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
974 dependencies : libcrypt)
975 conf.set10('HAVE_' + ident[0].to_upper(), have)
978 libcap = dependency('libcap', required : false)
979 if not libcap.found()
980 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
981 libcap = cc.find_library('cap')
984 want_bpf_framework = get_option('bpf-framework')
985 bpf_framework_required = want_bpf_framework == 'true'
987 libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2')
988 conf.set10('HAVE_LIBBPF', libbpf.found())
990 if want_bpf_framework == 'false' or not libbpf.found()
991 conf.set10('BPF_FRAMEWORK', 0)
993 # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
994 # (like clang-10/llvm-strip-10)
995 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')
996 r = find_program('clang', required : bpf_framework_required, version : '>= 10.0.0')
997 clang_found = r.found()
999 if meson.version().version_compare('>= 0.55')
1000 clang = [r.full_path()]
1005 # Assume that the required flags are supported by the found clang.
1006 clang_supports_flags = clang_found
1009 clang = cc.cmd_array()
1010 clang_supports_flags = cc.has_argument('-Wno-compare-distinct-pointer-types')
1014 # Check if 'clang -target bpf' is supported.
1015 clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
1017 clang_supports_bpf = false
1020 # Debian installs this in /usr/sbin/ which is not in $PATH.
1021 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1022 # We use 'bpftool gen' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
1023 bpftool = find_program('bpftool',
1024 '/usr/sbin/bpftool',
1026 version : '>= 5.13.0')
1029 bpftool_strip = true
1031 bpftool_strip = false
1032 bpftool = find_program('bpftool',
1033 '/usr/sbin/bpftool',
1034 required : bpf_framework_required,
1035 version : '>= 5.6.0')
1038 if not bpftool_strip
1039 if not meson.is_cross_build() and clang_found
1040 llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
1041 check : true).stdout().strip()
1043 llvm_strip_bin = 'llvm-strip'
1045 llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
1048 deps_found = clang_found and clang_supports_bpf and clang_supports_flags and (bpftool_strip or llvm_strip.found()) and bpftool.found()
1050 # Can build BPF program from source code in restricted C
1051 conf.set10('BPF_FRAMEWORK', deps_found)
1054 libmount = dependency('mount',
1055 version : fuzzer_build ? '>= 0' : '>= 2.30')
1057 want_libfdisk = get_option('fdisk')
1058 if want_libfdisk != 'false' and not skip_deps
1059 libfdisk = dependency('fdisk',
1060 version : '>= 2.32',
1061 required : want_libfdisk == 'true')
1062 have = libfdisk.found()
1067 conf.set10('HAVE_LIBFDISK', have)
1069 want_pwquality = get_option('pwquality')
1070 if want_pwquality != 'false' and not skip_deps
1071 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1072 have = libpwquality.found()
1077 conf.set10('HAVE_PWQUALITY', have)
1079 want_seccomp = get_option('seccomp')
1080 if want_seccomp != 'false' and not skip_deps
1081 libseccomp = dependency('libseccomp',
1082 version : '>= 2.3.1',
1083 required : want_seccomp == 'true')
1084 have = libseccomp.found()
1089 conf.set10('HAVE_SECCOMP', have)
1091 want_selinux = get_option('selinux')
1092 if want_selinux != 'false' and not skip_deps
1093 libselinux = dependency('libselinux',
1094 version : '>= 2.1.9',
1095 required : want_selinux == 'true')
1096 have = libselinux.found()
1101 conf.set10('HAVE_SELINUX', have)
1103 want_apparmor = get_option('apparmor')
1104 if want_apparmor != 'false' and not skip_deps
1105 libapparmor = dependency('libapparmor',
1106 version : '>= 2.13',
1107 required : want_apparmor == 'true')
1108 have = libapparmor.found()
1113 conf.set10('HAVE_APPARMOR', have)
1115 have = get_option('smack') and get_option('smack-run-label') != ''
1116 conf.set10('HAVE_SMACK_RUN_LABEL', have)
1118 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1121 want_polkit = get_option('polkit')
1122 install_polkit = false
1123 install_polkit_pkla = false
1124 if want_polkit != 'false' and not skip_deps
1125 install_polkit = true
1127 libpolkit = dependency('polkit-gobject-1',
1129 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1130 message('Old polkit detected, will install pkla files')
1131 install_polkit_pkla = true
1134 conf.set10('ENABLE_POLKIT', install_polkit)
1136 want_acl = get_option('acl')
1137 if want_acl != 'false' and not skip_deps
1138 libacl = cc.find_library('acl', required : want_acl == 'true')
1139 have = libacl.found()
1144 conf.set10('HAVE_ACL', have)
1146 want_audit = get_option('audit')
1147 if want_audit != 'false' and not skip_deps
1148 libaudit = dependency('audit', required : want_audit == 'true')
1149 have = libaudit.found()
1154 conf.set10('HAVE_AUDIT', have)
1156 want_blkid = get_option('blkid')
1157 if want_blkid != 'false' and not skip_deps
1158 libblkid = dependency('blkid', required : want_blkid == 'true')
1159 have = libblkid.found()
1161 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1162 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1167 conf.set10('HAVE_BLKID', have)
1169 want_kmod = get_option('kmod')
1170 if want_kmod != 'false' and not skip_deps
1171 libkmod = dependency('libkmod',
1173 required : want_kmod == 'true')
1174 have = libkmod.found()
1179 conf.set10('HAVE_KMOD', have)
1181 want_pam = get_option('pam')
1182 if want_pam != 'false' and not skip_deps
1183 libpam = cc.find_library('pam', required : want_pam == 'true')
1184 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1185 have = libpam.found() and libpam_misc.found()
1191 conf.set10('HAVE_PAM', have)
1193 want_microhttpd = get_option('microhttpd')
1194 if want_microhttpd != 'false' and not skip_deps
1195 libmicrohttpd = dependency('libmicrohttpd',
1196 version : '>= 0.9.33',
1197 required : want_microhttpd == 'true')
1198 have = libmicrohttpd.found()
1203 conf.set10('HAVE_MICROHTTPD', have)
1205 want_libcryptsetup = get_option('libcryptsetup')
1206 want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1208 if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1209 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1212 if want_libcryptsetup != 'false' and not skip_deps
1213 libcryptsetup = dependency('libcryptsetup',
1214 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1215 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
1216 have = libcryptsetup.found()
1218 foreach ident : ['crypt_set_metadata_size',
1219 'crypt_activate_by_signed_key',
1221 have_ident = have and cc.has_function(
1223 prefix : '#include <libcryptsetup.h>',
1224 dependencies : libcryptsetup)
1225 conf.set10('HAVE_' + ident.to_upper(), have_ident)
1231 conf.set10('HAVE_LIBCRYPTSETUP', have)
1233 if want_libcryptsetup_plugins != 'false' and not skip_deps
1234 have = (cc.has_function(
1235 'crypt_activate_by_token_pin',
1236 prefix : '#include <libcryptsetup.h>',
1237 dependencies : libcryptsetup) and
1239 'crypt_token_external_path',
1240 prefix : '#include <libcryptsetup.h>',
1241 dependencies : libcryptsetup))
1245 conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1247 want_libcurl = get_option('libcurl')
1248 if want_libcurl != 'false' and not skip_deps
1249 libcurl = dependency('libcurl',
1250 version : '>= 7.32.0',
1251 required : want_libcurl == 'true')
1252 have = libcurl.found()
1257 conf.set10('HAVE_LIBCURL', have)
1258 conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
1260 want_libidn = get_option('libidn')
1261 want_libidn2 = get_option('libidn2')
1262 if want_libidn == 'true' and want_libidn2 == 'true'
1263 error('libidn and libidn2 cannot be requested simultaneously')
1266 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1267 libidn = dependency('libidn2',
1268 required : want_libidn2 == 'true')
1269 have = libidn.found()
1274 conf.set10('HAVE_LIBIDN2', have)
1275 if not have and want_libidn != 'false' and not skip_deps
1276 # libidn is used for both libidn and libidn2 objects
1277 libidn = dependency('libidn',
1278 required : want_libidn == 'true')
1279 have = libidn.found()
1283 conf.set10('HAVE_LIBIDN', have)
1285 want_libiptc = get_option('libiptc')
1286 if want_libiptc != 'false' and not skip_deps
1287 libiptc = dependency('libiptc',
1288 required : want_libiptc == 'true')
1289 have = libiptc.found()
1294 conf.set10('HAVE_LIBIPTC', have)
1296 want_qrencode = get_option('qrencode')
1297 if want_qrencode != 'false' and not skip_deps
1298 libqrencode = dependency('libqrencode',
1300 required : want_qrencode == 'true')
1301 have = libqrencode.found()
1306 conf.set10('HAVE_QRENCODE', have)
1308 want_gcrypt = get_option('gcrypt')
1309 if want_gcrypt != 'false' and not skip_deps
1310 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1311 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1312 have = libgcrypt.found() and libgpg_error.found()
1317 # link to neither of the libs if one is not found
1321 conf.set10('HAVE_GCRYPT', have)
1323 want_gnutls = get_option('gnutls')
1324 if want_gnutls != 'false' and not skip_deps
1325 libgnutls = dependency('gnutls',
1326 version : '>= 3.1.4',
1327 required : want_gnutls == 'true')
1328 have = libgnutls.found()
1333 conf.set10('HAVE_GNUTLS', have)
1335 want_openssl = get_option('openssl')
1336 if want_openssl != 'false' and not skip_deps
1337 libopenssl = dependency('openssl',
1338 version : '>= 1.1.0',
1339 required : want_openssl == 'true')
1340 have = libopenssl.found()
1345 conf.set10('HAVE_OPENSSL', have)
1347 want_p11kit = get_option('p11kit')
1348 if want_p11kit != 'false' and not skip_deps
1349 libp11kit = dependency('p11-kit-1',
1350 version : '>= 0.23.3',
1351 required : want_p11kit == 'true')
1352 have = libp11kit.found()
1357 conf.set10('HAVE_P11KIT', have)
1359 want_libfido2 = get_option('libfido2')
1360 if want_libfido2 != 'false' and not skip_deps
1361 libfido2 = dependency('libfido2',
1362 required : want_libfido2 == 'true')
1363 have = libfido2.found()
1368 conf.set10('HAVE_LIBFIDO2', have)
1370 want_tpm2 = get_option('tpm2')
1371 if want_tpm2 != 'false' and not skip_deps
1372 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1373 required : want_tpm2 == 'true')
1379 conf.set10('HAVE_TPM2', have)
1381 want_elfutils = get_option('elfutils')
1382 if want_elfutils != 'false' and not skip_deps
1383 libdw = dependency('libdw',
1384 required : want_elfutils == 'true')
1385 have = libdw.found()
1387 # New in elfutils 0.177
1388 conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING',
1389 have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw))
1394 conf.set10('HAVE_ELFUTILS', have)
1396 want_zlib = get_option('zlib')
1397 if want_zlib != 'false' and not skip_deps
1398 libz = dependency('zlib',
1399 required : want_zlib == 'true')
1405 conf.set10('HAVE_ZLIB', have)
1407 want_bzip2 = get_option('bzip2')
1408 if want_bzip2 != 'false' and not skip_deps
1409 libbzip2 = cc.find_library('bz2',
1410 required : want_bzip2 == 'true')
1411 have = libbzip2.found()
1416 conf.set10('HAVE_BZIP2', have)
1418 want_xz = get_option('xz')
1419 if want_xz != 'false' and not skip_deps
1420 libxz = dependency('liblzma',
1421 required : want_xz == 'true')
1422 have_xz = libxz.found()
1427 conf.set10('HAVE_XZ', have_xz)
1429 want_lz4 = get_option('lz4')
1430 if want_lz4 != 'false' and not skip_deps
1431 liblz4 = dependency('liblz4',
1432 version : '>= 1.3.0',
1433 required : want_lz4 == 'true')
1434 have_lz4 = liblz4.found()
1439 conf.set10('HAVE_LZ4', have_lz4)
1441 want_zstd = get_option('zstd')
1442 if want_zstd != 'false' and not skip_deps
1443 libzstd = dependency('libzstd',
1444 required : want_zstd == 'true',
1445 version : '>= 1.4.0')
1446 have_zstd = libzstd.found()
1451 conf.set10('HAVE_ZSTD', have_zstd)
1453 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1455 want_xkbcommon = get_option('xkbcommon')
1456 if want_xkbcommon != 'false' and not skip_deps
1457 libxkbcommon = dependency('xkbcommon',
1458 version : '>= 0.3.0',
1459 required : want_xkbcommon == 'true')
1460 have = libxkbcommon.found()
1465 conf.set10('HAVE_XKBCOMMON', have)
1467 want_pcre2 = get_option('pcre2')
1468 if want_pcre2 != 'false'
1469 libpcre2 = dependency('libpcre2-8',
1470 required : want_pcre2 == 'true')
1471 have = libpcre2.found()
1476 conf.set10('HAVE_PCRE2', have)
1478 want_glib = get_option('glib')
1479 if want_glib != 'false' and not skip_deps
1480 libglib = dependency('glib-2.0',
1481 version : '>= 2.22.0',
1482 required : want_glib == 'true')
1483 libgobject = dependency('gobject-2.0',
1484 version : '>= 2.22.0',
1485 required : want_glib == 'true')
1486 libgio = dependency('gio-2.0',
1487 required : want_glib == 'true')
1488 have = libglib.found() and libgobject.found() and libgio.found()
1495 conf.set10('HAVE_GLIB', have)
1497 want_dbus = get_option('dbus')
1498 if want_dbus != 'false' and not skip_deps
1499 libdbus = dependency('dbus-1',
1500 version : '>= 1.3.2',
1501 required : want_dbus == 'true')
1502 have = libdbus.found()
1507 conf.set10('HAVE_DBUS', have)
1509 dbusdatadir = datadir / 'dbus-1'
1510 if conf.get('HAVE_DBUS') == 1
1511 dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
1514 dbuspolicydir = get_option('dbuspolicydir')
1515 if dbuspolicydir == ''
1516 dbuspolicydir = dbusdatadir / 'system.d'
1519 dbussessionservicedir = get_option('dbussessionservicedir')
1520 if dbussessionservicedir == ''
1521 dbussessionservicedir = dbusdatadir / 'services'
1522 if conf.get('HAVE_DBUS') == 1
1523 dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
1527 dbussystemservicedir = get_option('dbussystemservicedir')
1528 if dbussystemservicedir == ''
1529 dbussystemservicedir = dbusdatadir / 'system-services'
1530 if conf.get('HAVE_DBUS') == 1
1531 dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
1535 dbus_interfaces_dir = get_option('dbus-interfaces-dir')
1536 if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
1537 if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
1538 dbus_interfaces_dir = 'no'
1539 warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
1541 dbus_interfaces_dir = dbusdatadir / 'interfaces'
1542 if conf.get('HAVE_DBUS') == 1
1543 dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
1547 if dbus_interfaces_dir == dbusdatadir / 'interfaces' or dbus_interfaces_dir == 'no'
1548 dbus_interfaces_dir_name = 'interfaces'
1549 dbus_interfaces_dir_parent = dbusdatadir
1551 elements = dbus_interfaces_dir.split('/')
1552 dbus_interfaces_dir_name = elements[-1]
1553 dbus_interfaces_dir_parent = '/'
1554 foreach elem : elements
1555 if elem == dbus_interfaces_dir_name and dbus_interfaces_dir == dbus_interfaces_dir_parent / dbus_interfaces_dir_name
1558 dbus_interfaces_dir_parent = dbus_interfaces_dir_parent / elem
1562 # We support one or the other. If gcrypt is available, we assume it's there to
1563 # be used, and use it in preference.
1564 opt = get_option('cryptolib')
1565 if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1566 error('openssl requested as the default cryptolib, but not available')
1568 conf.set10('PREFER_OPENSSL',
1569 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1570 conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1571 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
1572 lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? [libopenssl] : [libgcrypt, libgpg_error]
1574 dns_over_tls = get_option('dns-over-tls')
1575 if dns_over_tls != 'false'
1576 if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1
1577 error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib')
1580 if dns_over_tls == 'openssl' or conf.get('PREFER_OPENSSL') == 1
1583 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
1584 if dns_over_tls == 'gnutls' and not have_gnutls
1585 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1588 if dns_over_tls == 'gnutls' or have_gnutls
1589 have_openssl = false
1591 have_openssl = conf.get('HAVE_OPENSSL') == 1
1592 if dns_over_tls != 'auto' and not have_openssl
1593 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
1594 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1597 have = have_gnutls or have_openssl
1601 have_openssl = false
1603 conf.set10('ENABLE_DNS_OVER_TLS', have)
1604 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1605 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1607 default_dns_over_tls = get_option('default-dns-over-tls')
1609 default_dns_over_tls = 'no'
1611 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1612 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.')
1613 default_dns_over_tls = 'no'
1615 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1616 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1617 conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
1619 default_mdns = get_option('default-mdns')
1620 conf.set('DEFAULT_MDNS_MODE',
1621 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1622 conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
1624 default_llmnr = get_option('default-llmnr')
1625 conf.set('DEFAULT_LLMNR_MODE',
1626 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1627 conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
1629 want_repart = get_option('repart')
1630 if want_repart != 'false'
1631 have = conf.get('HAVE_LIBFDISK') == 1
1632 if want_repart == 'true' and not have
1633 error('repart support was requested, but dependencies are not available')
1638 conf.set10('ENABLE_REPART', have)
1640 default_dnssec = get_option('default-dnssec')
1642 default_dnssec = 'no'
1644 if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0
1645 message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.')
1646 default_dnssec = 'no'
1648 conf.set('DEFAULT_DNSSEC_MODE',
1649 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1650 conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1652 want_sysupdate = get_option('sysupdate')
1653 if want_sysupdate != 'false'
1654 have = (conf.get('HAVE_OPENSSL') == 1 and
1655 conf.get('HAVE_LIBFDISK') == 1)
1656 if want_sysupdate == 'true' and not have
1657 error('sysupdate support was requested, but dependencies are not available')
1662 conf.set10('ENABLE_SYSUPDATE', have)
1664 want_importd = get_option('importd')
1665 if want_importd != 'false'
1666 have = (conf.get('HAVE_LIBCURL') == 1 and
1667 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
1668 conf.get('HAVE_ZLIB') == 1 and
1669 conf.get('HAVE_XZ') == 1)
1670 if want_importd == 'true' and not have
1671 error('importd support was requested, but dependencies are not available')
1676 conf.set10('ENABLE_IMPORTD', have)
1678 want_kernel_install = get_option('kernel-install')
1679 conf.set10('ENABLE_KERNEL_INSTALL', want_kernel_install)
1681 want_homed = get_option('homed')
1682 if want_homed != 'false'
1683 have = (conf.get('HAVE_OPENSSL') == 1 and
1684 conf.get('HAVE_LIBFDISK') == 1 and
1685 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1686 if want_homed == 'true' and not have
1687 error('homed support was requested, but dependencies are not available')
1692 conf.set10('ENABLE_HOMED', have)
1694 have = have and conf.get('HAVE_PAM') == 1
1695 conf.set10('ENABLE_PAM_HOME', have)
1697 have = get_option('oomd')
1698 conf.set10('ENABLE_OOMD', have)
1700 want_remote = get_option('remote')
1701 if want_remote != 'false'
1702 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1703 conf.get('HAVE_LIBCURL') == 1]
1704 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1705 # it's possible to build one without the other. Complain only if
1706 # support was explicitly requested. The auxiliary files like sysusers
1707 # config should be installed when any of the programs are built.
1708 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1709 error('remote support was requested, but dependencies are not available')
1711 have = have_deps[0] or have_deps[1]
1715 conf.set10('ENABLE_REMOTE', have)
1717 foreach term : ['analyze',
1731 'compat-mutable-uid-boundaries',
1757 have = get_option(term)
1758 name = 'ENABLE_' + term.underscorify().to_upper()
1759 conf.set10(name, have)
1762 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1764 foreach tuple : [['nss-mymachines', 'machined'],
1765 ['nss-resolve', 'resolve']]
1766 want = get_option(tuple[0])
1768 have = get_option(tuple[1])
1769 if want == 'true' and not have
1770 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1775 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1776 conf.set10(name, have)
1780 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1781 'ENABLE_NSS_MYMACHINES',
1782 'ENABLE_NSS_RESOLVE',
1783 'ENABLE_NSS_SYSTEMD']
1784 if conf.get(term) == 1
1788 conf.set10('ENABLE_NSS', enable_nss)
1790 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1792 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1794 ############################################################
1800 ############################################################
1802 # Include these now as they provide gnu-efi detection.
1803 subdir('src/fundamental')
1804 subdir('src/boot/efi')
1806 ############################################################
1808 generate_gperfs = find_program('tools/generate-gperfs.py')
1809 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1810 make_directive_index_py = find_program('tools/make-directive-index.py')
1811 make_man_index_py = find_program('tools/make-man-index.py')
1812 meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
1813 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1814 update_man_rules_py = find_program('tools/update-man-rules.py')
1815 update_hwdb_sh = find_program('tools/update-hwdb.sh')
1816 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1817 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1818 xml_helper_py = find_program('tools/xml_helper.py')
1819 export_dbus_interfaces_py = find_program('tools/dbus_exporter.py')
1821 ############################################################
1823 config_h = configure_file(
1824 output : 'config.h',
1825 configuration : conf)
1827 add_project_arguments('-include', 'config.h', language : 'c')
1829 jinja2_cmdline = [meson_render_jinja2, config_h, version_h]
1831 ############################################################
1833 # binaries that have --help and are intended for use by humans,
1834 # usually, but not always, installed in /bin.
1835 public_programs = []
1837 # D-Bus introspection XML export
1840 basic_includes = include_directories(
1846 libsystemd_includes = [basic_includes, include_directories(
1847 'src/libsystemd/sd-bus',
1848 'src/libsystemd/sd-device',
1849 'src/libsystemd/sd-event',
1850 'src/libsystemd/sd-hwdb',
1851 'src/libsystemd/sd-id128',
1852 'src/libsystemd/sd-journal',
1853 'src/libsystemd/sd-netlink',
1854 'src/libsystemd/sd-network',
1855 'src/libsystemd/sd-resolve')]
1857 includes = [libsystemd_includes, include_directories('src/shared')]
1862 subdir('src/libsystemd')
1863 subdir('src/shared')
1865 subdir('src/libudev')
1866 subdir('src/cryptsetup/cryptsetup-tokens')
1868 libsystemd = shared_library(
1871 version : libsystemd_version,
1872 include_directories : libsystemd_includes,
1873 link_args : ['-shared',
1874 '-Wl,--version-script=' + libsystemd_sym_path],
1875 link_with : [libbasic,
1877 link_whole : [libsystemd_static],
1878 dependencies : [threads,
1883 link_depends : libsystemd_sym,
1885 install_dir : rootlibdir)
1887 install_libsystemd_static = static_library(
1891 basic_gcrypt_sources,
1892 fundamental_sources,
1894 include_directories : libsystemd_includes,
1895 build_by_default : static_libsystemd != 'false',
1896 install : static_libsystemd != 'false',
1897 install_dir : rootlibdir,
1898 pic : static_libsystemd_pic,
1899 dependencies : [threads,
1910 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1912 libudev = shared_library(
1915 version : libudev_version,
1916 include_directories : includes,
1917 link_args : ['-shared',
1918 '-Wl,--version-script=' + libudev_sym_path],
1919 link_with : [libsystemd_static, libshared_static],
1920 link_whole : libudev_basic,
1921 dependencies : [threads],
1922 link_depends : libudev_sym,
1924 install_dir : rootlibdir)
1926 install_libudev_static = static_library(
1929 fundamental_sources,
1934 include_directories : includes,
1935 build_by_default : static_libudev != 'false',
1936 install : static_libudev != 'false',
1937 install_dir : rootlibdir,
1938 link_depends : libudev_sym,
1939 dependencies : libshared_deps + [libmount],
1940 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1941 pic : static_libudev_pic)
1943 if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
1944 if conf.get('HAVE_TPM2') == 1
1945 cryptsetup_token_systemd_tpm2 = shared_library(
1946 'cryptsetup-token-systemd-tpm2',
1947 cryptsetup_token_systemd_tpm2_sources,
1948 include_directories : includes,
1949 link_args : ['-shared',
1950 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1951 link_with : [lib_cryptsetup_token_common,
1953 dependencies : [libcryptsetup,
1956 link_depends : cryptsetup_token_sym,
1957 install_rpath : rootlibexecdir,
1959 install_dir : libcryptsetup_plugins_dir)
1962 if conf.get('HAVE_LIBFIDO2') == 1
1963 cryptsetup_token_systemd_fido2 = shared_library(
1964 'cryptsetup-token-systemd-fido2',
1965 cryptsetup_token_systemd_fido2_sources,
1966 include_directories : includes,
1967 link_args : ['-shared',
1968 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1969 link_with : [lib_cryptsetup_token_common,
1971 dependencies : [libcryptsetup,
1974 link_depends : cryptsetup_token_sym,
1975 install_rpath : rootlibexecdir,
1977 install_dir : libcryptsetup_plugins_dir)
1980 if conf.get('HAVE_P11KIT') == 1
1981 cryptsetup_token_systemd_pkcs11 = shared_library(
1982 'cryptsetup-token-systemd-pkcs11',
1983 cryptsetup_token_systemd_pkcs11_sources,
1984 include_directories : includes,
1985 link_args : ['-shared',
1986 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1987 link_with : [lib_cryptsetup_token_common,
1989 dependencies : [libcryptsetup,
1992 link_depends : cryptsetup_token_sym,
1993 install_rpath : rootlibexecdir,
1995 install_dir : libcryptsetup_plugins_dir)
1999 ############################################################
2001 # systemd-analyze requires 'libcore'
2003 # systemd-journal-remote requires 'libjournal_core'
2004 subdir('src/journal')
2005 # systemd-networkd requires 'libsystemd_network'
2006 subdir('src/libsystemd-network')
2008 subdir('src/analyze')
2009 subdir('src/busctl')
2010 subdir('src/coredump')
2011 subdir('src/cryptenroll')
2012 subdir('src/cryptsetup')
2014 subdir('src/hostname')
2015 subdir('src/import')
2016 subdir('src/journal-remote')
2017 subdir('src/kernel-install')
2018 subdir('src/locale')
2020 subdir('src/machine')
2021 subdir('src/network')
2022 subdir('src/nspawn')
2024 subdir('src/partition')
2025 subdir('src/portable')
2026 subdir('src/pstore')
2027 subdir('src/resolve')
2029 subdir('src/shutdown')
2030 subdir('src/sysext')
2031 subdir('src/systemctl')
2032 subdir('src/sysupdate')
2033 subdir('src/timedate')
2034 subdir('src/timesync')
2035 subdir('src/tmpfiles')
2036 subdir('src/userdb')
2037 subdir('src/vconsole')
2038 subdir('src/xdg-autostart-generator')
2040 subdir('src/systemd')
2047 ############################################################
2049 # only static linking apart from libdl, to make sure that the
2050 # module is linked to all libraries that it uses.
2051 test_dlopen = executable(
2055 include_directories : includes,
2056 link_with : [libbasic],
2057 dependencies : [libdl],
2058 build_by_default : want_tests != 'false')
2060 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
2061 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
2062 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
2063 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
2065 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
2069 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
2070 version_script_arg = project_source_root / sym
2072 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
2073 if tuple.length() > 2
2074 foreach s : tuple[2]
2075 sources += ['src/nss-@0@/@1@'.format(module, s)]
2079 incs = tuple.length() > 3 ? tuple[3] : includes
2081 nss = shared_library(
2086 include_directories : incs,
2087 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
2088 link_args : ['-Wl,-z,nodelete',
2090 '-Wl,--version-script=' + version_script_arg],
2091 link_with : [libsystemd_static,
2094 dependencies : [threads,
2098 install_dir : rootlibdir)
2100 # We cannot use shared_module because it does not support version suffix.
2101 # Unfortunately shared_library insists on creating the symlink…
2102 meson.add_install_script('sh', '-c',
2103 'rm $DESTDIR@0@/libnss_@1@.so'
2104 .format(rootlibdir, module))
2106 if want_tests != 'false'
2107 test('dlopen-nss_' + module,
2109 # path to dlopen must include a slash
2110 args : nss.full_path(),
2116 ############################################################
2121 include_directories : includes,
2122 link_with : [libcore,
2124 dependencies : [versiondep,
2126 install_rpath : rootlibexecdir,
2128 install_dir : rootlibexecdir)
2129 dbus_programs += exe
2130 public_programs += exe
2132 meson.add_install_script(meson_make_symlink,
2133 rootlibexecdir / 'systemd',
2134 rootsbindir / 'init')
2136 public_programs += executable(
2138 systemd_analyze_sources,
2139 include_directories : core_includes,
2140 link_with : [libcore,
2142 dependencies : [versiondep,
2144 install_rpath : rootlibexecdir,
2145 install : conf.get('ENABLE_ANALYZE'))
2149 systemd_journald_sources,
2150 include_directories : includes,
2151 link_with : [libjournal_core,
2153 dependencies : [threads,
2158 install_rpath : rootlibexecdir,
2160 install_dir : rootlibexecdir)
2162 public_programs += executable(
2164 systemd_cat_sources,
2165 include_directories : includes,
2166 link_with : [libjournal_core,
2168 dependencies : [threads],
2169 install_rpath : rootlibexecdir,
2172 public_programs += executable(
2175 include_directories : includes,
2176 link_with : [libshared],
2177 dependencies : [threads,
2183 install_rpath : rootlibexecdir,
2185 install_dir : rootbindir)
2188 'systemd-getty-generator',
2189 'src/getty-generator/getty-generator.c',
2190 include_directories : includes,
2191 link_with : [libshared],
2192 install_rpath : rootlibexecdir,
2194 install_dir : systemgeneratordir)
2197 'systemd-debug-generator',
2198 'src/debug-generator/debug-generator.c',
2199 include_directories : includes,
2200 link_with : [libshared],
2201 install_rpath : rootlibexecdir,
2203 install_dir : systemgeneratordir)
2206 'systemd-run-generator',
2207 'src/run-generator/run-generator.c',
2208 include_directories : includes,
2209 link_with : [libshared],
2210 install_rpath : rootlibexecdir,
2212 install_dir : systemgeneratordir)
2215 'systemd-fstab-generator',
2216 'src/fstab-generator/fstab-generator.c',
2217 include_directories : includes,
2218 link_with : [libshared],
2219 install_rpath : rootlibexecdir,
2221 install_dir : systemgeneratordir)
2223 if want_tests != 'false'
2224 test('test-fstab-generator',
2225 test_fstab_generator_sh,
2226 # https://github.com/mesonbuild/meson/issues/2681
2227 args : exe.full_path(),
2231 if conf.get('ENABLE_ENVIRONMENT_D') == 1
2233 '30-systemd-environment-d-generator',
2234 'src/environment-d-generator/environment-d-generator.c',
2235 include_directories : includes,
2236 link_with : [libshared],
2237 install_rpath : rootlibexecdir,
2239 install_dir : userenvgeneratordir)
2241 meson.add_install_script(meson_make_symlink,
2242 sysconfdir / 'environment',
2243 environmentdir / '99-environment.conf')
2246 if conf.get('ENABLE_HIBERNATE') == 1
2248 'systemd-hibernate-resume-generator',
2249 'src/hibernate-resume/hibernate-resume-generator.c',
2250 include_directories : includes,
2251 link_with : [libshared],
2252 install_rpath : rootlibexecdir,
2254 install_dir : systemgeneratordir)
2257 'systemd-hibernate-resume',
2258 'src/hibernate-resume/hibernate-resume.c',
2259 include_directories : includes,
2260 link_with : [libshared],
2261 install_rpath : rootlibexecdir,
2263 install_dir : rootlibexecdir)
2266 if conf.get('HAVE_BLKID') == 1
2268 'systemd-gpt-auto-generator',
2269 'src/gpt-auto-generator/gpt-auto-generator.c',
2270 include_directories : includes,
2271 link_with : [libshared],
2272 dependencies : libblkid,
2273 install_rpath : rootlibexecdir,
2275 install_dir : systemgeneratordir)
2277 public_programs += executable(
2279 'src/dissect/dissect.c',
2280 include_directories : includes,
2281 link_with : [libshared],
2282 install_rpath : rootlibexecdir,
2286 if conf.get('ENABLE_RESOLVE') == 1
2287 dbus_programs += executable(
2289 systemd_resolved_sources,
2290 include_directories : resolve_includes,
2291 link_with : [libshared,
2293 libsystemd_resolve_core],
2294 dependencies : systemd_resolved_dependencies,
2295 install_rpath : rootlibexecdir,
2297 install_dir : rootlibexecdir)
2299 public_programs += executable(
2302 include_directories : includes,
2303 link_with : [libshared,
2305 libsystemd_resolve_core],
2306 dependencies : [threads,
2307 lib_openssl_or_gcrypt,
2310 install_rpath : rootlibexecdir,
2313 meson.add_install_script(meson_make_symlink,
2314 bindir / 'resolvectl',
2315 rootsbindir / 'resolvconf')
2317 meson.add_install_script(meson_make_symlink,
2318 bindir / 'resolvectl',
2319 bindir / 'systemd-resolve')
2322 if conf.get('ENABLE_LOGIND') == 1
2323 dbus_programs += executable(
2325 systemd_logind_sources,
2326 include_directories : includes,
2327 link_with : [liblogind_core,
2329 dependencies : [threads,
2331 install_rpath : rootlibexecdir,
2333 install_dir : rootlibexecdir)
2335 public_programs += executable(
2338 include_directories : includes,
2339 link_with : [libshared],
2340 dependencies : [threads,
2344 install_rpath : rootlibexecdir,
2346 install_dir : rootbindir)
2348 public_programs += executable(
2350 'src/login/inhibit.c',
2351 include_directories : includes,
2352 link_with : [libshared],
2353 install_rpath : rootlibexecdir,
2355 install_dir : rootbindir)
2357 if conf.get('HAVE_PAM') == 1
2358 version_script_arg = project_source_root / pam_systemd_sym
2359 pam_systemd = shared_library(
2363 include_directories : includes,
2364 link_args : ['-shared',
2365 '-Wl,--version-script=' + version_script_arg],
2366 link_with : [libsystemd_static,
2368 dependencies : [threads,
2371 link_depends : pam_systemd_sym,
2373 install_dir : pamlibdir)
2375 if want_tests != 'false'
2376 test('dlopen-pam_systemd',
2378 # path to dlopen must include a slash
2379 args : pam_systemd.full_path(),
2380 depends : pam_systemd)
2385 'systemd-user-runtime-dir',
2386 user_runtime_dir_sources,
2387 include_directories : includes,
2388 link_with : [libshared],
2389 install_rpath : rootlibexecdir,
2391 install_dir : rootlibexecdir)
2394 if conf.get('HAVE_PAM') == 1
2396 'systemd-user-sessions',
2397 'src/user-sessions/user-sessions.c',
2398 include_directories : includes,
2399 link_with : [libshared],
2400 install_rpath : rootlibexecdir,
2402 install_dir : rootlibexecdir)
2405 if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
2406 if get_option('link-boot-shared')
2407 boot_link_with = [libshared]
2409 boot_link_with = [libsystemd_static, libshared_static]
2412 public_programs += executable(
2414 'src/boot/bootctl.c',
2415 include_directories : includes,
2416 link_with : [boot_link_with],
2417 dependencies : [libblkid],
2418 install_rpath : rootlibexecdir,
2421 public_programs += executable(
2422 'systemd-bless-boot',
2423 'src/boot/bless-boot.c',
2424 include_directories : includes,
2425 link_with : [boot_link_with],
2426 dependencies : [libblkid],
2427 install_rpath : rootlibexecdir,
2429 install_dir : rootlibexecdir)
2432 'systemd-bless-boot-generator',
2433 'src/boot/bless-boot-generator.c',
2434 include_directories : includes,
2435 link_with : [boot_link_with],
2436 install_rpath : rootlibexecdir,
2438 install_dir : systemgeneratordir)
2442 'systemd-boot-check-no-failures',
2443 'src/boot/boot-check-no-failures.c',
2444 include_directories : includes,
2445 link_with : [libshared],
2446 dependencies : [libblkid],
2447 install_rpath : rootlibexecdir,
2449 install_dir : rootlibexecdir)
2451 public_programs += executable(
2452 'systemd-socket-activate',
2453 'src/activate/activate.c',
2454 include_directories : includes,
2455 link_with : [libshared],
2456 dependencies : [threads],
2457 install_rpath : rootlibexecdir,
2460 systemctl = executable(
2463 include_directories : includes,
2464 link_with : systemctl_link_with,
2465 dependencies : [threads,
2471 install_rpath : rootlibexecdir,
2473 install_dir : rootbindir)
2474 public_programs += systemctl
2476 if conf.get('ENABLE_PORTABLED') == 1
2477 dbus_programs += executable(
2478 'systemd-portabled',
2479 systemd_portabled_sources,
2480 include_directories : includes,
2481 link_with : [libshared],
2482 dependencies : [threads, libselinux],
2483 install_rpath : rootlibexecdir,
2485 install_dir : rootlibexecdir)
2487 public_programs += executable(
2489 'src/portable/portablectl.c',
2490 include_directories : includes,
2491 link_with : [libshared],
2492 dependencies : [threads],
2493 install_rpath : rootlibexecdir,
2495 install_dir : rootbindir)
2498 if conf.get('ENABLE_SYSEXT') == 1
2499 public_programs += executable(
2501 systemd_sysext_sources,
2502 include_directories : includes,
2503 link_with : [libshared],
2504 install_rpath : rootlibexecdir,
2506 install_dir : rootbindir)
2509 if conf.get('ENABLE_USERDB') == 1
2512 systemd_userwork_sources,
2513 include_directories : includes,
2514 link_with : [libshared],
2515 dependencies : [threads],
2516 install_rpath : rootlibexecdir,
2518 install_dir : rootlibexecdir)
2522 systemd_userdbd_sources,
2523 include_directories : includes,
2524 link_with : [libshared],
2525 dependencies : [threads],
2526 install_rpath : rootlibexecdir,
2528 install_dir : rootlibexecdir)
2530 public_programs += executable(
2533 include_directories : includes,
2534 link_with : [libshared],
2535 dependencies : [threads],
2536 install_rpath : rootlibexecdir,
2538 install_dir : rootbindir)
2541 if conf.get('ENABLE_HOMED') == 1
2544 systemd_homework_sources,
2545 include_directories : includes,
2546 link_with : [libshared],
2547 dependencies : [threads,
2553 install_rpath : rootlibexecdir,
2555 install_dir : rootlibexecdir)
2557 dbus_programs += executable(
2559 systemd_homed_sources,
2560 include_directories : home_includes,
2561 link_with : [libshared],
2562 dependencies : [threads,
2566 install_rpath : rootlibexecdir,
2568 install_dir : rootlibexecdir)
2570 public_programs += executable(
2573 include_directories : includes,
2574 link_with : [libshared],
2575 dependencies : [threads,
2580 install_rpath : rootlibexecdir,
2582 install_dir : rootbindir)
2584 if conf.get('HAVE_PAM') == 1
2585 version_script_arg = project_source_root / pam_systemd_home_sym
2586 pam_systemd = shared_library(
2590 include_directories : includes,
2591 link_args : ['-shared',
2592 '-Wl,--version-script=' + version_script_arg],
2593 link_with : [libsystemd_static,
2595 dependencies : [threads,
2599 link_depends : pam_systemd_home_sym,
2601 install_dir : pamlibdir)
2605 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2606 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2607 meson.add_install_script(meson_make_symlink,
2608 rootbindir / 'systemctl',
2609 rootsbindir / alias)
2612 meson.add_install_script(meson_make_symlink,
2613 rootbindir / 'udevadm',
2614 rootlibexecdir / 'systemd-udevd')
2616 if conf.get('ENABLE_BACKLIGHT') == 1
2618 'systemd-backlight',
2619 'src/backlight/backlight.c',
2620 include_directories : includes,
2621 link_with : [libshared],
2622 install_rpath : rootlibexecdir,
2624 install_dir : rootlibexecdir)
2627 if conf.get('ENABLE_RFKILL') == 1
2630 'src/rfkill/rfkill.c',
2631 include_directories : includes,
2632 link_with : [libshared],
2633 install_rpath : rootlibexecdir,
2635 install_dir : rootlibexecdir)
2639 'systemd-system-update-generator',
2640 'src/system-update-generator/system-update-generator.c',
2641 include_directories : includes,
2642 link_with : [libshared],
2643 install_rpath : rootlibexecdir,
2645 install_dir : systemgeneratordir)
2647 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2649 'systemd-cryptsetup',
2650 systemd_cryptsetup_sources,
2651 include_directories : includes,
2652 link_with : [libshared],
2653 dependencies : [libcryptsetup,
2655 install_rpath : rootlibexecdir,
2657 install_dir : rootlibexecdir)
2660 'systemd-cryptsetup-generator',
2661 'src/cryptsetup/cryptsetup-generator.c',
2662 include_directories : includes,
2663 link_with : [libshared],
2664 install_rpath : rootlibexecdir,
2666 install_dir : systemgeneratordir)
2669 'systemd-veritysetup',
2670 'src/veritysetup/veritysetup.c',
2671 include_directories : includes,
2672 link_with : [libshared],
2673 dependencies : [libcryptsetup],
2674 install_rpath : rootlibexecdir,
2676 install_dir : rootlibexecdir)
2679 'systemd-veritysetup-generator',
2680 'src/veritysetup/veritysetup-generator.c',
2681 include_directories : includes,
2682 link_with : [libshared],
2683 install_rpath : rootlibexecdir,
2685 install_dir : systemgeneratordir)
2687 public_programs += executable(
2688 'systemd-cryptenroll',
2689 systemd_cryptenroll_sources,
2690 include_directories : includes,
2691 link_with : [libshared],
2692 dependencies : [libcryptsetup,
2696 install_rpath : rootlibexecdir,
2700 'systemd-integritysetup',
2701 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
2702 include_directories : includes,
2703 link_with : [libshared],
2704 dependencies : [libcryptsetup],
2705 install_rpath : rootlibexecdir,
2707 install_dir : rootlibexecdir)
2710 'systemd-integritysetup-generator',
2711 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
2712 include_directories : includes,
2713 link_with : [libshared],
2714 install_rpath : rootlibexecdir,
2716 install_dir : systemgeneratordir)
2719 if conf.get('HAVE_SYSV_COMPAT') == 1
2721 'systemd-sysv-generator',
2722 'src/sysv-generator/sysv-generator.c',
2723 include_directories : includes,
2724 link_with : [libshared],
2725 install_rpath : rootlibexecdir,
2727 install_dir : systemgeneratordir)
2729 sysv_generator_test_py = find_program('test/sysv-generator-test.py')
2730 if want_tests != 'false'
2731 test('sysv-generator-test',
2732 sysv_generator_test_py,
2737 'systemd-rc-local-generator',
2738 'src/rc-local-generator/rc-local-generator.c',
2739 include_directories : includes,
2740 link_with : [libshared],
2741 install_rpath : rootlibexecdir,
2743 install_dir : systemgeneratordir)
2746 if conf.get('ENABLE_XDG_AUTOSTART') == 1
2748 'systemd-xdg-autostart-generator',
2749 systemd_xdg_autostart_generator_sources,
2750 include_directories : includes,
2751 link_with : [libshared],
2752 install_rpath : rootlibexecdir,
2754 install_dir : usergeneratordir)
2757 'systemd-xdg-autostart-condition',
2758 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2759 include_directories : includes,
2760 link_with : [libshared],
2761 install_rpath : rootlibexecdir,
2763 install_dir : rootlibexecdir)
2766 if conf.get('ENABLE_HOSTNAMED') == 1
2767 dbus_programs += executable(
2768 'systemd-hostnamed',
2769 'src/hostname/hostnamed.c',
2770 include_directories : includes,
2771 link_with : [libshared],
2772 install_rpath : rootlibexecdir,
2774 install_dir : rootlibexecdir)
2776 public_programs += executable(
2778 'src/hostname/hostnamectl.c',
2779 include_directories : includes,
2780 link_with : [libshared],
2781 install_rpath : rootlibexecdir,
2785 if conf.get('ENABLE_LOCALED') == 1
2786 if conf.get('HAVE_XKBCOMMON') == 1
2787 # logind will load libxkbcommon.so dynamically on its own, but we still
2788 # need to specify where the headers are
2789 deps = [libdl, libxkbcommon.partial_dependency(compile_args: true)]
2794 dbus_programs += executable(
2796 systemd_localed_sources,
2797 include_directories : includes,
2798 link_with : [libshared],
2799 dependencies : deps,
2800 install_rpath : rootlibexecdir,
2802 install_dir : rootlibexecdir)
2804 public_programs += executable(
2807 include_directories : includes,
2808 link_with : [libshared],
2809 install_rpath : rootlibexecdir,
2813 if conf.get('ENABLE_TIMEDATED') == 1
2814 dbus_programs += executable(
2815 'systemd-timedated',
2816 'src/timedate/timedated.c',
2817 include_directories : includes,
2818 link_with : [libshared],
2819 install_rpath : rootlibexecdir,
2821 install_dir : rootlibexecdir)
2824 if conf.get('ENABLE_TIMEDATECTL') == 1
2825 public_programs += executable(
2827 'src/timedate/timedatectl.c',
2828 include_directories : includes,
2829 install_rpath : rootlibexecdir,
2830 link_with : [libshared],
2831 dependencies : [libm],
2835 if conf.get('ENABLE_TIMESYNCD') == 1
2837 'systemd-timesyncd',
2838 systemd_timesyncd_sources,
2839 include_directories : includes,
2840 link_with : [libtimesyncd_core],
2841 dependencies : [threads,
2843 install_rpath : rootlibexecdir,
2845 install_dir : rootlibexecdir)
2848 'systemd-time-wait-sync',
2849 'src/timesync/wait-sync.c',
2850 include_directories : includes,
2851 link_with : [libtimesyncd_core],
2852 install_rpath : rootlibexecdir,
2854 install_dir : rootlibexecdir)
2857 if conf.get('ENABLE_MACHINED') == 1
2858 dbus_programs += executable(
2860 systemd_machined_sources,
2861 include_directories : includes,
2862 link_with : [libmachine_core,
2864 install_rpath : rootlibexecdir,
2866 install_dir : rootlibexecdir)
2868 public_programs += executable(
2870 'src/machine/machinectl.c',
2871 include_directories : includes,
2872 link_with : [libshared],
2873 dependencies : [threads,
2877 install_rpath : rootlibexecdir,
2879 install_dir : rootbindir)
2882 if conf.get('ENABLE_IMPORTD') == 1
2883 dbus_programs += executable(
2885 systemd_importd_sources,
2886 include_directories : includes,
2887 link_with : [libshared],
2888 dependencies : [threads],
2889 install_rpath : rootlibexecdir,
2891 install_dir : rootlibexecdir)
2893 systemd_pull = executable(
2895 systemd_pull_sources,
2896 include_directories : includes,
2897 link_with : [libshared,
2899 dependencies : [versiondep,
2901 lib_openssl_or_gcrypt,
2905 install_rpath : rootlibexecdir,
2907 install_dir : rootlibexecdir)
2909 systemd_import = executable(
2911 systemd_import_sources,
2912 include_directories : includes,
2913 link_with : [libshared,
2915 dependencies : [libcurl,
2919 install_rpath : rootlibexecdir,
2921 install_dir : rootlibexecdir)
2923 systemd_import_fs = executable(
2924 'systemd-import-fs',
2925 systemd_import_fs_sources,
2926 include_directories : includes,
2927 link_with : [libshared,
2929 install_rpath : rootlibexecdir,
2931 install_dir : rootlibexecdir)
2933 systemd_export = executable(
2935 systemd_export_sources,
2936 include_directories : includes,
2937 link_with : [libshared,
2939 dependencies : [libcurl,
2943 install_rpath : rootlibexecdir,
2945 install_dir : rootlibexecdir)
2947 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2950 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2951 public_programs += executable(
2952 'systemd-journal-upload',
2953 systemd_journal_upload_sources,
2954 include_directories : includes,
2955 link_with : [libshared],
2956 dependencies : [versiondep,
2963 install_rpath : rootlibexecdir,
2965 install_dir : rootlibexecdir)
2968 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2969 public_programs += executable(
2970 'systemd-journal-remote',
2971 systemd_journal_remote_sources,
2972 include_directories : journal_includes,
2973 link_with : [libshared,
2974 libsystemd_journal_remote],
2975 dependencies : [threads,
2981 install_rpath : rootlibexecdir,
2983 install_dir : rootlibexecdir)
2985 public_programs += executable(
2986 'systemd-journal-gatewayd',
2987 systemd_journal_gatewayd_sources,
2988 include_directories : journal_includes,
2989 link_with : [libshared],
2990 dependencies : [threads,
2996 install_rpath : rootlibexecdir,
2998 install_dir : rootlibexecdir)
3001 if conf.get('ENABLE_COREDUMP') == 1
3004 systemd_coredump_sources,
3005 include_directories : includes,
3006 link_with : [libshared],
3007 dependencies : [threads,
3012 install_rpath : rootlibexecdir,
3014 install_dir : rootlibexecdir)
3016 public_programs += executable(
3018 coredumpctl_sources,
3019 include_directories : includes,
3020 link_with : [libshared],
3021 dependencies : [threads,
3025 install_rpath : rootlibexecdir,
3029 if conf.get('ENABLE_PSTORE') == 1
3032 systemd_pstore_sources,
3033 include_directories : includes,
3034 link_with : [libshared],
3035 dependencies : [threads,
3040 install_rpath : rootlibexecdir,
3042 install_dir : rootlibexecdir)
3045 if conf.get('ENABLE_OOMD') == 1
3046 dbus_programs += executable('systemd-oomd',
3047 systemd_oomd_sources,
3048 include_directories : includes,
3049 link_with : [libshared],
3051 install_rpath : rootlibexecdir,
3053 install_dir : rootlibexecdir)
3055 public_programs += executable(
3058 include_directories : includes,
3059 link_with : [libshared],
3061 install_rpath : rootlibexecdir,
3065 if conf.get('ENABLE_BINFMT') == 1
3066 public_programs += executable(
3068 'src/binfmt/binfmt.c',
3069 include_directories : includes,
3070 link_with : [libshared],
3071 install_rpath : rootlibexecdir,
3073 install_dir : rootlibexecdir)
3075 meson.add_install_script('sh', '-c',
3076 mkdir_p.format(binfmtdir))
3077 if install_sysconfdir
3078 meson.add_install_script('sh', '-c',
3079 mkdir_p.format(sysconfdir / 'binfmt.d'))
3083 if conf.get('ENABLE_SYSUPDATE') == 1
3085 'systemd-sysupdate',
3086 systemd_sysupdate_sources,
3087 include_directories : includes,
3088 link_with : [libshared],
3089 dependencies : [threads,
3093 install_rpath : rootlibexecdir,
3095 install_dir : rootlibexecdir)
3096 public_programs += exe
3099 if conf.get('ENABLE_VCONSOLE') == 1
3101 'systemd-vconsole-setup',
3102 'src/vconsole/vconsole-setup.c',
3103 include_directories : includes,
3104 link_with : [libshared],
3105 install_rpath : rootlibexecdir,
3107 install_dir : rootlibexecdir)
3110 if conf.get('ENABLE_RANDOMSEED') == 1
3112 'systemd-random-seed',
3113 'src/random-seed/random-seed.c',
3114 include_directories : includes,
3115 link_with : [libshared],
3116 install_rpath : rootlibexecdir,
3118 install_dir : rootlibexecdir)
3121 if conf.get('ENABLE_FIRSTBOOT') == 1
3122 public_programs += executable(
3123 'systemd-firstboot',
3124 'src/firstboot/firstboot.c',
3125 include_directories : includes,
3126 link_with : [libshared],
3127 dependencies : [libcrypt],
3128 install_rpath : rootlibexecdir,
3130 install_dir : rootbindir)
3134 'systemd-remount-fs',
3135 'src/remount-fs/remount-fs.c',
3136 include_directories : includes,
3137 link_with : [libshared],
3138 install_rpath : rootlibexecdir,
3140 install_dir : rootlibexecdir)
3143 'systemd-machine-id-setup',
3144 'src/machine-id-setup/machine-id-setup-main.c',
3145 include_directories : includes,
3146 link_with : [libshared],
3147 install_rpath : rootlibexecdir,
3149 install_dir : rootbindir)
3154 include_directories : includes,
3155 link_with : [libshared],
3156 install_rpath : rootlibexecdir,
3158 install_dir : rootlibexecdir)
3160 executable('systemd-growfs',
3161 'src/partition/growfs.c',
3162 include_directories : includes,
3163 link_with : [libshared],
3164 install_rpath : rootlibexecdir,
3166 install_dir : rootlibexecdir)
3170 'src/partition/makefs.c',
3171 include_directories : includes,
3172 link_with : [libshared],
3173 install_rpath : rootlibexecdir,
3175 install_dir : rootlibexecdir)
3179 'src/sleep/sleep.c',
3180 include_directories : includes,
3181 link_with : [libshared],
3182 install_rpath : rootlibexecdir,
3184 install_dir : rootlibexecdir)
3186 if install_sysconfdir_samples
3187 install_data('src/sleep/sleep.conf',
3188 install_dir : pkgsysconfdir)
3191 public_programs += executable(
3193 'src/sysctl/sysctl.c',
3194 include_directories : includes,
3195 link_with : [libshared],
3196 install_rpath : rootlibexecdir,
3198 install_dir : rootlibexecdir)
3202 'src/ac-power/ac-power.c',
3203 include_directories : includes,
3204 link_with : [libshared],
3205 install_rpath : rootlibexecdir,
3207 install_dir : rootlibexecdir)
3209 public_programs += executable(
3210 'systemd-detect-virt',
3211 'src/detect-virt/detect-virt.c',
3212 include_directories : includes,
3213 link_with : [libshared],
3214 install_rpath : rootlibexecdir,
3217 public_programs += executable(
3219 'src/delta/delta.c',
3220 include_directories : includes,
3221 link_with : [libshared],
3222 install_rpath : rootlibexecdir,
3225 public_programs += executable(
3227 'src/escape/escape.c',
3228 include_directories : includes,
3229 link_with : [libshared],
3230 install_rpath : rootlibexecdir,
3232 install_dir : rootbindir)
3234 public_programs += executable(
3236 'src/notify/notify.c',
3237 include_directories : includes,
3238 link_with : [libshared],
3239 install_rpath : rootlibexecdir,
3241 install_dir : rootbindir)
3243 public_programs += executable(
3245 'src/creds/creds.c',
3246 include_directories : includes,
3247 link_with : [libshared],
3248 dependencies : [threads,
3250 install_rpath : rootlibexecdir,
3252 install_dir : rootbindir)
3255 'systemd-volatile-root',
3256 'src/volatile-root/volatile-root.c',
3257 include_directories : includes,
3258 link_with : [libshared],
3259 install_rpath : rootlibexecdir,
3260 install : conf.get('ENABLE_INITRD') == 1,
3261 install_dir : rootlibexecdir)
3264 'systemd-cgroups-agent',
3265 'src/cgroups-agent/cgroups-agent.c',
3266 include_directories : includes,
3267 link_with : [libshared],
3268 install_rpath : rootlibexecdir,
3270 install_dir : rootlibexecdir)
3272 systemd_id128 = executable(
3274 'src/id128/id128.c',
3275 include_directories : includes,
3276 link_with : [libshared],
3277 install_rpath : rootlibexecdir,
3279 public_programs += systemd_id128
3281 if want_tests != 'false'
3282 test('test-systemctl-enable',
3283 test_systemctl_enable_sh,
3284 # https://github.com/mesonbuild/meson/issues/2681
3285 args : [systemctl.full_path(),
3286 systemd_id128.full_path()])
3289 public_programs += executable(
3292 include_directories : includes,
3293 link_with : [libshared],
3294 install_rpath : rootlibexecdir,
3297 public_programs += executable(
3298 'systemd-ask-password',
3299 'src/ask-password/ask-password.c',
3300 include_directories : includes,
3301 link_with : [libshared],
3302 install_rpath : rootlibexecdir,
3304 install_dir : rootbindir)
3307 'systemd-reply-password',
3308 'src/reply-password/reply-password.c',
3309 include_directories : includes,
3310 link_with : [libshared],
3311 install_rpath : rootlibexecdir,
3313 install_dir : rootlibexecdir)
3315 public_programs += executable(
3316 'systemd-tty-ask-password-agent',
3317 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3318 include_directories : includes,
3319 link_with : [libshared],
3320 install_rpath : rootlibexecdir,
3322 install_dir : rootbindir)
3324 public_programs += executable(
3327 include_directories : includes,
3328 link_with : [libshared],
3329 install_rpath : rootlibexecdir,
3332 public_programs += executable(
3334 'src/cgtop/cgtop.c',
3335 include_directories : includes,
3336 link_with : [libshared],
3337 install_rpath : rootlibexecdir,
3342 'src/initctl/initctl.c',
3343 include_directories : includes,
3344 link_with : [libshared],
3345 install_rpath : rootlibexecdir,
3346 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3347 install_dir : rootlibexecdir)
3349 public_programs += executable(
3351 'src/mount/mount-tool.c',
3352 include_directories : includes,
3353 link_with : [libshared],
3354 dependencies: [libmount],
3355 install_rpath : rootlibexecdir,
3358 meson.add_install_script(meson_make_symlink,
3359 'systemd-mount', bindir / 'systemd-umount')
3361 public_programs += executable(
3364 include_directories : includes,
3365 link_with : [libshared],
3366 install_rpath : rootlibexecdir,
3369 public_programs += executable(
3370 'systemd-stdio-bridge',
3371 'src/stdio-bridge/stdio-bridge.c',
3372 include_directories : includes,
3373 link_with : [libshared],
3374 dependencies : [versiondep],
3375 install_rpath : rootlibexecdir,
3378 public_programs += executable(
3381 include_directories : includes,
3382 link_with : [libshared],
3383 dependencies : [versiondep],
3384 install_rpath : rootlibexecdir,
3390 'src/sysusers/sysusers.c',
3391 include_directories : includes,
3392 link_with : [libshared],
3393 install_rpath : rootlibexecdir,
3395 install_dir : rootbindir)
3396 public_programs += exe
3398 if want_tests != 'false'
3399 test('test-sysusers',
3401 # https://github.com/mesonbuild/meson/issues/2681
3402 args : exe.full_path())
3405 if have_standalone_binaries
3407 'systemd-sysusers.standalone',
3408 'src/sysusers/sysusers.c',
3409 include_directories : includes,
3410 c_args : '-DSTANDALONE',
3411 link_with : [libshared_static,
3416 install_dir : rootbindir)
3417 public_programs += exe
3419 if want_tests != 'false'
3420 test('test-sysusers.standalone',
3422 # https://github.com/mesonbuild/meson/issues/2681
3423 args : exe.full_path())
3428 if conf.get('ENABLE_TMPFILES') == 1
3431 systemd_tmpfiles_sources,
3432 include_directories : includes,
3433 link_with : [libshared],
3434 dependencies : [libacl],
3435 install_rpath : rootlibexecdir,
3437 install_dir : rootbindir)
3438 public_programs += exe
3440 if want_tests != 'false'
3441 test('test-systemd-tmpfiles',
3442 test_systemd_tmpfiles_py,
3443 # https://github.com/mesonbuild/meson/issues/2681
3444 args : exe.full_path())
3447 if have_standalone_binaries
3448 public_programs += executable(
3449 'systemd-tmpfiles.standalone',
3450 systemd_tmpfiles_sources,
3451 include_directories : includes,
3452 c_args : '-DSTANDALONE',
3453 link_with : [libshared_static,
3457 dependencies : [libacl],
3459 install_dir : rootbindir)
3463 if conf.get('ENABLE_HWDB') == 1
3464 systemd_hwdb = executable(
3467 include_directories : includes,
3468 link_with : udev_link_with,
3469 install_rpath : udev_rpath,
3471 install_dir : rootbindir)
3472 public_programs += systemd_hwdb
3474 if want_tests != 'false'
3477 args : [systemd_hwdb.full_path()],
3482 if conf.get('ENABLE_QUOTACHECK') == 1
3484 'systemd-quotacheck',
3485 'src/quotacheck/quotacheck.c',
3486 include_directories : includes,
3487 link_with : [libshared],
3488 install_rpath : rootlibexecdir,
3490 install_dir : rootlibexecdir)
3493 public_programs += executable(
3494 'systemd-socket-proxyd',
3495 'src/socket-proxy/socket-proxyd.c',
3496 include_directories : includes,
3497 link_with : [libshared],
3498 dependencies : [threads],
3499 install_rpath : rootlibexecdir,
3501 install_dir : rootlibexecdir)
3503 udevadm = executable(
3506 include_directories : includes,
3507 link_with : [libudevd_core],
3508 dependencies : [versiondep,
3514 install_rpath : udev_rpath,
3516 install_dir : rootbindir)
3517 public_programs += udevadm
3519 if conf.get('ENABLE_REPART') == 1
3522 systemd_repart_sources,
3523 include_directories : includes,
3524 link_with : [libshared],
3525 dependencies : [threads,
3528 install_rpath : rootlibexecdir,
3530 install_dir : rootbindir)
3531 public_programs += exe
3533 if want_tests != 'false'
3536 args : [exe.full_path(), udevadm.full_path()])
3542 systemd_shutdown_sources,
3543 include_directories : includes,
3544 link_with : [libshared],
3545 dependencies : [libmount],
3546 install_rpath : rootlibexecdir,
3548 install_dir : rootlibexecdir)
3551 'systemd-update-done',
3552 'src/update-done/update-done.c',
3553 include_directories : includes,
3554 link_with : [libshared],
3555 install_rpath : rootlibexecdir,
3557 install_dir : rootlibexecdir)
3560 'systemd-update-utmp',
3561 'src/update-utmp/update-utmp.c',
3562 include_directories : includes,
3563 link_with : [libshared],
3564 dependencies : [libaudit],
3565 install_rpath : rootlibexecdir,
3566 install : (conf.get('ENABLE_UTMP') == 1),
3567 install_dir : rootlibexecdir)
3569 if conf.get('HAVE_KMOD') == 1
3571 'systemd-modules-load',
3572 'src/modules-load/modules-load.c',
3573 include_directories : includes,
3574 link_with : [libshared],
3575 dependencies : [libkmod],
3576 install_rpath : rootlibexecdir,
3578 install_dir : rootlibexecdir)
3580 meson.add_install_script('sh', '-c',
3581 mkdir_p.format(modulesloaddir))
3582 if install_sysconfdir
3583 meson.add_install_script('sh', '-c',
3584 mkdir_p.format(sysconfdir / 'modules-load.d'))
3588 public_programs += executable(
3590 systemd_nspawn_sources,
3591 include_directories : includes,
3592 link_with : [libnspawn_core,
3594 dependencies : [libblkid,
3596 install_rpath : rootlibexecdir,
3599 if conf.get('ENABLE_NETWORKD') == 1
3600 dbus_programs += executable(
3602 systemd_networkd_sources,
3603 include_directories : network_includes,
3604 link_with : [libnetworkd_core,
3606 networkd_link_with],
3607 dependencies : [threads],
3608 install_rpath : rootlibexecdir,
3610 install_dir : rootlibexecdir)
3612 public_programs += executable(
3613 'systemd-networkd-wait-online',
3614 systemd_networkd_wait_online_sources,
3615 include_directories : includes,
3616 link_with : [networkd_link_with],
3617 install_rpath : rootlibexecdir,
3619 install_dir : rootlibexecdir)
3621 public_programs += executable(
3624 include_directories : libsystemd_network_includes,
3625 link_with : [libsystemd_network,
3626 networkd_link_with],
3627 install_rpath : rootlibexecdir,
3629 install_dir : rootbindir)
3633 'systemd-network-generator',
3634 network_generator_sources,
3635 include_directories : includes,
3636 link_with : [networkd_link_with],
3637 install_rpath : rootlibexecdir,
3639 install_dir : rootlibexecdir)
3641 if want_tests != 'false'
3642 test('test-network-generator-conversion',
3643 test_network_generator_conversion_sh,
3644 # https://github.com/mesonbuild/meson/issues/2681
3645 args : exe.full_path(),
3650 'systemd-sulogin-shell',
3651 'src/sulogin-shell/sulogin-shell.c',
3652 include_directories : includes,
3653 link_with : [libshared],
3654 install_rpath : rootlibexecdir,
3656 install_dir : rootlibexecdir)
3658 public_programs += custom_target(
3660 input : kernel_install_in,
3661 output : 'kernel-install',
3662 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
3663 install : want_kernel_install,
3664 install_mode : 'rwxr-xr-x',
3665 install_dir : bindir)
3667 ############################################################
3669 runtest_env = custom_target(
3670 'systemd-runtest.env',
3671 output : 'systemd-runtest.env',
3672 command : [sh, '-c',
3673 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
3674 project_source_root / 'test',
3675 project_build_root / 'catalog')],
3677 build_by_default : true)
3679 test_cflags = ['-DTEST_CODE=1']
3680 # We intentionally do not do inline initializations with definitions for a
3681 # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
3682 # use the variable unexpectedly. This triggers a lot of maybe-uninitialized
3683 # false positives when the combination of -O2 and -flto is used. Suppress them.
3684 if '-O2' in get_option('c_args') and '-flto=auto' in get_option('c_args')
3685 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
3688 foreach tuple : tests
3690 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3691 dependencies = tuple.length() > 2 ? tuple[2] : []
3692 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3693 condition = tuple.length() > 4 ? tuple[4] : ''
3694 type = tuple.length() > 5 ? tuple[5] : ''
3695 defs = tuple.length() > 6 ? tuple[6] : []
3697 parallel = tuple.length() > 7 ? tuple[7] : true
3700 # FIXME: Use fs.stem() with meson >= 0.54.0
3701 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
3702 if type.startswith('timeout=')
3703 timeout = type.split('=')[1].to_int()
3707 if condition == '' or conf.get(condition) == 1
3711 include_directories : incs,
3712 link_with : link_with,
3713 dependencies : [versiondep,
3716 build_by_default : want_tests != 'false',
3717 install_rpath : rootlibexecdir,
3718 install : install_tests,
3719 install_dir : testsdir / type,
3720 link_depends : runtest_env)
3723 message('@0@ is a manual test'.format(name))
3724 elif type == 'unsafe' and want_tests != 'unsafe'
3725 message('@0@ is an unsafe test'.format(name))
3726 elif want_tests != 'false'
3732 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3737 'test-libsystemd-sym',
3738 test_libsystemd_sym_c,
3739 include_directories : includes,
3740 link_with : [libsystemd],
3741 build_by_default : want_tests != 'false',
3742 install : install_tests,
3743 install_dir : testsdir)
3744 if want_tests != 'false'
3745 test('test-libsystemd-sym', exe)
3749 'test-libsystemd-static-sym',
3750 test_libsystemd_sym_c,
3751 include_directories : includes,
3752 link_with : [install_libsystemd_static],
3753 dependencies : [threads], # threads is already included in dependencies on the library,
3754 # but does not seem to get propagated. Add here as a work-around.
3755 build_by_default : want_tests != 'false' and static_libsystemd_pic,
3756 install : install_tests and static_libsystemd_pic,
3757 install_dir : testsdir)
3758 if want_tests != 'false' and static_libsystemd_pic
3759 test('test-libsystemd-static-sym', exe)
3765 include_directories : libudev_includes,
3766 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3767 link_with : [libudev],
3768 build_by_default : want_tests != 'false',
3769 install : install_tests,
3770 install_dir : testsdir)
3771 if want_tests != 'false'
3772 test('test-libudev-sym', exe)
3776 'test-libudev-static-sym',
3778 include_directories : libudev_includes,
3779 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3780 link_with : [install_libudev_static],
3781 build_by_default : want_tests != 'false' and static_libudev_pic,
3782 install : install_tests and static_libudev_pic,
3783 install_dir : testsdir)
3784 if want_tests != 'false' and static_libudev_pic
3785 test('test-libudev-static-sym', exe)
3788 ############################################################
3792 foreach tuple : fuzzers
3794 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3795 dependencies = tuple.length() > 2 ? tuple[2] : []
3796 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3797 defs = tuple.length() > 4 ? tuple[4] : []
3801 dependencies += fuzzing_engine
3803 if fuzzing_engine.found()
3804 dependencies += fuzzing_engine
3806 link_args += ['-fsanitize=fuzzer']
3809 sources += 'src/fuzz/fuzz-main.c'
3812 # FIXME: Use fs.stem() with meson >= 0.54.0
3813 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
3818 include_directories : [incs, include_directories('src/fuzz')],
3819 link_with : link_with,
3820 dependencies : dependencies,
3821 c_args : defs + test_cflags,
3822 link_args: link_args,
3824 build_by_default : fuzzer_build)
3827 if want_tests != 'false'
3828 # Run the fuzz regression tests without any sanitizers enabled.
3829 # Additional invocations with sanitizers may be added below.
3830 foreach p : fuzz_regression_tests
3831 b = p.split('/')[-2]
3832 c = p.split('/')[-1]
3835 test('@0@_@1@'.format(b, c),
3837 args : [project_source_root / p])
3843 alias_target('fuzzers', fuzzer_exes)
3845 ############################################################
3847 subdir('modprobe.d')
3849 subdir('sysusers.d')
3850 subdir('tmpfiles.d')
3856 subdir('shell-completion/bash')
3857 subdir('shell-completion/zsh')
3858 subdir('docs/sysvinit')
3859 subdir('docs/var-log')
3861 install_subdir('factory/etc',
3862 install_dir : factorydir)
3863 subdir('factory/templates')
3865 if install_sysconfdir
3866 install_data('xorg/50-systemd-user.sh',
3867 install_dir : xinitrcdir)
3869 install_data('LICENSE.GPL2',
3873 'docs/CODING_STYLE.md',
3874 'docs/DISTRO_PORTING.md',
3875 'docs/ENVIRONMENT.md',
3877 'docs/TRANSIENT-SETTINGS.md',
3878 'docs/TRANSLATORS.md',
3879 'docs/UIDS-GIDS.md',
3880 'docs/GVARIANT-SERIALIZATION.md',
3881 install_dir : docdir)
3883 install_subdir('LICENSES',
3884 install_dir : docdir)
3886 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3887 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3889 ############################################################
3891 # Ensure that changes to the docs/ directory do not break the
3892 # basic Github pages build. But only run it in developer mode,
3893 # as it might be fragile due to changes in the tooling, and it is
3894 # not generally useful for users.
3895 jekyll = find_program('jekyll', required : false)
3896 if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
3897 test('github-pages',
3900 '--source', project_source_root / 'docs',
3901 '--destination', project_build_root / '_site'])
3904 ############################################################
3906 check_help = find_program('tools/check-help.sh')
3907 check_version = find_program('tools/check-version.sh')
3909 foreach exec : public_programs
3910 name = exec.full_path().split('/')[-1]
3911 if want_tests != 'false'
3912 test('check-help-' + name,
3914 args : exec.full_path(),
3917 test('check-version-' + name,
3919 args : [exec.full_path(),
3920 meson.project_version()],
3925 ############################################################
3927 check_directives_sh = find_program('tools/check-directives.sh')
3929 if want_tests != 'false'
3930 test('check-directives',
3931 check_directives_sh,
3932 args : [project_source_root, project_build_root])
3935 ############################################################
3937 # Enable tests for all supported sanitizers
3938 foreach tuple : sanitizers
3939 sanitizer = tuple[0]
3942 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3944 foreach p : fuzz_regression_tests
3945 b = p.split('/')[-2]
3946 c = p.split('/')[-1]
3948 name = '@0@:@1@'.format(b, sanitizer)
3951 if want_tests == 'false'
3952 message('Not compiling @0@ because tests is set to false'.format(name))
3954 exe = custom_target(
3958 command : [ln, '-fs',
3959 build.full_path() / b,
3961 build_by_default : true)
3963 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
3969 test('@0@_@1@_@2@'.format(b, c, sanitizer),
3971 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3973 args : [exe.full_path(),
3974 project_source_root / p])
3981 ############################################################
3984 all_files = run_command(
3985 env, '-u', 'GIT_WORK_TREE',
3986 git, '--git-dir=@0@/.git'.format(project_source_root),
3987 'ls-files', ':/*.[ch]',
3989 if all_files.returncode() == 0
3990 all_files = files(all_files.stdout().split())
3995 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
3998 command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files)
4003 git_contrib_sh = find_program('tools/git-contrib.sh')
4006 command : [git_contrib_sh])
4010 git_head = run_command(
4011 git, '--git-dir=@0@/.git'.format(project_source_root),
4012 'rev-parse', 'HEAD',
4013 check : false).stdout().strip()
4014 git_head_short = run_command(
4015 git, '--git-dir=@0@/.git'.format(project_source_root),
4016 'rev-parse', '--short=7', 'HEAD',
4017 check : false).stdout().strip()
4021 command : [git, 'archive',
4022 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
4024 '--prefix', 'systemd-@0@/'.format(git_head),
4028 ############################################################
4030 check_api_docs_sh = find_program('tools/check-api-docs.sh')
4033 depends : [man, libsystemd, libudev],
4034 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
4036 alias_target('update-dbus-docs', update_dbus_docs)
4037 alias_target('update-man-rules', update_man_rules)
4039 if not meson.is_cross_build()
4041 'export-dbus-interfaces',
4042 output : dbus_interfaces_dir_name,
4043 install : dbus_interfaces_dir != 'no',
4044 install_dir : dbus_interfaces_dir_parent,
4045 command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs])
4048 ############################################################
4050 alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
4051 check : true).stdout().strip()
4054 'split /usr' : split_usr,
4055 'split bin-sbin' : split_bin,
4056 'prefix directory' : prefixdir,
4057 'rootprefix directory' : rootprefixdir,
4058 'sysconf directory' : sysconfdir,
4059 'include directory' : includedir,
4060 'lib directory' : libdir,
4061 'rootlib directory' : rootlibdir,
4062 'SysV init scripts' : sysvinit_path,
4063 'SysV rc?.d directories' : sysvrcnd_path,
4064 'PAM modules directory' : pamlibdir,
4065 'PAM configuration directory' : pamconfdir,
4066 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
4067 'RPM macros directory' : rpmmacrosdir,
4068 'modprobe.d directory' : modprobedir,
4069 'D-Bus policy directory' : dbuspolicydir,
4070 'D-Bus session directory' : dbussessionservicedir,
4071 'D-Bus system directory' : dbussystemservicedir,
4072 'D-Bus interfaces directory' : dbus_interfaces_dir,
4073 'bash completions directory' : bashcompletiondir,
4074 'zsh completions directory' : zshcompletiondir,
4075 'private shared lib version tag' : shared_lib_tag,
4076 'extra start script' : get_option('rc-local'),
4077 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
4078 get_option('debug-tty')),
4079 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
4080 conf.get('SYSTEM_ALLOC_UID_MIN')),
4081 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
4082 conf.get('SYSTEM_ALLOC_GID_MIN')),
4083 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
4084 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
4085 'static UID/GID allocations' : ' '.join(static_ugids),
4086 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
4087 'render group access mode' : get_option('group-render-mode'),
4088 'certificate root directory' : get_option('certificate-root'),
4089 'support URL' : support_url,
4090 'nobody user name' : nobody_user,
4091 'nobody group name' : nobody_group,
4092 'fallback hostname' : get_option('fallback-hostname'),
4093 'default DNSSEC mode' : default_dnssec,
4094 'default DNS-over-TLS mode' : default_dns_over_tls,
4095 'default mDNS mode' : default_mdns,
4096 'default LLMNR mode' : default_llmnr,
4097 'default DNS servers' : dns_servers.split(' '),
4098 'default NTP servers' : ntp_servers.split(' '),
4099 'default cgroup hierarchy' : default_hierarchy,
4100 'default net.naming-scheme value' : default_net_naming_scheme,
4101 'default KillUserProcesses value' : kill_user_processes,
4102 'default locale' : default_locale,
4103 'default user $PATH' :
4104 default_user_path != '' ? default_user_path : '(same as system services)',
4105 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
4106 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
4109 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
4110 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
4111 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
4132 ['libcryptsetup-plugins'],
4158 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
4188 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
4202 ['legacy-pkla', install_polkit_pkla],
4207 ['man pages', want_man],
4208 ['html pages', want_html],
4209 ['man page indices', want_man and have_lxml],
4211 ['compat-mutable-uid-boundaries'],
4214 ['adm group', get_option('adm-group')],
4215 ['wheel group', get_option('wheel-group')],
4218 ['debug mmap cache'],
4220 ['valgrind', conf.get('VALGRIND') == 1],
4221 ['trace logging', conf.get('LOG_TRACE') == 1],
4222 ['install tests', install_tests],
4223 ['link-udev-shared', get_option('link-udev-shared')],
4224 ['link-systemctl-shared', get_option('link-systemctl-shared')],
4225 ['link-networkd-shared', get_option('link-networkd-shared')],
4226 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
4227 ['link-boot-shared', get_option('link-boot-shared')],
4229 ['standalone-binaries', get_option('standalone-binaries')],
4232 if tuple.length() >= 2
4235 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
4236 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
4237 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
4246 if static_libsystemd == 'false'
4247 missing += 'static-libsystemd'
4249 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
4252 if static_libudev == 'false'
4253 missing += 'static-libudev'
4255 found += 'static-libudev(@0@)'.format(static_libudev)
4258 if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
4259 found += 'cryptolib(openssl)'
4260 elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
4261 found += 'cryptolib(gcrypt)'
4263 missing += 'cryptolib'
4266 if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
4267 found += 'DNS-over-TLS(gnutls)'
4268 elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
4269 found += 'DNS-over-TLS(openssl)'
4271 missing += 'DNS-over-TLS'
4275 'enabled' : ', '.join(found),
4276 'disabled' : ', '.join(missing)},
4277 section : 'Features')
4279 if rootprefixdir != rootprefix_default
4281 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
4282 'systemd used fixed names for unit file directories and other paths, so anything\n' +
4283 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))