1 # SPDX-License-Identifier: LGPL-2.1+
3 project('systemd', 'c',
12 meson_version : '>= 0.46',
15 libsystemd_version = '0.25.0'
16 libudev_version = '1.6.13'
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
22 conf = configuration_data()
23 conf.set('PROJECT_VERSION', meson.project_version())
25 substs = configuration_data()
26 substs.set('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
27 substs.set('PROJECT_VERSION', meson.project_version())
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()
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')
38 fuzzer_build = want_ossfuzz or want_libfuzzer
40 #####################################################################
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())
48 #####################################################################
50 if get_option('split-usr') == 'auto'
51 split_usr = run_command('test', '-L', '/bin').returncode() != 0
53 split_usr = get_option('split-usr') == 'true'
55 conf.set10('HAVE_SPLIT_USR', split_usr,
56 description : '/usr/bin and /bin directories are separate')
58 if get_option('split-bin') == 'auto'
59 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
61 split_bin = get_option('split-bin') == 'true'
63 conf.set10('HAVE_SPLIT_BIN', split_bin,
64 description : 'bin and sbin directories are separate')
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
73 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
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')
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)
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))
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'))
98 rootbindir = join_paths(rootprefixdir, 'bin')
99 rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
100 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
102 rootlibdir = get_option('rootlibdir')
104 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
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)
119 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
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')
157 docdir = get_option('docdir')
159 docdir = join_paths(datadir, 'doc/systemd')
162 dbuspolicydir = get_option('dbuspolicydir')
163 if dbuspolicydir == ''
164 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
167 dbussessionservicedir = get_option('dbussessionservicedir')
168 if dbussessionservicedir == ''
169 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
172 dbussystemservicedir = get_option('dbussystemservicedir')
173 if dbussystemservicedir == ''
174 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
177 pamlibdir = get_option('pamlibdir')
179 pamlibdir = join_paths(rootlibdir, 'security')
182 pamconfdir = get_option('pamconfdir')
184 pamconfdir = join_paths(sysconfdir, 'pam.d')
187 memory_accounting_default = get_option('memory-accounting-default')
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'))
197 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
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')
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'))
286 #####################################################################
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')
293 want_tests = get_option('tests')
294 slow_tests = want_tests != 'false' and get_option('slow-tests')
295 install_tests = get_option('install-tests')
297 if add_languages('cpp', required : fuzzer_build)
298 # Used only for tests
299 cxx_cmd = ' '.join(meson.get_compiler('cpp').cmd_array())
305 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
307 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
310 possible_cc_flags = [
314 '-Wmissing-include-dirs',
315 '-Wold-style-definition',
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',
326 '-Wstrict-prototypes',
328 '-Wmissing-noreturn',
329 '-Wimplicit-fallthrough=5',
332 '-Wstrict-aliasing=2',
335 '-Werror=shift-count-overflow',
336 '-Werror=shift-overflow=2',
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
348 # work-around for gcc 7.1 turning this on on its own.
349 '-Wno-error=nonnull',
351 # Disable -Wmaybe-uninitialized, since it's noisy on gcc 8 with
352 # optimizations enabled, producing essentially false positives.
353 '-Wno-maybe-uninitialized',
357 '-fdiagnostics-show-option',
358 '-fno-strict-aliasing',
359 '-fvisibility=hidden',
361 '-fstack-protector-strong',
362 '--param=ssp-buffer-size=4',
365 # --as-needed and --no-undefined are provided by meson by default,
366 # run mesonconf to see what is enabled
367 possible_link_flags = [
372 if cc.get_id() == 'clang'
373 possible_cc_flags += [
374 '-Wno-typedef-redefinition',
375 '-Wno-gnu-variable-sized-type-not-at-end',
379 if get_option('buildtype') != 'debug'
380 possible_cc_flags += [
381 '-ffunction-sections',
385 possible_link_flags += '-Wl,--gc-sections'
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
392 possible_cc_flags += [
393 '-Wno-unused-variable',
394 '-Wno-unused-but-set-variable',
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')
403 #include <inttypes.h>
404 typedef uint64_t usec_t;
405 usec_t now(clockid_t clock);
410 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
411 add_project_arguments('-Werror=shadow', language : 'c')
414 cpp = ' '.join(cc.cmd_array()) + ' -E'
416 #####################################################################
417 # compilation result tests
419 conf.set('_GNU_SOURCE', true)
420 conf.set('__SANE_USERSPACE_TYPES__', true)
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>'))
432 #include <sys/stat.h>
435 foreach decl : ['char16_t',
440 # We get -1 if the size cannot be determined
441 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
443 if decl == 'struct statx'
445 want_linux_stat_h = false
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
454 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
457 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
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'],
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)
549 foreach ident : ['secure_getenv', '__secure_getenv']
550 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(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>'''],
579 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
580 conf.set10('HAVE_' + ident[0].to_upper(), have)
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)
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)
592 #####################################################################
594 vcs_tagger = [project_source_root + '/tools/meson-vcs-tag.sh',
596 get_option('version-tag'),
597 meson.project_version()]
600 input : 'src/version/version.h.in',
601 output : 'version.h',
604 versiondep = declare_dependency(sources: version_h)
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)
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')
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'],
632 path = get_option(prog[0] + '-path')
634 message('Using @1@ for @0@'.format(prog[0], path))
636 exe = find_program(prog[0],
637 '/usr/sbin/' + prog[0],
640 path = exe.found() ? exe.path() : prog[1]
642 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
643 conf.set_quoted(name, path)
644 substs.set(name, path)
647 conf.set_quoted('TELINIT', get_option('telinit-path'))
649 if run_command('ln', '--relative', '--help').returncode() != 0
650 error('ln does not support --relative (added in coreutils 8.16)')
653 ############################################################
655 gperf = find_program('gperf')
657 gperf_test_format = '''
659 const char * in_word_set(const char *, @0@);
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'
668 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
669 if cc.compiles(gperf_test)
670 gperf_len_type = 'unsigned'
672 error('unable to determine gperf len type')
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')
679 ############################################################
681 if not cc.has_header('sys/capability.h')
682 error('POSIX caps headers not found')
684 foreach header : ['crypt.h',
685 'linux/btrfs_tree.h',
688 'linux/vm_sockets.h',
691 'valgrind/memcheck.h',
692 'valgrind/valgrind.h',
695 conf.set10('HAVE_' + header.underscorify().to_upper(),
696 cc.has_header(header))
699 ############################################################
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'] : [])
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')
713 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
716 default_net_naming_scheme = get_option('default-net-naming-scheme')
717 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
719 time_epoch = get_option('time-epoch')
722 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout().to_int()
724 conf.set('TIME_EPOCH', time_epoch)
726 system_uid_max = get_option('system-uid-max')
727 if system_uid_max == -1
728 system_uid_max = run_command(
730 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
731 '/etc/login.defs').stdout().strip()
732 if system_uid_max == ''
735 system_uid_max = system_uid_max.to_int()
738 conf.set('SYSTEM_UID_MAX', system_uid_max)
739 substs.set('systemuidmax', system_uid_max)
741 system_gid_max = get_option('system-gid-max')
742 if system_gid_max == -1
743 system_gid_max = run_command(
745 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
746 '/etc/login.defs').stdout().strip()
747 if system_gid_max == ''
750 system_gid_max = system_gid_max.to_int()
753 conf.set('SYSTEM_GID_MAX', system_gid_max)
754 substs.set('systemgidmax', system_gid_max)
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)
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)
770 nobody_user = get_option('nobody-user')
771 nobody_group = get_option('nobody-group')
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
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.')
783 id_result = run_command('id', '-u', nobody_user)
784 if id_result.returncode() == 0
785 id = id_result.stdout().to_int()
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.')
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
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.')
802 id_result = run_command('id', '-g', nobody_group)
803 if id_result.returncode() == 0
804 id = id_result.stdout().to_int()
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.')
812 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
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.')
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)
823 tty_gid = get_option('tty-gid')
824 conf.set('TTY_GID', tty_gid)
825 substs.set('TTY_GID', tty_gid)
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)
831 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
832 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
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')
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')
846 dns_servers = get_option('dns-servers')
847 conf.set_quoted('DNS_SERVERS', dns_servers)
848 substs.set('DNS_SERVERS', dns_servers)
850 ntp_servers = get_option('ntp-servers')
851 conf.set_quoted('NTP_SERVERS', ntp_servers)
852 substs.set('NTP_SERVERS', ntp_servers)
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()
860 default_locale = 'C.UTF-8'
863 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
865 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
867 substs.set('SUSHELL', get_option('debug-shell'))
868 substs.set('DEBUGTTY', get_option('debug-tty'))
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')
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
882 enable_debug_udev = true
884 message('unknown debug option "@0@", ignoring'.format(name))
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)
892 conf.set10('VALGRIND', get_option('valgrind'))
893 conf.set10('LOG_TRACE', get_option('log-trace'))
895 #####################################################################
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')
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')
909 libmount = dependency('mount',
910 version : fuzzer_build ? '>= 0' : '>= 2.30')
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()
922 conf.set10('HAVE_SECCOMP', have)
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()
934 conf.set10('HAVE_SELINUX', have)
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()
945 conf.set10('HAVE_APPARMOR', have)
947 smack_run_label = get_option('smack-run-label')
948 if smack_run_label != ''
949 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
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
958 libpolkit = dependency('polkit-gobject-1',
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
965 conf.set10('ENABLE_POLKIT', install_polkit)
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()
975 conf.set10('HAVE_ACL', have)
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()
985 conf.set10('HAVE_AUDIT', have)
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()
995 conf.set10('HAVE_BLKID', have)
997 want_kmod = get_option('kmod')
998 if want_kmod != 'false' and not fuzzer_build
999 libkmod = dependency('libkmod',
1001 required : want_kmod == 'true')
1002 have = libkmod.found()
1007 conf.set10('HAVE_KMOD', have)
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()
1019 conf.set10('HAVE_PAM', have)
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()
1031 conf.set10('HAVE_MICROHTTPD', have)
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',
1042 prefix : '#include <libcryptsetup.h>')
1048 conf.set10('HAVE_LIBCRYPTSETUP', have)
1049 conf.set10('HAVE_LIBCRYPTSETUP_SECTOR_SIZE', have_sector)
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()
1061 conf.set10('HAVE_LIBCURL', have)
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')
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()
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()
1086 conf.set10('HAVE_LIBIDN2', have)
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()
1097 conf.set10('HAVE_LIBIPTC', have)
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()
1108 conf.set10('HAVE_QRENCODE', have)
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()
1119 # link to neither of the libs if one is not found
1123 conf.set10('HAVE_GCRYPT', have)
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()
1135 conf.set10('HAVE_GNUTLS', have)
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()
1147 conf.set10('HAVE_OPENSSL', have)
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()
1158 conf.set10('HAVE_ELFUTILS', have)
1160 want_zlib = get_option('zlib')
1161 if want_zlib != 'false' and not fuzzer_build
1162 libz = dependency('zlib',
1163 required : want_zlib == 'true')
1169 conf.set10('HAVE_ZLIB', have)
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()
1180 conf.set10('HAVE_BZIP2', have)
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()
1191 conf.set10('HAVE_XZ', have)
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()
1203 conf.set10('HAVE_LZ4', have)
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()
1215 conf.set10('HAVE_XKBCOMMON', have)
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()
1226 conf.set10('HAVE_PCRE2', have)
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()
1245 conf.set10('HAVE_GLIB', have)
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()
1257 conf.set10('HAVE_DBUS', have)
1259 default_dnssec = get_option('default-dnssec')
1261 default_dnssec = 'no'
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'
1267 conf.set('DEFAULT_DNSSEC_MODE',
1268 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1269 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1271 dns_over_tls = get_option('dns-over-tls')
1272 if dns_over_tls != 'false'
1273 if dns_over_tls == 'openssl'
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')
1281 if dns_over_tls == 'gnutls' or have_gnutls
1282 have_openssl = false
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))
1290 have = have_gnutls or have_openssl
1294 have_openssl = false
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)
1300 default_dns_over_tls = get_option('default-dns-over-tls')
1302 default_dns_over_tls = 'no'
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'
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)
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')
1324 conf.set10('ENABLE_IMPORTD', have)
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')
1337 have = have_deps[0] or have_deps[1]
1341 conf.set10('ENABLE_REMOTE', have)
1343 foreach term : ['utmp',
1375 have = get_option(term)
1376 name = 'ENABLE_' + term.underscorify().to_upper()
1377 conf.set10(name, have)
1380 foreach tuple : [['nss-mymachines', 'machined'],
1381 ['nss-resolve', 'resolve']]
1382 want = get_option(tuple[0])
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]))
1391 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1392 conf.set10(name, have)
1396 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1397 'ENABLE_NSS_MYMACHINES',
1398 'ENABLE_NSS_RESOLVE',
1399 'ENABLE_NSS_SYSTEMD']
1400 if conf.get(term) == 1
1404 conf.set10('ENABLE_NSS', enable_nss)
1406 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1411 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1413 #####################################################################
1415 if get_option('efi')
1416 efi_arch = host_machine.cpu_family()
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'
1431 EFI_MACHINE_TYPE_NAME = ''
1436 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1438 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
1442 conf.set10('ENABLE_EFI', have)
1444 #####################################################################
1446 config_h = configure_file(
1447 output : 'config.h',
1448 configuration : conf)
1450 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1452 includes = include_directories('src/basic',
1456 'src/journal-remote',
1460 'src/time-wait-sync',
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',
1477 add_project_arguments('-include', 'config.h', language : 'c')
1479 generate_gperfs = find_program('tools/generate-gperfs.py')
1483 subdir('src/systemd')
1485 subdir('src/libsystemd')
1486 subdir('src/libsystemd-network')
1487 subdir('src/journal')
1490 libjournal_core = static_library(
1492 libjournal_core_sources,
1494 include_directories : includes,
1497 libsystemd_sym_path = '@0@/@1@'.format(project_source_root, libsystemd_sym)
1498 libsystemd = shared_library(
1501 version : libsystemd_version,
1502 include_directories : includes,
1503 link_args : ['-shared',
1504 '-Wl,--version-script=' + libsystemd_sym_path],
1505 link_with : [libbasic,
1507 link_whole : [libsystemd_static,
1509 dependencies : [threads,
1513 link_depends : libsystemd_sym,
1515 install_dir : rootlibdir)
1517 static_libsystemd = get_option('static-libsystemd')
1518 static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
1520 install_libsystemd_static = static_library(
1523 journal_client_sources,
1525 basic_gcrypt_sources,
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,
1541 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1543 ############################################################
1545 # binaries that have --help and are intended for use by humans,
1546 # usually, but not always, installed in /bin.
1547 public_programs = []
1549 subdir('src/libudev')
1550 subdir('src/shared')
1552 subdir('src/shutdown')
1554 subdir('src/network')
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')
1577 ############################################################
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(
1585 include_directories : includes,
1586 link_with : [libbasic],
1587 dependencies : [libdl],
1588 build_by_default : want_tests != 'false')
1590 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
1591 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1592 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
1593 ['resolve', 'ENABLE_NSS_RESOLVE']]
1595 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1599 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1600 version_script_arg = join_paths(project_source_root, sym)
1602 nss = shared_library(
1604 'src/nss-@0@/nss-@0@.c'.format(module),
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',
1611 '-Wl,--version-script=' + version_script_arg,
1613 link_with : [libsystemd_static,
1615 dependencies : [threads,
1619 install_dir : rootlibdir)
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))
1627 if want_tests != 'false'
1628 test('dlopen-nss_' + module,
1630 # path to dlopen must include a slash
1631 args : nss.full_path())
1636 ############################################################
1638 executable('systemd',
1640 include_directories : includes,
1641 link_with : [libcore,
1643 dependencies : [versiondep,
1650 install_rpath : rootlibexecdir,
1652 install_dir : rootlibexecdir)
1654 meson.add_install_script(meson_make_symlink,
1655 join_paths(rootlibexecdir, 'systemd'),
1656 join_paths(rootsbindir, 'init'))
1658 exe = executable('systemd-analyze',
1659 systemd_analyze_sources,
1660 include_directories : includes,
1661 link_with : [libcore,
1663 dependencies : [versiondep,
1670 install_rpath : rootlibexecdir,
1672 public_programs += exe
1674 executable('systemd-journald',
1675 systemd_journald_sources,
1676 include_directories : includes,
1677 link_with : [libjournal_core,
1679 dependencies : [threads,
1683 install_rpath : rootlibexecdir,
1685 install_dir : rootlibexecdir)
1687 exe = executable('systemd-cat',
1688 systemd_cat_sources,
1689 include_directories : includes,
1690 link_with : [libjournal_core,
1692 dependencies : [threads],
1693 install_rpath : rootlibexecdir,
1695 public_programs += exe
1697 exe = executable('journalctl',
1699 include_directories : includes,
1700 link_with : [libshared],
1701 dependencies : [threads,
1706 install_rpath : rootlibexecdir,
1708 install_dir : rootbindir)
1709 public_programs += exe
1711 executable('systemd-getty-generator',
1712 'src/getty-generator/getty-generator.c',
1713 include_directories : includes,
1714 link_with : [libshared],
1715 install_rpath : rootlibexecdir,
1717 install_dir : systemgeneratordir)
1719 executable('systemd-debug-generator',
1720 'src/debug-generator/debug-generator.c',
1721 include_directories : includes,
1722 link_with : [libshared],
1723 install_rpath : rootlibexecdir,
1725 install_dir : systemgeneratordir)
1727 executable('systemd-run-generator',
1728 'src/run-generator/run-generator.c',
1729 include_directories : includes,
1730 link_with : [libshared],
1731 install_rpath : rootlibexecdir,
1733 install_dir : systemgeneratordir)
1735 executable('systemd-fstab-generator',
1736 'src/fstab-generator/fstab-generator.c',
1737 include_directories : includes,
1738 link_with : [libcore_shared,
1740 install_rpath : rootlibexecdir,
1742 install_dir : systemgeneratordir)
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,
1751 install_dir : userenvgeneratordir)
1753 meson.add_install_script(meson_make_symlink,
1754 join_paths(sysconfdir, 'environment'),
1755 join_paths(environmentdir, '99-environment.conf'))
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,
1765 install_dir : systemgeneratordir)
1767 executable('systemd-hibernate-resume',
1768 'src/hibernate-resume/hibernate-resume.c',
1769 include_directories : includes,
1770 link_with : [libshared],
1771 install_rpath : rootlibexecdir,
1773 install_dir : rootlibexecdir)
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,
1785 install_dir : systemgeneratordir)
1787 exe = executable('systemd-dissect',
1788 'src/dissect/dissect.c',
1789 include_directories : includes,
1790 link_with : [libshared],
1791 install_rpath : rootlibexecdir,
1793 install_dir : rootlibexecdir)
1794 public_programs += exe
1797 if conf.get('ENABLE_RESOLVE') == 1
1798 executable('systemd-resolved',
1799 systemd_resolved_sources,
1800 include_directories : includes,
1801 link_with : [libshared,
1803 libsystemd_resolve_core],
1804 dependencies : systemd_resolved_dependencies,
1805 install_rpath : rootlibexecdir,
1807 install_dir : rootlibexecdir)
1809 exe = executable('resolvectl',
1811 include_directories : includes,
1812 link_with : [libshared,
1814 libsystemd_resolve_core],
1815 dependencies : [threads,
1819 install_rpath : rootlibexecdir,
1821 public_programs += exe
1823 meson.add_install_script(meson_make_symlink,
1824 join_paths(bindir, 'resolvectl'),
1825 join_paths(rootsbindir, 'resolvconf'))
1827 meson.add_install_script(meson_make_symlink,
1828 join_paths(bindir, 'resolvectl'),
1829 join_paths(bindir, 'systemd-resolve'))
1832 if conf.get('ENABLE_LOGIND') == 1
1833 executable('systemd-logind',
1834 systemd_logind_sources,
1835 include_directories : includes,
1836 link_with : [liblogind_core,
1838 dependencies : [threads,
1840 install_rpath : rootlibexecdir,
1842 install_dir : rootlibexecdir)
1844 exe = executable('loginctl',
1846 include_directories : includes,
1847 link_with : [libshared],
1848 dependencies : [threads,
1851 install_rpath : rootlibexecdir,
1853 install_dir : rootbindir)
1854 public_programs += exe
1856 exe = executable('systemd-inhibit',
1857 'src/login/inhibit.c',
1858 include_directories : includes,
1859 link_with : [libshared],
1860 install_rpath : rootlibexecdir,
1862 install_dir : rootbindir)
1863 public_programs += exe
1865 if conf.get('HAVE_PAM') == 1
1866 version_script_arg = join_paths(project_source_root, pam_systemd_sym)
1867 pam_systemd = shared_library(
1871 include_directories : includes,
1872 link_args : ['-shared',
1873 '-Wl,--version-script=' + version_script_arg],
1874 link_with : [libsystemd_static,
1876 dependencies : [threads,
1879 link_depends : pam_systemd_sym,
1881 install_dir : pamlibdir)
1883 if want_tests != 'false'
1884 test('dlopen-pam_systemd',
1886 # path to dlopen must include a slash
1887 args : pam_systemd.full_path())
1891 executable('systemd-user-runtime-dir',
1892 user_runtime_dir_sources,
1893 include_directories : includes,
1894 link_with : [libshared],
1895 install_rpath : rootlibexecdir,
1897 install_dir : rootlibexecdir)
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,
1907 install_dir : rootlibexecdir)
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,
1918 public_programs += exe
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,
1927 install_dir : rootlibexecdir)
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,
1935 install_dir : systemgeneratordir)
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,
1945 install_dir : rootlibexecdir)
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,
1953 public_programs += exe
1956 if get_option('link-systemctl-shared')
1957 systemctl_link_with = [libshared]
1959 systemctl_link_with = [libsystemd_static,
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,
1976 install_rpath : rootlibexecdir,
1978 install_dir : rootbindir)
1979 public_programs += exe
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,
1989 install_dir : rootlibexecdir)
1991 exe = executable('portablectl', 'src/portable/portablectl.c',
1992 include_directories : includes,
1993 link_with : [libshared],
1994 dependencies : [threads],
1995 install_rpath : rootlibexecdir,
1997 install_dir : rootbindir)
1998 public_programs += exe
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))
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,
2014 install_dir : rootlibexecdir)
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,
2024 install_dir : rootlibexecdir)
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,
2033 install_dir : systemgeneratordir)
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,
2043 install_dir : rootlibexecdir)
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,
2052 install_dir : systemgeneratordir)
2054 executable('systemd-veritysetup',
2055 'src/veritysetup/veritysetup.c',
2056 include_directories : includes,
2057 link_with : [libshared],
2058 dependencies : [libcryptsetup],
2059 install_rpath : rootlibexecdir,
2061 install_dir : rootlibexecdir)
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,
2070 install_dir : systemgeneratordir)
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,
2080 install_dir : systemgeneratordir)
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,
2088 install_dir : systemgeneratordir)
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,
2098 install_dir : rootlibexecdir)
2100 exe = executable('hostnamectl',
2101 'src/hostname/hostnamectl.c',
2102 include_directories : includes,
2103 link_with : [libshared],
2104 install_rpath : rootlibexecdir,
2106 public_programs += exe
2109 if conf.get('ENABLE_LOCALED') == 1
2110 if conf.get('HAVE_XKBCOMMON') == 1
2111 # logind will load libxkbcommon.so dynamically on its own
2117 executable('systemd-localed',
2118 systemd_localed_sources,
2119 include_directories : includes,
2120 link_with : [libshared],
2121 dependencies : deps,
2122 install_rpath : rootlibexecdir,
2124 install_dir : rootlibexecdir)
2126 exe = executable('localectl',
2128 include_directories : includes,
2129 link_with : [libshared],
2130 install_rpath : rootlibexecdir,
2132 public_programs += exe
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,
2142 install_dir : rootlibexecdir)
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],
2153 public_programs += exe
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,
2163 install_rpath : rootlibexecdir,
2165 install_dir : rootlibexecdir)
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,
2173 install_dir : rootlibexecdir)
2176 if conf.get('ENABLE_MACHINED') == 1
2177 executable('systemd-machined',
2178 systemd_machined_sources,
2179 include_directories : includes,
2180 link_with : [libmachine_core,
2182 install_rpath : rootlibexecdir,
2184 install_dir : rootlibexecdir)
2186 exe = executable('machinectl',
2187 'src/machine/machinectl.c',
2188 include_directories : includes,
2189 link_with : [libshared],
2190 dependencies : [threads,
2193 install_rpath : rootlibexecdir,
2195 install_dir : rootbindir)
2196 public_programs += exe
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,
2207 install_dir : rootlibexecdir)
2209 systemd_pull = executable('systemd-pull',
2210 systemd_pull_sources,
2211 include_directories : includes,
2212 link_with : [libshared],
2213 dependencies : [versiondep,
2219 install_rpath : rootlibexecdir,
2221 install_dir : rootlibexecdir)
2223 systemd_import = executable('systemd-import',
2224 systemd_import_sources,
2225 include_directories : includes,
2226 link_with : [libshared],
2227 dependencies : [libcurl,
2231 install_rpath : rootlibexecdir,
2233 install_dir : rootlibexecdir)
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,
2241 install_dir : rootlibexecdir)
2243 systemd_export = executable('systemd-export',
2244 systemd_export_sources,
2245 include_directories : includes,
2246 link_with : [libshared],
2247 dependencies : [libcurl,
2251 install_rpath : rootlibexecdir,
2253 install_dir : rootlibexecdir)
2255 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
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,
2269 install_rpath : rootlibexecdir,
2271 install_dir : rootlibexecdir)
2272 public_programs += exe
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,
2286 install_rpath : rootlibexecdir,
2288 install_dir : rootlibexecdir)
2290 s_j_gatewayd = executable('systemd-journal-gatewayd',
2291 systemd_journal_gatewayd_sources,
2292 include_directories : includes,
2293 link_with : [libshared],
2294 dependencies : [threads,
2299 install_rpath : rootlibexecdir,
2301 install_dir : rootlibexecdir)
2302 public_programs += [s_j_remote, s_j_gatewayd]
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,
2315 install_rpath : rootlibexecdir,
2317 install_dir : rootlibexecdir)
2319 exe = executable('coredumpctl',
2320 coredumpctl_sources,
2321 include_directories : includes,
2322 link_with : [libshared],
2323 dependencies : [threads,
2326 install_rpath : rootlibexecdir,
2328 public_programs += exe
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,
2338 install_dir : rootlibexecdir)
2339 public_programs += exe
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')))
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,
2354 install_dir : rootlibexecdir)
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,
2364 install_dir : rootlibexecdir)
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,
2375 install_dir : rootbindir)
2378 executable('systemd-remount-fs',
2379 'src/remount-fs/remount-fs.c',
2380 include_directories : includes,
2381 link_with : [libcore_shared,
2383 install_rpath : rootlibexecdir,
2385 install_dir : rootlibexecdir)
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,
2392 install_rpath : rootlibexecdir,
2394 install_dir : rootbindir)
2396 executable('systemd-fsck',
2398 include_directories : includes,
2399 link_with : [libshared],
2400 install_rpath : rootlibexecdir,
2402 install_dir : rootlibexecdir)
2404 executable('systemd-growfs',
2405 'src/partition/growfs.c',
2406 include_directories : includes,
2407 link_with : [libshared],
2408 dependencies : [libcryptsetup],
2409 install_rpath : rootlibexecdir,
2411 install_dir : rootlibexecdir)
2413 executable('systemd-makefs',
2414 'src/partition/makefs.c',
2415 include_directories : includes,
2416 link_with : [libshared],
2417 install_rpath : rootlibexecdir,
2419 install_dir : rootlibexecdir)
2421 executable('systemd-sleep',
2422 'src/sleep/sleep.c',
2423 include_directories : includes,
2424 link_with : [libshared],
2425 install_rpath : rootlibexecdir,
2427 install_dir : rootlibexecdir)
2429 install_data('src/sleep/sleep.conf',
2430 install_dir : pkgsysconfdir)
2432 exe = executable('systemd-sysctl',
2433 'src/sysctl/sysctl.c',
2434 include_directories : includes,
2435 link_with : [libshared],
2436 install_rpath : rootlibexecdir,
2438 install_dir : rootlibexecdir)
2439 public_programs += exe
2441 executable('systemd-ac-power',
2442 'src/ac-power/ac-power.c',
2443 include_directories : includes,
2444 link_with : [libshared],
2445 install_rpath : rootlibexecdir,
2447 install_dir : rootlibexecdir)
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,
2455 public_programs += exe
2457 exe = executable('systemd-delta',
2458 'src/delta/delta.c',
2459 include_directories : includes,
2460 link_with : [libshared],
2461 install_rpath : rootlibexecdir,
2463 public_programs += exe
2465 exe = executable('systemd-escape',
2466 'src/escape/escape.c',
2467 include_directories : includes,
2468 link_with : [libshared],
2469 install_rpath : rootlibexecdir,
2471 install_dir : rootbindir)
2472 public_programs += exe
2474 exe = executable('systemd-notify',
2475 'src/notify/notify.c',
2476 include_directories : includes,
2477 link_with : [libshared],
2478 install_rpath : rootlibexecdir,
2480 install_dir : rootbindir)
2481 public_programs += exe
2483 executable('systemd-volatile-root',
2484 'src/volatile-root/volatile-root.c',
2485 include_directories : includes,
2486 link_with : [libshared],
2487 install_rpath : rootlibexecdir,
2489 install_dir : rootlibexecdir)
2491 executable('systemd-cgroups-agent',
2492 'src/cgroups-agent/cgroups-agent.c',
2493 include_directories : includes,
2494 link_with : [libshared],
2495 install_rpath : rootlibexecdir,
2497 install_dir : rootlibexecdir)
2499 exe = executable('systemd-id128',
2500 'src/id128/id128.c',
2501 include_directories : includes,
2502 link_with : [libshared],
2503 install_rpath : rootlibexecdir,
2505 public_programs += exe
2507 exe = executable('systemd-path',
2509 include_directories : includes,
2510 link_with : [libshared],
2511 install_rpath : rootlibexecdir,
2513 public_programs += exe
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,
2521 install_dir : rootbindir)
2522 public_programs += exe
2524 executable('systemd-reply-password',
2525 'src/reply-password/reply-password.c',
2526 include_directories : includes,
2527 link_with : [libshared],
2528 install_rpath : rootlibexecdir,
2530 install_dir : rootlibexecdir)
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,
2538 install_dir : rootbindir)
2539 public_programs += exe
2541 exe = executable('systemd-cgls',
2543 include_directories : includes,
2544 link_with : [libshared],
2545 install_rpath : rootlibexecdir,
2547 public_programs += exe
2549 exe = executable('systemd-cgtop',
2550 'src/cgtop/cgtop.c',
2551 include_directories : includes,
2552 link_with : [libshared],
2553 install_rpath : rootlibexecdir,
2555 public_programs += exe
2557 executable('systemd-initctl',
2558 'src/initctl/initctl.c',
2559 include_directories : includes,
2560 link_with : [libshared],
2561 install_rpath : rootlibexecdir,
2563 install_dir : rootlibexecdir)
2565 exe = executable('systemd-mount',
2566 'src/mount/mount-tool.c',
2567 include_directories : includes,
2568 link_with : [libshared],
2569 install_rpath : rootlibexecdir,
2571 public_programs += exe
2573 meson.add_install_script(meson_make_symlink,
2574 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2576 exe = executable('systemd-run',
2578 include_directories : includes,
2579 link_with : [libshared],
2580 install_rpath : rootlibexecdir,
2582 public_programs += exe
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,
2591 public_programs += exe
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,
2601 public_programs += exe
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,
2610 install_dir : rootbindir)
2611 public_programs += exe
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,
2622 install_dir : rootbindir)
2623 public_programs += exe
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())
2633 if conf.get('ENABLE_HWDB') == 1
2634 exe = executable('systemd-hwdb',
2636 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2637 include_directories : includes,
2638 link_with : [libudev_static],
2639 install_rpath : udev_rpath,
2641 install_dir : rootbindir)
2642 public_programs += exe
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,
2652 install_dir : rootlibexecdir)
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,
2662 install_dir : rootlibexecdir)
2663 public_programs += exe
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,
2672 dependencies : [versiondep,
2678 install_rpath : udev_rpath,
2680 install_dir : rootlibexecdir)
2681 public_programs += exe
2683 exe = executable('udevadm',
2685 c_args : '-DLOG_REALM=LOG_REALM_UDEV',
2686 include_directories : includes,
2687 link_with : [libudev_core,
2690 dependencies : [versiondep,
2696 install_rpath : udev_rpath,
2698 install_dir : rootbindir)
2699 public_programs += exe
2701 executable('systemd-shutdown',
2702 systemd_shutdown_sources,
2703 include_directories : includes,
2704 link_with : [libcore_shared,
2706 dependencies : [libmount],
2707 install_rpath : rootlibexecdir,
2709 install_dir : rootlibexecdir)
2711 executable('systemd-update-done',
2712 'src/update-done/update-done.c',
2713 include_directories : includes,
2714 link_with : [libshared],
2715 install_rpath : rootlibexecdir,
2717 install_dir : rootlibexecdir)
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,
2726 install_dir : rootlibexecdir)
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,
2736 install_dir : rootlibexecdir)
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')))
2744 exe = executable('systemd-nspawn',
2745 systemd_nspawn_sources,
2746 include_directories : includes,
2747 link_with : [libcore_shared,
2750 dependencies : [libblkid,
2752 install_rpath : rootlibexecdir,
2754 public_programs += exe
2756 if conf.get('ENABLE_NETWORKD') == 1
2757 executable('systemd-networkd',
2758 systemd_networkd_sources,
2759 include_directories : includes,
2760 link_with : [libnetworkd_core,
2764 dependencies : [threads],
2765 install_rpath : rootlibexecdir,
2767 install_dir : rootlibexecdir)
2769 executable('systemd-networkd-wait-online',
2770 systemd_networkd_wait_online_sources,
2771 include_directories : includes,
2772 link_with : [libnetworkd_core,
2774 install_rpath : rootlibexecdir,
2776 install_dir : rootlibexecdir)
2778 exe = executable('networkctl',
2780 include_directories : includes,
2781 link_with : [libsystemd_network,
2783 install_rpath : rootlibexecdir,
2785 install_dir : rootbindir)
2786 public_programs += exe
2789 executable('systemd-sulogin-shell',
2790 ['src/sulogin-shell/sulogin-shell.c'],
2791 include_directories : includes,
2792 link_with : [libshared],
2793 install_rpath : rootlibexecdir,
2795 install_dir : rootlibexecdir)
2797 ############################################################
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')) +
2806 build_by_default : true)
2808 foreach tuple : tests
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
2818 name = sources[0].split('/')[-1].split('.')[0]
2819 if type.startswith('timeout=')
2820 timeout = type.split('=')[1].to_int()
2824 if condition == '' or conf.get(condition) == 1
2828 include_directories : incs,
2829 link_with : link_with,
2830 dependencies : [versiondep,
2833 build_by_default : want_tests != 'false',
2834 install_rpath : rootlibexecdir,
2835 install : install_tests,
2836 install_dir : join_paths(testsdir, type))
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'
2848 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
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)
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)
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)
2892 'test-libudev-static-sym',
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)
2904 ############################################################
2908 if get_option('tests') != 'false'
2909 foreach tuple : fuzzers
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
2917 dependencies += fuzzing_engine
2919 sources += 'src/fuzz/fuzz-main.c'
2922 name = sources[0].split('/')[-1].split('.')[0]
2924 fuzzer_exes += executable(
2927 include_directories : [incs, include_directories('src/fuzz')],
2928 link_with : link_with,
2929 dependencies : dependencies,
2935 run_target('fuzzers',
2936 depends : fuzzer_exes,
2939 ############################################################
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')
2948 subdir('sysusers.d')
2949 subdir('tmpfiles.d')
2954 subdir('shell-completion/bash')
2955 subdir('shell-completion/zsh')
2956 subdir('docs/sysvinit')
2957 subdir('docs/var-log')
2959 install_subdir('factory/etc',
2960 install_dir : factorydir)
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',
2970 'docs/CODING_STYLE.md',
2971 'docs/DISTRO_PORTING.md',
2972 'docs/ENVIRONMENT.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)
2980 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2981 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2983 ############################################################
2985 meson_check_help = find_program('tools/meson-check-help.sh')
2987 foreach exec : public_programs
2988 name = exec.full_path().split('/')[-1]
2989 if want_tests != 'false'
2990 test('check-help-' + name,
2992 args : exec.full_path())
2996 ############################################################
2998 # Enable tests for all supported sanitizers
2999 foreach tuple : sanitizers
3000 sanitizer = tuple[0]
3003 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
3005 foreach p : fuzz_regression_tests
3006 b = p.split('/')[-2]
3007 c = p.split('/')[-1]
3009 name = '@0@:@1@'.format(b, sanitizer)
3012 if want_tests == 'false'
3013 message('Not compiling @0@ because tests is set to false'.format(name))
3015 exe = custom_target(
3019 command : [env, 'ln', '-fs',
3020 join_paths(build.full_path(), b),
3022 build_by_default : true)
3024 message('Not compiling @0@ because slow-tests is set to false'.format(name))
3029 if want_tests != 'false' and slow_tests
3030 test('@0@:@1@:@2@'.format(b, c, sanitizer),
3032 args : [exe.full_path(),
3033 join_paths(project_source_root, p)])
3040 ############################################################
3043 all_files = run_command(
3045 ['--git-dir=@0@/.git'.format(project_source_root),
3048 all_files = files(all_files.stdout().split())
3053 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
3056 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
3060 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
3063 command : [meson_git_contrib_sh])
3067 git_head = run_command(
3069 ['--git-dir=@0@/.git'.format(project_source_root),
3070 'rev-parse', 'HEAD']).stdout().strip()
3071 git_head_short = run_command(
3073 ['--git-dir=@0@/.git'.format(project_source_root),
3074 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3078 command : ['git', 'archive',
3079 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
3081 '--prefix', 'systemd-@0@/'.format(git_head),
3085 ############################################################
3087 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
3090 depends : [man, libsystemd, libudev],
3091 command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3093 ############################################################
3096 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
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)),
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)]
3145 alt_dns_servers = '\n '.join(dns_servers.split(' '))
3146 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3148 'default DNS servers: @0@'.format(alt_dns_servers),
3149 'default NTP servers: @0@'.format(alt_ntp_servers)]
3151 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3152 '@@0@'.format(time_epoch)).stdout().strip()
3154 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3157 'static libsystemd: @0@'.format(static_libsystemd),
3158 'static libudev: @0@'.format(static_libudev)]
3161 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3162 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3163 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3165 if conf.get('ENABLE_EFI') == 1
3166 status += 'efi arch: @0@'.format(efi_arch)
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)]
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],
3230 ['legacy pkla', install_polkit_pkla],
3232 ['gnu-efi', have_gnu_efi],
3245 ['man pages', want_man],
3246 ['html pages', want_html],
3247 ['man page indices', want_man and have_lxml],
3252 ['adm group', get_option('adm-group')],
3253 ['wheel group', get_option('wheel-group')],
3256 ['debug mmap cache'],
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')],
3265 if tuple.length() >= 2
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
3281 'enabled features: @0@'.format(', '.join(found)),
3283 'disabled features: @0@'.format(', '.join(missing)),
3285 message('\n '.join(status))
3287 if rootprefixdir != rootprefix_default
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))