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