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