]> git.ipfire.org Git - thirdparty/systemd.git/blob - meson.build
Merge pull request #21454 from bluca/inspect_elf
[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 # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
996 # (like clang-10/llvm-strip-10)
997 clang_bin = cc.get_id() == 'clang' ? cc.cmd_array()[0] : 'clang'
998 clang = find_program(clang_bin, required : bpf_framework_required)
999 if clang.found()
1000 llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
1001 check : true).stdout().strip()
1002 else
1003 llvm_strip_bin = 'llvm-strip'
1004 endif
1005 llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required)
1006
1007 # Debian installs this in /usr/sbin/ which is not in $PATH.
1008 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1009 bpftool = find_program('bpftool', '/usr/sbin/bpftool', required : bpf_framework_required)
1010
1011 bpf_arches = ['x86_64']
1012 deps_found = libbpf.found() and clang.found() and llvm_strip.found() and bpftool.found()
1013 # Can build BPF program from source code in restricted C
1014 conf.set10('BPF_FRAMEWORK',
1015 bpf_arches.contains(host_machine.cpu_family()) and deps_found)
1016 endif
1017
1018 libmount = dependency('mount',
1019 version : fuzzer_build ? '>= 0' : '>= 2.30')
1020
1021 want_libfdisk = get_option('fdisk')
1022 if want_libfdisk != 'false' and not skip_deps
1023 libfdisk = dependency('fdisk',
1024 version : '>= 2.33',
1025 required : want_libfdisk == 'true')
1026 have = libfdisk.found()
1027 else
1028 have = false
1029 libfdisk = []
1030 endif
1031 conf.set10('HAVE_LIBFDISK', have)
1032
1033 want_pwquality = get_option('pwquality')
1034 if want_pwquality != 'false' and not skip_deps
1035 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1036 have = libpwquality.found()
1037 else
1038 have = false
1039 libpwquality = []
1040 endif
1041 conf.set10('HAVE_PWQUALITY', have)
1042
1043 want_seccomp = get_option('seccomp')
1044 if want_seccomp != 'false' and not skip_deps
1045 libseccomp = dependency('libseccomp',
1046 version : '>= 2.3.1',
1047 required : want_seccomp == 'true')
1048 have = libseccomp.found()
1049 else
1050 have = false
1051 libseccomp = []
1052 endif
1053 conf.set10('HAVE_SECCOMP', have)
1054
1055 want_selinux = get_option('selinux')
1056 if want_selinux != 'false' and not skip_deps
1057 libselinux = dependency('libselinux',
1058 version : '>= 2.1.9',
1059 required : want_selinux == 'true')
1060 have = libselinux.found()
1061 else
1062 have = false
1063 libselinux = []
1064 endif
1065 conf.set10('HAVE_SELINUX', have)
1066
1067 want_apparmor = get_option('apparmor')
1068 if want_apparmor != 'false' and not skip_deps
1069 libapparmor = dependency('libapparmor',
1070 version : '>= 2.13',
1071 required : want_apparmor == 'true')
1072 have = libapparmor.found()
1073 else
1074 have = false
1075 libapparmor = []
1076 endif
1077 conf.set10('HAVE_APPARMOR', have)
1078
1079 have = get_option('smack') and get_option('smack-run-label') != ''
1080 conf.set10('HAVE_SMACK_RUN_LABEL', have)
1081 if have
1082 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1083 endif
1084
1085 want_polkit = get_option('polkit')
1086 install_polkit = false
1087 install_polkit_pkla = false
1088 if want_polkit != 'false' and not skip_deps
1089 install_polkit = true
1090
1091 libpolkit = dependency('polkit-gobject-1',
1092 required : false)
1093 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1094 message('Old polkit detected, will install pkla files')
1095 install_polkit_pkla = true
1096 endif
1097 endif
1098 conf.set10('ENABLE_POLKIT', install_polkit)
1099
1100 want_acl = get_option('acl')
1101 if want_acl != 'false' and not skip_deps
1102 libacl = cc.find_library('acl', required : want_acl == 'true')
1103 have = libacl.found()
1104 else
1105 have = false
1106 libacl = []
1107 endif
1108 conf.set10('HAVE_ACL', have)
1109
1110 want_audit = get_option('audit')
1111 if want_audit != 'false' and not skip_deps
1112 libaudit = dependency('audit', required : want_audit == 'true')
1113 have = libaudit.found()
1114 else
1115 have = false
1116 libaudit = []
1117 endif
1118 conf.set10('HAVE_AUDIT', have)
1119
1120 want_blkid = get_option('blkid')
1121 if want_blkid != 'false' and not skip_deps
1122 libblkid = dependency('blkid', required : want_blkid == 'true')
1123 have = libblkid.found()
1124
1125 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1126 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1127 else
1128 have = false
1129 libblkid = []
1130 endif
1131 conf.set10('HAVE_BLKID', have)
1132
1133 want_kmod = get_option('kmod')
1134 if want_kmod != 'false' and not skip_deps
1135 libkmod = dependency('libkmod',
1136 version : '>= 15',
1137 required : want_kmod == 'true')
1138 have = libkmod.found()
1139 else
1140 have = false
1141 libkmod = []
1142 endif
1143 conf.set10('HAVE_KMOD', have)
1144
1145 want_pam = get_option('pam')
1146 if want_pam != 'false' and not skip_deps
1147 libpam = cc.find_library('pam', required : want_pam == 'true')
1148 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1149 have = libpam.found() and libpam_misc.found()
1150 else
1151 have = false
1152 libpam = []
1153 libpam_misc = []
1154 endif
1155 conf.set10('HAVE_PAM', have)
1156
1157 want_microhttpd = get_option('microhttpd')
1158 if want_microhttpd != 'false' and not skip_deps
1159 libmicrohttpd = dependency('libmicrohttpd',
1160 version : '>= 0.9.33',
1161 required : want_microhttpd == 'true')
1162 have = libmicrohttpd.found()
1163 else
1164 have = false
1165 libmicrohttpd = []
1166 endif
1167 conf.set10('HAVE_MICROHTTPD', have)
1168
1169 want_libcryptsetup = get_option('libcryptsetup')
1170 want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1171
1172 if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1173 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1174 endif
1175
1176 if want_libcryptsetup != 'false' and not skip_deps
1177 libcryptsetup = dependency('libcryptsetup',
1178 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1179 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
1180 have = libcryptsetup.found()
1181
1182 conf.set10('HAVE_CRYPT_SET_METADATA_SIZE',
1183 have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup))
1184 conf.set10('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY',
1185 have and cc.has_function('crypt_activate_by_signed_key', dependencies : libcryptsetup))
1186 conf.set10('HAVE_CRYPT_TOKEN_MAX',
1187 have and cc.has_function('crypt_token_max', dependencies : libcryptsetup))
1188 else
1189 have = false
1190 libcryptsetup = []
1191 endif
1192 conf.set10('HAVE_LIBCRYPTSETUP', have)
1193
1194 if want_libcryptsetup_plugins != 'false' and not skip_deps
1195 have = (cc.has_function('crypt_activate_by_token_pin', dependencies : libcryptsetup) and
1196 cc.has_function('crypt_token_external_path', dependencies : libcryptsetup))
1197 else
1198 have = false
1199 endif
1200 conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1201
1202 want_libcurl = get_option('libcurl')
1203 if want_libcurl != 'false' and not skip_deps
1204 libcurl = dependency('libcurl',
1205 version : '>= 7.32.0',
1206 required : want_libcurl == 'true')
1207 have = libcurl.found()
1208 else
1209 have = false
1210 libcurl = []
1211 endif
1212 conf.set10('HAVE_LIBCURL', have)
1213 conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
1214
1215 want_libidn = get_option('libidn')
1216 want_libidn2 = get_option('libidn2')
1217 if want_libidn == 'true' and want_libidn2 == 'true'
1218 error('libidn and libidn2 cannot be requested simultaneously')
1219 endif
1220
1221 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1222 libidn = dependency('libidn2',
1223 required : want_libidn2 == 'true')
1224 have = libidn.found()
1225 else
1226 have = false
1227 libidn = []
1228 endif
1229 conf.set10('HAVE_LIBIDN2', have)
1230 if not have and want_libidn != 'false' and not skip_deps
1231 # libidn is used for both libidn and libidn2 objects
1232 libidn = dependency('libidn',
1233 required : want_libidn == 'true')
1234 have = libidn.found()
1235 else
1236 have = false
1237 endif
1238 conf.set10('HAVE_LIBIDN', have)
1239
1240 want_libiptc = get_option('libiptc')
1241 if want_libiptc != 'false' and not skip_deps
1242 libiptc = dependency('libiptc',
1243 required : want_libiptc == 'true')
1244 have = libiptc.found()
1245 else
1246 have = false
1247 libiptc = []
1248 endif
1249 conf.set10('HAVE_LIBIPTC', have)
1250
1251 want_qrencode = get_option('qrencode')
1252 if want_qrencode != 'false' and not skip_deps
1253 libqrencode = dependency('libqrencode',
1254 version : '>= 4',
1255 required : want_qrencode == 'true')
1256 have = libqrencode.found()
1257 else
1258 have = false
1259 libqrencode = []
1260 endif
1261 conf.set10('HAVE_QRENCODE', have)
1262
1263 want_gcrypt = get_option('gcrypt')
1264 if want_gcrypt != 'false' and not skip_deps
1265 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1266 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1267 have = libgcrypt.found() and libgpg_error.found()
1268 else
1269 have = false
1270 endif
1271 if not have
1272 # link to neither of the libs if one is not found
1273 libgcrypt = []
1274 libgpg_error = []
1275 endif
1276 conf.set10('HAVE_GCRYPT', have)
1277
1278 want_gnutls = get_option('gnutls')
1279 if want_gnutls != 'false' and not skip_deps
1280 libgnutls = dependency('gnutls',
1281 version : '>= 3.1.4',
1282 required : want_gnutls == 'true')
1283 have = libgnutls.found()
1284 else
1285 have = false
1286 libgnutls = []
1287 endif
1288 conf.set10('HAVE_GNUTLS', have)
1289
1290 want_openssl = get_option('openssl')
1291 if want_openssl != 'false' and not skip_deps
1292 libopenssl = dependency('openssl',
1293 version : '>= 1.1.0',
1294 required : want_openssl == 'true')
1295 have = libopenssl.found()
1296 else
1297 have = false
1298 libopenssl = []
1299 endif
1300 conf.set10('HAVE_OPENSSL', have)
1301
1302 want_p11kit = get_option('p11kit')
1303 if want_p11kit != 'false' and not skip_deps
1304 libp11kit = dependency('p11-kit-1',
1305 version : '>= 0.23.3',
1306 required : want_p11kit == 'true')
1307 have = libp11kit.found()
1308 else
1309 have = false
1310 libp11kit = []
1311 endif
1312 conf.set10('HAVE_P11KIT', have)
1313
1314 want_libfido2 = get_option('libfido2')
1315 if want_libfido2 != 'false' and not skip_deps
1316 libfido2 = dependency('libfido2',
1317 required : want_libfido2 == 'true')
1318 have = libfido2.found()
1319 else
1320 have = false
1321 libfido2 = []
1322 endif
1323 conf.set10('HAVE_LIBFIDO2', have)
1324
1325 want_tpm2 = get_option('tpm2')
1326 if want_tpm2 != 'false' and not skip_deps
1327 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1328 required : want_tpm2 == 'true')
1329 have = tpm2.found()
1330 else
1331 have = false
1332 tpm2 = []
1333 endif
1334 conf.set10('HAVE_TPM2', have)
1335
1336 want_elfutils = get_option('elfutils')
1337 if want_elfutils != 'false' and not skip_deps
1338 libdw = dependency('libdw',
1339 required : want_elfutils == 'true')
1340 have = libdw.found()
1341
1342 # New in elfutils 0.177
1343 conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING',
1344 have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw))
1345 else
1346 have = false
1347 libdw = []
1348 endif
1349 conf.set10('HAVE_ELFUTILS', have)
1350
1351 want_zlib = get_option('zlib')
1352 if want_zlib != 'false' and not skip_deps
1353 libz = dependency('zlib',
1354 required : want_zlib == 'true')
1355 have = libz.found()
1356 else
1357 have = false
1358 libz = []
1359 endif
1360 conf.set10('HAVE_ZLIB', have)
1361
1362 want_bzip2 = get_option('bzip2')
1363 if want_bzip2 != 'false' and not skip_deps
1364 libbzip2 = cc.find_library('bz2',
1365 required : want_bzip2 == 'true')
1366 have = libbzip2.found()
1367 else
1368 have = false
1369 libbzip2 = []
1370 endif
1371 conf.set10('HAVE_BZIP2', have)
1372
1373 want_xz = get_option('xz')
1374 if want_xz != 'false' and not skip_deps
1375 libxz = dependency('liblzma',
1376 required : want_xz == 'true')
1377 have_xz = libxz.found()
1378 else
1379 have_xz = false
1380 libxz = []
1381 endif
1382 conf.set10('HAVE_XZ', have_xz)
1383
1384 want_lz4 = get_option('lz4')
1385 if want_lz4 != 'false' and not skip_deps
1386 liblz4 = dependency('liblz4',
1387 version : '>= 1.3.0',
1388 required : want_lz4 == 'true')
1389 have_lz4 = liblz4.found()
1390 else
1391 have_lz4 = false
1392 liblz4 = []
1393 endif
1394 conf.set10('HAVE_LZ4', have_lz4)
1395
1396 want_zstd = get_option('zstd')
1397 if want_zstd != 'false' and not skip_deps
1398 libzstd = dependency('libzstd',
1399 required : want_zstd == 'true',
1400 version : '>= 1.4.0')
1401 have_zstd = libzstd.found()
1402 else
1403 have_zstd = false
1404 libzstd = []
1405 endif
1406 conf.set10('HAVE_ZSTD', have_zstd)
1407
1408 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1409
1410 want_xkbcommon = get_option('xkbcommon')
1411 if want_xkbcommon != 'false' and not skip_deps
1412 libxkbcommon = dependency('xkbcommon',
1413 version : '>= 0.3.0',
1414 required : want_xkbcommon == 'true')
1415 have = libxkbcommon.found()
1416 else
1417 have = false
1418 libxkbcommon = []
1419 endif
1420 conf.set10('HAVE_XKBCOMMON', have)
1421
1422 want_pcre2 = get_option('pcre2')
1423 if want_pcre2 != 'false'
1424 libpcre2 = dependency('libpcre2-8',
1425 required : want_pcre2 == 'true')
1426 have = libpcre2.found()
1427 else
1428 have = false
1429 libpcre2 = []
1430 endif
1431 conf.set10('HAVE_PCRE2', have)
1432
1433 want_glib = get_option('glib')
1434 if want_glib != 'false' and not skip_deps
1435 libglib = dependency('glib-2.0',
1436 version : '>= 2.22.0',
1437 required : want_glib == 'true')
1438 libgobject = dependency('gobject-2.0',
1439 version : '>= 2.22.0',
1440 required : want_glib == 'true')
1441 libgio = dependency('gio-2.0',
1442 required : want_glib == 'true')
1443 have = libglib.found() and libgobject.found() and libgio.found()
1444 else
1445 have = false
1446 libglib = []
1447 libgobject = []
1448 libgio = []
1449 endif
1450 conf.set10('HAVE_GLIB', have)
1451
1452 want_dbus = get_option('dbus')
1453 if want_dbus != 'false' and not skip_deps
1454 libdbus = dependency('dbus-1',
1455 version : '>= 1.3.2',
1456 required : want_dbus == 'true')
1457 have = libdbus.found()
1458 else
1459 have = false
1460 libdbus = []
1461 endif
1462 conf.set10('HAVE_DBUS', have)
1463
1464 # We support one or the other. If gcrypt is available, we assume it's there to
1465 # be used, and use it in preference.
1466 opt = get_option('cryptolib')
1467 if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1468 error('openssl requested as the default cryptolib, but not available')
1469 endif
1470 conf.set10('PREFER_OPENSSL',
1471 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1472 conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1473 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
1474 lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? libopenssl : libgcrypt
1475
1476 dns_over_tls = get_option('dns-over-tls')
1477 if dns_over_tls != 'false'
1478 if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1
1479 error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib')
1480 endif
1481
1482 if dns_over_tls == 'openssl' or conf.get('PREFER_OPENSSL') == 1
1483 have_gnutls = false
1484 else
1485 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
1486 if dns_over_tls == 'gnutls' and not have_gnutls
1487 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1488 endif
1489 endif
1490 if dns_over_tls == 'gnutls' or have_gnutls
1491 have_openssl = false
1492 else
1493 have_openssl = conf.get('HAVE_OPENSSL') == 1
1494 if dns_over_tls != 'auto' and not have_openssl
1495 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
1496 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1497 endif
1498 endif
1499 have = have_gnutls or have_openssl
1500 else
1501 have = false
1502 have_gnutls = false
1503 have_openssl = false
1504 endif
1505 conf.set10('ENABLE_DNS_OVER_TLS', have)
1506 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1507 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1508
1509 default_dns_over_tls = get_option('default-dns-over-tls')
1510 if skip_deps
1511 default_dns_over_tls = 'no'
1512 endif
1513 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1514 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.')
1515 default_dns_over_tls = 'no'
1516 endif
1517 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1518 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1519 conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
1520
1521 default_mdns = get_option('default-mdns')
1522 conf.set('DEFAULT_MDNS_MODE',
1523 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1524 conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
1525
1526 default_llmnr = get_option('default-llmnr')
1527 conf.set('DEFAULT_LLMNR_MODE',
1528 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1529 conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
1530
1531 want_repart = get_option('repart')
1532 if want_repart != 'false'
1533 have = conf.get('HAVE_LIBFDISK') == 1
1534 if want_repart == 'true' and not have
1535 error('repart support was requested, but dependencies are not available')
1536 endif
1537 else
1538 have = false
1539 endif
1540 conf.set10('ENABLE_REPART', have)
1541
1542 default_dnssec = get_option('default-dnssec')
1543 if skip_deps
1544 default_dnssec = 'no'
1545 endif
1546 if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0
1547 message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.')
1548 default_dnssec = 'no'
1549 endif
1550 conf.set('DEFAULT_DNSSEC_MODE',
1551 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1552 conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1553
1554 want_importd = get_option('importd')
1555 if want_importd != 'false'
1556 have = (conf.get('HAVE_LIBCURL') == 1 and
1557 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
1558 conf.get('HAVE_ZLIB') == 1 and
1559 conf.get('HAVE_XZ') == 1)
1560 if want_importd == 'true' and not have
1561 error('importd support was requested, but dependencies are not available')
1562 endif
1563 else
1564 have = false
1565 endif
1566 conf.set10('ENABLE_IMPORTD', have)
1567
1568 want_homed = get_option('homed')
1569 if want_homed != 'false'
1570 have = (conf.get('HAVE_OPENSSL') == 1 and
1571 conf.get('HAVE_LIBFDISK') == 1 and
1572 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1573 if want_homed == 'true' and not have
1574 error('homed support was requested, but dependencies are not available')
1575 endif
1576 else
1577 have = false
1578 endif
1579 conf.set10('ENABLE_HOMED', have)
1580
1581 have = have and conf.get('HAVE_PAM') == 1
1582 conf.set10('ENABLE_PAM_HOME', have)
1583
1584 have = get_option('oomd')
1585 conf.set10('ENABLE_OOMD', have)
1586
1587 want_remote = get_option('remote')
1588 if want_remote != 'false'
1589 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1590 conf.get('HAVE_LIBCURL') == 1]
1591 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1592 # it's possible to build one without the other. Complain only if
1593 # support was explicitly requested. The auxiliary files like sysusers
1594 # config should be installed when any of the programs are built.
1595 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1596 error('remote support was requested, but dependencies are not available')
1597 endif
1598 have = have_deps[0] or have_deps[1]
1599 else
1600 have = false
1601 endif
1602 conf.set10('ENABLE_REMOTE', have)
1603
1604 foreach term : ['analyze',
1605 'backlight',
1606 'binfmt',
1607 'coredump',
1608 'efi',
1609 'environment-d',
1610 'firstboot',
1611 'gshadow',
1612 'hibernate',
1613 'hostnamed',
1614 'hwdb',
1615 'idn',
1616 'ima',
1617 'initrd',
1618 'compat-mutable-uid-boundaries',
1619 'nscd',
1620 'ldconfig',
1621 'localed',
1622 'logind',
1623 'machined',
1624 'networkd',
1625 'nss-myhostname',
1626 'nss-systemd',
1627 'portabled',
1628 'sysext',
1629 'pstore',
1630 'quotacheck',
1631 'randomseed',
1632 'resolve',
1633 'rfkill',
1634 'smack',
1635 'sysusers',
1636 'timedated',
1637 'timesyncd',
1638 'tmpfiles',
1639 'tpm',
1640 'userdb',
1641 'utmp',
1642 'vconsole',
1643 'xdg-autostart']
1644 have = get_option(term)
1645 name = 'ENABLE_' + term.underscorify().to_upper()
1646 conf.set10(name, have)
1647 endforeach
1648
1649 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1650
1651 foreach tuple : [['nss-mymachines', 'machined'],
1652 ['nss-resolve', 'resolve']]
1653 want = get_option(tuple[0])
1654 if want != 'false'
1655 have = get_option(tuple[1])
1656 if want == 'true' and not have
1657 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1658 endif
1659 else
1660 have = false
1661 endif
1662 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1663 conf.set10(name, have)
1664 endforeach
1665
1666 enable_nss = false
1667 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1668 'ENABLE_NSS_MYMACHINES',
1669 'ENABLE_NSS_RESOLVE',
1670 'ENABLE_NSS_SYSTEMD']
1671 if conf.get(term) == 1
1672 enable_nss = true
1673 endif
1674 endforeach
1675 conf.set10('ENABLE_NSS', enable_nss)
1676
1677 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1678
1679 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1680
1681 #####################################################################
1682
1683 subdir('src/fundamental')
1684 subdir('src/boot/efi')
1685
1686 ############################################################
1687
1688 build_bpf_skel_py = find_program('tools/build-bpf-skel.py')
1689 generate_gperfs = find_program('tools/generate-gperfs.py')
1690 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1691 make_directive_index_py = find_program('tools/make-directive-index.py')
1692 make_man_index_py = find_program('tools/make-man-index.py')
1693 meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
1694 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1695 update_hwdb_sh = find_program('tools/update-hwdb.sh')
1696 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1697 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1698 xml_helper_py = find_program('tools/xml_helper.py')
1699
1700 #####################################################################
1701
1702 config_h = configure_file(
1703 output : 'config.h',
1704 configuration : conf)
1705
1706 add_project_arguments('-include', 'config.h', language : 'c')
1707
1708 ############################################################
1709
1710 # binaries that have --help and are intended for use by humans,
1711 # usually, but not always, installed in /bin.
1712 public_programs = []
1713
1714 tests = []
1715 fuzzers = []
1716
1717 basic_includes = include_directories(
1718 'src/basic',
1719 'src/fundamental',
1720 'src/systemd',
1721 '.')
1722
1723 libsystemd_includes = [basic_includes, include_directories(
1724 'src/libsystemd/sd-bus',
1725 'src/libsystemd/sd-device',
1726 'src/libsystemd/sd-event',
1727 'src/libsystemd/sd-hwdb',
1728 'src/libsystemd/sd-id128',
1729 'src/libsystemd/sd-journal',
1730 'src/libsystemd/sd-netlink',
1731 'src/libsystemd/sd-network',
1732 'src/libsystemd/sd-resolve')]
1733
1734 includes = [libsystemd_includes, include_directories('src/shared')]
1735
1736 subdir('po')
1737 subdir('catalog')
1738 subdir('src/basic')
1739 subdir('src/libsystemd')
1740 subdir('src/shared')
1741 subdir('src/udev')
1742 subdir('src/libudev')
1743 subdir('src/cryptsetup/cryptsetup-tokens')
1744
1745 libsystemd = shared_library(
1746 'systemd',
1747 disable_mempool_c,
1748 version : libsystemd_version,
1749 include_directories : libsystemd_includes,
1750 link_args : ['-shared',
1751 '-Wl,--version-script=' + libsystemd_sym_path],
1752 link_with : [libbasic,
1753 libbasic_gcrypt],
1754 link_whole : [libsystemd_static],
1755 dependencies : [threads,
1756 librt,
1757 libxz,
1758 libzstd,
1759 liblz4],
1760 link_depends : libsystemd_sym,
1761 install : true,
1762 install_dir : rootlibdir)
1763
1764 install_libsystemd_static = static_library(
1765 'systemd',
1766 libsystemd_sources,
1767 basic_sources,
1768 basic_gcrypt_sources,
1769 fundamental_sources,
1770 disable_mempool_c,
1771 include_directories : libsystemd_includes,
1772 build_by_default : static_libsystemd != 'false',
1773 install : static_libsystemd != 'false',
1774 install_dir : rootlibdir,
1775 pic : static_libsystemd_pic,
1776 dependencies : [threads,
1777 librt,
1778 libxz,
1779 libzstd,
1780 liblz4,
1781 libdl,
1782 libcap,
1783 libblkid,
1784 libmount,
1785 libgcrypt,
1786 libopenssl],
1787 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1788
1789 libudev = shared_library(
1790 'udev',
1791 disable_mempool_c,
1792 version : libudev_version,
1793 include_directories : includes,
1794 link_args : ['-shared',
1795 '-Wl,--version-script=' + libudev_sym_path],
1796 link_with : [libsystemd_static, libshared_static],
1797 link_whole : libudev_basic,
1798 dependencies : [threads],
1799 link_depends : libudev_sym,
1800 install : true,
1801 install_dir : rootlibdir)
1802
1803 install_libudev_static = static_library(
1804 'udev',
1805 basic_sources,
1806 fundamental_sources,
1807 shared_sources,
1808 libsystemd_sources,
1809 libudev_sources,
1810 disable_mempool_c,
1811 include_directories : includes,
1812 build_by_default : static_libudev != 'false',
1813 install : static_libudev != 'false',
1814 install_dir : rootlibdir,
1815 link_depends : libudev_sym,
1816 dependencies : libshared_deps + [libmount],
1817 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1818 pic : static_libudev_pic)
1819
1820 if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
1821 if conf.get('HAVE_TPM2') == 1
1822 cryptsetup_token_systemd_tpm2 = shared_library(
1823 'cryptsetup-token-systemd-tpm2',
1824 link_args : ['-shared',
1825 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1826 dependencies : libshared_deps + [libcryptsetup, versiondep],
1827 link_with : [libshared],
1828 link_whole : [cryptsetup_token_systemd_tpm2_static],
1829 link_depends : cryptsetup_token_sym,
1830 install_rpath : rootlibexecdir,
1831 install : true,
1832 install_dir : libcryptsetup_plugins_dir)
1833 endif
1834
1835 if conf.get('HAVE_LIBFIDO2') == 1
1836 cryptsetup_token_systemd_fido2 = shared_library(
1837 'cryptsetup-token-systemd-fido2',
1838 link_args : ['-shared',
1839 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1840 dependencies : libshared_deps + [libcryptsetup, versiondep],
1841 link_with : [libshared],
1842 link_whole : [cryptsetup_token_systemd_fido2_static],
1843 link_depends : cryptsetup_token_sym,
1844 install_rpath : rootlibexecdir,
1845 install : true,
1846 install_dir : libcryptsetup_plugins_dir)
1847 endif
1848
1849 if conf.get('HAVE_P11KIT') == 1
1850 cryptsetup_token_systemd_pkcs11 = shared_library(
1851 'cryptsetup-token-systemd-pkcs11',
1852 link_args : ['-shared',
1853 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1854 dependencies : libshared_deps + [libcryptsetup, versiondep],
1855 link_with : [libshared],
1856 link_whole : [cryptsetup_token_systemd_pkcs11_static],
1857 link_depends : cryptsetup_token_sym,
1858 install_rpath : rootlibexecdir,
1859 install : true,
1860 install_dir : libcryptsetup_plugins_dir)
1861 endif
1862 endif
1863
1864 ############################################################
1865
1866 # systemd-analyze requires 'libcore'
1867 subdir('src/core')
1868 # systemd-journal-remote requires 'libjournal_core'
1869 subdir('src/journal')
1870 # systemd-networkd requires 'libsystemd_network'
1871 subdir('src/libsystemd-network')
1872
1873 subdir('src/analyze')
1874 subdir('src/busctl')
1875 subdir('src/coredump')
1876 subdir('src/cryptenroll')
1877 subdir('src/cryptsetup')
1878 subdir('src/home')
1879 subdir('src/hostname')
1880 subdir('src/import')
1881 subdir('src/journal-remote')
1882 subdir('src/kernel-install')
1883 subdir('src/locale')
1884 subdir('src/login')
1885 subdir('src/machine')
1886 subdir('src/network')
1887 subdir('src/nspawn')
1888 subdir('src/oom')
1889 subdir('src/partition')
1890 subdir('src/portable')
1891 subdir('src/pstore')
1892 subdir('src/resolve')
1893 subdir('src/rpm')
1894 subdir('src/shutdown')
1895 subdir('src/sysext')
1896 subdir('src/systemctl')
1897 subdir('src/timedate')
1898 subdir('src/timesync')
1899 subdir('src/tmpfiles')
1900 subdir('src/userdb')
1901 subdir('src/vconsole')
1902 subdir('src/xdg-autostart-generator')
1903
1904 subdir('src/systemd')
1905
1906 subdir('src/test')
1907 subdir('src/fuzz')
1908 subdir('rules.d')
1909 subdir('test')
1910
1911 ############################################################
1912
1913 # only static linking apart from libdl, to make sure that the
1914 # module is linked to all libraries that it uses.
1915 test_dlopen = executable(
1916 'test-dlopen',
1917 test_dlopen_c,
1918 disable_mempool_c,
1919 include_directories : includes,
1920 link_with : [libbasic],
1921 dependencies : [libdl],
1922 build_by_default : want_tests != 'false')
1923
1924 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
1925 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
1926 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
1927 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
1928
1929 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1930 if condition
1931 module = tuple[0]
1932
1933 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1934 version_script_arg = project_source_root / sym
1935
1936 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
1937 if tuple.length() > 2
1938 foreach s : tuple[2]
1939 sources += ['src/nss-@0@/@1@'.format(module, s)]
1940 endforeach
1941 endif
1942
1943 incs = tuple.length() > 3 ? tuple[3] : includes
1944
1945 nss = shared_library(
1946 'nss_' + module,
1947 sources,
1948 disable_mempool_c,
1949 version : '2',
1950 include_directories : incs,
1951 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1952 link_args : ['-Wl,-z,nodelete',
1953 '-shared',
1954 '-Wl,--version-script=' + version_script_arg],
1955 link_with : [libsystemd_static,
1956 libshared_static,
1957 libbasic],
1958 dependencies : [threads,
1959 librt],
1960 link_depends : sym,
1961 install : true,
1962 install_dir : rootlibdir)
1963
1964 # We cannot use shared_module because it does not support version suffix.
1965 # Unfortunately shared_library insists on creating the symlink…
1966 meson.add_install_script('sh', '-c',
1967 'rm $DESTDIR@0@/libnss_@1@.so'
1968 .format(rootlibdir, module))
1969
1970 if want_tests != 'false'
1971 test('dlopen-nss_' + module,
1972 test_dlopen,
1973 # path to dlopen must include a slash
1974 args : nss.full_path())
1975 endif
1976 endif
1977 endforeach
1978
1979 ############################################################
1980
1981 executable(
1982 'systemd',
1983 systemd_sources,
1984 include_directories : includes,
1985 link_with : [libcore,
1986 libshared],
1987 dependencies : [versiondep,
1988 threads,
1989 librt,
1990 libseccomp,
1991 libselinux,
1992 libmount,
1993 libblkid],
1994 install_rpath : rootlibexecdir,
1995 install : true,
1996 install_dir : rootlibexecdir)
1997
1998 meson.add_install_script(meson_make_symlink,
1999 rootlibexecdir / 'systemd',
2000 rootsbindir / 'init')
2001
2002 public_programs += executable(
2003 'systemd-analyze',
2004 systemd_analyze_sources,
2005 include_directories : core_includes,
2006 link_with : [libcore,
2007 libshared],
2008 dependencies : [versiondep,
2009 threads,
2010 librt,
2011 libseccomp,
2012 libselinux,
2013 libmount,
2014 libblkid],
2015 install_rpath : rootlibexecdir,
2016 install : conf.get('ENABLE_ANALYZE'))
2017
2018 executable(
2019 'systemd-journald',
2020 systemd_journald_sources,
2021 include_directories : includes,
2022 link_with : [libjournal_core,
2023 libshared],
2024 dependencies : [threads,
2025 libxz,
2026 liblz4,
2027 libselinux,
2028 libzstd],
2029 install_rpath : rootlibexecdir,
2030 install : true,
2031 install_dir : rootlibexecdir)
2032
2033 public_programs += executable(
2034 'systemd-cat',
2035 systemd_cat_sources,
2036 include_directories : includes,
2037 link_with : [libjournal_core,
2038 libshared],
2039 dependencies : [threads],
2040 install_rpath : rootlibexecdir,
2041 install : true)
2042
2043 public_programs += executable(
2044 'journalctl',
2045 journalctl_sources,
2046 include_directories : includes,
2047 link_with : [libshared],
2048 dependencies : [threads,
2049 libdl,
2050 libxz,
2051 liblz4,
2052 libzstd,
2053 libdl],
2054 install_rpath : rootlibexecdir,
2055 install : true,
2056 install_dir : rootbindir)
2057
2058 executable(
2059 'systemd-getty-generator',
2060 'src/getty-generator/getty-generator.c',
2061 include_directories : includes,
2062 link_with : [libshared],
2063 install_rpath : rootlibexecdir,
2064 install : true,
2065 install_dir : systemgeneratordir)
2066
2067 executable(
2068 'systemd-debug-generator',
2069 'src/debug-generator/debug-generator.c',
2070 include_directories : includes,
2071 link_with : [libshared],
2072 install_rpath : rootlibexecdir,
2073 install : true,
2074 install_dir : systemgeneratordir)
2075
2076 executable(
2077 'systemd-run-generator',
2078 'src/run-generator/run-generator.c',
2079 include_directories : includes,
2080 link_with : [libshared],
2081 install_rpath : rootlibexecdir,
2082 install : true,
2083 install_dir : systemgeneratordir)
2084
2085 executable(
2086 'systemd-fstab-generator',
2087 'src/fstab-generator/fstab-generator.c',
2088 include_directories : includes,
2089 link_with : [libshared],
2090 install_rpath : rootlibexecdir,
2091 install : true,
2092 install_dir : systemgeneratordir)
2093
2094 if conf.get('ENABLE_ENVIRONMENT_D') == 1
2095 executable(
2096 '30-systemd-environment-d-generator',
2097 'src/environment-d-generator/environment-d-generator.c',
2098 include_directories : includes,
2099 link_with : [libshared],
2100 install_rpath : rootlibexecdir,
2101 install : true,
2102 install_dir : userenvgeneratordir)
2103
2104 meson.add_install_script(meson_make_symlink,
2105 sysconfdir / 'environment',
2106 environmentdir / '99-environment.conf')
2107 endif
2108
2109 if conf.get('ENABLE_HIBERNATE') == 1
2110 executable(
2111 'systemd-hibernate-resume-generator',
2112 'src/hibernate-resume/hibernate-resume-generator.c',
2113 include_directories : includes,
2114 link_with : [libshared],
2115 install_rpath : rootlibexecdir,
2116 install : true,
2117 install_dir : systemgeneratordir)
2118
2119 executable(
2120 'systemd-hibernate-resume',
2121 'src/hibernate-resume/hibernate-resume.c',
2122 include_directories : includes,
2123 link_with : [libshared],
2124 install_rpath : rootlibexecdir,
2125 install : true,
2126 install_dir : rootlibexecdir)
2127 endif
2128
2129 if conf.get('HAVE_BLKID') == 1
2130 executable(
2131 'systemd-gpt-auto-generator',
2132 'src/gpt-auto-generator/gpt-auto-generator.c',
2133 include_directories : includes,
2134 link_with : [libshared],
2135 dependencies : libblkid,
2136 install_rpath : rootlibexecdir,
2137 install : true,
2138 install_dir : systemgeneratordir)
2139
2140 public_programs += executable(
2141 'systemd-dissect',
2142 'src/dissect/dissect.c',
2143 include_directories : includes,
2144 link_with : [libshared],
2145 install_rpath : rootlibexecdir,
2146 install : true)
2147 endif
2148
2149 if conf.get('ENABLE_RESOLVE') == 1
2150 executable(
2151 'systemd-resolved',
2152 systemd_resolved_sources,
2153 include_directories : resolve_includes,
2154 link_with : [libshared,
2155 libbasic_gcrypt,
2156 libsystemd_resolve_core],
2157 dependencies : systemd_resolved_dependencies,
2158 install_rpath : rootlibexecdir,
2159 install : true,
2160 install_dir : rootlibexecdir)
2161
2162 public_programs += executable(
2163 'resolvectl',
2164 resolvectl_sources,
2165 include_directories : includes,
2166 link_with : [libshared,
2167 libbasic_gcrypt,
2168 libsystemd_resolve_core],
2169 dependencies : [threads,
2170 lib_openssl_or_gcrypt,
2171 libgpg_error,
2172 libm,
2173 libidn],
2174 install_rpath : rootlibexecdir,
2175 install : true)
2176
2177 meson.add_install_script(meson_make_symlink,
2178 bindir / 'resolvectl',
2179 rootsbindir / 'resolvconf')
2180
2181 meson.add_install_script(meson_make_symlink,
2182 bindir / 'resolvectl',
2183 bindir / 'systemd-resolve')
2184 endif
2185
2186 if conf.get('ENABLE_LOGIND') == 1
2187 executable(
2188 'systemd-logind',
2189 systemd_logind_sources,
2190 include_directories : includes,
2191 link_with : [liblogind_core,
2192 libshared],
2193 dependencies : [threads,
2194 libacl],
2195 install_rpath : rootlibexecdir,
2196 install : true,
2197 install_dir : rootlibexecdir)
2198
2199 public_programs += executable(
2200 'loginctl',
2201 loginctl_sources,
2202 include_directories : includes,
2203 link_with : [libshared],
2204 dependencies : [threads,
2205 liblz4,
2206 libxz,
2207 libzstd],
2208 install_rpath : rootlibexecdir,
2209 install : true,
2210 install_dir : rootbindir)
2211
2212 public_programs += executable(
2213 'systemd-inhibit',
2214 'src/login/inhibit.c',
2215 include_directories : includes,
2216 link_with : [libshared],
2217 install_rpath : rootlibexecdir,
2218 install : true,
2219 install_dir : rootbindir)
2220
2221 if conf.get('HAVE_PAM') == 1
2222 version_script_arg = project_source_root / pam_systemd_sym
2223 pam_systemd = shared_library(
2224 'pam_systemd',
2225 pam_systemd_c,
2226 name_prefix : '',
2227 include_directories : includes,
2228 link_args : ['-shared',
2229 '-Wl,--version-script=' + version_script_arg],
2230 link_with : [libsystemd_static,
2231 libshared_static],
2232 dependencies : [threads,
2233 libpam,
2234 libpam_misc],
2235 link_depends : pam_systemd_sym,
2236 install : true,
2237 install_dir : pamlibdir)
2238
2239 if want_tests != 'false'
2240 test('dlopen-pam_systemd',
2241 test_dlopen,
2242 # path to dlopen must include a slash
2243 args : pam_systemd.full_path())
2244 endif
2245 endif
2246
2247 executable(
2248 'systemd-user-runtime-dir',
2249 user_runtime_dir_sources,
2250 include_directories : includes,
2251 link_with : [libshared],
2252 install_rpath : rootlibexecdir,
2253 install : true,
2254 install_dir : rootlibexecdir)
2255 endif
2256
2257 if conf.get('HAVE_PAM') == 1
2258 executable(
2259 'systemd-user-sessions',
2260 'src/user-sessions/user-sessions.c',
2261 include_directories : includes,
2262 link_with : [libshared],
2263 install_rpath : rootlibexecdir,
2264 install : true,
2265 install_dir : rootlibexecdir)
2266 endif
2267
2268 if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
2269 public_programs += executable(
2270 'bootctl',
2271 'src/boot/bootctl.c',
2272 include_directories : includes,
2273 link_with : [libshared],
2274 dependencies : [libblkid],
2275 install_rpath : rootlibexecdir,
2276 install : true)
2277
2278 public_programs += executable(
2279 'systemd-bless-boot',
2280 'src/boot/bless-boot.c',
2281 include_directories : includes,
2282 link_with : [libshared],
2283 dependencies : [libblkid],
2284 install_rpath : rootlibexecdir,
2285 install : true,
2286 install_dir : rootlibexecdir)
2287
2288 executable(
2289 'systemd-bless-boot-generator',
2290 'src/boot/bless-boot-generator.c',
2291 include_directories : includes,
2292 link_with : [libshared],
2293 install_rpath : rootlibexecdir,
2294 install : true,
2295 install_dir : systemgeneratordir)
2296 endif
2297
2298 executable(
2299 'systemd-boot-check-no-failures',
2300 'src/boot/boot-check-no-failures.c',
2301 include_directories : includes,
2302 link_with : [libshared],
2303 dependencies : [libblkid],
2304 install_rpath : rootlibexecdir,
2305 install : true,
2306 install_dir : rootlibexecdir)
2307
2308 public_programs += executable(
2309 'systemd-socket-activate',
2310 'src/activate/activate.c',
2311 include_directories : includes,
2312 link_with : [libshared],
2313 dependencies : [threads],
2314 install_rpath : rootlibexecdir,
2315 install : true)
2316
2317 public_programs += executable(
2318 'systemctl',
2319 systemctl_sources,
2320 include_directories : includes,
2321 link_with : systemctl_link_with,
2322 dependencies : [threads,
2323 libcap,
2324 libselinux,
2325 libxz,
2326 liblz4,
2327 libzstd],
2328 install_rpath : rootlibexecdir,
2329 install : true,
2330 install_dir : rootbindir)
2331
2332 if conf.get('ENABLE_PORTABLED') == 1
2333 executable(
2334 'systemd-portabled',
2335 systemd_portabled_sources,
2336 include_directories : includes,
2337 link_with : [libshared],
2338 dependencies : [threads, libselinux],
2339 install_rpath : rootlibexecdir,
2340 install : true,
2341 install_dir : rootlibexecdir)
2342
2343 public_programs += executable(
2344 'portablectl',
2345 'src/portable/portablectl.c',
2346 include_directories : includes,
2347 link_with : [libshared],
2348 dependencies : [threads],
2349 install_rpath : rootlibexecdir,
2350 install : true,
2351 install_dir : rootbindir)
2352 endif
2353
2354 if conf.get('ENABLE_SYSEXT') == 1
2355 public_programs += executable(
2356 'systemd-sysext',
2357 systemd_sysext_sources,
2358 include_directories : includes,
2359 link_with : [libshared],
2360 install_rpath : rootlibexecdir,
2361 install : true,
2362 install_dir : rootbindir)
2363 endif
2364
2365 if conf.get('ENABLE_USERDB') == 1
2366 executable(
2367 'systemd-userwork',
2368 systemd_userwork_sources,
2369 include_directories : includes,
2370 link_with : [libshared],
2371 dependencies : [threads],
2372 install_rpath : rootlibexecdir,
2373 install : true,
2374 install_dir : rootlibexecdir)
2375
2376 executable(
2377 'systemd-userdbd',
2378 systemd_userdbd_sources,
2379 include_directories : includes,
2380 link_with : [libshared],
2381 dependencies : [threads],
2382 install_rpath : rootlibexecdir,
2383 install : true,
2384 install_dir : rootlibexecdir)
2385
2386 public_programs += executable(
2387 'userdbctl',
2388 userdbctl_sources,
2389 include_directories : includes,
2390 link_with : [libshared],
2391 dependencies : [threads],
2392 install_rpath : rootlibexecdir,
2393 install : true,
2394 install_dir : rootbindir)
2395 endif
2396
2397 if conf.get('ENABLE_HOMED') == 1
2398 executable(
2399 'systemd-homework',
2400 systemd_homework_sources,
2401 include_directories : includes,
2402 link_with : [libshared],
2403 dependencies : [threads,
2404 libblkid,
2405 libcrypt,
2406 libopenssl,
2407 libfdisk,
2408 libp11kit],
2409 install_rpath : rootlibexecdir,
2410 install : true,
2411 install_dir : rootlibexecdir)
2412
2413 executable(
2414 'systemd-homed',
2415 systemd_homed_sources,
2416 include_directories : home_includes,
2417 link_with : [libshared],
2418 dependencies : [threads,
2419 libcrypt,
2420 libopenssl,
2421 libm],
2422 install_rpath : rootlibexecdir,
2423 install : true,
2424 install_dir : rootlibexecdir)
2425
2426 public_programs += executable(
2427 'homectl',
2428 homectl_sources,
2429 include_directories : includes,
2430 link_with : [libshared],
2431 dependencies : [threads,
2432 libcrypt,
2433 libopenssl,
2434 libp11kit,
2435 libdl],
2436 install_rpath : rootlibexecdir,
2437 install : true,
2438 install_dir : rootbindir)
2439
2440 if conf.get('HAVE_PAM') == 1
2441 version_script_arg = project_source_root / pam_systemd_home_sym
2442 pam_systemd = shared_library(
2443 'pam_systemd_home',
2444 pam_systemd_home_c,
2445 name_prefix : '',
2446 include_directories : includes,
2447 link_args : ['-shared',
2448 '-Wl,--version-script=' + version_script_arg],
2449 link_with : [libsystemd_static,
2450 libshared_static],
2451 dependencies : [threads,
2452 libpam,
2453 libpam_misc,
2454 libcrypt],
2455 link_depends : pam_systemd_home_sym,
2456 install : true,
2457 install_dir : pamlibdir)
2458 endif
2459 endif
2460
2461 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2462 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2463 meson.add_install_script(meson_make_symlink,
2464 rootbindir / 'systemctl',
2465 rootsbindir / alias)
2466 endforeach
2467
2468 meson.add_install_script(meson_make_symlink,
2469 rootbindir / 'udevadm',
2470 rootlibexecdir / 'systemd-udevd')
2471
2472 if conf.get('ENABLE_BACKLIGHT') == 1
2473 executable(
2474 'systemd-backlight',
2475 'src/backlight/backlight.c',
2476 include_directories : includes,
2477 link_with : [libshared],
2478 install_rpath : rootlibexecdir,
2479 install : true,
2480 install_dir : rootlibexecdir)
2481 endif
2482
2483 if conf.get('ENABLE_RFKILL') == 1
2484 executable(
2485 'systemd-rfkill',
2486 'src/rfkill/rfkill.c',
2487 include_directories : includes,
2488 link_with : [libshared],
2489 install_rpath : rootlibexecdir,
2490 install : true,
2491 install_dir : rootlibexecdir)
2492 endif
2493
2494 executable(
2495 'systemd-system-update-generator',
2496 'src/system-update-generator/system-update-generator.c',
2497 include_directories : includes,
2498 link_with : [libshared],
2499 install_rpath : rootlibexecdir,
2500 install : true,
2501 install_dir : systemgeneratordir)
2502
2503 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2504 executable(
2505 'systemd-cryptsetup',
2506 systemd_cryptsetup_sources,
2507 include_directories : includes,
2508 link_with : [libshared],
2509 dependencies : [libcryptsetup,
2510 libp11kit],
2511 install_rpath : rootlibexecdir,
2512 install : true,
2513 install_dir : rootlibexecdir)
2514
2515 executable(
2516 'systemd-cryptsetup-generator',
2517 'src/cryptsetup/cryptsetup-generator.c',
2518 include_directories : includes,
2519 link_with : [libshared],
2520 install_rpath : rootlibexecdir,
2521 install : true,
2522 install_dir : systemgeneratordir)
2523
2524 executable(
2525 'systemd-veritysetup',
2526 'src/veritysetup/veritysetup.c',
2527 include_directories : includes,
2528 link_with : [libshared],
2529 dependencies : [libcryptsetup],
2530 install_rpath : rootlibexecdir,
2531 install : true,
2532 install_dir : rootlibexecdir)
2533
2534 executable(
2535 'systemd-veritysetup-generator',
2536 'src/veritysetup/veritysetup-generator.c',
2537 include_directories : includes,
2538 link_with : [libshared],
2539 install_rpath : rootlibexecdir,
2540 install : true,
2541 install_dir : systemgeneratordir)
2542
2543 executable(
2544 'systemd-cryptenroll',
2545 systemd_cryptenroll_sources,
2546 include_directories : includes,
2547 link_with : [libshared],
2548 dependencies : [libcryptsetup,
2549 libdl,
2550 libopenssl,
2551 libp11kit],
2552 install_rpath : rootlibexecdir,
2553 install : true)
2554
2555 executable(
2556 'systemd-integritysetup',
2557 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
2558 include_directories : includes,
2559 link_with : [libshared],
2560 dependencies : [libcryptsetup],
2561 install_rpath : rootlibexecdir,
2562 install : true,
2563 install_dir : rootlibexecdir)
2564
2565 executable(
2566 'systemd-integritysetup-generator',
2567 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
2568 include_directories : includes,
2569 link_with : [libshared],
2570 install_rpath : rootlibexecdir,
2571 install : true,
2572 install_dir : systemgeneratordir)
2573 endif
2574
2575 if conf.get('HAVE_SYSV_COMPAT') == 1
2576 executable(
2577 'systemd-sysv-generator',
2578 'src/sysv-generator/sysv-generator.c',
2579 include_directories : includes,
2580 link_with : [libshared],
2581 install_rpath : rootlibexecdir,
2582 install : true,
2583 install_dir : systemgeneratordir)
2584
2585 executable(
2586 'systemd-rc-local-generator',
2587 'src/rc-local-generator/rc-local-generator.c',
2588 include_directories : includes,
2589 link_with : [libshared],
2590 install_rpath : rootlibexecdir,
2591 install : true,
2592 install_dir : systemgeneratordir)
2593 endif
2594
2595 if conf.get('ENABLE_XDG_AUTOSTART') == 1
2596 executable(
2597 'systemd-xdg-autostart-generator',
2598 systemd_xdg_autostart_generator_sources,
2599 include_directories : includes,
2600 link_with : [libshared],
2601 install_rpath : rootlibexecdir,
2602 install : true,
2603 install_dir : usergeneratordir)
2604
2605 executable(
2606 'systemd-xdg-autostart-condition',
2607 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2608 include_directories : includes,
2609 link_with : [libshared],
2610 install_rpath : rootlibexecdir,
2611 install : true,
2612 install_dir : rootlibexecdir)
2613 endif
2614
2615 if conf.get('ENABLE_HOSTNAMED') == 1
2616 executable(
2617 'systemd-hostnamed',
2618 'src/hostname/hostnamed.c',
2619 include_directories : includes,
2620 link_with : [libshared],
2621 install_rpath : rootlibexecdir,
2622 install : true,
2623 install_dir : rootlibexecdir)
2624
2625 public_programs += executable(
2626 'hostnamectl',
2627 'src/hostname/hostnamectl.c',
2628 include_directories : includes,
2629 link_with : [libshared],
2630 install_rpath : rootlibexecdir,
2631 install : true)
2632 endif
2633
2634 if conf.get('ENABLE_LOCALED') == 1
2635 if conf.get('HAVE_XKBCOMMON') == 1
2636 # logind will load libxkbcommon.so dynamically on its own, but we still
2637 # need to specify where the headers are
2638 deps = [libdl, libxkbcommon.partial_dependency(compile_args: true)]
2639 else
2640 deps = []
2641 endif
2642
2643 executable(
2644 'systemd-localed',
2645 systemd_localed_sources,
2646 include_directories : includes,
2647 link_with : [libshared],
2648 dependencies : deps,
2649 install_rpath : rootlibexecdir,
2650 install : true,
2651 install_dir : rootlibexecdir)
2652
2653 public_programs += executable(
2654 'localectl',
2655 localectl_sources,
2656 include_directories : includes,
2657 link_with : [libshared],
2658 install_rpath : rootlibexecdir,
2659 install : true)
2660 endif
2661
2662 if conf.get('ENABLE_TIMEDATED') == 1
2663 executable(
2664 'systemd-timedated',
2665 'src/timedate/timedated.c',
2666 include_directories : includes,
2667 link_with : [libshared],
2668 install_rpath : rootlibexecdir,
2669 install : true,
2670 install_dir : rootlibexecdir)
2671 endif
2672
2673 if conf.get('ENABLE_TIMEDATECTL') == 1
2674 public_programs += executable(
2675 'timedatectl',
2676 'src/timedate/timedatectl.c',
2677 include_directories : includes,
2678 install_rpath : rootlibexecdir,
2679 link_with : [libshared],
2680 dependencies : [libm],
2681 install : true)
2682 endif
2683
2684 if conf.get('ENABLE_TIMESYNCD') == 1
2685 executable(
2686 'systemd-timesyncd',
2687 systemd_timesyncd_sources,
2688 include_directories : includes,
2689 link_with : [libtimesyncd_core],
2690 dependencies : [threads,
2691 libm],
2692 install_rpath : rootlibexecdir,
2693 install : true,
2694 install_dir : rootlibexecdir)
2695
2696 executable(
2697 'systemd-time-wait-sync',
2698 'src/timesync/wait-sync.c',
2699 include_directories : includes,
2700 link_with : [libtimesyncd_core],
2701 install_rpath : rootlibexecdir,
2702 install : true,
2703 install_dir : rootlibexecdir)
2704 endif
2705
2706 if conf.get('ENABLE_MACHINED') == 1
2707 executable(
2708 'systemd-machined',
2709 systemd_machined_sources,
2710 include_directories : includes,
2711 link_with : [libmachine_core,
2712 libshared],
2713 install_rpath : rootlibexecdir,
2714 install : true,
2715 install_dir : rootlibexecdir)
2716
2717 public_programs += executable(
2718 'machinectl',
2719 'src/machine/machinectl.c',
2720 include_directories : includes,
2721 link_with : [libshared],
2722 dependencies : [threads,
2723 libxz,
2724 liblz4,
2725 libzstd],
2726 install_rpath : rootlibexecdir,
2727 install : true,
2728 install_dir : rootbindir)
2729 endif
2730
2731 if conf.get('ENABLE_IMPORTD') == 1
2732 executable(
2733 'systemd-importd',
2734 systemd_importd_sources,
2735 include_directories : includes,
2736 link_with : [libshared],
2737 dependencies : [threads],
2738 install_rpath : rootlibexecdir,
2739 install : true,
2740 install_dir : rootlibexecdir)
2741
2742 systemd_pull = executable(
2743 'systemd-pull',
2744 systemd_pull_sources,
2745 include_directories : includes,
2746 link_with : [libshared],
2747 dependencies : [versiondep,
2748 libcurl,
2749 lib_openssl_or_gcrypt,
2750 libz,
2751 libbzip2,
2752 libxz],
2753 install_rpath : rootlibexecdir,
2754 install : true,
2755 install_dir : rootlibexecdir)
2756
2757 systemd_import = executable(
2758 'systemd-import',
2759 systemd_import_sources,
2760 include_directories : includes,
2761 link_with : [libshared],
2762 dependencies : [libcurl,
2763 libz,
2764 libbzip2,
2765 libxz],
2766 install_rpath : rootlibexecdir,
2767 install : true,
2768 install_dir : rootlibexecdir)
2769
2770 systemd_import_fs = executable(
2771 'systemd-import-fs',
2772 systemd_import_fs_sources,
2773 include_directories : includes,
2774 link_with : [libshared],
2775 install_rpath : rootlibexecdir,
2776 install : true,
2777 install_dir : rootlibexecdir)
2778
2779 systemd_export = executable(
2780 'systemd-export',
2781 systemd_export_sources,
2782 include_directories : includes,
2783 link_with : [libshared],
2784 dependencies : [libcurl,
2785 libz,
2786 libbzip2,
2787 libxz],
2788 install_rpath : rootlibexecdir,
2789 install : true,
2790 install_dir : rootlibexecdir)
2791
2792 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2793 endif
2794
2795 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2796 public_programs += executable(
2797 'systemd-journal-upload',
2798 systemd_journal_upload_sources,
2799 include_directories : includes,
2800 link_with : [libshared],
2801 dependencies : [versiondep,
2802 threads,
2803 libcurl,
2804 libgnutls,
2805 libxz,
2806 liblz4,
2807 libzstd],
2808 install_rpath : rootlibexecdir,
2809 install : true,
2810 install_dir : rootlibexecdir)
2811 endif
2812
2813 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2814 public_programs += executable(
2815 'systemd-journal-remote',
2816 systemd_journal_remote_sources,
2817 include_directories : includes,
2818 link_with : [libshared,
2819 libsystemd_journal_remote],
2820 dependencies : [threads,
2821 libmicrohttpd,
2822 libgnutls,
2823 libxz,
2824 liblz4,
2825 libzstd],
2826 install_rpath : rootlibexecdir,
2827 install : true,
2828 install_dir : rootlibexecdir)
2829
2830 public_programs += executable(
2831 'systemd-journal-gatewayd',
2832 systemd_journal_gatewayd_sources,
2833 include_directories : includes,
2834 link_with : [libshared],
2835 dependencies : [threads,
2836 libmicrohttpd,
2837 libgnutls,
2838 libxz,
2839 liblz4,
2840 libzstd],
2841 install_rpath : rootlibexecdir,
2842 install : true,
2843 install_dir : rootlibexecdir)
2844 endif
2845
2846 if conf.get('ENABLE_COREDUMP') == 1
2847 executable(
2848 'systemd-coredump',
2849 systemd_coredump_sources,
2850 include_directories : includes,
2851 link_with : [libshared],
2852 dependencies : [threads,
2853 libacl,
2854 libxz,
2855 liblz4,
2856 libzstd],
2857 install_rpath : rootlibexecdir,
2858 install : true,
2859 install_dir : rootlibexecdir)
2860
2861 public_programs += executable(
2862 'coredumpctl',
2863 coredumpctl_sources,
2864 include_directories : includes,
2865 link_with : [libshared],
2866 dependencies : [threads,
2867 libxz,
2868 liblz4,
2869 libzstd],
2870 install_rpath : rootlibexecdir,
2871 install : true)
2872 endif
2873
2874 if conf.get('ENABLE_PSTORE') == 1
2875 executable(
2876 'systemd-pstore',
2877 systemd_pstore_sources,
2878 include_directories : includes,
2879 link_with : [libshared],
2880 dependencies : [threads,
2881 libacl,
2882 libxz,
2883 liblz4,
2884 libzstd],
2885 install_rpath : rootlibexecdir,
2886 install : true,
2887 install_dir : rootlibexecdir)
2888 endif
2889
2890 if conf.get('ENABLE_OOMD') == 1
2891 executable('systemd-oomd',
2892 systemd_oomd_sources,
2893 include_directories : includes,
2894 link_with : [libshared],
2895 dependencies : [],
2896 install_rpath : rootlibexecdir,
2897 install : true,
2898 install_dir : rootlibexecdir)
2899
2900 public_programs += executable(
2901 'oomctl',
2902 oomctl_sources,
2903 include_directories : includes,
2904 link_with : [libshared],
2905 dependencies : [],
2906 install_rpath : rootlibexecdir,
2907 install : true,
2908 install_dir : rootbindir)
2909 endif
2910
2911 if conf.get('ENABLE_BINFMT') == 1
2912 public_programs += executable(
2913 'systemd-binfmt',
2914 'src/binfmt/binfmt.c',
2915 include_directories : includes,
2916 link_with : [libshared],
2917 install_rpath : rootlibexecdir,
2918 install : true,
2919 install_dir : rootlibexecdir)
2920
2921 meson.add_install_script('sh', '-c',
2922 mkdir_p.format(binfmtdir))
2923 if install_sysconfdir
2924 meson.add_install_script('sh', '-c',
2925 mkdir_p.format(sysconfdir / 'binfmt.d'))
2926 endif
2927 endif
2928
2929 if conf.get('ENABLE_REPART') == 1
2930 exe = executable(
2931 'systemd-repart',
2932 systemd_repart_sources,
2933 include_directories : includes,
2934 link_with : [libshared],
2935 dependencies : [threads,
2936 libblkid,
2937 libfdisk],
2938 install_rpath : rootlibexecdir,
2939 install : true,
2940 install_dir : rootbindir)
2941 public_programs += exe
2942
2943 if want_tests != 'false'
2944 test('test-repart',
2945 test_repart_sh,
2946 args : exe.full_path())
2947 endif
2948 endif
2949
2950 if conf.get('ENABLE_VCONSOLE') == 1
2951 executable(
2952 'systemd-vconsole-setup',
2953 'src/vconsole/vconsole-setup.c',
2954 include_directories : includes,
2955 link_with : [libshared],
2956 install_rpath : rootlibexecdir,
2957 install : true,
2958 install_dir : rootlibexecdir)
2959 endif
2960
2961 if conf.get('ENABLE_RANDOMSEED') == 1
2962 executable(
2963 'systemd-random-seed',
2964 'src/random-seed/random-seed.c',
2965 include_directories : includes,
2966 link_with : [libshared],
2967 install_rpath : rootlibexecdir,
2968 install : true,
2969 install_dir : rootlibexecdir)
2970 endif
2971
2972 if conf.get('ENABLE_FIRSTBOOT') == 1
2973 executable(
2974 'systemd-firstboot',
2975 'src/firstboot/firstboot.c',
2976 include_directories : includes,
2977 link_with : [libshared],
2978 dependencies : [libcrypt],
2979 install_rpath : rootlibexecdir,
2980 install : true,
2981 install_dir : rootbindir)
2982 endif
2983
2984 executable(
2985 'systemd-remount-fs',
2986 'src/remount-fs/remount-fs.c',
2987 include_directories : includes,
2988 link_with : [libshared],
2989 install_rpath : rootlibexecdir,
2990 install : true,
2991 install_dir : rootlibexecdir)
2992
2993 executable(
2994 'systemd-machine-id-setup',
2995 'src/machine-id-setup/machine-id-setup-main.c',
2996 include_directories : includes,
2997 link_with : [libshared],
2998 install_rpath : rootlibexecdir,
2999 install : true,
3000 install_dir : rootbindir)
3001
3002 executable(
3003 'systemd-fsck',
3004 'src/fsck/fsck.c',
3005 include_directories : includes,
3006 link_with : [libshared],
3007 install_rpath : rootlibexecdir,
3008 install : true,
3009 install_dir : rootlibexecdir)
3010
3011 executable('systemd-growfs',
3012 'src/partition/growfs.c',
3013 include_directories : includes,
3014 link_with : [libshared],
3015 install_rpath : rootlibexecdir,
3016 install : true,
3017 install_dir : rootlibexecdir)
3018
3019 executable(
3020 'systemd-makefs',
3021 'src/partition/makefs.c',
3022 include_directories : includes,
3023 link_with : [libshared],
3024 install_rpath : rootlibexecdir,
3025 install : true,
3026 install_dir : rootlibexecdir)
3027
3028 executable(
3029 'systemd-sleep',
3030 'src/sleep/sleep.c',
3031 include_directories : includes,
3032 link_with : [libshared],
3033 install_rpath : rootlibexecdir,
3034 install : true,
3035 install_dir : rootlibexecdir)
3036
3037 if install_sysconfdir_samples
3038 install_data('src/sleep/sleep.conf',
3039 install_dir : pkgsysconfdir)
3040 endif
3041
3042 public_programs += executable(
3043 'systemd-sysctl',
3044 'src/sysctl/sysctl.c',
3045 include_directories : includes,
3046 link_with : [libshared],
3047 install_rpath : rootlibexecdir,
3048 install : true,
3049 install_dir : rootlibexecdir)
3050
3051 executable(
3052 'systemd-ac-power',
3053 'src/ac-power/ac-power.c',
3054 include_directories : includes,
3055 link_with : [libshared],
3056 install_rpath : rootlibexecdir,
3057 install : true,
3058 install_dir : rootlibexecdir)
3059
3060 public_programs += executable(
3061 'systemd-detect-virt',
3062 'src/detect-virt/detect-virt.c',
3063 include_directories : includes,
3064 link_with : [libshared],
3065 install_rpath : rootlibexecdir,
3066 install : true)
3067
3068 public_programs += executable(
3069 'systemd-delta',
3070 'src/delta/delta.c',
3071 include_directories : includes,
3072 link_with : [libshared],
3073 install_rpath : rootlibexecdir,
3074 install : true)
3075
3076 public_programs += executable(
3077 'systemd-escape',
3078 'src/escape/escape.c',
3079 include_directories : includes,
3080 link_with : [libshared],
3081 install_rpath : rootlibexecdir,
3082 install : true,
3083 install_dir : rootbindir)
3084
3085 public_programs += executable(
3086 'systemd-notify',
3087 'src/notify/notify.c',
3088 include_directories : includes,
3089 link_with : [libshared],
3090 install_rpath : rootlibexecdir,
3091 install : true,
3092 install_dir : rootbindir)
3093
3094 public_programs += executable(
3095 'systemd-creds',
3096 'src/creds/creds.c',
3097 include_directories : includes,
3098 link_with : [libshared],
3099 dependencies : [threads,
3100 libopenssl],
3101 install_rpath : rootlibexecdir,
3102 install : true,
3103 install_dir : rootbindir)
3104
3105 executable(
3106 'systemd-volatile-root',
3107 'src/volatile-root/volatile-root.c',
3108 include_directories : includes,
3109 link_with : [libshared],
3110 install_rpath : rootlibexecdir,
3111 install : conf.get('ENABLE_INITRD') == 1,
3112 install_dir : rootlibexecdir)
3113
3114 executable(
3115 'systemd-cgroups-agent',
3116 'src/cgroups-agent/cgroups-agent.c',
3117 include_directories : includes,
3118 link_with : [libshared],
3119 install_rpath : rootlibexecdir,
3120 install : true,
3121 install_dir : rootlibexecdir)
3122
3123 public_programs += executable(
3124 'systemd-id128',
3125 'src/id128/id128.c',
3126 include_directories : includes,
3127 link_with : [libshared],
3128 install_rpath : rootlibexecdir,
3129 install : true)
3130
3131 public_programs += executable(
3132 'systemd-path',
3133 'src/path/path.c',
3134 include_directories : includes,
3135 link_with : [libshared],
3136 install_rpath : rootlibexecdir,
3137 install : true)
3138
3139 public_programs += executable(
3140 'systemd-ask-password',
3141 'src/ask-password/ask-password.c',
3142 include_directories : includes,
3143 link_with : [libshared],
3144 install_rpath : rootlibexecdir,
3145 install : true,
3146 install_dir : rootbindir)
3147
3148 executable(
3149 'systemd-reply-password',
3150 'src/reply-password/reply-password.c',
3151 include_directories : includes,
3152 link_with : [libshared],
3153 install_rpath : rootlibexecdir,
3154 install : true,
3155 install_dir : rootlibexecdir)
3156
3157 public_programs += executable(
3158 'systemd-tty-ask-password-agent',
3159 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3160 include_directories : includes,
3161 link_with : [libshared],
3162 install_rpath : rootlibexecdir,
3163 install : true,
3164 install_dir : rootbindir)
3165
3166 public_programs += executable(
3167 'systemd-cgls',
3168 'src/cgls/cgls.c',
3169 include_directories : includes,
3170 link_with : [libshared],
3171 install_rpath : rootlibexecdir,
3172 install : true)
3173
3174 public_programs += executable(
3175 'systemd-cgtop',
3176 'src/cgtop/cgtop.c',
3177 include_directories : includes,
3178 link_with : [libshared],
3179 install_rpath : rootlibexecdir,
3180 install : true)
3181
3182 executable(
3183 'systemd-initctl',
3184 'src/initctl/initctl.c',
3185 include_directories : includes,
3186 link_with : [libshared],
3187 install_rpath : rootlibexecdir,
3188 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3189 install_dir : rootlibexecdir)
3190
3191 public_programs += executable(
3192 'systemd-mount',
3193 'src/mount/mount-tool.c',
3194 include_directories : includes,
3195 link_with : [libshared],
3196 dependencies: [libmount],
3197 install_rpath : rootlibexecdir,
3198 install : true)
3199
3200 meson.add_install_script(meson_make_symlink,
3201 'systemd-mount', bindir / 'systemd-umount')
3202
3203 public_programs += executable(
3204 'systemd-run',
3205 'src/run/run.c',
3206 include_directories : includes,
3207 link_with : [libshared],
3208 install_rpath : rootlibexecdir,
3209 install : true)
3210
3211 public_programs += executable(
3212 'systemd-stdio-bridge',
3213 'src/stdio-bridge/stdio-bridge.c',
3214 include_directories : includes,
3215 link_with : [libshared],
3216 dependencies : [versiondep],
3217 install_rpath : rootlibexecdir,
3218 install : true)
3219
3220 public_programs += executable(
3221 'busctl',
3222 busctl_sources,
3223 include_directories : includes,
3224 link_with : [libshared],
3225 install_rpath : rootlibexecdir,
3226 install : true)
3227
3228 if enable_sysusers
3229 exe = executable(
3230 'systemd-sysusers',
3231 'src/sysusers/sysusers.c',
3232 include_directories : includes,
3233 link_with : [libshared],
3234 install_rpath : rootlibexecdir,
3235 install : true,
3236 install_dir : rootbindir)
3237 public_programs += exe
3238
3239 if want_tests != 'false'
3240 test('test-sysusers',
3241 test_sysusers_sh,
3242 # https://github.com/mesonbuild/meson/issues/2681
3243 args : exe.full_path())
3244 endif
3245
3246 if have_standalone_binaries
3247 exe = executable(
3248 'systemd-sysusers.standalone',
3249 'src/sysusers/sysusers.c',
3250 include_directories : includes,
3251 c_args : '-DSTANDALONE',
3252 link_with : [libshared_static,
3253 libbasic,
3254 libbasic_gcrypt,
3255 libsystemd_static],
3256 install : true,
3257 install_dir : rootbindir)
3258 public_programs += exe
3259
3260 if want_tests != 'false'
3261 test('test-sysusers.standalone',
3262 test_sysusers_sh,
3263 # https://github.com/mesonbuild/meson/issues/2681
3264 args : exe.full_path())
3265 endif
3266 endif
3267 endif
3268
3269 if conf.get('ENABLE_TMPFILES') == 1
3270 exe = executable(
3271 'systemd-tmpfiles',
3272 systemd_tmpfiles_sources,
3273 include_directories : includes,
3274 link_with : [libshared],
3275 dependencies : [libacl],
3276 install_rpath : rootlibexecdir,
3277 install : true,
3278 install_dir : rootbindir)
3279 public_programs += exe
3280
3281 if want_tests != 'false'
3282 test('test-systemd-tmpfiles',
3283 test_systemd_tmpfiles_py,
3284 # https://github.com/mesonbuild/meson/issues/2681
3285 args : exe.full_path())
3286 endif
3287
3288 if have_standalone_binaries
3289 public_programs += executable(
3290 'systemd-tmpfiles.standalone',
3291 systemd_tmpfiles_sources,
3292 include_directories : includes,
3293 c_args : '-DSTANDALONE',
3294 link_with : [libshared_static,
3295 libbasic,
3296 libbasic_gcrypt,
3297 libsystemd_static],
3298 dependencies : [libacl],
3299 install : true,
3300 install_dir : rootbindir)
3301 endif
3302 endif
3303
3304 if conf.get('ENABLE_HWDB') == 1
3305 systemd_hwdb = executable(
3306 'systemd-hwdb',
3307 'src/hwdb/hwdb.c',
3308 include_directories : includes,
3309 link_with : udev_link_with,
3310 install_rpath : udev_rpath,
3311 install : true,
3312 install_dir : rootbindir)
3313 public_programs += systemd_hwdb
3314
3315 if want_tests != 'false'
3316 test('hwdb-test',
3317 hwdb_test_sh,
3318 args : [systemd_hwdb.full_path()],
3319 timeout : 90)
3320 endif
3321 endif
3322
3323 if conf.get('ENABLE_QUOTACHECK') == 1
3324 executable(
3325 'systemd-quotacheck',
3326 'src/quotacheck/quotacheck.c',
3327 include_directories : includes,
3328 link_with : [libshared],
3329 install_rpath : rootlibexecdir,
3330 install : true,
3331 install_dir : rootlibexecdir)
3332 endif
3333
3334 public_programs += executable(
3335 'systemd-socket-proxyd',
3336 'src/socket-proxy/socket-proxyd.c',
3337 include_directories : includes,
3338 link_with : [libshared],
3339 dependencies : [threads],
3340 install_rpath : rootlibexecdir,
3341 install : true,
3342 install_dir : rootlibexecdir)
3343
3344 public_programs += executable(
3345 'udevadm',
3346 udevadm_sources,
3347 include_directories : includes,
3348 link_with : [libudevd_core],
3349 dependencies : [versiondep,
3350 threads,
3351 libkmod,
3352 libidn,
3353 libacl,
3354 libblkid],
3355 install_rpath : udev_rpath,
3356 install : true,
3357 install_dir : rootbindir)
3358
3359 executable(
3360 'systemd-shutdown',
3361 systemd_shutdown_sources,
3362 include_directories : includes,
3363 link_with : [libshared],
3364 dependencies : [libmount],
3365 install_rpath : rootlibexecdir,
3366 install : true,
3367 install_dir : rootlibexecdir)
3368
3369 executable(
3370 'systemd-update-done',
3371 'src/update-done/update-done.c',
3372 include_directories : includes,
3373 link_with : [libshared],
3374 install_rpath : rootlibexecdir,
3375 install : true,
3376 install_dir : rootlibexecdir)
3377
3378 executable(
3379 'systemd-update-utmp',
3380 'src/update-utmp/update-utmp.c',
3381 include_directories : includes,
3382 link_with : [libshared],
3383 dependencies : [libaudit],
3384 install_rpath : rootlibexecdir,
3385 install : (conf.get('ENABLE_UTMP') == 1),
3386 install_dir : rootlibexecdir)
3387
3388 if conf.get('HAVE_KMOD') == 1
3389 executable(
3390 'systemd-modules-load',
3391 'src/modules-load/modules-load.c',
3392 include_directories : includes,
3393 link_with : [libshared],
3394 dependencies : [libkmod],
3395 install_rpath : rootlibexecdir,
3396 install : true,
3397 install_dir : rootlibexecdir)
3398
3399 meson.add_install_script('sh', '-c',
3400 mkdir_p.format(modulesloaddir))
3401 if install_sysconfdir
3402 meson.add_install_script('sh', '-c',
3403 mkdir_p.format(sysconfdir / 'modules-load.d'))
3404 endif
3405 endif
3406
3407 public_programs += executable(
3408 'systemd-nspawn',
3409 systemd_nspawn_sources,
3410 include_directories : includes,
3411 link_with : [libnspawn_core,
3412 libshared],
3413 dependencies : [libblkid,
3414 libseccomp],
3415 install_rpath : rootlibexecdir,
3416 install : true)
3417
3418 if conf.get('ENABLE_NETWORKD') == 1
3419 executable(
3420 'systemd-networkd',
3421 systemd_networkd_sources,
3422 include_directories : network_includes,
3423 link_with : [libnetworkd_core,
3424 libsystemd_network,
3425 networkd_link_with],
3426 dependencies : [threads],
3427 install_rpath : rootlibexecdir,
3428 install : true,
3429 install_dir : rootlibexecdir)
3430
3431 executable(
3432 'systemd-networkd-wait-online',
3433 systemd_networkd_wait_online_sources,
3434 include_directories : includes,
3435 link_with : [networkd_link_with],
3436 install_rpath : rootlibexecdir,
3437 install : true,
3438 install_dir : rootlibexecdir)
3439
3440 public_programs += executable(
3441 'networkctl',
3442 networkctl_sources,
3443 include_directories : libsystemd_network_includes,
3444 link_with : [libsystemd_network,
3445 networkd_link_with],
3446 install_rpath : rootlibexecdir,
3447 install : true,
3448 install_dir : rootbindir)
3449
3450 exe = executable(
3451 'systemd-network-generator',
3452 network_generator_sources,
3453 include_directories : includes,
3454 link_with : [networkd_link_with],
3455 install_rpath : rootlibexecdir,
3456 install : true,
3457 install_dir : rootlibexecdir)
3458
3459 if want_tests != 'false'
3460 test('test-network-generator-conversion',
3461 test_network_generator_conversion_sh,
3462 # https://github.com/mesonbuild/meson/issues/2681
3463 args : exe.full_path())
3464 endif
3465 endif
3466
3467 executable(
3468 'systemd-sulogin-shell',
3469 'src/sulogin-shell/sulogin-shell.c',
3470 include_directories : includes,
3471 link_with : [libshared],
3472 install_rpath : rootlibexecdir,
3473 install : true,
3474 install_dir : rootlibexecdir)
3475
3476 ############################################################
3477
3478 custom_target(
3479 'systemd-runtest.env',
3480 output : 'systemd-runtest.env',
3481 command : [sh, '-c',
3482 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
3483 project_source_root / 'test',
3484 project_build_root / 'catalog')],
3485 build_by_default : true)
3486
3487 test_cflags = ['-DTEST_CODE=1']
3488 # We intentionally do not do inline initializations with definitions for a
3489 # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
3490 # use the variable unexpectedly. This triggers a lot of maybe-uninitialized
3491 # false positives when the combination of -O2 and -flto is used. Suppress them.
3492 if '-O2' in get_option('c_args') and '-flto=auto' in get_option('c_args')
3493 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
3494 endif
3495
3496 foreach tuple : tests
3497 sources = tuple[0]
3498 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3499 dependencies = tuple.length() > 2 ? tuple[2] : []
3500 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3501 condition = tuple.length() > 4 ? tuple[4] : ''
3502 type = tuple.length() > 5 ? tuple[5] : ''
3503 defs = tuple.length() > 6 ? tuple[6] : []
3504 defs += test_cflags
3505 parallel = tuple.length() > 7 ? tuple[7] : true
3506 timeout = 30
3507
3508 name = sources[0].split('/')[-1].split('.')[0]
3509 if type.startswith('timeout=')
3510 timeout = type.split('=')[1].to_int()
3511 type = ''
3512 endif
3513
3514 if condition == '' or conf.get(condition) == 1
3515 exe = executable(
3516 name,
3517 sources,
3518 include_directories : incs,
3519 link_with : link_with,
3520 dependencies : [versiondep,
3521 dependencies],
3522 c_args : defs,
3523 build_by_default : want_tests != 'false',
3524 install_rpath : rootlibexecdir,
3525 install : install_tests,
3526 install_dir : testsdir / type)
3527
3528 if type == 'manual'
3529 message('@0@ is a manual test'.format(name))
3530 elif type == 'unsafe' and want_tests != 'unsafe'
3531 message('@0@ is an unsafe test'.format(name))
3532 elif want_tests != 'false'
3533 test(name, exe,
3534 env : test_env,
3535 timeout : timeout)
3536 endif
3537 else
3538 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3539 endif
3540 endforeach
3541
3542 exe = executable(
3543 'test-libsystemd-sym',
3544 test_libsystemd_sym_c,
3545 include_directories : includes,
3546 link_with : [libsystemd],
3547 build_by_default : want_tests != 'false',
3548 install : install_tests,
3549 install_dir : testsdir)
3550 if want_tests != 'false'
3551 test('test-libsystemd-sym', exe)
3552 endif
3553
3554 exe = executable(
3555 'test-libsystemd-static-sym',
3556 test_libsystemd_sym_c,
3557 include_directories : includes,
3558 link_with : [install_libsystemd_static],
3559 dependencies : [threads], # threads is already included in dependencies on the library,
3560 # but does not seem to get propagated. Add here as a work-around.
3561 build_by_default : want_tests != 'false' and static_libsystemd_pic,
3562 install : install_tests and static_libsystemd_pic,
3563 install_dir : testsdir)
3564 if want_tests != 'false' and static_libsystemd_pic
3565 test('test-libsystemd-static-sym', exe)
3566 endif
3567
3568 exe = executable(
3569 'test-libudev-sym',
3570 test_libudev_sym_c,
3571 include_directories : libudev_includes,
3572 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3573 link_with : [libudev],
3574 build_by_default : want_tests != 'false',
3575 install : install_tests,
3576 install_dir : testsdir)
3577 if want_tests != 'false'
3578 test('test-libudev-sym', exe)
3579 endif
3580
3581 exe = executable(
3582 'test-libudev-static-sym',
3583 test_libudev_sym_c,
3584 include_directories : libudev_includes,
3585 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3586 link_with : [install_libudev_static],
3587 build_by_default : want_tests != 'false' and static_libudev_pic,
3588 install : install_tests and static_libudev_pic,
3589 install_dir : testsdir)
3590 if want_tests != 'false' and static_libudev_pic
3591 test('test-libudev-static-sym', exe)
3592 endif
3593
3594 ############################################################
3595
3596 fuzzer_exes = []
3597
3598 foreach tuple : fuzzers
3599 sources = tuple[0]
3600 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3601 dependencies = tuple.length() > 2 ? tuple[2] : []
3602 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3603 defs = tuple.length() > 4 ? tuple[4] : []
3604 link_args = []
3605
3606 if want_ossfuzz
3607 dependencies += fuzzing_engine
3608 elif want_libfuzzer
3609 if fuzzing_engine.found()
3610 dependencies += fuzzing_engine
3611 else
3612 link_args += ['-fsanitize=fuzzer']
3613 endif
3614 else
3615 sources += 'src/fuzz/fuzz-main.c'
3616 endif
3617
3618 name = sources[0].split('/')[-1].split('.')[0]
3619
3620 exe = executable(
3621 name,
3622 sources,
3623 include_directories : [incs, include_directories('src/fuzz')],
3624 link_with : link_with,
3625 dependencies : dependencies,
3626 c_args : defs + test_cflags,
3627 link_args: link_args,
3628 install : false,
3629 build_by_default : fuzzer_build)
3630 fuzzer_exes += exe
3631
3632 if want_tests != 'false'
3633 # Run the fuzz regression tests without any sanitizers enabled.
3634 # Additional invocations with sanitizers may be added below.
3635 foreach p : fuzz_regression_tests
3636 b = p.split('/')[-2]
3637 c = p.split('/')[-1]
3638
3639 if b == name
3640 test('@0@_@1@'.format(b, c),
3641 exe,
3642 args : [project_source_root / p])
3643 endif
3644 endforeach
3645 endif
3646 endforeach
3647
3648 alias_target('fuzzers', fuzzer_exes)
3649
3650 ############################################################
3651
3652 subdir('modprobe.d')
3653 subdir('sysctl.d')
3654 subdir('sysusers.d')
3655 subdir('tmpfiles.d')
3656 subdir('hwdb.d')
3657 subdir('units')
3658 subdir('presets')
3659 subdir('network')
3660 subdir('man')
3661 subdir('shell-completion/bash')
3662 subdir('shell-completion/zsh')
3663 subdir('docs/sysvinit')
3664 subdir('docs/var-log')
3665
3666 install_subdir('factory/etc',
3667 install_dir : factorydir)
3668
3669 if install_sysconfdir
3670 install_data('xorg/50-systemd-user.sh',
3671 install_dir : xinitrcdir)
3672 endif
3673 install_data('LICENSE.GPL2',
3674 'LICENSE.LGPL2.1',
3675 'NEWS',
3676 'README',
3677 'docs/CODING_STYLE.md',
3678 'docs/DISTRO_PORTING.md',
3679 'docs/ENVIRONMENT.md',
3680 'docs/HACKING.md',
3681 'docs/TRANSIENT-SETTINGS.md',
3682 'docs/TRANSLATORS.md',
3683 'docs/UIDS-GIDS.md',
3684 'docs/GVARIANT-SERIALIZATION.md',
3685 install_dir : docdir)
3686
3687 install_subdir('LICENSES',
3688 install_dir : docdir)
3689
3690 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3691 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3692
3693 ############################################################
3694
3695 # Ensure that changes to the docs/ directory do not break the
3696 # basic Github pages build. But only run it in developer mode,
3697 # as it might be fragile due to changes in the tooling, and it is
3698 # not generally useful for users.
3699 jekyll = find_program('jekyll', required : false)
3700 if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
3701 test('github-pages',
3702 jekyll,
3703 args : ['build',
3704 '--source', project_source_root / 'docs',
3705 '--destination', project_build_root / '_site'])
3706 endif
3707
3708 ############################################################
3709
3710 check_help = find_program('tools/check-help.sh')
3711
3712 foreach exec : public_programs
3713 name = exec.full_path().split('/')[-1]
3714 if want_tests != 'false'
3715 test('check-help-' + name,
3716 check_help,
3717 args : exec.full_path())
3718 endif
3719 endforeach
3720
3721 ############################################################
3722
3723 check_directives_sh = find_program('tools/check-directives.sh')
3724
3725 if want_tests != 'false'
3726 test('check-directives',
3727 check_directives_sh,
3728 args : [project_source_root, project_build_root])
3729 endif
3730
3731 ############################################################
3732
3733 # Enable tests for all supported sanitizers
3734 foreach tuple : sanitizers
3735 sanitizer = tuple[0]
3736 build = tuple[1]
3737
3738 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3739 prev = ''
3740 foreach p : fuzz_regression_tests
3741 b = p.split('/')[-2]
3742 c = p.split('/')[-1]
3743
3744 name = '@0@:@1@'.format(b, sanitizer)
3745
3746 if name != prev
3747 if want_tests == 'false'
3748 message('Not compiling @0@ because tests is set to false'.format(name))
3749 elif fuzz_tests
3750 exe = custom_target(
3751 name,
3752 output : name,
3753 depends : build,
3754 command : [ln, '-fs',
3755 build.full_path() / b,
3756 '@OUTPUT@'],
3757 build_by_default : true)
3758 else
3759 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
3760 endif
3761 endif
3762 prev = name
3763
3764 if fuzz_tests
3765 test('@0@_@1@_@2@'.format(b, c, sanitizer),
3766 env,
3767 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3768 timeout : 60,
3769 args : [exe.full_path(),
3770 project_source_root / p])
3771 endif
3772 endforeach
3773 endif
3774 endforeach
3775
3776
3777 ############################################################
3778
3779 if git.found()
3780 all_files = run_command(
3781 env, '-u', 'GIT_WORK_TREE',
3782 git, '--git-dir=@0@/.git'.format(project_source_root),
3783 'ls-files', ':/*.[ch]',
3784 check : false)
3785 if all_files.returncode() == 0
3786 all_files = files(all_files.stdout().split())
3787
3788 custom_target(
3789 'tags',
3790 output : 'tags',
3791 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
3792 run_target(
3793 'ctags',
3794 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
3795 endif
3796 endif
3797
3798 if git.found()
3799 git_contrib_sh = find_program('tools/git-contrib.sh')
3800 run_target(
3801 'git-contrib',
3802 command : [git_contrib_sh])
3803 endif
3804
3805 if git.found()
3806 git_head = run_command(
3807 git, '--git-dir=@0@/.git'.format(project_source_root),
3808 'rev-parse', 'HEAD',
3809 check : false).stdout().strip()
3810 git_head_short = run_command(
3811 git, '--git-dir=@0@/.git'.format(project_source_root),
3812 'rev-parse', '--short=7', 'HEAD',
3813 check : false).stdout().strip()
3814
3815 run_target(
3816 'git-snapshot',
3817 command : [git, 'archive',
3818 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
3819 git_head_short),
3820 '--prefix', 'systemd-@0@/'.format(git_head),
3821 'HEAD'])
3822 endif
3823
3824 ############################################################
3825
3826 check_api_docs_sh = find_program('tools/check-api-docs.sh')
3827 run_target(
3828 'check-api-docs',
3829 depends : [man, libsystemd, libudev],
3830 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3831
3832 alias_target('update-dbus-docs', update_dbus_docs)
3833 alias_target('update-man-rules', update_man_rules)
3834
3835 ############################################################
3836
3837 alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
3838 check : true).stdout().strip()
3839
3840 summary({
3841 'build mode' : get_option('mode'),
3842 'split /usr' : split_usr,
3843 'split bin-sbin' : split_bin,
3844 'prefix directory' : prefixdir,
3845 'rootprefix directory' : rootprefixdir,
3846 'sysconf directory' : sysconfdir,
3847 'include directory' : includedir,
3848 'lib directory' : libdir,
3849 'rootlib directory' : rootlibdir,
3850 'SysV init scripts' : sysvinit_path,
3851 'SysV rc?.d directories' : sysvrcnd_path,
3852 'PAM modules directory' : pamlibdir,
3853 'PAM configuration directory' : pamconfdir,
3854 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
3855 'RPM macros directory' : rpmmacrosdir,
3856 'modprobe.d directory' : modprobedir,
3857 'D-Bus policy directory' : dbuspolicydir,
3858 'D-Bus session directory' : dbussessionservicedir,
3859 'D-Bus system directory' : dbussystemservicedir,
3860 'bash completions directory' : bashcompletiondir,
3861 'zsh completions directory' : zshcompletiondir,
3862 'extra start script' : get_option('rc-local'),
3863 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
3864 get_option('debug-tty')),
3865 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
3866 conf.get('SYSTEM_ALLOC_UID_MIN')),
3867 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
3868 conf.get('SYSTEM_ALLOC_GID_MIN')),
3869 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
3870 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
3871 'static UID/GID allocations' : ' '.join(static_ugids),
3872 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
3873 'render group access mode' : get_option('group-render-mode'),
3874 'certificate root directory' : get_option('certificate-root'),
3875 'support URL' : support_url,
3876 'nobody user name' : nobody_user,
3877 'nobody group name' : nobody_group,
3878 'fallback hostname' : get_option('fallback-hostname'),
3879 'default DNSSEC mode' : default_dnssec,
3880 'default DNS-over-TLS mode' : default_dns_over_tls,
3881 'default mDNS mode' : default_mdns,
3882 'default LLMNR mode' : default_llmnr,
3883 'default DNS servers' : dns_servers.split(' '),
3884 'default NTP servers' : ntp_servers.split(' '),
3885 'default cgroup hierarchy' : default_hierarchy,
3886 'default net.naming-scheme value' : default_net_naming_scheme,
3887 'default KillUserProcesses value' : kill_user_processes,
3888 'default locale' : default_locale,
3889 'default user $PATH' :
3890 default_user_path != '' ? default_user_path : '(same as system services)',
3891 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
3892 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
3893
3894 # TODO:
3895 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3896 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3897 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3898
3899 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_GNU_EFI') == 1
3900 summary({
3901 'EFI machine type' : efi_arch[0],
3902 'EFI CC' : '@0@'.format(' '.join(efi_cc)),
3903 'EFI lds' : efi_lds,
3904 'EFI crt0' : efi_crt0,
3905 'EFI include directory' : efi_incdir},
3906 section : 'Extensible Firmware Interface')
3907 endif
3908
3909 found = []
3910 missing = []
3911
3912 foreach tuple : [
3913 # dependencies
3914 ['ACL'],
3915 ['AUDIT'],
3916 ['AppArmor'],
3917 ['IMA'],
3918 ['PAM'],
3919 ['SECCOMP'],
3920 ['SELinux'],
3921 ['SMACK'],
3922 ['blkid'],
3923 ['elfutils'],
3924 ['gcrypt'],
3925 ['gnutls'],
3926 ['libbpf'],
3927 ['libcryptsetup'],
3928 ['libcryptsetup-plugins'],
3929 ['libcurl'],
3930 ['libfdisk'],
3931 ['libfido2'],
3932 ['libidn'],
3933 ['libidn2'],
3934 ['libiptc'],
3935 ['microhttpd'],
3936 ['openssl'],
3937 ['p11kit'],
3938 ['pcre2'],
3939 ['pwquality'],
3940 ['qrencode'],
3941 ['tpm2'],
3942 ['xkbcommon'],
3943
3944 # compression libs
3945 ['zstd'],
3946 ['lz4'],
3947 ['xz'],
3948 ['zlib'],
3949 ['bzip2'],
3950
3951 # components
3952 ['backlight'],
3953 ['binfmt'],
3954 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
3955 ['coredump'],
3956 ['environment.d'],
3957 ['efi'],
3958 ['gnu-efi'],
3959 ['firstboot'],
3960 ['hibernate'],
3961 ['homed'],
3962 ['hostnamed'],
3963 ['hwdb'],
3964 ['importd'],
3965 ['initrd'],
3966 ['kernel-install', get_option('kernel-install')],
3967 ['localed'],
3968 ['logind'],
3969 ['machined'],
3970 ['networkd'],
3971 ['nss-myhostname'],
3972 ['nss-mymachines'],
3973 ['nss-resolve'],
3974 ['nss-systemd'],
3975 ['oomd'],
3976 ['portabled'],
3977 ['pstore'],
3978 ['quotacheck'],
3979 ['randomseed'],
3980 ['repart'],
3981 ['resolve'],
3982 ['rfkill'],
3983 ['sysext'],
3984 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
3985 ['sysusers'],
3986 ['timedated'],
3987 ['timesyncd'],
3988 ['tmpfiles'],
3989 ['userdb'],
3990 ['vconsole'],
3991 ['xdg-autostart'],
3992
3993 # optional features
3994 ['idn'],
3995 ['polkit'],
3996 ['nscd'],
3997 ['legacy-pkla', install_polkit_pkla],
3998 ['kmod'],
3999 ['dbus'],
4000 ['glib'],
4001 ['tpm'],
4002 ['man pages', want_man],
4003 ['html pages', want_html],
4004 ['man page indices', want_man and have_lxml],
4005 ['SysV compat'],
4006 ['compat-mutable-uid-boundaries'],
4007 ['utmp'],
4008 ['ldconfig'],
4009 ['adm group', get_option('adm-group')],
4010 ['wheel group', get_option('wheel-group')],
4011 ['gshadow'],
4012 ['debug hashmap'],
4013 ['debug mmap cache'],
4014 ['debug siphash'],
4015 ['valgrind', conf.get('VALGRIND') == 1],
4016 ['trace logging', conf.get('LOG_TRACE') == 1],
4017 ['install tests', install_tests],
4018 ['link-udev-shared', get_option('link-udev-shared')],
4019 ['link-systemctl-shared', get_option('link-systemctl-shared')],
4020 ['link-networkd-shared', get_option('link-networkd-shared')],
4021 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
4022 ['fexecve'],
4023 ['standalone-binaries', get_option('standalone-binaries')],
4024 ]
4025
4026 if tuple.length() >= 2
4027 cond = tuple[1]
4028 else
4029 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
4030 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
4031 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
4032 endif
4033 if cond
4034 found += tuple[0]
4035 else
4036 missing += tuple[0]
4037 endif
4038 endforeach
4039
4040 if static_libsystemd == 'false'
4041 missing += 'static-libsystemd'
4042 else
4043 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
4044 endif
4045
4046 if static_libudev == 'false'
4047 missing += 'static-libudev'
4048 else
4049 found += 'static-libudev(@0@)'.format(static_libudev)
4050 endif
4051
4052 if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
4053 found += 'cryptolib(openssl)'
4054 elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
4055 found += 'cryptolib(gcrypt)'
4056 else
4057 missing += 'cryptolib'
4058 endif
4059
4060 if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
4061 found += 'DNS-over-TLS(gnutls)'
4062 elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
4063 found += 'DNS-over-TLS(openssl)'
4064 else
4065 missing += 'DNS-over-TLS'
4066 endif
4067
4068 summary({
4069 'enabled' : ', '.join(found),
4070 'disabled' : ', '.join(missing)},
4071 section : 'Features')
4072
4073 if rootprefixdir != rootprefix_default
4074 warning('\n' +
4075 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
4076 'systemd used fixed names for unit file directories and other paths, so anything\n' +
4077 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
4078 endif