]> git.ipfire.org Git - thirdparty/systemd.git/blob - meson.build
tty-ask-password: copy argv[] before forking child
[thirdparty/systemd.git] / meson.build
1 # SPDX-License-Identifier: LGPL-2.1+
2
3 project('systemd', 'c',
4 version : '241',
5 license : 'LGPLv2+',
6 default_options: [
7 'c_std=gnu99',
8 'prefix=/usr',
9 'sysconfdir=/etc',
10 'localstatedir=/var',
11 ],
12 meson_version : '>= 0.46',
13 )
14
15 libsystemd_version = '0.25.0'
16 libudev_version = '1.6.13'
17
18 # We need the same data in two different formats, ugh!
19 # Also, for hysterical reasons, we use different variable
20 # names, sometimes. Not all variables are included in every
21 # set. Ugh, ugh, ugh!
22 conf = configuration_data()
23 conf.set('PROJECT_VERSION', meson.project_version())
24
25 substs = configuration_data()
26 substs.set('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
27 substs.set('PROJECT_VERSION', meson.project_version())
28
29 # This is to be used instead of meson.source_root(), as the latter will return
30 # the wrong result when systemd is being built as a meson subproject
31 project_source_root = meson.current_source_dir()
32
33 want_ossfuzz = get_option('oss-fuzz')
34 want_libfuzzer = get_option('llvm-fuzz')
35 if want_ossfuzz and want_libfuzzer
36 error('only one of oss-fuzz and llvm-fuzz can be specified')
37 endif
38 fuzzer_build = want_ossfuzz or want_libfuzzer
39
40 #####################################################################
41
42 # Try to install the git pre-commit hook
43 git_hook = run_command(join_paths(project_source_root, 'tools/add-git-hook.sh'))
44 if git_hook.returncode() == 0
45 message(git_hook.stdout().strip())
46 endif
47
48 #####################################################################
49
50 if get_option('split-usr') == 'auto'
51 split_usr = run_command('test', '-L', '/bin').returncode() != 0
52 else
53 split_usr = get_option('split-usr') == 'true'
54 endif
55 conf.set10('HAVE_SPLIT_USR', split_usr,
56 description : '/usr/bin and /bin directories are separate')
57
58 if get_option('split-bin') == 'auto'
59 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
60 else
61 split_bin = get_option('split-bin') == 'true'
62 endif
63 conf.set10('HAVE_SPLIT_BIN', split_bin,
64 description : 'bin and sbin directories are separate')
65
66 rootprefixdir = get_option('rootprefix')
67 # Unusual rootprefixdir values are used by some distros
68 # (see https://github.com/systemd/systemd/pull/7461).
69 rootprefix_default = split_usr ? '/' : '/usr'
70 if rootprefixdir == ''
71 rootprefixdir = rootprefix_default
72 endif
73 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
74
75 sysvinit_path = get_option('sysvinit-path')
76 sysvrcnd_path = get_option('sysvrcnd-path')
77 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
78 description : 'SysV init scripts and rcN.d links are supported')
79
80 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
81 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
82 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
83
84 # join_paths ignores the preceding arguments if an absolute component is
85 # encountered, so this should canonicalize various paths when they are
86 # absolute or relative.
87 prefixdir = get_option('prefix')
88 if not prefixdir.startswith('/')
89 error('Prefix is not absolute: "@0@"'.format(prefixdir))
90 endif
91 bindir = join_paths(prefixdir, get_option('bindir'))
92 libdir = join_paths(prefixdir, get_option('libdir'))
93 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
94 includedir = join_paths(prefixdir, get_option('includedir'))
95 datadir = join_paths(prefixdir, get_option('datadir'))
96 localstatedir = join_paths('/', get_option('localstatedir'))
97
98 rootbindir = join_paths(rootprefixdir, 'bin')
99 rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
100 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
101
102 rootlibdir = get_option('rootlibdir')
103 if rootlibdir == ''
104 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
105 endif
106
107 # Dirs of external packages
108 pkgconfigdatadir = get_option('pkgconfigdatadir') == '' ? join_paths(datadir, 'pkgconfig') : get_option('pkgconfigdatadir')
109 pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgconfig') : get_option('pkgconfiglibdir')
110 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
111 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
112 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
113 varlogdir = join_paths(localstatedir, 'log')
114 xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
115 rpmmacrosdir = get_option('rpmmacrosdir')
116 if rpmmacrosdir != 'no'
117 rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
118 endif
119 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
120
121 # Our own paths
122 pkgdatadir = join_paths(datadir, 'systemd')
123 environmentdir = join_paths(prefixdir, 'lib/environment.d')
124 pkgsysconfdir = join_paths(sysconfdir, 'systemd')
125 userunitdir = join_paths(prefixdir, 'lib/systemd/user')
126 userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
127 tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
128 sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
129 sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
130 binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
131 modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
132 networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
133 pkgincludedir = join_paths(includedir, 'systemd')
134 systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
135 usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
136 pkgsysconfsystemgeneratordir = join_paths(pkgsysconfdir, 'system-generators')
137 pkgsysconfusergeneratordir = join_paths(pkgsysconfdir, 'user-generators')
138 systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
139 userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
140 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
141 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
142 systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
143 systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
144 udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
145 udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
146 udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
147 catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
148 kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
149 factorydir = join_paths(datadir, 'factory')
150 bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
151 testsdir = join_paths(prefixdir, 'lib/systemd/tests')
152 systemdstatedir = join_paths(localstatedir, 'lib/systemd')
153 catalogstatedir = join_paths(systemdstatedir, 'catalog')
154 randomseeddir = join_paths(localstatedir, 'lib/systemd')
155 profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
156
157 docdir = get_option('docdir')
158 if docdir == ''
159 docdir = join_paths(datadir, 'doc/systemd')
160 endif
161
162 dbuspolicydir = get_option('dbuspolicydir')
163 if dbuspolicydir == ''
164 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
165 endif
166
167 dbussessionservicedir = get_option('dbussessionservicedir')
168 if dbussessionservicedir == ''
169 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
170 endif
171
172 dbussystemservicedir = get_option('dbussystemservicedir')
173 if dbussystemservicedir == ''
174 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
175 endif
176
177 pamlibdir = get_option('pamlibdir')
178 if pamlibdir == ''
179 pamlibdir = join_paths(rootlibdir, 'security')
180 endif
181
182 pamconfdir = get_option('pamconfdir')
183 if pamconfdir == ''
184 pamconfdir = join_paths(sysconfdir, 'pam.d')
185 endif
186
187 memory_accounting_default = get_option('memory-accounting-default')
188
189 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
190 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
191 conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
192 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
193 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
194 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
195 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
196
197 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
198
199 conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
200 conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
201 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
202 conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
203 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
204 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
205 conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
206 conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
207 conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
208 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
209 conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
210 conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
211 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
212 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
213 conf.set_quoted('ROOTPREFIX', rootprefixdir)
214 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
215 conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
216 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
217 conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
218 conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
219 conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
220 conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
221 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
222 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
223 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
224 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
225 conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
226 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
227 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
228 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
229 conf.set_quoted('LIBDIR', libdir)
230 conf.set_quoted('ROOTLIBDIR', rootlibdir)
231 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
232 conf.set_quoted('BOOTLIBDIR', bootlibdir)
233 conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
234 conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
235 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', join_paths(rootlibexecdir, 'systemd-import-fs'))
236 conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
237 conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
238 conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
239 conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
240 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
241 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
242
243 substs.set('prefix', prefixdir)
244 substs.set('rootprefix', rootprefixdir)
245 substs.set('rootprefix_noslash', rootprefixdir_noslash)
246 substs.set('exec_prefix', prefixdir)
247 substs.set('libdir', libdir)
248 substs.set('rootlibdir', rootlibdir)
249 substs.set('includedir', includedir)
250 substs.set('sysconfdir', sysconfdir)
251 substs.set('bindir', bindir)
252 substs.set('rootbindir', rootbindir)
253 substs.set('rootlibexecdir', rootlibexecdir)
254 substs.set('systemunitdir', systemunitdir)
255 substs.set('userunitdir', userunitdir)
256 substs.set('systempresetdir', systempresetdir)
257 substs.set('userpresetdir', userpresetdir)
258 substs.set('udevhwdbdir', udevhwdbdir)
259 substs.set('udevrulesdir', udevrulesdir)
260 substs.set('udevlibexecdir', udevlibexecdir)
261 substs.set('environmentdir', environmentdir)
262 substs.set('catalogdir', catalogdir)
263 substs.set('tmpfilesdir', tmpfilesdir)
264 substs.set('sysusersdir', sysusersdir)
265 substs.set('sysctldir', sysctldir)
266 substs.set('binfmtdir', binfmtdir)
267 substs.set('modulesloaddir', modulesloaddir)
268 substs.set('modprobedir', modprobedir)
269 substs.set('systemgeneratordir', systemgeneratordir)
270 substs.set('usergeneratordir', usergeneratordir)
271 substs.set('systemenvgeneratordir', systemenvgeneratordir)
272 substs.set('userenvgeneratordir', userenvgeneratordir)
273 substs.set('systemshutdowndir', systemshutdowndir)
274 substs.set('systemsleepdir', systemsleepdir)
275 substs.set('VARLOGDIR', varlogdir)
276 substs.set('CERTIFICATEROOT', get_option('certificate-root'))
277 substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
278 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
279 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
280 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
281 substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
282 substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
283 substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
284 substs.set('HIGH_RLIMIT_NOFILE', conf.get('HIGH_RLIMIT_NOFILE'))
285
286 #####################################################################
287
288 cc = meson.get_compiler('c')
289 pkgconfig = import('pkgconfig')
290 check_compilation_sh = find_program('tools/meson-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 install_tests = get_option('install-tests')
296
297 if add_languages('cpp', required : fuzzer_build)
298 # Used only for tests
299 cxx_cmd = ' '.join(meson.get_compiler('cpp').cmd_array())
300 else
301 cxx_cmd = ''
302 endif
303
304 if want_libfuzzer
305 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
306 elif want_ossfuzz
307 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
308 endif
309
310 possible_cc_flags = [
311 '-Wextra',
312 '-Werror=undef',
313 '-Wlogical-op',
314 '-Wmissing-include-dirs',
315 '-Wold-style-definition',
316 '-Wpointer-arith',
317 '-Winit-self',
318 '-Wfloat-equal',
319 '-Wsuggest-attribute=noreturn',
320 '-Werror=missing-prototypes',
321 '-Werror=implicit-function-declaration',
322 '-Werror=missing-declarations',
323 '-Werror=return-type',
324 '-Werror=incompatible-pointer-types',
325 '-Werror=format=2',
326 '-Wstrict-prototypes',
327 '-Wredundant-decls',
328 '-Wmissing-noreturn',
329 '-Wimplicit-fallthrough=5',
330 '-Wshadow',
331 '-Wendif-labels',
332 '-Wstrict-aliasing=2',
333 '-Wwrite-strings',
334 '-Werror=overflow',
335 '-Werror=shift-count-overflow',
336 '-Werror=shift-overflow=2',
337 '-Wdate-time',
338 '-Wnested-externs',
339
340 # negative arguments are correctly detected starting with meson 0.46.
341 '-Wno-unused-parameter',
342 '-Wno-missing-field-initializers',
343 '-Wno-unused-result',
344 '-Wno-format-signedness',
345 '-Wno-error=#warnings', # clang
346 '-Wno-string-plus-int', # clang
347
348 # work-around for gcc 7.1 turning this on on its own.
349 '-Wno-error=nonnull',
350
351 # Disable -Wmaybe-uninitialized, since it's noisy on gcc 8 with
352 # optimizations enabled, producing essentially false positives.
353 '-Wno-maybe-uninitialized',
354
355 '-ffast-math',
356 '-fno-common',
357 '-fdiagnostics-show-option',
358 '-fno-strict-aliasing',
359 '-fvisibility=hidden',
360 '-fstack-protector',
361 '-fstack-protector-strong',
362 '--param=ssp-buffer-size=4',
363 ]
364
365 # --as-needed and --no-undefined are provided by meson by default,
366 # run mesonconf to see what is enabled
367 possible_link_flags = [
368 '-Wl,-z,relro',
369 '-Wl,-z,now',
370 ]
371
372 if cc.get_id() == 'clang'
373 possible_cc_flags += [
374 '-Wno-typedef-redefinition',
375 '-Wno-gnu-variable-sized-type-not-at-end',
376 ]
377 endif
378
379 if get_option('buildtype') != 'debug'
380 possible_cc_flags += [
381 '-ffunction-sections',
382 '-fdata-sections',
383 ]
384
385 possible_link_flags += '-Wl,--gc-sections'
386 endif
387
388 if get_option('b_ndebug') == 'true'
389 # With asserts disabled with get a bunch of warnings about variables which
390 # are used only in the asserts. This is not useful at all, so let's just silence
391 # those warnings.
392 possible_cc_flags += [
393 '-Wno-unused-variable',
394 '-Wno-unused-but-set-variable',
395 ]
396 endif
397
398 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
399 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
400
401 if cc.compiles('''
402 #include <time.h>
403 #include <inttypes.h>
404 typedef uint64_t usec_t;
405 usec_t now(clockid_t clock);
406 int main(void) {
407 struct timespec now;
408 return 0;
409 }
410 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
411 add_project_arguments('-Werror=shadow', language : 'c')
412 endif
413
414 cpp = ' '.join(cc.cmd_array()) + ' -E'
415
416 #####################################################################
417 # compilation result tests
418
419 conf.set('_GNU_SOURCE', true)
420 conf.set('__SANE_USERSPACE_TYPES__', true)
421
422 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
423 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
424 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
425 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
426 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
427 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
428 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
429
430 decl_headers = '''
431 #include <uchar.h>
432 #include <sys/stat.h>
433 '''
434
435 foreach decl : ['char16_t',
436 'char32_t',
437 'struct statx',
438 ]
439
440 # We get -1 if the size cannot be determined
441 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
442
443 if decl == 'struct statx'
444 if have
445 want_linux_stat_h = false
446 else
447 have = cc.sizeof(decl,
448 prefix : decl_headers + '#include <linux/stat.h>',
449 args : '-D_GNU_SOURCE') > 0
450 want_linux_stat_h = have
451 endif
452 endif
453
454 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
455 endforeach
456
457 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
458
459 foreach decl : [['ETHTOOL_LINK_MODE_10baseT_Half_BIT', 'linux/ethtool.h'],
460 ['ETHTOOL_LINK_MODE_25000baseCR_Full_BIT', 'linux/ethtool.h'],
461 ['ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT', 'linux/ethtool.h'],
462 ['ETHTOOL_LINK_MODE_1000baseX_Full_BIT', 'linux/ethtool.h'],
463 ['ETHTOOL_LINK_MODE_2500baseT_Full_BIT', 'linux/ethtool.h'],
464 ['ETHTOOL_LINK_MODE_FEC_NONE_BIT', 'linux/ethtool.h'],
465 ['FRA_TUN_ID', 'linux/fib_rules.h'],
466 ['FRA_SUPPRESS_PREFIXLEN', 'linux/fib_rules.h'],
467 ['FRA_PAD', 'linux/fib_rules.h'],
468 ['FRA_L3MDEV', 'linux/fib_rules.h'],
469 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
470 ['FRA_DPORT_RANGE', 'linux/fib_rules.h'],
471 ['FOU_ATTR_REMCSUM_NOPARTIAL', 'linux/fou.h'],
472 ['FOU_CMD_GET', 'linux/fou.h'],
473 ['IFA_FLAGS', 'linux/if_addr.h'],
474 ['IFLA_BRIDGE_VLAN_TUNNEL_INFO', 'linux/if_bridge.h'],
475 ['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
476 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
477 ['IN6_ADDR_GEN_MODE_RANDOM', 'linux/if_link.h'],
478 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
479 ['IPVLAN_MODE_L3S', 'linux/if_link.h'],
480 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
481 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
482 ['IFLA_CARRIER_CHANGES', 'linux/if_link.h'],
483 ['IFLA_PHYS_SWITCH_ID', 'linux/if_link.h'],
484 ['IFLA_LINK_NETNSID', 'linux/if_link.h'],
485 ['IFLA_PHYS_PORT_NAME', 'linux/if_link.h'],
486 ['IFLA_PROTO_DOWN', 'linux/if_link.h'],
487 ['IFLA_GSO_MAX_SIZE', 'linux/if_link.h'],
488 ['IFLA_PAD', 'linux/if_link.h'],
489 ['IFLA_XDP', 'linux/if_link.h'],
490 ['IFLA_EVENT', 'linux/if_link.h'],
491 ['IFLA_IF_NETNSID', 'linux/if_link.h'],
492 ['IFLA_TARGET_NETNSID', 'linux/if_link.h'],
493 ['IFLA_NEW_IFINDEX', 'linux/if_link.h'],
494 ['IFLA_MAX_MTU', 'linux/if_link.h'],
495 ['IFLA_BOND_MODE', 'linux/if_link.h'],
496 ['IFLA_BOND_ACTIVE_SLAVE', 'linux/if_link.h'],
497 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
498 ['IFLA_BOND_AD_ACTOR_SYSTEM', 'linux/if_link.h'],
499 ['IFLA_BOND_TLB_DYNAMIC_LB', 'linux/if_link.h'],
500 ['IFLA_VXLAN_UDP_ZERO_CSUM6_RX', 'linux/if_link.h'],
501 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
502 ['IFLA_VXLAN_COLLECT_METADATA', 'linux/if_link.h'],
503 ['IFLA_VXLAN_LABEL', 'linux/if_link.h'],
504 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
505 ['IFLA_VXLAN_TTL_INHERIT', 'linux/if_link.h'],
506 ['IFLA_GENEVE_TOS', 'linux/if_link.h'],
507 ['IFLA_GENEVE_COLLECT_METADATA', 'linux/if_link.h'],
508 ['IFLA_GENEVE_REMOTE6', 'linux/if_link.h'],
509 ['IFLA_GENEVE_UDP_ZERO_CSUM6_RX', 'linux/if_link.h'],
510 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
511 ['IFLA_GENEVE_TTL_INHERIT', 'linux/if_link.h'],
512 ['IFLA_BR_MAX_AGE', 'linux/if_link.h'],
513 ['IFLA_BR_PRIORITY', 'linux/if_link.h'],
514 ['IFLA_BR_VLAN_PROTOCOL', 'linux/if_link.h'],
515 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
516 ['IFLA_BR_VLAN_STATS_ENABLED', 'linux/if_link.h'],
517 ['IFLA_BR_MCAST_STATS_ENABLED', 'linux/if_link.h'],
518 ['IFLA_BR_MCAST_MLD_VERSION', 'linux/if_link.h'],
519 ['IFLA_BR_VLAN_STATS_PER_PORT', 'linux/if_link.h'],
520 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
521 ['IFLA_BRPORT_PROXYARP_WIFI', 'linux/if_link.h'],
522 ['IFLA_BRPORT_MULTICAST_ROUTER', 'linux/if_link.h'],
523 ['IFLA_BRPORT_PAD', 'linux/if_link.h'],
524 ['IFLA_BRPORT_MCAST_FLOOD', 'linux/if_link.h'],
525 ['IFLA_BRPORT_VLAN_TUNNEL', 'linux/if_link.h'],
526 ['IFLA_BRPORT_BCAST_FLOOD', 'linux/if_link.h'],
527 ['IFLA_BRPORT_NEIGH_SUPPRESS', 'linux/if_link.h'],
528 ['IFLA_BRPORT_ISOLATED', 'linux/if_link.h'],
529 ['IFLA_BRPORT_BACKUP_PORT', 'linux/if_link.h'],
530 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
531 # if_tunnel.h is buggy and cannot be included on its own
532 ['IFLA_VTI_FWMARK', 'linux/if_tunnel.h', '#include <net/if.h>'],
533 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
534 ['IFLA_IPTUN_COLLECT_METADATA', 'linux/if_tunnel.h', '#include <net/if.h>'],
535 ['IFLA_IPTUN_FWMARK', 'linux/if_tunnel.h', '#include <net/if.h>'],
536 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
537 ['IFLA_GRE_COLLECT_METADATA', 'linux/if_tunnel.h', '#include <net/if.h>'],
538 ['IFLA_GRE_IGNORE_DF', 'linux/if_tunnel.h', '#include <net/if.h>'],
539 ['IFLA_GRE_FWMARK', 'linux/if_tunnel.h', '#include <net/if.h>'],
540 ['IFLA_GRE_ERSPAN_INDEX', 'linux/if_tunnel.h', '#include <net/if.h>'],
541 ['IFLA_GRE_ERSPAN_HWID', 'linux/if_tunnel.h', '#include <net/if.h>'],
542 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
543 ]
544 prefix = decl.length() > 2 ? decl[2] : ''
545 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
546 conf.set10('HAVE_' + decl[0], have)
547 endforeach
548
549 foreach ident : ['secure_getenv', '__secure_getenv']
550 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
551 endforeach
552
553 foreach ident : [
554 ['memfd_create', '''#include <sys/mman.h>'''],
555 ['gettid', '''#include <sys/types.h>
556 #include <unistd.h>'''],
557 ['pivot_root', '''#include <stdlib.h>
558 #include <unistd.h>'''], # no known header declares pivot_root
559 ['name_to_handle_at', '''#include <sys/types.h>
560 #include <sys/stat.h>
561 #include <fcntl.h>'''],
562 ['setns', '''#include <sched.h>'''],
563 ['renameat2', '''#include <stdio.h>
564 #include <fcntl.h>'''],
565 ['kcmp', '''#include <linux/kcmp.h>'''],
566 ['keyctl', '''#include <sys/types.h>
567 #include <keyutils.h>'''],
568 ['copy_file_range', '''#include <sys/syscall.h>
569 #include <unistd.h>'''],
570 ['bpf', '''#include <sys/syscall.h>
571 #include <unistd.h>'''],
572 ['statx', '''#include <sys/types.h>
573 #include <sys/stat.h>
574 #include <unistd.h>'''],
575 ['explicit_bzero' , '''#include <string.h>'''],
576 ['reallocarray', '''#include <malloc.h>'''],
577 ]
578
579 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
580 conf.set10('HAVE_' + ident[0].to_upper(), have)
581 endforeach
582
583 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
584 conf.set10('USE_SYS_RANDOM_H', true)
585 conf.set10('HAVE_GETRANDOM', true)
586 else
587 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
588 conf.set10('USE_SYS_RANDOM_H', false)
589 conf.set10('HAVE_GETRANDOM', have)
590 endif
591
592 #####################################################################
593
594 vcs_tagger = [project_source_root + '/tools/meson-vcs-tag.sh',
595 project_source_root,
596 get_option('version-tag'),
597 meson.project_version()]
598
599 version_h = vcs_tag(
600 input : 'src/version/version.h.in',
601 output : 'version.h',
602 command: vcs_tagger)
603
604 versiondep = declare_dependency(sources: version_h)
605
606 sed = find_program('sed')
607 awk = find_program('awk')
608 m4 = find_program('m4')
609 stat = find_program('stat')
610 git = find_program('git', required : false)
611 env = find_program('env')
612 perl = find_program('perl', required : false)
613
614 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
615 mkdir_p = 'mkdir -p $DESTDIR/@0@'
616 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
617 splash_bmp = files('test/splash.bmp')
618
619 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
620 # /usr/sbin, /sbin, and fall back to the default from middle column.
621 progs = [['quotaon', '/usr/sbin/quotaon' ],
622 ['quotacheck', '/usr/sbin/quotacheck' ],
623 ['kmod', '/usr/bin/kmod' ],
624 ['kexec', '/usr/sbin/kexec' ],
625 ['sulogin', '/usr/sbin/sulogin' ],
626 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
627 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
628 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
629 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
630 ]
631 foreach prog : progs
632 path = get_option(prog[0] + '-path')
633 if path != ''
634 message('Using @1@ for @0@'.format(prog[0], path))
635 else
636 exe = find_program(prog[0],
637 '/usr/sbin/' + prog[0],
638 '/sbin/' + prog[0],
639 required: false)
640 path = exe.found() ? exe.path() : prog[1]
641 endif
642 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
643 conf.set_quoted(name, path)
644 substs.set(name, path)
645 endforeach
646
647 conf.set_quoted('TELINIT', get_option('telinit-path'))
648
649 if run_command('ln', '--relative', '--help').returncode() != 0
650 error('ln does not support --relative (added in coreutils 8.16)')
651 endif
652
653 ############################################################
654
655 gperf = find_program('gperf')
656
657 gperf_test_format = '''
658 #include <string.h>
659 const char * in_word_set(const char *, @0@);
660 @1@
661 '''
662 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
663 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
664 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
665 if cc.compiles(gperf_test)
666 gperf_len_type = 'size_t'
667 else
668 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
669 if cc.compiles(gperf_test)
670 gperf_len_type = 'unsigned'
671 else
672 error('unable to determine gperf len type')
673 endif
674 endif
675 message('gperf len type is @0@'.format(gperf_len_type))
676 conf.set('GPERF_LEN_TYPE', gperf_len_type,
677 description : 'The type of gperf "len" parameter')
678
679 ############################################################
680
681 if not cc.has_header('sys/capability.h')
682 error('POSIX caps headers not found')
683 endif
684 foreach header : ['crypt.h',
685 'linux/btrfs_tree.h',
686 'linux/fou.h',
687 'linux/memfd.h',
688 'linux/vm_sockets.h',
689 'linux/can/vxcan.h',
690 'sys/auxv.h',
691 'valgrind/memcheck.h',
692 'valgrind/valgrind.h',
693 ]
694
695 conf.set10('HAVE_' + header.underscorify().to_upper(),
696 cc.has_header(header))
697 endforeach
698
699 ############################################################
700
701 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
702 conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
703 gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
704
705 default_hierarchy = get_option('default-hierarchy')
706 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
707 description : 'default cgroup hierarchy as string')
708 if default_hierarchy == 'legacy'
709 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
710 elif default_hierarchy == 'hybrid'
711 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
712 else
713 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
714 endif
715
716 default_net_naming_scheme = get_option('default-net-naming-scheme')
717 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
718
719 time_epoch = get_option('time-epoch')
720 if time_epoch == -1
721 NEWS = files('NEWS')
722 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout().to_int()
723 endif
724 conf.set('TIME_EPOCH', time_epoch)
725
726 system_uid_max = get_option('system-uid-max')
727 if system_uid_max == -1
728 system_uid_max = run_command(
729 awk,
730 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
731 '/etc/login.defs').stdout().strip()
732 if system_uid_max == ''
733 system_uid_max = 999
734 else
735 system_uid_max = system_uid_max.to_int()
736 endif
737 endif
738 conf.set('SYSTEM_UID_MAX', system_uid_max)
739 substs.set('systemuidmax', system_uid_max)
740
741 system_gid_max = get_option('system-gid-max')
742 if system_gid_max == -1
743 system_gid_max = run_command(
744 awk,
745 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
746 '/etc/login.defs').stdout().strip()
747 if system_gid_max == ''
748 system_gid_max = 999
749 else
750 system_gid_max = system_gid_max.to_int()
751 endif
752 endif
753 conf.set('SYSTEM_GID_MAX', system_gid_max)
754 substs.set('systemgidmax', system_gid_max)
755
756 dynamic_uid_min = get_option('dynamic-uid-min')
757 dynamic_uid_max = get_option('dynamic-uid-max')
758 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
759 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
760 substs.set('dynamicuidmin', dynamic_uid_min)
761 substs.set('dynamicuidmax', dynamic_uid_max)
762
763 container_uid_base_min = get_option('container-uid-base-min')
764 container_uid_base_max = get_option('container-uid-base-max')
765 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
766 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
767 substs.set('containeruidbasemin', container_uid_base_min)
768 substs.set('containeruidbasemax', container_uid_base_max)
769
770 nobody_user = get_option('nobody-user')
771 nobody_group = get_option('nobody-group')
772
773 if not meson.is_cross_build()
774 getent_result = run_command('getent', 'passwd', '65534')
775 if getent_result.returncode() == 0
776 name = getent_result.stdout().split(':')[0]
777 if name != nobody_user
778 warning('\n' +
779 '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) +
780 'Your build will result in an user table setup that is incompatible with the local system.')
781 endif
782 endif
783 id_result = run_command('id', '-u', nobody_user)
784 if id_result.returncode() == 0
785 id = id_result.stdout().to_int()
786 if id != 65534
787 warning('\n' +
788 '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) +
789 'Your build will result in an user table setup that is incompatible with the local system.')
790 endif
791 endif
792
793 getent_result = run_command('getent', 'group', '65534')
794 if getent_result.returncode() == 0
795 name = getent_result.stdout().split(':')[0]
796 if name != nobody_group
797 warning('\n' +
798 '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) +
799 'Your build will result in an group table setup that is incompatible with the local system.')
800 endif
801 endif
802 id_result = run_command('id', '-g', nobody_group)
803 if id_result.returncode() == 0
804 id = id_result.stdout().to_int()
805 if id != 65534
806 warning('\n' +
807 'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
808 'Your build will result in an group table setup that is incompatible with the local system.')
809 endif
810 endif
811 endif
812 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
813 warning('\n' +
814 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
815 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
816 endif
817
818 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
819 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
820 substs.set('NOBODY_USER_NAME', nobody_user)
821 substs.set('NOBODY_GROUP_NAME', nobody_group)
822
823 tty_gid = get_option('tty-gid')
824 conf.set('TTY_GID', tty_gid)
825 substs.set('TTY_GID', tty_gid)
826
827 # Ensure provided GID argument is numeric, otherwise fallback to default assignment
828 users_gid = get_option('users-gid')
829 substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid)
830
831 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
832 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
833
834 dev_kvm_mode = get_option('dev-kvm-mode')
835 substs.set('DEV_KVM_MODE', dev_kvm_mode)
836 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
837 group_render_mode = get_option('group-render-mode')
838 substs.set('GROUP_RENDER_MODE', group_render_mode)
839 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
840
841 kill_user_processes = get_option('default-kill-user-processes')
842 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
843 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
844 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
845
846 dns_servers = get_option('dns-servers')
847 conf.set_quoted('DNS_SERVERS', dns_servers)
848 substs.set('DNS_SERVERS', dns_servers)
849
850 ntp_servers = get_option('ntp-servers')
851 conf.set_quoted('NTP_SERVERS', ntp_servers)
852 substs.set('NTP_SERVERS', ntp_servers)
853
854 default_locale = get_option('default-locale')
855 if default_locale == ''
856 if not meson.is_cross_build()
857 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
858 default_locale = run_command(choose_default_locale_sh).stdout().strip()
859 else
860 default_locale = 'C.UTF-8'
861 endif
862 endif
863 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
864
865 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
866
867 substs.set('SUSHELL', get_option('debug-shell'))
868 substs.set('DEBUGTTY', get_option('debug-tty'))
869
870 enable_debug_hashmap = false
871 enable_debug_mmap_cache = false
872 enable_debug_siphash = false
873 enable_debug_udev = false
874 foreach name : get_option('debug-extra')
875 if name == 'hashmap'
876 enable_debug_hashmap = true
877 elif name == 'mmap-cache'
878 enable_debug_mmap_cache = true
879 elif name == 'siphash'
880 enable_debug_siphash = true
881 elif name == 'udev'
882 enable_debug_udev = 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 conf.set10('ENABLE_DEBUG_UDEV', enable_debug_udev)
891
892 conf.set10('VALGRIND', get_option('valgrind'))
893 conf.set10('LOG_TRACE', get_option('log-trace'))
894
895 #####################################################################
896
897 threads = dependency('threads')
898 librt = cc.find_library('rt')
899 libm = cc.find_library('m')
900 libdl = cc.find_library('dl')
901 libcrypt = cc.find_library('crypt')
902
903 libcap = dependency('libcap', required : false)
904 if not libcap.found()
905 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
906 libcap = cc.find_library('cap')
907 endif
908
909 libmount = dependency('mount',
910 version : fuzzer_build ? '>= 0' : '>= 2.30')
911
912 want_seccomp = get_option('seccomp')
913 if want_seccomp != 'false' and not fuzzer_build
914 libseccomp = dependency('libseccomp',
915 version : '>= 2.3.1',
916 required : want_seccomp == 'true')
917 have = libseccomp.found()
918 else
919 have = false
920 libseccomp = []
921 endif
922 conf.set10('HAVE_SECCOMP', have)
923
924 want_selinux = get_option('selinux')
925 if want_selinux != 'false' and not fuzzer_build
926 libselinux = dependency('libselinux',
927 version : '>= 2.1.9',
928 required : want_selinux == 'true')
929 have = libselinux.found()
930 else
931 have = false
932 libselinux = []
933 endif
934 conf.set10('HAVE_SELINUX', have)
935
936 want_apparmor = get_option('apparmor')
937 if want_apparmor != 'false' and not fuzzer_build
938 libapparmor = dependency('libapparmor',
939 required : want_apparmor == 'true')
940 have = libapparmor.found()
941 else
942 have = false
943 libapparmor = []
944 endif
945 conf.set10('HAVE_APPARMOR', have)
946
947 smack_run_label = get_option('smack-run-label')
948 if smack_run_label != ''
949 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
950 endif
951
952 want_polkit = get_option('polkit')
953 install_polkit = false
954 install_polkit_pkla = false
955 if want_polkit != 'false' and not fuzzer_build
956 install_polkit = true
957
958 libpolkit = dependency('polkit-gobject-1',
959 required : false)
960 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
961 message('Old polkit detected, will install pkla files')
962 install_polkit_pkla = true
963 endif
964 endif
965 conf.set10('ENABLE_POLKIT', install_polkit)
966
967 want_acl = get_option('acl')
968 if want_acl != 'false' and not fuzzer_build
969 libacl = cc.find_library('acl', required : want_acl == 'true')
970 have = libacl.found()
971 else
972 have = false
973 libacl = []
974 endif
975 conf.set10('HAVE_ACL', have)
976
977 want_audit = get_option('audit')
978 if want_audit != 'false' and not fuzzer_build
979 libaudit = dependency('audit', required : want_audit == 'true')
980 have = libaudit.found()
981 else
982 have = false
983 libaudit = []
984 endif
985 conf.set10('HAVE_AUDIT', have)
986
987 want_blkid = get_option('blkid')
988 if want_blkid != 'false' and not fuzzer_build
989 libblkid = dependency('blkid', required : want_blkid == 'true')
990 have = libblkid.found()
991 else
992 have = false
993 libblkid = []
994 endif
995 conf.set10('HAVE_BLKID', have)
996
997 want_kmod = get_option('kmod')
998 if want_kmod != 'false' and not fuzzer_build
999 libkmod = dependency('libkmod',
1000 version : '>= 15',
1001 required : want_kmod == 'true')
1002 have = libkmod.found()
1003 else
1004 have = false
1005 libkmod = []
1006 endif
1007 conf.set10('HAVE_KMOD', have)
1008
1009 want_pam = get_option('pam')
1010 if want_pam != 'false' and not fuzzer_build
1011 libpam = cc.find_library('pam', required : want_pam == 'true')
1012 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1013 have = libpam.found() and libpam_misc.found()
1014 else
1015 have = false
1016 libpam = []
1017 libpam_misc = []
1018 endif
1019 conf.set10('HAVE_PAM', have)
1020
1021 want_microhttpd = get_option('microhttpd')
1022 if want_microhttpd != 'false' and not fuzzer_build
1023 libmicrohttpd = dependency('libmicrohttpd',
1024 version : '>= 0.9.33',
1025 required : want_microhttpd == 'true')
1026 have = libmicrohttpd.found()
1027 else
1028 have = false
1029 libmicrohttpd = []
1030 endif
1031 conf.set10('HAVE_MICROHTTPD', have)
1032
1033 want_libcryptsetup = get_option('libcryptsetup')
1034 if want_libcryptsetup != 'false' and not fuzzer_build
1035 libcryptsetup = dependency('libcryptsetup',
1036 version : '>= 1.6.0',
1037 required : want_libcryptsetup == 'true')
1038 have = libcryptsetup.found()
1039 have_sector = cc.has_member(
1040 'struct crypt_params_plain',
1041 'sector_size',
1042 prefix : '#include <libcryptsetup.h>')
1043 else
1044 have = false
1045 have_sector = false
1046 libcryptsetup = []
1047 endif
1048 conf.set10('HAVE_LIBCRYPTSETUP', have)
1049 conf.set10('HAVE_LIBCRYPTSETUP_SECTOR_SIZE', have_sector)
1050
1051 want_libcurl = get_option('libcurl')
1052 if want_libcurl != 'false' and not fuzzer_build
1053 libcurl = dependency('libcurl',
1054 version : '>= 7.32.0',
1055 required : want_libcurl == 'true')
1056 have = libcurl.found()
1057 else
1058 have = false
1059 libcurl = []
1060 endif
1061 conf.set10('HAVE_LIBCURL', have)
1062
1063 want_libidn = get_option('libidn')
1064 want_libidn2 = get_option('libidn2')
1065 if want_libidn == 'true' and want_libidn2 == 'true'
1066 error('libidn and libidn2 cannot be requested simultaneously')
1067 endif
1068
1069 if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
1070 libidn = dependency('libidn',
1071 required : want_libidn == 'true')
1072 have = libidn.found()
1073 else
1074 have = false
1075 libidn = []
1076 endif
1077 conf.set10('HAVE_LIBIDN', have)
1078 if not have and want_libidn2 != 'false' and not fuzzer_build
1079 # libidn is used for both libidn and libidn2 objects
1080 libidn = dependency('libidn2',
1081 required : want_libidn2 == 'true')
1082 have = libidn.found()
1083 else
1084 have = false
1085 endif
1086 conf.set10('HAVE_LIBIDN2', have)
1087
1088 want_libiptc = get_option('libiptc')
1089 if want_libiptc != 'false' and not fuzzer_build
1090 libiptc = dependency('libiptc',
1091 required : want_libiptc == 'true')
1092 have = libiptc.found()
1093 else
1094 have = false
1095 libiptc = []
1096 endif
1097 conf.set10('HAVE_LIBIPTC', have)
1098
1099 want_qrencode = get_option('qrencode')
1100 if want_qrencode != 'false' and not fuzzer_build
1101 libqrencode = dependency('libqrencode',
1102 required : want_qrencode == 'true')
1103 have = libqrencode.found()
1104 else
1105 have = false
1106 libqrencode = []
1107 endif
1108 conf.set10('HAVE_QRENCODE', have)
1109
1110 want_gcrypt = get_option('gcrypt')
1111 if want_gcrypt != 'false' and not fuzzer_build
1112 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1113 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1114 have = libgcrypt.found() and libgpg_error.found()
1115 else
1116 have = false
1117 endif
1118 if not have
1119 # link to neither of the libs if one is not found
1120 libgcrypt = []
1121 libgpg_error = []
1122 endif
1123 conf.set10('HAVE_GCRYPT', have)
1124
1125 want_gnutls = get_option('gnutls')
1126 if want_gnutls != 'false' and not fuzzer_build
1127 libgnutls = dependency('gnutls',
1128 version : '>= 3.1.4',
1129 required : want_gnutls == 'true')
1130 have = libgnutls.found()
1131 else
1132 have = false
1133 libgnutls = []
1134 endif
1135 conf.set10('HAVE_GNUTLS', have)
1136
1137 want_openssl = get_option('openssl')
1138 if want_openssl != 'false' and not fuzzer_build
1139 libopenssl = dependency('openssl',
1140 version : '>= 1.1.0',
1141 required : want_openssl == 'true')
1142 have = libopenssl.found()
1143 else
1144 have = false
1145 libopenssl = []
1146 endif
1147 conf.set10('HAVE_OPENSSL', have)
1148
1149 want_elfutils = get_option('elfutils')
1150 if want_elfutils != 'false' and not fuzzer_build
1151 libdw = dependency('libdw',
1152 required : want_elfutils == 'true')
1153 have = libdw.found()
1154 else
1155 have = false
1156 libdw = []
1157 endif
1158 conf.set10('HAVE_ELFUTILS', have)
1159
1160 want_zlib = get_option('zlib')
1161 if want_zlib != 'false' and not fuzzer_build
1162 libz = dependency('zlib',
1163 required : want_zlib == 'true')
1164 have = libz.found()
1165 else
1166 have = false
1167 libz = []
1168 endif
1169 conf.set10('HAVE_ZLIB', have)
1170
1171 want_bzip2 = get_option('bzip2')
1172 if want_bzip2 != 'false' and not fuzzer_build
1173 libbzip2 = cc.find_library('bz2',
1174 required : want_bzip2 == 'true')
1175 have = libbzip2.found()
1176 else
1177 have = false
1178 libbzip2 = []
1179 endif
1180 conf.set10('HAVE_BZIP2', have)
1181
1182 want_xz = get_option('xz')
1183 if want_xz != 'false' and not fuzzer_build
1184 libxz = dependency('liblzma',
1185 required : want_xz == 'true')
1186 have = libxz.found()
1187 else
1188 have = false
1189 libxz = []
1190 endif
1191 conf.set10('HAVE_XZ', have)
1192
1193 want_lz4 = get_option('lz4')
1194 if want_lz4 != 'false' and not fuzzer_build
1195 liblz4 = dependency('liblz4',
1196 version : '>= 1.3.0',
1197 required : want_lz4 == 'true')
1198 have = liblz4.found()
1199 else
1200 have = false
1201 liblz4 = []
1202 endif
1203 conf.set10('HAVE_LZ4', have)
1204
1205 want_xkbcommon = get_option('xkbcommon')
1206 if want_xkbcommon != 'false' and not fuzzer_build
1207 libxkbcommon = dependency('xkbcommon',
1208 version : '>= 0.3.0',
1209 required : want_xkbcommon == 'true')
1210 have = libxkbcommon.found()
1211 else
1212 have = false
1213 libxkbcommon = []
1214 endif
1215 conf.set10('HAVE_XKBCOMMON', have)
1216
1217 want_pcre2 = get_option('pcre2')
1218 if want_pcre2 != 'false'
1219 libpcre2 = dependency('libpcre2-8',
1220 required : want_pcre2 == 'true')
1221 have = libpcre2.found()
1222 else
1223 have = false
1224 libpcre2 = []
1225 endif
1226 conf.set10('HAVE_PCRE2', have)
1227
1228 want_glib = get_option('glib')
1229 if want_glib != 'false' and not fuzzer_build
1230 libglib = dependency('glib-2.0',
1231 version : '>= 2.22.0',
1232 required : want_glib == 'true')
1233 libgobject = dependency('gobject-2.0',
1234 version : '>= 2.22.0',
1235 required : want_glib == 'true')
1236 libgio = dependency('gio-2.0',
1237 required : want_glib == 'true')
1238 have = libglib.found() and libgobject.found() and libgio.found()
1239 else
1240 have = false
1241 libglib = []
1242 libgobject = []
1243 libgio = []
1244 endif
1245 conf.set10('HAVE_GLIB', have)
1246
1247 want_dbus = get_option('dbus')
1248 if want_dbus != 'false' and not fuzzer_build
1249 libdbus = dependency('dbus-1',
1250 version : '>= 1.3.2',
1251 required : want_dbus == 'true')
1252 have = libdbus.found()
1253 else
1254 have = false
1255 libdbus = []
1256 endif
1257 conf.set10('HAVE_DBUS', have)
1258
1259 default_dnssec = get_option('default-dnssec')
1260 if fuzzer_build
1261 default_dnssec = 'no'
1262 endif
1263 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1264 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1265 default_dnssec = 'no'
1266 endif
1267 conf.set('DEFAULT_DNSSEC_MODE',
1268 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1269 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1270
1271 dns_over_tls = get_option('dns-over-tls')
1272 if dns_over_tls != 'false'
1273 if dns_over_tls == 'openssl'
1274 have_gnutls = false
1275 else
1276 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.5.3'))
1277 if dns_over_tls == 'gnutls' and not have_gnutls
1278 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1279 endif
1280 endif
1281 if dns_over_tls == 'gnutls' or have_gnutls
1282 have_openssl = false
1283 else
1284 have_openssl = conf.get('HAVE_OPENSSL') == 1
1285 if dns_over_tls != 'auto' and not have_openssl
1286 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
1287 error('DNS-over-TLS support was requested$0$, but dependencies are not available'.format(str))
1288 endif
1289 endif
1290 have = have_gnutls or have_openssl
1291 else
1292 have = false
1293 have_gnutls = false
1294 have_openssl = false
1295 endif
1296 conf.set10('ENABLE_DNS_OVER_TLS', have)
1297 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1298 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1299
1300 default_dns_over_tls = get_option('default-dns-over-tls')
1301 if fuzzer_build
1302 default_dns_over_tls = 'no'
1303 endif
1304 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1305 message('default-dns-over-tls cannot be set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.')
1306 default_dns_over_tls = 'no'
1307 endif
1308 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1309 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1310 substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls)
1311
1312 want_importd = get_option('importd')
1313 if want_importd != 'false'
1314 have = (conf.get('HAVE_LIBCURL') == 1 and
1315 conf.get('HAVE_ZLIB') == 1 and
1316 conf.get('HAVE_XZ') == 1 and
1317 conf.get('HAVE_GCRYPT') == 1)
1318 if want_importd == 'true' and not have
1319 error('importd support was requested, but dependencies are not available')
1320 endif
1321 else
1322 have = false
1323 endif
1324 conf.set10('ENABLE_IMPORTD', have)
1325
1326 want_remote = get_option('remote')
1327 if want_remote != 'false'
1328 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1329 conf.get('HAVE_LIBCURL') == 1]
1330 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1331 # it's possible to build one without the other. Complain only if
1332 # support was explictly requested. The auxiliary files like sysusers
1333 # config should be installed when any of the programs are built.
1334 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1335 error('remote support was requested, but dependencies are not available')
1336 endif
1337 have = have_deps[0] or have_deps[1]
1338 else
1339 have = false
1340 endif
1341 conf.set10('ENABLE_REMOTE', have)
1342
1343 foreach term : ['utmp',
1344 'hibernate',
1345 'environment-d',
1346 'binfmt',
1347 'coredump',
1348 'resolve',
1349 'logind',
1350 'hostnamed',
1351 'localed',
1352 'machined',
1353 'portabled',
1354 'networkd',
1355 'timedated',
1356 'timesyncd',
1357 'firstboot',
1358 'randomseed',
1359 'backlight',
1360 'vconsole',
1361 'quotacheck',
1362 'sysusers',
1363 'tmpfiles',
1364 'hwdb',
1365 'rfkill',
1366 'ldconfig',
1367 'efi',
1368 'tpm',
1369 'ima',
1370 'smack',
1371 'gshadow',
1372 'idn',
1373 'nss-myhostname',
1374 'nss-systemd']
1375 have = get_option(term)
1376 name = 'ENABLE_' + term.underscorify().to_upper()
1377 conf.set10(name, have)
1378 endforeach
1379
1380 foreach tuple : [['nss-mymachines', 'machined'],
1381 ['nss-resolve', 'resolve']]
1382 want = get_option(tuple[0])
1383 if want != 'false'
1384 have = get_option(tuple[1])
1385 if want == 'true' and not have
1386 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1387 endif
1388 else
1389 have = false
1390 endif
1391 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1392 conf.set10(name, have)
1393 endforeach
1394
1395 enable_nss = false
1396 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1397 'ENABLE_NSS_MYMACHINES',
1398 'ENABLE_NSS_RESOLVE',
1399 'ENABLE_NSS_SYSTEMD']
1400 if conf.get(term) == 1
1401 enable_nss = true
1402 endif
1403 endforeach
1404 conf.set10('ENABLE_NSS', enable_nss)
1405
1406 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1407
1408 tests = []
1409 fuzzers = []
1410
1411 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1412
1413 #####################################################################
1414
1415 if get_option('efi')
1416 efi_arch = host_machine.cpu_family()
1417
1418 if efi_arch == 'x86'
1419 EFI_MACHINE_TYPE_NAME = 'ia32'
1420 gnu_efi_arch = 'ia32'
1421 elif efi_arch == 'x86_64'
1422 EFI_MACHINE_TYPE_NAME = 'x64'
1423 gnu_efi_arch = 'x86_64'
1424 elif efi_arch == 'arm'
1425 EFI_MACHINE_TYPE_NAME = 'arm'
1426 gnu_efi_arch = 'arm'
1427 elif efi_arch == 'aarch64'
1428 EFI_MACHINE_TYPE_NAME = 'aa64'
1429 gnu_efi_arch = 'aarch64'
1430 else
1431 EFI_MACHINE_TYPE_NAME = ''
1432 gnu_efi_arch = ''
1433 endif
1434
1435 have = true
1436 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1437
1438 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
1439 else
1440 have = false
1441 endif
1442 conf.set10('ENABLE_EFI', have)
1443
1444 #####################################################################
1445
1446 config_h = configure_file(
1447 output : 'config.h',
1448 configuration : conf)
1449
1450 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1451
1452 includes = include_directories('src/basic',
1453 'src/shared',
1454 'src/systemd',
1455 'src/journal',
1456 'src/journal-remote',
1457 'src/nspawn',
1458 'src/resolve',
1459 'src/timesync',
1460 'src/time-wait-sync',
1461 'src/login',
1462 'src/udev',
1463 'src/libudev',
1464 'src/core',
1465 'src/shutdown',
1466 'src/libsystemd/sd-bus',
1467 'src/libsystemd/sd-device',
1468 'src/libsystemd/sd-event',
1469 'src/libsystemd/sd-hwdb',
1470 'src/libsystemd/sd-id128',
1471 'src/libsystemd/sd-netlink',
1472 'src/libsystemd/sd-network',
1473 'src/libsystemd/sd-resolve',
1474 'src/libsystemd-network',
1475 '.')
1476
1477 add_project_arguments('-include', 'config.h', language : 'c')
1478
1479 generate_gperfs = find_program('tools/generate-gperfs.py')
1480
1481 subdir('po')
1482 subdir('catalog')
1483 subdir('src/systemd')
1484 subdir('src/basic')
1485 subdir('src/libsystemd')
1486 subdir('src/libsystemd-network')
1487 subdir('src/journal')
1488 subdir('src/login')
1489
1490 libjournal_core = static_library(
1491 'journal-core',
1492 libjournal_core_sources,
1493 journald_gperf_c,
1494 include_directories : includes,
1495 install : false)
1496
1497 libsystemd_sym_path = '@0@/@1@'.format(project_source_root, libsystemd_sym)
1498 libsystemd = shared_library(
1499 'systemd',
1500 disable_mempool_c,
1501 version : libsystemd_version,
1502 include_directories : includes,
1503 link_args : ['-shared',
1504 '-Wl,--version-script=' + libsystemd_sym_path],
1505 link_with : [libbasic,
1506 libbasic_gcrypt],
1507 link_whole : [libsystemd_static,
1508 libjournal_client],
1509 dependencies : [threads,
1510 librt,
1511 libxz,
1512 liblz4],
1513 link_depends : libsystemd_sym,
1514 install : true,
1515 install_dir : rootlibdir)
1516
1517 static_libsystemd = get_option('static-libsystemd')
1518 static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
1519
1520 install_libsystemd_static = static_library(
1521 'systemd',
1522 libsystemd_sources,
1523 journal_client_sources,
1524 basic_sources,
1525 basic_gcrypt_sources,
1526 disable_mempool_c,
1527 include_directories : includes,
1528 build_by_default : static_libsystemd != 'false',
1529 install : static_libsystemd != 'false',
1530 install_dir : rootlibdir,
1531 pic : static_libsystemd == 'true' or static_libsystemd == 'pic',
1532 dependencies : [threads,
1533 librt,
1534 libxz,
1535 liblz4,
1536 libcap,
1537 libblkid,
1538 libmount,
1539 libselinux,
1540 libgcrypt],
1541 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1542
1543 ############################################################
1544
1545 # binaries that have --help and are intended for use by humans,
1546 # usually, but not always, installed in /bin.
1547 public_programs = []
1548
1549 subdir('src/libudev')
1550 subdir('src/shared')
1551 subdir('src/core')
1552 subdir('src/shutdown')
1553 subdir('src/udev')
1554 subdir('src/network')
1555
1556 subdir('src/analyze')
1557 subdir('src/journal-remote')
1558 subdir('src/coredump')
1559 subdir('src/hostname')
1560 subdir('src/import')
1561 subdir('src/kernel-install')
1562 subdir('src/locale')
1563 subdir('src/machine')
1564 subdir('src/portable')
1565 subdir('src/nspawn')
1566 subdir('src/resolve')
1567 subdir('src/timedate')
1568 subdir('src/timesync')
1569 subdir('src/vconsole')
1570 subdir('src/boot/efi')
1571
1572 subdir('src/test')
1573 subdir('src/fuzz')
1574 subdir('rules')
1575 subdir('test')
1576
1577 ############################################################
1578
1579 # only static linking apart from libdl, to make sure that the
1580 # module is linked to all libraries that it uses.
1581 test_dlopen = executable(
1582 'test-dlopen',
1583 test_dlopen_c,
1584 disable_mempool_c,
1585 include_directories : includes,
1586 link_with : [libbasic],
1587 dependencies : [libdl],
1588 build_by_default : want_tests != 'false')
1589
1590 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
1591 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1592 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
1593 ['resolve', 'ENABLE_NSS_RESOLVE']]
1594
1595 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1596 if condition
1597 module = tuple[0]
1598
1599 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1600 version_script_arg = join_paths(project_source_root, sym)
1601
1602 nss = shared_library(
1603 'nss_' + module,
1604 'src/nss-@0@/nss-@0@.c'.format(module),
1605 disable_mempool_c,
1606 version : '2',
1607 include_directories : includes,
1608 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1609 link_args : ['-Wl,-z,nodelete',
1610 '-shared',
1611 '-Wl,--version-script=' + version_script_arg,
1612 '-Wl,--undefined'],
1613 link_with : [libsystemd_static,
1614 libbasic],
1615 dependencies : [threads,
1616 librt],
1617 link_depends : sym,
1618 install : true,
1619 install_dir : rootlibdir)
1620
1621 # We cannot use shared_module because it does not support version suffix.
1622 # Unfortunately shared_library insists on creating the symlink…
1623 meson.add_install_script('sh', '-c',
1624 'rm $DESTDIR@0@/libnss_@1@.so'
1625 .format(rootlibdir, module))
1626
1627 if want_tests != 'false'
1628 test('dlopen-nss_' + module,
1629 test_dlopen,
1630 # path to dlopen must include a slash
1631 args : nss.full_path())
1632 endif
1633 endif
1634 endforeach
1635
1636 ############################################################
1637
1638 executable('systemd',
1639 systemd_sources,
1640 include_directories : includes,
1641 link_with : [libcore,
1642 libshared],
1643 dependencies : [versiondep,
1644 threads,
1645 librt,
1646 libseccomp,
1647 libselinux,
1648 libmount,
1649 libblkid],
1650 install_rpath : rootlibexecdir,
1651 install : true,
1652 install_dir : rootlibexecdir)
1653
1654 meson.add_install_script(meson_make_symlink,
1655 join_paths(rootlibexecdir, 'systemd'),
1656 join_paths(rootsbindir, 'init'))
1657
1658 exe = executable('systemd-analyze',
1659 systemd_analyze_sources,
1660 include_directories : includes,
1661 link_with : [libcore,
1662 libshared],
1663 dependencies : [versiondep,
1664 threads,
1665 librt,
1666 libseccomp,
1667 libselinux,
1668 libmount,
1669 libblkid],
1670 install_rpath : rootlibexecdir,
1671 install : true)
1672 public_programs += exe
1673
1674 executable('systemd-journald',
1675 systemd_journald_sources,
1676 include_directories : includes,
1677 link_with : [libjournal_core,
1678 libshared],
1679 dependencies : [threads,
1680 libxz,
1681 liblz4,
1682 libselinux],
1683 install_rpath : rootlibexecdir,
1684 install : true,
1685 install_dir : rootlibexecdir)
1686
1687 exe = executable('systemd-cat',
1688 systemd_cat_sources,
1689 include_directories : includes,
1690 link_with : [libjournal_core,
1691 libshared],
1692 dependencies : [threads],
1693 install_rpath : rootlibexecdir,
1694 install : true)
1695 public_programs += exe
1696
1697 exe = executable('journalctl',
1698 journalctl_sources,
1699 include_directories : includes,
1700 link_with : [libshared],
1701 dependencies : [threads,
1702 libqrencode,
1703 libxz,
1704 liblz4,
1705 libpcre2],
1706 install_rpath : rootlibexecdir,
1707 install : true,
1708 install_dir : rootbindir)
1709 public_programs += exe
1710
1711 executable('systemd-getty-generator',
1712 'src/getty-generator/getty-generator.c',
1713 include_directories : includes,
1714 link_with : [libshared],
1715 install_rpath : rootlibexecdir,
1716 install : true,
1717 install_dir : systemgeneratordir)
1718
1719 executable('systemd-debug-generator',
1720 'src/debug-generator/debug-generator.c',
1721 include_directories : includes,
1722 link_with : [libshared],
1723 install_rpath : rootlibexecdir,
1724 install : true,
1725 install_dir : systemgeneratordir)
1726
1727 executable('systemd-run-generator',
1728 'src/run-generator/run-generator.c',
1729 include_directories : includes,
1730 link_with : [libshared],
1731 install_rpath : rootlibexecdir,
1732 install : true,
1733 install_dir : systemgeneratordir)
1734
1735 executable('systemd-fstab-generator',
1736 'src/fstab-generator/fstab-generator.c',
1737 include_directories : includes,
1738 link_with : [libcore_shared,
1739 libshared],
1740 install_rpath : rootlibexecdir,
1741 install : true,
1742 install_dir : systemgeneratordir)
1743
1744 if conf.get('ENABLE_ENVIRONMENT_D') == 1
1745 executable('30-systemd-environment-d-generator',
1746 'src/environment-d-generator/environment-d-generator.c',
1747 include_directories : includes,
1748 link_with : [libshared],
1749 install_rpath : rootlibexecdir,
1750 install : true,
1751 install_dir : userenvgeneratordir)
1752
1753 meson.add_install_script(meson_make_symlink,
1754 join_paths(sysconfdir, 'environment'),
1755 join_paths(environmentdir, '99-environment.conf'))
1756 endif
1757
1758 if conf.get('ENABLE_HIBERNATE') == 1
1759 executable('systemd-hibernate-resume-generator',
1760 'src/hibernate-resume/hibernate-resume-generator.c',
1761 include_directories : includes,
1762 link_with : [libshared],
1763 install_rpath : rootlibexecdir,
1764 install : true,
1765 install_dir : systemgeneratordir)
1766
1767 executable('systemd-hibernate-resume',
1768 'src/hibernate-resume/hibernate-resume.c',
1769 include_directories : includes,
1770 link_with : [libshared],
1771 install_rpath : rootlibexecdir,
1772 install : true,
1773 install_dir : rootlibexecdir)
1774 endif
1775
1776 if conf.get('HAVE_BLKID') == 1
1777 executable('systemd-gpt-auto-generator',
1778 'src/gpt-auto-generator/gpt-auto-generator.c',
1779 'src/shared/blkid-util.h',
1780 include_directories : includes,
1781 link_with : [libshared],
1782 dependencies : libblkid,
1783 install_rpath : rootlibexecdir,
1784 install : true,
1785 install_dir : systemgeneratordir)
1786
1787 exe = executable('systemd-dissect',
1788 'src/dissect/dissect.c',
1789 include_directories : includes,
1790 link_with : [libshared],
1791 install_rpath : rootlibexecdir,
1792 install : true,
1793 install_dir : rootlibexecdir)
1794 public_programs += exe
1795 endif
1796
1797 if conf.get('ENABLE_RESOLVE') == 1
1798 executable('systemd-resolved',
1799 systemd_resolved_sources,
1800 include_directories : includes,
1801 link_with : [libshared,
1802 libbasic_gcrypt,
1803 libsystemd_resolve_core],
1804 dependencies : systemd_resolved_dependencies,
1805 install_rpath : rootlibexecdir,
1806 install : true,
1807 install_dir : rootlibexecdir)
1808
1809 exe = executable('resolvectl',
1810 resolvectl_sources,
1811 include_directories : includes,
1812 link_with : [libshared,
1813 libbasic_gcrypt,
1814 libsystemd_resolve_core],
1815 dependencies : [threads,
1816 libgpg_error,
1817 libm,
1818 libidn],
1819 install_rpath : rootlibexecdir,
1820 install : true)
1821 public_programs += exe
1822
1823 meson.add_install_script(meson_make_symlink,
1824 join_paths(bindir, 'resolvectl'),
1825 join_paths(rootsbindir, 'resolvconf'))
1826
1827 meson.add_install_script(meson_make_symlink,
1828 join_paths(bindir, 'resolvectl'),
1829 join_paths(bindir, 'systemd-resolve'))
1830 endif
1831
1832 if conf.get('ENABLE_LOGIND') == 1
1833 executable('systemd-logind',
1834 systemd_logind_sources,
1835 include_directories : includes,
1836 link_with : [liblogind_core,
1837 libshared],
1838 dependencies : [threads,
1839 libacl],
1840 install_rpath : rootlibexecdir,
1841 install : true,
1842 install_dir : rootlibexecdir)
1843
1844 exe = executable('loginctl',
1845 loginctl_sources,
1846 include_directories : includes,
1847 link_with : [libshared],
1848 dependencies : [threads,
1849 liblz4,
1850 libxz],
1851 install_rpath : rootlibexecdir,
1852 install : true,
1853 install_dir : rootbindir)
1854 public_programs += exe
1855
1856 exe = executable('systemd-inhibit',
1857 'src/login/inhibit.c',
1858 include_directories : includes,
1859 link_with : [libshared],
1860 install_rpath : rootlibexecdir,
1861 install : true,
1862 install_dir : rootbindir)
1863 public_programs += exe
1864
1865 if conf.get('HAVE_PAM') == 1
1866 version_script_arg = join_paths(project_source_root, pam_systemd_sym)
1867 pam_systemd = shared_library(
1868 'pam_systemd',
1869 pam_systemd_c,
1870 name_prefix : '',
1871 include_directories : includes,
1872 link_args : ['-shared',
1873 '-Wl,--version-script=' + version_script_arg],
1874 link_with : [libsystemd_static,
1875 libshared_static],
1876 dependencies : [threads,
1877 libpam,
1878 libpam_misc],
1879 link_depends : pam_systemd_sym,
1880 install : true,
1881 install_dir : pamlibdir)
1882
1883 if want_tests != 'false'
1884 test('dlopen-pam_systemd',
1885 test_dlopen,
1886 # path to dlopen must include a slash
1887 args : pam_systemd.full_path())
1888 endif
1889 endif
1890
1891 executable('systemd-user-runtime-dir',
1892 user_runtime_dir_sources,
1893 include_directories : includes,
1894 link_with : [libshared],
1895 install_rpath : rootlibexecdir,
1896 install : true,
1897 install_dir : rootlibexecdir)
1898 endif
1899
1900 if conf.get('HAVE_PAM') == 1
1901 executable('systemd-user-sessions',
1902 'src/user-sessions/user-sessions.c',
1903 include_directories : includes,
1904 link_with : [libshared],
1905 install_rpath : rootlibexecdir,
1906 install : true,
1907 install_dir : rootlibexecdir)
1908 endif
1909
1910 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1911 exe = executable('bootctl',
1912 'src/boot/bootctl.c',
1913 include_directories : includes,
1914 link_with : [libshared],
1915 dependencies : [libblkid],
1916 install_rpath : rootlibexecdir,
1917 install : true)
1918 public_programs += exe
1919
1920 executable('systemd-bless-boot',
1921 'src/boot/bless-boot.c',
1922 include_directories : includes,
1923 link_with : [libshared],
1924 dependencies : [libblkid],
1925 install_rpath : rootlibexecdir,
1926 install : true,
1927 install_dir : rootlibexecdir)
1928
1929 executable('systemd-bless-boot-generator',
1930 'src/boot/bless-boot-generator.c',
1931 include_directories : includes,
1932 link_with : [libshared],
1933 install_rpath : rootlibexecdir,
1934 install : true,
1935 install_dir : systemgeneratordir)
1936 endif
1937
1938 executable('systemd-boot-check-no-failures',
1939 'src/boot/boot-check-no-failures.c',
1940 include_directories : includes,
1941 link_with : [libshared],
1942 dependencies : [libblkid],
1943 install_rpath : rootlibexecdir,
1944 install : true,
1945 install_dir : rootlibexecdir)
1946
1947 exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1948 include_directories : includes,
1949 link_with : [libshared],
1950 dependencies : [threads],
1951 install_rpath : rootlibexecdir,
1952 install : true)
1953 public_programs += exe
1954
1955
1956 if get_option('link-systemctl-shared')
1957 systemctl_link_with = [libshared]
1958 else
1959 systemctl_link_with = [libsystemd_static,
1960 libshared_static,
1961 libjournal_client,
1962 libbasic_gcrypt]
1963 endif
1964
1965 exe = executable('systemctl',
1966 'src/systemctl/systemctl.c',
1967 'src/systemctl/sysv-compat.h',
1968 'src/systemctl/sysv-compat.c',
1969 include_directories : includes,
1970 link_with : systemctl_link_with,
1971 dependencies : [threads,
1972 libcap,
1973 libselinux,
1974 libxz,
1975 liblz4],
1976 install_rpath : rootlibexecdir,
1977 install : true,
1978 install_dir : rootbindir)
1979 public_programs += exe
1980
1981 if conf.get('ENABLE_PORTABLED') == 1
1982 executable('systemd-portabled',
1983 systemd_portabled_sources,
1984 include_directories : includes,
1985 link_with : [libshared],
1986 dependencies : [threads],
1987 install_rpath : rootlibexecdir,
1988 install : true,
1989 install_dir : rootlibexecdir)
1990
1991 exe = executable('portablectl', 'src/portable/portablectl.c',
1992 include_directories : includes,
1993 link_with : [libshared],
1994 dependencies : [threads],
1995 install_rpath : rootlibexecdir,
1996 install : true,
1997 install_dir : rootbindir)
1998 public_programs += exe
1999 endif
2000
2001 foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit']
2002 meson.add_install_script(meson_make_symlink,
2003 join_paths(rootbindir, 'systemctl'),
2004 join_paths(rootsbindir, alias))
2005 endforeach
2006
2007 if conf.get('ENABLE_BACKLIGHT') == 1
2008 executable('systemd-backlight',
2009 'src/backlight/backlight.c',
2010 include_directories : includes,
2011 link_with : [libshared],
2012 install_rpath : rootlibexecdir,
2013 install : true,
2014 install_dir : rootlibexecdir)
2015 endif
2016
2017 if conf.get('ENABLE_RFKILL') == 1
2018 executable('systemd-rfkill',
2019 'src/rfkill/rfkill.c',
2020 include_directories : includes,
2021 link_with : [libshared],
2022 install_rpath : rootlibexecdir,
2023 install : true,
2024 install_dir : rootlibexecdir)
2025 endif
2026
2027 executable('systemd-system-update-generator',
2028 'src/system-update-generator/system-update-generator.c',
2029 include_directories : includes,
2030 link_with : [libshared],
2031 install_rpath : rootlibexecdir,
2032 install : true,
2033 install_dir : systemgeneratordir)
2034
2035 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2036 executable('systemd-cryptsetup',
2037 'src/cryptsetup/cryptsetup.c',
2038 include_directories : includes,
2039 link_with : [libshared],
2040 dependencies : [libcryptsetup],
2041 install_rpath : rootlibexecdir,
2042 install : true,
2043 install_dir : rootlibexecdir)
2044
2045 executable('systemd-cryptsetup-generator',
2046 'src/cryptsetup/cryptsetup-generator.c',
2047 include_directories : includes,
2048 link_with : [libshared],
2049 dependencies : [libcryptsetup],
2050 install_rpath : rootlibexecdir,
2051 install : true,
2052 install_dir : systemgeneratordir)
2053
2054 executable('systemd-veritysetup',
2055 'src/veritysetup/veritysetup.c',
2056 include_directories : includes,
2057 link_with : [libshared],
2058 dependencies : [libcryptsetup],
2059 install_rpath : rootlibexecdir,
2060 install : true,
2061 install_dir : rootlibexecdir)
2062
2063 executable('systemd-veritysetup-generator',
2064 'src/veritysetup/veritysetup-generator.c',
2065 include_directories : includes,
2066 link_with : [libshared],
2067 dependencies : [libcryptsetup],
2068 install_rpath : rootlibexecdir,
2069 install : true,
2070 install_dir : systemgeneratordir)
2071 endif
2072
2073 if conf.get('HAVE_SYSV_COMPAT') == 1
2074 executable('systemd-sysv-generator',
2075 'src/sysv-generator/sysv-generator.c',
2076 include_directories : includes,
2077 link_with : [libshared],
2078 install_rpath : rootlibexecdir,
2079 install : true,
2080 install_dir : systemgeneratordir)
2081
2082 executable('systemd-rc-local-generator',
2083 'src/rc-local-generator/rc-local-generator.c',
2084 include_directories : includes,
2085 link_with : [libshared],
2086 install_rpath : rootlibexecdir,
2087 install : true,
2088 install_dir : systemgeneratordir)
2089 endif
2090
2091 if conf.get('ENABLE_HOSTNAMED') == 1
2092 executable('systemd-hostnamed',
2093 'src/hostname/hostnamed.c',
2094 include_directories : includes,
2095 link_with : [libshared],
2096 install_rpath : rootlibexecdir,
2097 install : true,
2098 install_dir : rootlibexecdir)
2099
2100 exe = executable('hostnamectl',
2101 'src/hostname/hostnamectl.c',
2102 include_directories : includes,
2103 link_with : [libshared],
2104 install_rpath : rootlibexecdir,
2105 install : true)
2106 public_programs += exe
2107 endif
2108
2109 if conf.get('ENABLE_LOCALED') == 1
2110 if conf.get('HAVE_XKBCOMMON') == 1
2111 # logind will load libxkbcommon.so dynamically on its own
2112 deps = [libdl]
2113 else
2114 deps = []
2115 endif
2116
2117 executable('systemd-localed',
2118 systemd_localed_sources,
2119 include_directories : includes,
2120 link_with : [libshared],
2121 dependencies : deps,
2122 install_rpath : rootlibexecdir,
2123 install : true,
2124 install_dir : rootlibexecdir)
2125
2126 exe = executable('localectl',
2127 localectl_sources,
2128 include_directories : includes,
2129 link_with : [libshared],
2130 install_rpath : rootlibexecdir,
2131 install : true)
2132 public_programs += exe
2133 endif
2134
2135 if conf.get('ENABLE_TIMEDATED') == 1
2136 executable('systemd-timedated',
2137 'src/timedate/timedated.c',
2138 include_directories : includes,
2139 link_with : [libshared],
2140 install_rpath : rootlibexecdir,
2141 install : true,
2142 install_dir : rootlibexecdir)
2143 endif
2144
2145 if conf.get('ENABLE_TIMEDATECTL') == 1
2146 exe = executable('timedatectl',
2147 'src/timedate/timedatectl.c',
2148 include_directories : includes,
2149 install_rpath : rootlibexecdir,
2150 link_with : [libshared],
2151 dependencies : [libm],
2152 install : true)
2153 public_programs += exe
2154 endif
2155
2156 if conf.get('ENABLE_TIMESYNCD') == 1
2157 executable('systemd-timesyncd',
2158 systemd_timesyncd_sources,
2159 include_directories : includes,
2160 link_with : [libshared],
2161 dependencies : [threads,
2162 libm],
2163 install_rpath : rootlibexecdir,
2164 install : true,
2165 install_dir : rootlibexecdir)
2166
2167 executable('systemd-time-wait-sync',
2168 'src/time-wait-sync/time-wait-sync.c',
2169 include_directories : includes,
2170 link_with : [libshared],
2171 install_rpath : rootlibexecdir,
2172 install : true,
2173 install_dir : rootlibexecdir)
2174 endif
2175
2176 if conf.get('ENABLE_MACHINED') == 1
2177 executable('systemd-machined',
2178 systemd_machined_sources,
2179 include_directories : includes,
2180 link_with : [libmachine_core,
2181 libshared],
2182 install_rpath : rootlibexecdir,
2183 install : true,
2184 install_dir : rootlibexecdir)
2185
2186 exe = executable('machinectl',
2187 'src/machine/machinectl.c',
2188 include_directories : includes,
2189 link_with : [libshared],
2190 dependencies : [threads,
2191 libxz,
2192 liblz4],
2193 install_rpath : rootlibexecdir,
2194 install : true,
2195 install_dir : rootbindir)
2196 public_programs += exe
2197 endif
2198
2199 if conf.get('ENABLE_IMPORTD') == 1
2200 executable('systemd-importd',
2201 systemd_importd_sources,
2202 include_directories : includes,
2203 link_with : [libshared],
2204 dependencies : [threads],
2205 install_rpath : rootlibexecdir,
2206 install : true,
2207 install_dir : rootlibexecdir)
2208
2209 systemd_pull = executable('systemd-pull',
2210 systemd_pull_sources,
2211 include_directories : includes,
2212 link_with : [libshared],
2213 dependencies : [versiondep,
2214 libcurl,
2215 libz,
2216 libbzip2,
2217 libxz,
2218 libgcrypt],
2219 install_rpath : rootlibexecdir,
2220 install : true,
2221 install_dir : rootlibexecdir)
2222
2223 systemd_import = executable('systemd-import',
2224 systemd_import_sources,
2225 include_directories : includes,
2226 link_with : [libshared],
2227 dependencies : [libcurl,
2228 libz,
2229 libbzip2,
2230 libxz],
2231 install_rpath : rootlibexecdir,
2232 install : true,
2233 install_dir : rootlibexecdir)
2234
2235 systemd_import_fs = executable('systemd-import-fs',
2236 systemd_import_fs_sources,
2237 include_directories : includes,
2238 link_with : [libshared],
2239 install_rpath : rootlibexecdir,
2240 install : true,
2241 install_dir : rootlibexecdir)
2242
2243 systemd_export = executable('systemd-export',
2244 systemd_export_sources,
2245 include_directories : includes,
2246 link_with : [libshared],
2247 dependencies : [libcurl,
2248 libz,
2249 libbzip2,
2250 libxz],
2251 install_rpath : rootlibexecdir,
2252 install : true,
2253 install_dir : rootlibexecdir)
2254
2255 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2256 endif
2257
2258 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2259 exe = executable('systemd-journal-upload',
2260 systemd_journal_upload_sources,
2261 include_directories : includes,
2262 link_with : [libshared],
2263 dependencies : [versiondep,
2264 threads,
2265 libcurl,
2266 libgnutls,
2267 libxz,
2268 liblz4],
2269 install_rpath : rootlibexecdir,
2270 install : true,
2271 install_dir : rootlibexecdir)
2272 public_programs += exe
2273 endif
2274
2275 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2276 s_j_remote = executable('systemd-journal-remote',
2277 systemd_journal_remote_sources,
2278 include_directories : includes,
2279 link_with : [libshared,
2280 libsystemd_journal_remote],
2281 dependencies : [threads,
2282 libmicrohttpd,
2283 libgnutls,
2284 libxz,
2285 liblz4],
2286 install_rpath : rootlibexecdir,
2287 install : true,
2288 install_dir : rootlibexecdir)
2289
2290 s_j_gatewayd = executable('systemd-journal-gatewayd',
2291 systemd_journal_gatewayd_sources,
2292 include_directories : includes,
2293 link_with : [libshared],
2294 dependencies : [threads,
2295 libmicrohttpd,
2296 libgnutls,
2297 libxz,
2298 liblz4],
2299 install_rpath : rootlibexecdir,
2300 install : true,
2301 install_dir : rootlibexecdir)
2302 public_programs += [s_j_remote, s_j_gatewayd]
2303 endif
2304
2305 if conf.get('ENABLE_COREDUMP') == 1
2306 executable('systemd-coredump',
2307 systemd_coredump_sources,
2308 include_directories : includes,
2309 link_with : [libshared],
2310 dependencies : [threads,
2311 libacl,
2312 libdw,
2313 libxz,
2314 liblz4],
2315 install_rpath : rootlibexecdir,
2316 install : true,
2317 install_dir : rootlibexecdir)
2318
2319 exe = executable('coredumpctl',
2320 coredumpctl_sources,
2321 include_directories : includes,
2322 link_with : [libshared],
2323 dependencies : [threads,
2324 libxz,
2325 liblz4],
2326 install_rpath : rootlibexecdir,
2327 install : true)
2328 public_programs += exe
2329 endif
2330
2331 if conf.get('ENABLE_BINFMT') == 1
2332 exe = executable('systemd-binfmt',
2333 'src/binfmt/binfmt.c',
2334 include_directories : includes,
2335 link_with : [libshared],
2336 install_rpath : rootlibexecdir,
2337 install : true,
2338 install_dir : rootlibexecdir)
2339 public_programs += exe
2340
2341 meson.add_install_script('sh', '-c',
2342 mkdir_p.format(binfmtdir))
2343 meson.add_install_script('sh', '-c',
2344 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2345 endif
2346
2347 if conf.get('ENABLE_VCONSOLE') == 1
2348 executable('systemd-vconsole-setup',
2349 'src/vconsole/vconsole-setup.c',
2350 include_directories : includes,
2351 link_with : [libshared],
2352 install_rpath : rootlibexecdir,
2353 install : true,
2354 install_dir : rootlibexecdir)
2355 endif
2356
2357 if conf.get('ENABLE_RANDOMSEED') == 1
2358 executable('systemd-random-seed',
2359 'src/random-seed/random-seed.c',
2360 include_directories : includes,
2361 link_with : [libshared],
2362 install_rpath : rootlibexecdir,
2363 install : true,
2364 install_dir : rootlibexecdir)
2365 endif
2366
2367 if conf.get('ENABLE_FIRSTBOOT') == 1
2368 executable('systemd-firstboot',
2369 'src/firstboot/firstboot.c',
2370 include_directories : includes,
2371 link_with : [libshared],
2372 dependencies : [libcrypt],
2373 install_rpath : rootlibexecdir,
2374 install : true,
2375 install_dir : rootbindir)
2376 endif
2377
2378 executable('systemd-remount-fs',
2379 'src/remount-fs/remount-fs.c',
2380 include_directories : includes,
2381 link_with : [libcore_shared,
2382 libshared],
2383 install_rpath : rootlibexecdir,
2384 install : true,
2385 install_dir : rootlibexecdir)
2386
2387 executable('systemd-machine-id-setup',
2388 'src/machine-id-setup/machine-id-setup-main.c',
2389 include_directories : includes,
2390 link_with : [libcore_shared,
2391 libshared],
2392 install_rpath : rootlibexecdir,
2393 install : true,
2394 install_dir : rootbindir)
2395
2396 executable('systemd-fsck',
2397 'src/fsck/fsck.c',
2398 include_directories : includes,
2399 link_with : [libshared],
2400 install_rpath : rootlibexecdir,
2401 install : true,
2402 install_dir : rootlibexecdir)
2403
2404 executable('systemd-growfs',
2405 'src/partition/growfs.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('systemd-makefs',
2414 'src/partition/makefs.c',
2415 include_directories : includes,
2416 link_with : [libshared],
2417 install_rpath : rootlibexecdir,
2418 install : true,
2419 install_dir : rootlibexecdir)
2420
2421 executable('systemd-sleep',
2422 'src/sleep/sleep.c',
2423 include_directories : includes,
2424 link_with : [libshared],
2425 install_rpath : rootlibexecdir,
2426 install : true,
2427 install_dir : rootlibexecdir)
2428
2429 install_data('src/sleep/sleep.conf',
2430 install_dir : pkgsysconfdir)
2431
2432 exe = executable('systemd-sysctl',
2433 'src/sysctl/sysctl.c',
2434 include_directories : includes,
2435 link_with : [libshared],
2436 install_rpath : rootlibexecdir,
2437 install : true,
2438 install_dir : rootlibexecdir)
2439 public_programs += exe
2440
2441 executable('systemd-ac-power',
2442 'src/ac-power/ac-power.c',
2443 include_directories : includes,
2444 link_with : [libshared],
2445 install_rpath : rootlibexecdir,
2446 install : true,
2447 install_dir : rootlibexecdir)
2448
2449 exe = executable('systemd-detect-virt',
2450 'src/detect-virt/detect-virt.c',
2451 include_directories : includes,
2452 link_with : [libshared],
2453 install_rpath : rootlibexecdir,
2454 install : true)
2455 public_programs += exe
2456
2457 exe = executable('systemd-delta',
2458 'src/delta/delta.c',
2459 include_directories : includes,
2460 link_with : [libshared],
2461 install_rpath : rootlibexecdir,
2462 install : true)
2463 public_programs += exe
2464
2465 exe = executable('systemd-escape',
2466 'src/escape/escape.c',
2467 include_directories : includes,
2468 link_with : [libshared],
2469 install_rpath : rootlibexecdir,
2470 install : true,
2471 install_dir : rootbindir)
2472 public_programs += exe
2473
2474 exe = executable('systemd-notify',
2475 'src/notify/notify.c',
2476 include_directories : includes,
2477 link_with : [libshared],
2478 install_rpath : rootlibexecdir,
2479 install : true,
2480 install_dir : rootbindir)
2481 public_programs += exe
2482
2483 executable('systemd-volatile-root',
2484 'src/volatile-root/volatile-root.c',
2485 include_directories : includes,
2486 link_with : [libshared],
2487 install_rpath : rootlibexecdir,
2488 install : true,
2489 install_dir : rootlibexecdir)
2490
2491 executable('systemd-cgroups-agent',
2492 'src/cgroups-agent/cgroups-agent.c',
2493 include_directories : includes,
2494 link_with : [libshared],
2495 install_rpath : rootlibexecdir,
2496 install : true,
2497 install_dir : rootlibexecdir)
2498
2499 exe = executable('systemd-id128',
2500 'src/id128/id128.c',
2501 include_directories : includes,
2502 link_with : [libshared],
2503 install_rpath : rootlibexecdir,
2504 install : true)
2505 public_programs += exe
2506
2507 exe = executable('systemd-path',
2508 'src/path/path.c',
2509 include_directories : includes,
2510 link_with : [libshared],
2511 install_rpath : rootlibexecdir,
2512 install : true)
2513 public_programs += exe
2514
2515 exe = executable('systemd-ask-password',
2516 'src/ask-password/ask-password.c',
2517 include_directories : includes,
2518 link_with : [libshared],
2519 install_rpath : rootlibexecdir,
2520 install : true,
2521 install_dir : rootbindir)
2522 public_programs += exe
2523
2524 executable('systemd-reply-password',
2525 'src/reply-password/reply-password.c',
2526 include_directories : includes,
2527 link_with : [libshared],
2528 install_rpath : rootlibexecdir,
2529 install : true,
2530 install_dir : rootlibexecdir)
2531
2532 exe = executable('systemd-tty-ask-password-agent',
2533 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2534 include_directories : includes,
2535 link_with : [libshared],
2536 install_rpath : rootlibexecdir,
2537 install : true,
2538 install_dir : rootbindir)
2539 public_programs += exe
2540
2541 exe = executable('systemd-cgls',
2542 'src/cgls/cgls.c',
2543 include_directories : includes,
2544 link_with : [libshared],
2545 install_rpath : rootlibexecdir,
2546 install : true)
2547 public_programs += exe
2548
2549 exe = executable('systemd-cgtop',
2550 'src/cgtop/cgtop.c',
2551 include_directories : includes,
2552 link_with : [libshared],
2553 install_rpath : rootlibexecdir,
2554 install : true)
2555 public_programs += exe
2556
2557 executable('systemd-initctl',
2558 'src/initctl/initctl.c',
2559 include_directories : includes,
2560 link_with : [libshared],
2561 install_rpath : rootlibexecdir,
2562 install : true,
2563 install_dir : rootlibexecdir)
2564
2565 exe = executable('systemd-mount',
2566 'src/mount/mount-tool.c',
2567 include_directories : includes,
2568 link_with : [libshared],
2569 install_rpath : rootlibexecdir,
2570 install : true)
2571 public_programs += exe
2572
2573 meson.add_install_script(meson_make_symlink,
2574 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2575
2576 exe = executable('systemd-run',
2577 'src/run/run.c',
2578 include_directories : includes,
2579 link_with : [libshared],
2580 install_rpath : rootlibexecdir,
2581 install : true)
2582 public_programs += exe
2583
2584 exe = executable('systemd-stdio-bridge',
2585 'src/stdio-bridge/stdio-bridge.c',
2586 include_directories : includes,
2587 link_with : [libshared],
2588 dependencies : [versiondep],
2589 install_rpath : rootlibexecdir,
2590 install : true)
2591 public_programs += exe
2592
2593 exe = executable('busctl',
2594 'src/busctl/busctl.c',
2595 'src/busctl/busctl-introspect.c',
2596 'src/busctl/busctl-introspect.h',
2597 include_directories : includes,
2598 link_with : [libshared],
2599 install_rpath : rootlibexecdir,
2600 install : true)
2601 public_programs += exe
2602
2603 if conf.get('ENABLE_SYSUSERS') == 1
2604 exe = executable('systemd-sysusers',
2605 'src/sysusers/sysusers.c',
2606 include_directories : includes,
2607 link_with : [libshared],
2608 install_rpath : rootlibexecdir,
2609 install : true,
2610 install_dir : rootbindir)
2611 public_programs += exe
2612 endif
2613
2614 if conf.get('ENABLE_TMPFILES') == 1
2615 exe = executable('systemd-tmpfiles',
2616 'src/tmpfiles/tmpfiles.c',
2617 include_directories : includes,
2618 link_with : [libshared],
2619 dependencies : [libacl],
2620 install_rpath : rootlibexecdir,
2621 install : true,
2622 install_dir : rootbindir)
2623 public_programs += exe
2624
2625 if want_tests != 'false'
2626 test('test-systemd-tmpfiles',
2627 test_systemd_tmpfiles_py,
2628 # https://github.com/mesonbuild/meson/issues/2681
2629 args : exe.full_path())
2630 endif
2631 endif
2632
2633 if conf.get('ENABLE_HWDB') == 1
2634 exe = executable('systemd-hwdb',
2635 'src/hwdb/hwdb.c',
2636 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2637 include_directories : includes,
2638 link_with : [libudev_static],
2639 install_rpath : udev_rpath,
2640 install : true,
2641 install_dir : rootbindir)
2642 public_programs += exe
2643 endif
2644
2645 if conf.get('ENABLE_QUOTACHECK') == 1
2646 executable('systemd-quotacheck',
2647 'src/quotacheck/quotacheck.c',
2648 include_directories : includes,
2649 link_with : [libshared],
2650 install_rpath : rootlibexecdir,
2651 install : true,
2652 install_dir : rootlibexecdir)
2653 endif
2654
2655 exe = executable('systemd-socket-proxyd',
2656 'src/socket-proxy/socket-proxyd.c',
2657 include_directories : includes,
2658 link_with : [libshared],
2659 dependencies : [threads],
2660 install_rpath : rootlibexecdir,
2661 install : true,
2662 install_dir : rootlibexecdir)
2663 public_programs += exe
2664
2665 exe = executable('systemd-udevd',
2666 systemd_udevd_sources,
2667 include_directories : includes,
2668 c_args : '-DLOG_REALM=LOG_REALM_UDEV',
2669 link_with : [libudev_core,
2670 libsystemd_network,
2671 libudev_static],
2672 dependencies : [versiondep,
2673 threads,
2674 libkmod,
2675 libidn,
2676 libacl,
2677 libblkid],
2678 install_rpath : udev_rpath,
2679 install : true,
2680 install_dir : rootlibexecdir)
2681 public_programs += exe
2682
2683 exe = executable('udevadm',
2684 udevadm_sources,
2685 c_args : '-DLOG_REALM=LOG_REALM_UDEV',
2686 include_directories : includes,
2687 link_with : [libudev_core,
2688 libsystemd_network,
2689 libudev_static],
2690 dependencies : [versiondep,
2691 threads,
2692 libkmod,
2693 libidn,
2694 libacl,
2695 libblkid],
2696 install_rpath : udev_rpath,
2697 install : true,
2698 install_dir : rootbindir)
2699 public_programs += exe
2700
2701 executable('systemd-shutdown',
2702 systemd_shutdown_sources,
2703 include_directories : includes,
2704 link_with : [libcore_shared,
2705 libshared],
2706 dependencies : [libmount],
2707 install_rpath : rootlibexecdir,
2708 install : true,
2709 install_dir : rootlibexecdir)
2710
2711 executable('systemd-update-done',
2712 'src/update-done/update-done.c',
2713 include_directories : includes,
2714 link_with : [libshared],
2715 install_rpath : rootlibexecdir,
2716 install : true,
2717 install_dir : rootlibexecdir)
2718
2719 executable('systemd-update-utmp',
2720 'src/update-utmp/update-utmp.c',
2721 include_directories : includes,
2722 link_with : [libshared],
2723 dependencies : [libaudit],
2724 install_rpath : rootlibexecdir,
2725 install : true,
2726 install_dir : rootlibexecdir)
2727
2728 if conf.get('HAVE_KMOD') == 1
2729 executable('systemd-modules-load',
2730 'src/modules-load/modules-load.c',
2731 include_directories : includes,
2732 link_with : [libshared],
2733 dependencies : [libkmod],
2734 install_rpath : rootlibexecdir,
2735 install : true,
2736 install_dir : rootlibexecdir)
2737
2738 meson.add_install_script('sh', '-c',
2739 mkdir_p.format(modulesloaddir))
2740 meson.add_install_script('sh', '-c',
2741 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2742 endif
2743
2744 exe = executable('systemd-nspawn',
2745 systemd_nspawn_sources,
2746 include_directories : includes,
2747 link_with : [libcore_shared,
2748 libnspawn_core,
2749 libshared],
2750 dependencies : [libblkid,
2751 libseccomp],
2752 install_rpath : rootlibexecdir,
2753 install : true)
2754 public_programs += exe
2755
2756 if conf.get('ENABLE_NETWORKD') == 1
2757 executable('systemd-networkd',
2758 systemd_networkd_sources,
2759 include_directories : includes,
2760 link_with : [libnetworkd_core,
2761 libsystemd_network,
2762 libudev_static,
2763 libshared],
2764 dependencies : [threads],
2765 install_rpath : rootlibexecdir,
2766 install : true,
2767 install_dir : rootlibexecdir)
2768
2769 executable('systemd-networkd-wait-online',
2770 systemd_networkd_wait_online_sources,
2771 include_directories : includes,
2772 link_with : [libnetworkd_core,
2773 libshared],
2774 install_rpath : rootlibexecdir,
2775 install : true,
2776 install_dir : rootlibexecdir)
2777
2778 exe = executable('networkctl',
2779 networkctl_sources,
2780 include_directories : includes,
2781 link_with : [libsystemd_network,
2782 libshared],
2783 install_rpath : rootlibexecdir,
2784 install : true,
2785 install_dir : rootbindir)
2786 public_programs += exe
2787 endif
2788
2789 executable('systemd-sulogin-shell',
2790 ['src/sulogin-shell/sulogin-shell.c'],
2791 include_directories : includes,
2792 link_with : [libshared],
2793 install_rpath : rootlibexecdir,
2794 install : true,
2795 install_dir : rootlibexecdir)
2796
2797 ############################################################
2798
2799 custom_target(
2800 'systemd-runtest.env',
2801 output : 'systemd-runtest.env',
2802 command : ['sh', '-c', '{ ' +
2803 'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
2804 'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(meson.current_build_dir(), 'catalog')) +
2805 '} >@OUTPUT@'],
2806 build_by_default : true)
2807
2808 foreach tuple : tests
2809 sources = tuple[0]
2810 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2811 dependencies = tuple[2]
2812 condition = tuple.length() >= 4 ? tuple[3] : ''
2813 type = tuple.length() >= 5 ? tuple[4] : ''
2814 defs = tuple.length() >= 6 ? tuple[5] : []
2815 incs = tuple.length() >= 7 ? tuple[6] : includes
2816 timeout = 30
2817
2818 name = sources[0].split('/')[-1].split('.')[0]
2819 if type.startswith('timeout=')
2820 timeout = type.split('=')[1].to_int()
2821 type = ''
2822 endif
2823
2824 if condition == '' or conf.get(condition) == 1
2825 exe = executable(
2826 name,
2827 sources,
2828 include_directories : incs,
2829 link_with : link_with,
2830 dependencies : [versiondep,
2831 dependencies],
2832 c_args : defs,
2833 build_by_default : want_tests != 'false',
2834 install_rpath : rootlibexecdir,
2835 install : install_tests,
2836 install_dir : join_paths(testsdir, type))
2837
2838 if type == 'manual'
2839 message('@0@ is a manual test'.format(name))
2840 elif type == 'unsafe' and want_tests != 'unsafe'
2841 message('@0@ is an unsafe test'.format(name))
2842 elif want_tests != 'false'
2843 test(name, exe,
2844 env : test_env,
2845 timeout : timeout)
2846 endif
2847 else
2848 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2849 endif
2850 endforeach
2851
2852 exe = executable(
2853 'test-libsystemd-sym',
2854 test_libsystemd_sym_c,
2855 include_directories : includes,
2856 link_with : [libsystemd],
2857 build_by_default : want_tests != 'false',
2858 install : install_tests,
2859 install_dir : testsdir)
2860 if want_tests != 'false'
2861 test('test-libsystemd-sym', exe)
2862 endif
2863
2864 exe = executable(
2865 'test-libsystemd-static-sym',
2866 test_libsystemd_sym_c,
2867 include_directories : includes,
2868 link_with : [install_libsystemd_static],
2869 dependencies : [threads], # threads is already included in dependencies on the library,
2870 # but does not seem to get propagated. Add here as a work-around.
2871 build_by_default : want_tests != 'false' and static_libsystemd_pic,
2872 install : install_tests and static_libsystemd_pic,
2873 install_dir : testsdir)
2874 if want_tests != 'false' and static_libsystemd_pic
2875 test('test-libsystemd-static-sym', exe)
2876 endif
2877
2878 exe = executable(
2879 'test-libudev-sym',
2880 test_libudev_sym_c,
2881 include_directories : includes,
2882 c_args : '-Wno-deprecated-declarations',
2883 link_with : [libudev],
2884 build_by_default : want_tests != 'false',
2885 install : install_tests,
2886 install_dir : testsdir)
2887 if want_tests != 'false'
2888 test('test-libudev-sym', exe)
2889 endif
2890
2891 exe = executable(
2892 'test-libudev-static-sym',
2893 test_libudev_sym_c,
2894 include_directories : includes,
2895 c_args : '-Wno-deprecated-declarations',
2896 link_with : [install_libudev_static],
2897 build_by_default : want_tests != 'false' and static_libudev_pic,
2898 install : install_tests and static_libudev_pic,
2899 install_dir : testsdir)
2900 if want_tests != 'false' and static_libudev_pic
2901 test('test-libudev-static-sym', exe)
2902 endif
2903
2904 ############################################################
2905
2906 fuzzer_exes = []
2907
2908 if get_option('tests') != 'false'
2909 foreach tuple : fuzzers
2910 sources = tuple[0]
2911 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2912 dependencies = tuple[2]
2913 defs = tuple.length() >= 4 ? tuple[3] : []
2914 incs = tuple.length() >= 5 ? tuple[4] : includes
2915
2916 if fuzzer_build
2917 dependencies += fuzzing_engine
2918 else
2919 sources += 'src/fuzz/fuzz-main.c'
2920 endif
2921
2922 name = sources[0].split('/')[-1].split('.')[0]
2923
2924 fuzzer_exes += executable(
2925 name,
2926 sources,
2927 include_directories : [incs, include_directories('src/fuzz')],
2928 link_with : link_with,
2929 dependencies : dependencies,
2930 c_args : defs,
2931 install : false)
2932 endforeach
2933 endif
2934
2935 run_target('fuzzers',
2936 depends : fuzzer_exes,
2937 command : ['true'])
2938
2939 ############################################################
2940
2941 make_directive_index_py = find_program('tools/make-directive-index.py')
2942 make_man_index_py = find_program('tools/make-man-index.py')
2943 xml_helper_py = find_program('tools/xml_helper.py')
2944 hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2945
2946 subdir('units')
2947 subdir('sysctl.d')
2948 subdir('sysusers.d')
2949 subdir('tmpfiles.d')
2950 subdir('presets')
2951 subdir('hwdb')
2952 subdir('network')
2953 subdir('man')
2954 subdir('shell-completion/bash')
2955 subdir('shell-completion/zsh')
2956 subdir('docs/sysvinit')
2957 subdir('docs/var-log')
2958
2959 install_subdir('factory/etc',
2960 install_dir : factorydir)
2961
2962 install_data('xorg/50-systemd-user.sh',
2963 install_dir : xinitrcdir)
2964 install_data('modprobe.d/systemd.conf',
2965 install_dir : modprobedir)
2966 install_data('LICENSE.GPL2',
2967 'LICENSE.LGPL2.1',
2968 'NEWS',
2969 'README',
2970 'docs/CODING_STYLE.md',
2971 'docs/DISTRO_PORTING.md',
2972 'docs/ENVIRONMENT.md',
2973 'docs/HACKING.md',
2974 'docs/TRANSIENT-SETTINGS.md',
2975 'docs/TRANSLATORS.md',
2976 'docs/UIDS-GIDS.md',
2977 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2978 install_dir : docdir)
2979
2980 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2981 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2982
2983 ############################################################
2984
2985 meson_check_help = find_program('tools/meson-check-help.sh')
2986
2987 foreach exec : public_programs
2988 name = exec.full_path().split('/')[-1]
2989 if want_tests != 'false'
2990 test('check-help-' + name,
2991 meson_check_help,
2992 args : exec.full_path())
2993 endif
2994 endforeach
2995
2996 ############################################################
2997
2998 # Enable tests for all supported sanitizers
2999 foreach tuple : sanitizers
3000 sanitizer = tuple[0]
3001 build = tuple[1]
3002
3003 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3004 prev = ''
3005 foreach p : fuzz_regression_tests
3006 b = p.split('/')[-2]
3007 c = p.split('/')[-1]
3008
3009 name = '@0@:@1@'.format(b, sanitizer)
3010
3011 if name != prev
3012 if want_tests == 'false'
3013 message('Not compiling @0@ because tests is set to false'.format(name))
3014 elif slow_tests
3015 exe = custom_target(
3016 name,
3017 output : name,
3018 depends : build,
3019 command : [env, 'ln', '-fs',
3020 join_paths(build.full_path(), b),
3021 '@OUTPUT@'],
3022 build_by_default : true)
3023 else
3024 message('Not compiling @0@ because slow-tests is set to false'.format(name))
3025 endif
3026 endif
3027 prev = name
3028
3029 if want_tests != 'false' and slow_tests
3030 test('@0@:@1@:@2@'.format(b, c, sanitizer),
3031 env,
3032 args : [exe.full_path(),
3033 join_paths(project_source_root, p)])
3034 endif
3035 endforeach
3036 endif
3037 endforeach
3038
3039
3040 ############################################################
3041
3042 if git.found()
3043 all_files = run_command(
3044 git,
3045 ['--git-dir=@0@/.git'.format(project_source_root),
3046 'ls-files',
3047 ':/*.[ch]'])
3048 all_files = files(all_files.stdout().split())
3049
3050 custom_target(
3051 'tags',
3052 output : 'tags',
3053 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
3054 run_target(
3055 'ctags',
3056 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
3057 endif
3058
3059 if git.found()
3060 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
3061 run_target(
3062 'git-contrib',
3063 command : [meson_git_contrib_sh])
3064 endif
3065
3066 if git.found()
3067 git_head = run_command(
3068 git,
3069 ['--git-dir=@0@/.git'.format(project_source_root),
3070 'rev-parse', 'HEAD']).stdout().strip()
3071 git_head_short = run_command(
3072 git,
3073 ['--git-dir=@0@/.git'.format(project_source_root),
3074 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3075
3076 run_target(
3077 'git-snapshot',
3078 command : ['git', 'archive',
3079 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
3080 git_head_short),
3081 '--prefix', 'systemd-@0@/'.format(git_head),
3082 'HEAD'])
3083 endif
3084
3085 ############################################################
3086
3087 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
3088 run_target(
3089 'check-api-docs',
3090 depends : [man, libsystemd, libudev],
3091 command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3092
3093 ############################################################
3094
3095 status = [
3096 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3097
3098 'split /usr: @0@'.format(split_usr),
3099 'split bin-sbin: @0@'.format(split_bin),
3100 'prefix directory: @0@'.format(prefixdir),
3101 'rootprefix directory: @0@'.format(rootprefixdir),
3102 'sysconf directory: @0@'.format(sysconfdir),
3103 'include directory: @0@'.format(includedir),
3104 'lib directory: @0@'.format(libdir),
3105 'rootlib directory: @0@'.format(rootlibdir),
3106 'SysV init scripts: @0@'.format(sysvinit_path),
3107 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3108 'PAM modules directory: @0@'.format(pamlibdir),
3109 'PAM configuration directory: @0@'.format(pamconfdir),
3110 'RPM macros directory: @0@'.format(rpmmacrosdir),
3111 'modprobe.d directory: @0@'.format(modprobedir),
3112 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3113 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3114 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3115 'bash completions directory: @0@'.format(bashcompletiondir),
3116 'zsh completions directory: @0@'.format(zshcompletiondir),
3117 'extra start script: @0@'.format(get_option('rc-local')),
3118 'extra stop script: @0@'.format(get_option('halt-local')),
3119 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3120 get_option('debug-tty')),
3121 'TTY GID: @0@'.format(tty_gid),
3122 'users GID: @0@'.format(substs.get('USERS_GID')),
3123 'maximum system UID: @0@'.format(system_uid_max),
3124 'maximum system GID: @0@'.format(system_gid_max),
3125 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
3126 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
3127 'minimum container UID base: @0@'.format(container_uid_base_min),
3128 'maximum container UID base: @0@'.format(container_uid_base_max),
3129 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3130 'render group access mode: @0@'.format(get_option('group-render-mode')),
3131 'certificate root directory: @0@'.format(get_option('certificate-root')),
3132 'support URL: @0@'.format(support_url),
3133 'nobody user name: @0@'.format(nobody_user),
3134 'nobody group name: @0@'.format(nobody_group),
3135 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3136 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
3137
3138 'default DNSSEC mode: @0@'.format(default_dnssec),
3139 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
3140 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3141 'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
3142 'default KillUserProcesses setting: @0@'.format(kill_user_processes),
3143 'default locale: @0@'.format(default_locale)]
3144
3145 alt_dns_servers = '\n '.join(dns_servers.split(' '))
3146 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3147 status += [
3148 'default DNS servers: @0@'.format(alt_dns_servers),
3149 'default NTP servers: @0@'.format(alt_ntp_servers)]
3150
3151 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3152 '@@0@'.format(time_epoch)).stdout().strip()
3153 status += [
3154 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3155
3156 status += [
3157 'static libsystemd: @0@'.format(static_libsystemd),
3158 'static libudev: @0@'.format(static_libudev)]
3159
3160 # TODO:
3161 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3162 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3163 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3164
3165 if conf.get('ENABLE_EFI') == 1
3166 status += 'efi arch: @0@'.format(efi_arch)
3167
3168 if have_gnu_efi
3169 status += [
3170 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3171 'EFI CC @0@'.format(' '.join(efi_cc)),
3172 'EFI lib directory: @0@'.format(efi_libdir),
3173 'EFI lds directory: @0@'.format(efi_ldsdir),
3174 'EFI include directory: @0@'.format(efi_incdir)]
3175 endif
3176 endif
3177
3178 found = []
3179 missing = []
3180
3181 foreach tuple : [
3182 ['libcryptsetup'],
3183 ['PAM'],
3184 ['AUDIT'],
3185 ['IMA'],
3186 ['AppArmor'],
3187 ['SELinux'],
3188 ['SECCOMP'],
3189 ['SMACK'],
3190 ['zlib'],
3191 ['xz'],
3192 ['lz4'],
3193 ['bzip2'],
3194 ['ACL'],
3195 ['gcrypt'],
3196 ['qrencode'],
3197 ['microhttpd'],
3198 ['gnutls'],
3199 ['openssl'],
3200 ['libcurl'],
3201 ['idn'],
3202 ['libidn2'],
3203 ['libidn'],
3204 ['libiptc'],
3205 ['elfutils'],
3206 ['binfmt'],
3207 ['vconsole'],
3208 ['quotacheck'],
3209 ['tmpfiles'],
3210 ['environment.d'],
3211 ['sysusers'],
3212 ['firstboot'],
3213 ['randomseed'],
3214 ['backlight'],
3215 ['rfkill'],
3216 ['logind'],
3217 ['machined'],
3218 ['portabled'],
3219 ['importd'],
3220 ['hostnamed'],
3221 ['timedated'],
3222 ['timesyncd'],
3223 ['localed'],
3224 ['networkd'],
3225 ['resolve'],
3226 ['DNS-over-TLS(gnutls)', conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1],
3227 ['DNS-over-TLS(openssl)', conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1],
3228 ['coredump'],
3229 ['polkit'],
3230 ['legacy pkla', install_polkit_pkla],
3231 ['efi'],
3232 ['gnu-efi', have_gnu_efi],
3233 ['kmod'],
3234 ['xkbcommon'],
3235 ['pcre2'],
3236 ['blkid'],
3237 ['dbus'],
3238 ['glib'],
3239 ['nss-myhostname'],
3240 ['nss-mymachines'],
3241 ['nss-resolve'],
3242 ['nss-systemd'],
3243 ['hwdb'],
3244 ['tpm'],
3245 ['man pages', want_man],
3246 ['html pages', want_html],
3247 ['man page indices', want_man and have_lxml],
3248 ['SysV compat'],
3249 ['utmp'],
3250 ['ldconfig'],
3251 ['hibernate'],
3252 ['adm group', get_option('adm-group')],
3253 ['wheel group', get_option('wheel-group')],
3254 ['gshadow'],
3255 ['debug hashmap'],
3256 ['debug mmap cache'],
3257 ['debug siphash'],
3258 ['debug udev'],
3259 ['valgrind', conf.get('VALGRIND') == 1],
3260 ['trace logging', conf.get('LOG_TRACE') == 1],
3261 ['link-udev-shared', get_option('link-udev-shared')],
3262 ['link-systemctl-shared', get_option('link-systemctl-shared')],
3263 ]
3264
3265 if tuple.length() >= 2
3266 cond = tuple[1]
3267 else
3268 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3269 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3270 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3271 endif
3272 if cond
3273 found += tuple[0]
3274 else
3275 missing += tuple[0]
3276 endif
3277 endforeach
3278
3279 status += [
3280 '',
3281 'enabled features: @0@'.format(', '.join(found)),
3282 '',
3283 'disabled features: @0@'.format(', '.join(missing)),
3284 '']
3285 message('\n '.join(status))
3286
3287 if rootprefixdir != rootprefix_default
3288 warning('\n' +
3289 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3290 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3291 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
3292 endif