1 # SPDX-License-Identifier: LGPL-2.1-or-later
3 project('systemd', 'c',
13 meson_version : '>= 0.46',
16 libsystemd_version = '0.31.0'
17 libudev_version = '1.7.1'
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'
72 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
73 + ' split-usr mode is going to be removed\n' +
74 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
76 conf.set10('HAVE_SPLIT_USR', split_usr,
77 description : '/usr/bin and /bin directories are separate')
79 if get_option('split-bin') == 'auto'
80 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
82 split_bin = get_option('split-bin') == 'true'
84 conf.set10('HAVE_SPLIT_BIN', split_bin,
85 description : 'bin and sbin directories are separate')
87 rootprefixdir = get_option('rootprefix')
88 # Unusual rootprefixdir values are used by some distros
89 # (see https://github.com/systemd/systemd/pull/7461).
90 rootprefix_default = split_usr ? '/' : '/usr'
91 if rootprefixdir == ''
92 rootprefixdir = rootprefix_default
94 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
96 have_standalone_binaries = get_option('standalone-binaries')
98 sysvinit_path = get_option('sysvinit-path')
99 sysvrcnd_path = get_option('sysvrcnd-path')
100 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
101 description : 'SysV init scripts and rcN.d links are supported')
103 if get_option('hibernate') and not get_option('initrd')
104 error('hibernate depends on initrd')
107 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
108 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
109 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
111 # join_paths ignores the preceding arguments if an absolute component is
112 # encountered, so this should canonicalize various paths when they are
113 # absolute or relative.
114 prefixdir = get_option('prefix')
115 if not prefixdir.startswith('/')
116 error('Prefix is not absolute: "@0@"'.format(prefixdir))
118 if prefixdir != rootprefixdir and not prefixdir.startswith(rootprefixdir.strip('/') + '/')
119 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
120 rootprefixdir, prefixdir))
123 bindir = join_paths(prefixdir, get_option('bindir'))
124 libdir = join_paths(prefixdir, get_option('libdir'))
125 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
126 includedir = join_paths(prefixdir, get_option('includedir'))
127 datadir = join_paths(prefixdir, get_option('datadir'))
128 localstatedir = join_paths('/', get_option('localstatedir'))
130 rootbindir = join_paths(rootprefixdir, 'bin')
131 rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
132 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
134 rootlibdir = get_option('rootlibdir')
136 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
139 install_sysconfdir = get_option('install-sysconfdir') != 'false'
140 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
141 # Dirs of external packages
142 pkgconfigdatadir = get_option('pkgconfigdatadir') == '' ? join_paths(datadir, 'pkgconfig') : get_option('pkgconfigdatadir')
143 pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgconfig') : get_option('pkgconfiglibdir')
144 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
145 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
146 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
147 xinitrcdir = get_option('xinitrcdir') == '' ? join_paths(sysconfdir, 'X11/xinit/xinitrc.d') : get_option('xinitrcdir')
148 rpmmacrosdir = get_option('rpmmacrosdir')
149 if rpmmacrosdir != 'no'
150 rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
152 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
155 pkgdatadir = join_paths(datadir, 'systemd')
156 environmentdir = join_paths(prefixdir, 'lib/environment.d')
157 pkgsysconfdir = join_paths(sysconfdir, 'systemd')
158 userunitdir = join_paths(prefixdir, 'lib/systemd/user')
159 userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
160 tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
161 sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
162 sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
163 binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
164 modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
165 networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
166 pkgincludedir = join_paths(includedir, 'systemd')
167 systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
168 usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
169 systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
170 userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
171 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
172 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
173 systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
174 systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
175 udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
176 udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
177 udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
178 catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
179 kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
180 factorydir = join_paths(datadir, 'factory')
181 bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
182 testsdir = join_paths(prefixdir, 'lib/systemd/tests')
183 systemdstatedir = join_paths(localstatedir, 'lib/systemd')
184 catalogstatedir = join_paths(systemdstatedir, 'catalog')
185 randomseeddir = join_paths(localstatedir, 'lib/systemd')
186 profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
187 ntpservicelistdir = join_paths(rootprefixdir, 'lib/systemd/ntp-units.d')
189 docdir = get_option('docdir')
191 docdir = join_paths(datadir, 'doc/systemd')
194 dbuspolicydir = get_option('dbuspolicydir')
195 if dbuspolicydir == ''
196 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
199 dbussessionservicedir = get_option('dbussessionservicedir')
200 if dbussessionservicedir == ''
201 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
204 dbussystemservicedir = get_option('dbussystemservicedir')
205 if dbussystemservicedir == ''
206 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
209 pamlibdir = get_option('pamlibdir')
211 pamlibdir = join_paths(rootlibdir, 'security')
214 pamconfdir = get_option('pamconfdir')
216 pamconfdir = join_paths(prefixdir, 'lib/pam.d')
219 memory_accounting_default = get_option('memory-accounting-default')
220 status_unit_format_default = get_option('status-unit-format-default')
222 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
223 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'system'))
224 conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
225 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
226 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
227 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
229 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
230 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
232 conf.set_quoted('USER_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'user'))
233 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
234 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
235 conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
236 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
237 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
238 conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
239 conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
240 conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
241 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
242 conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
243 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
244 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
245 conf.set_quoted('ROOTPREFIX', rootprefixdir)
246 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
247 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
248 conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
249 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
250 conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', join_paths(rootlibexecdir, 'systemd-veritysetup'))
251 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
252 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
253 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
254 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
255 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
256 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
257 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
258 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
259 conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
260 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
261 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
262 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
263 conf.set_quoted('LIBDIR', libdir)
264 conf.set_quoted('ROOTLIBDIR', rootlibdir)
265 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
266 conf.set_quoted('BOOTLIBDIR', bootlibdir)
267 conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
268 conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
269 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', join_paths(rootlibexecdir, 'systemd-import-fs'))
270 conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
271 conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
272 conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
273 conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
274 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', join_paths(rootlibexecdir, 'systemd-homework'))
275 conf.set_quoted('SYSTEMD_USERWORK_PATH', join_paths(rootlibexecdir, 'systemd-userwork'))
276 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
277 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
278 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
280 substs.set('prefix', prefixdir)
281 substs.set('rootprefix', rootprefixdir)
282 substs.set('rootprefix_noslash', rootprefixdir_noslash)
283 substs.set('exec_prefix', prefixdir)
284 substs.set('libdir', libdir)
285 substs.set('rootlibdir', rootlibdir)
286 substs.set('includedir', includedir)
287 substs.set('sysconfdir', sysconfdir)
288 substs.set('bindir', bindir)
289 substs.set('rootbindir', rootbindir)
290 substs.set('rootlibexecdir', rootlibexecdir)
291 substs.set('systemunitdir', systemunitdir)
292 substs.set('userunitdir', userunitdir)
293 substs.set('systempresetdir', systempresetdir)
294 substs.set('userpresetdir', userpresetdir)
295 substs.set('udevhwdbdir', udevhwdbdir)
296 substs.set('udevrulesdir', udevrulesdir)
297 substs.set('udevlibexecdir', udevlibexecdir)
298 substs.set('environmentdir', environmentdir)
299 substs.set('catalogdir', catalogdir)
300 substs.set('tmpfilesdir', tmpfilesdir)
301 substs.set('sysusersdir', sysusersdir)
302 substs.set('sysctldir', sysctldir)
303 substs.set('binfmtdir', binfmtdir)
304 substs.set('modulesloaddir', modulesloaddir)
305 substs.set('modprobedir', modprobedir)
306 substs.set('systemgeneratordir', systemgeneratordir)
307 substs.set('usergeneratordir', usergeneratordir)
308 substs.set('systemenvgeneratordir', systemenvgeneratordir)
309 substs.set('userenvgeneratordir', userenvgeneratordir)
310 substs.set('systemshutdowndir', systemshutdowndir)
311 substs.set('systemsleepdir', systemsleepdir)
312 substs.set('CERTIFICATEROOT', get_option('certificate-root'))
313 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
314 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
315 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
316 substs.set('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
317 substs.set('RC_LOCAL_PATH', get_option('rc-local'))
318 substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
319 substs.set('STATUS_UNIT_FORMAT_DEFAULT', status_unit_format_default)
320 substs.set('HIGH_RLIMIT_NOFILE', conf.get('HIGH_RLIMIT_NOFILE'))
321 substs.set('BUILD_ROOT', project_build_root)
323 #####################################################################
325 cc = meson.get_compiler('c')
326 pkgconfig = import('pkgconfig')
327 check_compilation_sh = find_program('tools/check-compilation.sh')
328 meson_build_sh = find_program('tools/meson-build.sh')
330 want_tests = get_option('tests')
331 slow_tests = want_tests != 'false' and get_option('slow-tests')
332 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
333 install_tests = get_option('install-tests')
335 if add_languages('cpp', required : fuzzer_build)
336 # Used only for tests
337 cxx = meson.get_compiler('cpp')
338 cxx_cmd = ' '.join(cxx.cmd_array())
344 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
345 if fuzzing_engine.found()
346 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
347 elif cc.has_argument('-fsanitize=fuzzer-no-link')
348 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
350 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
353 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
356 # Those generate many false positives, and we do not want to change the code to
358 basic_disabled_warnings = [
359 '-Wno-unused-parameter',
360 '-Wno-missing-field-initializers',
361 '-Wno-unused-result',
362 '-Wno-format-signedness',
365 possible_cc_flags = [
368 '-Wmissing-include-dirs',
369 '-Wold-style-definition',
373 '-Wsuggest-attribute=noreturn',
374 '-Werror=missing-prototypes',
375 '-Werror=implicit-function-declaration',
376 '-Werror=missing-declarations',
377 '-Werror=return-type',
378 '-Werror=incompatible-pointer-types',
380 '-Wstrict-prototypes',
382 '-Wmissing-noreturn',
383 '-Wimplicit-fallthrough=5',
386 '-Wstrict-aliasing=2',
389 '-Werror=shift-count-overflow',
390 '-Werror=shift-overflow=2',
394 # negative arguments are correctly detected starting with meson 0.46.
395 '-Wno-error=#warnings', # clang
396 '-Wno-string-plus-int', # clang
398 # Disable -Wmaybe-uninitialized, since it's noisy on gcc 8 with
399 # optimizations enabled, producing essentially false positives.
400 '-Wno-maybe-uninitialized',
404 '-fdiagnostics-show-option',
405 '-fno-strict-aliasing',
406 '-fvisibility=hidden',
408 '-fstack-protector-strong',
409 '--param=ssp-buffer-size=4',
412 # --as-needed and --no-undefined are provided by meson by default,
413 # run mesonconf to see what is enabled
414 possible_link_flags = [
420 if cc.get_id() == 'clang'
421 possible_cc_flags += [
422 '-Wno-typedef-redefinition',
423 '-Wno-gnu-variable-sized-type-not-at-end',
427 if get_option('buildtype') != 'debug'
428 possible_cc_flags += [
429 '-ffunction-sections',
433 possible_link_flags += '-Wl,--gc-sections'
436 add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
437 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
438 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
440 have = cc.has_argument('-Wzero-length-bounds')
441 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
445 #include <inttypes.h>
446 typedef uint64_t usec_t;
447 usec_t now(clockid_t clock);
452 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
453 add_project_arguments('-Werror=shadow', language : 'c')
457 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
460 cpp = ' '.join(cc.cmd_array()) + ' -E'
462 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
464 #####################################################################
465 # compilation result tests
467 conf.set('_GNU_SOURCE', true)
468 conf.set('__SANE_USERSPACE_TYPES__', true)
469 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
471 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
472 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
473 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
474 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
478 #include <sys/stat.h>
481 foreach decl : ['char16_t',
486 # We get -1 if the size cannot be determined
487 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
489 if decl == 'struct statx'
491 want_linux_stat_h = false
493 have = cc.sizeof(decl,
494 prefix : decl_headers + '#include <linux/stat.h>',
495 args : '-D_GNU_SOURCE') > 0
496 want_linux_stat_h = have
500 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
503 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
505 foreach ident : ['secure_getenv', '__secure_getenv']
506 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
510 ['memfd_create', '''#include <sys/mman.h>'''],
511 ['gettid', '''#include <sys/types.h>
512 #include <unistd.h>'''],
513 ['pivot_root', '''#include <stdlib.h>
514 #include <unistd.h>'''], # no known header declares pivot_root
515 ['name_to_handle_at', '''#include <sys/types.h>
516 #include <sys/stat.h>
517 #include <fcntl.h>'''],
518 ['setns', '''#include <sched.h>'''],
519 ['renameat2', '''#include <stdio.h>
520 #include <fcntl.h>'''],
521 ['kcmp', '''#include <linux/kcmp.h>'''],
522 ['keyctl', '''#include <sys/types.h>
523 #include <keyutils.h>'''],
524 ['copy_file_range', '''#include <sys/syscall.h>
525 #include <unistd.h>'''],
526 ['bpf', '''#include <sys/syscall.h>
527 #include <unistd.h>'''],
528 ['statx', '''#include <sys/types.h>
529 #include <sys/stat.h>
530 #include <unistd.h>'''],
531 ['explicit_bzero' , '''#include <string.h>'''],
532 ['reallocarray', '''#include <stdlib.h>'''],
533 ['set_mempolicy', '''#include <stdlib.h>
534 #include <unistd.h>'''],
535 ['get_mempolicy', '''#include <stdlib.h>
536 #include <unistd.h>'''],
537 ['pidfd_send_signal', '''#include <stdlib.h>
540 #include <sys/wait.h>'''],
541 ['pidfd_open', '''#include <stdlib.h>
544 #include <sys/wait.h>'''],
545 ['rt_sigqueueinfo', '''#include <stdlib.h>
548 #include <sys/wait.h>'''],
549 ['mallinfo', '''#include <malloc.h>'''],
550 ['execveat', '''#include <unistd.h>'''],
551 ['close_range', '''#include <unistd.h>'''],
552 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
555 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
556 conf.set10('HAVE_' + ident[0].to_upper(), have)
559 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
560 conf.set10('USE_SYS_RANDOM_H', true)
561 conf.set10('HAVE_GETRANDOM', true)
563 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
564 conf.set10('USE_SYS_RANDOM_H', false)
565 conf.set10('HAVE_GETRANDOM', have)
568 #####################################################################
570 version_tag = get_option('version-tag')
572 vcs_data = configuration_data()
573 vcs_data.set('VCS_TAG', version_tag)
574 version_h = configure_file(configuration : vcs_data,
575 input : 'src/version/version.h.in',
576 output : 'version.h')
579 project_source_root + '/tools/meson-vcs-tag.sh',
581 meson.project_version()]
584 input : 'src/version/version.h.in',
585 output : 'version.h',
589 versiondep = declare_dependency(sources: version_h)
591 sed = find_program('sed')
592 awk = find_program('awk')
593 m4 = find_program('m4')
594 stat = find_program('stat')
595 git = find_program('git', required : false)
596 env = find_program('env')
597 perl = find_program('perl', required : false)
599 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
600 mkdir_p = 'mkdir -p $DESTDIR/@0@'
601 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
602 splash_bmp = files('test/splash.bmp')
604 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
605 # /usr/sbin, /sbin, and fall back to the default from middle column.
606 progs = [['quotaon', '/usr/sbin/quotaon' ],
607 ['quotacheck', '/usr/sbin/quotacheck' ],
608 ['kmod', '/usr/bin/kmod' ],
609 ['kexec', '/usr/sbin/kexec' ],
610 ['sulogin', '/usr/sbin/sulogin' ],
611 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
612 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
613 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
614 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
615 ['nologin', '/usr/sbin/nologin', ],
618 path = get_option(prog[0] + '-path')
620 message('Using @1@ for @0@'.format(prog[0], path))
622 exe = find_program(prog[0],
623 '/usr/sbin/' + prog[0],
626 path = exe.found() ? exe.path() : prog[1]
628 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
629 conf.set_quoted(name, path)
630 substs.set(name, path)
633 conf.set_quoted('TELINIT', get_option('telinit-path'))
635 if run_command('ln', '--relative', '--help').returncode() != 0
636 error('ln does not support --relative (added in coreutils 8.16)')
639 ############################################################
641 gperf = find_program('gperf')
643 gperf_test_format = '''
645 const char * in_word_set(const char *, @0@);
648 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
649 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
650 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
651 if cc.compiles(gperf_test)
652 gperf_len_type = 'size_t'
654 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
655 if cc.compiles(gperf_test)
656 gperf_len_type = 'unsigned'
658 error('unable to determine gperf len type')
661 message('gperf len type is @0@'.format(gperf_len_type))
662 conf.set('GPERF_LEN_TYPE', gperf_len_type,
663 description : 'The type of gperf "len" parameter')
665 ############################################################
667 if not cc.has_header('sys/capability.h')
668 error('POSIX caps headers not found')
670 foreach header : ['crypt.h',
672 'linux/vm_sockets.h',
674 'valgrind/memcheck.h',
675 'valgrind/valgrind.h',
676 'linux/time_types.h',
679 conf.set10('HAVE_' + header.underscorify().to_upper(),
680 cc.has_header(header))
683 ############################################################
685 fallback_hostname = get_option('fallback-hostname')
686 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
687 error('Invalid fallback-hostname configuration')
688 # A more extensive test is done in test-hostname-util. Let's catch
689 # the most obvious errors here so we don't fail with an assert later.
691 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
693 default_hierarchy = get_option('default-hierarchy')
694 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
695 description : 'default cgroup hierarchy as string')
696 if default_hierarchy == 'legacy'
697 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
698 elif default_hierarchy == 'hybrid'
699 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
701 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
704 default_net_naming_scheme = get_option('default-net-naming-scheme')
705 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
707 time_epoch = get_option('time-epoch')
709 time_epoch = run_command('sh', ['-c', 'echo "$SOURCE_DATE_EPOCH"']).stdout().strip()
710 if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
711 # If we're in a git repository, use the creation time of the latest git tag.
712 latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
713 time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout()
717 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
719 time_epoch = time_epoch.to_int()
721 conf.set('TIME_EPOCH', time_epoch)
723 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
724 ['system-uid-max', 'SYS_UID_MAX', 999],
725 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
726 ['system-gid-max', 'SYS_GID_MAX', 999]]
727 v = get_option(tuple[0])
731 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
732 '/etc/login.defs').stdout().strip()
739 conf.set(tuple[0].underscorify().to_upper(), v)
740 substs.set(tuple[0].underscorify().to_upper(), v)
742 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
743 error('Invalid uid allocation range')
745 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
746 error('Invalid gid allocation range')
749 dynamic_uid_min = get_option('dynamic-uid-min')
750 dynamic_uid_max = get_option('dynamic-uid-max')
751 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
752 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
753 substs.set('dynamicuidmin', dynamic_uid_min)
754 substs.set('dynamicuidmax', dynamic_uid_max)
756 container_uid_base_min = get_option('container-uid-base-min')
757 container_uid_base_max = get_option('container-uid-base-max')
758 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
759 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
760 substs.set('containeruidbasemin', container_uid_base_min)
761 substs.set('containeruidbasemax', container_uid_base_max)
763 nobody_user = get_option('nobody-user')
764 nobody_group = get_option('nobody-group')
766 if not meson.is_cross_build()
767 getent_result = run_command('getent', 'passwd', '65534')
768 if getent_result.returncode() == 0
769 name = getent_result.stdout().split(':')[0]
770 if name != nobody_user
772 '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) +
773 'Your build will result in an user table setup that is incompatible with the local system.')
776 id_result = run_command('id', '-u', nobody_user)
777 if id_result.returncode() == 0
778 id = id_result.stdout().to_int()
781 '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) +
782 'Your build will result in an user table setup that is incompatible with the local system.')
786 getent_result = run_command('getent', 'group', '65534')
787 if getent_result.returncode() == 0
788 name = getent_result.stdout().split(':')[0]
789 if name != nobody_group
791 '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) +
792 'Your build will result in an group table setup that is incompatible with the local system.')
795 id_result = run_command('id', '-g', nobody_group)
796 if id_result.returncode() == 0
797 id = id_result.stdout().to_int()
800 '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) +
801 'Your build will result in an group table setup that is incompatible with the local system.')
805 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
807 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
808 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
811 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
812 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
813 substs.set('NOBODY_USER_NAME', nobody_user)
814 substs.set('NOBODY_GROUP_NAME', nobody_group)
816 tty_gid = get_option('tty-gid')
817 conf.set('TTY_GID', tty_gid)
818 substs.set('TTY_GID', tty_gid)
820 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
821 users_gid = get_option('users-gid')
822 substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid)
824 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
825 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
827 dev_kvm_mode = get_option('dev-kvm-mode')
828 substs.set('DEV_KVM_MODE', dev_kvm_mode)
829 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
830 group_render_mode = get_option('group-render-mode')
831 substs.set('GROUP_RENDER_MODE', group_render_mode)
832 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
834 kill_user_processes = get_option('default-kill-user-processes')
835 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
836 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
837 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
839 dns_servers = get_option('dns-servers')
840 conf.set_quoted('DNS_SERVERS', dns_servers)
841 substs.set('DNS_SERVERS', dns_servers)
843 ntp_servers = get_option('ntp-servers')
844 conf.set_quoted('NTP_SERVERS', ntp_servers)
845 substs.set('NTP_SERVERS', ntp_servers)
847 default_locale = get_option('default-locale')
848 if default_locale == ''
849 if not meson.is_cross_build()
850 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
851 default_locale = run_command(choose_default_locale_sh).stdout().strip()
853 default_locale = 'C.UTF-8'
856 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
858 localegen_path = get_option('localegen-path')
860 if localegen_path != ''
861 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
864 conf.set10('HAVE_LOCALEGEN', have)
866 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
868 service_watchdog = get_option('service-watchdog')
869 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
870 substs.set('SERVICE_WATCHDOG', watchdog_value)
872 substs.set('SUSHELL', get_option('debug-shell'))
873 substs.set('DEBUGTTY', get_option('debug-tty'))
874 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
876 enable_debug_hashmap = false
877 enable_debug_mmap_cache = false
878 enable_debug_siphash = false
879 foreach name : get_option('debug-extra')
881 enable_debug_hashmap = true
882 elif name == 'mmap-cache'
883 enable_debug_mmap_cache = true
884 elif name == 'siphash'
885 enable_debug_siphash = true
887 message('unknown debug option "@0@", ignoring'.format(name))
890 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
891 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
892 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
894 conf.set10('VALGRIND', get_option('valgrind'))
895 conf.set10('LOG_TRACE', get_option('log-trace'))
897 default_user_path = get_option('user-path')
898 if default_user_path != ''
899 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
900 default_user_path_display = default_user_path
902 # meson 0.49 fails when ?: is used in .format()
903 default_user_path_display = '(same as system services)'
907 #####################################################################
909 threads = dependency('threads')
910 librt = cc.find_library('rt')
911 libm = cc.find_library('m')
912 libdl = cc.find_library('dl')
913 libcrypt = cc.find_library('crypt')
915 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
917 ['crypt_ra', crypt_header],
918 ['crypt_preferred_method', crypt_header],
919 ['crypt_gensalt_ra', crypt_header]]
921 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
922 dependencies : libcrypt)
923 conf.set10('HAVE_' + ident[0].to_upper(), have)
926 libcap = dependency('libcap', required : false)
927 if not libcap.found()
928 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
929 libcap = cc.find_library('cap')
932 libmount = dependency('mount',
933 version : fuzzer_build ? '>= 0' : '>= 2.30')
935 want_libfdisk = get_option('fdisk')
936 if want_libfdisk != 'false' and not skip_deps
937 libfdisk = dependency('fdisk',
939 required : want_libfdisk == 'true')
940 have = libfdisk.found()
945 conf.set10('HAVE_LIBFDISK', have)
947 want_pwquality = get_option('pwquality')
948 if want_pwquality != 'false' and not skip_deps
949 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
950 have = libpwquality.found()
955 conf.set10('HAVE_PWQUALITY', have)
957 want_seccomp = get_option('seccomp')
958 if want_seccomp != 'false' and not skip_deps
959 libseccomp = dependency('libseccomp',
960 version : '>= 2.3.1',
961 required : want_seccomp == 'true')
962 have = libseccomp.found()
967 conf.set10('HAVE_SECCOMP', have)
969 want_selinux = get_option('selinux')
970 if want_selinux != 'false' and not skip_deps
971 libselinux = dependency('libselinux',
972 version : '>= 2.1.9',
973 required : want_selinux == 'true')
974 have = libselinux.found()
979 conf.set10('HAVE_SELINUX', have)
981 want_apparmor = get_option('apparmor')
982 if want_apparmor != 'false' and not skip_deps
983 libapparmor = dependency('libapparmor',
985 required : want_apparmor == 'true')
986 have = libapparmor.found()
991 conf.set10('HAVE_APPARMOR', have)
993 smack_run_label = get_option('smack-run-label')
994 if smack_run_label != ''
995 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
998 want_polkit = get_option('polkit')
999 install_polkit = false
1000 install_polkit_pkla = false
1001 if want_polkit != 'false' and not skip_deps
1002 install_polkit = true
1004 libpolkit = dependency('polkit-gobject-1',
1006 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1007 message('Old polkit detected, will install pkla files')
1008 install_polkit_pkla = true
1011 conf.set10('ENABLE_POLKIT', install_polkit)
1013 want_acl = get_option('acl')
1014 if want_acl != 'false' and not skip_deps
1015 libacl = cc.find_library('acl', required : want_acl == 'true')
1016 have = libacl.found()
1021 conf.set10('HAVE_ACL', have)
1023 want_audit = get_option('audit')
1024 if want_audit != 'false' and not skip_deps
1025 libaudit = dependency('audit', required : want_audit == 'true')
1026 have = libaudit.found()
1031 conf.set10('HAVE_AUDIT', have)
1033 want_blkid = get_option('blkid')
1034 if want_blkid != 'false' and not skip_deps
1035 libblkid = dependency('blkid', required : want_blkid == 'true')
1036 have = libblkid.found()
1038 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1039 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1044 conf.set10('HAVE_BLKID', have)
1046 want_kmod = get_option('kmod')
1047 if want_kmod != 'false' and not skip_deps
1048 libkmod = dependency('libkmod',
1050 required : want_kmod == 'true')
1051 have = libkmod.found()
1056 conf.set10('HAVE_KMOD', have)
1058 want_pam = get_option('pam')
1059 if want_pam != 'false' and not skip_deps
1060 libpam = cc.find_library('pam', required : want_pam == 'true')
1061 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1062 have = libpam.found() and libpam_misc.found()
1068 conf.set10('HAVE_PAM', have)
1070 want_microhttpd = get_option('microhttpd')
1071 if want_microhttpd != 'false' and not skip_deps
1072 libmicrohttpd = dependency('libmicrohttpd',
1073 version : '>= 0.9.33',
1074 required : want_microhttpd == 'true')
1075 have = libmicrohttpd.found()
1080 conf.set10('HAVE_MICROHTTPD', have)
1082 want_libcryptsetup = get_option('libcryptsetup')
1083 if want_libcryptsetup != 'false' and not skip_deps
1084 libcryptsetup = dependency('libcryptsetup',
1085 version : '>= 2.0.1',
1086 required : want_libcryptsetup == 'true')
1087 have = libcryptsetup.found()
1089 conf.set10('HAVE_CRYPT_SET_METADATA_SIZE',
1090 have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup))
1091 conf.set10('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY',
1092 have and cc.has_function('crypt_activate_by_signed_key', dependencies : libcryptsetup))
1093 conf.set10('HAVE_CRYPT_TOKEN_MAX',
1094 have and cc.has_function('crypt_token_max', dependencies : libcryptsetup))
1099 conf.set10('HAVE_LIBCRYPTSETUP', have)
1101 want_libcurl = get_option('libcurl')
1102 if want_libcurl != 'false' and not skip_deps
1103 libcurl = dependency('libcurl',
1104 version : '>= 7.32.0',
1105 required : want_libcurl == 'true')
1106 have = libcurl.found()
1111 conf.set10('HAVE_LIBCURL', have)
1112 conf.set10('CURL_NO_OLDIES', get_option('mode') == 'developer')
1114 want_libidn = get_option('libidn')
1115 want_libidn2 = get_option('libidn2')
1116 if want_libidn == 'true' and want_libidn2 == 'true'
1117 error('libidn and libidn2 cannot be requested simultaneously')
1120 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1121 libidn = dependency('libidn2',
1122 required : want_libidn2 == 'true')
1123 have = libidn.found()
1128 conf.set10('HAVE_LIBIDN2', have)
1129 if not have and want_libidn != 'false' and not skip_deps
1130 # libidn is used for both libidn and libidn2 objects
1131 libidn = dependency('libidn',
1132 required : want_libidn == 'true')
1133 have = libidn.found()
1137 conf.set10('HAVE_LIBIDN', have)
1139 want_libiptc = get_option('libiptc')
1140 if want_libiptc != 'false' and not skip_deps
1141 libiptc = dependency('libiptc',
1142 required : want_libiptc == 'true')
1143 have = libiptc.found()
1148 conf.set10('HAVE_LIBIPTC', have)
1150 want_qrencode = get_option('qrencode')
1151 if want_qrencode != 'false' and not skip_deps
1152 libqrencode = dependency('libqrencode',
1154 required : want_qrencode == 'true')
1155 have = libqrencode.found()
1160 conf.set10('HAVE_QRENCODE', have)
1162 want_gcrypt = get_option('gcrypt')
1163 if want_gcrypt != 'false' and not skip_deps
1164 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1165 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1166 have = libgcrypt.found() and libgpg_error.found()
1171 # link to neither of the libs if one is not found
1175 conf.set10('HAVE_GCRYPT', have)
1177 want_gnutls = get_option('gnutls')
1178 if want_gnutls != 'false' and not skip_deps
1179 libgnutls = dependency('gnutls',
1180 version : '>= 3.1.4',
1181 required : want_gnutls == 'true')
1182 have = libgnutls.found()
1187 conf.set10('HAVE_GNUTLS', have)
1189 want_openssl = get_option('openssl')
1190 if want_openssl != 'false' and not skip_deps
1191 libopenssl = dependency('openssl',
1192 version : '>= 1.1.0',
1193 required : want_openssl == 'true')
1194 have = libopenssl.found()
1199 conf.set10('HAVE_OPENSSL', have)
1201 want_p11kit = get_option('p11kit')
1202 if want_p11kit != 'false' and not skip_deps
1203 libp11kit = dependency('p11-kit-1',
1204 version : '>= 0.23.3',
1205 required : want_p11kit == 'true')
1206 have = libp11kit.found()
1211 conf.set10('HAVE_P11KIT', have)
1213 want_libfido2 = get_option('libfido2')
1214 if want_libfido2 != 'false' and not skip_deps
1215 libfido2 = dependency('libfido2',
1216 required : want_libfido2 == 'true')
1217 have = libfido2.found()
1222 conf.set10('HAVE_LIBFIDO2', have)
1224 want_tpm2 = get_option('tpm2')
1225 if want_tpm2 != 'false' and not skip_deps
1226 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1227 required : want_tpm2 == 'true')
1233 conf.set10('HAVE_TPM2', have)
1235 want_elfutils = get_option('elfutils')
1236 if want_elfutils != 'false' and not skip_deps
1237 libdw = dependency('libdw',
1238 required : want_elfutils == 'true')
1239 have = libdw.found()
1244 conf.set10('HAVE_ELFUTILS', have)
1246 want_zlib = get_option('zlib')
1247 if want_zlib != 'false' and not skip_deps
1248 libz = dependency('zlib',
1249 required : want_zlib == 'true')
1255 conf.set10('HAVE_ZLIB', have)
1257 want_bzip2 = get_option('bzip2')
1258 if want_bzip2 != 'false' and not skip_deps
1259 libbzip2 = cc.find_library('bz2',
1260 required : want_bzip2 == 'true')
1261 have = libbzip2.found()
1266 conf.set10('HAVE_BZIP2', have)
1268 want_xz = get_option('xz')
1269 if want_xz != 'false' and not skip_deps
1270 libxz = dependency('liblzma',
1271 required : want_xz == 'true')
1272 have_xz = libxz.found()
1277 conf.set10('HAVE_XZ', have_xz)
1279 want_lz4 = get_option('lz4')
1280 if want_lz4 != 'false' and not skip_deps
1281 liblz4 = dependency('liblz4',
1282 version : '>= 1.3.0',
1283 required : want_lz4 == 'true')
1284 have_lz4 = liblz4.found()
1289 conf.set10('HAVE_LZ4', have_lz4)
1291 want_zstd = get_option('zstd')
1292 if want_zstd != 'false' and not skip_deps
1293 libzstd = dependency('libzstd',
1294 required : want_zstd == 'true',
1295 version : '>= 1.4.0')
1296 have_zstd = libzstd.found()
1301 conf.set10('HAVE_ZSTD', have_zstd)
1303 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1305 want_xkbcommon = get_option('xkbcommon')
1306 if want_xkbcommon != 'false' and not skip_deps
1307 libxkbcommon = dependency('xkbcommon',
1308 version : '>= 0.3.0',
1309 required : want_xkbcommon == 'true')
1310 have = libxkbcommon.found()
1315 conf.set10('HAVE_XKBCOMMON', have)
1317 want_pcre2 = get_option('pcre2')
1318 if want_pcre2 != 'false'
1319 libpcre2 = dependency('libpcre2-8',
1320 required : want_pcre2 == 'true')
1321 have = libpcre2.found()
1326 conf.set10('HAVE_PCRE2', have)
1328 want_glib = get_option('glib')
1329 if want_glib != 'false' and not skip_deps
1330 libglib = dependency('glib-2.0',
1331 version : '>= 2.22.0',
1332 required : want_glib == 'true')
1333 libgobject = dependency('gobject-2.0',
1334 version : '>= 2.22.0',
1335 required : want_glib == 'true')
1336 libgio = dependency('gio-2.0',
1337 required : want_glib == 'true')
1338 have = libglib.found() and libgobject.found() and libgio.found()
1345 conf.set10('HAVE_GLIB', have)
1347 want_dbus = get_option('dbus')
1348 if want_dbus != 'false' and not skip_deps
1349 libdbus = dependency('dbus-1',
1350 version : '>= 1.3.2',
1351 required : want_dbus == 'true')
1352 have = libdbus.found()
1357 conf.set10('HAVE_DBUS', have)
1359 default_dnssec = get_option('default-dnssec')
1361 default_dnssec = 'no'
1363 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1364 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1365 default_dnssec = 'no'
1367 conf.set('DEFAULT_DNSSEC_MODE',
1368 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1369 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1371 dns_over_tls = get_option('dns-over-tls')
1372 if dns_over_tls != 'false'
1373 if dns_over_tls == 'openssl'
1376 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
1377 if dns_over_tls == 'gnutls' and not have_gnutls
1378 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1381 if dns_over_tls == 'gnutls' or have_gnutls
1382 have_openssl = false
1384 have_openssl = conf.get('HAVE_OPENSSL') == 1
1385 if dns_over_tls != 'auto' and not have_openssl
1386 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
1387 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1390 have = have_gnutls or have_openssl
1394 have_openssl = false
1396 conf.set10('ENABLE_DNS_OVER_TLS', have)
1397 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1398 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1400 default_dns_over_tls = get_option('default-dns-over-tls')
1402 default_dns_over_tls = 'no'
1404 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1405 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.')
1406 default_dns_over_tls = 'no'
1408 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1409 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1410 substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls)
1412 default_mdns = get_option('default-mdns')
1413 conf.set('DEFAULT_MDNS_MODE',
1414 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1415 substs.set('DEFAULT_MDNS_MODE', default_mdns)
1417 default_llmnr = get_option('default-llmnr')
1418 conf.set('DEFAULT_LLMNR_MODE',
1419 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1420 substs.set('DEFAULT_LLMNR_MODE', default_llmnr)
1422 want_repart = get_option('repart')
1423 if want_repart != 'false'
1424 have = (conf.get('HAVE_OPENSSL') == 1 and
1425 conf.get('HAVE_LIBFDISK') == 1)
1426 if want_repart == 'true' and not have
1427 error('repart support was requested, but dependencies are not available')
1432 conf.set10('ENABLE_REPART', have)
1434 want_importd = get_option('importd')
1435 if want_importd != 'false'
1436 have = (conf.get('HAVE_LIBCURL') == 1 and
1437 conf.get('HAVE_ZLIB') == 1 and
1438 conf.get('HAVE_XZ') == 1 and
1439 conf.get('HAVE_GCRYPT') == 1)
1440 if want_importd == 'true' and not have
1441 error('importd support was requested, but dependencies are not available')
1446 conf.set10('ENABLE_IMPORTD', have)
1448 want_homed = get_option('homed')
1449 if want_homed != 'false'
1450 have = (conf.get('HAVE_OPENSSL') == 1 and
1451 conf.get('HAVE_LIBFDISK') == 1 and
1452 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1453 if want_homed == 'true' and not have
1454 error('homed support was requested, but dependencies are not available')
1459 conf.set10('ENABLE_HOMED', have)
1461 have = have and conf.get('HAVE_PAM') == 1
1462 conf.set10('ENABLE_PAM_HOME', have)
1464 have = get_option('oomd')
1465 conf.set10('ENABLE_OOMD', have)
1466 substs.set10('ENABLE_OOMD', have)
1468 want_remote = get_option('remote')
1469 if want_remote != 'false'
1470 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1471 conf.get('HAVE_LIBCURL') == 1]
1472 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1473 # it's possible to build one without the other. Complain only if
1474 # support was explicitly requested. The auxiliary files like sysusers
1475 # config should be installed when any of the programs are built.
1476 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1477 error('remote support was requested, but dependencies are not available')
1479 have = have_deps[0] or have_deps[1]
1483 conf.set10('ENABLE_REMOTE', have)
1485 foreach term : ['analyze',
1499 'compat-mutable-uid-boundaries',
1525 have = get_option(term)
1526 name = 'ENABLE_' + term.underscorify().to_upper()
1527 conf.set10(name, have)
1528 substs.set10(name, have)
1531 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1533 foreach tuple : [['nss-mymachines', 'machined'],
1534 ['nss-resolve', 'resolve']]
1535 want = get_option(tuple[0])
1537 have = get_option(tuple[1])
1538 if want == 'true' and not have
1539 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1544 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1545 conf.set10(name, have)
1549 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1550 'ENABLE_NSS_MYMACHINES',
1551 'ENABLE_NSS_RESOLVE',
1552 'ENABLE_NSS_SYSTEMD']
1553 if conf.get(term) == 1
1557 conf.set10('ENABLE_NSS', enable_nss)
1559 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1561 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1563 #####################################################################
1565 if get_option('efi')
1566 efi_arch = host_machine.cpu_family()
1568 if efi_arch == 'x86'
1569 EFI_MACHINE_TYPE_NAME = 'ia32'
1570 gnu_efi_arch = 'ia32'
1571 elif efi_arch == 'x86_64'
1572 EFI_MACHINE_TYPE_NAME = 'x64'
1573 gnu_efi_arch = 'x86_64'
1574 elif efi_arch == 'arm'
1575 EFI_MACHINE_TYPE_NAME = 'arm'
1576 gnu_efi_arch = 'arm'
1577 elif efi_arch == 'aarch64'
1578 EFI_MACHINE_TYPE_NAME = 'aa64'
1579 gnu_efi_arch = 'aarch64'
1581 EFI_MACHINE_TYPE_NAME = ''
1586 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1588 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
1592 conf.set10('ENABLE_EFI', have)
1594 ############################################################
1596 generate_gperfs = find_program('tools/generate-gperfs.py')
1597 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1598 make_directive_index_py = find_program('tools/make-directive-index.py')
1599 make_man_index_py = find_program('tools/make-man-index.py')
1600 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1601 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1602 update_hwdb_sh = find_program('tools/update-hwdb.sh')
1603 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1604 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1605 xml_helper_py = find_program('tools/xml_helper.py')
1607 #####################################################################
1609 config_h = configure_file(
1610 output : 'config.h',
1611 configuration : conf)
1613 add_project_arguments('-include', 'config.h', language : 'c')
1615 ############################################################
1617 # binaries that have --help and are intended for use by humans,
1618 # usually, but not always, installed in /bin.
1619 public_programs = []
1624 basic_includes = include_directories(
1630 libsystemd_includes = [basic_includes, include_directories(
1631 'src/libsystemd/sd-bus',
1632 'src/libsystemd/sd-device',
1633 'src/libsystemd/sd-event',
1634 'src/libsystemd/sd-hwdb',
1635 'src/libsystemd/sd-id128',
1636 'src/libsystemd/sd-journal',
1637 'src/libsystemd/sd-netlink',
1638 'src/libsystemd/sd-network',
1639 'src/libsystemd/sd-resolve')]
1641 includes = [libsystemd_includes, include_directories('src/shared')]
1645 subdir('src/fundamental')
1647 subdir('src/libsystemd')
1648 subdir('src/shared')
1650 subdir('src/libudev')
1652 libsystemd = shared_library(
1655 version : libsystemd_version,
1656 include_directories : libsystemd_includes,
1657 link_args : ['-shared',
1658 '-Wl,--version-script=' + libsystemd_sym_path],
1659 link_with : [libbasic,
1661 link_whole : [libsystemd_static],
1662 dependencies : [threads,
1667 link_depends : libsystemd_sym,
1669 install_dir : rootlibdir)
1671 install_libsystemd_static = static_library(
1675 basic_gcrypt_sources,
1676 fundamental_sources,
1678 include_directories : libsystemd_includes,
1679 build_by_default : static_libsystemd != 'false',
1680 install : static_libsystemd != 'false',
1681 install_dir : rootlibdir,
1682 pic : static_libsystemd_pic,
1683 dependencies : [threads,
1693 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1695 libudev = shared_library(
1698 version : libudev_version,
1699 include_directories : includes,
1700 link_args : ['-shared',
1701 '-Wl,--version-script=' + libudev_sym_path],
1702 link_with : [libsystemd_static, libshared_static],
1703 link_whole : libudev_basic,
1704 dependencies : [threads],
1705 link_depends : libudev_sym,
1707 install_dir : rootlibdir)
1709 install_libudev_static = static_library(
1712 fundamental_sources,
1717 include_directories : includes,
1718 build_by_default : static_libudev != 'false',
1719 install : static_libudev != 'false',
1720 install_dir : rootlibdir,
1721 link_depends : libudev_sym,
1722 dependencies : libshared_deps + [libmount],
1723 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1724 pic : static_libudev_pic)
1726 ############################################################
1728 # systemd-analyze requires 'libcore'
1730 # systemd-journal-remote requires 'libjournal_core'
1731 subdir('src/journal')
1732 # systemd-networkd requires 'libsystemd_network'
1733 subdir('src/libsystemd-network')
1735 subdir('src/analyze')
1736 subdir('src/boot/efi')
1737 subdir('src/busctl')
1738 subdir('src/coredump')
1739 subdir('src/cryptenroll')
1740 subdir('src/cryptsetup')
1742 subdir('src/hostname')
1743 subdir('src/import')
1744 subdir('src/journal-remote')
1745 subdir('src/kernel-install')
1746 subdir('src/locale')
1748 subdir('src/machine')
1749 subdir('src/network')
1750 subdir('src/nspawn')
1752 subdir('src/partition')
1753 subdir('src/portable')
1754 subdir('src/pstore')
1755 subdir('src/resolve')
1757 subdir('src/shutdown')
1758 subdir('src/sysext')
1759 subdir('src/systemctl')
1760 subdir('src/timedate')
1761 subdir('src/timesync')
1762 subdir('src/tmpfiles')
1763 subdir('src/userdb')
1764 subdir('src/vconsole')
1765 subdir('src/xdg-autostart-generator')
1767 subdir('src/systemd')
1774 ############################################################
1776 # only static linking apart from libdl, to make sure that the
1777 # module is linked to all libraries that it uses.
1778 test_dlopen = executable(
1782 include_directories : includes,
1783 link_with : [libbasic],
1784 dependencies : [libdl],
1785 build_by_default : want_tests != 'false')
1787 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
1788 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
1789 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
1790 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
1792 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1796 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1797 version_script_arg = join_paths(project_source_root, sym)
1799 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
1800 if tuple.length() > 2
1801 foreach s : tuple[2]
1802 sources += ['src/nss-@0@/@1@'.format(module, s)]
1806 incs = tuple.length() > 3 ? tuple[3] : includes
1808 nss = shared_library(
1813 include_directories : incs,
1814 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1815 link_args : ['-Wl,-z,nodelete',
1817 '-Wl,--version-script=' + version_script_arg],
1818 link_with : [libsystemd_static,
1821 dependencies : [threads,
1825 install_dir : rootlibdir)
1827 # We cannot use shared_module because it does not support version suffix.
1828 # Unfortunately shared_library insists on creating the symlink…
1829 meson.add_install_script('sh', '-c',
1830 'rm $DESTDIR@0@/libnss_@1@.so'
1831 .format(rootlibdir, module))
1833 if want_tests != 'false'
1834 test('dlopen-nss_' + module,
1836 # path to dlopen must include a slash
1837 args : nss.full_path())
1842 ############################################################
1847 include_directories : includes,
1848 link_with : [libcore,
1850 dependencies : [versiondep,
1857 install_rpath : rootlibexecdir,
1859 install_dir : rootlibexecdir)
1861 meson.add_install_script(meson_make_symlink,
1862 join_paths(rootlibexecdir, 'systemd'),
1863 join_paths(rootsbindir, 'init'))
1865 public_programs += executable(
1867 systemd_analyze_sources,
1868 include_directories : core_includes,
1869 link_with : [libcore,
1871 dependencies : [versiondep,
1878 install_rpath : rootlibexecdir,
1879 install : conf.get('ENABLE_ANALYZE'))
1883 systemd_journald_sources,
1884 include_directories : includes,
1885 link_with : [libjournal_core,
1887 dependencies : [threads,
1892 install_rpath : rootlibexecdir,
1894 install_dir : rootlibexecdir)
1896 public_programs += executable(
1898 systemd_cat_sources,
1899 include_directories : includes,
1900 link_with : [libjournal_core,
1902 dependencies : [threads],
1903 install_rpath : rootlibexecdir,
1906 public_programs += executable(
1909 include_directories : includes,
1910 link_with : [libshared],
1911 dependencies : [threads,
1917 install_rpath : rootlibexecdir,
1919 install_dir : rootbindir)
1922 'systemd-getty-generator',
1923 'src/getty-generator/getty-generator.c',
1924 include_directories : includes,
1925 link_with : [libshared],
1926 install_rpath : rootlibexecdir,
1928 install_dir : systemgeneratordir)
1931 'systemd-debug-generator',
1932 'src/debug-generator/debug-generator.c',
1933 include_directories : includes,
1934 link_with : [libshared],
1935 install_rpath : rootlibexecdir,
1937 install_dir : systemgeneratordir)
1940 'systemd-run-generator',
1941 'src/run-generator/run-generator.c',
1942 include_directories : includes,
1943 link_with : [libshared],
1944 install_rpath : rootlibexecdir,
1946 install_dir : systemgeneratordir)
1949 'systemd-fstab-generator',
1950 'src/fstab-generator/fstab-generator.c',
1951 include_directories : includes,
1952 link_with : [libshared],
1953 install_rpath : rootlibexecdir,
1955 install_dir : systemgeneratordir)
1957 if conf.get('ENABLE_ENVIRONMENT_D') == 1
1959 '30-systemd-environment-d-generator',
1960 'src/environment-d-generator/environment-d-generator.c',
1961 include_directories : includes,
1962 link_with : [libshared],
1963 install_rpath : rootlibexecdir,
1965 install_dir : userenvgeneratordir)
1967 meson.add_install_script(meson_make_symlink,
1968 join_paths(sysconfdir, 'environment'),
1969 join_paths(environmentdir, '99-environment.conf'))
1972 if conf.get('ENABLE_HIBERNATE') == 1
1974 'systemd-hibernate-resume-generator',
1975 'src/hibernate-resume/hibernate-resume-generator.c',
1976 include_directories : includes,
1977 link_with : [libshared],
1978 install_rpath : rootlibexecdir,
1980 install_dir : systemgeneratordir)
1983 'systemd-hibernate-resume',
1984 'src/hibernate-resume/hibernate-resume.c',
1985 include_directories : includes,
1986 link_with : [libshared],
1987 install_rpath : rootlibexecdir,
1989 install_dir : rootlibexecdir)
1992 if conf.get('HAVE_BLKID') == 1
1994 'systemd-gpt-auto-generator',
1995 'src/gpt-auto-generator/gpt-auto-generator.c',
1996 include_directories : includes,
1997 link_with : [libshared],
1998 dependencies : libblkid,
1999 install_rpath : rootlibexecdir,
2001 install_dir : systemgeneratordir)
2003 public_programs += executable(
2005 'src/dissect/dissect.c',
2006 include_directories : includes,
2007 link_with : [libshared],
2008 install_rpath : rootlibexecdir,
2012 if conf.get('ENABLE_RESOLVE') == 1
2015 systemd_resolved_sources,
2016 include_directories : resolve_includes,
2017 link_with : [libshared,
2019 libsystemd_resolve_core],
2020 dependencies : systemd_resolved_dependencies,
2021 install_rpath : rootlibexecdir,
2023 install_dir : rootlibexecdir)
2025 public_programs += executable(
2028 include_directories : includes,
2029 link_with : [libshared,
2031 libsystemd_resolve_core],
2032 dependencies : [threads,
2036 install_rpath : rootlibexecdir,
2039 meson.add_install_script(meson_make_symlink,
2040 join_paths(bindir, 'resolvectl'),
2041 join_paths(rootsbindir, 'resolvconf'))
2043 meson.add_install_script(meson_make_symlink,
2044 join_paths(bindir, 'resolvectl'),
2045 join_paths(bindir, 'systemd-resolve'))
2048 if conf.get('ENABLE_LOGIND') == 1
2051 systemd_logind_sources,
2052 include_directories : includes,
2053 link_with : [liblogind_core,
2055 dependencies : [threads,
2057 install_rpath : rootlibexecdir,
2059 install_dir : rootlibexecdir)
2061 public_programs += executable(
2064 include_directories : includes,
2065 link_with : [libshared],
2066 dependencies : [threads,
2070 install_rpath : rootlibexecdir,
2072 install_dir : rootbindir)
2074 public_programs += executable(
2076 'src/login/inhibit.c',
2077 include_directories : includes,
2078 link_with : [libshared],
2079 install_rpath : rootlibexecdir,
2081 install_dir : rootbindir)
2083 if conf.get('HAVE_PAM') == 1
2084 version_script_arg = join_paths(project_source_root, pam_systemd_sym)
2085 pam_systemd = shared_library(
2089 include_directories : includes,
2090 link_args : ['-shared',
2091 '-Wl,--version-script=' + version_script_arg],
2092 link_with : [libsystemd_static,
2094 dependencies : [threads,
2097 link_depends : pam_systemd_sym,
2099 install_dir : pamlibdir)
2101 if want_tests != 'false'
2102 test('dlopen-pam_systemd',
2104 # path to dlopen must include a slash
2105 args : pam_systemd.full_path())
2110 'systemd-user-runtime-dir',
2111 user_runtime_dir_sources,
2112 include_directories : includes,
2113 link_with : [libshared],
2114 install_rpath : rootlibexecdir,
2116 install_dir : rootlibexecdir)
2119 if conf.get('HAVE_PAM') == 1
2121 'systemd-user-sessions',
2122 'src/user-sessions/user-sessions.c',
2123 include_directories : includes,
2124 link_with : [libshared],
2125 install_rpath : rootlibexecdir,
2127 install_dir : rootlibexecdir)
2130 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
2131 public_programs += executable(
2133 'src/boot/bootctl.c',
2134 include_directories : includes,
2135 link_with : [libshared],
2136 dependencies : [libblkid],
2137 install_rpath : rootlibexecdir,
2140 public_programs += executable(
2141 'systemd-bless-boot',
2142 'src/boot/bless-boot.c',
2143 include_directories : includes,
2144 link_with : [libshared],
2145 dependencies : [libblkid],
2146 install_rpath : rootlibexecdir,
2148 install_dir : rootlibexecdir)
2151 'systemd-bless-boot-generator',
2152 'src/boot/bless-boot-generator.c',
2153 include_directories : includes,
2154 link_with : [libshared],
2155 install_rpath : rootlibexecdir,
2157 install_dir : systemgeneratordir)
2161 'systemd-boot-check-no-failures',
2162 'src/boot/boot-check-no-failures.c',
2163 include_directories : includes,
2164 link_with : [libshared],
2165 dependencies : [libblkid],
2166 install_rpath : rootlibexecdir,
2168 install_dir : rootlibexecdir)
2170 public_programs += executable(
2171 'systemd-socket-activate',
2172 'src/activate/activate.c',
2173 include_directories : includes,
2174 link_with : [libshared],
2175 dependencies : [threads],
2176 install_rpath : rootlibexecdir,
2179 public_programs += executable(
2182 include_directories : includes,
2183 link_with : systemctl_link_with,
2184 dependencies : [threads,
2190 install_rpath : rootlibexecdir,
2192 install_dir : rootbindir)
2194 if conf.get('ENABLE_PORTABLED') == 1
2196 'systemd-portabled',
2197 systemd_portabled_sources,
2198 include_directories : includes,
2199 link_with : [libshared],
2200 dependencies : [threads],
2201 install_rpath : rootlibexecdir,
2203 install_dir : rootlibexecdir)
2205 public_programs += executable(
2207 'src/portable/portablectl.c',
2208 include_directories : includes,
2209 link_with : [libshared],
2210 dependencies : [threads],
2211 install_rpath : rootlibexecdir,
2213 install_dir : rootbindir)
2216 if conf.get('ENABLE_SYSEXT') == 1
2217 public_programs += executable(
2219 systemd_sysext_sources,
2220 include_directories : includes,
2221 link_with : [libshared],
2222 install_rpath : rootlibexecdir,
2224 install_dir : rootbindir)
2227 if conf.get('ENABLE_USERDB') == 1
2230 systemd_userwork_sources,
2231 include_directories : includes,
2232 link_with : [libshared],
2233 dependencies : [threads],
2234 install_rpath : rootlibexecdir,
2236 install_dir : rootlibexecdir)
2240 systemd_userdbd_sources,
2241 include_directories : includes,
2242 link_with : [libshared],
2243 dependencies : [threads],
2244 install_rpath : rootlibexecdir,
2246 install_dir : rootlibexecdir)
2248 public_programs += executable(
2251 include_directories : includes,
2252 link_with : [libshared],
2253 dependencies : [threads],
2254 install_rpath : rootlibexecdir,
2256 install_dir : rootbindir)
2259 if conf.get('ENABLE_HOMED') == 1
2262 systemd_homework_sources,
2263 include_directories : includes,
2264 link_with : [libshared],
2265 dependencies : [threads,
2272 install_rpath : rootlibexecdir,
2274 install_dir : rootlibexecdir)
2278 systemd_homed_sources,
2279 include_directories : home_includes,
2280 link_with : [libshared],
2281 dependencies : [threads,
2284 install_rpath : rootlibexecdir,
2286 install_dir : rootlibexecdir)
2288 public_programs += executable(
2291 include_directories : includes,
2292 link_with : [libshared],
2293 dependencies : [threads,
2298 install_rpath : rootlibexecdir,
2300 install_dir : rootbindir)
2302 if conf.get('HAVE_PAM') == 1
2303 version_script_arg = join_paths(project_source_root, pam_systemd_home_sym)
2304 pam_systemd = shared_library(
2308 include_directories : includes,
2309 link_args : ['-shared',
2310 '-Wl,--version-script=' + version_script_arg],
2311 link_with : [libsystemd_static,
2313 dependencies : [threads,
2317 link_depends : pam_systemd_home_sym,
2319 install_dir : pamlibdir)
2323 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2324 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2325 meson.add_install_script(meson_make_symlink,
2326 join_paths(rootbindir, 'systemctl'),
2327 join_paths(rootsbindir, alias))
2330 meson.add_install_script(meson_make_symlink,
2331 join_paths(rootbindir, 'udevadm'),
2332 join_paths(rootlibexecdir, 'systemd-udevd'))
2334 if conf.get('ENABLE_BACKLIGHT') == 1
2336 'systemd-backlight',
2337 'src/backlight/backlight.c',
2338 include_directories : includes,
2339 link_with : [libshared],
2340 install_rpath : rootlibexecdir,
2342 install_dir : rootlibexecdir)
2345 if conf.get('ENABLE_RFKILL') == 1
2348 'src/rfkill/rfkill.c',
2349 include_directories : includes,
2350 link_with : [libshared],
2351 install_rpath : rootlibexecdir,
2353 install_dir : rootlibexecdir)
2357 'systemd-system-update-generator',
2358 'src/system-update-generator/system-update-generator.c',
2359 include_directories : includes,
2360 link_with : [libshared],
2361 install_rpath : rootlibexecdir,
2363 install_dir : systemgeneratordir)
2365 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2367 'systemd-cryptsetup',
2368 systemd_cryptsetup_sources,
2369 include_directories : includes,
2370 link_with : [libshared],
2371 dependencies : [libcryptsetup,
2373 install_rpath : rootlibexecdir,
2375 install_dir : rootlibexecdir)
2378 'systemd-cryptsetup-generator',
2379 'src/cryptsetup/cryptsetup-generator.c',
2380 include_directories : includes,
2381 link_with : [libshared],
2382 install_rpath : rootlibexecdir,
2384 install_dir : systemgeneratordir)
2387 'systemd-veritysetup',
2388 'src/veritysetup/veritysetup.c',
2389 include_directories : includes,
2390 link_with : [libshared],
2391 dependencies : [libcryptsetup],
2392 install_rpath : rootlibexecdir,
2394 install_dir : rootlibexecdir)
2397 'systemd-veritysetup-generator',
2398 'src/veritysetup/veritysetup-generator.c',
2399 include_directories : includes,
2400 link_with : [libshared],
2401 install_rpath : rootlibexecdir,
2403 install_dir : systemgeneratordir)
2406 'systemd-cryptenroll',
2407 systemd_cryptenroll_sources,
2408 include_directories : includes,
2409 link_with : [libshared],
2410 dependencies : [libcryptsetup,
2414 install_rpath : rootlibexecdir,
2418 if conf.get('HAVE_SYSV_COMPAT') == 1
2420 'systemd-sysv-generator',
2421 'src/sysv-generator/sysv-generator.c',
2422 include_directories : includes,
2423 link_with : [libshared],
2424 install_rpath : rootlibexecdir,
2426 install_dir : systemgeneratordir)
2429 'systemd-rc-local-generator',
2430 'src/rc-local-generator/rc-local-generator.c',
2431 include_directories : includes,
2432 link_with : [libshared],
2433 install_rpath : rootlibexecdir,
2435 install_dir : systemgeneratordir)
2438 if conf.get('ENABLE_XDG_AUTOSTART') == 1
2440 'systemd-xdg-autostart-generator',
2441 systemd_xdg_autostart_generator_sources,
2442 include_directories : includes,
2443 link_with : [libshared],
2444 install_rpath : rootlibexecdir,
2446 install_dir : usergeneratordir)
2449 'systemd-xdg-autostart-condition',
2450 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2451 include_directories : includes,
2452 link_with : [libshared],
2453 install_rpath : rootlibexecdir,
2455 install_dir : rootlibexecdir)
2458 if conf.get('ENABLE_HOSTNAMED') == 1
2460 'systemd-hostnamed',
2461 'src/hostname/hostnamed.c',
2462 include_directories : includes,
2463 link_with : [libshared],
2464 install_rpath : rootlibexecdir,
2466 install_dir : rootlibexecdir)
2468 public_programs += executable(
2470 'src/hostname/hostnamectl.c',
2471 include_directories : includes,
2472 link_with : [libshared],
2473 install_rpath : rootlibexecdir,
2477 if conf.get('ENABLE_LOCALED') == 1
2478 if conf.get('HAVE_XKBCOMMON') == 1
2479 # logind will load libxkbcommon.so dynamically on its own
2487 systemd_localed_sources,
2488 include_directories : includes,
2489 link_with : [libshared],
2490 dependencies : deps,
2491 install_rpath : rootlibexecdir,
2493 install_dir : rootlibexecdir)
2495 public_programs += executable(
2498 include_directories : includes,
2499 link_with : [libshared],
2500 install_rpath : rootlibexecdir,
2504 if conf.get('ENABLE_TIMEDATED') == 1
2506 'systemd-timedated',
2507 'src/timedate/timedated.c',
2508 include_directories : includes,
2509 link_with : [libshared],
2510 install_rpath : rootlibexecdir,
2512 install_dir : rootlibexecdir)
2515 if conf.get('ENABLE_TIMEDATECTL') == 1
2516 public_programs += executable(
2518 'src/timedate/timedatectl.c',
2519 include_directories : includes,
2520 install_rpath : rootlibexecdir,
2521 link_with : [libshared],
2522 dependencies : [libm],
2526 if conf.get('ENABLE_TIMESYNCD') == 1
2528 'systemd-timesyncd',
2529 systemd_timesyncd_sources,
2530 include_directories : includes,
2531 link_with : [libtimesyncd_core],
2532 dependencies : [threads,
2534 install_rpath : rootlibexecdir,
2536 install_dir : rootlibexecdir)
2539 'systemd-time-wait-sync',
2540 'src/timesync/wait-sync.c',
2541 include_directories : includes,
2542 link_with : [libtimesyncd_core],
2543 install_rpath : rootlibexecdir,
2545 install_dir : rootlibexecdir)
2548 if conf.get('ENABLE_MACHINED') == 1
2551 systemd_machined_sources,
2552 include_directories : includes,
2553 link_with : [libmachine_core,
2555 install_rpath : rootlibexecdir,
2557 install_dir : rootlibexecdir)
2559 public_programs += executable(
2561 'src/machine/machinectl.c',
2562 include_directories : includes,
2563 link_with : [libshared],
2564 dependencies : [threads,
2568 install_rpath : rootlibexecdir,
2570 install_dir : rootbindir)
2573 if conf.get('ENABLE_IMPORTD') == 1
2576 systemd_importd_sources,
2577 include_directories : includes,
2578 link_with : [libshared],
2579 dependencies : [threads],
2580 install_rpath : rootlibexecdir,
2582 install_dir : rootlibexecdir)
2584 systemd_pull = executable(
2586 systemd_pull_sources,
2587 include_directories : includes,
2588 link_with : [libshared],
2589 dependencies : [versiondep,
2595 install_rpath : rootlibexecdir,
2597 install_dir : rootlibexecdir)
2599 systemd_import = executable(
2601 systemd_import_sources,
2602 include_directories : includes,
2603 link_with : [libshared],
2604 dependencies : [libcurl,
2608 install_rpath : rootlibexecdir,
2610 install_dir : rootlibexecdir)
2612 systemd_import_fs = executable(
2613 'systemd-import-fs',
2614 systemd_import_fs_sources,
2615 include_directories : includes,
2616 link_with : [libshared],
2617 install_rpath : rootlibexecdir,
2619 install_dir : rootlibexecdir)
2621 systemd_export = executable(
2623 systemd_export_sources,
2624 include_directories : includes,
2625 link_with : [libshared],
2626 dependencies : [libcurl,
2630 install_rpath : rootlibexecdir,
2632 install_dir : rootlibexecdir)
2634 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2637 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2638 public_programs += executable(
2639 'systemd-journal-upload',
2640 systemd_journal_upload_sources,
2641 include_directories : includes,
2642 link_with : [libshared],
2643 dependencies : [versiondep,
2650 install_rpath : rootlibexecdir,
2652 install_dir : rootlibexecdir)
2655 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2656 public_programs += executable(
2657 'systemd-journal-remote',
2658 systemd_journal_remote_sources,
2659 include_directories : includes,
2660 link_with : [libshared,
2661 libsystemd_journal_remote],
2662 dependencies : [threads,
2668 install_rpath : rootlibexecdir,
2670 install_dir : rootlibexecdir)
2672 public_programs += executable(
2673 'systemd-journal-gatewayd',
2674 systemd_journal_gatewayd_sources,
2675 include_directories : includes,
2676 link_with : [libshared],
2677 dependencies : [threads,
2683 install_rpath : rootlibexecdir,
2685 install_dir : rootlibexecdir)
2688 if conf.get('ENABLE_COREDUMP') == 1
2691 systemd_coredump_sources,
2692 include_directories : includes,
2693 link_with : [libshared],
2694 dependencies : [threads,
2700 install_rpath : rootlibexecdir,
2702 install_dir : rootlibexecdir)
2704 public_programs += executable(
2706 coredumpctl_sources,
2707 include_directories : includes,
2708 link_with : [libshared],
2709 dependencies : [threads,
2713 install_rpath : rootlibexecdir,
2717 if conf.get('ENABLE_PSTORE') == 1
2720 systemd_pstore_sources,
2721 include_directories : includes,
2722 link_with : [libshared],
2723 dependencies : [threads,
2729 install_rpath : rootlibexecdir,
2731 install_dir : rootlibexecdir)
2734 if conf.get('ENABLE_OOMD') == 1
2735 executable('systemd-oomd',
2736 systemd_oomd_sources,
2737 include_directories : includes,
2738 link_with : [libshared],
2740 install_rpath : rootlibexecdir,
2742 install_dir : rootlibexecdir)
2744 public_programs += executable(
2747 include_directories : includes,
2748 link_with : [libshared],
2750 install_rpath : rootlibexecdir,
2752 install_dir : rootbindir)
2755 if conf.get('ENABLE_BINFMT') == 1
2756 public_programs += executable(
2758 'src/binfmt/binfmt.c',
2759 include_directories : includes,
2760 link_with : [libshared],
2761 install_rpath : rootlibexecdir,
2763 install_dir : rootlibexecdir)
2765 meson.add_install_script('sh', '-c',
2766 mkdir_p.format(binfmtdir))
2767 if install_sysconfdir
2768 meson.add_install_script('sh', '-c',
2769 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2773 if conf.get('ENABLE_REPART') == 1
2776 systemd_repart_sources,
2777 include_directories : includes,
2778 link_with : [libshared],
2779 dependencies : [threads,
2783 install_rpath : rootlibexecdir,
2785 install_dir : rootbindir)
2786 public_programs += exe
2788 if want_tests != 'false'
2791 args : exe.full_path())
2795 if conf.get('ENABLE_VCONSOLE') == 1
2797 'systemd-vconsole-setup',
2798 'src/vconsole/vconsole-setup.c',
2799 include_directories : includes,
2800 link_with : [libshared],
2801 install_rpath : rootlibexecdir,
2803 install_dir : rootlibexecdir)
2806 if conf.get('ENABLE_RANDOMSEED') == 1
2808 'systemd-random-seed',
2809 'src/random-seed/random-seed.c',
2810 include_directories : includes,
2811 link_with : [libshared],
2812 install_rpath : rootlibexecdir,
2814 install_dir : rootlibexecdir)
2817 if conf.get('ENABLE_FIRSTBOOT') == 1
2819 'systemd-firstboot',
2820 'src/firstboot/firstboot.c',
2821 include_directories : includes,
2822 link_with : [libshared],
2823 dependencies : [libcrypt],
2824 install_rpath : rootlibexecdir,
2826 install_dir : rootbindir)
2830 'systemd-remount-fs',
2831 'src/remount-fs/remount-fs.c',
2832 include_directories : includes,
2833 link_with : [libshared],
2834 install_rpath : rootlibexecdir,
2836 install_dir : rootlibexecdir)
2839 'systemd-machine-id-setup',
2840 'src/machine-id-setup/machine-id-setup-main.c',
2841 include_directories : includes,
2842 link_with : [libshared],
2843 install_rpath : rootlibexecdir,
2845 install_dir : rootbindir)
2850 include_directories : includes,
2851 link_with : [libshared],
2852 install_rpath : rootlibexecdir,
2854 install_dir : rootlibexecdir)
2856 executable('systemd-growfs',
2857 'src/partition/growfs.c',
2858 include_directories : includes,
2859 link_with : [libshared],
2860 install_rpath : rootlibexecdir,
2862 install_dir : rootlibexecdir)
2866 'src/partition/makefs.c',
2867 include_directories : includes,
2868 link_with : [libshared],
2869 install_rpath : rootlibexecdir,
2871 install_dir : rootlibexecdir)
2875 'src/sleep/sleep.c',
2876 include_directories : includes,
2877 link_with : [libshared],
2878 install_rpath : rootlibexecdir,
2880 install_dir : rootlibexecdir)
2882 if install_sysconfdir_samples
2883 install_data('src/sleep/sleep.conf',
2884 install_dir : pkgsysconfdir)
2887 public_programs += executable(
2889 'src/sysctl/sysctl.c',
2890 include_directories : includes,
2891 link_with : [libshared],
2892 install_rpath : rootlibexecdir,
2894 install_dir : rootlibexecdir)
2898 'src/ac-power/ac-power.c',
2899 include_directories : includes,
2900 link_with : [libshared],
2901 install_rpath : rootlibexecdir,
2903 install_dir : rootlibexecdir)
2905 public_programs += executable(
2906 'systemd-detect-virt',
2907 'src/detect-virt/detect-virt.c',
2908 include_directories : includes,
2909 link_with : [libshared],
2910 install_rpath : rootlibexecdir,
2913 public_programs += executable(
2915 'src/delta/delta.c',
2916 include_directories : includes,
2917 link_with : [libshared],
2918 install_rpath : rootlibexecdir,
2921 public_programs += executable(
2923 'src/escape/escape.c',
2924 include_directories : includes,
2925 link_with : [libshared],
2926 install_rpath : rootlibexecdir,
2928 install_dir : rootbindir)
2930 public_programs += executable(
2932 'src/notify/notify.c',
2933 include_directories : includes,
2934 link_with : [libshared],
2935 install_rpath : rootlibexecdir,
2937 install_dir : rootbindir)
2940 'systemd-volatile-root',
2941 'src/volatile-root/volatile-root.c',
2942 include_directories : includes,
2943 link_with : [libshared],
2944 install_rpath : rootlibexecdir,
2945 install : conf.get('ENABLE_INITRD') == 1,
2946 install_dir : rootlibexecdir)
2949 'systemd-cgroups-agent',
2950 'src/cgroups-agent/cgroups-agent.c',
2951 include_directories : includes,
2952 link_with : [libshared],
2953 install_rpath : rootlibexecdir,
2955 install_dir : rootlibexecdir)
2957 public_programs += executable(
2959 'src/id128/id128.c',
2960 include_directories : includes,
2961 link_with : [libshared],
2962 install_rpath : rootlibexecdir,
2965 public_programs += executable(
2968 include_directories : includes,
2969 link_with : [libshared],
2970 install_rpath : rootlibexecdir,
2973 public_programs += executable(
2974 'systemd-ask-password',
2975 'src/ask-password/ask-password.c',
2976 include_directories : includes,
2977 link_with : [libshared],
2978 install_rpath : rootlibexecdir,
2980 install_dir : rootbindir)
2983 'systemd-reply-password',
2984 'src/reply-password/reply-password.c',
2985 include_directories : includes,
2986 link_with : [libshared],
2987 install_rpath : rootlibexecdir,
2989 install_dir : rootlibexecdir)
2991 public_programs += executable(
2992 'systemd-tty-ask-password-agent',
2993 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2994 include_directories : includes,
2995 link_with : [libshared],
2996 install_rpath : rootlibexecdir,
2998 install_dir : rootbindir)
3000 public_programs += executable(
3003 include_directories : includes,
3004 link_with : [libshared],
3005 install_rpath : rootlibexecdir,
3008 public_programs += executable(
3010 'src/cgtop/cgtop.c',
3011 include_directories : includes,
3012 link_with : [libshared],
3013 install_rpath : rootlibexecdir,
3018 'src/initctl/initctl.c',
3019 include_directories : includes,
3020 link_with : [libshared],
3021 install_rpath : rootlibexecdir,
3022 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3023 install_dir : rootlibexecdir)
3025 public_programs += executable(
3027 'src/mount/mount-tool.c',
3028 include_directories : includes,
3029 link_with : [libshared],
3030 dependencies: [libmount],
3031 install_rpath : rootlibexecdir,
3034 meson.add_install_script(meson_make_symlink,
3035 'systemd-mount', join_paths(bindir, 'systemd-umount'))
3037 public_programs += executable(
3040 include_directories : includes,
3041 link_with : [libshared],
3042 install_rpath : rootlibexecdir,
3045 public_programs += executable(
3046 'systemd-stdio-bridge',
3047 'src/stdio-bridge/stdio-bridge.c',
3048 include_directories : includes,
3049 link_with : [libshared],
3050 dependencies : [versiondep],
3051 install_rpath : rootlibexecdir,
3054 public_programs += executable(
3057 include_directories : includes,
3058 link_with : [libshared],
3059 install_rpath : rootlibexecdir,
3065 'src/sysusers/sysusers.c',
3066 include_directories : includes,
3067 link_with : [libshared],
3068 install_rpath : rootlibexecdir,
3070 install_dir : rootbindir)
3071 public_programs += exe
3073 if want_tests != 'false'
3074 test('test-sysusers',
3076 # https://github.com/mesonbuild/meson/issues/2681
3077 args : exe.full_path())
3080 if have_standalone_binaries
3082 'systemd-sysusers.standalone',
3083 'src/sysusers/sysusers.c',
3084 include_directories : includes,
3085 c_args : '-DSTANDALONE',
3086 link_with : [libshared_static,
3091 install_dir : rootbindir)
3092 public_programs += exe
3094 if want_tests != 'false'
3095 test('test-sysusers.standalone',
3097 # https://github.com/mesonbuild/meson/issues/2681
3098 args : exe.full_path())
3103 if conf.get('ENABLE_TMPFILES') == 1
3106 systemd_tmpfiles_sources,
3107 include_directories : includes,
3108 link_with : [libshared],
3109 dependencies : [libacl],
3110 install_rpath : rootlibexecdir,
3112 install_dir : rootbindir)
3113 public_programs += exe
3115 if want_tests != 'false'
3116 test('test-systemd-tmpfiles',
3117 test_systemd_tmpfiles_py,
3118 # https://github.com/mesonbuild/meson/issues/2681
3119 args : exe.full_path())
3122 if have_standalone_binaries
3123 public_programs += executable(
3124 'systemd-tmpfiles.standalone',
3125 systemd_tmpfiles_sources,
3126 include_directories : includes,
3127 c_args : '-DSTANDALONE',
3128 link_with : [libshared_static,
3132 dependencies : [libacl],
3134 install_dir : rootbindir)
3138 if conf.get('ENABLE_HWDB') == 1
3139 public_programs += executable(
3142 include_directories : includes,
3143 link_with : udev_link_with,
3144 install_rpath : udev_rpath,
3146 install_dir : rootbindir)
3149 if conf.get('ENABLE_QUOTACHECK') == 1
3151 'systemd-quotacheck',
3152 'src/quotacheck/quotacheck.c',
3153 include_directories : includes,
3154 link_with : [libshared],
3155 install_rpath : rootlibexecdir,
3157 install_dir : rootlibexecdir)
3160 public_programs += executable(
3161 'systemd-socket-proxyd',
3162 'src/socket-proxy/socket-proxyd.c',
3163 include_directories : includes,
3164 link_with : [libshared],
3165 dependencies : [threads],
3166 install_rpath : rootlibexecdir,
3168 install_dir : rootlibexecdir)
3170 public_programs += executable(
3173 include_directories : includes,
3174 link_with : [libudevd_core],
3175 dependencies : [versiondep,
3181 install_rpath : udev_rpath,
3183 install_dir : rootbindir)
3187 systemd_shutdown_sources,
3188 include_directories : includes,
3189 link_with : [libshared],
3190 dependencies : [libmount],
3191 install_rpath : rootlibexecdir,
3193 install_dir : rootlibexecdir)
3196 'systemd-update-done',
3197 'src/update-done/update-done.c',
3198 include_directories : includes,
3199 link_with : [libshared],
3200 install_rpath : rootlibexecdir,
3202 install_dir : rootlibexecdir)
3205 'systemd-update-utmp',
3206 'src/update-utmp/update-utmp.c',
3207 include_directories : includes,
3208 link_with : [libshared],
3209 dependencies : [libaudit],
3210 install_rpath : rootlibexecdir,
3211 install : (conf.get('ENABLE_UTMP') == 1),
3212 install_dir : rootlibexecdir)
3214 if conf.get('HAVE_KMOD') == 1
3216 'systemd-modules-load',
3217 'src/modules-load/modules-load.c',
3218 include_directories : includes,
3219 link_with : [libshared],
3220 dependencies : [libkmod],
3221 install_rpath : rootlibexecdir,
3223 install_dir : rootlibexecdir)
3225 meson.add_install_script('sh', '-c',
3226 mkdir_p.format(modulesloaddir))
3227 if install_sysconfdir
3228 meson.add_install_script('sh', '-c',
3229 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
3233 public_programs += executable(
3235 systemd_nspawn_sources,
3236 include_directories : includes,
3237 link_with : [libnspawn_core,
3239 dependencies : [libblkid,
3241 install_rpath : rootlibexecdir,
3244 if conf.get('ENABLE_NETWORKD') == 1
3247 systemd_networkd_sources,
3248 include_directories : network_includes,
3249 link_with : [libnetworkd_core,
3251 networkd_link_with],
3252 dependencies : [threads],
3253 install_rpath : rootlibexecdir,
3255 install_dir : rootlibexecdir)
3258 'systemd-networkd-wait-online',
3259 systemd_networkd_wait_online_sources,
3260 include_directories : includes,
3261 link_with : [networkd_link_with],
3262 install_rpath : rootlibexecdir,
3264 install_dir : rootlibexecdir)
3266 public_programs += executable(
3269 include_directories : libsystemd_network_includes,
3270 link_with : [libsystemd_network,
3271 networkd_link_with],
3272 install_rpath : rootlibexecdir,
3274 install_dir : rootbindir)
3277 'systemd-network-generator',
3278 network_generator_sources,
3279 include_directories : includes,
3280 link_with : [networkd_link_with],
3281 install_rpath : rootlibexecdir,
3283 install_dir : rootlibexecdir)
3285 if want_tests != 'false'
3286 test('test-network-generator-conversion',
3287 test_network_generator_conversion_sh,
3288 # https://github.com/mesonbuild/meson/issues/2681
3289 args : exe.full_path())
3294 'systemd-sulogin-shell',
3295 'src/sulogin-shell/sulogin-shell.c',
3296 include_directories : includes,
3297 link_with : [libshared],
3298 install_rpath : rootlibexecdir,
3300 install_dir : rootlibexecdir)
3302 ############################################################
3305 'systemd-runtest.env',
3306 output : 'systemd-runtest.env',
3307 command : ['sh', '-c', '{ ' +
3308 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
3309 'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(project_build_root, 'catalog')) +
3311 build_by_default : true)
3313 foreach tuple : tests
3315 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3316 dependencies = tuple.length() > 2 ? tuple[2] : []
3317 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3318 condition = tuple.length() > 4 ? tuple[4] : ''
3319 type = tuple.length() > 5 ? tuple[5] : ''
3320 defs = tuple.length() > 6 ? tuple[6] : []
3321 parallel = tuple.length() > 7 ? tuple[7] : true
3324 name = sources[0].split('/')[-1].split('.')[0]
3325 if type.startswith('timeout=')
3326 timeout = type.split('=')[1].to_int()
3330 if condition == '' or conf.get(condition) == 1
3334 include_directories : incs,
3335 link_with : link_with,
3336 dependencies : [versiondep,
3339 build_by_default : want_tests != 'false',
3340 install_rpath : rootlibexecdir,
3341 install : install_tests,
3342 install_dir : join_paths(testsdir, type))
3345 message('@0@ is a manual test'.format(name))
3346 elif type == 'unsafe' and want_tests != 'unsafe'
3347 message('@0@ is an unsafe test'.format(name))
3348 elif want_tests != 'false'
3354 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3359 'test-libsystemd-sym',
3360 test_libsystemd_sym_c,
3361 include_directories : includes,
3362 link_with : [libsystemd],
3363 build_by_default : want_tests != 'false',
3364 install : install_tests,
3365 install_dir : testsdir)
3366 if want_tests != 'false'
3367 test('test-libsystemd-sym', exe)
3371 'test-libsystemd-static-sym',
3372 test_libsystemd_sym_c,
3373 include_directories : includes,
3374 link_with : [install_libsystemd_static],
3375 dependencies : [threads], # threads is already included in dependencies on the library,
3376 # but does not seem to get propagated. Add here as a work-around.
3377 build_by_default : want_tests != 'false' and static_libsystemd_pic,
3378 install : install_tests and static_libsystemd_pic,
3379 install_dir : testsdir)
3380 if want_tests != 'false' and static_libsystemd_pic
3381 test('test-libsystemd-static-sym', exe)
3387 include_directories : libudev_includes,
3388 c_args : '-Wno-deprecated-declarations',
3389 link_with : [libudev],
3390 build_by_default : want_tests != 'false',
3391 install : install_tests,
3392 install_dir : testsdir)
3393 if want_tests != 'false'
3394 test('test-libudev-sym', exe)
3398 'test-libudev-static-sym',
3400 include_directories : libudev_includes,
3401 c_args : '-Wno-deprecated-declarations',
3402 link_with : [install_libudev_static],
3403 build_by_default : want_tests != 'false' and static_libudev_pic,
3404 install : install_tests and static_libudev_pic,
3405 install_dir : testsdir)
3406 if want_tests != 'false' and static_libudev_pic
3407 test('test-libudev-static-sym', exe)
3410 ############################################################
3414 foreach tuple : fuzzers
3416 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3417 dependencies = tuple.length() > 2 ? tuple[2] : []
3418 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3419 defs = tuple.length() > 4 ? tuple[4] : []
3423 dependencies += fuzzing_engine
3425 if fuzzing_engine.found()
3426 dependencies += fuzzing_engine
3428 link_args += ['-fsanitize=fuzzer']
3431 sources += 'src/fuzz/fuzz-main.c'
3434 name = sources[0].split('/')[-1].split('.')[0]
3436 fuzzer_exes += executable(
3439 include_directories : [incs, include_directories('src/fuzz')],
3440 link_with : link_with,
3441 dependencies : dependencies,
3443 link_args: link_args,
3445 build_by_default : fuzz_tests or fuzzer_build)
3450 depends : fuzzer_exes,
3453 ############################################################
3456 subdir('sysusers.d')
3457 subdir('tmpfiles.d')
3463 subdir('shell-completion/bash')
3464 subdir('shell-completion/zsh')
3465 subdir('docs/sysvinit')
3466 subdir('docs/var-log')
3468 install_subdir('factory/etc',
3469 install_dir : factorydir)
3471 if install_sysconfdir
3472 install_data('xorg/50-systemd-user.sh',
3473 install_dir : xinitrcdir)
3475 install_data('modprobe.d/systemd.conf',
3476 install_dir : modprobedir)
3477 install_data('LICENSE.GPL2',
3481 'docs/CODING_STYLE.md',
3482 'docs/DISTRO_PORTING.md',
3483 'docs/ENVIRONMENT.md',
3485 'docs/TRANSIENT-SETTINGS.md',
3486 'docs/TRANSLATORS.md',
3487 'docs/UIDS-GIDS.md',
3488 'docs/GVARIANT-SERIALIZATION.md',
3489 install_dir : docdir)
3491 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3492 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3494 ############################################################
3496 check_help = find_program('tools/check-help.sh')
3498 foreach exec : public_programs
3499 name = exec.full_path().split('/')[-1]
3500 if want_tests != 'false'
3501 test('check-help-' + name,
3503 args : exec.full_path())
3507 ############################################################
3509 check_directives_sh = find_program('tools/check-directives.sh')
3511 if want_tests != 'false'
3512 test('check-directives',
3513 check_directives_sh,
3514 args : project_source_root)
3517 ############################################################
3519 # Enable tests for all supported sanitizers
3520 foreach tuple : sanitizers
3521 sanitizer = tuple[0]
3524 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3526 foreach p : fuzz_regression_tests
3527 b = p.split('/')[-2]
3528 c = p.split('/')[-1]
3530 name = '@0@:@1@'.format(b, sanitizer)
3533 if want_tests == 'false'
3534 message('Not compiling @0@ because tests is set to false'.format(name))
3536 exe = custom_target(
3540 command : [env, 'ln', '-fs',
3541 join_paths(build.full_path(), b),
3543 build_by_default : true)
3545 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
3551 test('@0@_@1@_@2@'.format(b, c, sanitizer),
3553 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3555 args : [exe.full_path(),
3556 join_paths(project_source_root, p)])
3563 ############################################################
3566 all_files = run_command(
3567 'env', '-u', 'GIT_WORK_TREE',
3569 '--git-dir=@0@/.git'.format(project_source_root),
3570 'ls-files', ':/*.[ch]')
3572 all_files = files(all_files.stdout().split())
3577 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
3580 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
3584 git_contrib_sh = find_program('tools/git-contrib.sh')
3587 command : [git_contrib_sh])
3591 git_head = run_command(
3593 ['--git-dir=@0@/.git'.format(project_source_root),
3594 'rev-parse', 'HEAD']).stdout().strip()
3595 git_head_short = run_command(
3597 ['--git-dir=@0@/.git'.format(project_source_root),
3598 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3602 command : ['git', 'archive',
3603 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
3605 '--prefix', 'systemd-@0@/'.format(git_head),
3609 ############################################################
3611 check_api_docs_sh = find_program('tools/check-api-docs.sh')
3614 depends : [man, libsystemd, libudev],
3615 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3617 ############################################################
3619 if dbus_docs.length() > 0
3622 output : 'update-dbus-docs',
3623 command : [update_dbus_docs_py,
3624 '--build-dir=@0@'.format(project_build_root),
3628 if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER'
3629 test('dbus-docs-fresh',
3630 update_dbus_docs_py,
3631 args : ['--build-dir=@0@'.format(project_build_root),
3632 '--test'] + dbus_docs)
3638 output : 'update-man-rules',
3639 command : ['sh', '-c',
3640 'cd @0@ && '.format(meson.build_root()) +
3641 'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) +
3642 'mv t @0@/man/rules/meson.build'.format(meson.current_source_dir())],
3643 depend_files : custom_entities_ent)
3645 ############################################################
3646 watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog
3649 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3651 'build mode: @0@'.format(get_option('mode')),
3652 'split /usr: @0@'.format(split_usr),
3653 'split bin-sbin: @0@'.format(split_bin),
3654 'prefix directory: @0@'.format(prefixdir),
3655 'rootprefix directory: @0@'.format(rootprefixdir),
3656 'sysconf directory: @0@'.format(sysconfdir),
3657 'include directory: @0@'.format(includedir),
3658 'lib directory: @0@'.format(libdir),
3659 'rootlib directory: @0@'.format(rootlibdir),
3660 'SysV init scripts: @0@'.format(sysvinit_path),
3661 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3662 'PAM modules directory: @0@'.format(pamlibdir),
3663 'PAM configuration directory: @0@'.format(pamconfdir),
3664 'RPM macros directory: @0@'.format(rpmmacrosdir),
3665 'modprobe.d directory: @0@'.format(modprobedir),
3666 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3667 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3668 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3669 'bash completions directory: @0@'.format(bashcompletiondir),
3670 'zsh completions directory: @0@'.format(zshcompletiondir),
3671 'extra start script: @0@'.format(get_option('rc-local')),
3672 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3673 get_option('debug-tty')),
3674 'TTY GID: @0@'.format(tty_gid),
3675 'users GID: @0@'.format(substs.get('USERS_GID')),
3676 'system UIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
3677 conf.get('SYSTEM_ALLOC_UID_MIN')),
3678 'system GIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
3679 conf.get('SYSTEM_ALLOC_GID_MIN')),
3680 'dynamic UIDs: @0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
3681 'container UID bases: @0@…@1@'.format(container_uid_base_min, container_uid_base_max),
3682 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3683 'render group access mode: @0@'.format(get_option('group-render-mode')),
3684 'certificate root directory: @0@'.format(get_option('certificate-root')),
3685 'support URL: @0@'.format(support_url),
3686 'nobody user name: @0@'.format(nobody_user),
3687 'nobody group name: @0@'.format(nobody_group),
3688 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3690 'default DNSSEC mode: @0@'.format(default_dnssec),
3691 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
3692 'default mDNS mode: @0@'.format(default_mdns),
3693 'default LLMNR mode: @0@'.format(default_llmnr),
3694 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3695 'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
3696 'default KillUserProcesses setting: @0@'.format(kill_user_processes),
3697 'default locale: @0@'.format(default_locale),
3698 'default user $PATH: @0@'.format(default_user_path_display),
3699 'systemd service watchdog: @0@'.format(watchdog_opt)]
3701 alt_dns_servers = '\n '.join(dns_servers.split(' '))
3702 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3704 'default DNS servers: @0@'.format(alt_dns_servers),
3705 'default NTP servers: @0@'.format(alt_ntp_servers)]
3707 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3708 '@@0@'.format(time_epoch)).stdout().strip()
3710 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3713 'static libsystemd: @0@'.format(static_libsystemd),
3714 'static libudev: @0@'.format(static_libudev)]
3717 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3718 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3719 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3721 if conf.get('ENABLE_EFI') == 1
3722 status += 'efi arch: @0@'.format(efi_arch)
3726 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3727 'EFI CC @0@'.format(' '.join(efi_cc)),
3728 'EFI lds: @0@'.format(efi_lds),
3729 'EFI crt0: @0@'.format(efi_crt0),
3730 'EFI include directory: @0@'.format(efi_incdir)]
3765 ['compat-mutable-uid-boundaries'],
3796 ['DNS-over-TLS(gnutls)', conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1],
3797 ['DNS-over-TLS(openssl)', conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1],
3802 ['legacy pkla', install_polkit_pkla],
3804 ['gnu-efi', have_gnu_efi],
3817 ['man pages', want_man],
3818 ['html pages', want_html],
3819 ['man page indices', want_man and have_lxml],
3824 ['adm group', get_option('adm-group')],
3825 ['wheel group', get_option('wheel-group')],
3828 ['debug mmap cache'],
3830 ['valgrind', conf.get('VALGRIND') == 1],
3831 ['trace logging', conf.get('LOG_TRACE') == 1],
3832 ['install tests', install_tests],
3833 ['link-udev-shared', get_option('link-udev-shared')],
3834 ['link-systemctl-shared', get_option('link-systemctl-shared')],
3835 ['link-networkd-shared', get_option('link-networkd-shared')],
3836 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
3837 ['kernel-install', get_option('kernel-install')],
3838 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
3840 ['standalone-binaries', get_option('standalone-binaries')],
3843 if tuple.length() >= 2
3846 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3847 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3848 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3859 'enabled features: @0@'.format(', '.join(found)),
3861 'disabled features: @0@'.format(', '.join(missing)),
3863 message('\n '.join(status))
3865 if rootprefixdir != rootprefix_default
3867 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3868 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3869 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))