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