1 # SPDX-License-Identifier: LGPL-2.1-or-later
3 project('systemd', 'c',
13 meson_version : '>= 0.46',
16 libsystemd_version = '0.31.0'
17 libudev_version = '1.7.1'
19 # We need the same data in two different formats, ugh!
20 # Also, for hysterical reasons, we use different variable
21 # names, sometimes. Not all variables are included in every
23 conf = configuration_data()
24 conf.set('PROJECT_VERSION', meson.project_version(),
25 description : 'Numerical project version (used where a simple number is expected)')
27 substs = configuration_data()
28 substs.set('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
29 substs.set('PROJECT_VERSION', meson.project_version(),
30 description : 'Numerical project version (used where a simple number is expected)')
32 # This is to be used instead of meson.source_root(), as the latter will return
33 # the wrong result when systemd is being built as a meson subproject
34 project_source_root = meson.current_source_dir()
35 project_build_root = meson.current_build_dir()
36 relative_source_path = run_command('realpath',
37 '--relative-to=@0@'.format(project_build_root),
38 project_source_root).stdout().strip()
39 conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
41 conf.set('BUILD_MODE', 'BUILD_MODE_' + get_option('mode').to_upper(),
42 description : 'tailor build to development or release builds')
44 want_ossfuzz = get_option('oss-fuzz')
45 want_libfuzzer = get_option('llvm-fuzz')
46 if want_ossfuzz + want_libfuzzer > 1
47 error('only one of oss-fuzz or llvm-fuzz can be specified')
50 skip_deps = want_ossfuzz or want_libfuzzer
51 fuzzer_build = want_ossfuzz or want_libfuzzer
53 #####################################################################
55 # Try to install the git pre-commit hook
56 add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
57 if add_git_hook_sh.found()
58 git_hook = run_command(add_git_hook_sh)
59 if git_hook.returncode() == 0
60 message(git_hook.stdout().strip())
64 #####################################################################
66 if get_option('split-usr') == 'auto'
67 split_usr = run_command('test', '-L', '/bin').returncode() != 0
69 split_usr = get_option('split-usr') == 'true'
72 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
73 + ' split-usr mode is going to be removed\n' +
74 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
76 conf.set10('HAVE_SPLIT_USR', split_usr,
77 description : '/usr/bin and /bin directories are separate')
79 if get_option('split-bin') == 'auto'
80 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
82 split_bin = get_option('split-bin') == 'true'
84 conf.set10('HAVE_SPLIT_BIN', split_bin,
85 description : 'bin and sbin directories are separate')
87 rootprefixdir = get_option('rootprefix')
88 # Unusual rootprefixdir values are used by some distros
89 # (see https://github.com/systemd/systemd/pull/7461).
90 rootprefix_default = split_usr ? '/' : '/usr'
91 if rootprefixdir == ''
92 rootprefixdir = rootprefix_default
94 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
96 have_standalone_binaries = get_option('standalone-binaries')
98 sysvinit_path = get_option('sysvinit-path')
99 sysvrcnd_path = get_option('sysvrcnd-path')
100 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
101 description : 'SysV init scripts and rcN.d links are supported')
103 if get_option('hibernate') and not get_option('initrd')
104 error('hibernate depends on initrd')
107 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
108 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
109 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
111 # join_paths ignores the preceding arguments if an absolute component is
112 # encountered, so this should canonicalize various paths when they are
113 # absolute or relative.
114 prefixdir = get_option('prefix')
115 if not prefixdir.startswith('/')
116 error('Prefix is not absolute: "@0@"'.format(prefixdir))
118 if prefixdir != rootprefixdir and not prefixdir.startswith(rootprefixdir.strip('/') + '/')
119 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
120 rootprefixdir, prefixdir))
123 bindir = join_paths(prefixdir, get_option('bindir'))
124 libdir = join_paths(prefixdir, get_option('libdir'))
125 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
126 includedir = join_paths(prefixdir, get_option('includedir'))
127 datadir = join_paths(prefixdir, get_option('datadir'))
128 localstatedir = join_paths('/', get_option('localstatedir'))
130 rootbindir = join_paths(rootprefixdir, 'bin')
131 rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
132 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
134 rootlibdir = get_option('rootlibdir')
136 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
139 install_sysconfdir = get_option('install-sysconfdir') != 'false'
140 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
141 # Dirs of external packages
142 pkgconfigdatadir = get_option('pkgconfigdatadir') == '' ? join_paths(datadir, 'pkgconfig') : get_option('pkgconfigdatadir')
143 pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgconfig') : get_option('pkgconfiglibdir')
144 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
145 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
146 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
147 xinitrcdir = get_option('xinitrcdir') == '' ? join_paths(sysconfdir, 'X11/xinit/xinitrc.d') : get_option('xinitrcdir')
148 rpmmacrosdir = get_option('rpmmacrosdir')
149 if rpmmacrosdir != 'no'
150 rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
152 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
155 pkgdatadir = join_paths(datadir, 'systemd')
156 environmentdir = join_paths(prefixdir, 'lib/environment.d')
157 pkgsysconfdir = join_paths(sysconfdir, 'systemd')
158 userunitdir = join_paths(prefixdir, 'lib/systemd/user')
159 userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
160 tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
161 sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
162 sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
163 binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
164 modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
165 networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
166 pkgincludedir = join_paths(includedir, 'systemd')
167 systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
168 usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
169 systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
170 userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
171 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
172 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
173 systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
174 systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
175 udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
176 udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
177 udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
178 catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
179 kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
180 factorydir = join_paths(datadir, 'factory')
181 bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
182 testsdir = join_paths(prefixdir, 'lib/systemd/tests')
183 systemdstatedir = join_paths(localstatedir, 'lib/systemd')
184 catalogstatedir = join_paths(systemdstatedir, 'catalog')
185 randomseeddir = join_paths(localstatedir, 'lib/systemd')
186 profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
187 ntpservicelistdir = join_paths(rootprefixdir, 'lib/systemd/ntp-units.d')
189 docdir = get_option('docdir')
191 docdir = join_paths(datadir, 'doc/systemd')
194 dbuspolicydir = get_option('dbuspolicydir')
195 if dbuspolicydir == ''
196 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
199 dbussessionservicedir = get_option('dbussessionservicedir')
200 if dbussessionservicedir == ''
201 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
204 dbussystemservicedir = get_option('dbussystemservicedir')
205 if dbussystemservicedir == ''
206 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
209 pamlibdir = get_option('pamlibdir')
211 pamlibdir = join_paths(rootlibdir, 'security')
214 pamconfdir = get_option('pamconfdir')
216 pamconfdir = join_paths(prefixdir, 'lib/pam.d')
219 memory_accounting_default = get_option('memory-accounting-default')
220 status_unit_format_default = get_option('status-unit-format-default')
222 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
223 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'system'))
224 conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
225 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
226 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
227 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
229 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
230 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
232 conf.set_quoted('USER_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'user'))
233 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
234 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
235 conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
236 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
237 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
238 conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
239 conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
240 conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
241 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
242 conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
243 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
244 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
245 conf.set_quoted('ROOTPREFIX', rootprefixdir)
246 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
247 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
248 conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
249 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
250 conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', join_paths(rootlibexecdir, 'systemd-veritysetup'))
251 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
252 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
253 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
254 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
255 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
256 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
257 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
258 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
259 conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
260 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
261 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
262 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
263 conf.set_quoted('LIBDIR', libdir)
264 conf.set_quoted('ROOTLIBDIR', rootlibdir)
265 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
266 conf.set_quoted('BOOTLIBDIR', bootlibdir)
267 conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
268 conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
269 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', join_paths(rootlibexecdir, 'systemd-import-fs'))
270 conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
271 conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
272 conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
273 conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
274 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', join_paths(rootlibexecdir, 'systemd-homework'))
275 conf.set_quoted('SYSTEMD_USERWORK_PATH', join_paths(rootlibexecdir, 'systemd-userwork'))
276 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
277 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
278 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
280 substs.set('prefix', prefixdir)
281 substs.set('rootprefix', rootprefixdir)
282 substs.set('rootprefix_noslash', rootprefixdir_noslash)
283 substs.set('exec_prefix', prefixdir)
284 substs.set('libdir', libdir)
285 substs.set('rootlibdir', rootlibdir)
286 substs.set('includedir', includedir)
287 substs.set('sysconfdir', sysconfdir)
288 substs.set('bindir', bindir)
289 substs.set('rootbindir', rootbindir)
290 substs.set('rootlibexecdir', rootlibexecdir)
291 substs.set('systemunitdir', systemunitdir)
292 substs.set('userunitdir', userunitdir)
293 substs.set('systempresetdir', systempresetdir)
294 substs.set('userpresetdir', userpresetdir)
295 substs.set('udevhwdbdir', udevhwdbdir)
296 substs.set('udevrulesdir', udevrulesdir)
297 substs.set('udevlibexecdir', udevlibexecdir)
298 substs.set('environmentdir', environmentdir)
299 substs.set('catalogdir', catalogdir)
300 substs.set('tmpfilesdir', tmpfilesdir)
301 substs.set('sysusersdir', sysusersdir)
302 substs.set('sysctldir', sysctldir)
303 substs.set('binfmtdir', binfmtdir)
304 substs.set('modulesloaddir', modulesloaddir)
305 substs.set('modprobedir', modprobedir)
306 substs.set('systemgeneratordir', systemgeneratordir)
307 substs.set('usergeneratordir', usergeneratordir)
308 substs.set('systemenvgeneratordir', systemenvgeneratordir)
309 substs.set('userenvgeneratordir', userenvgeneratordir)
310 substs.set('systemshutdowndir', systemshutdowndir)
311 substs.set('systemsleepdir', systemsleepdir)
312 substs.set('CERTIFICATEROOT', get_option('certificate-root'))
313 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
314 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
315 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
316 substs.set('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
317 substs.set('RC_LOCAL_PATH', get_option('rc-local'))
318 substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
319 substs.set('STATUS_UNIT_FORMAT_DEFAULT', status_unit_format_default)
320 substs.set('HIGH_RLIMIT_NOFILE', conf.get('HIGH_RLIMIT_NOFILE'))
321 substs.set('BUILD_ROOT', project_build_root)
323 #####################################################################
325 cc = meson.get_compiler('c')
326 pkgconfig = import('pkgconfig')
327 check_compilation_sh = find_program('tools/check-compilation.sh')
328 meson_build_sh = find_program('tools/meson-build.sh')
330 want_tests = get_option('tests')
331 slow_tests = want_tests != 'false' and get_option('slow-tests')
332 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
333 install_tests = get_option('install-tests')
335 if add_languages('cpp', required : fuzzer_build)
336 # Used only for tests
337 cxx = meson.get_compiler('cpp')
338 cxx_cmd = ' '.join(cxx.cmd_array())
344 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
345 if fuzzing_engine.found()
346 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
347 elif cc.has_argument('-fsanitize=fuzzer-no-link')
348 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
350 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
353 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
356 # Those generate many false positives, and we do not want to change the code to
358 basic_disabled_warnings = [
359 '-Wno-unused-parameter',
360 '-Wno-missing-field-initializers',
361 '-Wno-unused-result',
362 '-Wno-format-signedness',
365 possible_cc_flags = [
368 '-Wmissing-include-dirs',
369 '-Wold-style-definition',
373 '-Wsuggest-attribute=noreturn',
374 '-Werror=missing-prototypes',
375 '-Werror=implicit-function-declaration',
376 '-Werror=missing-declarations',
377 '-Werror=return-type',
378 '-Werror=incompatible-pointer-types',
380 '-Wstrict-prototypes',
382 '-Wmissing-noreturn',
383 '-Wimplicit-fallthrough=5',
386 '-Wstrict-aliasing=2',
389 '-Werror=shift-count-overflow',
390 '-Werror=shift-overflow=2',
394 # negative arguments are correctly detected starting with meson 0.46.
395 '-Wno-error=#warnings', # clang
396 '-Wno-string-plus-int', # clang
398 # Disable -Wmaybe-uninitialized, since it's noisy on gcc 8 with
399 # optimizations enabled, producing essentially false positives.
400 '-Wno-maybe-uninitialized',
404 '-fdiagnostics-show-option',
405 '-fno-strict-aliasing',
406 '-fvisibility=hidden',
408 '-fstack-protector-strong',
409 '--param=ssp-buffer-size=4',
412 # --as-needed and --no-undefined are provided by meson by default,
413 # run mesonconf to see what is enabled
414 possible_link_flags = [
420 if cc.get_id() == 'clang'
421 possible_cc_flags += [
422 '-Wno-typedef-redefinition',
423 '-Wno-gnu-variable-sized-type-not-at-end',
427 if get_option('buildtype') != 'debug'
428 possible_cc_flags += [
429 '-ffunction-sections',
433 possible_link_flags += '-Wl,--gc-sections'
436 add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
437 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
438 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
440 have = cc.has_argument('-Wzero-length-bounds')
441 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
445 #include <inttypes.h>
446 typedef uint64_t usec_t;
447 usec_t now(clockid_t clock);
452 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
453 add_project_arguments('-Werror=shadow', language : 'c')
457 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
460 cpp = ' '.join(cc.cmd_array()) + ' -E'
462 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
464 #####################################################################
465 # compilation result tests
467 conf.set('_GNU_SOURCE', true)
468 conf.set('__SANE_USERSPACE_TYPES__', true)
469 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
471 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
472 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
473 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
474 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
478 #include <sys/stat.h>
481 foreach decl : ['char16_t',
486 # We get -1 if the size cannot be determined
487 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
489 if decl == 'struct statx'
491 want_linux_stat_h = false
493 have = cc.sizeof(decl,
494 prefix : decl_headers + '#include <linux/stat.h>',
495 args : '-D_GNU_SOURCE') > 0
496 want_linux_stat_h = have
500 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
503 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
505 foreach ident : ['secure_getenv', '__secure_getenv']
506 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
510 ['memfd_create', '''#include <sys/mman.h>'''],
511 ['gettid', '''#include <sys/types.h>
512 #include <unistd.h>'''],
513 ['pivot_root', '''#include <stdlib.h>
514 #include <unistd.h>'''], # no known header declares pivot_root
515 ['name_to_handle_at', '''#include <sys/types.h>
516 #include <sys/stat.h>
517 #include <fcntl.h>'''],
518 ['setns', '''#include <sched.h>'''],
519 ['renameat2', '''#include <stdio.h>
520 #include <fcntl.h>'''],
521 ['kcmp', '''#include <linux/kcmp.h>'''],
522 ['keyctl', '''#include <sys/types.h>
523 #include <keyutils.h>'''],
524 ['copy_file_range', '''#include <sys/syscall.h>
525 #include <unistd.h>'''],
526 ['bpf', '''#include <sys/syscall.h>
527 #include <unistd.h>'''],
528 ['statx', '''#include <sys/types.h>
529 #include <sys/stat.h>
530 #include <unistd.h>'''],
531 ['explicit_bzero' , '''#include <string.h>'''],
532 ['reallocarray', '''#include <stdlib.h>'''],
533 ['set_mempolicy', '''#include <stdlib.h>
534 #include <unistd.h>'''],
535 ['get_mempolicy', '''#include <stdlib.h>
536 #include <unistd.h>'''],
537 ['pidfd_send_signal', '''#include <stdlib.h>
540 #include <sys/wait.h>'''],
541 ['pidfd_open', '''#include <stdlib.h>
544 #include <sys/wait.h>'''],
545 ['rt_sigqueueinfo', '''#include <stdlib.h>
548 #include <sys/wait.h>'''],
549 ['mallinfo', '''#include <malloc.h>'''],
550 ['execveat', '''#include <unistd.h>'''],
551 ['close_range', '''#include <unistd.h>'''],
552 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
555 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
556 conf.set10('HAVE_' + ident[0].to_upper(), have)
559 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
560 conf.set10('USE_SYS_RANDOM_H', true)
561 conf.set10('HAVE_GETRANDOM', true)
563 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
564 conf.set10('USE_SYS_RANDOM_H', false)
565 conf.set10('HAVE_GETRANDOM', have)
568 #####################################################################
570 version_tag = get_option('version-tag')
572 vcs_data = configuration_data()
573 vcs_data.set('VCS_TAG', version_tag)
574 version_h = configure_file(configuration : vcs_data,
575 input : 'src/version/version.h.in',
576 output : 'version.h')
579 project_source_root + '/tools/meson-vcs-tag.sh',
581 meson.project_version()]
584 input : 'src/version/version.h.in',
585 output : 'version.h',
589 versiondep = declare_dependency(sources: version_h)
591 sed = find_program('sed')
592 awk = find_program('awk')
593 m4 = find_program('m4')
594 stat = find_program('stat')
595 git = find_program('git', required : false)
596 env = find_program('env')
597 perl = find_program('perl', required : false)
599 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
600 mkdir_p = 'mkdir -p $DESTDIR/@0@'
601 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
602 splash_bmp = files('test/splash.bmp')
604 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
605 # /usr/sbin, /sbin, and fall back to the default from middle column.
606 progs = [['quotaon', '/usr/sbin/quotaon' ],
607 ['quotacheck', '/usr/sbin/quotacheck' ],
608 ['kmod', '/usr/bin/kmod' ],
609 ['kexec', '/usr/sbin/kexec' ],
610 ['sulogin', '/usr/sbin/sulogin' ],
611 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
612 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
613 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
614 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
615 ['nologin', '/usr/sbin/nologin', ],
618 path = get_option(prog[0] + '-path')
620 message('Using @1@ for @0@'.format(prog[0], path))
622 exe = find_program(prog[0],
623 '/usr/sbin/' + prog[0],
626 path = exe.found() ? exe.path() : prog[1]
628 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
629 conf.set_quoted(name, path)
630 substs.set(name, path)
633 conf.set_quoted('TELINIT', get_option('telinit-path'))
635 if run_command('ln', '--relative', '--help').returncode() != 0
636 error('ln does not support --relative (added in coreutils 8.16)')
639 ############################################################
641 gperf = find_program('gperf')
643 gperf_test_format = '''
645 const char * in_word_set(const char *, @0@);
648 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
649 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
650 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
651 if cc.compiles(gperf_test)
652 gperf_len_type = 'size_t'
654 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
655 if cc.compiles(gperf_test)
656 gperf_len_type = 'unsigned'
658 error('unable to determine gperf len type')
661 message('gperf len type is @0@'.format(gperf_len_type))
662 conf.set('GPERF_LEN_TYPE', gperf_len_type,
663 description : 'The type of gperf "len" parameter')
665 ############################################################
667 if not cc.has_header('sys/capability.h')
668 error('POSIX caps headers not found')
670 foreach header : ['crypt.h',
672 'linux/vm_sockets.h',
674 'valgrind/memcheck.h',
675 'valgrind/valgrind.h',
676 'linux/time_types.h',
679 conf.set10('HAVE_' + header.underscorify().to_upper(),
680 cc.has_header(header))
683 ############################################################
685 fallback_hostname = get_option('fallback-hostname')
686 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
687 error('Invalid fallback-hostname configuration')
688 # A more extensive test is done in test-hostname-util. Let's catch
689 # the most obvious errors here so we don't fail with an assert later.
691 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
693 default_hierarchy = get_option('default-hierarchy')
694 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
695 description : 'default cgroup hierarchy as string')
696 if default_hierarchy == 'legacy'
697 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
698 elif default_hierarchy == 'hybrid'
699 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
701 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
704 default_net_naming_scheme = get_option('default-net-naming-scheme')
705 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
707 time_epoch = get_option('time-epoch')
709 time_epoch = run_command('sh', ['-c', 'echo "$SOURCE_DATE_EPOCH"']).stdout().strip()
710 if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
711 # If we're in a git repository, use the creation time of the latest git tag.
712 latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
713 time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout()
717 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
719 time_epoch = time_epoch.to_int()
721 conf.set('TIME_EPOCH', time_epoch)
723 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
724 ['system-uid-max', 'SYS_UID_MAX', 999],
725 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
726 ['system-gid-max', 'SYS_GID_MAX', 999]]
727 v = get_option(tuple[0])
731 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
732 '/etc/login.defs').stdout().strip()
739 conf.set(tuple[0].underscorify().to_upper(), v)
740 substs.set(tuple[0].underscorify().to_upper(), v)
742 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
743 error('Invalid uid allocation range')
745 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
746 error('Invalid gid allocation range')
749 dynamic_uid_min = get_option('dynamic-uid-min')
750 dynamic_uid_max = get_option('dynamic-uid-max')
751 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
752 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
753 substs.set('dynamicuidmin', dynamic_uid_min)
754 substs.set('dynamicuidmax', dynamic_uid_max)
756 container_uid_base_min = get_option('container-uid-base-min')
757 container_uid_base_max = get_option('container-uid-base-max')
758 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
759 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
760 substs.set('containeruidbasemin', container_uid_base_min)
761 substs.set('containeruidbasemax', container_uid_base_max)
763 nobody_user = get_option('nobody-user')
764 nobody_group = get_option('nobody-group')
766 if not meson.is_cross_build()
767 getent_result = run_command('getent', 'passwd', '65534')
768 if getent_result.returncode() == 0
769 name = getent_result.stdout().split(':')[0]
770 if name != nobody_user
772 'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
773 'Your build will result in an user table setup that is incompatible with the local system.')
776 id_result = run_command('id', '-u', nobody_user)
777 if id_result.returncode() == 0
778 id = id_result.stdout().to_int()
781 'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
782 'Your build will result in an user table setup that is incompatible with the local system.')
786 getent_result = run_command('getent', 'group', '65534')
787 if getent_result.returncode() == 0
788 name = getent_result.stdout().split(':')[0]
789 if name != nobody_group
791 'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
792 'Your build will result in an group table setup that is incompatible with the local system.')
795 id_result = run_command('id', '-g', nobody_group)
796 if id_result.returncode() == 0
797 id = id_result.stdout().to_int()
800 'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
801 'Your build will result in an group table setup that is incompatible with the local system.')
805 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
807 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
808 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
811 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
812 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
813 substs.set('NOBODY_USER_NAME', nobody_user)
814 substs.set('NOBODY_GROUP_NAME', nobody_group)
816 tty_gid = get_option('tty-gid')
817 conf.set('TTY_GID', tty_gid)
818 substs.set('TTY_GID', tty_gid)
820 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
821 users_gid = get_option('users-gid')
822 substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid)
824 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
825 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
827 dev_kvm_mode = get_option('dev-kvm-mode')
828 substs.set('DEV_KVM_MODE', dev_kvm_mode)
829 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
830 group_render_mode = get_option('group-render-mode')
831 substs.set('GROUP_RENDER_MODE', group_render_mode)
832 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
834 kill_user_processes = get_option('default-kill-user-processes')
835 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
836 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
837 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
839 dns_servers = get_option('dns-servers')
840 conf.set_quoted('DNS_SERVERS', dns_servers)
841 substs.set('DNS_SERVERS', dns_servers)
843 ntp_servers = get_option('ntp-servers')
844 conf.set_quoted('NTP_SERVERS', ntp_servers)
845 substs.set('NTP_SERVERS', ntp_servers)
847 default_locale = get_option('default-locale')
848 if default_locale == ''
849 if not meson.is_cross_build()
850 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
851 default_locale = run_command(choose_default_locale_sh).stdout().strip()
853 default_locale = 'C.UTF-8'
856 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
858 localegen_path = get_option('localegen-path')
861 if localegen_path != ''
862 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
864 writable = ' /usr/lib/locale'
866 substs.set('SERVICE_LOCALEGEN_WRITABLE', writable)
867 conf.set10('HAVE_LOCALEGEN', have)
869 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
871 service_watchdog = get_option('service-watchdog')
872 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
873 substs.set('SERVICE_WATCHDOG', watchdog_value)
875 substs.set('SUSHELL', get_option('debug-shell'))
876 substs.set('DEBUGTTY', get_option('debug-tty'))
877 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
879 enable_debug_hashmap = false
880 enable_debug_mmap_cache = false
881 enable_debug_siphash = false
882 foreach name : get_option('debug-extra')
884 enable_debug_hashmap = true
885 elif name == 'mmap-cache'
886 enable_debug_mmap_cache = true
887 elif name == 'siphash'
888 enable_debug_siphash = true
890 message('unknown debug option "@0@", ignoring'.format(name))
893 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
894 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
895 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
897 conf.set10('VALGRIND', get_option('valgrind'))
898 conf.set10('LOG_TRACE', get_option('log-trace'))
900 default_user_path = get_option('user-path')
901 if default_user_path != ''
902 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
903 default_user_path_display = default_user_path
905 # meson 0.49 fails when ?: is used in .format()
906 default_user_path_display = '(same as system services)'
910 #####################################################################
912 threads = dependency('threads')
913 librt = cc.find_library('rt')
914 libm = cc.find_library('m')
915 libdl = cc.find_library('dl')
916 libcrypt = cc.find_library('crypt')
918 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
920 ['crypt_ra', crypt_header],
921 ['crypt_preferred_method', crypt_header],
922 ['crypt_gensalt_ra', crypt_header]]
924 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
925 dependencies : libcrypt)
926 conf.set10('HAVE_' + ident[0].to_upper(), have)
929 libcap = dependency('libcap', required : false)
930 if not libcap.found()
931 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
932 libcap = cc.find_library('cap')
935 libmount = dependency('mount',
936 version : fuzzer_build ? '>= 0' : '>= 2.30')
938 want_libfdisk = get_option('fdisk')
939 if want_libfdisk != 'false' and not skip_deps
940 libfdisk = dependency('fdisk',
942 required : want_libfdisk == 'true')
943 have = libfdisk.found()
948 conf.set10('HAVE_LIBFDISK', have)
950 want_pwquality = get_option('pwquality')
951 if want_pwquality != 'false' and not skip_deps
952 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
953 have = libpwquality.found()
958 conf.set10('HAVE_PWQUALITY', have)
960 want_seccomp = get_option('seccomp')
961 if want_seccomp != 'false' and not skip_deps
962 libseccomp = dependency('libseccomp',
963 version : '>= 2.3.1',
964 required : want_seccomp == 'true')
965 have = libseccomp.found()
970 conf.set10('HAVE_SECCOMP', have)
972 want_selinux = get_option('selinux')
973 if want_selinux != 'false' and not skip_deps
974 libselinux = dependency('libselinux',
975 version : '>= 2.1.9',
976 required : want_selinux == 'true')
977 have = libselinux.found()
982 conf.set10('HAVE_SELINUX', have)
984 want_apparmor = get_option('apparmor')
985 if want_apparmor != 'false' and not skip_deps
986 libapparmor = dependency('libapparmor',
988 required : want_apparmor == 'true')
989 have = libapparmor.found()
994 conf.set10('HAVE_APPARMOR', have)
996 smack_run_label = get_option('smack-run-label')
997 if smack_run_label != ''
998 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
1001 want_polkit = get_option('polkit')
1002 install_polkit = false
1003 install_polkit_pkla = false
1004 if want_polkit != 'false' and not skip_deps
1005 install_polkit = true
1007 libpolkit = dependency('polkit-gobject-1',
1009 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1010 message('Old polkit detected, will install pkla files')
1011 install_polkit_pkla = true
1014 conf.set10('ENABLE_POLKIT', install_polkit)
1016 want_acl = get_option('acl')
1017 if want_acl != 'false' and not skip_deps
1018 libacl = cc.find_library('acl', required : want_acl == 'true')
1019 have = libacl.found()
1024 conf.set10('HAVE_ACL', have)
1026 want_audit = get_option('audit')
1027 if want_audit != 'false' and not skip_deps
1028 libaudit = dependency('audit', required : want_audit == 'true')
1029 have = libaudit.found()
1034 conf.set10('HAVE_AUDIT', have)
1036 want_blkid = get_option('blkid')
1037 if want_blkid != 'false' and not skip_deps
1038 libblkid = dependency('blkid', required : want_blkid == 'true')
1039 have = libblkid.found()
1041 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1042 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1047 conf.set10('HAVE_BLKID', have)
1049 want_kmod = get_option('kmod')
1050 if want_kmod != 'false' and not skip_deps
1051 libkmod = dependency('libkmod',
1053 required : want_kmod == 'true')
1054 have = libkmod.found()
1059 conf.set10('HAVE_KMOD', have)
1061 want_pam = get_option('pam')
1062 if want_pam != 'false' and not skip_deps
1063 libpam = cc.find_library('pam', required : want_pam == 'true')
1064 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1065 have = libpam.found() and libpam_misc.found()
1071 conf.set10('HAVE_PAM', have)
1073 want_microhttpd = get_option('microhttpd')
1074 if want_microhttpd != 'false' and not skip_deps
1075 libmicrohttpd = dependency('libmicrohttpd',
1076 version : '>= 0.9.33',
1077 required : want_microhttpd == 'true')
1078 have = libmicrohttpd.found()
1083 conf.set10('HAVE_MICROHTTPD', have)
1085 want_libcryptsetup = get_option('libcryptsetup')
1086 if want_libcryptsetup != 'false' and not skip_deps
1087 libcryptsetup = dependency('libcryptsetup',
1088 version : '>= 2.0.1',
1089 required : want_libcryptsetup == 'true')
1090 have = libcryptsetup.found()
1092 conf.set10('HAVE_CRYPT_SET_METADATA_SIZE',
1093 have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup))
1094 conf.set10('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY',
1095 have and cc.has_function('crypt_activate_by_signed_key', dependencies : libcryptsetup))
1096 conf.set10('HAVE_CRYPT_TOKEN_MAX',
1097 have and cc.has_function('crypt_token_max', dependencies : libcryptsetup))
1102 conf.set10('HAVE_LIBCRYPTSETUP', have)
1104 want_libcurl = get_option('libcurl')
1105 if want_libcurl != 'false' and not skip_deps
1106 libcurl = dependency('libcurl',
1107 version : '>= 7.32.0',
1108 required : want_libcurl == 'true')
1109 have = libcurl.found()
1114 conf.set10('HAVE_LIBCURL', have)
1115 conf.set10('CURL_NO_OLDIES', get_option('mode') == 'developer')
1117 want_libidn = get_option('libidn')
1118 want_libidn2 = get_option('libidn2')
1119 if want_libidn == 'true' and want_libidn2 == 'true'
1120 error('libidn and libidn2 cannot be requested simultaneously')
1123 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1124 libidn = dependency('libidn2',
1125 required : want_libidn2 == 'true')
1126 have = libidn.found()
1131 conf.set10('HAVE_LIBIDN2', have)
1132 if not have and want_libidn != 'false' and not skip_deps
1133 # libidn is used for both libidn and libidn2 objects
1134 libidn = dependency('libidn',
1135 required : want_libidn == 'true')
1136 have = libidn.found()
1140 conf.set10('HAVE_LIBIDN', have)
1142 want_libiptc = get_option('libiptc')
1143 if want_libiptc != 'false' and not skip_deps
1144 libiptc = dependency('libiptc',
1145 required : want_libiptc == 'true')
1146 have = libiptc.found()
1151 conf.set10('HAVE_LIBIPTC', have)
1153 want_qrencode = get_option('qrencode')
1154 if want_qrencode != 'false' and not skip_deps
1155 libqrencode = dependency('libqrencode',
1157 required : want_qrencode == 'true')
1158 have = libqrencode.found()
1163 conf.set10('HAVE_QRENCODE', have)
1165 want_gcrypt = get_option('gcrypt')
1166 if want_gcrypt != 'false' and not skip_deps
1167 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1168 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1169 have = libgcrypt.found() and libgpg_error.found()
1174 # link to neither of the libs if one is not found
1178 conf.set10('HAVE_GCRYPT', have)
1180 want_gnutls = get_option('gnutls')
1181 if want_gnutls != 'false' and not skip_deps
1182 libgnutls = dependency('gnutls',
1183 version : '>= 3.1.4',
1184 required : want_gnutls == 'true')
1185 have = libgnutls.found()
1190 conf.set10('HAVE_GNUTLS', have)
1192 want_openssl = get_option('openssl')
1193 if want_openssl != 'false' and not skip_deps
1194 libopenssl = dependency('openssl',
1195 version : '>= 1.1.0',
1196 required : want_openssl == 'true')
1197 have = libopenssl.found()
1202 conf.set10('HAVE_OPENSSL', have)
1204 want_p11kit = get_option('p11kit')
1205 if want_p11kit != 'false' and not skip_deps
1206 libp11kit = dependency('p11-kit-1',
1207 version : '>= 0.23.3',
1208 required : want_p11kit == 'true')
1209 have = libp11kit.found()
1214 conf.set10('HAVE_P11KIT', have)
1216 want_libfido2 = get_option('libfido2')
1217 if want_libfido2 != 'false' and not skip_deps
1218 libfido2 = dependency('libfido2',
1219 required : want_libfido2 == 'true')
1220 have = libfido2.found()
1225 conf.set10('HAVE_LIBFIDO2', have)
1227 want_tpm2 = get_option('tpm2')
1228 if want_tpm2 != 'false' and not skip_deps
1229 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1230 required : want_tpm2 == 'true')
1236 conf.set10('HAVE_TPM2', have)
1238 want_elfutils = get_option('elfutils')
1239 if want_elfutils != 'false' and not skip_deps
1240 libdw = dependency('libdw',
1241 required : want_elfutils == 'true')
1242 have = libdw.found()
1247 conf.set10('HAVE_ELFUTILS', have)
1249 want_zlib = get_option('zlib')
1250 if want_zlib != 'false' and not skip_deps
1251 libz = dependency('zlib',
1252 required : want_zlib == 'true')
1258 conf.set10('HAVE_ZLIB', have)
1260 want_bzip2 = get_option('bzip2')
1261 if want_bzip2 != 'false' and not skip_deps
1262 libbzip2 = cc.find_library('bz2',
1263 required : want_bzip2 == 'true')
1264 have = libbzip2.found()
1269 conf.set10('HAVE_BZIP2', have)
1271 want_xz = get_option('xz')
1272 if want_xz != 'false' and not skip_deps
1273 libxz = dependency('liblzma',
1274 required : want_xz == 'true')
1275 have_xz = libxz.found()
1280 conf.set10('HAVE_XZ', have_xz)
1282 want_lz4 = get_option('lz4')
1283 if want_lz4 != 'false' and not skip_deps
1284 liblz4 = dependency('liblz4',
1285 version : '>= 1.3.0',
1286 required : want_lz4 == 'true')
1287 have_lz4 = liblz4.found()
1292 conf.set10('HAVE_LZ4', have_lz4)
1294 want_zstd = get_option('zstd')
1295 if want_zstd != 'false' and not skip_deps
1296 libzstd = dependency('libzstd',
1297 required : want_zstd == 'true',
1298 version : '>= 1.4.0')
1299 have_zstd = libzstd.found()
1304 conf.set10('HAVE_ZSTD', have_zstd)
1306 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1308 want_xkbcommon = get_option('xkbcommon')
1309 if want_xkbcommon != 'false' and not skip_deps
1310 libxkbcommon = dependency('xkbcommon',
1311 version : '>= 0.3.0',
1312 required : want_xkbcommon == 'true')
1313 have = libxkbcommon.found()
1318 conf.set10('HAVE_XKBCOMMON', have)
1320 want_pcre2 = get_option('pcre2')
1321 if want_pcre2 != 'false'
1322 libpcre2 = dependency('libpcre2-8',
1323 required : want_pcre2 == 'true')
1324 have = libpcre2.found()
1329 conf.set10('HAVE_PCRE2', have)
1331 want_glib = get_option('glib')
1332 if want_glib != 'false' and not skip_deps
1333 libglib = dependency('glib-2.0',
1334 version : '>= 2.22.0',
1335 required : want_glib == 'true')
1336 libgobject = dependency('gobject-2.0',
1337 version : '>= 2.22.0',
1338 required : want_glib == 'true')
1339 libgio = dependency('gio-2.0',
1340 required : want_glib == 'true')
1341 have = libglib.found() and libgobject.found() and libgio.found()
1348 conf.set10('HAVE_GLIB', have)
1350 want_dbus = get_option('dbus')
1351 if want_dbus != 'false' and not skip_deps
1352 libdbus = dependency('dbus-1',
1353 version : '>= 1.3.2',
1354 required : want_dbus == 'true')
1355 have = libdbus.found()
1360 conf.set10('HAVE_DBUS', have)
1362 default_dnssec = get_option('default-dnssec')
1364 default_dnssec = 'no'
1366 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1367 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1368 default_dnssec = 'no'
1370 conf.set('DEFAULT_DNSSEC_MODE',
1371 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1372 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1374 dns_over_tls = get_option('dns-over-tls')
1375 if dns_over_tls != 'false'
1376 if dns_over_tls == 'openssl'
1379 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
1380 if dns_over_tls == 'gnutls' and not have_gnutls
1381 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1384 if dns_over_tls == 'gnutls' or have_gnutls
1385 have_openssl = false
1387 have_openssl = conf.get('HAVE_OPENSSL') == 1
1388 if dns_over_tls != 'auto' and not have_openssl
1389 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
1390 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1393 have = have_gnutls or have_openssl
1397 have_openssl = false
1399 conf.set10('ENABLE_DNS_OVER_TLS', have)
1400 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1401 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1403 default_dns_over_tls = get_option('default-dns-over-tls')
1405 default_dns_over_tls = 'no'
1407 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1408 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.')
1409 default_dns_over_tls = 'no'
1411 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1412 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1413 substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls)
1415 default_mdns = get_option('default-mdns')
1416 conf.set('DEFAULT_MDNS_MODE',
1417 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1418 substs.set('DEFAULT_MDNS_MODE', default_mdns)
1420 default_llmnr = get_option('default-llmnr')
1421 conf.set('DEFAULT_LLMNR_MODE',
1422 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1423 substs.set('DEFAULT_LLMNR_MODE', default_llmnr)
1425 want_repart = get_option('repart')
1426 if want_repart != 'false'
1427 have = (conf.get('HAVE_OPENSSL') == 1 and
1428 conf.get('HAVE_LIBFDISK') == 1)
1429 if want_repart == 'true' and not have
1430 error('repart support was requested, but dependencies are not available')
1435 conf.set10('ENABLE_REPART', have)
1437 want_importd = get_option('importd')
1438 if want_importd != 'false'
1439 have = (conf.get('HAVE_LIBCURL') == 1 and
1440 conf.get('HAVE_ZLIB') == 1 and
1441 conf.get('HAVE_XZ') == 1 and
1442 conf.get('HAVE_GCRYPT') == 1)
1443 if want_importd == 'true' and not have
1444 error('importd support was requested, but dependencies are not available')
1449 conf.set10('ENABLE_IMPORTD', have)
1451 want_homed = get_option('homed')
1452 if want_homed != 'false'
1453 have = (conf.get('HAVE_OPENSSL') == 1 and
1454 conf.get('HAVE_LIBFDISK') == 1 and
1455 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1456 if want_homed == 'true' and not have
1457 error('homed support was requested, but dependencies are not available')
1462 conf.set10('ENABLE_HOMED', have)
1464 have = have and conf.get('HAVE_PAM') == 1
1465 conf.set10('ENABLE_PAM_HOME', have)
1467 have = get_option('oomd')
1468 conf.set10('ENABLE_OOMD', have)
1469 substs.set10('ENABLE_OOMD', have)
1471 want_remote = get_option('remote')
1472 if want_remote != 'false'
1473 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1474 conf.get('HAVE_LIBCURL') == 1]
1475 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1476 # it's possible to build one without the other. Complain only if
1477 # support was explicitly requested. The auxiliary files like sysusers
1478 # config should be installed when any of the programs are built.
1479 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1480 error('remote support was requested, but dependencies are not available')
1482 have = have_deps[0] or have_deps[1]
1486 conf.set10('ENABLE_REMOTE', have)
1488 foreach term : ['analyze',
1502 'compat-mutable-uid-boundaries',
1528 have = get_option(term)
1529 name = 'ENABLE_' + term.underscorify().to_upper()
1530 conf.set10(name, have)
1531 substs.set10(name, have)
1534 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1536 foreach tuple : [['nss-mymachines', 'machined'],
1537 ['nss-resolve', 'resolve']]
1538 want = get_option(tuple[0])
1540 have = get_option(tuple[1])
1541 if want == 'true' and not have
1542 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1547 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1548 conf.set10(name, have)
1552 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1553 'ENABLE_NSS_MYMACHINES',
1554 'ENABLE_NSS_RESOLVE',
1555 'ENABLE_NSS_SYSTEMD']
1556 if conf.get(term) == 1
1560 conf.set10('ENABLE_NSS', enable_nss)
1562 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1564 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1566 #####################################################################
1568 if get_option('efi')
1569 efi_arch = host_machine.cpu_family()
1571 if efi_arch == 'x86'
1572 EFI_MACHINE_TYPE_NAME = 'ia32'
1573 gnu_efi_arch = 'ia32'
1574 elif efi_arch == 'x86_64'
1575 EFI_MACHINE_TYPE_NAME = 'x64'
1576 gnu_efi_arch = 'x86_64'
1577 elif efi_arch == 'arm'
1578 EFI_MACHINE_TYPE_NAME = 'arm'
1579 gnu_efi_arch = 'arm'
1580 elif efi_arch == 'aarch64'
1581 EFI_MACHINE_TYPE_NAME = 'aa64'
1582 gnu_efi_arch = 'aarch64'
1584 EFI_MACHINE_TYPE_NAME = ''
1589 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1591 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
1595 conf.set10('ENABLE_EFI', have)
1597 ############################################################
1599 generate_gperfs = find_program('tools/generate-gperfs.py')
1600 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1601 make_directive_index_py = find_program('tools/make-directive-index.py')
1602 make_man_index_py = find_program('tools/make-man-index.py')
1603 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1604 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1605 update_hwdb_sh = find_program('tools/update-hwdb.sh')
1606 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1607 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1608 xml_helper_py = find_program('tools/xml_helper.py')
1610 #####################################################################
1612 config_h = configure_file(
1613 output : 'config.h',
1614 configuration : conf)
1616 add_project_arguments('-include', 'config.h', language : 'c')
1618 ############################################################
1620 # binaries that have --help and are intended for use by humans,
1621 # usually, but not always, installed in /bin.
1622 public_programs = []
1627 basic_includes = include_directories(
1633 libsystemd_includes = [basic_includes, include_directories(
1634 'src/libsystemd/sd-bus',
1635 'src/libsystemd/sd-device',
1636 'src/libsystemd/sd-event',
1637 'src/libsystemd/sd-hwdb',
1638 'src/libsystemd/sd-id128',
1639 'src/libsystemd/sd-journal',
1640 'src/libsystemd/sd-netlink',
1641 'src/libsystemd/sd-network',
1642 'src/libsystemd/sd-resolve')]
1644 includes = [libsystemd_includes, include_directories('src/shared')]
1648 subdir('src/fundamental')
1650 subdir('src/libsystemd')
1651 subdir('src/shared')
1653 subdir('src/libudev')
1655 libsystemd = shared_library(
1658 version : libsystemd_version,
1659 include_directories : libsystemd_includes,
1660 link_args : ['-shared',
1661 '-Wl,--version-script=' + libsystemd_sym_path],
1662 link_with : [libbasic,
1664 link_whole : [libsystemd_static],
1665 dependencies : [threads,
1670 link_depends : libsystemd_sym,
1672 install_dir : rootlibdir)
1674 install_libsystemd_static = static_library(
1678 basic_gcrypt_sources,
1679 fundamental_sources,
1681 include_directories : libsystemd_includes,
1682 build_by_default : static_libsystemd != 'false',
1683 install : static_libsystemd != 'false',
1684 install_dir : rootlibdir,
1685 pic : static_libsystemd_pic,
1686 dependencies : [threads,
1696 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1698 libudev = shared_library(
1701 version : libudev_version,
1702 include_directories : includes,
1703 link_args : ['-shared',
1704 '-Wl,--version-script=' + libudev_sym_path],
1705 link_with : [libsystemd_static, libshared_static],
1706 link_whole : libudev_basic,
1707 dependencies : [threads],
1708 link_depends : libudev_sym,
1710 install_dir : rootlibdir)
1712 install_libudev_static = static_library(
1715 fundamental_sources,
1720 include_directories : includes,
1721 build_by_default : static_libudev != 'false',
1722 install : static_libudev != 'false',
1723 install_dir : rootlibdir,
1724 link_depends : libudev_sym,
1725 dependencies : libshared_deps + [libmount],
1726 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1727 pic : static_libudev_pic)
1729 ############################################################
1731 # systemd-analyze requires 'libcore'
1733 # systemd-journal-remote requires 'libjournal_core'
1734 subdir('src/journal')
1735 # systemd-networkd requires 'libsystemd_network'
1736 subdir('src/libsystemd-network')
1738 subdir('src/analyze')
1739 subdir('src/boot/efi')
1740 subdir('src/busctl')
1741 subdir('src/coredump')
1742 subdir('src/cryptenroll')
1743 subdir('src/cryptsetup')
1745 subdir('src/hostname')
1746 subdir('src/import')
1747 subdir('src/journal-remote')
1748 subdir('src/kernel-install')
1749 subdir('src/locale')
1751 subdir('src/machine')
1752 subdir('src/network')
1753 subdir('src/nspawn')
1755 subdir('src/partition')
1756 subdir('src/portable')
1757 subdir('src/pstore')
1758 subdir('src/resolve')
1760 subdir('src/shutdown')
1761 subdir('src/sysext')
1762 subdir('src/systemctl')
1763 subdir('src/timedate')
1764 subdir('src/timesync')
1765 subdir('src/tmpfiles')
1766 subdir('src/userdb')
1767 subdir('src/vconsole')
1768 subdir('src/xdg-autostart-generator')
1770 subdir('src/systemd')
1777 ############################################################
1779 # only static linking apart from libdl, to make sure that the
1780 # module is linked to all libraries that it uses.
1781 test_dlopen = executable(
1785 include_directories : includes,
1786 link_with : [libbasic],
1787 dependencies : [libdl],
1788 build_by_default : want_tests != 'false')
1790 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
1791 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
1792 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
1793 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
1795 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1799 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1800 version_script_arg = join_paths(project_source_root, sym)
1802 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
1803 if tuple.length() > 2
1804 foreach s : tuple[2]
1805 sources += ['src/nss-@0@/@1@'.format(module, s)]
1809 incs = tuple.length() > 3 ? tuple[3] : includes
1811 nss = shared_library(
1816 include_directories : incs,
1817 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1818 link_args : ['-Wl,-z,nodelete',
1820 '-Wl,--version-script=' + version_script_arg],
1821 link_with : [libsystemd_static,
1824 dependencies : [threads,
1828 install_dir : rootlibdir)
1830 # We cannot use shared_module because it does not support version suffix.
1831 # Unfortunately shared_library insists on creating the symlink…
1832 meson.add_install_script('sh', '-c',
1833 'rm $DESTDIR@0@/libnss_@1@.so'
1834 .format(rootlibdir, module))
1836 if want_tests != 'false'
1837 test('dlopen-nss_' + module,
1839 # path to dlopen must include a slash
1840 args : nss.full_path())
1845 ############################################################
1850 include_directories : includes,
1851 link_with : [libcore,
1853 dependencies : [versiondep,
1860 install_rpath : rootlibexecdir,
1862 install_dir : rootlibexecdir)
1864 meson.add_install_script(meson_make_symlink,
1865 join_paths(rootlibexecdir, 'systemd'),
1866 join_paths(rootsbindir, 'init'))
1868 public_programs += executable(
1870 systemd_analyze_sources,
1871 include_directories : core_includes,
1872 link_with : [libcore,
1874 dependencies : [versiondep,
1881 install_rpath : rootlibexecdir,
1882 install : conf.get('ENABLE_ANALYZE'))
1886 systemd_journald_sources,
1887 include_directories : includes,
1888 link_with : [libjournal_core,
1890 dependencies : [threads,
1895 install_rpath : rootlibexecdir,
1897 install_dir : rootlibexecdir)
1899 public_programs += executable(
1901 systemd_cat_sources,
1902 include_directories : includes,
1903 link_with : [libjournal_core,
1905 dependencies : [threads],
1906 install_rpath : rootlibexecdir,
1909 public_programs += executable(
1912 include_directories : includes,
1913 link_with : [libshared],
1914 dependencies : [threads,
1920 install_rpath : rootlibexecdir,
1922 install_dir : rootbindir)
1925 'systemd-getty-generator',
1926 'src/getty-generator/getty-generator.c',
1927 include_directories : includes,
1928 link_with : [libshared],
1929 install_rpath : rootlibexecdir,
1931 install_dir : systemgeneratordir)
1934 'systemd-debug-generator',
1935 'src/debug-generator/debug-generator.c',
1936 include_directories : includes,
1937 link_with : [libshared],
1938 install_rpath : rootlibexecdir,
1940 install_dir : systemgeneratordir)
1943 'systemd-run-generator',
1944 'src/run-generator/run-generator.c',
1945 include_directories : includes,
1946 link_with : [libshared],
1947 install_rpath : rootlibexecdir,
1949 install_dir : systemgeneratordir)
1952 'systemd-fstab-generator',
1953 'src/fstab-generator/fstab-generator.c',
1954 include_directories : includes,
1955 link_with : [libshared],
1956 install_rpath : rootlibexecdir,
1958 install_dir : systemgeneratordir)
1960 if conf.get('ENABLE_ENVIRONMENT_D') == 1
1962 '30-systemd-environment-d-generator',
1963 'src/environment-d-generator/environment-d-generator.c',
1964 include_directories : includes,
1965 link_with : [libshared],
1966 install_rpath : rootlibexecdir,
1968 install_dir : userenvgeneratordir)
1970 meson.add_install_script(meson_make_symlink,
1971 join_paths(sysconfdir, 'environment'),
1972 join_paths(environmentdir, '99-environment.conf'))
1975 if conf.get('ENABLE_HIBERNATE') == 1
1977 'systemd-hibernate-resume-generator',
1978 'src/hibernate-resume/hibernate-resume-generator.c',
1979 include_directories : includes,
1980 link_with : [libshared],
1981 install_rpath : rootlibexecdir,
1983 install_dir : systemgeneratordir)
1986 'systemd-hibernate-resume',
1987 'src/hibernate-resume/hibernate-resume.c',
1988 include_directories : includes,
1989 link_with : [libshared],
1990 install_rpath : rootlibexecdir,
1992 install_dir : rootlibexecdir)
1995 if conf.get('HAVE_BLKID') == 1
1997 'systemd-gpt-auto-generator',
1998 'src/gpt-auto-generator/gpt-auto-generator.c',
1999 include_directories : includes,
2000 link_with : [libshared],
2001 dependencies : libblkid,
2002 install_rpath : rootlibexecdir,
2004 install_dir : systemgeneratordir)
2006 public_programs += executable(
2008 'src/dissect/dissect.c',
2009 include_directories : includes,
2010 link_with : [libshared],
2011 install_rpath : rootlibexecdir,
2015 if conf.get('ENABLE_RESOLVE') == 1
2018 systemd_resolved_sources,
2019 include_directories : resolve_includes,
2020 link_with : [libshared,
2022 libsystemd_resolve_core],
2023 dependencies : systemd_resolved_dependencies,
2024 install_rpath : rootlibexecdir,
2026 install_dir : rootlibexecdir)
2028 public_programs += executable(
2031 include_directories : includes,
2032 link_with : [libshared,
2034 libsystemd_resolve_core],
2035 dependencies : [threads,
2039 install_rpath : rootlibexecdir,
2042 meson.add_install_script(meson_make_symlink,
2043 join_paths(bindir, 'resolvectl'),
2044 join_paths(rootsbindir, 'resolvconf'))
2046 meson.add_install_script(meson_make_symlink,
2047 join_paths(bindir, 'resolvectl'),
2048 join_paths(bindir, 'systemd-resolve'))
2051 if conf.get('ENABLE_LOGIND') == 1
2054 systemd_logind_sources,
2055 include_directories : includes,
2056 link_with : [liblogind_core,
2058 dependencies : [threads,
2060 install_rpath : rootlibexecdir,
2062 install_dir : rootlibexecdir)
2064 public_programs += executable(
2067 include_directories : includes,
2068 link_with : [libshared],
2069 dependencies : [threads,
2073 install_rpath : rootlibexecdir,
2075 install_dir : rootbindir)
2077 public_programs += executable(
2079 'src/login/inhibit.c',
2080 include_directories : includes,
2081 link_with : [libshared],
2082 install_rpath : rootlibexecdir,
2084 install_dir : rootbindir)
2086 if conf.get('HAVE_PAM') == 1
2087 version_script_arg = join_paths(project_source_root, pam_systemd_sym)
2088 pam_systemd = shared_library(
2092 include_directories : includes,
2093 link_args : ['-shared',
2094 '-Wl,--version-script=' + version_script_arg],
2095 link_with : [libsystemd_static,
2097 dependencies : [threads,
2100 link_depends : pam_systemd_sym,
2102 install_dir : pamlibdir)
2104 if want_tests != 'false'
2105 test('dlopen-pam_systemd',
2107 # path to dlopen must include a slash
2108 args : pam_systemd.full_path())
2113 'systemd-user-runtime-dir',
2114 user_runtime_dir_sources,
2115 include_directories : includes,
2116 link_with : [libshared],
2117 install_rpath : rootlibexecdir,
2119 install_dir : rootlibexecdir)
2122 if conf.get('HAVE_PAM') == 1
2124 'systemd-user-sessions',
2125 'src/user-sessions/user-sessions.c',
2126 include_directories : includes,
2127 link_with : [libshared],
2128 install_rpath : rootlibexecdir,
2130 install_dir : rootlibexecdir)
2133 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
2134 public_programs += executable(
2136 'src/boot/bootctl.c',
2137 include_directories : includes,
2138 link_with : [libshared],
2139 dependencies : [libblkid],
2140 install_rpath : rootlibexecdir,
2143 public_programs += executable(
2144 'systemd-bless-boot',
2145 'src/boot/bless-boot.c',
2146 include_directories : includes,
2147 link_with : [libshared],
2148 dependencies : [libblkid],
2149 install_rpath : rootlibexecdir,
2151 install_dir : rootlibexecdir)
2154 'systemd-bless-boot-generator',
2155 'src/boot/bless-boot-generator.c',
2156 include_directories : includes,
2157 link_with : [libshared],
2158 install_rpath : rootlibexecdir,
2160 install_dir : systemgeneratordir)
2164 'systemd-boot-check-no-failures',
2165 'src/boot/boot-check-no-failures.c',
2166 include_directories : includes,
2167 link_with : [libshared],
2168 dependencies : [libblkid],
2169 install_rpath : rootlibexecdir,
2171 install_dir : rootlibexecdir)
2173 public_programs += executable(
2174 'systemd-socket-activate',
2175 'src/activate/activate.c',
2176 include_directories : includes,
2177 link_with : [libshared],
2178 dependencies : [threads],
2179 install_rpath : rootlibexecdir,
2182 public_programs += executable(
2185 include_directories : includes,
2186 link_with : systemctl_link_with,
2187 dependencies : [threads,
2193 install_rpath : rootlibexecdir,
2195 install_dir : rootbindir)
2197 if conf.get('ENABLE_PORTABLED') == 1
2199 'systemd-portabled',
2200 systemd_portabled_sources,
2201 include_directories : includes,
2202 link_with : [libshared],
2203 dependencies : [threads],
2204 install_rpath : rootlibexecdir,
2206 install_dir : rootlibexecdir)
2208 public_programs += executable(
2210 'src/portable/portablectl.c',
2211 include_directories : includes,
2212 link_with : [libshared],
2213 dependencies : [threads],
2214 install_rpath : rootlibexecdir,
2216 install_dir : rootbindir)
2219 if conf.get('ENABLE_SYSEXT') == 1
2220 public_programs += executable(
2222 systemd_sysext_sources,
2223 include_directories : includes,
2224 link_with : [libshared],
2225 install_rpath : rootlibexecdir,
2227 install_dir : rootbindir)
2230 if conf.get('ENABLE_USERDB') == 1
2233 systemd_userwork_sources,
2234 include_directories : includes,
2235 link_with : [libshared],
2236 dependencies : [threads],
2237 install_rpath : rootlibexecdir,
2239 install_dir : rootlibexecdir)
2243 systemd_userdbd_sources,
2244 include_directories : includes,
2245 link_with : [libshared],
2246 dependencies : [threads],
2247 install_rpath : rootlibexecdir,
2249 install_dir : rootlibexecdir)
2251 public_programs += executable(
2254 include_directories : includes,
2255 link_with : [libshared],
2256 dependencies : [threads],
2257 install_rpath : rootlibexecdir,
2259 install_dir : rootbindir)
2262 if conf.get('ENABLE_HOMED') == 1
2265 systemd_homework_sources,
2266 include_directories : includes,
2267 link_with : [libshared],
2268 dependencies : [threads,
2275 install_rpath : rootlibexecdir,
2277 install_dir : rootlibexecdir)
2281 systemd_homed_sources,
2282 include_directories : home_includes,
2283 link_with : [libshared],
2284 dependencies : [threads,
2287 install_rpath : rootlibexecdir,
2289 install_dir : rootlibexecdir)
2291 public_programs += executable(
2294 include_directories : includes,
2295 link_with : [libshared],
2296 dependencies : [threads,
2301 install_rpath : rootlibexecdir,
2303 install_dir : rootbindir)
2305 if conf.get('HAVE_PAM') == 1
2306 version_script_arg = join_paths(project_source_root, pam_systemd_home_sym)
2307 pam_systemd = shared_library(
2311 include_directories : includes,
2312 link_args : ['-shared',
2313 '-Wl,--version-script=' + version_script_arg],
2314 link_with : [libsystemd_static,
2316 dependencies : [threads,
2320 link_depends : pam_systemd_home_sym,
2322 install_dir : pamlibdir)
2326 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2327 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2328 meson.add_install_script(meson_make_symlink,
2329 join_paths(rootbindir, 'systemctl'),
2330 join_paths(rootsbindir, alias))
2333 meson.add_install_script(meson_make_symlink,
2334 join_paths(rootbindir, 'udevadm'),
2335 join_paths(rootlibexecdir, 'systemd-udevd'))
2337 if conf.get('ENABLE_BACKLIGHT') == 1
2339 'systemd-backlight',
2340 'src/backlight/backlight.c',
2341 include_directories : includes,
2342 link_with : [libshared],
2343 install_rpath : rootlibexecdir,
2345 install_dir : rootlibexecdir)
2348 if conf.get('ENABLE_RFKILL') == 1
2351 'src/rfkill/rfkill.c',
2352 include_directories : includes,
2353 link_with : [libshared],
2354 install_rpath : rootlibexecdir,
2356 install_dir : rootlibexecdir)
2360 'systemd-system-update-generator',
2361 'src/system-update-generator/system-update-generator.c',
2362 include_directories : includes,
2363 link_with : [libshared],
2364 install_rpath : rootlibexecdir,
2366 install_dir : systemgeneratordir)
2368 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2370 'systemd-cryptsetup',
2371 systemd_cryptsetup_sources,
2372 include_directories : includes,
2373 link_with : [libshared],
2374 dependencies : [libcryptsetup,
2376 install_rpath : rootlibexecdir,
2378 install_dir : rootlibexecdir)
2381 'systemd-cryptsetup-generator',
2382 'src/cryptsetup/cryptsetup-generator.c',
2383 include_directories : includes,
2384 link_with : [libshared],
2385 install_rpath : rootlibexecdir,
2387 install_dir : systemgeneratordir)
2390 'systemd-veritysetup',
2391 'src/veritysetup/veritysetup.c',
2392 include_directories : includes,
2393 link_with : [libshared],
2394 dependencies : [libcryptsetup],
2395 install_rpath : rootlibexecdir,
2397 install_dir : rootlibexecdir)
2400 'systemd-veritysetup-generator',
2401 'src/veritysetup/veritysetup-generator.c',
2402 include_directories : includes,
2403 link_with : [libshared],
2404 install_rpath : rootlibexecdir,
2406 install_dir : systemgeneratordir)
2409 'systemd-cryptenroll',
2410 systemd_cryptenroll_sources,
2411 include_directories : includes,
2412 link_with : [libshared],
2413 dependencies : [libcryptsetup,
2417 install_rpath : rootlibexecdir,
2421 if conf.get('HAVE_SYSV_COMPAT') == 1
2423 'systemd-sysv-generator',
2424 'src/sysv-generator/sysv-generator.c',
2425 include_directories : includes,
2426 link_with : [libshared],
2427 install_rpath : rootlibexecdir,
2429 install_dir : systemgeneratordir)
2432 'systemd-rc-local-generator',
2433 'src/rc-local-generator/rc-local-generator.c',
2434 include_directories : includes,
2435 link_with : [libshared],
2436 install_rpath : rootlibexecdir,
2438 install_dir : systemgeneratordir)
2441 if conf.get('ENABLE_XDG_AUTOSTART') == 1
2443 'systemd-xdg-autostart-generator',
2444 systemd_xdg_autostart_generator_sources,
2445 include_directories : includes,
2446 link_with : [libshared],
2447 install_rpath : rootlibexecdir,
2449 install_dir : usergeneratordir)
2452 'systemd-xdg-autostart-condition',
2453 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2454 include_directories : includes,
2455 link_with : [libshared],
2456 install_rpath : rootlibexecdir,
2458 install_dir : rootlibexecdir)
2461 if conf.get('ENABLE_HOSTNAMED') == 1
2463 'systemd-hostnamed',
2464 'src/hostname/hostnamed.c',
2465 include_directories : includes,
2466 link_with : [libshared],
2467 install_rpath : rootlibexecdir,
2469 install_dir : rootlibexecdir)
2471 public_programs += executable(
2473 'src/hostname/hostnamectl.c',
2474 include_directories : includes,
2475 link_with : [libshared],
2476 install_rpath : rootlibexecdir,
2480 if conf.get('ENABLE_LOCALED') == 1
2481 if conf.get('HAVE_XKBCOMMON') == 1
2482 # logind will load libxkbcommon.so dynamically on its own
2490 systemd_localed_sources,
2491 include_directories : includes,
2492 link_with : [libshared],
2493 dependencies : deps,
2494 install_rpath : rootlibexecdir,
2496 install_dir : rootlibexecdir)
2498 public_programs += executable(
2501 include_directories : includes,
2502 link_with : [libshared],
2503 install_rpath : rootlibexecdir,
2507 if conf.get('ENABLE_TIMEDATED') == 1
2509 'systemd-timedated',
2510 'src/timedate/timedated.c',
2511 include_directories : includes,
2512 link_with : [libshared],
2513 install_rpath : rootlibexecdir,
2515 install_dir : rootlibexecdir)
2518 if conf.get('ENABLE_TIMEDATECTL') == 1
2519 public_programs += executable(
2521 'src/timedate/timedatectl.c',
2522 include_directories : includes,
2523 install_rpath : rootlibexecdir,
2524 link_with : [libshared],
2525 dependencies : [libm],
2529 if conf.get('ENABLE_TIMESYNCD') == 1
2531 'systemd-timesyncd',
2532 systemd_timesyncd_sources,
2533 include_directories : includes,
2534 link_with : [libtimesyncd_core],
2535 dependencies : [threads,
2537 install_rpath : rootlibexecdir,
2539 install_dir : rootlibexecdir)
2542 'systemd-time-wait-sync',
2543 'src/timesync/wait-sync.c',
2544 include_directories : includes,
2545 link_with : [libtimesyncd_core],
2546 install_rpath : rootlibexecdir,
2548 install_dir : rootlibexecdir)
2551 if conf.get('ENABLE_MACHINED') == 1
2554 systemd_machined_sources,
2555 include_directories : includes,
2556 link_with : [libmachine_core,
2558 install_rpath : rootlibexecdir,
2560 install_dir : rootlibexecdir)
2562 public_programs += executable(
2564 'src/machine/machinectl.c',
2565 include_directories : includes,
2566 link_with : [libshared],
2567 dependencies : [threads,
2571 install_rpath : rootlibexecdir,
2573 install_dir : rootbindir)
2576 if conf.get('ENABLE_IMPORTD') == 1
2579 systemd_importd_sources,
2580 include_directories : includes,
2581 link_with : [libshared],
2582 dependencies : [threads],
2583 install_rpath : rootlibexecdir,
2585 install_dir : rootlibexecdir)
2587 systemd_pull = executable(
2589 systemd_pull_sources,
2590 include_directories : includes,
2591 link_with : [libshared],
2592 dependencies : [versiondep,
2598 install_rpath : rootlibexecdir,
2600 install_dir : rootlibexecdir)
2602 systemd_import = executable(
2604 systemd_import_sources,
2605 include_directories : includes,
2606 link_with : [libshared],
2607 dependencies : [libcurl,
2611 install_rpath : rootlibexecdir,
2613 install_dir : rootlibexecdir)
2615 systemd_import_fs = executable(
2616 'systemd-import-fs',
2617 systemd_import_fs_sources,
2618 include_directories : includes,
2619 link_with : [libshared],
2620 install_rpath : rootlibexecdir,
2622 install_dir : rootlibexecdir)
2624 systemd_export = executable(
2626 systemd_export_sources,
2627 include_directories : includes,
2628 link_with : [libshared],
2629 dependencies : [libcurl,
2633 install_rpath : rootlibexecdir,
2635 install_dir : rootlibexecdir)
2637 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2640 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2641 public_programs += executable(
2642 'systemd-journal-upload',
2643 systemd_journal_upload_sources,
2644 include_directories : includes,
2645 link_with : [libshared],
2646 dependencies : [versiondep,
2653 install_rpath : rootlibexecdir,
2655 install_dir : rootlibexecdir)
2658 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2659 public_programs += executable(
2660 'systemd-journal-remote',
2661 systemd_journal_remote_sources,
2662 include_directories : includes,
2663 link_with : [libshared,
2664 libsystemd_journal_remote],
2665 dependencies : [threads,
2671 install_rpath : rootlibexecdir,
2673 install_dir : rootlibexecdir)
2675 public_programs += executable(
2676 'systemd-journal-gatewayd',
2677 systemd_journal_gatewayd_sources,
2678 include_directories : includes,
2679 link_with : [libshared],
2680 dependencies : [threads,
2686 install_rpath : rootlibexecdir,
2688 install_dir : rootlibexecdir)
2691 if conf.get('ENABLE_COREDUMP') == 1
2694 systemd_coredump_sources,
2695 include_directories : includes,
2696 link_with : [libshared],
2697 dependencies : [threads,
2703 install_rpath : rootlibexecdir,
2705 install_dir : rootlibexecdir)
2707 public_programs += executable(
2709 coredumpctl_sources,
2710 include_directories : includes,
2711 link_with : [libshared],
2712 dependencies : [threads,
2716 install_rpath : rootlibexecdir,
2720 if conf.get('ENABLE_PSTORE') == 1
2723 systemd_pstore_sources,
2724 include_directories : includes,
2725 link_with : [libshared],
2726 dependencies : [threads,
2732 install_rpath : rootlibexecdir,
2734 install_dir : rootlibexecdir)
2737 if conf.get('ENABLE_OOMD') == 1
2738 executable('systemd-oomd',
2739 systemd_oomd_sources,
2740 include_directories : includes,
2741 link_with : [libshared],
2743 install_rpath : rootlibexecdir,
2745 install_dir : rootlibexecdir)
2747 public_programs += executable(
2750 include_directories : includes,
2751 link_with : [libshared],
2753 install_rpath : rootlibexecdir,
2755 install_dir : rootbindir)
2758 if conf.get('ENABLE_BINFMT') == 1
2759 public_programs += executable(
2761 'src/binfmt/binfmt.c',
2762 include_directories : includes,
2763 link_with : [libshared],
2764 install_rpath : rootlibexecdir,
2766 install_dir : rootlibexecdir)
2768 meson.add_install_script('sh', '-c',
2769 mkdir_p.format(binfmtdir))
2770 if install_sysconfdir
2771 meson.add_install_script('sh', '-c',
2772 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2776 if conf.get('ENABLE_REPART') == 1
2779 systemd_repart_sources,
2780 include_directories : includes,
2781 link_with : [libshared],
2782 dependencies : [threads,
2786 install_rpath : rootlibexecdir,
2788 install_dir : rootbindir)
2789 public_programs += exe
2791 if want_tests != 'false'
2794 args : exe.full_path())
2798 if conf.get('ENABLE_VCONSOLE') == 1
2800 'systemd-vconsole-setup',
2801 'src/vconsole/vconsole-setup.c',
2802 include_directories : includes,
2803 link_with : [libshared],
2804 install_rpath : rootlibexecdir,
2806 install_dir : rootlibexecdir)
2809 if conf.get('ENABLE_RANDOMSEED') == 1
2811 'systemd-random-seed',
2812 'src/random-seed/random-seed.c',
2813 include_directories : includes,
2814 link_with : [libshared],
2815 install_rpath : rootlibexecdir,
2817 install_dir : rootlibexecdir)
2820 if conf.get('ENABLE_FIRSTBOOT') == 1
2822 'systemd-firstboot',
2823 'src/firstboot/firstboot.c',
2824 include_directories : includes,
2825 link_with : [libshared],
2826 dependencies : [libcrypt],
2827 install_rpath : rootlibexecdir,
2829 install_dir : rootbindir)
2833 'systemd-remount-fs',
2834 'src/remount-fs/remount-fs.c',
2835 include_directories : includes,
2836 link_with : [libshared],
2837 install_rpath : rootlibexecdir,
2839 install_dir : rootlibexecdir)
2842 'systemd-machine-id-setup',
2843 'src/machine-id-setup/machine-id-setup-main.c',
2844 include_directories : includes,
2845 link_with : [libshared],
2846 install_rpath : rootlibexecdir,
2848 install_dir : rootbindir)
2853 include_directories : includes,
2854 link_with : [libshared],
2855 install_rpath : rootlibexecdir,
2857 install_dir : rootlibexecdir)
2859 executable('systemd-growfs',
2860 'src/partition/growfs.c',
2861 include_directories : includes,
2862 link_with : [libshared],
2863 install_rpath : rootlibexecdir,
2865 install_dir : rootlibexecdir)
2869 'src/partition/makefs.c',
2870 include_directories : includes,
2871 link_with : [libshared],
2872 install_rpath : rootlibexecdir,
2874 install_dir : rootlibexecdir)
2878 'src/sleep/sleep.c',
2879 include_directories : includes,
2880 link_with : [libshared],
2881 install_rpath : rootlibexecdir,
2883 install_dir : rootlibexecdir)
2885 if install_sysconfdir_samples
2886 install_data('src/sleep/sleep.conf',
2887 install_dir : pkgsysconfdir)
2890 public_programs += executable(
2892 'src/sysctl/sysctl.c',
2893 include_directories : includes,
2894 link_with : [libshared],
2895 install_rpath : rootlibexecdir,
2897 install_dir : rootlibexecdir)
2901 'src/ac-power/ac-power.c',
2902 include_directories : includes,
2903 link_with : [libshared],
2904 install_rpath : rootlibexecdir,
2906 install_dir : rootlibexecdir)
2908 public_programs += executable(
2909 'systemd-detect-virt',
2910 'src/detect-virt/detect-virt.c',
2911 include_directories : includes,
2912 link_with : [libshared],
2913 install_rpath : rootlibexecdir,
2916 public_programs += executable(
2918 'src/delta/delta.c',
2919 include_directories : includes,
2920 link_with : [libshared],
2921 install_rpath : rootlibexecdir,
2924 public_programs += executable(
2926 'src/escape/escape.c',
2927 include_directories : includes,
2928 link_with : [libshared],
2929 install_rpath : rootlibexecdir,
2931 install_dir : rootbindir)
2933 public_programs += executable(
2935 'src/notify/notify.c',
2936 include_directories : includes,
2937 link_with : [libshared],
2938 install_rpath : rootlibexecdir,
2940 install_dir : rootbindir)
2943 'systemd-volatile-root',
2944 'src/volatile-root/volatile-root.c',
2945 include_directories : includes,
2946 link_with : [libshared],
2947 install_rpath : rootlibexecdir,
2948 install : conf.get('ENABLE_INITRD') == 1,
2949 install_dir : rootlibexecdir)
2952 'systemd-cgroups-agent',
2953 'src/cgroups-agent/cgroups-agent.c',
2954 include_directories : includes,
2955 link_with : [libshared],
2956 install_rpath : rootlibexecdir,
2958 install_dir : rootlibexecdir)
2960 public_programs += executable(
2962 'src/id128/id128.c',
2963 include_directories : includes,
2964 link_with : [libshared],
2965 install_rpath : rootlibexecdir,
2968 public_programs += executable(
2971 include_directories : includes,
2972 link_with : [libshared],
2973 install_rpath : rootlibexecdir,
2976 public_programs += executable(
2977 'systemd-ask-password',
2978 'src/ask-password/ask-password.c',
2979 include_directories : includes,
2980 link_with : [libshared],
2981 install_rpath : rootlibexecdir,
2983 install_dir : rootbindir)
2986 'systemd-reply-password',
2987 'src/reply-password/reply-password.c',
2988 include_directories : includes,
2989 link_with : [libshared],
2990 install_rpath : rootlibexecdir,
2992 install_dir : rootlibexecdir)
2994 public_programs += executable(
2995 'systemd-tty-ask-password-agent',
2996 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2997 include_directories : includes,
2998 link_with : [libshared],
2999 install_rpath : rootlibexecdir,
3001 install_dir : rootbindir)
3003 public_programs += executable(
3006 include_directories : includes,
3007 link_with : [libshared],
3008 install_rpath : rootlibexecdir,
3011 public_programs += executable(
3013 'src/cgtop/cgtop.c',
3014 include_directories : includes,
3015 link_with : [libshared],
3016 install_rpath : rootlibexecdir,
3021 'src/initctl/initctl.c',
3022 include_directories : includes,
3023 link_with : [libshared],
3024 install_rpath : rootlibexecdir,
3025 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3026 install_dir : rootlibexecdir)
3028 public_programs += executable(
3030 'src/mount/mount-tool.c',
3031 include_directories : includes,
3032 link_with : [libshared],
3033 dependencies: [libmount],
3034 install_rpath : rootlibexecdir,
3037 meson.add_install_script(meson_make_symlink,
3038 'systemd-mount', join_paths(bindir, 'systemd-umount'))
3040 public_programs += executable(
3043 include_directories : includes,
3044 link_with : [libshared],
3045 install_rpath : rootlibexecdir,
3048 public_programs += executable(
3049 'systemd-stdio-bridge',
3050 'src/stdio-bridge/stdio-bridge.c',
3051 include_directories : includes,
3052 link_with : [libshared],
3053 dependencies : [versiondep],
3054 install_rpath : rootlibexecdir,
3057 public_programs += executable(
3060 include_directories : includes,
3061 link_with : [libshared],
3062 install_rpath : rootlibexecdir,
3068 'src/sysusers/sysusers.c',
3069 include_directories : includes,
3070 link_with : [libshared],
3071 install_rpath : rootlibexecdir,
3073 install_dir : rootbindir)
3074 public_programs += exe
3076 if want_tests != 'false'
3077 test('test-sysusers',
3079 # https://github.com/mesonbuild/meson/issues/2681
3080 args : exe.full_path())
3083 if have_standalone_binaries
3085 'systemd-sysusers.standalone',
3086 'src/sysusers/sysusers.c',
3087 include_directories : includes,
3088 c_args : '-DSTANDALONE',
3089 link_with : [libshared_static,
3094 install_dir : rootbindir)
3095 public_programs += exe
3097 if want_tests != 'false'
3098 test('test-sysusers.standalone',
3100 # https://github.com/mesonbuild/meson/issues/2681
3101 args : exe.full_path())
3106 if conf.get('ENABLE_TMPFILES') == 1
3109 systemd_tmpfiles_sources,
3110 include_directories : includes,
3111 link_with : [libshared],
3112 dependencies : [libacl],
3113 install_rpath : rootlibexecdir,
3115 install_dir : rootbindir)
3116 public_programs += exe
3118 if want_tests != 'false'
3119 test('test-systemd-tmpfiles',
3120 test_systemd_tmpfiles_py,
3121 # https://github.com/mesonbuild/meson/issues/2681
3122 args : exe.full_path())
3125 if have_standalone_binaries
3126 public_programs += executable(
3127 'systemd-tmpfiles.standalone',
3128 systemd_tmpfiles_sources,
3129 include_directories : includes,
3130 c_args : '-DSTANDALONE',
3131 link_with : [libshared_static,
3135 dependencies : [libacl],
3137 install_dir : rootbindir)
3141 if conf.get('ENABLE_HWDB') == 1
3142 public_programs += executable(
3145 include_directories : includes,
3146 link_with : udev_link_with,
3147 install_rpath : udev_rpath,
3149 install_dir : rootbindir)
3152 if conf.get('ENABLE_QUOTACHECK') == 1
3154 'systemd-quotacheck',
3155 'src/quotacheck/quotacheck.c',
3156 include_directories : includes,
3157 link_with : [libshared],
3158 install_rpath : rootlibexecdir,
3160 install_dir : rootlibexecdir)
3163 public_programs += executable(
3164 'systemd-socket-proxyd',
3165 'src/socket-proxy/socket-proxyd.c',
3166 include_directories : includes,
3167 link_with : [libshared],
3168 dependencies : [threads],
3169 install_rpath : rootlibexecdir,
3171 install_dir : rootlibexecdir)
3173 public_programs += executable(
3176 include_directories : includes,
3177 link_with : [libudevd_core],
3178 dependencies : [versiondep,
3184 install_rpath : udev_rpath,
3186 install_dir : rootbindir)
3190 systemd_shutdown_sources,
3191 include_directories : includes,
3192 link_with : [libshared],
3193 dependencies : [libmount],
3194 install_rpath : rootlibexecdir,
3196 install_dir : rootlibexecdir)
3199 'systemd-update-done',
3200 'src/update-done/update-done.c',
3201 include_directories : includes,
3202 link_with : [libshared],
3203 install_rpath : rootlibexecdir,
3205 install_dir : rootlibexecdir)
3208 'systemd-update-utmp',
3209 'src/update-utmp/update-utmp.c',
3210 include_directories : includes,
3211 link_with : [libshared],
3212 dependencies : [libaudit],
3213 install_rpath : rootlibexecdir,
3214 install : (conf.get('ENABLE_UTMP') == 1),
3215 install_dir : rootlibexecdir)
3217 if conf.get('HAVE_KMOD') == 1
3219 'systemd-modules-load',
3220 'src/modules-load/modules-load.c',
3221 include_directories : includes,
3222 link_with : [libshared],
3223 dependencies : [libkmod],
3224 install_rpath : rootlibexecdir,
3226 install_dir : rootlibexecdir)
3228 meson.add_install_script('sh', '-c',
3229 mkdir_p.format(modulesloaddir))
3230 if install_sysconfdir
3231 meson.add_install_script('sh', '-c',
3232 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
3236 public_programs += executable(
3238 systemd_nspawn_sources,
3239 include_directories : includes,
3240 link_with : [libnspawn_core,
3242 dependencies : [libblkid,
3244 install_rpath : rootlibexecdir,
3247 if conf.get('ENABLE_NETWORKD') == 1
3250 systemd_networkd_sources,
3251 include_directories : network_includes,
3252 link_with : [libnetworkd_core,
3254 networkd_link_with],
3255 dependencies : [threads],
3256 install_rpath : rootlibexecdir,
3258 install_dir : rootlibexecdir)
3261 'systemd-networkd-wait-online',
3262 systemd_networkd_wait_online_sources,
3263 include_directories : includes,
3264 link_with : [networkd_link_with],
3265 install_rpath : rootlibexecdir,
3267 install_dir : rootlibexecdir)
3269 public_programs += executable(
3272 include_directories : libsystemd_network_includes,
3273 link_with : [libsystemd_network,
3274 networkd_link_with],
3275 install_rpath : rootlibexecdir,
3277 install_dir : rootbindir)
3280 'systemd-network-generator',
3281 network_generator_sources,
3282 include_directories : includes,
3283 link_with : [networkd_link_with],
3284 install_rpath : rootlibexecdir,
3286 install_dir : rootlibexecdir)
3288 if want_tests != 'false'
3289 test('test-network-generator-conversion',
3290 test_network_generator_conversion_sh,
3291 # https://github.com/mesonbuild/meson/issues/2681
3292 args : exe.full_path())
3297 'systemd-sulogin-shell',
3298 'src/sulogin-shell/sulogin-shell.c',
3299 include_directories : includes,
3300 link_with : [libshared],
3301 install_rpath : rootlibexecdir,
3303 install_dir : rootlibexecdir)
3305 ############################################################
3308 'systemd-runtest.env',
3309 output : 'systemd-runtest.env',
3310 command : ['sh', '-c', '{ ' +
3311 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
3312 'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(project_build_root, 'catalog')) +
3314 build_by_default : true)
3316 foreach tuple : tests
3318 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3319 dependencies = tuple.length() > 2 ? tuple[2] : []
3320 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3321 condition = tuple.length() > 4 ? tuple[4] : ''
3322 type = tuple.length() > 5 ? tuple[5] : ''
3323 defs = tuple.length() > 6 ? tuple[6] : []
3324 parallel = tuple.length() > 7 ? tuple[7] : true
3327 name = sources[0].split('/')[-1].split('.')[0]
3328 if type.startswith('timeout=')
3329 timeout = type.split('=')[1].to_int()
3333 if condition == '' or conf.get(condition) == 1
3337 include_directories : incs,
3338 link_with : link_with,
3339 dependencies : [versiondep,
3342 build_by_default : want_tests != 'false',
3343 install_rpath : rootlibexecdir,
3344 install : install_tests,
3345 install_dir : join_paths(testsdir, type))
3348 message('@0@ is a manual test'.format(name))
3349 elif type == 'unsafe' and want_tests != 'unsafe'
3350 message('@0@ is an unsafe test'.format(name))
3351 elif want_tests != 'false'
3357 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3362 'test-libsystemd-sym',
3363 test_libsystemd_sym_c,
3364 include_directories : includes,
3365 link_with : [libsystemd],
3366 build_by_default : want_tests != 'false',
3367 install : install_tests,
3368 install_dir : testsdir)
3369 if want_tests != 'false'
3370 test('test-libsystemd-sym', exe)
3374 'test-libsystemd-static-sym',
3375 test_libsystemd_sym_c,
3376 include_directories : includes,
3377 link_with : [install_libsystemd_static],
3378 dependencies : [threads], # threads is already included in dependencies on the library,
3379 # but does not seem to get propagated. Add here as a work-around.
3380 build_by_default : want_tests != 'false' and static_libsystemd_pic,
3381 install : install_tests and static_libsystemd_pic,
3382 install_dir : testsdir)
3383 if want_tests != 'false' and static_libsystemd_pic
3384 test('test-libsystemd-static-sym', exe)
3390 include_directories : libudev_includes,
3391 c_args : '-Wno-deprecated-declarations',
3392 link_with : [libudev],
3393 build_by_default : want_tests != 'false',
3394 install : install_tests,
3395 install_dir : testsdir)
3396 if want_tests != 'false'
3397 test('test-libudev-sym', exe)
3401 'test-libudev-static-sym',
3403 include_directories : libudev_includes,
3404 c_args : '-Wno-deprecated-declarations',
3405 link_with : [install_libudev_static],
3406 build_by_default : want_tests != 'false' and static_libudev_pic,
3407 install : install_tests and static_libudev_pic,
3408 install_dir : testsdir)
3409 if want_tests != 'false' and static_libudev_pic
3410 test('test-libudev-static-sym', exe)
3413 ############################################################
3417 foreach tuple : fuzzers
3419 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3420 dependencies = tuple.length() > 2 ? tuple[2] : []
3421 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3422 defs = tuple.length() > 4 ? tuple[4] : []
3426 dependencies += fuzzing_engine
3428 if fuzzing_engine.found()
3429 dependencies += fuzzing_engine
3431 link_args += ['-fsanitize=fuzzer']
3434 sources += 'src/fuzz/fuzz-main.c'
3437 name = sources[0].split('/')[-1].split('.')[0]
3439 fuzzer_exes += executable(
3442 include_directories : [incs, include_directories('src/fuzz')],
3443 link_with : link_with,
3444 dependencies : dependencies,
3446 link_args: link_args,
3448 build_by_default : fuzz_tests or fuzzer_build)
3453 depends : fuzzer_exes,
3456 ############################################################
3459 subdir('sysusers.d')
3460 subdir('tmpfiles.d')
3466 subdir('shell-completion/bash')
3467 subdir('shell-completion/zsh')
3468 subdir('docs/sysvinit')
3469 subdir('docs/var-log')
3471 install_subdir('factory/etc',
3472 install_dir : factorydir)
3474 if install_sysconfdir
3475 install_data('xorg/50-systemd-user.sh',
3476 install_dir : xinitrcdir)
3478 install_data('README',
3479 'modprobe.d/systemd.conf',
3480 install_dir : modprobedir)
3481 install_data('LICENSE.GPL2',
3485 'docs/CODING_STYLE.md',
3486 'docs/DISTRO_PORTING.md',
3487 'docs/ENVIRONMENT.md',
3489 'docs/TRANSIENT-SETTINGS.md',
3490 'docs/TRANSLATORS.md',
3491 'docs/UIDS-GIDS.md',
3492 'docs/GVARIANT-SERIALIZATION.md',
3493 install_dir : docdir)
3495 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3496 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3498 ############################################################
3500 check_help = find_program('tools/check-help.sh')
3502 foreach exec : public_programs
3503 name = exec.full_path().split('/')[-1]
3504 if want_tests != 'false'
3505 test('check-help-' + name,
3507 args : exec.full_path())
3511 ############################################################
3513 check_directives_sh = find_program('tools/check-directives.sh')
3515 if want_tests != 'false'
3516 test('check-directives',
3517 check_directives_sh,
3518 args : project_source_root)
3521 ############################################################
3523 # Enable tests for all supported sanitizers
3524 foreach tuple : sanitizers
3525 sanitizer = tuple[0]
3528 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3530 foreach p : fuzz_regression_tests
3531 b = p.split('/')[-2]
3532 c = p.split('/')[-1]
3534 name = '@0@:@1@'.format(b, sanitizer)
3537 if want_tests == 'false'
3538 message('Not compiling @0@ because tests is set to false'.format(name))
3540 exe = custom_target(
3544 command : [env, 'ln', '-fs',
3545 join_paths(build.full_path(), b),
3547 build_by_default : true)
3549 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
3555 test('@0@_@1@_@2@'.format(b, c, sanitizer),
3557 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3559 args : [exe.full_path(),
3560 join_paths(project_source_root, p)])
3567 ############################################################
3570 all_files = run_command(
3571 'env', '-u', 'GIT_WORK_TREE',
3573 '--git-dir=@0@/.git'.format(project_source_root),
3574 'ls-files', ':/*.[ch]')
3576 all_files = files(all_files.stdout().split())
3581 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
3584 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
3588 git_contrib_sh = find_program('tools/git-contrib.sh')
3591 command : [git_contrib_sh])
3595 git_head = run_command(
3597 ['--git-dir=@0@/.git'.format(project_source_root),
3598 'rev-parse', 'HEAD']).stdout().strip()
3599 git_head_short = run_command(
3601 ['--git-dir=@0@/.git'.format(project_source_root),
3602 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3606 command : ['git', 'archive',
3607 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
3609 '--prefix', 'systemd-@0@/'.format(git_head),
3613 ############################################################
3615 check_api_docs_sh = find_program('tools/check-api-docs.sh')
3618 depends : [man, libsystemd, libudev],
3619 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3621 ############################################################
3623 if dbus_docs.length() > 0
3626 output : 'update-dbus-docs',
3627 command : [update_dbus_docs_py,
3628 '--build-dir=@0@'.format(project_build_root),
3632 if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER'
3633 test('dbus-docs-fresh',
3634 update_dbus_docs_py,
3635 args : ['--build-dir=@0@'.format(project_build_root),
3636 '--test'] + dbus_docs)
3642 output : 'update-man-rules',
3643 command : ['sh', '-c',
3644 'cd @0@ && '.format(meson.build_root()) +
3645 'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) +
3646 'mv t @0@/man/rules/meson.build'.format(meson.current_source_dir())],
3647 depend_files : custom_entities_ent)
3649 ############################################################
3650 watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog
3653 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3655 'build mode: @0@'.format(get_option('mode')),
3656 'split /usr: @0@'.format(split_usr),
3657 'split bin-sbin: @0@'.format(split_bin),
3658 'prefix directory: @0@'.format(prefixdir),
3659 'rootprefix directory: @0@'.format(rootprefixdir),
3660 'sysconf directory: @0@'.format(sysconfdir),
3661 'include directory: @0@'.format(includedir),
3662 'lib directory: @0@'.format(libdir),
3663 'rootlib directory: @0@'.format(rootlibdir),
3664 'SysV init scripts: @0@'.format(sysvinit_path),
3665 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3666 'PAM modules directory: @0@'.format(pamlibdir),
3667 'PAM configuration directory: @0@'.format(pamconfdir),
3668 'RPM macros directory: @0@'.format(rpmmacrosdir),
3669 'modprobe.d directory: @0@'.format(modprobedir),
3670 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3671 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3672 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3673 'bash completions directory: @0@'.format(bashcompletiondir),
3674 'zsh completions directory: @0@'.format(zshcompletiondir),
3675 'extra start script: @0@'.format(get_option('rc-local')),
3676 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3677 get_option('debug-tty')),
3678 'TTY GID: @0@'.format(tty_gid),
3679 'users GID: @0@'.format(substs.get('USERS_GID')),
3680 'system UIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
3681 conf.get('SYSTEM_ALLOC_UID_MIN')),
3682 'system GIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
3683 conf.get('SYSTEM_ALLOC_GID_MIN')),
3684 'dynamic UIDs: @0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
3685 'container UID bases: @0@…@1@'.format(container_uid_base_min, container_uid_base_max),
3686 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3687 'render group access mode: @0@'.format(get_option('group-render-mode')),
3688 'certificate root directory: @0@'.format(get_option('certificate-root')),
3689 'support URL: @0@'.format(support_url),
3690 'nobody user name: @0@'.format(nobody_user),
3691 'nobody group name: @0@'.format(nobody_group),
3692 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3694 'default DNSSEC mode: @0@'.format(default_dnssec),
3695 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
3696 'default mDNS mode: @0@'.format(default_mdns),
3697 'default LLMNR mode: @0@'.format(default_llmnr),
3698 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3699 'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
3700 'default KillUserProcesses setting: @0@'.format(kill_user_processes),
3701 'default locale: @0@'.format(default_locale),
3702 'default user $PATH: @0@'.format(default_user_path_display),
3703 'systemd service watchdog: @0@'.format(watchdog_opt)]
3705 alt_dns_servers = '\n '.join(dns_servers.split(' '))
3706 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3708 'default DNS servers: @0@'.format(alt_dns_servers),
3709 'default NTP servers: @0@'.format(alt_ntp_servers)]
3711 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3712 '@@0@'.format(time_epoch)).stdout().strip()
3714 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3717 'static libsystemd: @0@'.format(static_libsystemd),
3718 'static libudev: @0@'.format(static_libudev)]
3721 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3722 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3723 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3725 if conf.get('ENABLE_EFI') == 1
3726 status += 'efi arch: @0@'.format(efi_arch)
3730 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3731 'EFI CC @0@'.format(' '.join(efi_cc)),
3732 'EFI lds: @0@'.format(efi_lds),
3733 'EFI crt0: @0@'.format(efi_crt0),
3734 'EFI include directory: @0@'.format(efi_incdir)]
3769 ['compat-mutable-uid-boundaries'],
3800 ['DNS-over-TLS(gnutls)', conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1],
3801 ['DNS-over-TLS(openssl)', conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1],
3806 ['legacy pkla', install_polkit_pkla],
3808 ['gnu-efi', have_gnu_efi],
3821 ['man pages', want_man],
3822 ['html pages', want_html],
3823 ['man page indices', want_man and have_lxml],
3828 ['adm group', get_option('adm-group')],
3829 ['wheel group', get_option('wheel-group')],
3832 ['debug mmap cache'],
3834 ['valgrind', conf.get('VALGRIND') == 1],
3835 ['trace logging', conf.get('LOG_TRACE') == 1],
3836 ['install tests', install_tests],
3837 ['link-udev-shared', get_option('link-udev-shared')],
3838 ['link-systemctl-shared', get_option('link-systemctl-shared')],
3839 ['link-networkd-shared', get_option('link-networkd-shared')],
3840 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
3841 ['kernel-install', get_option('kernel-install')],
3842 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
3844 ['standalone-binaries', get_option('standalone-binaries')],
3847 if tuple.length() >= 2
3850 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3851 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3852 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3863 'enabled features: @0@'.format(', '.join(found)),
3865 'disabled features: @0@'.format(', '.join(missing)),
3867 message('\n '.join(status))
3869 if rootprefixdir != rootprefix_default
3871 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3872 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3873 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))