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