1 # SPDX-License-Identifier: LGPL-2.1-or-later
3 project('systemd', 'c',
13 meson_version : '>= 0.46',
16 libsystemd_version = '0.30.0'
17 libudev_version = '1.7.0'
19 # We need the same data in two different formats, ugh!
20 # Also, for hysterical reasons, we use different variable
21 # names, sometimes. Not all variables are included in every
23 conf = configuration_data()
24 conf.set('PROJECT_VERSION', meson.project_version(),
25 description : 'Numerical project version (used where a simple number is expected)')
27 substs = configuration_data()
28 substs.set('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
29 substs.set('PROJECT_VERSION', meson.project_version(),
30 description : 'Numerical project version (used where a simple number is expected)')
32 # This is to be used instead of meson.source_root(), as the latter will return
33 # the wrong result when systemd is being built as a meson subproject
34 project_source_root = meson.current_source_dir()
35 project_build_root = meson.current_build_dir()
36 relative_source_path = run_command('realpath',
37 '--relative-to=@0@'.format(project_build_root),
38 project_source_root).stdout().strip()
39 conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
41 conf.set('BUILD_MODE', 'BUILD_MODE_' + get_option('mode').to_upper(),
42 description : 'tailor build to development or release builds')
44 want_ossfuzz = get_option('oss-fuzz')
45 want_libfuzzer = get_option('llvm-fuzz')
46 if want_ossfuzz + want_libfuzzer > 1
47 error('only one of oss-fuzz or llvm-fuzz can be specified')
50 skip_deps = want_ossfuzz or want_libfuzzer
51 fuzzer_build = want_ossfuzz or want_libfuzzer
53 #####################################################################
55 # Try to install the git pre-commit hook
56 add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
57 if add_git_hook_sh.found()
58 git_hook = run_command(add_git_hook_sh)
59 if git_hook.returncode() == 0
60 message(git_hook.stdout().strip())
64 #####################################################################
66 if get_option('split-usr') == 'auto'
67 split_usr = run_command('test', '-L', '/bin').returncode() != 0
69 split_usr = get_option('split-usr') == 'true'
71 conf.set10('HAVE_SPLIT_USR', split_usr,
72 description : '/usr/bin and /bin directories are separate')
74 if get_option('split-bin') == 'auto'
75 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
77 split_bin = get_option('split-bin') == 'true'
79 conf.set10('HAVE_SPLIT_BIN', split_bin,
80 description : 'bin and sbin directories are separate')
82 rootprefixdir = get_option('rootprefix')
83 # Unusual rootprefixdir values are used by some distros
84 # (see https://github.com/systemd/systemd/pull/7461).
85 rootprefix_default = split_usr ? '/' : '/usr'
86 if rootprefixdir == ''
87 rootprefixdir = rootprefix_default
89 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
91 have_standalone_binaries = get_option('standalone-binaries')
93 sysvinit_path = get_option('sysvinit-path')
94 sysvrcnd_path = get_option('sysvrcnd-path')
95 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
96 description : 'SysV init scripts and rcN.d links are supported')
98 if get_option('hibernate') and not get_option('initrd')
99 error('hibernate depends on initrd')
102 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
103 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
104 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
106 # join_paths ignores the preceding arguments if an absolute component is
107 # encountered, so this should canonicalize various paths when they are
108 # absolute or relative.
109 prefixdir = get_option('prefix')
110 if not prefixdir.startswith('/')
111 error('Prefix is not absolute: "@0@"'.format(prefixdir))
113 bindir = join_paths(prefixdir, get_option('bindir'))
114 libdir = join_paths(prefixdir, get_option('libdir'))
115 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
116 includedir = join_paths(prefixdir, get_option('includedir'))
117 datadir = join_paths(prefixdir, get_option('datadir'))
118 localstatedir = join_paths('/', get_option('localstatedir'))
120 rootbindir = join_paths(rootprefixdir, 'bin')
121 rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
122 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
124 rootlibdir = get_option('rootlibdir')
126 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
129 install_sysconfdir = get_option('install-sysconfdir') != 'false'
130 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
131 # Dirs of external packages
132 pkgconfigdatadir = get_option('pkgconfigdatadir') == '' ? join_paths(datadir, 'pkgconfig') : get_option('pkgconfigdatadir')
133 pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgconfig') : get_option('pkgconfiglibdir')
134 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
135 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
136 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
137 xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
138 rpmmacrosdir = get_option('rpmmacrosdir')
139 if rpmmacrosdir != 'no'
140 rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
142 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
145 pkgdatadir = join_paths(datadir, 'systemd')
146 environmentdir = join_paths(prefixdir, 'lib/environment.d')
147 pkgsysconfdir = join_paths(sysconfdir, 'systemd')
148 userunitdir = join_paths(prefixdir, 'lib/systemd/user')
149 userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
150 tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
151 sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
152 sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
153 binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
154 modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
155 networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
156 pkgincludedir = join_paths(includedir, 'systemd')
157 systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
158 usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
159 systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
160 userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
161 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
162 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
163 systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
164 systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
165 udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
166 udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
167 udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
168 catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
169 kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
170 factorydir = join_paths(datadir, 'factory')
171 bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
172 testsdir = join_paths(prefixdir, 'lib/systemd/tests')
173 systemdstatedir = join_paths(localstatedir, 'lib/systemd')
174 catalogstatedir = join_paths(systemdstatedir, 'catalog')
175 randomseeddir = join_paths(localstatedir, 'lib/systemd')
176 profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
177 ntpservicelistdir = join_paths(rootprefixdir, 'lib/systemd/ntp-units.d')
179 docdir = get_option('docdir')
181 docdir = join_paths(datadir, 'doc/systemd')
184 dbuspolicydir = get_option('dbuspolicydir')
185 if dbuspolicydir == ''
186 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
189 dbussessionservicedir = get_option('dbussessionservicedir')
190 if dbussessionservicedir == ''
191 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
194 dbussystemservicedir = get_option('dbussystemservicedir')
195 if dbussystemservicedir == ''
196 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
199 pamlibdir = get_option('pamlibdir')
201 pamlibdir = join_paths(rootlibdir, 'security')
204 pamconfdir = get_option('pamconfdir')
206 pamconfdir = join_paths(prefixdir, 'lib/pam.d')
209 memory_accounting_default = get_option('memory-accounting-default')
210 status_unit_format_default = get_option('status-unit-format-default')
212 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
213 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'system'))
214 conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
215 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
216 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
217 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
219 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
220 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
222 conf.set_quoted('USER_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'user'))
223 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
224 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
225 conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
226 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
227 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
228 conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
229 conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
230 conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
231 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
232 conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
233 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
234 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
235 conf.set_quoted('ROOTPREFIX', rootprefixdir)
236 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
237 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
238 conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
239 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
240 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
241 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
242 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
243 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
244 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
245 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
246 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
247 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
248 conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
249 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
250 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
251 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
252 conf.set_quoted('LIBDIR', libdir)
253 conf.set_quoted('ROOTLIBDIR', rootlibdir)
254 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
255 conf.set_quoted('BOOTLIBDIR', bootlibdir)
256 conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
257 conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
258 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', join_paths(rootlibexecdir, 'systemd-import-fs'))
259 conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
260 conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
261 conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
262 conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
263 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', join_paths(rootlibexecdir, 'systemd-homework'))
264 conf.set_quoted('SYSTEMD_USERWORK_PATH', join_paths(rootlibexecdir, 'systemd-userwork'))
265 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
266 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
267 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
269 substs.set('prefix', prefixdir)
270 substs.set('rootprefix', rootprefixdir)
271 substs.set('rootprefix_noslash', rootprefixdir_noslash)
272 substs.set('exec_prefix', prefixdir)
273 substs.set('libdir', libdir)
274 substs.set('rootlibdir', rootlibdir)
275 substs.set('includedir', includedir)
276 substs.set('sysconfdir', sysconfdir)
277 substs.set('bindir', bindir)
278 substs.set('rootbindir', rootbindir)
279 substs.set('rootlibexecdir', rootlibexecdir)
280 substs.set('systemunitdir', systemunitdir)
281 substs.set('userunitdir', userunitdir)
282 substs.set('systempresetdir', systempresetdir)
283 substs.set('userpresetdir', userpresetdir)
284 substs.set('udevhwdbdir', udevhwdbdir)
285 substs.set('udevrulesdir', udevrulesdir)
286 substs.set('udevlibexecdir', udevlibexecdir)
287 substs.set('environmentdir', environmentdir)
288 substs.set('catalogdir', catalogdir)
289 substs.set('tmpfilesdir', tmpfilesdir)
290 substs.set('sysusersdir', sysusersdir)
291 substs.set('sysctldir', sysctldir)
292 substs.set('binfmtdir', binfmtdir)
293 substs.set('modulesloaddir', modulesloaddir)
294 substs.set('modprobedir', modprobedir)
295 substs.set('systemgeneratordir', systemgeneratordir)
296 substs.set('usergeneratordir', usergeneratordir)
297 substs.set('systemenvgeneratordir', systemenvgeneratordir)
298 substs.set('userenvgeneratordir', userenvgeneratordir)
299 substs.set('systemshutdowndir', systemshutdowndir)
300 substs.set('systemsleepdir', systemsleepdir)
301 substs.set('CERTIFICATEROOT', get_option('certificate-root'))
302 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
303 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
304 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
305 substs.set('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
306 substs.set('RC_LOCAL_PATH', get_option('rc-local'))
307 substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
308 substs.set('STATUS_UNIT_FORMAT_DEFAULT', status_unit_format_default)
309 substs.set('HIGH_RLIMIT_NOFILE', conf.get('HIGH_RLIMIT_NOFILE'))
310 substs.set('BUILD_ROOT', project_build_root)
312 #####################################################################
314 cc = meson.get_compiler('c')
315 pkgconfig = import('pkgconfig')
316 check_compilation_sh = find_program('tools/check-compilation.sh')
317 meson_build_sh = find_program('tools/meson-build.sh')
319 want_tests = get_option('tests')
320 slow_tests = want_tests != 'false' and get_option('slow-tests')
321 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
322 install_tests = get_option('install-tests')
324 if add_languages('cpp', required : fuzzer_build)
325 # Used only for tests
326 cxx = meson.get_compiler('cpp')
327 cxx_cmd = ' '.join(cxx.cmd_array())
333 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
334 if fuzzing_engine.found()
335 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
336 elif cc.has_argument('-fsanitize=fuzzer-no-link')
337 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
339 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
342 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
345 # Those generate many false positives, and we do not want to change the code to
347 basic_disabled_warnings = [
348 '-Wno-unused-parameter',
349 '-Wno-missing-field-initializers',
350 '-Wno-unused-result',
351 '-Wno-format-signedness',
354 possible_cc_flags = [
357 '-Wmissing-include-dirs',
358 '-Wold-style-definition',
362 '-Wsuggest-attribute=noreturn',
363 '-Werror=missing-prototypes',
364 '-Werror=implicit-function-declaration',
365 '-Werror=missing-declarations',
366 '-Werror=return-type',
367 '-Werror=incompatible-pointer-types',
369 '-Wstrict-prototypes',
371 '-Wmissing-noreturn',
372 '-Wimplicit-fallthrough=5',
375 '-Wstrict-aliasing=2',
378 '-Werror=shift-count-overflow',
379 '-Werror=shift-overflow=2',
383 # negative arguments are correctly detected starting with meson 0.46.
384 '-Wno-error=#warnings', # clang
385 '-Wno-string-plus-int', # clang
387 # Disable -Wmaybe-uninitialized, since it's noisy on gcc 8 with
388 # optimizations enabled, producing essentially false positives.
389 '-Wno-maybe-uninitialized',
393 '-fdiagnostics-show-option',
394 '-fno-strict-aliasing',
395 '-fvisibility=hidden',
397 '-fstack-protector-strong',
398 '--param=ssp-buffer-size=4',
401 # --as-needed and --no-undefined are provided by meson by default,
402 # run mesonconf to see what is enabled
403 possible_link_flags = [
409 if cc.get_id() == 'clang'
410 possible_cc_flags += [
411 '-Wno-typedef-redefinition',
412 '-Wno-gnu-variable-sized-type-not-at-end',
416 if get_option('buildtype') != 'debug'
417 possible_cc_flags += [
418 '-ffunction-sections',
422 possible_link_flags += '-Wl,--gc-sections'
425 add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
426 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
427 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
429 have = cc.has_argument('-Wzero-length-bounds')
430 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
434 #include <inttypes.h>
435 typedef uint64_t usec_t;
436 usec_t now(clockid_t clock);
441 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
442 add_project_arguments('-Werror=shadow', language : 'c')
446 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
449 cpp = ' '.join(cc.cmd_array()) + ' -E'
451 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
453 #####################################################################
454 # compilation result tests
456 conf.set('_GNU_SOURCE', true)
457 conf.set('__SANE_USERSPACE_TYPES__', true)
458 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
460 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
461 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
462 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
463 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
467 #include <sys/stat.h>
470 foreach decl : ['char16_t',
475 # We get -1 if the size cannot be determined
476 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
478 if decl == 'struct statx'
480 want_linux_stat_h = false
482 have = cc.sizeof(decl,
483 prefix : decl_headers + '#include <linux/stat.h>',
484 args : '-D_GNU_SOURCE') > 0
485 want_linux_stat_h = have
489 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
492 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
494 foreach ident : ['secure_getenv', '__secure_getenv']
495 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
499 ['memfd_create', '''#include <sys/mman.h>'''],
500 ['gettid', '''#include <sys/types.h>
501 #include <unistd.h>'''],
502 ['pivot_root', '''#include <stdlib.h>
503 #include <unistd.h>'''], # no known header declares pivot_root
504 ['name_to_handle_at', '''#include <sys/types.h>
505 #include <sys/stat.h>
506 #include <fcntl.h>'''],
507 ['setns', '''#include <sched.h>'''],
508 ['renameat2', '''#include <stdio.h>
509 #include <fcntl.h>'''],
510 ['kcmp', '''#include <linux/kcmp.h>'''],
511 ['keyctl', '''#include <sys/types.h>
512 #include <keyutils.h>'''],
513 ['copy_file_range', '''#include <sys/syscall.h>
514 #include <unistd.h>'''],
515 ['bpf', '''#include <sys/syscall.h>
516 #include <unistd.h>'''],
517 ['statx', '''#include <sys/types.h>
518 #include <sys/stat.h>
519 #include <unistd.h>'''],
520 ['explicit_bzero' , '''#include <string.h>'''],
521 ['reallocarray', '''#include <stdlib.h>'''],
522 ['set_mempolicy', '''#include <stdlib.h>
523 #include <unistd.h>'''],
524 ['get_mempolicy', '''#include <stdlib.h>
525 #include <unistd.h>'''],
526 ['pidfd_send_signal', '''#include <stdlib.h>
529 #include <sys/wait.h>'''],
530 ['pidfd_open', '''#include <stdlib.h>
533 #include <sys/wait.h>'''],
534 ['rt_sigqueueinfo', '''#include <stdlib.h>
537 #include <sys/wait.h>'''],
538 ['mallinfo', '''#include <malloc.h>'''],
539 ['execveat', '''#include <unistd.h>'''],
540 ['close_range', '''#include <unistd.h>'''],
543 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
544 conf.set10('HAVE_' + ident[0].to_upper(), have)
547 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
548 conf.set10('USE_SYS_RANDOM_H', true)
549 conf.set10('HAVE_GETRANDOM', true)
551 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
552 conf.set10('USE_SYS_RANDOM_H', false)
553 conf.set10('HAVE_GETRANDOM', have)
556 #####################################################################
558 vcs_tagger = [project_source_root + '/tools/meson-vcs-tag.sh',
560 get_option('version-tag'),
561 meson.project_version()]
564 input : 'src/version/version.h.in',
565 output : 'version.h',
568 versiondep = declare_dependency(sources: version_h)
570 sed = find_program('sed')
571 awk = find_program('awk')
572 m4 = find_program('m4')
573 stat = find_program('stat')
574 git = find_program('git', required : false)
575 env = find_program('env')
576 perl = find_program('perl', required : false)
578 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
579 mkdir_p = 'mkdir -p $DESTDIR/@0@'
580 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
581 splash_bmp = files('test/splash.bmp')
583 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
584 # /usr/sbin, /sbin, and fall back to the default from middle column.
585 progs = [['quotaon', '/usr/sbin/quotaon' ],
586 ['quotacheck', '/usr/sbin/quotacheck' ],
587 ['kmod', '/usr/bin/kmod' ],
588 ['kexec', '/usr/sbin/kexec' ],
589 ['sulogin', '/usr/sbin/sulogin' ],
590 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
591 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
592 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
593 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
594 ['nologin', '/usr/sbin/nologin', ],
597 path = get_option(prog[0] + '-path')
599 message('Using @1@ for @0@'.format(prog[0], path))
601 exe = find_program(prog[0],
602 '/usr/sbin/' + prog[0],
605 path = exe.found() ? exe.path() : prog[1]
607 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
608 conf.set_quoted(name, path)
609 substs.set(name, path)
612 conf.set_quoted('TELINIT', get_option('telinit-path'))
614 if run_command('ln', '--relative', '--help').returncode() != 0
615 error('ln does not support --relative (added in coreutils 8.16)')
618 ############################################################
620 gperf = find_program('gperf')
622 gperf_test_format = '''
624 const char * in_word_set(const char *, @0@);
627 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
628 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
629 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
630 if cc.compiles(gperf_test)
631 gperf_len_type = 'size_t'
633 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
634 if cc.compiles(gperf_test)
635 gperf_len_type = 'unsigned'
637 error('unable to determine gperf len type')
640 message('gperf len type is @0@'.format(gperf_len_type))
641 conf.set('GPERF_LEN_TYPE', gperf_len_type,
642 description : 'The type of gperf "len" parameter')
644 ############################################################
646 if not cc.has_header('sys/capability.h')
647 error('POSIX caps headers not found')
649 foreach header : ['crypt.h',
651 'linux/vm_sockets.h',
653 'valgrind/memcheck.h',
654 'valgrind/valgrind.h',
657 conf.set10('HAVE_' + header.underscorify().to_upper(),
658 cc.has_header(header))
661 ############################################################
663 fallback_hostname = get_option('fallback-hostname')
664 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
665 error('Invalid fallback-hostname configuration')
666 # A more extensive test is done in test-hostname-util. Let's catch
667 # the most obvious errors here so we don't fail with an assert later.
669 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
671 default_hierarchy = get_option('default-hierarchy')
672 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
673 description : 'default cgroup hierarchy as string')
674 if default_hierarchy == 'legacy'
675 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
676 elif default_hierarchy == 'hybrid'
677 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
679 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
682 default_net_naming_scheme = get_option('default-net-naming-scheme')
683 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
685 time_epoch = get_option('time-epoch')
687 time_epoch = run_command('sh', ['-c', 'echo "$SOURCE_DATE_EPOCH"']).stdout().strip()
688 if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
689 # If we're in a git repository, use the creation time of the latest git tag.
690 latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
691 time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout()
695 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
697 time_epoch = time_epoch.to_int()
699 conf.set('TIME_EPOCH', time_epoch)
701 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
702 ['system-uid-max', 'SYS_UID_MAX', 999],
703 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
704 ['system-gid-max', 'SYS_GID_MAX', 999]]
705 v = get_option(tuple[0])
709 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
710 '/etc/login.defs').stdout().strip()
717 conf.set(tuple[0].underscorify().to_upper(), v)
718 substs.set(tuple[0].underscorify().to_upper(), v)
720 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
721 error('Invalid uid allocation range')
723 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
724 error('Invalid gid allocation range')
727 dynamic_uid_min = get_option('dynamic-uid-min')
728 dynamic_uid_max = get_option('dynamic-uid-max')
729 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
730 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
731 substs.set('dynamicuidmin', dynamic_uid_min)
732 substs.set('dynamicuidmax', dynamic_uid_max)
734 container_uid_base_min = get_option('container-uid-base-min')
735 container_uid_base_max = get_option('container-uid-base-max')
736 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
737 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
738 substs.set('containeruidbasemin', container_uid_base_min)
739 substs.set('containeruidbasemax', container_uid_base_max)
741 nobody_user = get_option('nobody-user')
742 nobody_group = get_option('nobody-group')
744 if not meson.is_cross_build()
745 getent_result = run_command('getent', 'passwd', '65534')
746 if getent_result.returncode() == 0
747 name = getent_result.stdout().split(':')[0]
748 if name != nobody_user
750 '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) +
751 'Your build will result in an user table setup that is incompatible with the local system.')
754 id_result = run_command('id', '-u', nobody_user)
755 if id_result.returncode() == 0
756 id = id_result.stdout().to_int()
759 '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) +
760 'Your build will result in an user table setup that is incompatible with the local system.')
764 getent_result = run_command('getent', 'group', '65534')
765 if getent_result.returncode() == 0
766 name = getent_result.stdout().split(':')[0]
767 if name != nobody_group
769 '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) +
770 'Your build will result in an group table setup that is incompatible with the local system.')
773 id_result = run_command('id', '-g', nobody_group)
774 if id_result.returncode() == 0
775 id = id_result.stdout().to_int()
778 'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
779 'Your build will result in an group table setup that is incompatible with the local system.')
783 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
785 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
786 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
789 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
790 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
791 substs.set('NOBODY_USER_NAME', nobody_user)
792 substs.set('NOBODY_GROUP_NAME', nobody_group)
794 tty_gid = get_option('tty-gid')
795 conf.set('TTY_GID', tty_gid)
796 substs.set('TTY_GID', tty_gid)
798 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
799 users_gid = get_option('users-gid')
800 substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid)
802 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
803 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
805 dev_kvm_mode = get_option('dev-kvm-mode')
806 substs.set('DEV_KVM_MODE', dev_kvm_mode)
807 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
808 group_render_mode = get_option('group-render-mode')
809 substs.set('GROUP_RENDER_MODE', group_render_mode)
810 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
812 kill_user_processes = get_option('default-kill-user-processes')
813 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
814 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
815 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
817 dns_servers = get_option('dns-servers')
818 conf.set_quoted('DNS_SERVERS', dns_servers)
819 substs.set('DNS_SERVERS', dns_servers)
821 ntp_servers = get_option('ntp-servers')
822 conf.set_quoted('NTP_SERVERS', ntp_servers)
823 substs.set('NTP_SERVERS', ntp_servers)
825 default_locale = get_option('default-locale')
826 if default_locale == ''
827 if not meson.is_cross_build()
828 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
829 default_locale = run_command(choose_default_locale_sh).stdout().strip()
831 default_locale = 'C.UTF-8'
834 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
836 localegen_path = get_option('localegen-path')
838 if localegen_path != ''
839 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
842 conf.set10('HAVE_LOCALEGEN', have)
844 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
846 service_watchdog = get_option('service-watchdog')
847 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
848 substs.set('SERVICE_WATCHDOG', watchdog_value)
850 substs.set('SUSHELL', get_option('debug-shell'))
851 substs.set('DEBUGTTY', get_option('debug-tty'))
852 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
854 enable_debug_hashmap = false
855 enable_debug_mmap_cache = false
856 enable_debug_siphash = false
857 foreach name : get_option('debug-extra')
859 enable_debug_hashmap = true
860 elif name == 'mmap-cache'
861 enable_debug_mmap_cache = true
862 elif name == 'siphash'
863 enable_debug_siphash = true
865 message('unknown debug option "@0@", ignoring'.format(name))
868 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
869 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
870 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
872 conf.set10('VALGRIND', get_option('valgrind'))
873 conf.set10('LOG_TRACE', get_option('log-trace'))
875 default_user_path = get_option('user-path')
876 if default_user_path != ''
877 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
878 default_user_path_display = default_user_path
880 # meson 0.49 fails when ?: is used in .format()
881 default_user_path_display = '(same as system services)'
885 #####################################################################
887 threads = dependency('threads')
888 librt = cc.find_library('rt')
889 libm = cc.find_library('m')
890 libdl = cc.find_library('dl')
891 libcrypt = cc.find_library('crypt')
893 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
895 ['crypt_ra', crypt_header],
896 ['crypt_preferred_method', crypt_header],
897 ['crypt_gensalt_ra', crypt_header]]
899 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
900 dependencies : libcrypt)
901 conf.set10('HAVE_' + ident[0].to_upper(), have)
904 libcap = dependency('libcap', required : false)
905 if not libcap.found()
906 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
907 libcap = cc.find_library('cap')
910 libmount = dependency('mount',
911 version : fuzzer_build ? '>= 0' : '>= 2.30')
913 want_libfdisk = get_option('fdisk')
914 if want_libfdisk != 'false' and not skip_deps
915 libfdisk = dependency('fdisk',
917 required : want_libfdisk == 'true')
918 have = libfdisk.found()
923 conf.set10('HAVE_LIBFDISK', have)
925 want_pwquality = get_option('pwquality')
926 if want_pwquality != 'false' and not skip_deps
927 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
928 have = libpwquality.found()
933 conf.set10('HAVE_PWQUALITY', have)
935 want_seccomp = get_option('seccomp')
936 if want_seccomp != 'false' and not skip_deps
937 libseccomp = dependency('libseccomp',
938 version : '>= 2.3.1',
939 required : want_seccomp == 'true')
940 have = libseccomp.found()
945 conf.set10('HAVE_SECCOMP', have)
947 want_selinux = get_option('selinux')
948 if want_selinux != 'false' and not skip_deps
949 libselinux = dependency('libselinux',
950 version : '>= 2.1.9',
951 required : want_selinux == 'true')
952 have = libselinux.found()
957 conf.set10('HAVE_SELINUX', have)
959 want_apparmor = get_option('apparmor')
960 if want_apparmor != 'false' and not skip_deps
961 libapparmor = dependency('libapparmor',
963 required : want_apparmor == 'true')
964 have = libapparmor.found()
969 conf.set10('HAVE_APPARMOR', have)
971 smack_run_label = get_option('smack-run-label')
972 if smack_run_label != ''
973 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
976 want_polkit = get_option('polkit')
977 install_polkit = false
978 install_polkit_pkla = false
979 if want_polkit != 'false' and not skip_deps
980 install_polkit = true
982 libpolkit = dependency('polkit-gobject-1',
984 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
985 message('Old polkit detected, will install pkla files')
986 install_polkit_pkla = true
989 conf.set10('ENABLE_POLKIT', install_polkit)
991 want_acl = get_option('acl')
992 if want_acl != 'false' and not skip_deps
993 libacl = cc.find_library('acl', required : want_acl == 'true')
994 have = libacl.found()
999 conf.set10('HAVE_ACL', have)
1001 want_audit = get_option('audit')
1002 if want_audit != 'false' and not skip_deps
1003 libaudit = dependency('audit', required : want_audit == 'true')
1004 have = libaudit.found()
1009 conf.set10('HAVE_AUDIT', have)
1011 want_blkid = get_option('blkid')
1012 if want_blkid != 'false' and not skip_deps
1013 libblkid = dependency('blkid', required : want_blkid == 'true')
1014 have = libblkid.found()
1016 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1017 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1022 conf.set10('HAVE_BLKID', have)
1024 want_kmod = get_option('kmod')
1025 if want_kmod != 'false' and not skip_deps
1026 libkmod = dependency('libkmod',
1028 required : want_kmod == 'true')
1029 have = libkmod.found()
1034 conf.set10('HAVE_KMOD', have)
1036 want_pam = get_option('pam')
1037 if want_pam != 'false' and not skip_deps
1038 libpam = cc.find_library('pam', required : want_pam == 'true')
1039 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1040 have = libpam.found() and libpam_misc.found()
1046 conf.set10('HAVE_PAM', have)
1048 want_microhttpd = get_option('microhttpd')
1049 if want_microhttpd != 'false' and not skip_deps
1050 libmicrohttpd = dependency('libmicrohttpd',
1051 version : '>= 0.9.33',
1052 required : want_microhttpd == 'true')
1053 have = libmicrohttpd.found()
1058 conf.set10('HAVE_MICROHTTPD', have)
1060 want_libcryptsetup = get_option('libcryptsetup')
1061 if want_libcryptsetup != 'false' and not skip_deps
1062 libcryptsetup = dependency('libcryptsetup',
1063 version : '>= 2.0.1',
1064 required : want_libcryptsetup == 'true')
1065 have = libcryptsetup.found()
1067 conf.set10('HAVE_CRYPT_SET_METADATA_SIZE',
1068 have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup))
1069 conf.set10('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY',
1070 have and cc.has_function('crypt_activate_by_signed_key', dependencies : libcryptsetup))
1071 conf.set10('HAVE_CRYPT_TOKEN_MAX',
1072 have and cc.has_function('crypt_token_max', dependencies : libcryptsetup))
1077 conf.set10('HAVE_LIBCRYPTSETUP', have)
1079 want_libcurl = get_option('libcurl')
1080 if want_libcurl != 'false' and not skip_deps
1081 libcurl = dependency('libcurl',
1082 version : '>= 7.32.0',
1083 required : want_libcurl == 'true')
1084 have = libcurl.found()
1089 conf.set10('HAVE_LIBCURL', have)
1090 conf.set10('CURL_NO_OLDIES', get_option('mode') == 'developer')
1092 want_libidn = get_option('libidn')
1093 want_libidn2 = get_option('libidn2')
1094 if want_libidn == 'true' and want_libidn2 == 'true'
1095 error('libidn and libidn2 cannot be requested simultaneously')
1098 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1099 libidn = dependency('libidn2',
1100 required : want_libidn2 == 'true')
1101 have = libidn.found()
1106 conf.set10('HAVE_LIBIDN2', have)
1107 if not have and want_libidn != 'false' and not skip_deps
1108 # libidn is used for both libidn and libidn2 objects
1109 libidn = dependency('libidn',
1110 required : want_libidn == 'true')
1111 have = libidn.found()
1115 conf.set10('HAVE_LIBIDN', have)
1117 want_libiptc = get_option('libiptc')
1118 if want_libiptc != 'false' and not skip_deps
1119 libiptc = dependency('libiptc',
1120 required : want_libiptc == 'true')
1121 have = libiptc.found()
1126 conf.set10('HAVE_LIBIPTC', have)
1128 want_qrencode = get_option('qrencode')
1129 if want_qrencode != 'false' and not skip_deps
1130 libqrencode = dependency('libqrencode',
1132 required : want_qrencode == 'true')
1133 have = libqrencode.found()
1138 conf.set10('HAVE_QRENCODE', have)
1140 want_gcrypt = get_option('gcrypt')
1141 if want_gcrypt != 'false' and not skip_deps
1142 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1143 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1144 have = libgcrypt.found() and libgpg_error.found()
1149 # link to neither of the libs if one is not found
1153 conf.set10('HAVE_GCRYPT', have)
1155 want_gnutls = get_option('gnutls')
1156 if want_gnutls != 'false' and not skip_deps
1157 libgnutls = dependency('gnutls',
1158 version : '>= 3.1.4',
1159 required : want_gnutls == 'true')
1160 have = libgnutls.found()
1165 conf.set10('HAVE_GNUTLS', have)
1167 want_openssl = get_option('openssl')
1168 if want_openssl != 'false' and not skip_deps
1169 libopenssl = dependency('openssl',
1170 version : '>= 1.1.0',
1171 required : want_openssl == 'true')
1172 have = libopenssl.found()
1177 conf.set10('HAVE_OPENSSL', have)
1179 want_p11kit = get_option('p11kit')
1180 if want_p11kit != 'false' and not skip_deps
1181 libp11kit = dependency('p11-kit-1',
1182 version : '>= 0.23.3',
1183 required : want_p11kit == 'true')
1184 have = libp11kit.found()
1189 conf.set10('HAVE_P11KIT', have)
1191 want_libfido2 = get_option('libfido2')
1192 if want_libfido2 != 'false' and not skip_deps
1193 libfido2 = dependency('libfido2',
1194 required : want_libfido2 == 'true')
1195 have = libfido2.found()
1200 conf.set10('HAVE_LIBFIDO2', have)
1202 want_tpm2 = get_option('tpm2')
1203 if want_tpm2 != 'false' and not skip_deps
1204 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1205 required : want_tpm2 == 'true')
1211 conf.set10('HAVE_TPM2', have)
1213 want_elfutils = get_option('elfutils')
1214 if want_elfutils != 'false' and not skip_deps
1215 libdw = dependency('libdw',
1216 required : want_elfutils == 'true')
1217 have = libdw.found()
1222 conf.set10('HAVE_ELFUTILS', have)
1224 want_zlib = get_option('zlib')
1225 if want_zlib != 'false' and not skip_deps
1226 libz = dependency('zlib',
1227 required : want_zlib == 'true')
1233 conf.set10('HAVE_ZLIB', have)
1235 want_bzip2 = get_option('bzip2')
1236 if want_bzip2 != 'false' and not skip_deps
1237 libbzip2 = cc.find_library('bz2',
1238 required : want_bzip2 == 'true')
1239 have = libbzip2.found()
1244 conf.set10('HAVE_BZIP2', have)
1246 want_xz = get_option('xz')
1247 if want_xz != 'false' and not skip_deps
1248 libxz = dependency('liblzma',
1249 required : want_xz == 'true')
1250 have_xz = libxz.found()
1255 conf.set10('HAVE_XZ', have_xz)
1257 want_lz4 = get_option('lz4')
1258 if want_lz4 != 'false' and not skip_deps
1259 liblz4 = dependency('liblz4',
1260 version : '>= 1.3.0',
1261 required : want_lz4 == 'true')
1262 have_lz4 = liblz4.found()
1267 conf.set10('HAVE_LZ4', have_lz4)
1269 want_zstd = get_option('zstd')
1270 if want_zstd != 'false' and not skip_deps
1271 libzstd = dependency('libzstd',
1272 required : want_zstd == 'true',
1273 version : '>= 1.4.0')
1274 have_zstd = libzstd.found()
1279 conf.set10('HAVE_ZSTD', have_zstd)
1281 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1283 want_xkbcommon = get_option('xkbcommon')
1284 if want_xkbcommon != 'false' and not skip_deps
1285 libxkbcommon = dependency('xkbcommon',
1286 version : '>= 0.3.0',
1287 required : want_xkbcommon == 'true')
1288 have = libxkbcommon.found()
1293 conf.set10('HAVE_XKBCOMMON', have)
1295 want_pcre2 = get_option('pcre2')
1296 if want_pcre2 != 'false'
1297 libpcre2 = dependency('libpcre2-8',
1298 required : want_pcre2 == 'true')
1299 have = libpcre2.found()
1304 conf.set10('HAVE_PCRE2', have)
1306 want_glib = get_option('glib')
1307 if want_glib != 'false' and not skip_deps
1308 libglib = dependency('glib-2.0',
1309 version : '>= 2.22.0',
1310 required : want_glib == 'true')
1311 libgobject = dependency('gobject-2.0',
1312 version : '>= 2.22.0',
1313 required : want_glib == 'true')
1314 libgio = dependency('gio-2.0',
1315 required : want_glib == 'true')
1316 have = libglib.found() and libgobject.found() and libgio.found()
1323 conf.set10('HAVE_GLIB', have)
1325 want_dbus = get_option('dbus')
1326 if want_dbus != 'false' and not skip_deps
1327 libdbus = dependency('dbus-1',
1328 version : '>= 1.3.2',
1329 required : want_dbus == 'true')
1330 have = libdbus.found()
1335 conf.set10('HAVE_DBUS', have)
1337 default_dnssec = get_option('default-dnssec')
1339 default_dnssec = 'no'
1341 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1342 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1343 default_dnssec = 'no'
1345 conf.set('DEFAULT_DNSSEC_MODE',
1346 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1347 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1349 dns_over_tls = get_option('dns-over-tls')
1350 if dns_over_tls != 'false'
1351 if dns_over_tls == 'openssl'
1354 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
1355 if dns_over_tls == 'gnutls' and not have_gnutls
1356 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1359 if dns_over_tls == 'gnutls' or have_gnutls
1360 have_openssl = false
1362 have_openssl = conf.get('HAVE_OPENSSL') == 1
1363 if dns_over_tls != 'auto' and not have_openssl
1364 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
1365 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1368 have = have_gnutls or have_openssl
1372 have_openssl = false
1374 conf.set10('ENABLE_DNS_OVER_TLS', have)
1375 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1376 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1378 default_dns_over_tls = get_option('default-dns-over-tls')
1380 default_dns_over_tls = 'no'
1382 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1383 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.')
1384 default_dns_over_tls = 'no'
1386 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1387 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1388 substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls)
1390 default_mdns = get_option('default-mdns')
1391 conf.set('DEFAULT_MDNS_MODE',
1392 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1393 substs.set('DEFAULT_MDNS_MODE', default_mdns)
1395 default_llmnr = get_option('default-llmnr')
1396 conf.set('DEFAULT_LLMNR_MODE',
1397 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1398 substs.set('DEFAULT_LLMNR_MODE', default_llmnr)
1400 want_repart = get_option('repart')
1401 if want_repart != 'false'
1402 have = (conf.get('HAVE_OPENSSL') == 1 and
1403 conf.get('HAVE_LIBFDISK') == 1)
1404 if want_repart == 'true' and not have
1405 error('repart support was requested, but dependencies are not available')
1410 conf.set10('ENABLE_REPART', have)
1412 want_importd = get_option('importd')
1413 if want_importd != 'false'
1414 have = (conf.get('HAVE_LIBCURL') == 1 and
1415 conf.get('HAVE_ZLIB') == 1 and
1416 conf.get('HAVE_XZ') == 1 and
1417 conf.get('HAVE_GCRYPT') == 1)
1418 if want_importd == 'true' and not have
1419 error('importd support was requested, but dependencies are not available')
1424 conf.set10('ENABLE_IMPORTD', have)
1426 want_homed = get_option('homed')
1427 if want_homed != 'false'
1428 have = (conf.get('HAVE_OPENSSL') == 1 and
1429 conf.get('HAVE_LIBFDISK') == 1 and
1430 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1431 if want_homed == 'true' and not have
1432 error('homed support was requested, but dependencies are not available')
1437 conf.set10('ENABLE_HOMED', have)
1439 have = have and conf.get('HAVE_PAM') == 1
1440 conf.set10('ENABLE_PAM_HOME', have)
1442 have = get_option('oomd')
1444 have = get_option('mode') == 'developer'
1446 have = have == 'true'
1447 if have and get_option('mode') != 'developer'
1448 warning('oomd is not ready for release mode (yet)')
1451 conf.set10('ENABLE_OOMD', have)
1452 substs.set10('ENABLE_OOMD', have)
1454 want_remote = get_option('remote')
1455 if want_remote != 'false'
1456 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1457 conf.get('HAVE_LIBCURL') == 1]
1458 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1459 # it's possible to build one without the other. Complain only if
1460 # support was explicitly requested. The auxiliary files like sysusers
1461 # config should be installed when any of the programs are built.
1462 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1463 error('remote support was requested, but dependencies are not available')
1465 have = have_deps[0] or have_deps[1]
1469 conf.set10('ENABLE_REMOTE', have)
1471 foreach term : ['analyze',
1485 'compat-mutable-uid-boundaries',
1510 have = get_option(term)
1511 name = 'ENABLE_' + term.underscorify().to_upper()
1512 conf.set10(name, have)
1513 substs.set10(name, have)
1516 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1518 foreach tuple : [['nss-mymachines', 'machined'],
1519 ['nss-resolve', 'resolve']]
1520 want = get_option(tuple[0])
1522 have = get_option(tuple[1])
1523 if want == 'true' and not have
1524 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1529 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1530 conf.set10(name, have)
1534 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1535 'ENABLE_NSS_MYMACHINES',
1536 'ENABLE_NSS_RESOLVE',
1537 'ENABLE_NSS_SYSTEMD']
1538 if conf.get(term) == 1
1542 conf.set10('ENABLE_NSS', enable_nss)
1544 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1549 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1551 #####################################################################
1553 if get_option('efi')
1554 efi_arch = host_machine.cpu_family()
1556 if efi_arch == 'x86'
1557 EFI_MACHINE_TYPE_NAME = 'ia32'
1558 gnu_efi_arch = 'ia32'
1559 elif efi_arch == 'x86_64'
1560 EFI_MACHINE_TYPE_NAME = 'x64'
1561 gnu_efi_arch = 'x86_64'
1562 elif efi_arch == 'arm'
1563 EFI_MACHINE_TYPE_NAME = 'arm'
1564 gnu_efi_arch = 'arm'
1565 elif efi_arch == 'aarch64'
1566 EFI_MACHINE_TYPE_NAME = 'aa64'
1567 gnu_efi_arch = 'aarch64'
1569 EFI_MACHINE_TYPE_NAME = ''
1574 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1576 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
1580 conf.set10('ENABLE_EFI', have)
1582 #####################################################################
1584 config_h = configure_file(
1585 output : 'config.h',
1586 configuration : conf)
1588 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1590 includes = include_directories('src/basic',
1595 'src/journal-remote',
1596 'src/libsystemd-network',
1597 'src/libsystemd/sd-bus',
1598 'src/libsystemd/sd-device',
1599 'src/libsystemd/sd-event',
1600 'src/libsystemd/sd-hwdb',
1601 'src/libsystemd/sd-id128',
1602 'src/libsystemd/sd-netlink',
1603 'src/libsystemd/sd-network',
1604 'src/libsystemd/sd-resolve',
1611 'src/time-wait-sync',
1614 'src/xdg-autostart-generator',
1617 add_project_arguments('-include', 'config.h', language : 'c')
1619 generate_gperfs = find_program('tools/generate-gperfs.py')
1623 subdir('src/libudev')
1624 subdir('src/systemd')
1626 subdir('src/libsystemd')
1627 subdir('src/libsystemd-network')
1628 subdir('src/journal')
1631 libjournal_core = static_library(
1633 libjournal_core_sources,
1635 include_directories : includes,
1638 libsystemd_sym_path = '@0@/@1@'.format(project_source_root, libsystemd_sym)
1639 libsystemd = shared_library(
1642 version : libsystemd_version,
1643 include_directories : includes,
1644 link_args : ['-shared',
1645 '-Wl,--version-script=' + libsystemd_sym_path],
1646 link_with : [libbasic,
1648 link_whole : [libsystemd_static,
1650 dependencies : [threads,
1655 link_depends : libsystemd_sym,
1657 install_dir : rootlibdir)
1659 static_libsystemd = get_option('static-libsystemd')
1660 static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
1662 install_libsystemd_static = static_library(
1665 journal_client_sources,
1667 basic_gcrypt_sources,
1669 include_directories : includes,
1670 build_by_default : static_libsystemd != 'false',
1671 install : static_libsystemd != 'false',
1672 install_dir : rootlibdir,
1673 pic : static_libsystemd == 'true' or static_libsystemd == 'pic',
1674 dependencies : [threads,
1684 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1686 ############################################################
1688 autosuspend_update_sh = find_program('tools/autosuspend-update.sh')
1689 hwdb_update_sh = find_program('tools/hwdb-update.sh')
1690 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1691 make_directive_index_py = find_program('tools/make-directive-index.py')
1692 make_man_index_py = find_program('tools/make-man-index.py')
1693 syscall_names_update_sh = find_program('tools/syscall-names-update.sh')
1694 xml_helper_py = find_program('tools/xml_helper.py')
1695 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1697 ############################################################
1699 # binaries that have --help and are intended for use by humans,
1700 # usually, but not always, installed in /bin.
1701 public_programs = []
1703 subdir('src/shared')
1705 subdir('src/shutdown')
1707 subdir('src/network')
1709 subdir('src/analyze')
1710 subdir('src/journal-remote')
1711 subdir('src/coredump')
1712 subdir('src/pstore')
1714 subdir('src/hostname')
1715 subdir('src/import')
1716 subdir('src/partition')
1717 subdir('src/kernel-install')
1718 subdir('src/locale')
1719 subdir('src/machine')
1720 subdir('src/portable')
1721 subdir('src/userdb')
1723 subdir('src/nspawn')
1724 subdir('src/resolve')
1725 subdir('src/timedate')
1726 subdir('src/timesync')
1727 subdir('src/tmpfiles')
1728 subdir('src/vconsole')
1729 subdir('src/boot/efi')
1736 ############################################################
1738 # only static linking apart from libdl, to make sure that the
1739 # module is linked to all libraries that it uses.
1740 test_dlopen = executable(
1744 include_directories : includes,
1745 link_with : [libbasic],
1746 dependencies : [libdl],
1747 build_by_default : want_tests != 'false')
1749 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
1750 ['systemd', 'ENABLE_NSS_SYSTEMD', 'src/nss-systemd/userdb-glue.c src/nss-systemd/userdb-glue.h src/nss-systemd/nss-systemd.h'],
1751 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
1752 ['resolve', 'ENABLE_NSS_RESOLVE']]
1754 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1758 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1759 version_script_arg = join_paths(project_source_root, sym)
1761 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
1762 if tuple.length() > 2
1763 sources += tuple[2].split()
1766 nss = shared_library(
1771 include_directories : includes,
1772 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1773 link_args : ['-Wl,-z,nodelete',
1775 '-Wl,--version-script=' + version_script_arg],
1776 link_with : [libsystemd_static,
1779 dependencies : [threads,
1783 install_dir : rootlibdir)
1785 # We cannot use shared_module because it does not support version suffix.
1786 # Unfortunately shared_library insists on creating the symlink…
1787 meson.add_install_script('sh', '-c',
1788 'rm $DESTDIR@0@/libnss_@1@.so'
1789 .format(rootlibdir, module))
1791 if want_tests != 'false'
1792 test('dlopen-nss_' + module,
1794 # path to dlopen must include a slash
1795 args : nss.full_path())
1800 ############################################################
1805 include_directories : includes,
1806 link_with : [libcore,
1808 dependencies : [versiondep,
1815 install_rpath : rootlibexecdir,
1817 install_dir : rootlibexecdir)
1819 meson.add_install_script(meson_make_symlink,
1820 join_paths(rootlibexecdir, 'systemd'),
1821 join_paths(rootsbindir, 'init'))
1823 public_programs += executable(
1825 systemd_analyze_sources,
1826 include_directories : includes,
1827 link_with : [libcore,
1829 dependencies : [versiondep,
1836 install_rpath : rootlibexecdir,
1837 install : conf.get('ENABLE_ANALYZE'))
1841 systemd_journald_sources,
1842 include_directories : includes,
1843 link_with : [libjournal_core,
1845 dependencies : [threads,
1850 install_rpath : rootlibexecdir,
1852 install_dir : rootlibexecdir)
1854 public_programs += executable(
1856 systemd_cat_sources,
1857 include_directories : includes,
1858 link_with : [libjournal_core,
1860 dependencies : [threads],
1861 install_rpath : rootlibexecdir,
1864 public_programs += executable(
1867 include_directories : includes,
1868 link_with : [libshared],
1869 dependencies : [threads,
1875 install_rpath : rootlibexecdir,
1877 install_dir : rootbindir)
1880 'systemd-getty-generator',
1881 'src/getty-generator/getty-generator.c',
1882 include_directories : includes,
1883 link_with : [libshared],
1884 install_rpath : rootlibexecdir,
1886 install_dir : systemgeneratordir)
1889 'systemd-debug-generator',
1890 'src/debug-generator/debug-generator.c',
1891 include_directories : includes,
1892 link_with : [libshared],
1893 install_rpath : rootlibexecdir,
1895 install_dir : systemgeneratordir)
1898 'systemd-run-generator',
1899 'src/run-generator/run-generator.c',
1900 include_directories : includes,
1901 link_with : [libshared],
1902 install_rpath : rootlibexecdir,
1904 install_dir : systemgeneratordir)
1907 'systemd-fstab-generator',
1908 'src/fstab-generator/fstab-generator.c',
1909 include_directories : includes,
1910 link_with : [libcore_shared,
1912 install_rpath : rootlibexecdir,
1914 install_dir : systemgeneratordir)
1916 if conf.get('ENABLE_ENVIRONMENT_D') == 1
1918 '30-systemd-environment-d-generator',
1919 'src/environment-d-generator/environment-d-generator.c',
1920 include_directories : includes,
1921 link_with : [libshared],
1922 install_rpath : rootlibexecdir,
1924 install_dir : userenvgeneratordir)
1926 meson.add_install_script(meson_make_symlink,
1927 join_paths(sysconfdir, 'environment'),
1928 join_paths(environmentdir, '99-environment.conf'))
1931 if conf.get('ENABLE_HIBERNATE') == 1
1933 'systemd-hibernate-resume-generator',
1934 'src/hibernate-resume/hibernate-resume-generator.c',
1935 include_directories : includes,
1936 link_with : [libshared],
1937 install_rpath : rootlibexecdir,
1939 install_dir : systemgeneratordir)
1942 'systemd-hibernate-resume',
1943 'src/hibernate-resume/hibernate-resume.c',
1944 include_directories : includes,
1945 link_with : [libshared],
1946 install_rpath : rootlibexecdir,
1948 install_dir : rootlibexecdir)
1951 if conf.get('HAVE_BLKID') == 1
1953 'systemd-gpt-auto-generator',
1954 'src/gpt-auto-generator/gpt-auto-generator.c',
1955 'src/shared/blkid-util.h',
1956 include_directories : includes,
1957 link_with : [libshared],
1958 dependencies : libblkid,
1959 install_rpath : rootlibexecdir,
1961 install_dir : systemgeneratordir)
1963 public_programs += executable(
1965 'src/dissect/dissect.c',
1966 include_directories : includes,
1967 link_with : [libshared],
1968 install_rpath : rootlibexecdir,
1972 if conf.get('ENABLE_RESOLVE') == 1
1975 systemd_resolved_sources,
1976 include_directories : includes,
1977 link_with : [libshared,
1979 libsystemd_resolve_core],
1980 dependencies : systemd_resolved_dependencies,
1981 install_rpath : rootlibexecdir,
1983 install_dir : rootlibexecdir)
1985 public_programs += executable(
1988 include_directories : includes,
1989 link_with : [libshared,
1991 libsystemd_resolve_core],
1992 dependencies : [threads,
1996 install_rpath : rootlibexecdir,
1999 meson.add_install_script(meson_make_symlink,
2000 join_paths(bindir, 'resolvectl'),
2001 join_paths(rootsbindir, 'resolvconf'))
2003 meson.add_install_script(meson_make_symlink,
2004 join_paths(bindir, 'resolvectl'),
2005 join_paths(bindir, 'systemd-resolve'))
2008 if conf.get('ENABLE_LOGIND') == 1
2011 systemd_logind_sources,
2012 include_directories : includes,
2013 link_with : [liblogind_core,
2015 dependencies : [threads,
2017 install_rpath : rootlibexecdir,
2019 install_dir : rootlibexecdir)
2021 public_programs += executable(
2024 include_directories : includes,
2025 link_with : [libshared],
2026 dependencies : [threads,
2030 install_rpath : rootlibexecdir,
2032 install_dir : rootbindir)
2034 public_programs += executable(
2036 'src/login/inhibit.c',
2037 include_directories : includes,
2038 link_with : [libshared],
2039 install_rpath : rootlibexecdir,
2041 install_dir : rootbindir)
2043 if conf.get('HAVE_PAM') == 1
2044 version_script_arg = join_paths(project_source_root, pam_systemd_sym)
2045 pam_systemd = shared_library(
2049 include_directories : includes,
2050 link_args : ['-shared',
2051 '-Wl,--version-script=' + version_script_arg],
2052 link_with : [libsystemd_static,
2054 dependencies : [threads,
2057 link_depends : pam_systemd_sym,
2059 install_dir : pamlibdir)
2061 if want_tests != 'false'
2062 test('dlopen-pam_systemd',
2064 # path to dlopen must include a slash
2065 args : pam_systemd.full_path())
2070 'systemd-user-runtime-dir',
2071 user_runtime_dir_sources,
2072 include_directories : includes,
2073 link_with : [libshared],
2074 install_rpath : rootlibexecdir,
2076 install_dir : rootlibexecdir)
2079 if conf.get('HAVE_PAM') == 1
2081 'systemd-user-sessions',
2082 'src/user-sessions/user-sessions.c',
2083 include_directories : includes,
2084 link_with : [libshared],
2085 install_rpath : rootlibexecdir,
2087 install_dir : rootlibexecdir)
2090 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
2091 public_programs += executable(
2093 'src/boot/bootctl.c',
2094 include_directories : includes,
2095 link_with : [libshared],
2096 dependencies : [libblkid],
2097 install_rpath : rootlibexecdir,
2100 public_programs += executable(
2101 'systemd-bless-boot',
2102 'src/boot/bless-boot.c',
2103 include_directories : includes,
2104 link_with : [libshared],
2105 dependencies : [libblkid],
2106 install_rpath : rootlibexecdir,
2108 install_dir : rootlibexecdir)
2111 'systemd-bless-boot-generator',
2112 'src/boot/bless-boot-generator.c',
2113 include_directories : includes,
2114 link_with : [libshared],
2115 install_rpath : rootlibexecdir,
2117 install_dir : systemgeneratordir)
2121 'systemd-boot-check-no-failures',
2122 'src/boot/boot-check-no-failures.c',
2123 include_directories : includes,
2124 link_with : [libshared],
2125 dependencies : [libblkid],
2126 install_rpath : rootlibexecdir,
2128 install_dir : rootlibexecdir)
2130 public_programs += executable(
2131 'systemd-socket-activate',
2132 'src/activate/activate.c',
2133 include_directories : includes,
2134 link_with : [libshared],
2135 dependencies : [threads],
2136 install_rpath : rootlibexecdir,
2139 if get_option('link-systemctl-shared')
2140 systemctl_link_with = [libshared]
2142 systemctl_link_with = [libsystemd_static,
2148 public_programs += executable(
2150 'src/systemctl/systemctl-add-dependency.c',
2151 'src/systemctl/systemctl-add-dependency.h',
2152 'src/systemctl/systemctl-cancel-job.c',
2153 'src/systemctl/systemctl-cancel-job.h',
2154 'src/systemctl/systemctl-clean-or-freeze.c',
2155 'src/systemctl/systemctl-clean-or-freeze.h',
2156 'src/systemctl/systemctl-compat-halt.c',
2157 'src/systemctl/systemctl-compat-halt.h',
2158 'src/systemctl/systemctl-compat-runlevel.c',
2159 'src/systemctl/systemctl-compat-runlevel.h',
2160 'src/systemctl/systemctl-compat-shutdown.c',
2161 'src/systemctl/systemctl-compat-shutdown.h',
2162 'src/systemctl/systemctl-compat-telinit.c',
2163 'src/systemctl/systemctl-compat-telinit.h',
2164 'src/systemctl/systemctl-daemon-reload.c',
2165 'src/systemctl/systemctl-daemon-reload.h',
2166 'src/systemctl/systemctl-edit.c',
2167 'src/systemctl/systemctl-edit.h',
2168 'src/systemctl/systemctl-enable.c',
2169 'src/systemctl/systemctl-enable.h',
2170 'src/systemctl/systemctl-is-active.c',
2171 'src/systemctl/systemctl-is-active.h',
2172 'src/systemctl/systemctl-is-enabled.c',
2173 'src/systemctl/systemctl-is-enabled.h',
2174 'src/systemctl/systemctl-is-system-running.c',
2175 'src/systemctl/systemctl-is-system-running.h',
2176 'src/systemctl/systemctl-kill.c',
2177 'src/systemctl/systemctl-kill.h',
2178 'src/systemctl/systemctl-list-dependencies.c',
2179 'src/systemctl/systemctl-list-dependencies.h',
2180 'src/systemctl/systemctl-list-jobs.c',
2181 'src/systemctl/systemctl-list-jobs.h',
2182 'src/systemctl/systemctl-list-machines.c',
2183 'src/systemctl/systemctl-list-machines.h',
2184 'src/systemctl/systemctl-list-unit-files.c',
2185 'src/systemctl/systemctl-list-unit-files.h',
2186 'src/systemctl/systemctl-list-units.c',
2187 'src/systemctl/systemctl-list-units.h',
2188 'src/systemctl/systemctl-log-setting.c',
2189 'src/systemctl/systemctl-log-setting.h',
2190 'src/systemctl/systemctl-logind.c',
2191 'src/systemctl/systemctl-logind.h',
2192 'src/systemctl/systemctl-preset-all.c',
2193 'src/systemctl/systemctl-preset-all.h',
2194 'src/systemctl/systemctl-reset-failed.c',
2195 'src/systemctl/systemctl-reset-failed.h',
2196 'src/systemctl/systemctl-service-watchdogs.c',
2197 'src/systemctl/systemctl-service-watchdogs.h',
2198 'src/systemctl/systemctl-set-default.c',
2199 'src/systemctl/systemctl-set-default.h',
2200 'src/systemctl/systemctl-set-environment.c',
2201 'src/systemctl/systemctl-set-environment.h',
2202 'src/systemctl/systemctl-set-property.c',
2203 'src/systemctl/systemctl-set-property.h',
2204 'src/systemctl/systemctl-show.c',
2205 'src/systemctl/systemctl-show.h',
2206 'src/systemctl/systemctl-start-special.c',
2207 'src/systemctl/systemctl-start-special.h',
2208 'src/systemctl/systemctl-start-unit.c',
2209 'src/systemctl/systemctl-start-unit.h',
2210 'src/systemctl/systemctl-switch-root.c',
2211 'src/systemctl/systemctl-switch-root.h',
2212 'src/systemctl/systemctl-sysv-compat.c',
2213 'src/systemctl/systemctl-sysv-compat.h',
2214 'src/systemctl/systemctl-trivial-method.c',
2215 'src/systemctl/systemctl-trivial-method.h',
2216 'src/systemctl/systemctl-util.c',
2217 'src/systemctl/systemctl-util.c',
2218 'src/systemctl/systemctl-util.h',
2219 'src/systemctl/systemctl.c',
2220 'src/systemctl/systemctl.h',
2221 include_directories : includes,
2222 link_with : systemctl_link_with,
2223 dependencies : [threads,
2229 install_rpath : rootlibexecdir,
2231 install_dir : rootbindir)
2233 if conf.get('ENABLE_PORTABLED') == 1
2235 'systemd-portabled',
2236 systemd_portabled_sources,
2237 include_directories : includes,
2238 link_with : [libshared],
2239 dependencies : [threads],
2240 install_rpath : rootlibexecdir,
2242 install_dir : rootlibexecdir)
2244 public_programs += executable(
2246 'src/portable/portablectl.c',
2247 include_directories : includes,
2248 link_with : [libshared],
2249 dependencies : [threads],
2250 install_rpath : rootlibexecdir,
2252 install_dir : rootbindir)
2255 if conf.get('ENABLE_USERDB') == 1
2258 systemd_userwork_sources,
2259 include_directories : includes,
2260 link_with : [libshared],
2261 dependencies : [threads],
2262 install_rpath : rootlibexecdir,
2264 install_dir : rootlibexecdir)
2268 systemd_userdbd_sources,
2269 include_directories : includes,
2270 link_with : [libshared],
2271 dependencies : [threads],
2272 install_rpath : rootlibexecdir,
2274 install_dir : rootlibexecdir)
2276 public_programs += executable(
2279 include_directories : includes,
2280 link_with : [libshared],
2281 dependencies : [threads],
2282 install_rpath : rootlibexecdir,
2284 install_dir : rootbindir)
2287 if conf.get('ENABLE_HOMED') == 1
2290 systemd_homework_sources,
2291 include_directories : includes,
2292 link_with : [libshared],
2293 dependencies : [threads,
2300 install_rpath : rootlibexecdir,
2302 install_dir : rootlibexecdir)
2306 systemd_homed_sources,
2307 include_directories : includes,
2308 link_with : [libshared],
2309 dependencies : [threads,
2312 install_rpath : rootlibexecdir,
2314 install_dir : rootlibexecdir)
2316 public_programs += executable(
2319 include_directories : includes,
2320 link_with : [libshared],
2321 dependencies : [threads,
2326 install_rpath : rootlibexecdir,
2328 install_dir : rootbindir)
2330 if conf.get('HAVE_PAM') == 1
2331 version_script_arg = join_paths(project_source_root, pam_systemd_home_sym)
2332 pam_systemd = shared_library(
2336 include_directories : includes,
2337 link_args : ['-shared',
2338 '-Wl,--version-script=' + version_script_arg],
2339 link_with : [libsystemd_static,
2341 dependencies : [threads,
2345 link_depends : pam_systemd_home_sym,
2347 install_dir : pamlibdir)
2351 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2352 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2353 meson.add_install_script(meson_make_symlink,
2354 join_paths(rootbindir, 'systemctl'),
2355 join_paths(rootsbindir, alias))
2358 meson.add_install_script(meson_make_symlink,
2359 join_paths(rootbindir, 'udevadm'),
2360 join_paths(rootlibexecdir, 'systemd-udevd'))
2362 if conf.get('ENABLE_BACKLIGHT') == 1
2364 'systemd-backlight',
2365 'src/backlight/backlight.c',
2366 include_directories : includes,
2367 link_with : [libshared],
2368 install_rpath : rootlibexecdir,
2370 install_dir : rootlibexecdir)
2373 if conf.get('ENABLE_RFKILL') == 1
2376 'src/rfkill/rfkill.c',
2377 include_directories : includes,
2378 link_with : [libshared],
2379 install_rpath : rootlibexecdir,
2381 install_dir : rootlibexecdir)
2385 'systemd-system-update-generator',
2386 'src/system-update-generator/system-update-generator.c',
2387 include_directories : includes,
2388 link_with : [libshared],
2389 install_rpath : rootlibexecdir,
2391 install_dir : systemgeneratordir)
2393 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2394 systemd_cryptsetup_sources = files('''
2395 src/cryptsetup/cryptsetup-fido2.h
2396 src/cryptsetup/cryptsetup-keyfile.c
2397 src/cryptsetup/cryptsetup-keyfile.h
2398 src/cryptsetup/cryptsetup-pkcs11.h
2399 src/cryptsetup/cryptsetup-tpm2.h
2400 src/cryptsetup/cryptsetup.c
2403 if conf.get('HAVE_P11KIT') == 1
2404 systemd_cryptsetup_sources += files('src/cryptsetup/cryptsetup-pkcs11.c')
2407 if conf.get('HAVE_LIBFIDO2') == 1
2408 systemd_cryptsetup_sources += files('src/cryptsetup/cryptsetup-fido2.c')
2411 if conf.get('HAVE_TPM2') == 1
2412 systemd_cryptsetup_sources += files('src/cryptsetup/cryptsetup-tpm2.c')
2416 'systemd-cryptsetup',
2417 systemd_cryptsetup_sources,
2418 include_directories : includes,
2419 link_with : [libshared],
2420 dependencies : [libcryptsetup,
2422 install_rpath : rootlibexecdir,
2424 install_dir : rootlibexecdir)
2427 'systemd-cryptsetup-generator',
2428 'src/cryptsetup/cryptsetup-generator.c',
2429 include_directories : includes,
2430 link_with : [libshared],
2431 install_rpath : rootlibexecdir,
2433 install_dir : systemgeneratordir)
2436 'systemd-veritysetup',
2437 'src/veritysetup/veritysetup.c',
2438 include_directories : includes,
2439 link_with : [libshared],
2440 dependencies : [libcryptsetup],
2441 install_rpath : rootlibexecdir,
2443 install_dir : rootlibexecdir)
2446 'systemd-veritysetup-generator',
2447 'src/veritysetup/veritysetup-generator.c',
2448 include_directories : includes,
2449 link_with : [libshared],
2450 install_rpath : rootlibexecdir,
2452 install_dir : systemgeneratordir)
2454 systemd_cryptenroll_sources = files('''
2455 src/cryptenroll/cryptenroll-fido2.h
2456 src/cryptenroll/cryptenroll-list.c
2457 src/cryptenroll/cryptenroll-list.h
2458 src/cryptenroll/cryptenroll-password.c
2459 src/cryptenroll/cryptenroll-password.h
2460 src/cryptenroll/cryptenroll-pkcs11.h
2461 src/cryptenroll/cryptenroll-recovery.c
2462 src/cryptenroll/cryptenroll-recovery.h
2463 src/cryptenroll/cryptenroll-tpm2.h
2464 src/cryptenroll/cryptenroll-wipe.c
2465 src/cryptenroll/cryptenroll-wipe.h
2466 src/cryptenroll/cryptenroll.c
2467 src/cryptenroll/cryptenroll.h
2470 if conf.get('HAVE_P11KIT') == 1 and conf.get('HAVE_OPENSSL') == 1
2471 systemd_cryptenroll_sources += files('src/cryptenroll/cryptenroll-pkcs11.c')
2474 if conf.get('HAVE_LIBFIDO2') == 1
2475 systemd_cryptenroll_sources += files('src/cryptenroll/cryptenroll-fido2.c')
2478 if conf.get('HAVE_TPM2') == 1
2479 systemd_cryptenroll_sources += files('src/cryptenroll/cryptenroll-tpm2.c')
2483 'systemd-cryptenroll',
2484 systemd_cryptenroll_sources,
2485 include_directories : includes,
2486 link_with : [libshared],
2487 dependencies : [libcryptsetup,
2491 install_rpath : rootlibexecdir,
2493 install_dir : bindir)
2496 if conf.get('HAVE_SYSV_COMPAT') == 1
2498 'systemd-sysv-generator',
2499 'src/sysv-generator/sysv-generator.c',
2500 include_directories : includes,
2501 link_with : [libshared],
2502 install_rpath : rootlibexecdir,
2504 install_dir : systemgeneratordir)
2507 'systemd-rc-local-generator',
2508 'src/rc-local-generator/rc-local-generator.c',
2509 include_directories : includes,
2510 link_with : [libshared],
2511 install_rpath : rootlibexecdir,
2513 install_dir : systemgeneratordir)
2516 if conf.get('ENABLE_XDG_AUTOSTART') == 1
2518 'systemd-xdg-autostart-generator',
2519 'src/xdg-autostart-generator/xdg-autostart-generator.c',
2520 'src/xdg-autostart-generator/xdg-autostart-service.c',
2521 include_directories : includes,
2522 link_with : [libshared],
2523 install_rpath : rootlibexecdir,
2525 install_dir : usergeneratordir)
2528 'systemd-xdg-autostart-condition',
2529 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2530 include_directories : includes,
2531 link_with : [libshared],
2532 install_rpath : rootlibexecdir,
2534 install_dir : rootlibexecdir)
2537 if conf.get('ENABLE_HOSTNAMED') == 1
2539 'systemd-hostnamed',
2540 'src/hostname/hostnamed.c',
2541 include_directories : includes,
2542 link_with : [libshared],
2543 install_rpath : rootlibexecdir,
2545 install_dir : rootlibexecdir)
2547 public_programs += executable(
2549 'src/hostname/hostnamectl.c',
2550 include_directories : includes,
2551 link_with : [libshared],
2552 install_rpath : rootlibexecdir,
2556 if conf.get('ENABLE_LOCALED') == 1
2557 if conf.get('HAVE_XKBCOMMON') == 1
2558 # logind will load libxkbcommon.so dynamically on its own
2566 systemd_localed_sources,
2567 include_directories : includes,
2568 link_with : [libshared],
2569 dependencies : deps,
2570 install_rpath : rootlibexecdir,
2572 install_dir : rootlibexecdir)
2574 public_programs += executable(
2577 include_directories : includes,
2578 link_with : [libshared],
2579 install_rpath : rootlibexecdir,
2583 if conf.get('ENABLE_TIMEDATED') == 1
2585 'systemd-timedated',
2586 'src/timedate/timedated.c',
2587 include_directories : includes,
2588 link_with : [libshared],
2589 install_rpath : rootlibexecdir,
2591 install_dir : rootlibexecdir)
2594 if conf.get('ENABLE_TIMEDATECTL') == 1
2595 public_programs += executable(
2597 'src/timedate/timedatectl.c',
2598 include_directories : includes,
2599 install_rpath : rootlibexecdir,
2600 link_with : [libshared],
2601 dependencies : [libm],
2605 if conf.get('ENABLE_TIMESYNCD') == 1
2606 if get_option('link-timesyncd-shared')
2607 timesyncd_link_with = [libshared]
2609 timesyncd_link_with = [libsystemd_static,
2616 'systemd-timesyncd',
2617 systemd_timesyncd_sources,
2618 include_directories : includes,
2619 link_with : [timesyncd_link_with],
2620 dependencies : [threads,
2622 install_rpath : rootlibexecdir,
2624 install_dir : rootlibexecdir)
2627 'systemd-time-wait-sync',
2628 'src/time-wait-sync/time-wait-sync.c',
2629 include_directories : includes,
2630 link_with : [timesyncd_link_with],
2631 install_rpath : rootlibexecdir,
2633 install_dir : rootlibexecdir)
2636 if conf.get('ENABLE_MACHINED') == 1
2639 systemd_machined_sources,
2640 include_directories : includes,
2641 link_with : [libmachine_core,
2643 install_rpath : rootlibexecdir,
2645 install_dir : rootlibexecdir)
2647 public_programs += executable(
2649 'src/machine/machinectl.c',
2650 include_directories : includes,
2651 link_with : [libshared],
2652 dependencies : [threads,
2656 install_rpath : rootlibexecdir,
2658 install_dir : rootbindir)
2661 if conf.get('ENABLE_IMPORTD') == 1
2664 systemd_importd_sources,
2665 include_directories : includes,
2666 link_with : [libshared],
2667 dependencies : [threads],
2668 install_rpath : rootlibexecdir,
2670 install_dir : rootlibexecdir)
2672 systemd_pull = executable(
2674 systemd_pull_sources,
2675 include_directories : includes,
2676 link_with : [libshared],
2677 dependencies : [versiondep,
2683 install_rpath : rootlibexecdir,
2685 install_dir : rootlibexecdir)
2687 systemd_import = executable(
2689 systemd_import_sources,
2690 include_directories : includes,
2691 link_with : [libshared],
2692 dependencies : [libcurl,
2696 install_rpath : rootlibexecdir,
2698 install_dir : rootlibexecdir)
2700 systemd_import_fs = executable(
2701 'systemd-import-fs',
2702 systemd_import_fs_sources,
2703 include_directories : includes,
2704 link_with : [libshared],
2705 install_rpath : rootlibexecdir,
2707 install_dir : rootlibexecdir)
2709 systemd_export = executable(
2711 systemd_export_sources,
2712 include_directories : includes,
2713 link_with : [libshared],
2714 dependencies : [libcurl,
2718 install_rpath : rootlibexecdir,
2720 install_dir : rootlibexecdir)
2722 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2725 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2726 public_programs += executable(
2727 'systemd-journal-upload',
2728 systemd_journal_upload_sources,
2729 include_directories : includes,
2730 link_with : [libshared],
2731 dependencies : [versiondep,
2738 install_rpath : rootlibexecdir,
2740 install_dir : rootlibexecdir)
2743 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2744 public_programs += executable(
2745 'systemd-journal-remote',
2746 systemd_journal_remote_sources,
2747 include_directories : includes,
2748 link_with : [libshared,
2749 libsystemd_journal_remote],
2750 dependencies : [threads,
2756 install_rpath : rootlibexecdir,
2758 install_dir : rootlibexecdir)
2760 public_programs += executable(
2761 'systemd-journal-gatewayd',
2762 systemd_journal_gatewayd_sources,
2763 include_directories : includes,
2764 link_with : [libshared],
2765 dependencies : [threads,
2771 install_rpath : rootlibexecdir,
2773 install_dir : rootlibexecdir)
2776 if conf.get('ENABLE_COREDUMP') == 1
2779 systemd_coredump_sources,
2780 include_directories : includes,
2781 link_with : [libshared],
2782 dependencies : [threads,
2788 install_rpath : rootlibexecdir,
2790 install_dir : rootlibexecdir)
2792 public_programs += executable(
2794 coredumpctl_sources,
2795 include_directories : includes,
2796 link_with : [libshared],
2797 dependencies : [threads,
2801 install_rpath : rootlibexecdir,
2805 if conf.get('ENABLE_PSTORE') == 1
2808 systemd_pstore_sources,
2809 include_directories : includes,
2810 link_with : [libshared],
2811 dependencies : [threads,
2817 install_rpath : rootlibexecdir,
2819 install_dir : rootlibexecdir)
2822 if conf.get('ENABLE_OOMD') == 1
2823 executable('systemd-oomd',
2824 systemd_oomd_sources,
2825 include_directories : includes,
2826 link_with : [libshared],
2828 install_rpath : rootlibexecdir,
2830 install_dir : rootlibexecdir)
2832 public_programs += executable(
2835 include_directories : includes,
2836 link_with : [libshared],
2838 install_rpath : rootlibexecdir,
2840 install_dir : rootbindir)
2843 if conf.get('ENABLE_BINFMT') == 1
2844 public_programs += executable(
2846 'src/binfmt/binfmt.c',
2847 include_directories : includes,
2848 link_with : [libshared],
2849 install_rpath : rootlibexecdir,
2851 install_dir : rootlibexecdir)
2853 meson.add_install_script('sh', '-c',
2854 mkdir_p.format(binfmtdir))
2855 if install_sysconfdir
2856 meson.add_install_script('sh', '-c',
2857 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2861 if conf.get('ENABLE_REPART') == 1
2864 systemd_repart_sources,
2865 include_directories : includes,
2866 link_with : [libshared],
2867 dependencies : [threads,
2871 install_rpath : rootlibexecdir,
2873 install_dir : rootbindir)
2874 public_programs += exe
2876 if want_tests != 'false'
2879 args : exe.full_path())
2883 if conf.get('ENABLE_VCONSOLE') == 1
2885 'systemd-vconsole-setup',
2886 'src/vconsole/vconsole-setup.c',
2887 include_directories : includes,
2888 link_with : [libshared],
2889 install_rpath : rootlibexecdir,
2891 install_dir : rootlibexecdir)
2894 if conf.get('ENABLE_RANDOMSEED') == 1
2896 'systemd-random-seed',
2897 'src/random-seed/random-seed.c',
2898 include_directories : includes,
2899 link_with : [libshared],
2900 install_rpath : rootlibexecdir,
2902 install_dir : rootlibexecdir)
2905 if conf.get('ENABLE_FIRSTBOOT') == 1
2907 'systemd-firstboot',
2908 'src/firstboot/firstboot.c',
2909 include_directories : includes,
2910 link_with : [libshared],
2911 dependencies : [libcrypt],
2912 install_rpath : rootlibexecdir,
2914 install_dir : rootbindir)
2918 'systemd-remount-fs',
2919 'src/remount-fs/remount-fs.c',
2920 include_directories : includes,
2921 link_with : [libcore_shared,
2923 install_rpath : rootlibexecdir,
2925 install_dir : rootlibexecdir)
2928 'systemd-machine-id-setup',
2929 'src/machine-id-setup/machine-id-setup-main.c',
2930 include_directories : includes,
2931 link_with : [libcore_shared,
2933 install_rpath : rootlibexecdir,
2935 install_dir : rootbindir)
2940 include_directories : includes,
2941 link_with : [libshared],
2942 install_rpath : rootlibexecdir,
2944 install_dir : rootlibexecdir)
2946 executable('systemd-growfs',
2947 'src/partition/growfs.c',
2948 include_directories : includes,
2949 link_with : [libshared],
2950 install_rpath : rootlibexecdir,
2952 install_dir : rootlibexecdir)
2956 'src/partition/makefs.c',
2957 include_directories : includes,
2958 link_with : [libshared],
2959 install_rpath : rootlibexecdir,
2961 install_dir : rootlibexecdir)
2965 'src/sleep/sleep.c',
2966 include_directories : includes,
2967 link_with : [libshared],
2968 install_rpath : rootlibexecdir,
2970 install_dir : rootlibexecdir)
2972 if install_sysconfdir_samples
2973 install_data('src/sleep/sleep.conf',
2974 install_dir : pkgsysconfdir)
2977 public_programs += executable(
2979 'src/sysctl/sysctl.c',
2980 include_directories : includes,
2981 link_with : [libshared],
2982 install_rpath : rootlibexecdir,
2984 install_dir : rootlibexecdir)
2988 'src/ac-power/ac-power.c',
2989 include_directories : includes,
2990 link_with : [libshared],
2991 install_rpath : rootlibexecdir,
2993 install_dir : rootlibexecdir)
2995 public_programs += executable(
2996 'systemd-detect-virt',
2997 'src/detect-virt/detect-virt.c',
2998 include_directories : includes,
2999 link_with : [libshared],
3000 install_rpath : rootlibexecdir,
3003 public_programs += executable(
3005 'src/delta/delta.c',
3006 include_directories : includes,
3007 link_with : [libshared],
3008 install_rpath : rootlibexecdir,
3011 public_programs += executable(
3013 'src/escape/escape.c',
3014 include_directories : includes,
3015 link_with : [libshared],
3016 install_rpath : rootlibexecdir,
3018 install_dir : rootbindir)
3020 public_programs += executable(
3022 'src/notify/notify.c',
3023 include_directories : includes,
3024 link_with : [libshared],
3025 install_rpath : rootlibexecdir,
3027 install_dir : rootbindir)
3030 'systemd-volatile-root',
3031 'src/volatile-root/volatile-root.c',
3032 include_directories : includes,
3033 link_with : [libshared],
3034 install_rpath : rootlibexecdir,
3035 install : conf.get('ENABLE_INITRD') == 1,
3036 install_dir : rootlibexecdir)
3039 'systemd-cgroups-agent',
3040 'src/cgroups-agent/cgroups-agent.c',
3041 include_directories : includes,
3042 link_with : [libshared],
3043 install_rpath : rootlibexecdir,
3045 install_dir : rootlibexecdir)
3047 public_programs += executable(
3049 'src/id128/id128.c',
3050 include_directories : includes,
3051 link_with : [libshared],
3052 install_rpath : rootlibexecdir,
3055 public_programs += executable(
3058 include_directories : includes,
3059 link_with : [libshared],
3060 install_rpath : rootlibexecdir,
3063 public_programs += executable(
3064 'systemd-ask-password',
3065 'src/ask-password/ask-password.c',
3066 include_directories : includes,
3067 link_with : [libshared],
3068 install_rpath : rootlibexecdir,
3070 install_dir : rootbindir)
3073 'systemd-reply-password',
3074 'src/reply-password/reply-password.c',
3075 include_directories : includes,
3076 link_with : [libshared],
3077 install_rpath : rootlibexecdir,
3079 install_dir : rootlibexecdir)
3081 public_programs += executable(
3082 'systemd-tty-ask-password-agent',
3083 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3084 include_directories : includes,
3085 link_with : [libshared],
3086 install_rpath : rootlibexecdir,
3088 install_dir : rootbindir)
3090 public_programs += executable(
3093 include_directories : includes,
3094 link_with : [libshared],
3095 install_rpath : rootlibexecdir,
3098 public_programs += executable(
3100 'src/cgtop/cgtop.c',
3101 include_directories : includes,
3102 link_with : [libshared],
3103 install_rpath : rootlibexecdir,
3108 'src/initctl/initctl.c',
3109 include_directories : includes,
3110 link_with : [libshared],
3111 install_rpath : rootlibexecdir,
3112 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3113 install_dir : rootlibexecdir)
3115 public_programs += executable(
3117 'src/mount/mount-tool.c',
3118 include_directories : includes,
3119 link_with : [libshared],
3120 dependencies: [libmount],
3121 install_rpath : rootlibexecdir,
3124 meson.add_install_script(meson_make_symlink,
3125 'systemd-mount', join_paths(bindir, 'systemd-umount'))
3127 public_programs += executable(
3130 include_directories : includes,
3131 link_with : [libshared],
3132 install_rpath : rootlibexecdir,
3135 public_programs += executable(
3136 'systemd-stdio-bridge',
3137 'src/stdio-bridge/stdio-bridge.c',
3138 include_directories : includes,
3139 link_with : [libshared],
3140 dependencies : [versiondep],
3141 install_rpath : rootlibexecdir,
3144 public_programs += executable(
3146 'src/busctl/busctl.c',
3147 'src/busctl/busctl-introspect.c',
3148 'src/busctl/busctl-introspect.h',
3149 include_directories : includes,
3150 link_with : [libshared],
3151 install_rpath : rootlibexecdir,
3157 'src/sysusers/sysusers.c',
3158 include_directories : includes,
3159 link_with : [libshared],
3160 install_rpath : rootlibexecdir,
3162 install_dir : rootbindir)
3163 public_programs += exe
3165 if want_tests != 'false'
3166 test('test-sysusers',
3168 # https://github.com/mesonbuild/meson/issues/2681
3169 args : exe.full_path())
3172 if have_standalone_binaries
3174 'systemd-sysusers.standalone',
3175 'src/sysusers/sysusers.c',
3176 include_directories : includes,
3177 c_args : '-DSTANDALONE',
3178 link_with : [libshared_static,
3184 install_dir : rootbindir)
3185 public_programs += exe
3187 if want_tests != 'false'
3188 test('test-sysusers.standalone',
3190 # https://github.com/mesonbuild/meson/issues/2681
3191 args : exe.full_path())
3196 if conf.get('ENABLE_TMPFILES') == 1
3199 systemd_tmpfiles_sources,
3200 include_directories : includes,
3201 link_with : [libshared],
3202 dependencies : [libacl],
3203 install_rpath : rootlibexecdir,
3205 install_dir : rootbindir)
3206 public_programs += exe
3208 if want_tests != 'false'
3209 test('test-systemd-tmpfiles',
3210 test_systemd_tmpfiles_py,
3211 # https://github.com/mesonbuild/meson/issues/2681
3212 args : exe.full_path())
3215 if have_standalone_binaries
3216 public_programs += executable(
3217 'systemd-tmpfiles.standalone',
3218 systemd_tmpfiles_sources,
3219 include_directories : includes,
3220 c_args : '-DSTANDALONE',
3221 link_with : [libshared_static,
3226 dependencies : [libacl],
3228 install_dir : rootbindir)
3232 if conf.get('ENABLE_HWDB') == 1
3233 public_programs += executable(
3236 'src/libsystemd/sd-hwdb/hwdb-internal.h',
3237 include_directories : includes,
3238 link_with : udev_link_with,
3239 install_rpath : udev_rpath,
3241 install_dir : rootbindir)
3244 if conf.get('ENABLE_QUOTACHECK') == 1
3246 'systemd-quotacheck',
3247 'src/quotacheck/quotacheck.c',
3248 include_directories : includes,
3249 link_with : [libshared],
3250 install_rpath : rootlibexecdir,
3252 install_dir : rootlibexecdir)
3255 public_programs += executable(
3256 'systemd-socket-proxyd',
3257 'src/socket-proxy/socket-proxyd.c',
3258 include_directories : includes,
3259 link_with : [libshared],
3260 dependencies : [threads],
3261 install_rpath : rootlibexecdir,
3263 install_dir : rootlibexecdir)
3265 public_programs += executable(
3268 c_args : '-DLOG_REALM=LOG_REALM_UDEV',
3269 include_directories : includes,
3270 link_with : [libudevd_core],
3271 dependencies : [versiondep,
3277 install_rpath : udev_rpath,
3279 install_dir : rootbindir)
3283 systemd_shutdown_sources,
3284 include_directories : includes,
3285 link_with : [libcore_shared,
3287 dependencies : [libmount],
3288 install_rpath : rootlibexecdir,
3290 install_dir : rootlibexecdir)
3293 'systemd-update-done',
3294 'src/update-done/update-done.c',
3295 include_directories : includes,
3296 link_with : [libshared],
3297 install_rpath : rootlibexecdir,
3299 install_dir : rootlibexecdir)
3302 'systemd-update-utmp',
3303 'src/update-utmp/update-utmp.c',
3304 include_directories : includes,
3305 link_with : [libshared],
3306 dependencies : [libaudit],
3307 install_rpath : rootlibexecdir,
3308 install : (conf.get('ENABLE_UTMP') == 1),
3309 install_dir : rootlibexecdir)
3311 if conf.get('HAVE_KMOD') == 1
3313 'systemd-modules-load',
3314 'src/modules-load/modules-load.c',
3315 include_directories : includes,
3316 link_with : [libshared],
3317 dependencies : [libkmod],
3318 install_rpath : rootlibexecdir,
3320 install_dir : rootlibexecdir)
3322 meson.add_install_script('sh', '-c',
3323 mkdir_p.format(modulesloaddir))
3324 if install_sysconfdir
3325 meson.add_install_script('sh', '-c',
3326 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
3330 public_programs += executable(
3332 systemd_nspawn_sources,
3333 include_directories : includes,
3334 link_with : [libcore_shared,
3337 dependencies : [libblkid,
3339 install_rpath : rootlibexecdir,
3342 if conf.get('ENABLE_NETWORKD') == 1
3345 systemd_networkd_sources,
3346 include_directories : network_include_dir,
3347 link_with : [libnetworkd_core,
3349 networkd_link_with],
3350 dependencies : [threads],
3351 install_rpath : rootlibexecdir,
3353 install_dir : rootlibexecdir)
3356 'systemd-networkd-wait-online',
3357 systemd_networkd_wait_online_sources,
3358 include_directories : includes,
3359 link_with : [libnetworkd_core,
3360 networkd_link_with],
3361 install_rpath : rootlibexecdir,
3363 install_dir : rootlibexecdir)
3365 public_programs += executable(
3368 include_directories : includes,
3369 link_with : [libsystemd_network,
3370 networkd_link_with],
3371 install_rpath : rootlibexecdir,
3373 install_dir : rootbindir)
3376 'systemd-network-generator',
3377 network_generator_sources,
3378 include_directories : includes,
3379 link_with : [networkd_link_with],
3380 install_rpath : rootlibexecdir,
3382 install_dir : rootlibexecdir)
3384 if want_tests != 'false'
3385 test('test-network-generator-conversion',
3386 test_network_generator_conversion_sh,
3387 # https://github.com/mesonbuild/meson/issues/2681
3388 args : exe.full_path())
3393 'systemd-sulogin-shell',
3394 ['src/sulogin-shell/sulogin-shell.c'],
3395 include_directories : includes,
3396 link_with : [libshared],
3397 install_rpath : rootlibexecdir,
3399 install_dir : rootlibexecdir)
3401 ############################################################
3404 'systemd-runtest.env',
3405 output : 'systemd-runtest.env',
3406 command : ['sh', '-c', '{ ' +
3407 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
3408 'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(project_build_root, 'catalog')) +
3410 build_by_default : true)
3412 foreach tuple : tests
3414 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
3415 dependencies = tuple[2]
3416 condition = tuple.length() >= 4 ? tuple[3] : ''
3417 type = tuple.length() >= 5 ? tuple[4] : ''
3418 defs = tuple.length() >= 6 ? tuple[5] : []
3419 incs = tuple.length() >= 7 ? tuple[6] : includes
3420 parallel = tuple.length() >= 8 ? tuple[7] : true
3423 name = sources[0].split('/')[-1].split('.')[0]
3424 if type.startswith('timeout=')
3425 timeout = type.split('=')[1].to_int()
3429 if condition == '' or conf.get(condition) == 1
3433 include_directories : incs,
3434 link_with : link_with,
3435 dependencies : [versiondep,
3438 build_by_default : want_tests != 'false',
3439 install_rpath : rootlibexecdir,
3440 install : install_tests,
3441 install_dir : join_paths(testsdir, type))
3444 message('@0@ is a manual test'.format(name))
3445 elif type == 'unsafe' and want_tests != 'unsafe'
3446 message('@0@ is an unsafe test'.format(name))
3447 elif want_tests != 'false'
3453 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3458 'test-libsystemd-sym',
3459 test_libsystemd_sym_c,
3460 include_directories : includes,
3461 link_with : [libsystemd],
3462 build_by_default : want_tests != 'false',
3463 install : install_tests,
3464 install_dir : testsdir)
3465 if want_tests != 'false'
3466 test('test-libsystemd-sym', exe)
3470 'test-libsystemd-static-sym',
3471 test_libsystemd_sym_c,
3472 include_directories : includes,
3473 link_with : [install_libsystemd_static],
3474 dependencies : [threads], # threads is already included in dependencies on the library,
3475 # but does not seem to get propagated. Add here as a work-around.
3476 build_by_default : want_tests != 'false' and static_libsystemd_pic,
3477 install : install_tests and static_libsystemd_pic,
3478 install_dir : testsdir)
3479 if want_tests != 'false' and static_libsystemd_pic
3480 test('test-libsystemd-static-sym', exe)
3486 include_directories : libudev_includes,
3487 c_args : '-Wno-deprecated-declarations',
3488 link_with : [libudev],
3489 build_by_default : want_tests != 'false',
3490 install : install_tests,
3491 install_dir : testsdir)
3492 if want_tests != 'false'
3493 test('test-libudev-sym', exe)
3497 'test-libudev-static-sym',
3499 include_directories : libudev_includes,
3500 c_args : '-Wno-deprecated-declarations',
3501 link_with : [install_libudev_static],
3502 build_by_default : want_tests != 'false' and static_libudev_pic,
3503 install : install_tests and static_libudev_pic,
3504 install_dir : testsdir)
3505 if want_tests != 'false' and static_libudev_pic
3506 test('test-libudev-static-sym', exe)
3509 ############################################################
3513 foreach tuple : fuzzers
3515 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
3516 dependencies = tuple[2]
3517 defs = tuple.length() >= 4 ? tuple[3] : []
3518 incs = tuple.length() >= 5 ? tuple[4] : includes
3522 dependencies += fuzzing_engine
3524 if fuzzing_engine.found()
3525 dependencies += fuzzing_engine
3527 link_args += ['-fsanitize=fuzzer']
3530 sources += 'src/fuzz/fuzz-main.c'
3533 name = sources[0].split('/')[-1].split('.')[0]
3535 fuzzer_exes += executable(
3538 include_directories : [incs, include_directories('src/fuzz')],
3539 link_with : link_with,
3540 dependencies : dependencies,
3542 link_args: link_args,
3544 build_by_default : fuzz_tests or fuzzer_build)
3549 depends : fuzzer_exes,
3552 ############################################################
3555 subdir('sysusers.d')
3556 subdir('tmpfiles.d')
3562 subdir('shell-completion/bash')
3563 subdir('shell-completion/zsh')
3564 subdir('docs/sysvinit')
3565 subdir('docs/var-log')
3567 install_subdir('factory/etc',
3568 install_dir : factorydir)
3570 if install_sysconfdir
3571 install_data('xorg/50-systemd-user.sh',
3572 install_dir : xinitrcdir)
3574 install_data('modprobe.d/systemd.conf',
3575 install_dir : modprobedir)
3576 install_data('LICENSE.GPL2',
3580 'docs/CODING_STYLE.md',
3581 'docs/DISTRO_PORTING.md',
3582 'docs/ENVIRONMENT.md',
3584 'docs/TRANSIENT-SETTINGS.md',
3585 'docs/TRANSLATORS.md',
3586 'docs/UIDS-GIDS.md',
3587 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
3588 install_dir : docdir)
3590 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3591 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3593 ############################################################
3595 check_help = find_program('tools/check-help.sh')
3597 foreach exec : public_programs
3598 name = exec.full_path().split('/')[-1]
3599 if want_tests != 'false'
3600 test('check-help-' + name,
3602 args : exec.full_path())
3606 ############################################################
3608 check_directives_sh = find_program('tools/check-directives.sh')
3610 if want_tests != 'false'
3611 test('check-directives',
3612 check_directives_sh,
3613 args : project_source_root)
3616 ############################################################
3618 # Enable tests for all supported sanitizers
3619 foreach tuple : sanitizers
3620 sanitizer = tuple[0]
3623 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3625 foreach p : fuzz_regression_tests
3626 b = p.split('/')[-2]
3627 c = p.split('/')[-1]
3629 name = '@0@:@1@'.format(b, sanitizer)
3632 if want_tests == 'false'
3633 message('Not compiling @0@ because tests is set to false'.format(name))
3635 exe = custom_target(
3639 command : [env, 'ln', '-fs',
3640 join_paths(build.full_path(), b),
3642 build_by_default : true)
3644 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
3650 test('@0@_@1@_@2@'.format(b, c, sanitizer),
3652 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3654 args : [exe.full_path(),
3655 join_paths(project_source_root, p)])
3662 ############################################################
3665 all_files = run_command(
3666 'env', '-u', 'GIT_WORK_TREE',
3668 '--git-dir=@0@/.git'.format(project_source_root),
3669 'ls-files', ':/*.[ch]')
3671 all_files = files(all_files.stdout().split())
3676 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
3679 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
3683 git_contrib_sh = find_program('tools/git-contrib.sh')
3686 command : [git_contrib_sh])
3690 git_head = run_command(
3692 ['--git-dir=@0@/.git'.format(project_source_root),
3693 'rev-parse', 'HEAD']).stdout().strip()
3694 git_head_short = run_command(
3696 ['--git-dir=@0@/.git'.format(project_source_root),
3697 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3701 command : ['git', 'archive',
3702 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
3704 '--prefix', 'systemd-@0@/'.format(git_head),
3708 ############################################################
3710 check_api_docs_sh = find_program('tools/check-api-docs.sh')
3713 depends : [man, libsystemd, libudev],
3714 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3716 ############################################################
3717 watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog
3720 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3722 'build mode: @0@'.format(get_option('mode')),
3723 'split /usr: @0@'.format(split_usr),
3724 'split bin-sbin: @0@'.format(split_bin),
3725 'prefix directory: @0@'.format(prefixdir),
3726 'rootprefix directory: @0@'.format(rootprefixdir),
3727 'sysconf directory: @0@'.format(sysconfdir),
3728 'include directory: @0@'.format(includedir),
3729 'lib directory: @0@'.format(libdir),
3730 'rootlib directory: @0@'.format(rootlibdir),
3731 'SysV init scripts: @0@'.format(sysvinit_path),
3732 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3733 'PAM modules directory: @0@'.format(pamlibdir),
3734 'PAM configuration directory: @0@'.format(pamconfdir),
3735 'RPM macros directory: @0@'.format(rpmmacrosdir),
3736 'modprobe.d directory: @0@'.format(modprobedir),
3737 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3738 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3739 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3740 'bash completions directory: @0@'.format(bashcompletiondir),
3741 'zsh completions directory: @0@'.format(zshcompletiondir),
3742 'extra start script: @0@'.format(get_option('rc-local')),
3743 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3744 get_option('debug-tty')),
3745 'TTY GID: @0@'.format(tty_gid),
3746 'users GID: @0@'.format(substs.get('USERS_GID')),
3747 'system UIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
3748 conf.get('SYSTEM_ALLOC_UID_MIN')),
3749 'system GIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
3750 conf.get('SYSTEM_ALLOC_GID_MIN')),
3751 'dynamic UIDs: @0@–@1@'.format(dynamic_uid_min, dynamic_uid_max),
3752 'container UID bases: @0@–@1@'.format(container_uid_base_min, container_uid_base_max),
3753 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3754 'render group access mode: @0@'.format(get_option('group-render-mode')),
3755 'certificate root directory: @0@'.format(get_option('certificate-root')),
3756 'support URL: @0@'.format(support_url),
3757 'nobody user name: @0@'.format(nobody_user),
3758 'nobody group name: @0@'.format(nobody_group),
3759 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3761 'default DNSSEC mode: @0@'.format(default_dnssec),
3762 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
3763 'default mDNS mode: @0@'.format(default_mdns),
3764 'default LLMNR mode: @0@'.format(default_llmnr),
3765 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3766 'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
3767 'default KillUserProcesses setting: @0@'.format(kill_user_processes),
3768 'default locale: @0@'.format(default_locale),
3769 'default user $PATH: @0@'.format(default_user_path_display),
3770 'systemd service watchdog: @0@'.format(watchdog_opt)]
3772 alt_dns_servers = '\n '.join(dns_servers.split(' '))
3773 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3775 'default DNS servers: @0@'.format(alt_dns_servers),
3776 'default NTP servers: @0@'.format(alt_ntp_servers)]
3778 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3779 '@@0@'.format(time_epoch)).stdout().strip()
3781 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3784 'static libsystemd: @0@'.format(static_libsystemd),
3785 'static libudev: @0@'.format(static_libudev)]
3788 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3789 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3790 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3792 if conf.get('ENABLE_EFI') == 1
3793 status += 'efi arch: @0@'.format(efi_arch)
3797 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3798 'EFI CC @0@'.format(' '.join(efi_cc)),
3799 'EFI lds: @0@'.format(efi_lds),
3800 'EFI crt0: @0@'.format(efi_crt0),
3801 'EFI include directory: @0@'.format(efi_incdir)]
3836 ['compat-mutable-uid-boundaries'],
3866 ['DNS-over-TLS(gnutls)', conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1],
3867 ['DNS-over-TLS(openssl)', conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1],
3872 ['legacy pkla', install_polkit_pkla],
3874 ['gnu-efi', have_gnu_efi],
3887 ['man pages', want_man],
3888 ['html pages', want_html],
3889 ['man page indices', want_man and have_lxml],
3894 ['adm group', get_option('adm-group')],
3895 ['wheel group', get_option('wheel-group')],
3898 ['debug mmap cache'],
3900 ['valgrind', conf.get('VALGRIND') == 1],
3901 ['trace logging', conf.get('LOG_TRACE') == 1],
3902 ['install tests', install_tests],
3903 ['link-udev-shared', get_option('link-udev-shared')],
3904 ['link-systemctl-shared', get_option('link-systemctl-shared')],
3905 ['link-networkd-shared', get_option('link-networkd-shared')],
3906 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
3907 ['kernel-install', get_option('kernel-install')],
3908 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
3912 if tuple.length() >= 2
3915 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3916 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3917 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3928 'enabled features: @0@'.format(', '.join(found)),
3930 'disabled features: @0@'.format(', '.join(missing)),
3932 message('\n '.join(status))
3934 if rootprefixdir != rootprefix_default
3936 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3937 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3938 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))