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
400 '-fdiagnostics-show-option',
401 '-fno-strict-aliasing',
402 '-fvisibility=hidden',
404 '-fstack-protector-strong',
405 '--param=ssp-buffer-size=4',
408 # Disable -Wmaybe-unitialized when compiling with -Os/-O1/-O3/etc. There are
409 # too many false positives with gcc >= 8. Effectively, we only test with -O0
410 # and -O2; this should be enough to catch most important cases without too much
411 # busywork. See https://github.com/systemd/systemd/pull/19226.
412 if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
413 cc.version().version_compare('<10'))
414 possible_cc_flags += '-Wno-maybe-uninitialized'
417 # --as-needed and --no-undefined are provided by meson by default,
418 # run mesonconf to see what is enabled
419 possible_link_flags = [
425 if cc.get_id() == 'clang'
426 possible_cc_flags += [
427 '-Wno-typedef-redefinition',
428 '-Wno-gnu-variable-sized-type-not-at-end',
432 if get_option('buildtype') != 'debug'
433 possible_cc_flags += [
434 '-ffunction-sections',
438 possible_link_flags += '-Wl,--gc-sections'
441 add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
442 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
443 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
445 have = cc.has_argument('-Wzero-length-bounds')
446 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
450 #include <inttypes.h>
451 typedef uint64_t usec_t;
452 usec_t now(clockid_t clock);
457 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
458 add_project_arguments('-Werror=shadow', language : 'c')
462 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
465 cpp = ' '.join(cc.cmd_array()) + ' -E'
467 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
469 #####################################################################
470 # compilation result tests
472 conf.set('_GNU_SOURCE', true)
473 conf.set('__SANE_USERSPACE_TYPES__', true)
474 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
476 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
477 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
478 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
479 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
483 #include <sys/stat.h>
486 foreach decl : ['char16_t',
491 # We get -1 if the size cannot be determined
492 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
494 if decl == 'struct statx'
496 want_linux_stat_h = false
498 have = cc.sizeof(decl,
499 prefix : decl_headers + '#include <linux/stat.h>',
500 args : '-D_GNU_SOURCE') > 0
501 want_linux_stat_h = have
505 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
508 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
510 foreach ident : ['secure_getenv', '__secure_getenv']
511 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
515 ['memfd_create', '''#include <sys/mman.h>'''],
516 ['gettid', '''#include <sys/types.h>
517 #include <unistd.h>'''],
518 ['pivot_root', '''#include <stdlib.h>
519 #include <unistd.h>'''], # no known header declares pivot_root
520 ['name_to_handle_at', '''#include <sys/types.h>
521 #include <sys/stat.h>
522 #include <fcntl.h>'''],
523 ['setns', '''#include <sched.h>'''],
524 ['renameat2', '''#include <stdio.h>
525 #include <fcntl.h>'''],
526 ['kcmp', '''#include <linux/kcmp.h>'''],
527 ['keyctl', '''#include <sys/types.h>
528 #include <keyutils.h>'''],
529 ['copy_file_range', '''#include <sys/syscall.h>
530 #include <unistd.h>'''],
531 ['bpf', '''#include <sys/syscall.h>
532 #include <unistd.h>'''],
533 ['statx', '''#include <sys/types.h>
534 #include <sys/stat.h>
535 #include <unistd.h>'''],
536 ['explicit_bzero' , '''#include <string.h>'''],
537 ['reallocarray', '''#include <stdlib.h>'''],
538 ['set_mempolicy', '''#include <stdlib.h>
539 #include <unistd.h>'''],
540 ['get_mempolicy', '''#include <stdlib.h>
541 #include <unistd.h>'''],
542 ['pidfd_send_signal', '''#include <stdlib.h>
545 #include <sys/wait.h>'''],
546 ['pidfd_open', '''#include <stdlib.h>
549 #include <sys/wait.h>'''],
550 ['rt_sigqueueinfo', '''#include <stdlib.h>
553 #include <sys/wait.h>'''],
554 ['mallinfo', '''#include <malloc.h>'''],
555 ['execveat', '''#include <unistd.h>'''],
556 ['close_range', '''#include <unistd.h>'''],
557 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
560 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
561 conf.set10('HAVE_' + ident[0].to_upper(), have)
564 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
565 conf.set10('USE_SYS_RANDOM_H', true)
566 conf.set10('HAVE_GETRANDOM', true)
568 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
569 conf.set10('USE_SYS_RANDOM_H', false)
570 conf.set10('HAVE_GETRANDOM', have)
573 #####################################################################
575 version_tag = get_option('version-tag')
577 vcs_data = configuration_data()
578 vcs_data.set('VCS_TAG', version_tag)
579 version_h = configure_file(configuration : vcs_data,
580 input : 'src/version/version.h.in',
581 output : 'version.h')
584 project_source_root + '/tools/meson-vcs-tag.sh',
586 meson.project_version()]
589 input : 'src/version/version.h.in',
590 output : 'version.h',
594 versiondep = declare_dependency(sources: version_h)
596 sed = find_program('sed')
597 awk = find_program('awk')
598 m4 = find_program('m4')
599 stat = find_program('stat')
600 git = find_program('git', required : false)
601 env = find_program('env')
602 perl = find_program('perl', required : false)
604 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
605 mkdir_p = 'mkdir -p $DESTDIR/@0@'
606 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
607 splash_bmp = files('test/splash.bmp')
609 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
610 # /usr/sbin, /sbin, and fall back to the default from middle column.
611 progs = [['quotaon', '/usr/sbin/quotaon' ],
612 ['quotacheck', '/usr/sbin/quotacheck' ],
613 ['kmod', '/usr/bin/kmod' ],
614 ['kexec', '/usr/sbin/kexec' ],
615 ['sulogin', '/usr/sbin/sulogin' ],
616 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
617 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
618 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
619 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
620 ['nologin', '/usr/sbin/nologin', ],
623 path = get_option(prog[0] + '-path')
625 message('Using @1@ for @0@'.format(prog[0], path))
627 exe = find_program(prog[0],
628 '/usr/sbin/' + prog[0],
631 path = exe.found() ? exe.path() : prog[1]
633 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
634 conf.set_quoted(name, path)
635 substs.set(name, path)
638 conf.set_quoted('TELINIT', get_option('telinit-path'))
640 if run_command('ln', '--relative', '--help').returncode() != 0
641 error('ln does not support --relative (added in coreutils 8.16)')
644 ############################################################
646 gperf = find_program('gperf')
648 gperf_test_format = '''
650 const char * in_word_set(const char *, @0@);
653 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
654 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
655 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
656 if cc.compiles(gperf_test)
657 gperf_len_type = 'size_t'
659 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
660 if cc.compiles(gperf_test)
661 gperf_len_type = 'unsigned'
663 error('unable to determine gperf len type')
666 message('gperf len type is @0@'.format(gperf_len_type))
667 conf.set('GPERF_LEN_TYPE', gperf_len_type,
668 description : 'The type of gperf "len" parameter')
670 ############################################################
672 if not cc.has_header('sys/capability.h')
673 error('POSIX caps headers not found')
675 foreach header : ['crypt.h',
677 'linux/vm_sockets.h',
679 'valgrind/memcheck.h',
680 'valgrind/valgrind.h',
681 'linux/time_types.h',
684 conf.set10('HAVE_' + header.underscorify().to_upper(),
685 cc.has_header(header))
688 ############################################################
690 fallback_hostname = get_option('fallback-hostname')
691 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
692 error('Invalid fallback-hostname configuration')
693 # A more extensive test is done in test-hostname-util. Let's catch
694 # the most obvious errors here so we don't fail with an assert later.
696 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
698 default_hierarchy = get_option('default-hierarchy')
699 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
700 description : 'default cgroup hierarchy as string')
701 if default_hierarchy == 'legacy'
702 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
703 elif default_hierarchy == 'hybrid'
704 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
706 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
709 default_net_naming_scheme = get_option('default-net-naming-scheme')
710 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
712 time_epoch = get_option('time-epoch')
714 time_epoch = run_command('sh', ['-c', 'echo "$SOURCE_DATE_EPOCH"']).stdout().strip()
715 if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
716 # If we're in a git repository, use the creation time of the latest git tag.
717 latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
718 time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout()
722 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
724 time_epoch = time_epoch.to_int()
726 conf.set('TIME_EPOCH', time_epoch)
728 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
729 ['system-uid-max', 'SYS_UID_MAX', 999],
730 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
731 ['system-gid-max', 'SYS_GID_MAX', 999]]
732 v = get_option(tuple[0])
736 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
737 '/etc/login.defs').stdout().strip()
744 conf.set(tuple[0].underscorify().to_upper(), v)
745 substs.set(tuple[0].underscorify().to_upper(), v)
747 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
748 error('Invalid uid allocation range')
750 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
751 error('Invalid gid allocation range')
754 dynamic_uid_min = get_option('dynamic-uid-min')
755 dynamic_uid_max = get_option('dynamic-uid-max')
756 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
757 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
758 substs.set('dynamicuidmin', dynamic_uid_min)
759 substs.set('dynamicuidmax', dynamic_uid_max)
761 container_uid_base_min = get_option('container-uid-base-min')
762 container_uid_base_max = get_option('container-uid-base-max')
763 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
764 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
765 substs.set('containeruidbasemin', container_uid_base_min)
766 substs.set('containeruidbasemax', container_uid_base_max)
768 nobody_user = get_option('nobody-user')
769 nobody_group = get_option('nobody-group')
771 if not meson.is_cross_build()
772 getent_result = run_command('getent', 'passwd', '65534')
773 if getent_result.returncode() == 0
774 name = getent_result.stdout().split(':')[0]
775 if name != nobody_user
777 '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) +
778 'Your build will result in an user table setup that is incompatible with the local system.')
781 id_result = run_command('id', '-u', nobody_user)
782 if id_result.returncode() == 0
783 id = id_result.stdout().to_int()
786 '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) +
787 'Your build will result in an user table setup that is incompatible with the local system.')
791 getent_result = run_command('getent', 'group', '65534')
792 if getent_result.returncode() == 0
793 name = getent_result.stdout().split(':')[0]
794 if name != nobody_group
796 '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) +
797 'Your build will result in an group table setup that is incompatible with the local system.')
800 id_result = run_command('id', '-g', nobody_group)
801 if id_result.returncode() == 0
802 id = id_result.stdout().to_int()
805 '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) +
806 'Your build will result in an group table setup that is incompatible with the local system.')
810 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
812 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
813 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
816 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
817 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
818 substs.set('NOBODY_USER_NAME', nobody_user)
819 substs.set('NOBODY_GROUP_NAME', nobody_group)
821 tty_gid = get_option('tty-gid')
822 conf.set('TTY_GID', tty_gid)
823 substs.set('TTY_GID', tty_gid)
825 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
826 users_gid = get_option('users-gid')
827 substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid)
829 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
830 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
832 dev_kvm_mode = get_option('dev-kvm-mode')
833 substs.set('DEV_KVM_MODE', dev_kvm_mode)
834 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
835 group_render_mode = get_option('group-render-mode')
836 substs.set('GROUP_RENDER_MODE', group_render_mode)
837 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
839 kill_user_processes = get_option('default-kill-user-processes')
840 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
841 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
842 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
844 dns_servers = get_option('dns-servers')
845 conf.set_quoted('DNS_SERVERS', dns_servers)
846 substs.set('DNS_SERVERS', dns_servers)
848 ntp_servers = get_option('ntp-servers')
849 conf.set_quoted('NTP_SERVERS', ntp_servers)
850 substs.set('NTP_SERVERS', ntp_servers)
852 default_locale = get_option('default-locale')
853 if default_locale == ''
854 if not meson.is_cross_build()
855 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
856 default_locale = run_command(choose_default_locale_sh).stdout().strip()
858 default_locale = 'C.UTF-8'
861 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
863 localegen_path = get_option('localegen-path')
866 if localegen_path != ''
867 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
869 writable = ' /usr/lib/locale'
871 substs.set('SERVICE_LOCALEGEN_WRITABLE', writable)
872 conf.set10('HAVE_LOCALEGEN', have)
874 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
876 service_watchdog = get_option('service-watchdog')
877 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
878 substs.set('SERVICE_WATCHDOG', watchdog_value)
880 substs.set('SUSHELL', get_option('debug-shell'))
881 substs.set('DEBUGTTY', get_option('debug-tty'))
882 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
884 enable_debug_hashmap = false
885 enable_debug_mmap_cache = false
886 enable_debug_siphash = false
887 foreach name : get_option('debug-extra')
889 enable_debug_hashmap = true
890 elif name == 'mmap-cache'
891 enable_debug_mmap_cache = true
892 elif name == 'siphash'
893 enable_debug_siphash = true
895 message('unknown debug option "@0@", ignoring'.format(name))
898 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
899 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
900 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
902 conf.set10('VALGRIND', get_option('valgrind'))
903 conf.set10('LOG_TRACE', get_option('log-trace'))
905 default_user_path = get_option('user-path')
906 if default_user_path != ''
907 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
908 default_user_path_display = default_user_path
910 # meson 0.49 fails when ?: is used in .format()
911 default_user_path_display = '(same as system services)'
915 #####################################################################
917 threads = dependency('threads')
918 librt = cc.find_library('rt')
919 libm = cc.find_library('m')
920 libdl = cc.find_library('dl')
921 libcrypt = cc.find_library('crypt')
923 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
925 ['crypt_ra', crypt_header],
926 ['crypt_preferred_method', crypt_header],
927 ['crypt_gensalt_ra', crypt_header]]
929 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
930 dependencies : libcrypt)
931 conf.set10('HAVE_' + ident[0].to_upper(), have)
934 libcap = dependency('libcap', required : false)
935 if not libcap.found()
936 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
937 libcap = cc.find_library('cap')
940 libmount = dependency('mount',
941 version : fuzzer_build ? '>= 0' : '>= 2.30')
943 want_libfdisk = get_option('fdisk')
944 if want_libfdisk != 'false' and not skip_deps
945 libfdisk = dependency('fdisk',
947 required : want_libfdisk == 'true')
948 have = libfdisk.found()
953 conf.set10('HAVE_LIBFDISK', have)
955 want_pwquality = get_option('pwquality')
956 if want_pwquality != 'false' and not skip_deps
957 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
958 have = libpwquality.found()
963 conf.set10('HAVE_PWQUALITY', have)
965 want_seccomp = get_option('seccomp')
966 if want_seccomp != 'false' and not skip_deps
967 libseccomp = dependency('libseccomp',
968 version : '>= 2.3.1',
969 required : want_seccomp == 'true')
970 have = libseccomp.found()
975 conf.set10('HAVE_SECCOMP', have)
977 want_selinux = get_option('selinux')
978 if want_selinux != 'false' and not skip_deps
979 libselinux = dependency('libselinux',
980 version : '>= 2.1.9',
981 required : want_selinux == 'true')
982 have = libselinux.found()
987 conf.set10('HAVE_SELINUX', have)
989 want_apparmor = get_option('apparmor')
990 if want_apparmor != 'false' and not skip_deps
991 libapparmor = dependency('libapparmor',
993 required : want_apparmor == 'true')
994 have = libapparmor.found()
999 conf.set10('HAVE_APPARMOR', have)
1001 smack_run_label = get_option('smack-run-label')
1002 if smack_run_label != ''
1003 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
1006 want_polkit = get_option('polkit')
1007 install_polkit = false
1008 install_polkit_pkla = false
1009 if want_polkit != 'false' and not skip_deps
1010 install_polkit = true
1012 libpolkit = dependency('polkit-gobject-1',
1014 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1015 message('Old polkit detected, will install pkla files')
1016 install_polkit_pkla = true
1019 conf.set10('ENABLE_POLKIT', install_polkit)
1021 want_acl = get_option('acl')
1022 if want_acl != 'false' and not skip_deps
1023 libacl = cc.find_library('acl', required : want_acl == 'true')
1024 have = libacl.found()
1029 conf.set10('HAVE_ACL', have)
1031 want_audit = get_option('audit')
1032 if want_audit != 'false' and not skip_deps
1033 libaudit = dependency('audit', required : want_audit == 'true')
1034 have = libaudit.found()
1039 conf.set10('HAVE_AUDIT', have)
1041 want_blkid = get_option('blkid')
1042 if want_blkid != 'false' and not skip_deps
1043 libblkid = dependency('blkid', required : want_blkid == 'true')
1044 have = libblkid.found()
1046 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1047 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1052 conf.set10('HAVE_BLKID', have)
1054 want_kmod = get_option('kmod')
1055 if want_kmod != 'false' and not skip_deps
1056 libkmod = dependency('libkmod',
1058 required : want_kmod == 'true')
1059 have = libkmod.found()
1064 conf.set10('HAVE_KMOD', have)
1066 want_pam = get_option('pam')
1067 if want_pam != 'false' and not skip_deps
1068 libpam = cc.find_library('pam', required : want_pam == 'true')
1069 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1070 have = libpam.found() and libpam_misc.found()
1076 conf.set10('HAVE_PAM', have)
1078 want_microhttpd = get_option('microhttpd')
1079 if want_microhttpd != 'false' and not skip_deps
1080 libmicrohttpd = dependency('libmicrohttpd',
1081 version : '>= 0.9.33',
1082 required : want_microhttpd == 'true')
1083 have = libmicrohttpd.found()
1088 conf.set10('HAVE_MICROHTTPD', have)
1090 want_libcryptsetup = get_option('libcryptsetup')
1091 if want_libcryptsetup != 'false' and not skip_deps
1092 libcryptsetup = dependency('libcryptsetup',
1093 version : '>= 2.0.1',
1094 required : want_libcryptsetup == 'true')
1095 have = libcryptsetup.found()
1097 conf.set10('HAVE_CRYPT_SET_METADATA_SIZE',
1098 have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup))
1099 conf.set10('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY',
1100 have and cc.has_function('crypt_activate_by_signed_key', dependencies : libcryptsetup))
1101 conf.set10('HAVE_CRYPT_TOKEN_MAX',
1102 have and cc.has_function('crypt_token_max', dependencies : libcryptsetup))
1107 conf.set10('HAVE_LIBCRYPTSETUP', have)
1109 want_libcurl = get_option('libcurl')
1110 if want_libcurl != 'false' and not skip_deps
1111 libcurl = dependency('libcurl',
1112 version : '>= 7.32.0',
1113 required : want_libcurl == 'true')
1114 have = libcurl.found()
1119 conf.set10('HAVE_LIBCURL', have)
1120 conf.set10('CURL_NO_OLDIES', get_option('mode') == 'developer')
1122 want_libidn = get_option('libidn')
1123 want_libidn2 = get_option('libidn2')
1124 if want_libidn == 'true' and want_libidn2 == 'true'
1125 error('libidn and libidn2 cannot be requested simultaneously')
1128 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1129 libidn = dependency('libidn2',
1130 required : want_libidn2 == 'true')
1131 have = libidn.found()
1136 conf.set10('HAVE_LIBIDN2', have)
1137 if not have and want_libidn != 'false' and not skip_deps
1138 # libidn is used for both libidn and libidn2 objects
1139 libidn = dependency('libidn',
1140 required : want_libidn == 'true')
1141 have = libidn.found()
1145 conf.set10('HAVE_LIBIDN', have)
1147 want_libiptc = get_option('libiptc')
1148 if want_libiptc != 'false' and not skip_deps
1149 libiptc = dependency('libiptc',
1150 required : want_libiptc == 'true')
1151 have = libiptc.found()
1156 conf.set10('HAVE_LIBIPTC', have)
1158 want_qrencode = get_option('qrencode')
1159 if want_qrencode != 'false' and not skip_deps
1160 libqrencode = dependency('libqrencode',
1162 required : want_qrencode == 'true')
1163 have = libqrencode.found()
1168 conf.set10('HAVE_QRENCODE', have)
1170 want_gcrypt = get_option('gcrypt')
1171 if want_gcrypt != 'false' and not skip_deps
1172 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1173 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1174 have = libgcrypt.found() and libgpg_error.found()
1179 # link to neither of the libs if one is not found
1183 conf.set10('HAVE_GCRYPT', have)
1185 want_gnutls = get_option('gnutls')
1186 if want_gnutls != 'false' and not skip_deps
1187 libgnutls = dependency('gnutls',
1188 version : '>= 3.1.4',
1189 required : want_gnutls == 'true')
1190 have = libgnutls.found()
1195 conf.set10('HAVE_GNUTLS', have)
1197 want_openssl = get_option('openssl')
1198 if want_openssl != 'false' and not skip_deps
1199 libopenssl = dependency('openssl',
1200 version : '>= 1.1.0',
1201 required : want_openssl == 'true')
1202 have = libopenssl.found()
1207 conf.set10('HAVE_OPENSSL', have)
1209 want_p11kit = get_option('p11kit')
1210 if want_p11kit != 'false' and not skip_deps
1211 libp11kit = dependency('p11-kit-1',
1212 version : '>= 0.23.3',
1213 required : want_p11kit == 'true')
1214 have = libp11kit.found()
1219 conf.set10('HAVE_P11KIT', have)
1221 want_libfido2 = get_option('libfido2')
1222 if want_libfido2 != 'false' and not skip_deps
1223 libfido2 = dependency('libfido2',
1224 required : want_libfido2 == 'true')
1225 have = libfido2.found()
1230 conf.set10('HAVE_LIBFIDO2', have)
1232 want_tpm2 = get_option('tpm2')
1233 if want_tpm2 != 'false' and not skip_deps
1234 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1235 required : want_tpm2 == 'true')
1241 conf.set10('HAVE_TPM2', have)
1243 want_elfutils = get_option('elfutils')
1244 if want_elfutils != 'false' and not skip_deps
1245 libdw = dependency('libdw',
1246 required : want_elfutils == 'true')
1247 have = libdw.found()
1252 conf.set10('HAVE_ELFUTILS', have)
1254 want_zlib = get_option('zlib')
1255 if want_zlib != 'false' and not skip_deps
1256 libz = dependency('zlib',
1257 required : want_zlib == 'true')
1263 conf.set10('HAVE_ZLIB', have)
1265 want_bzip2 = get_option('bzip2')
1266 if want_bzip2 != 'false' and not skip_deps
1267 libbzip2 = cc.find_library('bz2',
1268 required : want_bzip2 == 'true')
1269 have = libbzip2.found()
1274 conf.set10('HAVE_BZIP2', have)
1276 want_xz = get_option('xz')
1277 if want_xz != 'false' and not skip_deps
1278 libxz = dependency('liblzma',
1279 required : want_xz == 'true')
1280 have_xz = libxz.found()
1285 conf.set10('HAVE_XZ', have_xz)
1287 want_lz4 = get_option('lz4')
1288 if want_lz4 != 'false' and not skip_deps
1289 liblz4 = dependency('liblz4',
1290 version : '>= 1.3.0',
1291 required : want_lz4 == 'true')
1292 have_lz4 = liblz4.found()
1297 conf.set10('HAVE_LZ4', have_lz4)
1299 want_zstd = get_option('zstd')
1300 if want_zstd != 'false' and not skip_deps
1301 libzstd = dependency('libzstd',
1302 required : want_zstd == 'true',
1303 version : '>= 1.4.0')
1304 have_zstd = libzstd.found()
1309 conf.set10('HAVE_ZSTD', have_zstd)
1311 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1313 want_xkbcommon = get_option('xkbcommon')
1314 if want_xkbcommon != 'false' and not skip_deps
1315 libxkbcommon = dependency('xkbcommon',
1316 version : '>= 0.3.0',
1317 required : want_xkbcommon == 'true')
1318 have = libxkbcommon.found()
1323 conf.set10('HAVE_XKBCOMMON', have)
1325 want_pcre2 = get_option('pcre2')
1326 if want_pcre2 != 'false'
1327 libpcre2 = dependency('libpcre2-8',
1328 required : want_pcre2 == 'true')
1329 have = libpcre2.found()
1334 conf.set10('HAVE_PCRE2', have)
1336 want_glib = get_option('glib')
1337 if want_glib != 'false' and not skip_deps
1338 libglib = dependency('glib-2.0',
1339 version : '>= 2.22.0',
1340 required : want_glib == 'true')
1341 libgobject = dependency('gobject-2.0',
1342 version : '>= 2.22.0',
1343 required : want_glib == 'true')
1344 libgio = dependency('gio-2.0',
1345 required : want_glib == 'true')
1346 have = libglib.found() and libgobject.found() and libgio.found()
1353 conf.set10('HAVE_GLIB', have)
1355 want_dbus = get_option('dbus')
1356 if want_dbus != 'false' and not skip_deps
1357 libdbus = dependency('dbus-1',
1358 version : '>= 1.3.2',
1359 required : want_dbus == 'true')
1360 have = libdbus.found()
1365 conf.set10('HAVE_DBUS', have)
1367 default_dnssec = get_option('default-dnssec')
1369 default_dnssec = 'no'
1371 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1372 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1373 default_dnssec = 'no'
1375 conf.set('DEFAULT_DNSSEC_MODE',
1376 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1377 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1379 dns_over_tls = get_option('dns-over-tls')
1380 if dns_over_tls != 'false'
1381 if dns_over_tls == 'openssl'
1384 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
1385 if dns_over_tls == 'gnutls' and not have_gnutls
1386 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1389 if dns_over_tls == 'gnutls' or have_gnutls
1390 have_openssl = false
1392 have_openssl = conf.get('HAVE_OPENSSL') == 1
1393 if dns_over_tls != 'auto' and not have_openssl
1394 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
1395 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1398 have = have_gnutls or have_openssl
1402 have_openssl = false
1404 conf.set10('ENABLE_DNS_OVER_TLS', have)
1405 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1406 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1408 default_dns_over_tls = get_option('default-dns-over-tls')
1410 default_dns_over_tls = 'no'
1412 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1413 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.')
1414 default_dns_over_tls = 'no'
1416 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1417 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1418 substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls)
1420 default_mdns = get_option('default-mdns')
1421 conf.set('DEFAULT_MDNS_MODE',
1422 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1423 substs.set('DEFAULT_MDNS_MODE', default_mdns)
1425 default_llmnr = get_option('default-llmnr')
1426 conf.set('DEFAULT_LLMNR_MODE',
1427 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1428 substs.set('DEFAULT_LLMNR_MODE', default_llmnr)
1430 want_repart = get_option('repart')
1431 if want_repart != 'false'
1432 have = (conf.get('HAVE_OPENSSL') == 1 and
1433 conf.get('HAVE_LIBFDISK') == 1)
1434 if want_repart == 'true' and not have
1435 error('repart support was requested, but dependencies are not available')
1440 conf.set10('ENABLE_REPART', have)
1442 want_importd = get_option('importd')
1443 if want_importd != 'false'
1444 have = (conf.get('HAVE_LIBCURL') == 1 and
1445 conf.get('HAVE_ZLIB') == 1 and
1446 conf.get('HAVE_XZ') == 1 and
1447 conf.get('HAVE_GCRYPT') == 1)
1448 if want_importd == 'true' and not have
1449 error('importd support was requested, but dependencies are not available')
1454 conf.set10('ENABLE_IMPORTD', have)
1456 want_homed = get_option('homed')
1457 if want_homed != 'false'
1458 have = (conf.get('HAVE_OPENSSL') == 1 and
1459 conf.get('HAVE_LIBFDISK') == 1 and
1460 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1461 if want_homed == 'true' and not have
1462 error('homed support was requested, but dependencies are not available')
1467 conf.set10('ENABLE_HOMED', have)
1469 have = have and conf.get('HAVE_PAM') == 1
1470 conf.set10('ENABLE_PAM_HOME', have)
1472 have = get_option('oomd')
1473 conf.set10('ENABLE_OOMD', have)
1474 substs.set10('ENABLE_OOMD', have)
1476 want_remote = get_option('remote')
1477 if want_remote != 'false'
1478 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1479 conf.get('HAVE_LIBCURL') == 1]
1480 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1481 # it's possible to build one without the other. Complain only if
1482 # support was explicitly requested. The auxiliary files like sysusers
1483 # config should be installed when any of the programs are built.
1484 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1485 error('remote support was requested, but dependencies are not available')
1487 have = have_deps[0] or have_deps[1]
1491 conf.set10('ENABLE_REMOTE', have)
1493 foreach term : ['analyze',
1507 'compat-mutable-uid-boundaries',
1533 have = get_option(term)
1534 name = 'ENABLE_' + term.underscorify().to_upper()
1535 conf.set10(name, have)
1536 substs.set10(name, have)
1539 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1541 foreach tuple : [['nss-mymachines', 'machined'],
1542 ['nss-resolve', 'resolve']]
1543 want = get_option(tuple[0])
1545 have = get_option(tuple[1])
1546 if want == 'true' and not have
1547 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1552 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1553 conf.set10(name, have)
1557 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1558 'ENABLE_NSS_MYMACHINES',
1559 'ENABLE_NSS_RESOLVE',
1560 'ENABLE_NSS_SYSTEMD']
1561 if conf.get(term) == 1
1565 conf.set10('ENABLE_NSS', enable_nss)
1567 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1569 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1571 #####################################################################
1573 if get_option('efi')
1574 efi_arch = host_machine.cpu_family()
1576 if efi_arch == 'x86'
1577 EFI_MACHINE_TYPE_NAME = 'ia32'
1578 gnu_efi_arch = 'ia32'
1579 elif efi_arch == 'x86_64'
1580 EFI_MACHINE_TYPE_NAME = 'x64'
1581 gnu_efi_arch = 'x86_64'
1582 elif efi_arch == 'arm'
1583 EFI_MACHINE_TYPE_NAME = 'arm'
1584 gnu_efi_arch = 'arm'
1585 elif efi_arch == 'aarch64'
1586 EFI_MACHINE_TYPE_NAME = 'aa64'
1587 gnu_efi_arch = 'aarch64'
1589 EFI_MACHINE_TYPE_NAME = ''
1594 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1596 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
1600 conf.set10('ENABLE_EFI', have)
1602 ############################################################
1604 generate_gperfs = find_program('tools/generate-gperfs.py')
1605 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1606 make_directive_index_py = find_program('tools/make-directive-index.py')
1607 make_man_index_py = find_program('tools/make-man-index.py')
1608 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1609 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1610 update_hwdb_sh = find_program('tools/update-hwdb.sh')
1611 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1612 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1613 xml_helper_py = find_program('tools/xml_helper.py')
1615 #####################################################################
1617 config_h = configure_file(
1618 output : 'config.h',
1619 configuration : conf)
1621 add_project_arguments('-include', 'config.h', language : 'c')
1623 ############################################################
1625 # binaries that have --help and are intended for use by humans,
1626 # usually, but not always, installed in /bin.
1627 public_programs = []
1632 basic_includes = include_directories(
1638 libsystemd_includes = [basic_includes, include_directories(
1639 'src/libsystemd/sd-bus',
1640 'src/libsystemd/sd-device',
1641 'src/libsystemd/sd-event',
1642 'src/libsystemd/sd-hwdb',
1643 'src/libsystemd/sd-id128',
1644 'src/libsystemd/sd-journal',
1645 'src/libsystemd/sd-netlink',
1646 'src/libsystemd/sd-network',
1647 'src/libsystemd/sd-resolve')]
1649 includes = [libsystemd_includes, include_directories('src/shared')]
1653 subdir('src/fundamental')
1655 subdir('src/libsystemd')
1656 subdir('src/shared')
1658 subdir('src/libudev')
1660 libsystemd = shared_library(
1663 version : libsystemd_version,
1664 include_directories : libsystemd_includes,
1665 link_args : ['-shared',
1666 '-Wl,--version-script=' + libsystemd_sym_path],
1667 link_with : [libbasic,
1669 link_whole : [libsystemd_static],
1670 dependencies : [threads,
1675 link_depends : libsystemd_sym,
1677 install_dir : rootlibdir)
1679 install_libsystemd_static = static_library(
1683 basic_gcrypt_sources,
1684 fundamental_sources,
1686 include_directories : libsystemd_includes,
1687 build_by_default : static_libsystemd != 'false',
1688 install : static_libsystemd != 'false',
1689 install_dir : rootlibdir,
1690 pic : static_libsystemd_pic,
1691 dependencies : [threads,
1701 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1703 libudev = shared_library(
1706 version : libudev_version,
1707 include_directories : includes,
1708 link_args : ['-shared',
1709 '-Wl,--version-script=' + libudev_sym_path],
1710 link_with : [libsystemd_static, libshared_static],
1711 link_whole : libudev_basic,
1712 dependencies : [threads],
1713 link_depends : libudev_sym,
1715 install_dir : rootlibdir)
1717 install_libudev_static = static_library(
1720 fundamental_sources,
1725 include_directories : includes,
1726 build_by_default : static_libudev != 'false',
1727 install : static_libudev != 'false',
1728 install_dir : rootlibdir,
1729 link_depends : libudev_sym,
1730 dependencies : libshared_deps + [libmount],
1731 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1732 pic : static_libudev_pic)
1734 ############################################################
1736 # systemd-analyze requires 'libcore'
1738 # systemd-journal-remote requires 'libjournal_core'
1739 subdir('src/journal')
1740 # systemd-networkd requires 'libsystemd_network'
1741 subdir('src/libsystemd-network')
1743 subdir('src/analyze')
1744 subdir('src/boot/efi')
1745 subdir('src/busctl')
1746 subdir('src/coredump')
1747 subdir('src/cryptenroll')
1748 subdir('src/cryptsetup')
1750 subdir('src/hostname')
1751 subdir('src/import')
1752 subdir('src/journal-remote')
1753 subdir('src/kernel-install')
1754 subdir('src/locale')
1756 subdir('src/machine')
1757 subdir('src/network')
1758 subdir('src/nspawn')
1760 subdir('src/partition')
1761 subdir('src/portable')
1762 subdir('src/pstore')
1763 subdir('src/resolve')
1765 subdir('src/shutdown')
1766 subdir('src/sysext')
1767 subdir('src/systemctl')
1768 subdir('src/timedate')
1769 subdir('src/timesync')
1770 subdir('src/tmpfiles')
1771 subdir('src/userdb')
1772 subdir('src/vconsole')
1773 subdir('src/xdg-autostart-generator')
1775 subdir('src/systemd')
1782 ############################################################
1784 # only static linking apart from libdl, to make sure that the
1785 # module is linked to all libraries that it uses.
1786 test_dlopen = executable(
1790 include_directories : includes,
1791 link_with : [libbasic],
1792 dependencies : [libdl],
1793 build_by_default : want_tests != 'false')
1795 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
1796 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
1797 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
1798 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
1800 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1804 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1805 version_script_arg = join_paths(project_source_root, sym)
1807 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
1808 if tuple.length() > 2
1809 foreach s : tuple[2]
1810 sources += ['src/nss-@0@/@1@'.format(module, s)]
1814 incs = tuple.length() > 3 ? tuple[3] : includes
1816 nss = shared_library(
1821 include_directories : incs,
1822 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1823 link_args : ['-Wl,-z,nodelete',
1825 '-Wl,--version-script=' + version_script_arg],
1826 link_with : [libsystemd_static,
1829 dependencies : [threads,
1833 install_dir : rootlibdir)
1835 # We cannot use shared_module because it does not support version suffix.
1836 # Unfortunately shared_library insists on creating the symlink…
1837 meson.add_install_script('sh', '-c',
1838 'rm $DESTDIR@0@/libnss_@1@.so'
1839 .format(rootlibdir, module))
1841 if want_tests != 'false'
1842 test('dlopen-nss_' + module,
1844 # path to dlopen must include a slash
1845 args : nss.full_path())
1850 ############################################################
1855 include_directories : includes,
1856 link_with : [libcore,
1858 dependencies : [versiondep,
1865 install_rpath : rootlibexecdir,
1867 install_dir : rootlibexecdir)
1869 meson.add_install_script(meson_make_symlink,
1870 join_paths(rootlibexecdir, 'systemd'),
1871 join_paths(rootsbindir, 'init'))
1873 public_programs += executable(
1875 systemd_analyze_sources,
1876 include_directories : core_includes,
1877 link_with : [libcore,
1879 dependencies : [versiondep,
1886 install_rpath : rootlibexecdir,
1887 install : conf.get('ENABLE_ANALYZE'))
1891 systemd_journald_sources,
1892 include_directories : includes,
1893 link_with : [libjournal_core,
1895 dependencies : [threads,
1900 install_rpath : rootlibexecdir,
1902 install_dir : rootlibexecdir)
1904 public_programs += executable(
1906 systemd_cat_sources,
1907 include_directories : includes,
1908 link_with : [libjournal_core,
1910 dependencies : [threads],
1911 install_rpath : rootlibexecdir,
1914 public_programs += executable(
1917 include_directories : includes,
1918 link_with : [libshared],
1919 dependencies : [threads,
1925 install_rpath : rootlibexecdir,
1927 install_dir : rootbindir)
1930 'systemd-getty-generator',
1931 'src/getty-generator/getty-generator.c',
1932 include_directories : includes,
1933 link_with : [libshared],
1934 install_rpath : rootlibexecdir,
1936 install_dir : systemgeneratordir)
1939 'systemd-debug-generator',
1940 'src/debug-generator/debug-generator.c',
1941 include_directories : includes,
1942 link_with : [libshared],
1943 install_rpath : rootlibexecdir,
1945 install_dir : systemgeneratordir)
1948 'systemd-run-generator',
1949 'src/run-generator/run-generator.c',
1950 include_directories : includes,
1951 link_with : [libshared],
1952 install_rpath : rootlibexecdir,
1954 install_dir : systemgeneratordir)
1957 'systemd-fstab-generator',
1958 'src/fstab-generator/fstab-generator.c',
1959 include_directories : includes,
1960 link_with : [libshared],
1961 install_rpath : rootlibexecdir,
1963 install_dir : systemgeneratordir)
1965 if conf.get('ENABLE_ENVIRONMENT_D') == 1
1967 '30-systemd-environment-d-generator',
1968 'src/environment-d-generator/environment-d-generator.c',
1969 include_directories : includes,
1970 link_with : [libshared],
1971 install_rpath : rootlibexecdir,
1973 install_dir : userenvgeneratordir)
1975 meson.add_install_script(meson_make_symlink,
1976 join_paths(sysconfdir, 'environment'),
1977 join_paths(environmentdir, '99-environment.conf'))
1980 if conf.get('ENABLE_HIBERNATE') == 1
1982 'systemd-hibernate-resume-generator',
1983 'src/hibernate-resume/hibernate-resume-generator.c',
1984 include_directories : includes,
1985 link_with : [libshared],
1986 install_rpath : rootlibexecdir,
1988 install_dir : systemgeneratordir)
1991 'systemd-hibernate-resume',
1992 'src/hibernate-resume/hibernate-resume.c',
1993 include_directories : includes,
1994 link_with : [libshared],
1995 install_rpath : rootlibexecdir,
1997 install_dir : rootlibexecdir)
2000 if conf.get('HAVE_BLKID') == 1
2002 'systemd-gpt-auto-generator',
2003 'src/gpt-auto-generator/gpt-auto-generator.c',
2004 include_directories : includes,
2005 link_with : [libshared],
2006 dependencies : libblkid,
2007 install_rpath : rootlibexecdir,
2009 install_dir : systemgeneratordir)
2011 public_programs += executable(
2013 'src/dissect/dissect.c',
2014 include_directories : includes,
2015 link_with : [libshared],
2016 install_rpath : rootlibexecdir,
2020 if conf.get('ENABLE_RESOLVE') == 1
2023 systemd_resolved_sources,
2024 include_directories : resolve_includes,
2025 link_with : [libshared,
2027 libsystemd_resolve_core],
2028 dependencies : systemd_resolved_dependencies,
2029 install_rpath : rootlibexecdir,
2031 install_dir : rootlibexecdir)
2033 public_programs += executable(
2036 include_directories : includes,
2037 link_with : [libshared,
2039 libsystemd_resolve_core],
2040 dependencies : [threads,
2044 install_rpath : rootlibexecdir,
2047 meson.add_install_script(meson_make_symlink,
2048 join_paths(bindir, 'resolvectl'),
2049 join_paths(rootsbindir, 'resolvconf'))
2051 meson.add_install_script(meson_make_symlink,
2052 join_paths(bindir, 'resolvectl'),
2053 join_paths(bindir, 'systemd-resolve'))
2056 if conf.get('ENABLE_LOGIND') == 1
2059 systemd_logind_sources,
2060 include_directories : includes,
2061 link_with : [liblogind_core,
2063 dependencies : [threads,
2065 install_rpath : rootlibexecdir,
2067 install_dir : rootlibexecdir)
2069 public_programs += executable(
2072 include_directories : includes,
2073 link_with : [libshared],
2074 dependencies : [threads,
2078 install_rpath : rootlibexecdir,
2080 install_dir : rootbindir)
2082 public_programs += executable(
2084 'src/login/inhibit.c',
2085 include_directories : includes,
2086 link_with : [libshared],
2087 install_rpath : rootlibexecdir,
2089 install_dir : rootbindir)
2091 if conf.get('HAVE_PAM') == 1
2092 version_script_arg = join_paths(project_source_root, pam_systemd_sym)
2093 pam_systemd = shared_library(
2097 include_directories : includes,
2098 link_args : ['-shared',
2099 '-Wl,--version-script=' + version_script_arg],
2100 link_with : [libsystemd_static,
2102 dependencies : [threads,
2105 link_depends : pam_systemd_sym,
2107 install_dir : pamlibdir)
2109 if want_tests != 'false'
2110 test('dlopen-pam_systemd',
2112 # path to dlopen must include a slash
2113 args : pam_systemd.full_path())
2118 'systemd-user-runtime-dir',
2119 user_runtime_dir_sources,
2120 include_directories : includes,
2121 link_with : [libshared],
2122 install_rpath : rootlibexecdir,
2124 install_dir : rootlibexecdir)
2127 if conf.get('HAVE_PAM') == 1
2129 'systemd-user-sessions',
2130 'src/user-sessions/user-sessions.c',
2131 include_directories : includes,
2132 link_with : [libshared],
2133 install_rpath : rootlibexecdir,
2135 install_dir : rootlibexecdir)
2138 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
2139 public_programs += executable(
2141 'src/boot/bootctl.c',
2142 include_directories : includes,
2143 link_with : [libshared],
2144 dependencies : [libblkid],
2145 install_rpath : rootlibexecdir,
2148 public_programs += executable(
2149 'systemd-bless-boot',
2150 'src/boot/bless-boot.c',
2151 include_directories : includes,
2152 link_with : [libshared],
2153 dependencies : [libblkid],
2154 install_rpath : rootlibexecdir,
2156 install_dir : rootlibexecdir)
2159 'systemd-bless-boot-generator',
2160 'src/boot/bless-boot-generator.c',
2161 include_directories : includes,
2162 link_with : [libshared],
2163 install_rpath : rootlibexecdir,
2165 install_dir : systemgeneratordir)
2169 'systemd-boot-check-no-failures',
2170 'src/boot/boot-check-no-failures.c',
2171 include_directories : includes,
2172 link_with : [libshared],
2173 dependencies : [libblkid],
2174 install_rpath : rootlibexecdir,
2176 install_dir : rootlibexecdir)
2178 public_programs += executable(
2179 'systemd-socket-activate',
2180 'src/activate/activate.c',
2181 include_directories : includes,
2182 link_with : [libshared],
2183 dependencies : [threads],
2184 install_rpath : rootlibexecdir,
2187 public_programs += executable(
2190 include_directories : includes,
2191 link_with : systemctl_link_with,
2192 dependencies : [threads,
2198 install_rpath : rootlibexecdir,
2200 install_dir : rootbindir)
2202 if conf.get('ENABLE_PORTABLED') == 1
2204 'systemd-portabled',
2205 systemd_portabled_sources,
2206 include_directories : includes,
2207 link_with : [libshared],
2208 dependencies : [threads],
2209 install_rpath : rootlibexecdir,
2211 install_dir : rootlibexecdir)
2213 public_programs += executable(
2215 'src/portable/portablectl.c',
2216 include_directories : includes,
2217 link_with : [libshared],
2218 dependencies : [threads],
2219 install_rpath : rootlibexecdir,
2221 install_dir : rootbindir)
2224 if conf.get('ENABLE_SYSEXT') == 1
2225 public_programs += executable(
2227 systemd_sysext_sources,
2228 include_directories : includes,
2229 link_with : [libshared],
2230 install_rpath : rootlibexecdir,
2232 install_dir : rootbindir)
2235 if conf.get('ENABLE_USERDB') == 1
2238 systemd_userwork_sources,
2239 include_directories : includes,
2240 link_with : [libshared],
2241 dependencies : [threads],
2242 install_rpath : rootlibexecdir,
2244 install_dir : rootlibexecdir)
2248 systemd_userdbd_sources,
2249 include_directories : includes,
2250 link_with : [libshared],
2251 dependencies : [threads],
2252 install_rpath : rootlibexecdir,
2254 install_dir : rootlibexecdir)
2256 public_programs += executable(
2259 include_directories : includes,
2260 link_with : [libshared],
2261 dependencies : [threads],
2262 install_rpath : rootlibexecdir,
2264 install_dir : rootbindir)
2267 if conf.get('ENABLE_HOMED') == 1
2270 systemd_homework_sources,
2271 include_directories : includes,
2272 link_with : [libshared],
2273 dependencies : [threads,
2280 install_rpath : rootlibexecdir,
2282 install_dir : rootlibexecdir)
2286 systemd_homed_sources,
2287 include_directories : home_includes,
2288 link_with : [libshared],
2289 dependencies : [threads,
2292 install_rpath : rootlibexecdir,
2294 install_dir : rootlibexecdir)
2296 public_programs += executable(
2299 include_directories : includes,
2300 link_with : [libshared],
2301 dependencies : [threads,
2306 install_rpath : rootlibexecdir,
2308 install_dir : rootbindir)
2310 if conf.get('HAVE_PAM') == 1
2311 version_script_arg = join_paths(project_source_root, pam_systemd_home_sym)
2312 pam_systemd = shared_library(
2316 include_directories : includes,
2317 link_args : ['-shared',
2318 '-Wl,--version-script=' + version_script_arg],
2319 link_with : [libsystemd_static,
2321 dependencies : [threads,
2325 link_depends : pam_systemd_home_sym,
2327 install_dir : pamlibdir)
2331 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2332 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2333 meson.add_install_script(meson_make_symlink,
2334 join_paths(rootbindir, 'systemctl'),
2335 join_paths(rootsbindir, alias))
2338 meson.add_install_script(meson_make_symlink,
2339 join_paths(rootbindir, 'udevadm'),
2340 join_paths(rootlibexecdir, 'systemd-udevd'))
2342 if conf.get('ENABLE_BACKLIGHT') == 1
2344 'systemd-backlight',
2345 'src/backlight/backlight.c',
2346 include_directories : includes,
2347 link_with : [libshared],
2348 install_rpath : rootlibexecdir,
2350 install_dir : rootlibexecdir)
2353 if conf.get('ENABLE_RFKILL') == 1
2356 'src/rfkill/rfkill.c',
2357 include_directories : includes,
2358 link_with : [libshared],
2359 install_rpath : rootlibexecdir,
2361 install_dir : rootlibexecdir)
2365 'systemd-system-update-generator',
2366 'src/system-update-generator/system-update-generator.c',
2367 include_directories : includes,
2368 link_with : [libshared],
2369 install_rpath : rootlibexecdir,
2371 install_dir : systemgeneratordir)
2373 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2375 'systemd-cryptsetup',
2376 systemd_cryptsetup_sources,
2377 include_directories : includes,
2378 link_with : [libshared],
2379 dependencies : [libcryptsetup,
2381 install_rpath : rootlibexecdir,
2383 install_dir : rootlibexecdir)
2386 'systemd-cryptsetup-generator',
2387 'src/cryptsetup/cryptsetup-generator.c',
2388 include_directories : includes,
2389 link_with : [libshared],
2390 install_rpath : rootlibexecdir,
2392 install_dir : systemgeneratordir)
2395 'systemd-veritysetup',
2396 'src/veritysetup/veritysetup.c',
2397 include_directories : includes,
2398 link_with : [libshared],
2399 dependencies : [libcryptsetup],
2400 install_rpath : rootlibexecdir,
2402 install_dir : rootlibexecdir)
2405 'systemd-veritysetup-generator',
2406 'src/veritysetup/veritysetup-generator.c',
2407 include_directories : includes,
2408 link_with : [libshared],
2409 install_rpath : rootlibexecdir,
2411 install_dir : systemgeneratordir)
2414 'systemd-cryptenroll',
2415 systemd_cryptenroll_sources,
2416 include_directories : includes,
2417 link_with : [libshared],
2418 dependencies : [libcryptsetup,
2422 install_rpath : rootlibexecdir,
2426 if conf.get('HAVE_SYSV_COMPAT') == 1
2428 'systemd-sysv-generator',
2429 'src/sysv-generator/sysv-generator.c',
2430 include_directories : includes,
2431 link_with : [libshared],
2432 install_rpath : rootlibexecdir,
2434 install_dir : systemgeneratordir)
2437 'systemd-rc-local-generator',
2438 'src/rc-local-generator/rc-local-generator.c',
2439 include_directories : includes,
2440 link_with : [libshared],
2441 install_rpath : rootlibexecdir,
2443 install_dir : systemgeneratordir)
2446 if conf.get('ENABLE_XDG_AUTOSTART') == 1
2448 'systemd-xdg-autostart-generator',
2449 systemd_xdg_autostart_generator_sources,
2450 include_directories : includes,
2451 link_with : [libshared],
2452 install_rpath : rootlibexecdir,
2454 install_dir : usergeneratordir)
2457 'systemd-xdg-autostart-condition',
2458 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2459 include_directories : includes,
2460 link_with : [libshared],
2461 install_rpath : rootlibexecdir,
2463 install_dir : rootlibexecdir)
2466 if conf.get('ENABLE_HOSTNAMED') == 1
2468 'systemd-hostnamed',
2469 'src/hostname/hostnamed.c',
2470 include_directories : includes,
2471 link_with : [libshared],
2472 install_rpath : rootlibexecdir,
2474 install_dir : rootlibexecdir)
2476 public_programs += executable(
2478 'src/hostname/hostnamectl.c',
2479 include_directories : includes,
2480 link_with : [libshared],
2481 install_rpath : rootlibexecdir,
2485 if conf.get('ENABLE_LOCALED') == 1
2486 if conf.get('HAVE_XKBCOMMON') == 1
2487 # logind will load libxkbcommon.so dynamically on its own
2495 systemd_localed_sources,
2496 include_directories : includes,
2497 link_with : [libshared],
2498 dependencies : deps,
2499 install_rpath : rootlibexecdir,
2501 install_dir : rootlibexecdir)
2503 public_programs += executable(
2506 include_directories : includes,
2507 link_with : [libshared],
2508 install_rpath : rootlibexecdir,
2512 if conf.get('ENABLE_TIMEDATED') == 1
2514 'systemd-timedated',
2515 'src/timedate/timedated.c',
2516 include_directories : includes,
2517 link_with : [libshared],
2518 install_rpath : rootlibexecdir,
2520 install_dir : rootlibexecdir)
2523 if conf.get('ENABLE_TIMEDATECTL') == 1
2524 public_programs += executable(
2526 'src/timedate/timedatectl.c',
2527 include_directories : includes,
2528 install_rpath : rootlibexecdir,
2529 link_with : [libshared],
2530 dependencies : [libm],
2534 if conf.get('ENABLE_TIMESYNCD') == 1
2536 'systemd-timesyncd',
2537 systemd_timesyncd_sources,
2538 include_directories : includes,
2539 link_with : [libtimesyncd_core],
2540 dependencies : [threads,
2542 install_rpath : rootlibexecdir,
2544 install_dir : rootlibexecdir)
2547 'systemd-time-wait-sync',
2548 'src/timesync/wait-sync.c',
2549 include_directories : includes,
2550 link_with : [libtimesyncd_core],
2551 install_rpath : rootlibexecdir,
2553 install_dir : rootlibexecdir)
2556 if conf.get('ENABLE_MACHINED') == 1
2559 systemd_machined_sources,
2560 include_directories : includes,
2561 link_with : [libmachine_core,
2563 install_rpath : rootlibexecdir,
2565 install_dir : rootlibexecdir)
2567 public_programs += executable(
2569 'src/machine/machinectl.c',
2570 include_directories : includes,
2571 link_with : [libshared],
2572 dependencies : [threads,
2576 install_rpath : rootlibexecdir,
2578 install_dir : rootbindir)
2581 if conf.get('ENABLE_IMPORTD') == 1
2584 systemd_importd_sources,
2585 include_directories : includes,
2586 link_with : [libshared],
2587 dependencies : [threads],
2588 install_rpath : rootlibexecdir,
2590 install_dir : rootlibexecdir)
2592 systemd_pull = executable(
2594 systemd_pull_sources,
2595 include_directories : includes,
2596 link_with : [libshared],
2597 dependencies : [versiondep,
2603 install_rpath : rootlibexecdir,
2605 install_dir : rootlibexecdir)
2607 systemd_import = executable(
2609 systemd_import_sources,
2610 include_directories : includes,
2611 link_with : [libshared],
2612 dependencies : [libcurl,
2616 install_rpath : rootlibexecdir,
2618 install_dir : rootlibexecdir)
2620 systemd_import_fs = executable(
2621 'systemd-import-fs',
2622 systemd_import_fs_sources,
2623 include_directories : includes,
2624 link_with : [libshared],
2625 install_rpath : rootlibexecdir,
2627 install_dir : rootlibexecdir)
2629 systemd_export = executable(
2631 systemd_export_sources,
2632 include_directories : includes,
2633 link_with : [libshared],
2634 dependencies : [libcurl,
2638 install_rpath : rootlibexecdir,
2640 install_dir : rootlibexecdir)
2642 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2645 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2646 public_programs += executable(
2647 'systemd-journal-upload',
2648 systemd_journal_upload_sources,
2649 include_directories : includes,
2650 link_with : [libshared],
2651 dependencies : [versiondep,
2658 install_rpath : rootlibexecdir,
2660 install_dir : rootlibexecdir)
2663 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2664 public_programs += executable(
2665 'systemd-journal-remote',
2666 systemd_journal_remote_sources,
2667 include_directories : includes,
2668 link_with : [libshared,
2669 libsystemd_journal_remote],
2670 dependencies : [threads,
2676 install_rpath : rootlibexecdir,
2678 install_dir : rootlibexecdir)
2680 public_programs += executable(
2681 'systemd-journal-gatewayd',
2682 systemd_journal_gatewayd_sources,
2683 include_directories : includes,
2684 link_with : [libshared],
2685 dependencies : [threads,
2691 install_rpath : rootlibexecdir,
2693 install_dir : rootlibexecdir)
2696 if conf.get('ENABLE_COREDUMP') == 1
2699 systemd_coredump_sources,
2700 include_directories : includes,
2701 link_with : [libshared],
2702 dependencies : [threads,
2708 install_rpath : rootlibexecdir,
2710 install_dir : rootlibexecdir)
2712 public_programs += executable(
2714 coredumpctl_sources,
2715 include_directories : includes,
2716 link_with : [libshared],
2717 dependencies : [threads,
2721 install_rpath : rootlibexecdir,
2725 if conf.get('ENABLE_PSTORE') == 1
2728 systemd_pstore_sources,
2729 include_directories : includes,
2730 link_with : [libshared],
2731 dependencies : [threads,
2737 install_rpath : rootlibexecdir,
2739 install_dir : rootlibexecdir)
2742 if conf.get('ENABLE_OOMD') == 1
2743 executable('systemd-oomd',
2744 systemd_oomd_sources,
2745 include_directories : includes,
2746 link_with : [libshared],
2748 install_rpath : rootlibexecdir,
2750 install_dir : rootlibexecdir)
2752 public_programs += executable(
2755 include_directories : includes,
2756 link_with : [libshared],
2758 install_rpath : rootlibexecdir,
2760 install_dir : rootbindir)
2763 if conf.get('ENABLE_BINFMT') == 1
2764 public_programs += executable(
2766 'src/binfmt/binfmt.c',
2767 include_directories : includes,
2768 link_with : [libshared],
2769 install_rpath : rootlibexecdir,
2771 install_dir : rootlibexecdir)
2773 meson.add_install_script('sh', '-c',
2774 mkdir_p.format(binfmtdir))
2775 if install_sysconfdir
2776 meson.add_install_script('sh', '-c',
2777 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2781 if conf.get('ENABLE_REPART') == 1
2784 systemd_repart_sources,
2785 include_directories : includes,
2786 link_with : [libshared],
2787 dependencies : [threads,
2791 install_rpath : rootlibexecdir,
2793 install_dir : rootbindir)
2794 public_programs += exe
2796 if want_tests != 'false'
2799 args : exe.full_path())
2803 if conf.get('ENABLE_VCONSOLE') == 1
2805 'systemd-vconsole-setup',
2806 'src/vconsole/vconsole-setup.c',
2807 include_directories : includes,
2808 link_with : [libshared],
2809 install_rpath : rootlibexecdir,
2811 install_dir : rootlibexecdir)
2814 if conf.get('ENABLE_RANDOMSEED') == 1
2816 'systemd-random-seed',
2817 'src/random-seed/random-seed.c',
2818 include_directories : includes,
2819 link_with : [libshared],
2820 install_rpath : rootlibexecdir,
2822 install_dir : rootlibexecdir)
2825 if conf.get('ENABLE_FIRSTBOOT') == 1
2827 'systemd-firstboot',
2828 'src/firstboot/firstboot.c',
2829 include_directories : includes,
2830 link_with : [libshared],
2831 dependencies : [libcrypt],
2832 install_rpath : rootlibexecdir,
2834 install_dir : rootbindir)
2838 'systemd-remount-fs',
2839 'src/remount-fs/remount-fs.c',
2840 include_directories : includes,
2841 link_with : [libshared],
2842 install_rpath : rootlibexecdir,
2844 install_dir : rootlibexecdir)
2847 'systemd-machine-id-setup',
2848 'src/machine-id-setup/machine-id-setup-main.c',
2849 include_directories : includes,
2850 link_with : [libshared],
2851 install_rpath : rootlibexecdir,
2853 install_dir : rootbindir)
2858 include_directories : includes,
2859 link_with : [libshared],
2860 install_rpath : rootlibexecdir,
2862 install_dir : rootlibexecdir)
2864 executable('systemd-growfs',
2865 'src/partition/growfs.c',
2866 include_directories : includes,
2867 link_with : [libshared],
2868 install_rpath : rootlibexecdir,
2870 install_dir : rootlibexecdir)
2874 'src/partition/makefs.c',
2875 include_directories : includes,
2876 link_with : [libshared],
2877 install_rpath : rootlibexecdir,
2879 install_dir : rootlibexecdir)
2883 'src/sleep/sleep.c',
2884 include_directories : includes,
2885 link_with : [libshared],
2886 install_rpath : rootlibexecdir,
2888 install_dir : rootlibexecdir)
2890 if install_sysconfdir_samples
2891 install_data('src/sleep/sleep.conf',
2892 install_dir : pkgsysconfdir)
2895 public_programs += executable(
2897 'src/sysctl/sysctl.c',
2898 include_directories : includes,
2899 link_with : [libshared],
2900 install_rpath : rootlibexecdir,
2902 install_dir : rootlibexecdir)
2906 'src/ac-power/ac-power.c',
2907 include_directories : includes,
2908 link_with : [libshared],
2909 install_rpath : rootlibexecdir,
2911 install_dir : rootlibexecdir)
2913 public_programs += executable(
2914 'systemd-detect-virt',
2915 'src/detect-virt/detect-virt.c',
2916 include_directories : includes,
2917 link_with : [libshared],
2918 install_rpath : rootlibexecdir,
2921 public_programs += executable(
2923 'src/delta/delta.c',
2924 include_directories : includes,
2925 link_with : [libshared],
2926 install_rpath : rootlibexecdir,
2929 public_programs += executable(
2931 'src/escape/escape.c',
2932 include_directories : includes,
2933 link_with : [libshared],
2934 install_rpath : rootlibexecdir,
2936 install_dir : rootbindir)
2938 public_programs += executable(
2940 'src/notify/notify.c',
2941 include_directories : includes,
2942 link_with : [libshared],
2943 install_rpath : rootlibexecdir,
2945 install_dir : rootbindir)
2948 'systemd-volatile-root',
2949 'src/volatile-root/volatile-root.c',
2950 include_directories : includes,
2951 link_with : [libshared],
2952 install_rpath : rootlibexecdir,
2953 install : conf.get('ENABLE_INITRD') == 1,
2954 install_dir : rootlibexecdir)
2957 'systemd-cgroups-agent',
2958 'src/cgroups-agent/cgroups-agent.c',
2959 include_directories : includes,
2960 link_with : [libshared],
2961 install_rpath : rootlibexecdir,
2963 install_dir : rootlibexecdir)
2965 public_programs += executable(
2967 'src/id128/id128.c',
2968 include_directories : includes,
2969 link_with : [libshared],
2970 install_rpath : rootlibexecdir,
2973 public_programs += executable(
2976 include_directories : includes,
2977 link_with : [libshared],
2978 install_rpath : rootlibexecdir,
2981 public_programs += executable(
2982 'systemd-ask-password',
2983 'src/ask-password/ask-password.c',
2984 include_directories : includes,
2985 link_with : [libshared],
2986 install_rpath : rootlibexecdir,
2988 install_dir : rootbindir)
2991 'systemd-reply-password',
2992 'src/reply-password/reply-password.c',
2993 include_directories : includes,
2994 link_with : [libshared],
2995 install_rpath : rootlibexecdir,
2997 install_dir : rootlibexecdir)
2999 public_programs += executable(
3000 'systemd-tty-ask-password-agent',
3001 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3002 include_directories : includes,
3003 link_with : [libshared],
3004 install_rpath : rootlibexecdir,
3006 install_dir : rootbindir)
3008 public_programs += executable(
3011 include_directories : includes,
3012 link_with : [libshared],
3013 install_rpath : rootlibexecdir,
3016 public_programs += executable(
3018 'src/cgtop/cgtop.c',
3019 include_directories : includes,
3020 link_with : [libshared],
3021 install_rpath : rootlibexecdir,
3026 'src/initctl/initctl.c',
3027 include_directories : includes,
3028 link_with : [libshared],
3029 install_rpath : rootlibexecdir,
3030 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3031 install_dir : rootlibexecdir)
3033 public_programs += executable(
3035 'src/mount/mount-tool.c',
3036 include_directories : includes,
3037 link_with : [libshared],
3038 dependencies: [libmount],
3039 install_rpath : rootlibexecdir,
3042 meson.add_install_script(meson_make_symlink,
3043 'systemd-mount', join_paths(bindir, 'systemd-umount'))
3045 public_programs += executable(
3048 include_directories : includes,
3049 link_with : [libshared],
3050 install_rpath : rootlibexecdir,
3053 public_programs += executable(
3054 'systemd-stdio-bridge',
3055 'src/stdio-bridge/stdio-bridge.c',
3056 include_directories : includes,
3057 link_with : [libshared],
3058 dependencies : [versiondep],
3059 install_rpath : rootlibexecdir,
3062 public_programs += executable(
3065 include_directories : includes,
3066 link_with : [libshared],
3067 install_rpath : rootlibexecdir,
3073 'src/sysusers/sysusers.c',
3074 include_directories : includes,
3075 link_with : [libshared],
3076 install_rpath : rootlibexecdir,
3078 install_dir : rootbindir)
3079 public_programs += exe
3081 if want_tests != 'false'
3082 test('test-sysusers',
3084 # https://github.com/mesonbuild/meson/issues/2681
3085 args : exe.full_path())
3088 if have_standalone_binaries
3090 'systemd-sysusers.standalone',
3091 'src/sysusers/sysusers.c',
3092 include_directories : includes,
3093 c_args : '-DSTANDALONE',
3094 link_with : [libshared_static,
3099 install_dir : rootbindir)
3100 public_programs += exe
3102 if want_tests != 'false'
3103 test('test-sysusers.standalone',
3105 # https://github.com/mesonbuild/meson/issues/2681
3106 args : exe.full_path())
3111 if conf.get('ENABLE_TMPFILES') == 1
3114 systemd_tmpfiles_sources,
3115 include_directories : includes,
3116 link_with : [libshared],
3117 dependencies : [libacl],
3118 install_rpath : rootlibexecdir,
3120 install_dir : rootbindir)
3121 public_programs += exe
3123 if want_tests != 'false'
3124 test('test-systemd-tmpfiles',
3125 test_systemd_tmpfiles_py,
3126 # https://github.com/mesonbuild/meson/issues/2681
3127 args : exe.full_path())
3130 if have_standalone_binaries
3131 public_programs += executable(
3132 'systemd-tmpfiles.standalone',
3133 systemd_tmpfiles_sources,
3134 include_directories : includes,
3135 c_args : '-DSTANDALONE',
3136 link_with : [libshared_static,
3140 dependencies : [libacl],
3142 install_dir : rootbindir)
3146 if conf.get('ENABLE_HWDB') == 1
3147 public_programs += executable(
3150 include_directories : includes,
3151 link_with : udev_link_with,
3152 install_rpath : udev_rpath,
3154 install_dir : rootbindir)
3157 if conf.get('ENABLE_QUOTACHECK') == 1
3159 'systemd-quotacheck',
3160 'src/quotacheck/quotacheck.c',
3161 include_directories : includes,
3162 link_with : [libshared],
3163 install_rpath : rootlibexecdir,
3165 install_dir : rootlibexecdir)
3168 public_programs += executable(
3169 'systemd-socket-proxyd',
3170 'src/socket-proxy/socket-proxyd.c',
3171 include_directories : includes,
3172 link_with : [libshared],
3173 dependencies : [threads],
3174 install_rpath : rootlibexecdir,
3176 install_dir : rootlibexecdir)
3178 public_programs += executable(
3181 include_directories : includes,
3182 link_with : [libudevd_core],
3183 dependencies : [versiondep,
3189 install_rpath : udev_rpath,
3191 install_dir : rootbindir)
3195 systemd_shutdown_sources,
3196 include_directories : includes,
3197 link_with : [libshared],
3198 dependencies : [libmount],
3199 install_rpath : rootlibexecdir,
3201 install_dir : rootlibexecdir)
3204 'systemd-update-done',
3205 'src/update-done/update-done.c',
3206 include_directories : includes,
3207 link_with : [libshared],
3208 install_rpath : rootlibexecdir,
3210 install_dir : rootlibexecdir)
3213 'systemd-update-utmp',
3214 'src/update-utmp/update-utmp.c',
3215 include_directories : includes,
3216 link_with : [libshared],
3217 dependencies : [libaudit],
3218 install_rpath : rootlibexecdir,
3219 install : (conf.get('ENABLE_UTMP') == 1),
3220 install_dir : rootlibexecdir)
3222 if conf.get('HAVE_KMOD') == 1
3224 'systemd-modules-load',
3225 'src/modules-load/modules-load.c',
3226 include_directories : includes,
3227 link_with : [libshared],
3228 dependencies : [libkmod],
3229 install_rpath : rootlibexecdir,
3231 install_dir : rootlibexecdir)
3233 meson.add_install_script('sh', '-c',
3234 mkdir_p.format(modulesloaddir))
3235 if install_sysconfdir
3236 meson.add_install_script('sh', '-c',
3237 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
3241 public_programs += executable(
3243 systemd_nspawn_sources,
3244 include_directories : includes,
3245 link_with : [libnspawn_core,
3247 dependencies : [libblkid,
3249 install_rpath : rootlibexecdir,
3252 if conf.get('ENABLE_NETWORKD') == 1
3255 systemd_networkd_sources,
3256 include_directories : network_includes,
3257 link_with : [libnetworkd_core,
3259 networkd_link_with],
3260 dependencies : [threads],
3261 install_rpath : rootlibexecdir,
3263 install_dir : rootlibexecdir)
3266 'systemd-networkd-wait-online',
3267 systemd_networkd_wait_online_sources,
3268 include_directories : includes,
3269 link_with : [networkd_link_with],
3270 install_rpath : rootlibexecdir,
3272 install_dir : rootlibexecdir)
3274 public_programs += executable(
3277 include_directories : libsystemd_network_includes,
3278 link_with : [libsystemd_network,
3279 networkd_link_with],
3280 install_rpath : rootlibexecdir,
3282 install_dir : rootbindir)
3285 'systemd-network-generator',
3286 network_generator_sources,
3287 include_directories : includes,
3288 link_with : [networkd_link_with],
3289 install_rpath : rootlibexecdir,
3291 install_dir : rootlibexecdir)
3293 if want_tests != 'false'
3294 test('test-network-generator-conversion',
3295 test_network_generator_conversion_sh,
3296 # https://github.com/mesonbuild/meson/issues/2681
3297 args : exe.full_path())
3302 'systemd-sulogin-shell',
3303 'src/sulogin-shell/sulogin-shell.c',
3304 include_directories : includes,
3305 link_with : [libshared],
3306 install_rpath : rootlibexecdir,
3308 install_dir : rootlibexecdir)
3310 ############################################################
3313 'systemd-runtest.env',
3314 output : 'systemd-runtest.env',
3315 command : ['sh', '-c', '{ ' +
3316 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
3317 'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(project_build_root, 'catalog')) +
3319 build_by_default : true)
3321 foreach tuple : tests
3323 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3324 dependencies = tuple.length() > 2 ? tuple[2] : []
3325 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3326 condition = tuple.length() > 4 ? tuple[4] : ''
3327 type = tuple.length() > 5 ? tuple[5] : ''
3328 defs = tuple.length() > 6 ? tuple[6] : []
3329 parallel = tuple.length() > 7 ? tuple[7] : true
3332 name = sources[0].split('/')[-1].split('.')[0]
3333 if type.startswith('timeout=')
3334 timeout = type.split('=')[1].to_int()
3338 if condition == '' or conf.get(condition) == 1
3342 include_directories : incs,
3343 link_with : link_with,
3344 dependencies : [versiondep,
3347 build_by_default : want_tests != 'false',
3348 install_rpath : rootlibexecdir,
3349 install : install_tests,
3350 install_dir : join_paths(testsdir, type))
3353 message('@0@ is a manual test'.format(name))
3354 elif type == 'unsafe' and want_tests != 'unsafe'
3355 message('@0@ is an unsafe test'.format(name))
3356 elif want_tests != 'false'
3362 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3367 'test-libsystemd-sym',
3368 test_libsystemd_sym_c,
3369 include_directories : includes,
3370 link_with : [libsystemd],
3371 build_by_default : want_tests != 'false',
3372 install : install_tests,
3373 install_dir : testsdir)
3374 if want_tests != 'false'
3375 test('test-libsystemd-sym', exe)
3379 'test-libsystemd-static-sym',
3380 test_libsystemd_sym_c,
3381 include_directories : includes,
3382 link_with : [install_libsystemd_static],
3383 dependencies : [threads], # threads is already included in dependencies on the library,
3384 # but does not seem to get propagated. Add here as a work-around.
3385 build_by_default : want_tests != 'false' and static_libsystemd_pic,
3386 install : install_tests and static_libsystemd_pic,
3387 install_dir : testsdir)
3388 if want_tests != 'false' and static_libsystemd_pic
3389 test('test-libsystemd-static-sym', exe)
3395 include_directories : libudev_includes,
3396 c_args : '-Wno-deprecated-declarations',
3397 link_with : [libudev],
3398 build_by_default : want_tests != 'false',
3399 install : install_tests,
3400 install_dir : testsdir)
3401 if want_tests != 'false'
3402 test('test-libudev-sym', exe)
3406 'test-libudev-static-sym',
3408 include_directories : libudev_includes,
3409 c_args : '-Wno-deprecated-declarations',
3410 link_with : [install_libudev_static],
3411 build_by_default : want_tests != 'false' and static_libudev_pic,
3412 install : install_tests and static_libudev_pic,
3413 install_dir : testsdir)
3414 if want_tests != 'false' and static_libudev_pic
3415 test('test-libudev-static-sym', exe)
3418 ############################################################
3422 foreach tuple : fuzzers
3424 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3425 dependencies = tuple.length() > 2 ? tuple[2] : []
3426 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3427 defs = tuple.length() > 4 ? tuple[4] : []
3431 dependencies += fuzzing_engine
3433 if fuzzing_engine.found()
3434 dependencies += fuzzing_engine
3436 link_args += ['-fsanitize=fuzzer']
3439 sources += 'src/fuzz/fuzz-main.c'
3442 name = sources[0].split('/')[-1].split('.')[0]
3444 fuzzer_exes += executable(
3447 include_directories : [incs, include_directories('src/fuzz')],
3448 link_with : link_with,
3449 dependencies : dependencies,
3451 link_args: link_args,
3453 build_by_default : fuzz_tests or fuzzer_build)
3458 depends : fuzzer_exes,
3461 ############################################################
3464 subdir('sysusers.d')
3465 subdir('tmpfiles.d')
3471 subdir('shell-completion/bash')
3472 subdir('shell-completion/zsh')
3473 subdir('docs/sysvinit')
3474 subdir('docs/var-log')
3476 install_subdir('factory/etc',
3477 install_dir : factorydir)
3479 if install_sysconfdir
3480 install_data('xorg/50-systemd-user.sh',
3481 install_dir : xinitrcdir)
3483 install_data('README',
3484 'modprobe.d/systemd.conf',
3485 install_dir : modprobedir)
3486 install_data('LICENSE.GPL2',
3490 'docs/CODING_STYLE.md',
3491 'docs/DISTRO_PORTING.md',
3492 'docs/ENVIRONMENT.md',
3494 'docs/TRANSIENT-SETTINGS.md',
3495 'docs/TRANSLATORS.md',
3496 'docs/UIDS-GIDS.md',
3497 'docs/GVARIANT-SERIALIZATION.md',
3498 install_dir : docdir)
3500 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3501 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3503 ############################################################
3505 check_help = find_program('tools/check-help.sh')
3507 foreach exec : public_programs
3508 name = exec.full_path().split('/')[-1]
3509 if want_tests != 'false'
3510 test('check-help-' + name,
3512 args : exec.full_path())
3516 ############################################################
3518 check_directives_sh = find_program('tools/check-directives.sh')
3520 if want_tests != 'false'
3521 test('check-directives',
3522 check_directives_sh,
3523 args : [project_source_root, project_build_root])
3526 ############################################################
3528 # Enable tests for all supported sanitizers
3529 foreach tuple : sanitizers
3530 sanitizer = tuple[0]
3533 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3535 foreach p : fuzz_regression_tests
3536 b = p.split('/')[-2]
3537 c = p.split('/')[-1]
3539 name = '@0@:@1@'.format(b, sanitizer)
3542 if want_tests == 'false'
3543 message('Not compiling @0@ because tests is set to false'.format(name))
3545 exe = custom_target(
3549 command : [env, 'ln', '-fs',
3550 join_paths(build.full_path(), b),
3552 build_by_default : true)
3554 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
3560 test('@0@_@1@_@2@'.format(b, c, sanitizer),
3562 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3564 args : [exe.full_path(),
3565 join_paths(project_source_root, p)])
3572 ############################################################
3575 all_files = run_command(
3576 'env', '-u', 'GIT_WORK_TREE',
3578 '--git-dir=@0@/.git'.format(project_source_root),
3579 'ls-files', ':/*.[ch]')
3581 all_files = files(all_files.stdout().split())
3586 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
3589 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
3593 git_contrib_sh = find_program('tools/git-contrib.sh')
3596 command : [git_contrib_sh])
3600 git_head = run_command(
3602 ['--git-dir=@0@/.git'.format(project_source_root),
3603 'rev-parse', 'HEAD']).stdout().strip()
3604 git_head_short = run_command(
3606 ['--git-dir=@0@/.git'.format(project_source_root),
3607 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3611 command : ['git', 'archive',
3612 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
3614 '--prefix', 'systemd-@0@/'.format(git_head),
3618 ############################################################
3620 check_api_docs_sh = find_program('tools/check-api-docs.sh')
3623 depends : [man, libsystemd, libudev],
3624 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3626 ############################################################
3628 if dbus_docs.length() > 0
3631 output : 'update-dbus-docs',
3632 command : [update_dbus_docs_py,
3633 '--build-dir=@0@'.format(project_build_root),
3637 if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER'
3638 test('dbus-docs-fresh',
3639 update_dbus_docs_py,
3640 args : ['--build-dir=@0@'.format(project_build_root),
3641 '--test'] + dbus_docs)
3647 output : 'update-man-rules',
3648 command : ['sh', '-c',
3649 'cd @0@ && '.format(meson.build_root()) +
3650 'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) +
3651 'mv t @0@/man/rules/meson.build'.format(meson.current_source_dir())],
3652 depend_files : custom_entities_ent)
3654 ############################################################
3655 watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog
3658 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3660 'build mode: @0@'.format(get_option('mode')),
3661 'split /usr: @0@'.format(split_usr),
3662 'split bin-sbin: @0@'.format(split_bin),
3663 'prefix directory: @0@'.format(prefixdir),
3664 'rootprefix directory: @0@'.format(rootprefixdir),
3665 'sysconf directory: @0@'.format(sysconfdir),
3666 'include directory: @0@'.format(includedir),
3667 'lib directory: @0@'.format(libdir),
3668 'rootlib directory: @0@'.format(rootlibdir),
3669 'SysV init scripts: @0@'.format(sysvinit_path),
3670 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3671 'PAM modules directory: @0@'.format(pamlibdir),
3672 'PAM configuration directory: @0@'.format(pamconfdir),
3673 'RPM macros directory: @0@'.format(rpmmacrosdir),
3674 'modprobe.d directory: @0@'.format(modprobedir),
3675 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3676 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3677 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3678 'bash completions directory: @0@'.format(bashcompletiondir),
3679 'zsh completions directory: @0@'.format(zshcompletiondir),
3680 'extra start script: @0@'.format(get_option('rc-local')),
3681 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3682 get_option('debug-tty')),
3683 'TTY GID: @0@'.format(tty_gid),
3684 'users GID: @0@'.format(substs.get('USERS_GID')),
3685 'system UIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
3686 conf.get('SYSTEM_ALLOC_UID_MIN')),
3687 'system GIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
3688 conf.get('SYSTEM_ALLOC_GID_MIN')),
3689 'dynamic UIDs: @0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
3690 'container UID bases: @0@…@1@'.format(container_uid_base_min, container_uid_base_max),
3691 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3692 'render group access mode: @0@'.format(get_option('group-render-mode')),
3693 'certificate root directory: @0@'.format(get_option('certificate-root')),
3694 'support URL: @0@'.format(support_url),
3695 'nobody user name: @0@'.format(nobody_user),
3696 'nobody group name: @0@'.format(nobody_group),
3697 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3699 'default DNSSEC mode: @0@'.format(default_dnssec),
3700 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
3701 'default mDNS mode: @0@'.format(default_mdns),
3702 'default LLMNR mode: @0@'.format(default_llmnr),
3703 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3704 'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
3705 'default KillUserProcesses setting: @0@'.format(kill_user_processes),
3706 'default locale: @0@'.format(default_locale),
3707 'default user $PATH: @0@'.format(default_user_path_display),
3708 'systemd service watchdog: @0@'.format(watchdog_opt)]
3710 alt_dns_servers = '\n '.join(dns_servers.split(' '))
3711 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3713 'default DNS servers: @0@'.format(alt_dns_servers),
3714 'default NTP servers: @0@'.format(alt_ntp_servers)]
3716 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3717 '@@0@'.format(time_epoch)).stdout().strip()
3719 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3722 'static libsystemd: @0@'.format(static_libsystemd),
3723 'static libudev: @0@'.format(static_libudev)]
3726 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3727 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3728 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3730 if conf.get('ENABLE_EFI') == 1
3731 status += 'efi arch: @0@'.format(efi_arch)
3735 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3736 'EFI CC @0@'.format(' '.join(efi_cc)),
3737 'EFI lds: @0@'.format(efi_lds),
3738 'EFI crt0: @0@'.format(efi_crt0),
3739 'EFI include directory: @0@'.format(efi_incdir)]
3774 ['compat-mutable-uid-boundaries'],
3805 ['DNS-over-TLS(gnutls)', conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1],
3806 ['DNS-over-TLS(openssl)', conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1],
3811 ['legacy pkla', install_polkit_pkla],
3813 ['gnu-efi', have_gnu_efi],
3826 ['man pages', want_man],
3827 ['html pages', want_html],
3828 ['man page indices', want_man and have_lxml],
3833 ['adm group', get_option('adm-group')],
3834 ['wheel group', get_option('wheel-group')],
3837 ['debug mmap cache'],
3839 ['valgrind', conf.get('VALGRIND') == 1],
3840 ['trace logging', conf.get('LOG_TRACE') == 1],
3841 ['install tests', install_tests],
3842 ['link-udev-shared', get_option('link-udev-shared')],
3843 ['link-systemctl-shared', get_option('link-systemctl-shared')],
3844 ['link-networkd-shared', get_option('link-networkd-shared')],
3845 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
3846 ['kernel-install', get_option('kernel-install')],
3847 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
3849 ['standalone-binaries', get_option('standalone-binaries')],
3852 if tuple.length() >= 2
3855 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3856 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3857 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3868 'enabled features: @0@'.format(', '.join(found)),
3870 'disabled features: @0@'.format(', '.join(missing)),
3872 message('\n '.join(status))
3874 if rootprefixdir != rootprefix_default
3876 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3877 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3878 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))