]> git.ipfire.org Git - thirdparty/systemd.git/blob - meson.build
basic/openssl-util: Add sha256 hash wrapper
[thirdparty/systemd.git] / meson.build
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2
3 project('systemd', 'c',
4 version : '249',
5 license : 'LGPLv2+',
6 default_options: [
7 'c_std=gnu99',
8 'prefix=/usr',
9 'sysconfdir=/etc',
10 'localstatedir=/var',
11 'warning_level=2',
12 ],
13 meson_version : '>= 0.53.2',
14 )
15
16 libsystemd_version = '0.32.0'
17 libudev_version = '1.7.2'
18
19 conf = configuration_data()
20 conf.set_quoted('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
21 conf.set('PROJECT_VERSION', meson.project_version(),
22 description : 'Numerical project version (used where a simple number is expected)')
23
24 # This is to be used instead of meson.source_root(), as the latter will return
25 # the wrong result when systemd is being built as a meson subproject
26 project_source_root = meson.current_source_dir()
27 project_build_root = meson.current_build_dir()
28 relative_source_path = run_command('realpath',
29 '--relative-to=@0@'.format(project_build_root),
30 project_source_root,
31 check : true).stdout().strip()
32 conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
33
34 conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer',
35 description : 'tailor build to development or release builds')
36
37 want_ossfuzz = get_option('oss-fuzz')
38 want_libfuzzer = get_option('llvm-fuzz')
39 if want_ossfuzz and want_libfuzzer
40 error('only one of oss-fuzz or llvm-fuzz can be specified')
41 endif
42
43 skip_deps = want_ossfuzz or want_libfuzzer
44 fuzzer_build = want_ossfuzz or want_libfuzzer
45
46 #####################################################################
47
48 # Try to install the git pre-commit hook
49 add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
50 if add_git_hook_sh.found()
51 git_hook = run_command(add_git_hook_sh, check : false)
52 if git_hook.returncode() == 0
53 message(git_hook.stdout().strip())
54 endif
55 endif
56
57 #####################################################################
58
59 fs = import('fs')
60 if get_option('split-usr') == 'auto'
61 split_usr = not fs.is_symlink('/bin')
62 else
63 split_usr = get_option('split-usr') == 'true'
64 endif
65 if split_usr
66 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
67 + ' split-usr mode is going to be removed\n' +
68 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
69 endif
70 conf.set10('HAVE_SPLIT_USR', split_usr,
71 description : '/usr/bin and /bin directories are separate')
72
73 if get_option('split-bin') == 'auto'
74 split_bin = not fs.is_symlink('/usr/sbin')
75 else
76 split_bin = get_option('split-bin') == 'true'
77 endif
78 conf.set10('HAVE_SPLIT_BIN', split_bin,
79 description : 'bin and sbin directories are separate')
80
81 rootprefixdir = get_option('rootprefix')
82 # Unusual rootprefixdir values are used by some distros
83 # (see https://github.com/systemd/systemd/pull/7461).
84 rootprefix_default = split_usr ? '/' : '/usr'
85 if rootprefixdir == ''
86 rootprefixdir = rootprefix_default
87 endif
88 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
89
90 have_standalone_binaries = get_option('standalone-binaries')
91
92 sysvinit_path = get_option('sysvinit-path')
93 sysvrcnd_path = get_option('sysvrcnd-path')
94 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
95 description : 'SysV init scripts and rcN.d links are supported')
96 conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
97
98 if get_option('hibernate') and not get_option('initrd')
99 error('hibernate depends on initrd')
100 endif
101
102 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
103 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
104 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
105
106 # Meson ignores the preceding arguments when joining paths if an absolute
107 # component is encountered, so this should canonicalize various paths when they
108 # are absolute or relative.
109 prefixdir = get_option('prefix')
110 if not prefixdir.startswith('/')
111 error('Prefix is not absolute: "@0@"'.format(prefixdir))
112 endif
113 if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
114 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
115 rootprefixdir, prefixdir))
116 endif
117
118 bindir = prefixdir / get_option('bindir')
119 libdir = prefixdir / get_option('libdir')
120 sysconfdir = prefixdir / get_option('sysconfdir')
121 includedir = prefixdir / get_option('includedir')
122 datadir = prefixdir / get_option('datadir')
123 localstatedir = '/' / get_option('localstatedir')
124
125 rootbindir = rootprefixdir / 'bin'
126 rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin')
127 rootlibexecdir = rootprefixdir / 'lib/systemd'
128
129 rootlibdir = get_option('rootlibdir')
130 if rootlibdir == ''
131 rootlibdir = rootprefixdir / libdir.split('/')[-1]
132 endif
133
134 install_sysconfdir = get_option('install-sysconfdir') != 'false'
135 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
136 # Dirs of external packages
137 pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig'
138 pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
139 polkitpolicydir = datadir / 'polkit-1/actions'
140 polkitrulesdir = datadir / 'polkit-1/rules.d'
141 polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
142 xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d'
143 rpmmacrosdir = get_option('rpmmacrosdir')
144 if rpmmacrosdir != 'no'
145 rpmmacrosdir = prefixdir / rpmmacrosdir
146 endif
147 modprobedir = rootprefixdir / 'lib/modprobe.d'
148
149 # Our own paths
150 pkgdatadir = datadir / 'systemd'
151 environmentdir = prefixdir / 'lib/environment.d'
152 pkgsysconfdir = sysconfdir / 'systemd'
153 userunitdir = prefixdir / 'lib/systemd/user'
154 userpresetdir = prefixdir / 'lib/systemd/user-preset'
155 tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
156 sysusersdir = prefixdir / 'lib/sysusers.d'
157 sysctldir = prefixdir / 'lib/sysctl.d'
158 binfmtdir = prefixdir / 'lib/binfmt.d'
159 modulesloaddir = prefixdir / 'lib/modules-load.d'
160 networkdir = rootprefixdir / 'lib/systemd/network'
161 pkgincludedir = includedir / 'systemd'
162 systemgeneratordir = rootlibexecdir / 'system-generators'
163 usergeneratordir = prefixdir / 'lib/systemd/user-generators'
164 systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
165 userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
166 systemshutdowndir = rootlibexecdir / 'system-shutdown'
167 systemsleepdir = rootlibexecdir / 'system-sleep'
168 systemunitdir = rootprefixdir / 'lib/systemd/system'
169 systempresetdir = rootprefixdir / 'lib/systemd/system-preset'
170 udevlibexecdir = rootprefixdir / 'lib/udev'
171 udevrulesdir = udevlibexecdir / 'rules.d'
172 udevhwdbdir = udevlibexecdir / 'hwdb.d'
173 catalogdir = prefixdir / 'lib/systemd/catalog'
174 kernelinstalldir = prefixdir / 'lib/kernel/install.d'
175 factorydir = datadir / 'factory'
176 bootlibdir = prefixdir / 'lib/systemd/boot/efi'
177 testsdir = prefixdir / 'lib/systemd/tests'
178 systemdstatedir = localstatedir / 'lib/systemd'
179 catalogstatedir = systemdstatedir / 'catalog'
180 randomseeddir = localstatedir / 'lib/systemd'
181 profiledir = rootlibexecdir / 'portable' / 'profile'
182 ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
183
184 docdir = get_option('docdir')
185 if docdir == ''
186 docdir = datadir / 'doc/systemd'
187 endif
188
189 dbuspolicydir = get_option('dbuspolicydir')
190 if dbuspolicydir == ''
191 dbuspolicydir = datadir / 'dbus-1/system.d'
192 endif
193
194 dbussessionservicedir = get_option('dbussessionservicedir')
195 if dbussessionservicedir == ''
196 dbussessionservicedir = datadir / 'dbus-1/services'
197 endif
198
199 dbussystemservicedir = get_option('dbussystemservicedir')
200 if dbussystemservicedir == ''
201 dbussystemservicedir = datadir / 'dbus-1/system-services'
202 endif
203
204 pamlibdir = get_option('pamlibdir')
205 if pamlibdir == ''
206 pamlibdir = rootlibdir / 'security'
207 endif
208
209 pamconfdir = get_option('pamconfdir')
210 if pamconfdir == ''
211 pamconfdir = prefixdir / 'lib/pam.d'
212 endif
213
214 libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir')
215 if libcryptsetup_plugins_dir == ''
216 libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup'
217 endif
218
219 memory_accounting_default = get_option('memory-accounting-default')
220 status_unit_format_default = get_option('status-unit-format-default')
221
222 conf.set_quoted('BINFMT_DIR', binfmtdir)
223 conf.set_quoted('BOOTLIBDIR', bootlibdir)
224 conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database')
225 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
226 conf.set_quoted('DOC_DIR', docdir)
227 conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd')
228 conf.set_quoted('ENVIRONMENT_DIR', environmentdir)
229 conf.set_quoted('INCLUDE_DIR', includedir)
230 conf.set_quoted('LIBDIR', libdir)
231 conf.set_quoted('MODPROBE_DIR', modprobedir)
232 conf.set_quoted('MODULESLOAD_DIR', modulesloaddir)
233 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
234 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent')
235 conf.set_quoted('PREFIX', prefixdir)
236 conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed')
237 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
238 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
239 conf.set_quoted('ROOTBINDIR', rootbindir)
240 conf.set_quoted('ROOTLIBDIR', rootlibdir)
241 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
242 conf.set_quoted('ROOTPREFIX', rootprefixdir)
243 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
244 conf.set_quoted('SYSCONF_DIR', sysconfdir)
245 conf.set_quoted('SYSCTL_DIR', sysctldir)
246 conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl')
247 conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd')
248 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
249 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent')
250 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup')
251 conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export')
252 conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck')
253 conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs')
254 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework')
255 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs')
256 conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import')
257 conf.set_quoted('SYSTEMD_INTEGRITYSETUP_PATH', rootlibexecdir / 'systemd-integritysetup')
258 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map')
259 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map')
260 conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs')
261 conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull')
262 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown')
263 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', bindir / 'systemd-stdio-bridge')
264 conf.set_quoted('SYSTEMD_TEST_DATA', testsdir / 'testdata')
265 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent')
266 conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper')
267 conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork')
268 conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup')
269 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system')
270 conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir)
271 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
272 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
273 conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
274 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
275 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
276 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
277 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
278 conf.set_quoted('SYSUSERS_DIR', sysusersdir)
279 conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
280 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
281 conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
282 conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
283 conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout'))
284 conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user')
285 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
286 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
287 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
288 conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg')
289 conf.set_quoted('USER_PRESET_DIR', userpresetdir)
290 conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg')
291
292 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
293 conf.set10('ENABLE_URLIFY', get_option('urlify'))
294 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
295 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
296 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
297 conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default)
298
299 #####################################################################
300
301 cc = meson.get_compiler('c')
302 pkgconfig = import('pkgconfig')
303 check_compilation_sh = find_program('tools/check-compilation.sh')
304 meson_build_sh = find_program('tools/meson-build.sh')
305
306 want_tests = get_option('tests')
307 slow_tests = want_tests != 'false' and get_option('slow-tests')
308 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
309 install_tests = get_option('install-tests')
310
311 if add_languages('cpp', required : fuzzer_build)
312 # Used only for tests
313 cxx = meson.get_compiler('cpp')
314 cxx_cmd = ' '.join(cxx.cmd_array())
315 else
316 cxx_cmd = ''
317 endif
318
319 if want_libfuzzer
320 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
321 if fuzzing_engine.found()
322 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
323 elif cc.has_argument('-fsanitize=fuzzer-no-link')
324 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
325 else
326 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
327 endif
328 elif want_ossfuzz
329 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
330 endif
331
332 # Those generate many false positives, and we do not want to change the code to
333 # avoid them.
334 basic_disabled_warnings = [
335 '-Wno-format-signedness',
336 '-Wno-missing-field-initializers',
337 '-Wno-unused-parameter',
338 ]
339
340 possible_common_cc_flags = [
341 '-Wdate-time',
342 '-Wendif-labels',
343 '-Werror=format=2',
344 '-Werror=implicit-function-declaration',
345 '-Werror=incompatible-pointer-types',
346 '-Werror=int-conversion',
347 '-Werror=overflow',
348 '-Werror=override-init',
349 '-Werror=return-type',
350 '-Werror=shift-count-overflow',
351 '-Werror=shift-overflow=2',
352 '-Werror=undef',
353 '-Wfloat-equal',
354 '-Wimplicit-fallthrough=5',
355 '-Winit-self',
356 '-Wlogical-op',
357 '-Wmissing-include-dirs',
358 '-Wmissing-noreturn',
359 '-Wnested-externs',
360 '-Wold-style-definition',
361 '-Wpointer-arith',
362 '-Wredundant-decls',
363 '-Wshadow',
364 '-Wstrict-aliasing=2',
365 '-Wstrict-prototypes',
366 '-Wsuggest-attribute=noreturn',
367 '-Wunused-function',
368 '-Wwrite-strings',
369
370 # negative arguments are correctly detected starting with meson 0.46.
371 '-Wno-error=#warnings', # clang
372 '-Wno-string-plus-int', # clang
373 ]
374
375 # Disable -Wmaybe-unitialized when compiling with -Os/-O1/-O3/etc. There are
376 # too many false positives with gcc >= 8. Effectively, we only test with -O0
377 # and -O2; this should be enough to catch most important cases without too much
378 # busywork. See https://github.com/systemd/systemd/pull/19226.
379 if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
380 cc.version().version_compare('<10'))
381 possible_common_cc_flags += '-Wno-maybe-uninitialized'
382 endif
383
384 # Disable -Wno-unused-result with gcc, see
385 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
386 if cc.get_id() == 'gcc'
387 possible_common_cc_flags += '-Wno-unused-result'
388 endif
389
390 # --as-needed and --no-undefined are provided by meson by default,
391 # run 'meson configure' to see what is enabled
392 possible_link_flags = [
393 '-Wl,--fatal-warnings',
394 '-Wl,-z,now',
395 '-Wl,-z,relro',
396 '-fstack-protector',
397 ]
398
399 if get_option('b_sanitize') == 'none'
400 possible_link_flags += '-Wl,--warn-common'
401 endif
402
403 if cc.get_id() == 'clang'
404 possible_common_cc_flags += [
405 '-Wno-typedef-redefinition',
406 '-Wno-gnu-variable-sized-type-not-at-end',
407 ]
408 endif
409
410 possible_cc_flags = possible_common_cc_flags + [
411 '-Werror=missing-declarations',
412 '-Werror=missing-prototypes',
413 '-fdiagnostics-show-option',
414 '-fno-common',
415 '-fno-strict-aliasing',
416 '-fstack-protector',
417 '-fstack-protector-strong',
418 '-fvisibility=hidden',
419 '--param=ssp-buffer-size=4',
420 ]
421
422 if get_option('buildtype') != 'debug'
423 possible_cc_flags += [
424 '-ffunction-sections',
425 '-fdata-sections',
426 ]
427
428 possible_link_flags += '-Wl,--gc-sections'
429 endif
430
431 add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
432 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
433 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
434
435 have = cc.has_argument('-Wzero-length-bounds')
436 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
437
438 if cc.compiles('''
439 #include <time.h>
440 #include <inttypes.h>
441 typedef uint64_t usec_t;
442 usec_t now(clockid_t clock);
443 int main(void) {
444 struct timespec now;
445 return 0;
446 }
447 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
448 add_project_arguments('-Werror=shadow', language : 'c')
449 endif
450
451 if cxx_cmd != ''
452 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
453 endif
454
455 cpp = ' '.join(cc.cmd_array()) + ' -E'
456
457 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
458
459 #####################################################################
460 # compilation result tests
461
462 conf.set('_GNU_SOURCE', true)
463 conf.set('__SANE_USERSPACE_TYPES__', true)
464 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
465
466 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
467 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
468 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
469 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
470
471 decl_headers = '''
472 #include <uchar.h>
473 #include <sys/mount.h>
474 #include <sys/stat.h>
475 #include <linux/fs.h>
476 '''
477
478 foreach decl : ['char16_t',
479 'char32_t',
480 'struct mount_attr',
481 'struct statx',
482 ]
483
484 # We get -1 if the size cannot be determined
485 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
486
487 if decl == 'struct statx'
488 if have
489 want_linux_stat_h = false
490 else
491 have = cc.sizeof(decl,
492 prefix : decl_headers + '#include <linux/stat.h>',
493 args : '-D_GNU_SOURCE') > 0
494 want_linux_stat_h = have
495 endif
496 endif
497
498 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
499 endforeach
500
501 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
502
503 foreach ident : ['secure_getenv', '__secure_getenv']
504 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
505 endforeach
506
507 foreach ident : [
508 ['memfd_create', '''#include <sys/mman.h>'''],
509 ['gettid', '''#include <sys/types.h>
510 #include <unistd.h>'''],
511 ['pivot_root', '''#include <stdlib.h>
512 #include <unistd.h>'''], # no known header declares pivot_root
513 ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get
514 ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set
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>
538 #include <unistd.h>
539 #include <signal.h>
540 #include <sys/wait.h>'''],
541 ['pidfd_open', '''#include <stdlib.h>
542 #include <unistd.h>
543 #include <signal.h>
544 #include <sys/wait.h>'''],
545 ['rt_sigqueueinfo', '''#include <stdlib.h>
546 #include <unistd.h>
547 #include <signal.h>
548 #include <sys/wait.h>'''],
549 ['mallinfo', '''#include <malloc.h>'''],
550 ['mallinfo2', '''#include <malloc.h>'''],
551 ['execveat', '''#include <unistd.h>'''],
552 ['close_range', '''#include <unistd.h>'''],
553 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
554 ['mount_setattr', '''#include <sys/mount.h>'''],
555 ['move_mount', '''#include <sys/mount.h>'''],
556 ['open_tree', '''#include <sys/mount.h>'''],
557 ['getdents64', '''#include <dirent.h>'''],
558 ]
559
560 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
561 conf.set10('HAVE_' + ident[0].to_upper(), have)
562 endforeach
563
564 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
565 conf.set10('USE_SYS_RANDOM_H', true)
566 conf.set10('HAVE_GETRANDOM', true)
567 else
568 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
569 conf.set10('USE_SYS_RANDOM_H', false)
570 conf.set10('HAVE_GETRANDOM', have)
571 endif
572
573 #####################################################################
574
575 version_tag = get_option('version-tag')
576 if version_tag != ''
577 vcs_data = configuration_data()
578 vcs_data.set('VCS_TAG', version_tag)
579 version_h = configure_file(configuration : vcs_data,
580 input : 'src/version/version.h.in',
581 output : 'version.h')
582 else
583 vcs_tagger = [
584 project_source_root + '/tools/meson-vcs-tag.sh',
585 project_source_root,
586 meson.project_version()]
587
588 version_h = vcs_tag(
589 input : 'src/version/version.h.in',
590 output : 'version.h',
591 command: vcs_tagger)
592 endif
593
594 versiondep = declare_dependency(sources: version_h)
595
596 sh = find_program('sh')
597 echo = find_program('echo')
598 sed = find_program('sed')
599 awk = find_program('awk')
600 stat = find_program('stat')
601 ln = find_program('ln')
602 git = find_program('git', required : false)
603 env = find_program('env')
604 perl = find_program('perl', required : false)
605 rsync = find_program('rsync', required : false)
606 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
607 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
608
609 mkdir_p = 'mkdir -p $DESTDIR/@0@'
610 splash_bmp = files('test/splash.bmp')
611
612 # If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
613 # /usr/sbin, /sbin, and fall back to the default from middle column.
614 progs = [['quotaon', '/usr/sbin/quotaon' ],
615 ['quotacheck', '/usr/sbin/quotacheck' ],
616 ['kmod', '/usr/bin/kmod' ],
617 ['kexec', '/usr/sbin/kexec' ],
618 ['sulogin', '/usr/sbin/sulogin' ],
619 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
620 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
621 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
622 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
623 ['nologin', '/usr/sbin/nologin', ],
624 ]
625 foreach prog : progs
626 path = get_option(prog[0] + '-path')
627 if path != ''
628 message('Using @1@ for @0@'.format(prog[0], path))
629 else
630 exe = find_program(prog[0],
631 '/usr/sbin/' + prog[0],
632 '/sbin/' + prog[0],
633 required: false)
634 path = exe.found() ? exe.path() : prog[1]
635 endif
636 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
637 conf.set_quoted(name, path)
638 endforeach
639
640 conf.set_quoted('TELINIT', get_option('telinit-path'))
641
642 if run_command(ln, '--relative', '--help', check : false).returncode() != 0
643 error('ln does not support --relative (added in coreutils 8.16)')
644 endif
645
646 ############################################################
647
648 if run_command('python3', '-c', 'import jinja2', check : false).returncode() != 0
649 error('python3 jinja2 missing')
650 endif
651
652 ############################################################
653
654 gperf = find_program('gperf')
655
656 gperf_test_format = '''
657 #include <string.h>
658 const char * in_word_set(const char *, @0@);
659 @1@
660 '''
661 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
662 gperf_snippet = run_command(sh, '-c', gperf_snippet_format.format(gperf.path()),
663 check : true)
664 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
665 if cc.compiles(gperf_test)
666 gperf_len_type = 'size_t'
667 else
668 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
669 if cc.compiles(gperf_test)
670 gperf_len_type = 'unsigned'
671 else
672 error('unable to determine gperf len type')
673 endif
674 endif
675 message('gperf len type is @0@'.format(gperf_len_type))
676 conf.set('GPERF_LEN_TYPE', gperf_len_type,
677 description : 'The type of gperf "len" parameter')
678
679 ############################################################
680
681 if not cc.has_header('sys/capability.h')
682 error('POSIX caps headers not found')
683 endif
684 foreach header : ['crypt.h',
685 'linux/memfd.h',
686 'linux/vm_sockets.h',
687 'sys/auxv.h',
688 'valgrind/memcheck.h',
689 'valgrind/valgrind.h',
690 'linux/time_types.h',
691 'sys/sdt.h',
692 ]
693
694 conf.set10('HAVE_' + header.underscorify().to_upper(),
695 cc.has_header(header))
696 endforeach
697
698 ############################################################
699
700 fallback_hostname = get_option('fallback-hostname')
701 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
702 error('Invalid fallback-hostname configuration')
703 # A more extensive test is done in test-hostname-util. Let's catch
704 # the most obvious errors here so we don't fail with an assert later.
705 endif
706 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
707
708 default_hierarchy = get_option('default-hierarchy')
709 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
710 description : 'default cgroup hierarchy as string')
711 if default_hierarchy == 'legacy'
712 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
713 elif default_hierarchy == 'hybrid'
714 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
715 else
716 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
717 endif
718
719 extra_net_naming_schemes = []
720 extra_net_naming_map = []
721 foreach scheme: get_option('extra-net-naming-schemes').split(',')
722 if scheme != ''
723 name = scheme.split('=')[0]
724 value = scheme.split('=')[1]
725 NAME = name.underscorify().to_upper()
726 VALUE = []
727 foreach field: value.split('+')
728 VALUE += 'NAMING_' + field.underscorify().to_upper()
729 endforeach
730 extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE))
731 extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME)
732 endif
733 endforeach
734 conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes))
735 conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map))
736
737 default_net_naming_scheme = get_option('default-net-naming-scheme')
738 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
739 if default_net_naming_scheme != 'latest'
740 conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST',
741 'NAMING_' + default_net_naming_scheme.underscorify().to_upper())
742 endif
743
744 time_epoch = get_option('time-epoch')
745 if time_epoch == -1
746 time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check : true).stdout().strip()
747 if time_epoch == '' and git.found() and fs.exists('.git')
748 # If we're in a git repository, use the creation time of the latest git tag.
749 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags',
750 check : false)
751 if latest_tag.returncode() == 0
752 time_epoch = run_command(
753 git, 'log', '--no-show-signature', '-1', '--format=%at',
754 latest_tag.stdout().strip(),
755 check : false).stdout()
756 endif
757 endif
758 if time_epoch == ''
759 NEWS = files('NEWS')
760 time_epoch = run_command(stat, '-c', '%Y', NEWS,
761 check : true).stdout()
762 endif
763 time_epoch = time_epoch.to_int()
764 endif
765 conf.set('TIME_EPOCH', time_epoch)
766
767 conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max'))
768
769 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
770 ['system-uid-max', 'SYS_UID_MAX', 999],
771 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
772 ['system-gid-max', 'SYS_GID_MAX', 999]]
773 v = get_option(tuple[0])
774 if v == -1
775 v = run_command(
776 awk,
777 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
778 '/etc/login.defs',
779 check : false).stdout().strip()
780 if v == ''
781 v = tuple[2]
782 else
783 v = v.to_int()
784 endif
785 endif
786 conf.set(tuple[0].underscorify().to_upper(), v)
787 endforeach
788 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
789 error('Invalid uid allocation range')
790 endif
791 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
792 error('Invalid gid allocation range')
793 endif
794
795 dynamic_uid_min = get_option('dynamic-uid-min')
796 dynamic_uid_max = get_option('dynamic-uid-max')
797 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
798 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
799
800 container_uid_base_min = get_option('container-uid-base-min')
801 container_uid_base_max = get_option('container-uid-base-max')
802 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
803 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
804
805 nobody_user = get_option('nobody-user')
806 nobody_group = get_option('nobody-group')
807
808 if not meson.is_cross_build()
809 getent_result = run_command('getent', 'passwd', '65534', check : false)
810 if getent_result.returncode() == 0
811 name = getent_result.stdout().split(':')[0]
812 if name != nobody_user
813 warning('\n' +
814 '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) +
815 'Your build will result in an user table setup that is incompatible with the local system.')
816 endif
817 endif
818 id_result = run_command('id', '-u', nobody_user, check : false)
819 if id_result.returncode() == 0
820 id = id_result.stdout().to_int()
821 if id != 65534
822 warning('\n' +
823 '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) +
824 'Your build will result in an user table setup that is incompatible with the local system.')
825 endif
826 endif
827
828 getent_result = run_command('getent', 'group', '65534', check : false)
829 if getent_result.returncode() == 0
830 name = getent_result.stdout().split(':')[0]
831 if name != nobody_group
832 warning('\n' +
833 '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) +
834 'Your build will result in an group table setup that is incompatible with the local system.')
835 endif
836 endif
837 id_result = run_command('id', '-g', nobody_group, check : false)
838 if id_result.returncode() == 0
839 id = id_result.stdout().to_int()
840 if id != 65534
841 warning('\n' +
842 'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n'.format(nobody_group, id) +
843 'Your build will result in an group table setup that is incompatible with the local system.')
844 endif
845 endif
846 endif
847 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
848 warning('\n' +
849 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
850 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
851 endif
852
853 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
854 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
855
856 static_ugids = []
857 foreach option : ['adm-gid',
858 'audio-gid',
859 'cdrom-gid',
860 'dialout-gid',
861 'disk-gid',
862 'input-gid',
863 'kmem-gid',
864 'kvm-gid',
865 'lp-gid',
866 'render-gid',
867 'sgx-gid',
868 'tape-gid',
869 'tty-gid',
870 'users-gid',
871 'utmp-gid',
872 'video-gid',
873 'wheel-gid',
874 'systemd-journal-gid',
875 'systemd-network-uid',
876 'systemd-resolve-uid',
877 'systemd-timesync-uid']
878 name = option.underscorify().to_upper()
879 val = get_option(option)
880
881 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
882 conf.set(name, val >= 0 ? val : '-')
883 if val >= 0
884 static_ugids += '@0@:@1@'.format(option, val)
885 endif
886 endforeach
887
888 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
889 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
890
891 dev_kvm_mode = get_option('dev-kvm-mode')
892 conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation
893 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
894 group_render_mode = get_option('group-render-mode')
895 conf.set_quoted('GROUP_RENDER_MODE', group_render_mode)
896 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
897
898 kill_user_processes = get_option('default-kill-user-processes')
899 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
900
901 dns_servers = get_option('dns-servers')
902 conf.set_quoted('DNS_SERVERS', dns_servers)
903
904 ntp_servers = get_option('ntp-servers')
905 conf.set_quoted('NTP_SERVERS', ntp_servers)
906
907 default_locale = get_option('default-locale')
908 if default_locale == ''
909 if not meson.is_cross_build()
910 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
911 default_locale = run_command(choose_default_locale_sh,
912 check : true).stdout().strip()
913 else
914 default_locale = 'C.UTF-8'
915 endif
916 endif
917 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
918
919 localegen_path = get_option('localegen-path')
920 if localegen_path != ''
921 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
922 endif
923 conf.set10('HAVE_LOCALEGEN', localegen_path != '')
924
925 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
926
927 service_watchdog = get_option('service-watchdog')
928 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
929 conf.set_quoted('SERVICE_WATCHDOG', watchdog_value)
930
931 conf.set_quoted('SUSHELL', get_option('debug-shell'))
932 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
933
934 enable_debug_hashmap = false
935 enable_debug_mmap_cache = false
936 enable_debug_siphash = false
937 foreach name : get_option('debug-extra')
938 if name == 'hashmap'
939 enable_debug_hashmap = true
940 elif name == 'mmap-cache'
941 enable_debug_mmap_cache = true
942 elif name == 'siphash'
943 enable_debug_siphash = true
944 else
945 message('unknown debug option "@0@", ignoring'.format(name))
946 endif
947 endforeach
948 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
949 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
950 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
951
952 conf.set10('VALGRIND', get_option('valgrind'))
953 conf.set10('LOG_TRACE', get_option('log-trace'))
954
955 default_user_path = get_option('user-path')
956 if default_user_path != ''
957 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
958 endif
959
960
961 #####################################################################
962
963 threads = dependency('threads')
964 librt = cc.find_library('rt')
965 libm = cc.find_library('m')
966 libdl = cc.find_library('dl')
967 libcrypt = cc.find_library('crypt')
968
969 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
970 foreach ident : [
971 ['crypt_ra', crypt_header],
972 ['crypt_preferred_method', crypt_header],
973 ['crypt_gensalt_ra', crypt_header]]
974
975 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
976 dependencies : libcrypt)
977 conf.set10('HAVE_' + ident[0].to_upper(), have)
978 endforeach
979
980 libcap = dependency('libcap', required : false)
981 if not libcap.found()
982 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
983 libcap = cc.find_library('cap')
984 endif
985
986 want_bpf_framework = get_option('bpf-framework')
987 bpf_framework_required = want_bpf_framework == 'true'
988
989 libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2')
990 conf.set10('HAVE_LIBBPF', libbpf.found())
991
992 if want_bpf_framework == 'false'
993 conf.set10('BPF_FRAMEWORK', 0)
994 else
995 clang = find_program('clang', required : bpf_framework_required)
996 llvm_strip = find_program('llvm-strip', required : bpf_framework_required)
997
998 # Debian installs this in /usr/sbin/ which is not in $PATH.
999 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1000 bpftool = find_program('bpftool', '/usr/sbin/bpftool', required : bpf_framework_required)
1001
1002 bpf_arches = ['x86_64']
1003 deps_found = libbpf.found() and clang.found() and llvm_strip.found() and bpftool.found()
1004 # Can build BPF program from source code in restricted C
1005 conf.set10('BPF_FRAMEWORK',
1006 bpf_arches.contains(host_machine.cpu_family()) and deps_found)
1007 endif
1008
1009 libmount = dependency('mount',
1010 version : fuzzer_build ? '>= 0' : '>= 2.30')
1011
1012 want_libfdisk = get_option('fdisk')
1013 if want_libfdisk != 'false' and not skip_deps
1014 libfdisk = dependency('fdisk',
1015 version : '>= 2.33',
1016 required : want_libfdisk == 'true')
1017 have = libfdisk.found()
1018 else
1019 have = false
1020 libfdisk = []
1021 endif
1022 conf.set10('HAVE_LIBFDISK', have)
1023
1024 want_pwquality = get_option('pwquality')
1025 if want_pwquality != 'false' and not skip_deps
1026 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1027 have = libpwquality.found()
1028 else
1029 have = false
1030 libpwquality = []
1031 endif
1032 conf.set10('HAVE_PWQUALITY', have)
1033
1034 want_seccomp = get_option('seccomp')
1035 if want_seccomp != 'false' and not skip_deps
1036 libseccomp = dependency('libseccomp',
1037 version : '>= 2.3.1',
1038 required : want_seccomp == 'true')
1039 have = libseccomp.found()
1040 else
1041 have = false
1042 libseccomp = []
1043 endif
1044 conf.set10('HAVE_SECCOMP', have)
1045
1046 want_selinux = get_option('selinux')
1047 if want_selinux != 'false' and not skip_deps
1048 libselinux = dependency('libselinux',
1049 version : '>= 2.1.9',
1050 required : want_selinux == 'true')
1051 have = libselinux.found()
1052 else
1053 have = false
1054 libselinux = []
1055 endif
1056 conf.set10('HAVE_SELINUX', have)
1057
1058 want_apparmor = get_option('apparmor')
1059 if want_apparmor != 'false' and not skip_deps
1060 libapparmor = dependency('libapparmor',
1061 version : '>= 2.13',
1062 required : want_apparmor == 'true')
1063 have = libapparmor.found()
1064 else
1065 have = false
1066 libapparmor = []
1067 endif
1068 conf.set10('HAVE_APPARMOR', have)
1069
1070 have = get_option('smack') and get_option('smack-run-label') != ''
1071 conf.set10('HAVE_SMACK_RUN_LABEL', have)
1072 if have
1073 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1074 endif
1075
1076 want_polkit = get_option('polkit')
1077 install_polkit = false
1078 install_polkit_pkla = false
1079 if want_polkit != 'false' and not skip_deps
1080 install_polkit = true
1081
1082 libpolkit = dependency('polkit-gobject-1',
1083 required : false)
1084 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1085 message('Old polkit detected, will install pkla files')
1086 install_polkit_pkla = true
1087 endif
1088 endif
1089 conf.set10('ENABLE_POLKIT', install_polkit)
1090
1091 want_acl = get_option('acl')
1092 if want_acl != 'false' and not skip_deps
1093 libacl = cc.find_library('acl', required : want_acl == 'true')
1094 have = libacl.found()
1095 else
1096 have = false
1097 libacl = []
1098 endif
1099 conf.set10('HAVE_ACL', have)
1100
1101 want_audit = get_option('audit')
1102 if want_audit != 'false' and not skip_deps
1103 libaudit = dependency('audit', required : want_audit == 'true')
1104 have = libaudit.found()
1105 else
1106 have = false
1107 libaudit = []
1108 endif
1109 conf.set10('HAVE_AUDIT', have)
1110
1111 want_blkid = get_option('blkid')
1112 if want_blkid != 'false' and not skip_deps
1113 libblkid = dependency('blkid', required : want_blkid == 'true')
1114 have = libblkid.found()
1115
1116 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1117 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1118 else
1119 have = false
1120 libblkid = []
1121 endif
1122 conf.set10('HAVE_BLKID', have)
1123
1124 want_kmod = get_option('kmod')
1125 if want_kmod != 'false' and not skip_deps
1126 libkmod = dependency('libkmod',
1127 version : '>= 15',
1128 required : want_kmod == 'true')
1129 have = libkmod.found()
1130 else
1131 have = false
1132 libkmod = []
1133 endif
1134 conf.set10('HAVE_KMOD', have)
1135
1136 want_pam = get_option('pam')
1137 if want_pam != 'false' and not skip_deps
1138 libpam = cc.find_library('pam', required : want_pam == 'true')
1139 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1140 have = libpam.found() and libpam_misc.found()
1141 else
1142 have = false
1143 libpam = []
1144 libpam_misc = []
1145 endif
1146 conf.set10('HAVE_PAM', have)
1147
1148 want_microhttpd = get_option('microhttpd')
1149 if want_microhttpd != 'false' and not skip_deps
1150 libmicrohttpd = dependency('libmicrohttpd',
1151 version : '>= 0.9.33',
1152 required : want_microhttpd == 'true')
1153 have = libmicrohttpd.found()
1154 else
1155 have = false
1156 libmicrohttpd = []
1157 endif
1158 conf.set10('HAVE_MICROHTTPD', have)
1159
1160 want_libcryptsetup = get_option('libcryptsetup')
1161 want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1162
1163 if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1164 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1165 endif
1166
1167 if want_libcryptsetup != 'false' and not skip_deps
1168 libcryptsetup = dependency('libcryptsetup',
1169 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1170 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
1171 have = libcryptsetup.found()
1172
1173 conf.set10('HAVE_CRYPT_SET_METADATA_SIZE',
1174 have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup))
1175 conf.set10('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY',
1176 have and cc.has_function('crypt_activate_by_signed_key', dependencies : libcryptsetup))
1177 conf.set10('HAVE_CRYPT_TOKEN_MAX',
1178 have and cc.has_function('crypt_token_max', dependencies : libcryptsetup))
1179 else
1180 have = false
1181 libcryptsetup = []
1182 endif
1183 conf.set10('HAVE_LIBCRYPTSETUP', have)
1184
1185 if want_libcryptsetup_plugins != 'false' and not skip_deps
1186 have = (cc.has_function('crypt_activate_by_token_pin', dependencies : libcryptsetup) and
1187 cc.has_function('crypt_token_external_path', dependencies : libcryptsetup))
1188 else
1189 have = false
1190 endif
1191 conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1192
1193 want_libcurl = get_option('libcurl')
1194 if want_libcurl != 'false' and not skip_deps
1195 libcurl = dependency('libcurl',
1196 version : '>= 7.32.0',
1197 required : want_libcurl == 'true')
1198 have = libcurl.found()
1199 else
1200 have = false
1201 libcurl = []
1202 endif
1203 conf.set10('HAVE_LIBCURL', have)
1204 conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
1205
1206 want_libidn = get_option('libidn')
1207 want_libidn2 = get_option('libidn2')
1208 if want_libidn == 'true' and want_libidn2 == 'true'
1209 error('libidn and libidn2 cannot be requested simultaneously')
1210 endif
1211
1212 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1213 libidn = dependency('libidn2',
1214 required : want_libidn2 == 'true')
1215 have = libidn.found()
1216 else
1217 have = false
1218 libidn = []
1219 endif
1220 conf.set10('HAVE_LIBIDN2', have)
1221 if not have and want_libidn != 'false' and not skip_deps
1222 # libidn is used for both libidn and libidn2 objects
1223 libidn = dependency('libidn',
1224 required : want_libidn == 'true')
1225 have = libidn.found()
1226 else
1227 have = false
1228 endif
1229 conf.set10('HAVE_LIBIDN', have)
1230
1231 want_libiptc = get_option('libiptc')
1232 if want_libiptc != 'false' and not skip_deps
1233 libiptc = dependency('libiptc',
1234 required : want_libiptc == 'true')
1235 have = libiptc.found()
1236 else
1237 have = false
1238 libiptc = []
1239 endif
1240 conf.set10('HAVE_LIBIPTC', have)
1241
1242 want_qrencode = get_option('qrencode')
1243 if want_qrencode != 'false' and not skip_deps
1244 libqrencode = dependency('libqrencode',
1245 version : '>= 4',
1246 required : want_qrencode == 'true')
1247 have = libqrencode.found()
1248 else
1249 have = false
1250 libqrencode = []
1251 endif
1252 conf.set10('HAVE_QRENCODE', have)
1253
1254 want_gcrypt = get_option('gcrypt')
1255 if want_gcrypt != 'false' and not skip_deps
1256 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1257 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1258 have = libgcrypt.found() and libgpg_error.found()
1259 else
1260 have = false
1261 endif
1262 if not have
1263 # link to neither of the libs if one is not found
1264 libgcrypt = []
1265 libgpg_error = []
1266 endif
1267 conf.set10('HAVE_GCRYPT', have)
1268
1269 want_gnutls = get_option('gnutls')
1270 if want_gnutls != 'false' and not skip_deps
1271 libgnutls = dependency('gnutls',
1272 version : '>= 3.1.4',
1273 required : want_gnutls == 'true')
1274 have = libgnutls.found()
1275 else
1276 have = false
1277 libgnutls = []
1278 endif
1279 conf.set10('HAVE_GNUTLS', have)
1280
1281 want_openssl = get_option('openssl')
1282 if want_openssl != 'false' and not skip_deps
1283 libopenssl = dependency('openssl',
1284 version : '>= 1.1.0',
1285 required : want_openssl == 'true')
1286 have = libopenssl.found()
1287 else
1288 have = false
1289 libopenssl = []
1290 endif
1291 conf.set10('HAVE_OPENSSL', have)
1292
1293 want_p11kit = get_option('p11kit')
1294 if want_p11kit != 'false' and not skip_deps
1295 libp11kit = dependency('p11-kit-1',
1296 version : '>= 0.23.3',
1297 required : want_p11kit == 'true')
1298 have = libp11kit.found()
1299 else
1300 have = false
1301 libp11kit = []
1302 endif
1303 conf.set10('HAVE_P11KIT', have)
1304
1305 want_libfido2 = get_option('libfido2')
1306 if want_libfido2 != 'false' and not skip_deps
1307 libfido2 = dependency('libfido2',
1308 required : want_libfido2 == 'true')
1309 have = libfido2.found()
1310 else
1311 have = false
1312 libfido2 = []
1313 endif
1314 conf.set10('HAVE_LIBFIDO2', have)
1315
1316 want_tpm2 = get_option('tpm2')
1317 if want_tpm2 != 'false' and not skip_deps
1318 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1319 required : want_tpm2 == 'true')
1320 have = tpm2.found()
1321 else
1322 have = false
1323 tpm2 = []
1324 endif
1325 conf.set10('HAVE_TPM2', have)
1326
1327 want_elfutils = get_option('elfutils')
1328 if want_elfutils != 'false' and not skip_deps
1329 libdw = dependency('libdw',
1330 required : want_elfutils == 'true')
1331 have = libdw.found()
1332 else
1333 have = false
1334 libdw = []
1335 endif
1336 conf.set10('HAVE_ELFUTILS', have)
1337
1338 want_zlib = get_option('zlib')
1339 if want_zlib != 'false' and not skip_deps
1340 libz = dependency('zlib',
1341 required : want_zlib == 'true')
1342 have = libz.found()
1343 else
1344 have = false
1345 libz = []
1346 endif
1347 conf.set10('HAVE_ZLIB', have)
1348
1349 want_bzip2 = get_option('bzip2')
1350 if want_bzip2 != 'false' and not skip_deps
1351 libbzip2 = cc.find_library('bz2',
1352 required : want_bzip2 == 'true')
1353 have = libbzip2.found()
1354 else
1355 have = false
1356 libbzip2 = []
1357 endif
1358 conf.set10('HAVE_BZIP2', have)
1359
1360 want_xz = get_option('xz')
1361 if want_xz != 'false' and not skip_deps
1362 libxz = dependency('liblzma',
1363 required : want_xz == 'true')
1364 have_xz = libxz.found()
1365 else
1366 have_xz = false
1367 libxz = []
1368 endif
1369 conf.set10('HAVE_XZ', have_xz)
1370
1371 want_lz4 = get_option('lz4')
1372 if want_lz4 != 'false' and not skip_deps
1373 liblz4 = dependency('liblz4',
1374 version : '>= 1.3.0',
1375 required : want_lz4 == 'true')
1376 have_lz4 = liblz4.found()
1377 else
1378 have_lz4 = false
1379 liblz4 = []
1380 endif
1381 conf.set10('HAVE_LZ4', have_lz4)
1382
1383 want_zstd = get_option('zstd')
1384 if want_zstd != 'false' and not skip_deps
1385 libzstd = dependency('libzstd',
1386 required : want_zstd == 'true',
1387 version : '>= 1.4.0')
1388 have_zstd = libzstd.found()
1389 else
1390 have_zstd = false
1391 libzstd = []
1392 endif
1393 conf.set10('HAVE_ZSTD', have_zstd)
1394
1395 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1396
1397 want_xkbcommon = get_option('xkbcommon')
1398 if want_xkbcommon != 'false' and not skip_deps
1399 libxkbcommon = dependency('xkbcommon',
1400 version : '>= 0.3.0',
1401 required : want_xkbcommon == 'true')
1402 have = libxkbcommon.found()
1403 else
1404 have = false
1405 libxkbcommon = []
1406 endif
1407 conf.set10('HAVE_XKBCOMMON', have)
1408
1409 want_pcre2 = get_option('pcre2')
1410 if want_pcre2 != 'false'
1411 libpcre2 = dependency('libpcre2-8',
1412 required : want_pcre2 == 'true')
1413 have = libpcre2.found()
1414 else
1415 have = false
1416 libpcre2 = []
1417 endif
1418 conf.set10('HAVE_PCRE2', have)
1419
1420 want_glib = get_option('glib')
1421 if want_glib != 'false' and not skip_deps
1422 libglib = dependency('glib-2.0',
1423 version : '>= 2.22.0',
1424 required : want_glib == 'true')
1425 libgobject = dependency('gobject-2.0',
1426 version : '>= 2.22.0',
1427 required : want_glib == 'true')
1428 libgio = dependency('gio-2.0',
1429 required : want_glib == 'true')
1430 have = libglib.found() and libgobject.found() and libgio.found()
1431 else
1432 have = false
1433 libglib = []
1434 libgobject = []
1435 libgio = []
1436 endif
1437 conf.set10('HAVE_GLIB', have)
1438
1439 want_dbus = get_option('dbus')
1440 if want_dbus != 'false' and not skip_deps
1441 libdbus = dependency('dbus-1',
1442 version : '>= 1.3.2',
1443 required : want_dbus == 'true')
1444 have = libdbus.found()
1445 else
1446 have = false
1447 libdbus = []
1448 endif
1449 conf.set10('HAVE_DBUS', have)
1450
1451 default_dnssec = get_option('default-dnssec')
1452 if skip_deps
1453 default_dnssec = 'no'
1454 endif
1455 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1456 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1457 default_dnssec = 'no'
1458 endif
1459 conf.set('DEFAULT_DNSSEC_MODE',
1460 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1461 conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1462
1463 dns_over_tls = get_option('dns-over-tls')
1464 if dns_over_tls != 'false'
1465 if dns_over_tls == 'openssl'
1466 have_gnutls = false
1467 else
1468 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
1469 if dns_over_tls == 'gnutls' and not have_gnutls
1470 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1471 endif
1472 endif
1473 if dns_over_tls == 'gnutls' or have_gnutls
1474 have_openssl = false
1475 else
1476 have_openssl = conf.get('HAVE_OPENSSL') == 1
1477 if dns_over_tls != 'auto' and not have_openssl
1478 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
1479 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1480 endif
1481 endif
1482 have = have_gnutls or have_openssl
1483 else
1484 have = false
1485 have_gnutls = false
1486 have_openssl = false
1487 endif
1488 conf.set10('ENABLE_DNS_OVER_TLS', have)
1489 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1490 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1491
1492 default_dns_over_tls = get_option('default-dns-over-tls')
1493 if skip_deps
1494 default_dns_over_tls = 'no'
1495 endif
1496 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1497 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.')
1498 default_dns_over_tls = 'no'
1499 endif
1500 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1501 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1502 conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
1503
1504 default_mdns = get_option('default-mdns')
1505 conf.set('DEFAULT_MDNS_MODE',
1506 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1507 conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
1508
1509 default_llmnr = get_option('default-llmnr')
1510 conf.set('DEFAULT_LLMNR_MODE',
1511 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1512 conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
1513
1514 want_repart = get_option('repart')
1515 if want_repart != 'false'
1516 have = (conf.get('HAVE_OPENSSL') == 1 and
1517 conf.get('HAVE_LIBFDISK') == 1)
1518 if want_repart == 'true' and not have
1519 error('repart support was requested, but dependencies are not available')
1520 endif
1521 else
1522 have = false
1523 endif
1524 conf.set10('ENABLE_REPART', have)
1525
1526 # We support one or the other. If gcrypt is available, we assume it's there to
1527 # be used, and use it in preference.
1528 opt = get_option('cryptolib')
1529 if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1530 error('openssl requested as the default cryptolib, but not available')
1531 endif
1532 conf.set10('PREFER_OPENSSL',
1533 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1534 conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1535 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
1536 lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? libopenssl : libgcrypt
1537
1538 want_importd = get_option('importd')
1539 if want_importd != 'false'
1540 have = (conf.get('HAVE_LIBCURL') == 1 and
1541 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
1542 conf.get('HAVE_ZLIB') == 1 and
1543 conf.get('HAVE_XZ') == 1)
1544 if want_importd == 'true' and not have
1545 error('importd support was requested, but dependencies are not available')
1546 endif
1547 else
1548 have = false
1549 endif
1550 conf.set10('ENABLE_IMPORTD', have)
1551
1552 want_homed = get_option('homed')
1553 if want_homed != 'false'
1554 have = (conf.get('HAVE_OPENSSL') == 1 and
1555 conf.get('HAVE_LIBFDISK') == 1 and
1556 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1557 if want_homed == 'true' and not have
1558 error('homed support was requested, but dependencies are not available')
1559 endif
1560 else
1561 have = false
1562 endif
1563 conf.set10('ENABLE_HOMED', have)
1564
1565 have = have and conf.get('HAVE_PAM') == 1
1566 conf.set10('ENABLE_PAM_HOME', have)
1567
1568 have = get_option('oomd')
1569 conf.set10('ENABLE_OOMD', have)
1570
1571 want_remote = get_option('remote')
1572 if want_remote != 'false'
1573 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1574 conf.get('HAVE_LIBCURL') == 1]
1575 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1576 # it's possible to build one without the other. Complain only if
1577 # support was explicitly requested. The auxiliary files like sysusers
1578 # config should be installed when any of the programs are built.
1579 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1580 error('remote support was requested, but dependencies are not available')
1581 endif
1582 have = have_deps[0] or have_deps[1]
1583 else
1584 have = false
1585 endif
1586 conf.set10('ENABLE_REMOTE', have)
1587
1588 foreach term : ['analyze',
1589 'backlight',
1590 'binfmt',
1591 'coredump',
1592 'efi',
1593 'environment-d',
1594 'firstboot',
1595 'gshadow',
1596 'hibernate',
1597 'hostnamed',
1598 'hwdb',
1599 'idn',
1600 'ima',
1601 'initrd',
1602 'compat-mutable-uid-boundaries',
1603 'nscd',
1604 'ldconfig',
1605 'localed',
1606 'logind',
1607 'machined',
1608 'networkd',
1609 'nss-myhostname',
1610 'nss-systemd',
1611 'portabled',
1612 'sysext',
1613 'pstore',
1614 'quotacheck',
1615 'randomseed',
1616 'resolve',
1617 'rfkill',
1618 'smack',
1619 'sysusers',
1620 'timedated',
1621 'timesyncd',
1622 'tmpfiles',
1623 'tpm',
1624 'userdb',
1625 'utmp',
1626 'vconsole',
1627 'xdg-autostart']
1628 have = get_option(term)
1629 name = 'ENABLE_' + term.underscorify().to_upper()
1630 conf.set10(name, have)
1631 endforeach
1632
1633 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1634
1635 foreach tuple : [['nss-mymachines', 'machined'],
1636 ['nss-resolve', 'resolve']]
1637 want = get_option(tuple[0])
1638 if want != 'false'
1639 have = get_option(tuple[1])
1640 if want == 'true' and not have
1641 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1642 endif
1643 else
1644 have = false
1645 endif
1646 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1647 conf.set10(name, have)
1648 endforeach
1649
1650 enable_nss = false
1651 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1652 'ENABLE_NSS_MYMACHINES',
1653 'ENABLE_NSS_RESOLVE',
1654 'ENABLE_NSS_SYSTEMD']
1655 if conf.get(term) == 1
1656 enable_nss = true
1657 endif
1658 endforeach
1659 conf.set10('ENABLE_NSS', enable_nss)
1660
1661 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1662
1663 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1664
1665 #####################################################################
1666
1667 subdir('src/fundamental')
1668 subdir('src/boot/efi')
1669
1670 ############################################################
1671
1672 build_bpf_skel_py = find_program('tools/build-bpf-skel.py')
1673 generate_gperfs = find_program('tools/generate-gperfs.py')
1674 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1675 make_directive_index_py = find_program('tools/make-directive-index.py')
1676 make_man_index_py = find_program('tools/make-man-index.py')
1677 meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
1678 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1679 update_hwdb_sh = find_program('tools/update-hwdb.sh')
1680 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1681 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1682 xml_helper_py = find_program('tools/xml_helper.py')
1683
1684 #####################################################################
1685
1686 config_h = configure_file(
1687 output : 'config.h',
1688 configuration : conf)
1689
1690 add_project_arguments('-include', 'config.h', language : 'c')
1691
1692 ############################################################
1693
1694 # binaries that have --help and are intended for use by humans,
1695 # usually, but not always, installed in /bin.
1696 public_programs = []
1697
1698 tests = []
1699 fuzzers = []
1700
1701 basic_includes = include_directories(
1702 'src/basic',
1703 'src/fundamental',
1704 'src/systemd',
1705 '.')
1706
1707 libsystemd_includes = [basic_includes, include_directories(
1708 'src/libsystemd/sd-bus',
1709 'src/libsystemd/sd-device',
1710 'src/libsystemd/sd-event',
1711 'src/libsystemd/sd-hwdb',
1712 'src/libsystemd/sd-id128',
1713 'src/libsystemd/sd-journal',
1714 'src/libsystemd/sd-netlink',
1715 'src/libsystemd/sd-network',
1716 'src/libsystemd/sd-resolve')]
1717
1718 includes = [libsystemd_includes, include_directories('src/shared')]
1719
1720 subdir('po')
1721 subdir('catalog')
1722 subdir('src/basic')
1723 subdir('src/libsystemd')
1724 subdir('src/shared')
1725 subdir('src/udev')
1726 subdir('src/libudev')
1727 subdir('src/cryptsetup/cryptsetup-tokens')
1728
1729 libsystemd = shared_library(
1730 'systemd',
1731 disable_mempool_c,
1732 version : libsystemd_version,
1733 include_directories : libsystemd_includes,
1734 link_args : ['-shared',
1735 '-Wl,--version-script=' + libsystemd_sym_path],
1736 link_with : [libbasic,
1737 libbasic_gcrypt],
1738 link_whole : [libsystemd_static],
1739 dependencies : [threads,
1740 librt,
1741 libxz,
1742 libzstd,
1743 liblz4],
1744 link_depends : libsystemd_sym,
1745 install : true,
1746 install_dir : rootlibdir)
1747
1748 install_libsystemd_static = static_library(
1749 'systemd',
1750 libsystemd_sources,
1751 basic_sources,
1752 basic_gcrypt_sources,
1753 fundamental_sources,
1754 disable_mempool_c,
1755 include_directories : libsystemd_includes,
1756 build_by_default : static_libsystemd != 'false',
1757 install : static_libsystemd != 'false',
1758 install_dir : rootlibdir,
1759 pic : static_libsystemd_pic,
1760 dependencies : [threads,
1761 librt,
1762 libxz,
1763 libzstd,
1764 liblz4,
1765 libdl,
1766 libcap,
1767 libblkid,
1768 libmount,
1769 libgcrypt,
1770 libopenssl],
1771 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1772
1773 libudev = shared_library(
1774 'udev',
1775 disable_mempool_c,
1776 version : libudev_version,
1777 include_directories : includes,
1778 link_args : ['-shared',
1779 '-Wl,--version-script=' + libudev_sym_path],
1780 link_with : [libsystemd_static, libshared_static],
1781 link_whole : libudev_basic,
1782 dependencies : [threads],
1783 link_depends : libudev_sym,
1784 install : true,
1785 install_dir : rootlibdir)
1786
1787 install_libudev_static = static_library(
1788 'udev',
1789 basic_sources,
1790 fundamental_sources,
1791 shared_sources,
1792 libsystemd_sources,
1793 libudev_sources,
1794 disable_mempool_c,
1795 include_directories : includes,
1796 build_by_default : static_libudev != 'false',
1797 install : static_libudev != 'false',
1798 install_dir : rootlibdir,
1799 link_depends : libudev_sym,
1800 dependencies : libshared_deps + [libmount],
1801 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1802 pic : static_libudev_pic)
1803
1804 if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
1805 if conf.get('HAVE_TPM2') == 1
1806 cryptsetup_token_systemd_tpm2 = shared_library(
1807 'cryptsetup-token-systemd-tpm2',
1808 link_args : ['-shared',
1809 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1810 dependencies : libshared_deps + [libcryptsetup, versiondep],
1811 link_with : [libshared],
1812 link_whole : [cryptsetup_token_systemd_tpm2_static],
1813 link_depends : cryptsetup_token_sym,
1814 install_rpath : rootlibexecdir,
1815 install : true,
1816 install_dir : libcryptsetup_plugins_dir)
1817 endif
1818
1819 if conf.get('HAVE_LIBFIDO2') == 1
1820 cryptsetup_token_systemd_fido2 = shared_library(
1821 'cryptsetup-token-systemd-fido2',
1822 link_args : ['-shared',
1823 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1824 dependencies : libshared_deps + [libcryptsetup, versiondep],
1825 link_with : [libshared],
1826 link_whole : [cryptsetup_token_systemd_fido2_static],
1827 link_depends : cryptsetup_token_sym,
1828 install_rpath : rootlibexecdir,
1829 install : true,
1830 install_dir : libcryptsetup_plugins_dir)
1831 endif
1832
1833 if conf.get('HAVE_P11KIT') == 1
1834 cryptsetup_token_systemd_pkcs11 = shared_library(
1835 'cryptsetup-token-systemd-pkcs11',
1836 link_args : ['-shared',
1837 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1838 dependencies : libshared_deps + [libcryptsetup, versiondep],
1839 link_with : [libshared],
1840 link_whole : [cryptsetup_token_systemd_pkcs11_static],
1841 link_depends : cryptsetup_token_sym,
1842 install_rpath : rootlibexecdir,
1843 install : true,
1844 install_dir : libcryptsetup_plugins_dir)
1845 endif
1846 endif
1847
1848 ############################################################
1849
1850 # systemd-analyze requires 'libcore'
1851 subdir('src/core')
1852 # systemd-journal-remote requires 'libjournal_core'
1853 subdir('src/journal')
1854 # systemd-networkd requires 'libsystemd_network'
1855 subdir('src/libsystemd-network')
1856
1857 subdir('src/analyze')
1858 subdir('src/busctl')
1859 subdir('src/coredump')
1860 subdir('src/cryptenroll')
1861 subdir('src/cryptsetup')
1862 subdir('src/home')
1863 subdir('src/hostname')
1864 subdir('src/import')
1865 subdir('src/journal-remote')
1866 subdir('src/kernel-install')
1867 subdir('src/locale')
1868 subdir('src/login')
1869 subdir('src/machine')
1870 subdir('src/network')
1871 subdir('src/nspawn')
1872 subdir('src/oom')
1873 subdir('src/partition')
1874 subdir('src/portable')
1875 subdir('src/pstore')
1876 subdir('src/resolve')
1877 subdir('src/rpm')
1878 subdir('src/shutdown')
1879 subdir('src/sysext')
1880 subdir('src/systemctl')
1881 subdir('src/timedate')
1882 subdir('src/timesync')
1883 subdir('src/tmpfiles')
1884 subdir('src/userdb')
1885 subdir('src/vconsole')
1886 subdir('src/xdg-autostart-generator')
1887
1888 subdir('src/systemd')
1889
1890 subdir('src/test')
1891 subdir('src/fuzz')
1892 subdir('rules.d')
1893 subdir('test')
1894
1895 ############################################################
1896
1897 # only static linking apart from libdl, to make sure that the
1898 # module is linked to all libraries that it uses.
1899 test_dlopen = executable(
1900 'test-dlopen',
1901 test_dlopen_c,
1902 disable_mempool_c,
1903 include_directories : includes,
1904 link_with : [libbasic],
1905 dependencies : [libdl],
1906 build_by_default : want_tests != 'false')
1907
1908 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
1909 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
1910 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
1911 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
1912
1913 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1914 if condition
1915 module = tuple[0]
1916
1917 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1918 version_script_arg = project_source_root / sym
1919
1920 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
1921 if tuple.length() > 2
1922 foreach s : tuple[2]
1923 sources += ['src/nss-@0@/@1@'.format(module, s)]
1924 endforeach
1925 endif
1926
1927 incs = tuple.length() > 3 ? tuple[3] : includes
1928
1929 nss = shared_library(
1930 'nss_' + module,
1931 sources,
1932 disable_mempool_c,
1933 version : '2',
1934 include_directories : incs,
1935 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1936 link_args : ['-Wl,-z,nodelete',
1937 '-shared',
1938 '-Wl,--version-script=' + version_script_arg],
1939 link_with : [libsystemd_static,
1940 libshared_static,
1941 libbasic],
1942 dependencies : [threads,
1943 librt],
1944 link_depends : sym,
1945 install : true,
1946 install_dir : rootlibdir)
1947
1948 # We cannot use shared_module because it does not support version suffix.
1949 # Unfortunately shared_library insists on creating the symlink…
1950 meson.add_install_script('sh', '-c',
1951 'rm $DESTDIR@0@/libnss_@1@.so'
1952 .format(rootlibdir, module))
1953
1954 if want_tests != 'false'
1955 test('dlopen-nss_' + module,
1956 test_dlopen,
1957 # path to dlopen must include a slash
1958 args : nss.full_path())
1959 endif
1960 endif
1961 endforeach
1962
1963 ############################################################
1964
1965 executable(
1966 'systemd',
1967 systemd_sources,
1968 include_directories : includes,
1969 link_with : [libcore,
1970 libshared],
1971 dependencies : [versiondep,
1972 threads,
1973 librt,
1974 libseccomp,
1975 libselinux,
1976 libmount,
1977 libblkid],
1978 install_rpath : rootlibexecdir,
1979 install : true,
1980 install_dir : rootlibexecdir)
1981
1982 meson.add_install_script(meson_make_symlink,
1983 rootlibexecdir / 'systemd',
1984 rootsbindir / 'init')
1985
1986 public_programs += executable(
1987 'systemd-analyze',
1988 systemd_analyze_sources,
1989 include_directories : core_includes,
1990 link_with : [libcore,
1991 libshared],
1992 dependencies : [versiondep,
1993 threads,
1994 librt,
1995 libseccomp,
1996 libselinux,
1997 libmount,
1998 libblkid],
1999 install_rpath : rootlibexecdir,
2000 install : conf.get('ENABLE_ANALYZE'))
2001
2002 executable(
2003 'systemd-journald',
2004 systemd_journald_sources,
2005 include_directories : includes,
2006 link_with : [libjournal_core,
2007 libshared],
2008 dependencies : [threads,
2009 libxz,
2010 liblz4,
2011 libselinux,
2012 libzstd],
2013 install_rpath : rootlibexecdir,
2014 install : true,
2015 install_dir : rootlibexecdir)
2016
2017 public_programs += executable(
2018 'systemd-cat',
2019 systemd_cat_sources,
2020 include_directories : includes,
2021 link_with : [libjournal_core,
2022 libshared],
2023 dependencies : [threads],
2024 install_rpath : rootlibexecdir,
2025 install : true)
2026
2027 public_programs += executable(
2028 'journalctl',
2029 journalctl_sources,
2030 include_directories : includes,
2031 link_with : [libshared],
2032 dependencies : [threads,
2033 libdl,
2034 libxz,
2035 liblz4,
2036 libzstd,
2037 libdl],
2038 install_rpath : rootlibexecdir,
2039 install : true,
2040 install_dir : rootbindir)
2041
2042 executable(
2043 'systemd-getty-generator',
2044 'src/getty-generator/getty-generator.c',
2045 include_directories : includes,
2046 link_with : [libshared],
2047 install_rpath : rootlibexecdir,
2048 install : true,
2049 install_dir : systemgeneratordir)
2050
2051 executable(
2052 'systemd-debug-generator',
2053 'src/debug-generator/debug-generator.c',
2054 include_directories : includes,
2055 link_with : [libshared],
2056 install_rpath : rootlibexecdir,
2057 install : true,
2058 install_dir : systemgeneratordir)
2059
2060 executable(
2061 'systemd-run-generator',
2062 'src/run-generator/run-generator.c',
2063 include_directories : includes,
2064 link_with : [libshared],
2065 install_rpath : rootlibexecdir,
2066 install : true,
2067 install_dir : systemgeneratordir)
2068
2069 executable(
2070 'systemd-fstab-generator',
2071 'src/fstab-generator/fstab-generator.c',
2072 include_directories : includes,
2073 link_with : [libshared],
2074 install_rpath : rootlibexecdir,
2075 install : true,
2076 install_dir : systemgeneratordir)
2077
2078 if conf.get('ENABLE_ENVIRONMENT_D') == 1
2079 executable(
2080 '30-systemd-environment-d-generator',
2081 'src/environment-d-generator/environment-d-generator.c',
2082 include_directories : includes,
2083 link_with : [libshared],
2084 install_rpath : rootlibexecdir,
2085 install : true,
2086 install_dir : userenvgeneratordir)
2087
2088 meson.add_install_script(meson_make_symlink,
2089 sysconfdir / 'environment',
2090 environmentdir / '99-environment.conf')
2091 endif
2092
2093 if conf.get('ENABLE_HIBERNATE') == 1
2094 executable(
2095 'systemd-hibernate-resume-generator',
2096 'src/hibernate-resume/hibernate-resume-generator.c',
2097 include_directories : includes,
2098 link_with : [libshared],
2099 install_rpath : rootlibexecdir,
2100 install : true,
2101 install_dir : systemgeneratordir)
2102
2103 executable(
2104 'systemd-hibernate-resume',
2105 'src/hibernate-resume/hibernate-resume.c',
2106 include_directories : includes,
2107 link_with : [libshared],
2108 install_rpath : rootlibexecdir,
2109 install : true,
2110 install_dir : rootlibexecdir)
2111 endif
2112
2113 if conf.get('HAVE_BLKID') == 1
2114 executable(
2115 'systemd-gpt-auto-generator',
2116 'src/gpt-auto-generator/gpt-auto-generator.c',
2117 include_directories : includes,
2118 link_with : [libshared],
2119 dependencies : libblkid,
2120 install_rpath : rootlibexecdir,
2121 install : true,
2122 install_dir : systemgeneratordir)
2123
2124 public_programs += executable(
2125 'systemd-dissect',
2126 'src/dissect/dissect.c',
2127 include_directories : includes,
2128 link_with : [libshared],
2129 install_rpath : rootlibexecdir,
2130 install : true)
2131 endif
2132
2133 if conf.get('ENABLE_RESOLVE') == 1
2134 executable(
2135 'systemd-resolved',
2136 systemd_resolved_sources,
2137 include_directories : resolve_includes,
2138 link_with : [libshared,
2139 libbasic_gcrypt,
2140 libsystemd_resolve_core],
2141 dependencies : systemd_resolved_dependencies,
2142 install_rpath : rootlibexecdir,
2143 install : true,
2144 install_dir : rootlibexecdir)
2145
2146 public_programs += executable(
2147 'resolvectl',
2148 resolvectl_sources,
2149 include_directories : includes,
2150 link_with : [libshared,
2151 libbasic_gcrypt,
2152 libsystemd_resolve_core],
2153 dependencies : [threads,
2154 lib_openssl_or_gcrypt,
2155 libgpg_error,
2156 libm,
2157 libidn],
2158 install_rpath : rootlibexecdir,
2159 install : true)
2160
2161 meson.add_install_script(meson_make_symlink,
2162 bindir / 'resolvectl',
2163 rootsbindir / 'resolvconf')
2164
2165 meson.add_install_script(meson_make_symlink,
2166 bindir / 'resolvectl',
2167 bindir / 'systemd-resolve')
2168 endif
2169
2170 if conf.get('ENABLE_LOGIND') == 1
2171 executable(
2172 'systemd-logind',
2173 systemd_logind_sources,
2174 include_directories : includes,
2175 link_with : [liblogind_core,
2176 libshared],
2177 dependencies : [threads,
2178 libacl],
2179 install_rpath : rootlibexecdir,
2180 install : true,
2181 install_dir : rootlibexecdir)
2182
2183 public_programs += executable(
2184 'loginctl',
2185 loginctl_sources,
2186 include_directories : includes,
2187 link_with : [libshared],
2188 dependencies : [threads,
2189 liblz4,
2190 libxz,
2191 libzstd],
2192 install_rpath : rootlibexecdir,
2193 install : true,
2194 install_dir : rootbindir)
2195
2196 public_programs += executable(
2197 'systemd-inhibit',
2198 'src/login/inhibit.c',
2199 include_directories : includes,
2200 link_with : [libshared],
2201 install_rpath : rootlibexecdir,
2202 install : true,
2203 install_dir : rootbindir)
2204
2205 if conf.get('HAVE_PAM') == 1
2206 version_script_arg = project_source_root / pam_systemd_sym
2207 pam_systemd = shared_library(
2208 'pam_systemd',
2209 pam_systemd_c,
2210 name_prefix : '',
2211 include_directories : includes,
2212 link_args : ['-shared',
2213 '-Wl,--version-script=' + version_script_arg],
2214 link_with : [libsystemd_static,
2215 libshared_static],
2216 dependencies : [threads,
2217 libpam,
2218 libpam_misc],
2219 link_depends : pam_systemd_sym,
2220 install : true,
2221 install_dir : pamlibdir)
2222
2223 if want_tests != 'false'
2224 test('dlopen-pam_systemd',
2225 test_dlopen,
2226 # path to dlopen must include a slash
2227 args : pam_systemd.full_path())
2228 endif
2229 endif
2230
2231 executable(
2232 'systemd-user-runtime-dir',
2233 user_runtime_dir_sources,
2234 include_directories : includes,
2235 link_with : [libshared],
2236 install_rpath : rootlibexecdir,
2237 install : true,
2238 install_dir : rootlibexecdir)
2239 endif
2240
2241 if conf.get('HAVE_PAM') == 1
2242 executable(
2243 'systemd-user-sessions',
2244 'src/user-sessions/user-sessions.c',
2245 include_directories : includes,
2246 link_with : [libshared],
2247 install_rpath : rootlibexecdir,
2248 install : true,
2249 install_dir : rootlibexecdir)
2250 endif
2251
2252 if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
2253 public_programs += executable(
2254 'bootctl',
2255 'src/boot/bootctl.c',
2256 include_directories : includes,
2257 link_with : [libshared],
2258 dependencies : [libblkid],
2259 install_rpath : rootlibexecdir,
2260 install : true)
2261
2262 public_programs += executable(
2263 'systemd-bless-boot',
2264 'src/boot/bless-boot.c',
2265 include_directories : includes,
2266 link_with : [libshared],
2267 dependencies : [libblkid],
2268 install_rpath : rootlibexecdir,
2269 install : true,
2270 install_dir : rootlibexecdir)
2271
2272 executable(
2273 'systemd-bless-boot-generator',
2274 'src/boot/bless-boot-generator.c',
2275 include_directories : includes,
2276 link_with : [libshared],
2277 install_rpath : rootlibexecdir,
2278 install : true,
2279 install_dir : systemgeneratordir)
2280 endif
2281
2282 executable(
2283 'systemd-boot-check-no-failures',
2284 'src/boot/boot-check-no-failures.c',
2285 include_directories : includes,
2286 link_with : [libshared],
2287 dependencies : [libblkid],
2288 install_rpath : rootlibexecdir,
2289 install : true,
2290 install_dir : rootlibexecdir)
2291
2292 public_programs += executable(
2293 'systemd-socket-activate',
2294 'src/activate/activate.c',
2295 include_directories : includes,
2296 link_with : [libshared],
2297 dependencies : [threads],
2298 install_rpath : rootlibexecdir,
2299 install : true)
2300
2301 public_programs += executable(
2302 'systemctl',
2303 systemctl_sources,
2304 include_directories : includes,
2305 link_with : systemctl_link_with,
2306 dependencies : [threads,
2307 libcap,
2308 libselinux,
2309 libxz,
2310 liblz4,
2311 libzstd],
2312 install_rpath : rootlibexecdir,
2313 install : true,
2314 install_dir : rootbindir)
2315
2316 if conf.get('ENABLE_PORTABLED') == 1
2317 executable(
2318 'systemd-portabled',
2319 systemd_portabled_sources,
2320 include_directories : includes,
2321 link_with : [libshared],
2322 dependencies : [threads, libselinux],
2323 install_rpath : rootlibexecdir,
2324 install : true,
2325 install_dir : rootlibexecdir)
2326
2327 public_programs += executable(
2328 'portablectl',
2329 'src/portable/portablectl.c',
2330 include_directories : includes,
2331 link_with : [libshared],
2332 dependencies : [threads],
2333 install_rpath : rootlibexecdir,
2334 install : true,
2335 install_dir : rootbindir)
2336 endif
2337
2338 if conf.get('ENABLE_SYSEXT') == 1
2339 public_programs += executable(
2340 'systemd-sysext',
2341 systemd_sysext_sources,
2342 include_directories : includes,
2343 link_with : [libshared],
2344 install_rpath : rootlibexecdir,
2345 install : true,
2346 install_dir : rootbindir)
2347 endif
2348
2349 if conf.get('ENABLE_USERDB') == 1
2350 executable(
2351 'systemd-userwork',
2352 systemd_userwork_sources,
2353 include_directories : includes,
2354 link_with : [libshared],
2355 dependencies : [threads],
2356 install_rpath : rootlibexecdir,
2357 install : true,
2358 install_dir : rootlibexecdir)
2359
2360 executable(
2361 'systemd-userdbd',
2362 systemd_userdbd_sources,
2363 include_directories : includes,
2364 link_with : [libshared],
2365 dependencies : [threads],
2366 install_rpath : rootlibexecdir,
2367 install : true,
2368 install_dir : rootlibexecdir)
2369
2370 public_programs += executable(
2371 'userdbctl',
2372 userdbctl_sources,
2373 include_directories : includes,
2374 link_with : [libshared],
2375 dependencies : [threads],
2376 install_rpath : rootlibexecdir,
2377 install : true,
2378 install_dir : rootbindir)
2379 endif
2380
2381 if conf.get('ENABLE_HOMED') == 1
2382 executable(
2383 'systemd-homework',
2384 systemd_homework_sources,
2385 include_directories : includes,
2386 link_with : [libshared],
2387 dependencies : [threads,
2388 libblkid,
2389 libcrypt,
2390 libopenssl,
2391 libfdisk,
2392 libp11kit],
2393 install_rpath : rootlibexecdir,
2394 install : true,
2395 install_dir : rootlibexecdir)
2396
2397 executable(
2398 'systemd-homed',
2399 systemd_homed_sources,
2400 include_directories : home_includes,
2401 link_with : [libshared],
2402 dependencies : [threads,
2403 libcrypt,
2404 libopenssl,
2405 libm],
2406 install_rpath : rootlibexecdir,
2407 install : true,
2408 install_dir : rootlibexecdir)
2409
2410 public_programs += executable(
2411 'homectl',
2412 homectl_sources,
2413 include_directories : includes,
2414 link_with : [libshared],
2415 dependencies : [threads,
2416 libcrypt,
2417 libopenssl,
2418 libp11kit,
2419 libdl],
2420 install_rpath : rootlibexecdir,
2421 install : true,
2422 install_dir : rootbindir)
2423
2424 if conf.get('HAVE_PAM') == 1
2425 version_script_arg = project_source_root / pam_systemd_home_sym
2426 pam_systemd = shared_library(
2427 'pam_systemd_home',
2428 pam_systemd_home_c,
2429 name_prefix : '',
2430 include_directories : includes,
2431 link_args : ['-shared',
2432 '-Wl,--version-script=' + version_script_arg],
2433 link_with : [libsystemd_static,
2434 libshared_static],
2435 dependencies : [threads,
2436 libpam,
2437 libpam_misc,
2438 libcrypt],
2439 link_depends : pam_systemd_home_sym,
2440 install : true,
2441 install_dir : pamlibdir)
2442 endif
2443 endif
2444
2445 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2446 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2447 meson.add_install_script(meson_make_symlink,
2448 rootbindir / 'systemctl',
2449 rootsbindir / alias)
2450 endforeach
2451
2452 meson.add_install_script(meson_make_symlink,
2453 rootbindir / 'udevadm',
2454 rootlibexecdir / 'systemd-udevd')
2455
2456 if conf.get('ENABLE_BACKLIGHT') == 1
2457 executable(
2458 'systemd-backlight',
2459 'src/backlight/backlight.c',
2460 include_directories : includes,
2461 link_with : [libshared],
2462 install_rpath : rootlibexecdir,
2463 install : true,
2464 install_dir : rootlibexecdir)
2465 endif
2466
2467 if conf.get('ENABLE_RFKILL') == 1
2468 executable(
2469 'systemd-rfkill',
2470 'src/rfkill/rfkill.c',
2471 include_directories : includes,
2472 link_with : [libshared],
2473 install_rpath : rootlibexecdir,
2474 install : true,
2475 install_dir : rootlibexecdir)
2476 endif
2477
2478 executable(
2479 'systemd-system-update-generator',
2480 'src/system-update-generator/system-update-generator.c',
2481 include_directories : includes,
2482 link_with : [libshared],
2483 install_rpath : rootlibexecdir,
2484 install : true,
2485 install_dir : systemgeneratordir)
2486
2487 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2488 executable(
2489 'systemd-cryptsetup',
2490 systemd_cryptsetup_sources,
2491 include_directories : includes,
2492 link_with : [libshared],
2493 dependencies : [libcryptsetup,
2494 libp11kit],
2495 install_rpath : rootlibexecdir,
2496 install : true,
2497 install_dir : rootlibexecdir)
2498
2499 executable(
2500 'systemd-cryptsetup-generator',
2501 'src/cryptsetup/cryptsetup-generator.c',
2502 include_directories : includes,
2503 link_with : [libshared],
2504 install_rpath : rootlibexecdir,
2505 install : true,
2506 install_dir : systemgeneratordir)
2507
2508 executable(
2509 'systemd-veritysetup',
2510 'src/veritysetup/veritysetup.c',
2511 include_directories : includes,
2512 link_with : [libshared],
2513 dependencies : [libcryptsetup],
2514 install_rpath : rootlibexecdir,
2515 install : true,
2516 install_dir : rootlibexecdir)
2517
2518 executable(
2519 'systemd-veritysetup-generator',
2520 'src/veritysetup/veritysetup-generator.c',
2521 include_directories : includes,
2522 link_with : [libshared],
2523 install_rpath : rootlibexecdir,
2524 install : true,
2525 install_dir : systemgeneratordir)
2526
2527 executable(
2528 'systemd-cryptenroll',
2529 systemd_cryptenroll_sources,
2530 include_directories : includes,
2531 link_with : [libshared],
2532 dependencies : [libcryptsetup,
2533 libdl,
2534 libopenssl,
2535 libp11kit],
2536 install_rpath : rootlibexecdir,
2537 install : true)
2538
2539 executable(
2540 'systemd-integritysetup',
2541 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
2542 include_directories : includes,
2543 link_with : [libshared],
2544 dependencies : [libcryptsetup],
2545 install_rpath : rootlibexecdir,
2546 install : true,
2547 install_dir : rootlibexecdir)
2548
2549 executable(
2550 'systemd-integritysetup-generator',
2551 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
2552 include_directories : includes,
2553 link_with : [libshared],
2554 install_rpath : rootlibexecdir,
2555 install : true,
2556 install_dir : systemgeneratordir)
2557 endif
2558
2559 if conf.get('HAVE_SYSV_COMPAT') == 1
2560 executable(
2561 'systemd-sysv-generator',
2562 'src/sysv-generator/sysv-generator.c',
2563 include_directories : includes,
2564 link_with : [libshared],
2565 install_rpath : rootlibexecdir,
2566 install : true,
2567 install_dir : systemgeneratordir)
2568
2569 executable(
2570 'systemd-rc-local-generator',
2571 'src/rc-local-generator/rc-local-generator.c',
2572 include_directories : includes,
2573 link_with : [libshared],
2574 install_rpath : rootlibexecdir,
2575 install : true,
2576 install_dir : systemgeneratordir)
2577 endif
2578
2579 if conf.get('ENABLE_XDG_AUTOSTART') == 1
2580 executable(
2581 'systemd-xdg-autostart-generator',
2582 systemd_xdg_autostart_generator_sources,
2583 include_directories : includes,
2584 link_with : [libshared],
2585 install_rpath : rootlibexecdir,
2586 install : true,
2587 install_dir : usergeneratordir)
2588
2589 executable(
2590 'systemd-xdg-autostart-condition',
2591 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2592 include_directories : includes,
2593 link_with : [libshared],
2594 install_rpath : rootlibexecdir,
2595 install : true,
2596 install_dir : rootlibexecdir)
2597 endif
2598
2599 if conf.get('ENABLE_HOSTNAMED') == 1
2600 executable(
2601 'systemd-hostnamed',
2602 'src/hostname/hostnamed.c',
2603 include_directories : includes,
2604 link_with : [libshared],
2605 install_rpath : rootlibexecdir,
2606 install : true,
2607 install_dir : rootlibexecdir)
2608
2609 public_programs += executable(
2610 'hostnamectl',
2611 'src/hostname/hostnamectl.c',
2612 include_directories : includes,
2613 link_with : [libshared],
2614 install_rpath : rootlibexecdir,
2615 install : true)
2616 endif
2617
2618 if conf.get('ENABLE_LOCALED') == 1
2619 if conf.get('HAVE_XKBCOMMON') == 1
2620 # logind will load libxkbcommon.so dynamically on its own, but we still
2621 # need to specify where the headers are
2622 deps = [libdl, libxkbcommon.partial_dependency(compile_args: true)]
2623 else
2624 deps = []
2625 endif
2626
2627 executable(
2628 'systemd-localed',
2629 systemd_localed_sources,
2630 include_directories : includes,
2631 link_with : [libshared],
2632 dependencies : deps,
2633 install_rpath : rootlibexecdir,
2634 install : true,
2635 install_dir : rootlibexecdir)
2636
2637 public_programs += executable(
2638 'localectl',
2639 localectl_sources,
2640 include_directories : includes,
2641 link_with : [libshared],
2642 install_rpath : rootlibexecdir,
2643 install : true)
2644 endif
2645
2646 if conf.get('ENABLE_TIMEDATED') == 1
2647 executable(
2648 'systemd-timedated',
2649 'src/timedate/timedated.c',
2650 include_directories : includes,
2651 link_with : [libshared],
2652 install_rpath : rootlibexecdir,
2653 install : true,
2654 install_dir : rootlibexecdir)
2655 endif
2656
2657 if conf.get('ENABLE_TIMEDATECTL') == 1
2658 public_programs += executable(
2659 'timedatectl',
2660 'src/timedate/timedatectl.c',
2661 include_directories : includes,
2662 install_rpath : rootlibexecdir,
2663 link_with : [libshared],
2664 dependencies : [libm],
2665 install : true)
2666 endif
2667
2668 if conf.get('ENABLE_TIMESYNCD') == 1
2669 executable(
2670 'systemd-timesyncd',
2671 systemd_timesyncd_sources,
2672 include_directories : includes,
2673 link_with : [libtimesyncd_core],
2674 dependencies : [threads,
2675 libm],
2676 install_rpath : rootlibexecdir,
2677 install : true,
2678 install_dir : rootlibexecdir)
2679
2680 executable(
2681 'systemd-time-wait-sync',
2682 'src/timesync/wait-sync.c',
2683 include_directories : includes,
2684 link_with : [libtimesyncd_core],
2685 install_rpath : rootlibexecdir,
2686 install : true,
2687 install_dir : rootlibexecdir)
2688 endif
2689
2690 if conf.get('ENABLE_MACHINED') == 1
2691 executable(
2692 'systemd-machined',
2693 systemd_machined_sources,
2694 include_directories : includes,
2695 link_with : [libmachine_core,
2696 libshared],
2697 install_rpath : rootlibexecdir,
2698 install : true,
2699 install_dir : rootlibexecdir)
2700
2701 public_programs += executable(
2702 'machinectl',
2703 'src/machine/machinectl.c',
2704 include_directories : includes,
2705 link_with : [libshared],
2706 dependencies : [threads,
2707 libxz,
2708 liblz4,
2709 libzstd],
2710 install_rpath : rootlibexecdir,
2711 install : true,
2712 install_dir : rootbindir)
2713 endif
2714
2715 if conf.get('ENABLE_IMPORTD') == 1
2716 executable(
2717 'systemd-importd',
2718 systemd_importd_sources,
2719 include_directories : includes,
2720 link_with : [libshared],
2721 dependencies : [threads],
2722 install_rpath : rootlibexecdir,
2723 install : true,
2724 install_dir : rootlibexecdir)
2725
2726 systemd_pull = executable(
2727 'systemd-pull',
2728 systemd_pull_sources,
2729 include_directories : includes,
2730 link_with : [libshared],
2731 dependencies : [versiondep,
2732 libcurl,
2733 lib_openssl_or_gcrypt,
2734 libz,
2735 libbzip2,
2736 libxz],
2737 install_rpath : rootlibexecdir,
2738 install : true,
2739 install_dir : rootlibexecdir)
2740
2741 systemd_import = executable(
2742 'systemd-import',
2743 systemd_import_sources,
2744 include_directories : includes,
2745 link_with : [libshared],
2746 dependencies : [libcurl,
2747 libz,
2748 libbzip2,
2749 libxz],
2750 install_rpath : rootlibexecdir,
2751 install : true,
2752 install_dir : rootlibexecdir)
2753
2754 systemd_import_fs = executable(
2755 'systemd-import-fs',
2756 systemd_import_fs_sources,
2757 include_directories : includes,
2758 link_with : [libshared],
2759 install_rpath : rootlibexecdir,
2760 install : true,
2761 install_dir : rootlibexecdir)
2762
2763 systemd_export = executable(
2764 'systemd-export',
2765 systemd_export_sources,
2766 include_directories : includes,
2767 link_with : [libshared],
2768 dependencies : [libcurl,
2769 libz,
2770 libbzip2,
2771 libxz],
2772 install_rpath : rootlibexecdir,
2773 install : true,
2774 install_dir : rootlibexecdir)
2775
2776 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2777 endif
2778
2779 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2780 public_programs += executable(
2781 'systemd-journal-upload',
2782 systemd_journal_upload_sources,
2783 include_directories : includes,
2784 link_with : [libshared],
2785 dependencies : [versiondep,
2786 threads,
2787 libcurl,
2788 libgnutls,
2789 libxz,
2790 liblz4,
2791 libzstd],
2792 install_rpath : rootlibexecdir,
2793 install : true,
2794 install_dir : rootlibexecdir)
2795 endif
2796
2797 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2798 public_programs += executable(
2799 'systemd-journal-remote',
2800 systemd_journal_remote_sources,
2801 include_directories : includes,
2802 link_with : [libshared,
2803 libsystemd_journal_remote],
2804 dependencies : [threads,
2805 libmicrohttpd,
2806 libgnutls,
2807 libxz,
2808 liblz4,
2809 libzstd],
2810 install_rpath : rootlibexecdir,
2811 install : true,
2812 install_dir : rootlibexecdir)
2813
2814 public_programs += executable(
2815 'systemd-journal-gatewayd',
2816 systemd_journal_gatewayd_sources,
2817 include_directories : includes,
2818 link_with : [libshared],
2819 dependencies : [threads,
2820 libmicrohttpd,
2821 libgnutls,
2822 libxz,
2823 liblz4,
2824 libzstd],
2825 install_rpath : rootlibexecdir,
2826 install : true,
2827 install_dir : rootlibexecdir)
2828 endif
2829
2830 if conf.get('ENABLE_COREDUMP') == 1
2831 executable(
2832 'systemd-coredump',
2833 systemd_coredump_sources,
2834 include_directories : includes,
2835 link_with : [libshared],
2836 dependencies : [threads,
2837 libacl,
2838 libdw,
2839 libxz,
2840 liblz4,
2841 libzstd],
2842 install_rpath : rootlibexecdir,
2843 install : true,
2844 install_dir : rootlibexecdir)
2845
2846 public_programs += executable(
2847 'coredumpctl',
2848 coredumpctl_sources,
2849 include_directories : includes,
2850 link_with : [libshared],
2851 dependencies : [threads,
2852 libxz,
2853 liblz4,
2854 libzstd],
2855 install_rpath : rootlibexecdir,
2856 install : true)
2857 endif
2858
2859 if conf.get('ENABLE_PSTORE') == 1
2860 executable(
2861 'systemd-pstore',
2862 systemd_pstore_sources,
2863 include_directories : includes,
2864 link_with : [libshared],
2865 dependencies : [threads,
2866 libacl,
2867 libdw,
2868 libxz,
2869 liblz4,
2870 libzstd],
2871 install_rpath : rootlibexecdir,
2872 install : true,
2873 install_dir : rootlibexecdir)
2874 endif
2875
2876 if conf.get('ENABLE_OOMD') == 1
2877 executable('systemd-oomd',
2878 systemd_oomd_sources,
2879 include_directories : includes,
2880 link_with : [libshared],
2881 dependencies : [],
2882 install_rpath : rootlibexecdir,
2883 install : true,
2884 install_dir : rootlibexecdir)
2885
2886 public_programs += executable(
2887 'oomctl',
2888 oomctl_sources,
2889 include_directories : includes,
2890 link_with : [libshared],
2891 dependencies : [],
2892 install_rpath : rootlibexecdir,
2893 install : true,
2894 install_dir : rootbindir)
2895 endif
2896
2897 if conf.get('ENABLE_BINFMT') == 1
2898 public_programs += executable(
2899 'systemd-binfmt',
2900 'src/binfmt/binfmt.c',
2901 include_directories : includes,
2902 link_with : [libshared],
2903 install_rpath : rootlibexecdir,
2904 install : true,
2905 install_dir : rootlibexecdir)
2906
2907 meson.add_install_script('sh', '-c',
2908 mkdir_p.format(binfmtdir))
2909 if install_sysconfdir
2910 meson.add_install_script('sh', '-c',
2911 mkdir_p.format(sysconfdir / 'binfmt.d'))
2912 endif
2913 endif
2914
2915 if conf.get('ENABLE_REPART') == 1
2916 exe = executable(
2917 'systemd-repart',
2918 systemd_repart_sources,
2919 include_directories : includes,
2920 link_with : [libshared],
2921 dependencies : [threads,
2922 libblkid,
2923 libfdisk,
2924 libopenssl],
2925 install_rpath : rootlibexecdir,
2926 install : true,
2927 install_dir : rootbindir)
2928 public_programs += exe
2929
2930 if want_tests != 'false'
2931 test('test-repart',
2932 test_repart_sh,
2933 args : exe.full_path())
2934 endif
2935 endif
2936
2937 if conf.get('ENABLE_VCONSOLE') == 1
2938 executable(
2939 'systemd-vconsole-setup',
2940 'src/vconsole/vconsole-setup.c',
2941 include_directories : includes,
2942 link_with : [libshared],
2943 install_rpath : rootlibexecdir,
2944 install : true,
2945 install_dir : rootlibexecdir)
2946 endif
2947
2948 if conf.get('ENABLE_RANDOMSEED') == 1
2949 executable(
2950 'systemd-random-seed',
2951 'src/random-seed/random-seed.c',
2952 include_directories : includes,
2953 link_with : [libshared],
2954 install_rpath : rootlibexecdir,
2955 install : true,
2956 install_dir : rootlibexecdir)
2957 endif
2958
2959 if conf.get('ENABLE_FIRSTBOOT') == 1
2960 executable(
2961 'systemd-firstboot',
2962 'src/firstboot/firstboot.c',
2963 include_directories : includes,
2964 link_with : [libshared],
2965 dependencies : [libcrypt],
2966 install_rpath : rootlibexecdir,
2967 install : true,
2968 install_dir : rootbindir)
2969 endif
2970
2971 executable(
2972 'systemd-remount-fs',
2973 'src/remount-fs/remount-fs.c',
2974 include_directories : includes,
2975 link_with : [libshared],
2976 install_rpath : rootlibexecdir,
2977 install : true,
2978 install_dir : rootlibexecdir)
2979
2980 executable(
2981 'systemd-machine-id-setup',
2982 'src/machine-id-setup/machine-id-setup-main.c',
2983 include_directories : includes,
2984 link_with : [libshared],
2985 install_rpath : rootlibexecdir,
2986 install : true,
2987 install_dir : rootbindir)
2988
2989 executable(
2990 'systemd-fsck',
2991 'src/fsck/fsck.c',
2992 include_directories : includes,
2993 link_with : [libshared],
2994 install_rpath : rootlibexecdir,
2995 install : true,
2996 install_dir : rootlibexecdir)
2997
2998 executable('systemd-growfs',
2999 'src/partition/growfs.c',
3000 include_directories : includes,
3001 link_with : [libshared],
3002 install_rpath : rootlibexecdir,
3003 install : true,
3004 install_dir : rootlibexecdir)
3005
3006 executable(
3007 'systemd-makefs',
3008 'src/partition/makefs.c',
3009 include_directories : includes,
3010 link_with : [libshared],
3011 install_rpath : rootlibexecdir,
3012 install : true,
3013 install_dir : rootlibexecdir)
3014
3015 executable(
3016 'systemd-sleep',
3017 'src/sleep/sleep.c',
3018 include_directories : includes,
3019 link_with : [libshared],
3020 install_rpath : rootlibexecdir,
3021 install : true,
3022 install_dir : rootlibexecdir)
3023
3024 if install_sysconfdir_samples
3025 install_data('src/sleep/sleep.conf',
3026 install_dir : pkgsysconfdir)
3027 endif
3028
3029 public_programs += executable(
3030 'systemd-sysctl',
3031 'src/sysctl/sysctl.c',
3032 include_directories : includes,
3033 link_with : [libshared],
3034 install_rpath : rootlibexecdir,
3035 install : true,
3036 install_dir : rootlibexecdir)
3037
3038 executable(
3039 'systemd-ac-power',
3040 'src/ac-power/ac-power.c',
3041 include_directories : includes,
3042 link_with : [libshared],
3043 install_rpath : rootlibexecdir,
3044 install : true,
3045 install_dir : rootlibexecdir)
3046
3047 public_programs += executable(
3048 'systemd-detect-virt',
3049 'src/detect-virt/detect-virt.c',
3050 include_directories : includes,
3051 link_with : [libshared],
3052 install_rpath : rootlibexecdir,
3053 install : true)
3054
3055 public_programs += executable(
3056 'systemd-delta',
3057 'src/delta/delta.c',
3058 include_directories : includes,
3059 link_with : [libshared],
3060 install_rpath : rootlibexecdir,
3061 install : true)
3062
3063 public_programs += executable(
3064 'systemd-escape',
3065 'src/escape/escape.c',
3066 include_directories : includes,
3067 link_with : [libshared],
3068 install_rpath : rootlibexecdir,
3069 install : true,
3070 install_dir : rootbindir)
3071
3072 public_programs += executable(
3073 'systemd-notify',
3074 'src/notify/notify.c',
3075 include_directories : includes,
3076 link_with : [libshared],
3077 install_rpath : rootlibexecdir,
3078 install : true,
3079 install_dir : rootbindir)
3080
3081 public_programs += executable(
3082 'systemd-creds',
3083 'src/creds/creds.c',
3084 include_directories : includes,
3085 link_with : [libshared],
3086 dependencies : [threads,
3087 libopenssl],
3088 install_rpath : rootlibexecdir,
3089 install : true,
3090 install_dir : rootbindir)
3091
3092 executable(
3093 'systemd-volatile-root',
3094 'src/volatile-root/volatile-root.c',
3095 include_directories : includes,
3096 link_with : [libshared],
3097 install_rpath : rootlibexecdir,
3098 install : conf.get('ENABLE_INITRD') == 1,
3099 install_dir : rootlibexecdir)
3100
3101 executable(
3102 'systemd-cgroups-agent',
3103 'src/cgroups-agent/cgroups-agent.c',
3104 include_directories : includes,
3105 link_with : [libshared],
3106 install_rpath : rootlibexecdir,
3107 install : true,
3108 install_dir : rootlibexecdir)
3109
3110 public_programs += executable(
3111 'systemd-id128',
3112 'src/id128/id128.c',
3113 include_directories : includes,
3114 link_with : [libshared],
3115 install_rpath : rootlibexecdir,
3116 install : true)
3117
3118 public_programs += executable(
3119 'systemd-path',
3120 'src/path/path.c',
3121 include_directories : includes,
3122 link_with : [libshared],
3123 install_rpath : rootlibexecdir,
3124 install : true)
3125
3126 public_programs += executable(
3127 'systemd-ask-password',
3128 'src/ask-password/ask-password.c',
3129 include_directories : includes,
3130 link_with : [libshared],
3131 install_rpath : rootlibexecdir,
3132 install : true,
3133 install_dir : rootbindir)
3134
3135 executable(
3136 'systemd-reply-password',
3137 'src/reply-password/reply-password.c',
3138 include_directories : includes,
3139 link_with : [libshared],
3140 install_rpath : rootlibexecdir,
3141 install : true,
3142 install_dir : rootlibexecdir)
3143
3144 public_programs += executable(
3145 'systemd-tty-ask-password-agent',
3146 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3147 include_directories : includes,
3148 link_with : [libshared],
3149 install_rpath : rootlibexecdir,
3150 install : true,
3151 install_dir : rootbindir)
3152
3153 public_programs += executable(
3154 'systemd-cgls',
3155 'src/cgls/cgls.c',
3156 include_directories : includes,
3157 link_with : [libshared],
3158 install_rpath : rootlibexecdir,
3159 install : true)
3160
3161 public_programs += executable(
3162 'systemd-cgtop',
3163 'src/cgtop/cgtop.c',
3164 include_directories : includes,
3165 link_with : [libshared],
3166 install_rpath : rootlibexecdir,
3167 install : true)
3168
3169 executable(
3170 'systemd-initctl',
3171 'src/initctl/initctl.c',
3172 include_directories : includes,
3173 link_with : [libshared],
3174 install_rpath : rootlibexecdir,
3175 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3176 install_dir : rootlibexecdir)
3177
3178 public_programs += executable(
3179 'systemd-mount',
3180 'src/mount/mount-tool.c',
3181 include_directories : includes,
3182 link_with : [libshared],
3183 dependencies: [libmount],
3184 install_rpath : rootlibexecdir,
3185 install : true)
3186
3187 meson.add_install_script(meson_make_symlink,
3188 'systemd-mount', bindir / 'systemd-umount')
3189
3190 public_programs += executable(
3191 'systemd-run',
3192 'src/run/run.c',
3193 include_directories : includes,
3194 link_with : [libshared],
3195 install_rpath : rootlibexecdir,
3196 install : true)
3197
3198 public_programs += executable(
3199 'systemd-stdio-bridge',
3200 'src/stdio-bridge/stdio-bridge.c',
3201 include_directories : includes,
3202 link_with : [libshared],
3203 dependencies : [versiondep],
3204 install_rpath : rootlibexecdir,
3205 install : true)
3206
3207 public_programs += executable(
3208 'busctl',
3209 busctl_sources,
3210 include_directories : includes,
3211 link_with : [libshared],
3212 install_rpath : rootlibexecdir,
3213 install : true)
3214
3215 if enable_sysusers
3216 exe = executable(
3217 'systemd-sysusers',
3218 'src/sysusers/sysusers.c',
3219 include_directories : includes,
3220 link_with : [libshared],
3221 install_rpath : rootlibexecdir,
3222 install : true,
3223 install_dir : rootbindir)
3224 public_programs += exe
3225
3226 if want_tests != 'false'
3227 test('test-sysusers',
3228 test_sysusers_sh,
3229 # https://github.com/mesonbuild/meson/issues/2681
3230 args : exe.full_path())
3231 endif
3232
3233 if have_standalone_binaries
3234 exe = executable(
3235 'systemd-sysusers.standalone',
3236 'src/sysusers/sysusers.c',
3237 include_directories : includes,
3238 c_args : '-DSTANDALONE',
3239 link_with : [libshared_static,
3240 libbasic,
3241 libbasic_gcrypt,
3242 libsystemd_static],
3243 install : true,
3244 install_dir : rootbindir)
3245 public_programs += exe
3246
3247 if want_tests != 'false'
3248 test('test-sysusers.standalone',
3249 test_sysusers_sh,
3250 # https://github.com/mesonbuild/meson/issues/2681
3251 args : exe.full_path())
3252 endif
3253 endif
3254 endif
3255
3256 if conf.get('ENABLE_TMPFILES') == 1
3257 exe = executable(
3258 'systemd-tmpfiles',
3259 systemd_tmpfiles_sources,
3260 include_directories : includes,
3261 link_with : [libshared],
3262 dependencies : [libacl],
3263 install_rpath : rootlibexecdir,
3264 install : true,
3265 install_dir : rootbindir)
3266 public_programs += exe
3267
3268 if want_tests != 'false'
3269 test('test-systemd-tmpfiles',
3270 test_systemd_tmpfiles_py,
3271 # https://github.com/mesonbuild/meson/issues/2681
3272 args : exe.full_path())
3273 endif
3274
3275 if have_standalone_binaries
3276 public_programs += executable(
3277 'systemd-tmpfiles.standalone',
3278 systemd_tmpfiles_sources,
3279 include_directories : includes,
3280 c_args : '-DSTANDALONE',
3281 link_with : [libshared_static,
3282 libbasic,
3283 libbasic_gcrypt,
3284 libsystemd_static],
3285 dependencies : [libacl],
3286 install : true,
3287 install_dir : rootbindir)
3288 endif
3289 endif
3290
3291 if conf.get('ENABLE_HWDB') == 1
3292 systemd_hwdb = executable(
3293 'systemd-hwdb',
3294 'src/hwdb/hwdb.c',
3295 include_directories : includes,
3296 link_with : udev_link_with,
3297 install_rpath : udev_rpath,
3298 install : true,
3299 install_dir : rootbindir)
3300 public_programs += systemd_hwdb
3301
3302 if want_tests != 'false'
3303 test('hwdb-test',
3304 hwdb_test_sh,
3305 args : [systemd_hwdb.full_path()],
3306 timeout : 90)
3307 endif
3308 endif
3309
3310 if conf.get('ENABLE_QUOTACHECK') == 1
3311 executable(
3312 'systemd-quotacheck',
3313 'src/quotacheck/quotacheck.c',
3314 include_directories : includes,
3315 link_with : [libshared],
3316 install_rpath : rootlibexecdir,
3317 install : true,
3318 install_dir : rootlibexecdir)
3319 endif
3320
3321 public_programs += executable(
3322 'systemd-socket-proxyd',
3323 'src/socket-proxy/socket-proxyd.c',
3324 include_directories : includes,
3325 link_with : [libshared],
3326 dependencies : [threads],
3327 install_rpath : rootlibexecdir,
3328 install : true,
3329 install_dir : rootlibexecdir)
3330
3331 public_programs += executable(
3332 'udevadm',
3333 udevadm_sources,
3334 include_directories : includes,
3335 link_with : [libudevd_core],
3336 dependencies : [versiondep,
3337 threads,
3338 libkmod,
3339 libidn,
3340 libacl,
3341 libblkid],
3342 install_rpath : udev_rpath,
3343 install : true,
3344 install_dir : rootbindir)
3345
3346 executable(
3347 'systemd-shutdown',
3348 systemd_shutdown_sources,
3349 include_directories : includes,
3350 link_with : [libshared],
3351 dependencies : [libmount],
3352 install_rpath : rootlibexecdir,
3353 install : true,
3354 install_dir : rootlibexecdir)
3355
3356 executable(
3357 'systemd-update-done',
3358 'src/update-done/update-done.c',
3359 include_directories : includes,
3360 link_with : [libshared],
3361 install_rpath : rootlibexecdir,
3362 install : true,
3363 install_dir : rootlibexecdir)
3364
3365 executable(
3366 'systemd-update-utmp',
3367 'src/update-utmp/update-utmp.c',
3368 include_directories : includes,
3369 link_with : [libshared],
3370 dependencies : [libaudit],
3371 install_rpath : rootlibexecdir,
3372 install : (conf.get('ENABLE_UTMP') == 1),
3373 install_dir : rootlibexecdir)
3374
3375 if conf.get('HAVE_KMOD') == 1
3376 executable(
3377 'systemd-modules-load',
3378 'src/modules-load/modules-load.c',
3379 include_directories : includes,
3380 link_with : [libshared],
3381 dependencies : [libkmod],
3382 install_rpath : rootlibexecdir,
3383 install : true,
3384 install_dir : rootlibexecdir)
3385
3386 meson.add_install_script('sh', '-c',
3387 mkdir_p.format(modulesloaddir))
3388 if install_sysconfdir
3389 meson.add_install_script('sh', '-c',
3390 mkdir_p.format(sysconfdir / 'modules-load.d'))
3391 endif
3392 endif
3393
3394 public_programs += executable(
3395 'systemd-nspawn',
3396 systemd_nspawn_sources,
3397 include_directories : includes,
3398 link_with : [libnspawn_core,
3399 libshared],
3400 dependencies : [libblkid,
3401 libseccomp],
3402 install_rpath : rootlibexecdir,
3403 install : true)
3404
3405 if conf.get('ENABLE_NETWORKD') == 1
3406 executable(
3407 'systemd-networkd',
3408 systemd_networkd_sources,
3409 include_directories : network_includes,
3410 link_with : [libnetworkd_core,
3411 libsystemd_network,
3412 networkd_link_with],
3413 dependencies : [threads],
3414 install_rpath : rootlibexecdir,
3415 install : true,
3416 install_dir : rootlibexecdir)
3417
3418 executable(
3419 'systemd-networkd-wait-online',
3420 systemd_networkd_wait_online_sources,
3421 include_directories : includes,
3422 link_with : [networkd_link_with],
3423 install_rpath : rootlibexecdir,
3424 install : true,
3425 install_dir : rootlibexecdir)
3426
3427 public_programs += executable(
3428 'networkctl',
3429 networkctl_sources,
3430 include_directories : libsystemd_network_includes,
3431 link_with : [libsystemd_network,
3432 networkd_link_with],
3433 install_rpath : rootlibexecdir,
3434 install : true,
3435 install_dir : rootbindir)
3436
3437 exe = executable(
3438 'systemd-network-generator',
3439 network_generator_sources,
3440 include_directories : includes,
3441 link_with : [networkd_link_with],
3442 install_rpath : rootlibexecdir,
3443 install : true,
3444 install_dir : rootlibexecdir)
3445
3446 if want_tests != 'false'
3447 test('test-network-generator-conversion',
3448 test_network_generator_conversion_sh,
3449 # https://github.com/mesonbuild/meson/issues/2681
3450 args : exe.full_path())
3451 endif
3452 endif
3453
3454 executable(
3455 'systemd-sulogin-shell',
3456 'src/sulogin-shell/sulogin-shell.c',
3457 include_directories : includes,
3458 link_with : [libshared],
3459 install_rpath : rootlibexecdir,
3460 install : true,
3461 install_dir : rootlibexecdir)
3462
3463 ############################################################
3464
3465 custom_target(
3466 'systemd-runtest.env',
3467 output : 'systemd-runtest.env',
3468 command : [sh, '-c',
3469 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
3470 project_source_root / 'test',
3471 project_build_root / 'catalog')],
3472 build_by_default : true)
3473
3474 test_cflags = ['-DTEST_CODE=1']
3475 # We intentionally do not do inline initializations with definitions for a
3476 # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
3477 # use the variable unexpectedly. This triggers a lot of maybe-uninitialized
3478 # false positives when the combination of -O2 and -flto is used. Suppress them.
3479 if '-O2' in get_option('c_args') and '-flto=auto' in get_option('c_args')
3480 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
3481 endif
3482
3483 foreach tuple : tests
3484 sources = tuple[0]
3485 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3486 dependencies = tuple.length() > 2 ? tuple[2] : []
3487 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3488 condition = tuple.length() > 4 ? tuple[4] : ''
3489 type = tuple.length() > 5 ? tuple[5] : ''
3490 defs = tuple.length() > 6 ? tuple[6] : []
3491 defs += test_cflags
3492 parallel = tuple.length() > 7 ? tuple[7] : true
3493 timeout = 30
3494
3495 name = sources[0].split('/')[-1].split('.')[0]
3496 if type.startswith('timeout=')
3497 timeout = type.split('=')[1].to_int()
3498 type = ''
3499 endif
3500
3501 if condition == '' or conf.get(condition) == 1
3502 exe = executable(
3503 name,
3504 sources,
3505 include_directories : incs,
3506 link_with : link_with,
3507 dependencies : [versiondep,
3508 dependencies],
3509 c_args : defs,
3510 build_by_default : want_tests != 'false',
3511 install_rpath : rootlibexecdir,
3512 install : install_tests,
3513 install_dir : testsdir / type)
3514
3515 if type == 'manual'
3516 message('@0@ is a manual test'.format(name))
3517 elif type == 'unsafe' and want_tests != 'unsafe'
3518 message('@0@ is an unsafe test'.format(name))
3519 elif want_tests != 'false'
3520 test(name, exe,
3521 env : test_env,
3522 timeout : timeout)
3523 endif
3524 else
3525 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3526 endif
3527 endforeach
3528
3529 exe = executable(
3530 'test-libsystemd-sym',
3531 test_libsystemd_sym_c,
3532 include_directories : includes,
3533 link_with : [libsystemd],
3534 build_by_default : want_tests != 'false',
3535 install : install_tests,
3536 install_dir : testsdir)
3537 if want_tests != 'false'
3538 test('test-libsystemd-sym', exe)
3539 endif
3540
3541 exe = executable(
3542 'test-libsystemd-static-sym',
3543 test_libsystemd_sym_c,
3544 include_directories : includes,
3545 link_with : [install_libsystemd_static],
3546 dependencies : [threads], # threads is already included in dependencies on the library,
3547 # but does not seem to get propagated. Add here as a work-around.
3548 build_by_default : want_tests != 'false' and static_libsystemd_pic,
3549 install : install_tests and static_libsystemd_pic,
3550 install_dir : testsdir)
3551 if want_tests != 'false' and static_libsystemd_pic
3552 test('test-libsystemd-static-sym', exe)
3553 endif
3554
3555 exe = executable(
3556 'test-libudev-sym',
3557 test_libudev_sym_c,
3558 include_directories : libudev_includes,
3559 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3560 link_with : [libudev],
3561 build_by_default : want_tests != 'false',
3562 install : install_tests,
3563 install_dir : testsdir)
3564 if want_tests != 'false'
3565 test('test-libudev-sym', exe)
3566 endif
3567
3568 exe = executable(
3569 'test-libudev-static-sym',
3570 test_libudev_sym_c,
3571 include_directories : libudev_includes,
3572 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3573 link_with : [install_libudev_static],
3574 build_by_default : want_tests != 'false' and static_libudev_pic,
3575 install : install_tests and static_libudev_pic,
3576 install_dir : testsdir)
3577 if want_tests != 'false' and static_libudev_pic
3578 test('test-libudev-static-sym', exe)
3579 endif
3580
3581 ############################################################
3582
3583 fuzzer_exes = []
3584
3585 foreach tuple : fuzzers
3586 sources = tuple[0]
3587 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3588 dependencies = tuple.length() > 2 ? tuple[2] : []
3589 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3590 defs = tuple.length() > 4 ? tuple[4] : []
3591 link_args = []
3592
3593 if want_ossfuzz
3594 dependencies += fuzzing_engine
3595 elif want_libfuzzer
3596 if fuzzing_engine.found()
3597 dependencies += fuzzing_engine
3598 else
3599 link_args += ['-fsanitize=fuzzer']
3600 endif
3601 else
3602 sources += 'src/fuzz/fuzz-main.c'
3603 endif
3604
3605 name = sources[0].split('/')[-1].split('.')[0]
3606
3607 exe = executable(
3608 name,
3609 sources,
3610 include_directories : [incs, include_directories('src/fuzz')],
3611 link_with : link_with,
3612 dependencies : dependencies,
3613 c_args : defs + test_cflags,
3614 link_args: link_args,
3615 install : false,
3616 build_by_default : fuzzer_build)
3617 fuzzer_exes += exe
3618
3619 if want_tests != 'false'
3620 # Run the fuzz regression tests without any sanitizers enabled.
3621 # Additional invocations with sanitizers may be added below.
3622 foreach p : fuzz_regression_tests
3623 b = p.split('/')[-2]
3624 c = p.split('/')[-1]
3625
3626 if b == name
3627 test('@0@_@1@'.format(b, c),
3628 exe,
3629 args : [project_source_root / p])
3630 endif
3631 endforeach
3632 endif
3633 endforeach
3634
3635 alias_target('fuzzers', fuzzer_exes)
3636
3637 ############################################################
3638
3639 subdir('modprobe.d')
3640 subdir('sysctl.d')
3641 subdir('sysusers.d')
3642 subdir('tmpfiles.d')
3643 subdir('hwdb.d')
3644 subdir('units')
3645 subdir('presets')
3646 subdir('network')
3647 subdir('man')
3648 subdir('shell-completion/bash')
3649 subdir('shell-completion/zsh')
3650 subdir('docs/sysvinit')
3651 subdir('docs/var-log')
3652
3653 install_subdir('factory/etc',
3654 install_dir : factorydir)
3655
3656 if install_sysconfdir
3657 install_data('xorg/50-systemd-user.sh',
3658 install_dir : xinitrcdir)
3659 endif
3660 install_data('LICENSE.GPL2',
3661 'LICENSE.LGPL2.1',
3662 'NEWS',
3663 'README',
3664 'docs/CODING_STYLE.md',
3665 'docs/DISTRO_PORTING.md',
3666 'docs/ENVIRONMENT.md',
3667 'docs/HACKING.md',
3668 'docs/TRANSIENT-SETTINGS.md',
3669 'docs/TRANSLATORS.md',
3670 'docs/UIDS-GIDS.md',
3671 'docs/GVARIANT-SERIALIZATION.md',
3672 install_dir : docdir)
3673
3674 install_subdir('LICENSES',
3675 install_dir : docdir)
3676
3677 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3678 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3679
3680 ############################################################
3681
3682 # Ensure that changes to the docs/ directory do not break the
3683 # basic Github pages build. But only run it in developer mode,
3684 # as it might be fragile due to changes in the tooling, and it is
3685 # not generally useful for users.
3686 jekyll = find_program('jekyll', required : false)
3687 if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
3688 test('github-pages',
3689 jekyll,
3690 args : ['build',
3691 '--source', project_source_root / 'docs',
3692 '--destination', project_build_root / '_site'])
3693 endif
3694
3695 ############################################################
3696
3697 check_help = find_program('tools/check-help.sh')
3698
3699 foreach exec : public_programs
3700 name = exec.full_path().split('/')[-1]
3701 if want_tests != 'false'
3702 test('check-help-' + name,
3703 check_help,
3704 args : exec.full_path())
3705 endif
3706 endforeach
3707
3708 ############################################################
3709
3710 check_directives_sh = find_program('tools/check-directives.sh')
3711
3712 if want_tests != 'false'
3713 test('check-directives',
3714 check_directives_sh,
3715 args : [project_source_root, project_build_root])
3716 endif
3717
3718 ############################################################
3719
3720 # Enable tests for all supported sanitizers
3721 foreach tuple : sanitizers
3722 sanitizer = tuple[0]
3723 build = tuple[1]
3724
3725 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3726 prev = ''
3727 foreach p : fuzz_regression_tests
3728 b = p.split('/')[-2]
3729 c = p.split('/')[-1]
3730
3731 name = '@0@:@1@'.format(b, sanitizer)
3732
3733 if name != prev
3734 if want_tests == 'false'
3735 message('Not compiling @0@ because tests is set to false'.format(name))
3736 elif fuzz_tests
3737 exe = custom_target(
3738 name,
3739 output : name,
3740 depends : build,
3741 command : [ln, '-fs',
3742 build.full_path() / b,
3743 '@OUTPUT@'],
3744 build_by_default : true)
3745 else
3746 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
3747 endif
3748 endif
3749 prev = name
3750
3751 if fuzz_tests
3752 test('@0@_@1@_@2@'.format(b, c, sanitizer),
3753 env,
3754 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3755 timeout : 60,
3756 args : [exe.full_path(),
3757 project_source_root / p])
3758 endif
3759 endforeach
3760 endif
3761 endforeach
3762
3763
3764 ############################################################
3765
3766 if git.found()
3767 all_files = run_command(
3768 env, '-u', 'GIT_WORK_TREE',
3769 git, '--git-dir=@0@/.git'.format(project_source_root),
3770 'ls-files', ':/*.[ch]',
3771 check : false)
3772 if all_files.returncode() == 0
3773 all_files = files(all_files.stdout().split())
3774
3775 custom_target(
3776 'tags',
3777 output : 'tags',
3778 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
3779 run_target(
3780 'ctags',
3781 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
3782 endif
3783 endif
3784
3785 if git.found()
3786 git_contrib_sh = find_program('tools/git-contrib.sh')
3787 run_target(
3788 'git-contrib',
3789 command : [git_contrib_sh])
3790 endif
3791
3792 if git.found()
3793 git_head = run_command(
3794 git, '--git-dir=@0@/.git'.format(project_source_root),
3795 'rev-parse', 'HEAD',
3796 check : false).stdout().strip()
3797 git_head_short = run_command(
3798 git, '--git-dir=@0@/.git'.format(project_source_root),
3799 'rev-parse', '--short=7', 'HEAD',
3800 check : false).stdout().strip()
3801
3802 run_target(
3803 'git-snapshot',
3804 command : [git, 'archive',
3805 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
3806 git_head_short),
3807 '--prefix', 'systemd-@0@/'.format(git_head),
3808 'HEAD'])
3809 endif
3810
3811 ############################################################
3812
3813 check_api_docs_sh = find_program('tools/check-api-docs.sh')
3814 run_target(
3815 'check-api-docs',
3816 depends : [man, libsystemd, libudev],
3817 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3818
3819 alias_target('update-dbus-docs', update_dbus_docs)
3820 alias_target('update-man-rules', update_man_rules)
3821
3822 ############################################################
3823
3824 alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
3825 check : true).stdout().strip()
3826
3827 summary({
3828 'build mode' : get_option('mode'),
3829 'split /usr' : split_usr,
3830 'split bin-sbin' : split_bin,
3831 'prefix directory' : prefixdir,
3832 'rootprefix directory' : rootprefixdir,
3833 'sysconf directory' : sysconfdir,
3834 'include directory' : includedir,
3835 'lib directory' : libdir,
3836 'rootlib directory' : rootlibdir,
3837 'SysV init scripts' : sysvinit_path,
3838 'SysV rc?.d directories' : sysvrcnd_path,
3839 'PAM modules directory' : pamlibdir,
3840 'PAM configuration directory' : pamconfdir,
3841 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
3842 'RPM macros directory' : rpmmacrosdir,
3843 'modprobe.d directory' : modprobedir,
3844 'D-Bus policy directory' : dbuspolicydir,
3845 'D-Bus session directory' : dbussessionservicedir,
3846 'D-Bus system directory' : dbussystemservicedir,
3847 'bash completions directory' : bashcompletiondir,
3848 'zsh completions directory' : zshcompletiondir,
3849 'extra start script' : get_option('rc-local'),
3850 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
3851 get_option('debug-tty')),
3852 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
3853 conf.get('SYSTEM_ALLOC_UID_MIN')),
3854 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
3855 conf.get('SYSTEM_ALLOC_GID_MIN')),
3856 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
3857 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
3858 'static UID/GID allocations' : ' '.join(static_ugids),
3859 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
3860 'render group access mode' : get_option('group-render-mode'),
3861 'certificate root directory' : get_option('certificate-root'),
3862 'support URL' : support_url,
3863 'nobody user name' : nobody_user,
3864 'nobody group name' : nobody_group,
3865 'fallback hostname' : get_option('fallback-hostname'),
3866 'default DNSSEC mode' : default_dnssec,
3867 'default DNS-over-TLS mode' : default_dns_over_tls,
3868 'default mDNS mode' : default_mdns,
3869 'default LLMNR mode' : default_llmnr,
3870 'default DNS servers' : dns_servers.split(' '),
3871 'default NTP servers' : ntp_servers.split(' '),
3872 'default cgroup hierarchy' : default_hierarchy,
3873 'default net.naming-scheme value' : default_net_naming_scheme,
3874 'default KillUserProcesses value' : kill_user_processes,
3875 'default locale' : default_locale,
3876 'default user $PATH' :
3877 default_user_path != '' ? default_user_path : '(same as system services)',
3878 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
3879 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
3880
3881 # TODO:
3882 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3883 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3884 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3885
3886 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_GNU_EFI') == 1
3887 summary({
3888 'EFI machine type' : efi_arch[0],
3889 'EFI CC' : '@0@'.format(' '.join(efi_cc)),
3890 'EFI lds' : efi_lds,
3891 'EFI crt0' : efi_crt0,
3892 'EFI include directory' : efi_incdir},
3893 section : 'Extensible Firmware Interface')
3894 endif
3895
3896 found = []
3897 missing = []
3898
3899 foreach tuple : [
3900 # dependencies
3901 ['ACL'],
3902 ['AUDIT'],
3903 ['AppArmor'],
3904 ['IMA'],
3905 ['PAM'],
3906 ['SECCOMP'],
3907 ['SELinux'],
3908 ['SMACK'],
3909 ['blkid'],
3910 ['elfutils'],
3911 ['gcrypt'],
3912 ['gnutls'],
3913 ['libbpf'],
3914 ['libcryptsetup'],
3915 ['libcryptsetup-plugins'],
3916 ['libcurl'],
3917 ['libfdisk'],
3918 ['libfido2'],
3919 ['libidn'],
3920 ['libidn2'],
3921 ['libiptc'],
3922 ['microhttpd'],
3923 ['openssl'],
3924 ['p11kit'],
3925 ['pcre2'],
3926 ['pwquality'],
3927 ['qrencode'],
3928 ['tpm2'],
3929 ['xkbcommon'],
3930
3931 # compression libs
3932 ['zstd'],
3933 ['lz4'],
3934 ['xz'],
3935 ['zlib'],
3936 ['bzip2'],
3937
3938 # components
3939 ['backlight'],
3940 ['binfmt'],
3941 ['bpf-framework'],
3942 ['coredump'],
3943 ['environment.d'],
3944 ['efi'],
3945 ['gnu-efi'],
3946 ['firstboot'],
3947 ['hibernate'],
3948 ['homed'],
3949 ['hostnamed'],
3950 ['hwdb'],
3951 ['importd'],
3952 ['initrd'],
3953 ['kernel-install', get_option('kernel-install')],
3954 ['localed'],
3955 ['logind'],
3956 ['machined'],
3957 ['networkd'],
3958 ['nss-myhostname'],
3959 ['nss-mymachines'],
3960 ['nss-resolve'],
3961 ['nss-systemd'],
3962 ['oomd'],
3963 ['portabled'],
3964 ['pstore'],
3965 ['quotacheck'],
3966 ['randomseed'],
3967 ['repart'],
3968 ['resolve'],
3969 ['rfkill'],
3970 ['sysext'],
3971 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
3972 ['sysusers'],
3973 ['timedated'],
3974 ['timesyncd'],
3975 ['tmpfiles'],
3976 ['userdb'],
3977 ['vconsole'],
3978 ['xdg-autostart'],
3979
3980 # optional features
3981 ['idn'],
3982 ['polkit'],
3983 ['nscd'],
3984 ['legacy-pkla', install_polkit_pkla],
3985 ['kmod'],
3986 ['dbus'],
3987 ['glib'],
3988 ['tpm'],
3989 ['man pages', want_man],
3990 ['html pages', want_html],
3991 ['man page indices', want_man and have_lxml],
3992 ['SysV compat'],
3993 ['compat-mutable-uid-boundaries'],
3994 ['utmp'],
3995 ['ldconfig'],
3996 ['adm group', get_option('adm-group')],
3997 ['wheel group', get_option('wheel-group')],
3998 ['gshadow'],
3999 ['debug hashmap'],
4000 ['debug mmap cache'],
4001 ['debug siphash'],
4002 ['valgrind'],
4003 ['trace logging', conf.get('LOG_TRACE') == 1],
4004 ['install tests', install_tests],
4005 ['link-udev-shared', get_option('link-udev-shared')],
4006 ['link-systemctl-shared', get_option('link-systemctl-shared')],
4007 ['link-networkd-shared', get_option('link-networkd-shared')],
4008 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
4009 ['fexecve'],
4010 ['standalone-binaries', get_option('standalone-binaries')],
4011 ]
4012
4013 if tuple.length() >= 2
4014 cond = tuple[1]
4015 else
4016 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
4017 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
4018 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
4019 endif
4020 if cond
4021 found += tuple[0]
4022 else
4023 missing += tuple[0]
4024 endif
4025 endforeach
4026
4027 if static_libsystemd == 'false'
4028 missing += 'static-libsystemd'
4029 else
4030 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
4031 endif
4032
4033 if static_libudev == 'false'
4034 missing += 'static-libudev'
4035 else
4036 found += 'static-libudev(@0@)'.format(static_libudev)
4037 endif
4038
4039 if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
4040 found += 'cryptolib(openssl)'
4041 elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
4042 found += 'cryptolib(gcrypt)'
4043 else
4044 missing += 'cryptolib'
4045 endif
4046
4047 if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
4048 found += 'DNS-over-TLS(gnutls)'
4049 elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
4050 found += 'DNS-over-TLS(openssl)'
4051 else
4052 missing += 'DNS-over-TLS'
4053 endif
4054
4055 summary({
4056 'enabled' : ', '.join(found),
4057 'disabled' : ', '.join(missing)},
4058 section : 'Features')
4059
4060 if rootprefixdir != rootprefix_default
4061 warning('\n' +
4062 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
4063 'systemd used fixed names for unit file directories and other paths, so anything\n' +
4064 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
4065 endif