1 # SPDX-License-Identifier: LGPL-2.1+
3 # Copyright 2017 Zbigniew Jędrzejewski-Szmek
5 project('elogind', 'c',
14 meson_version : '>= 0.44',
17 #if 0 /// UNNEEDED by elogind - libudev is external
18 # libsystemd_version = '0.22.0'
19 # libudev_version = '1.6.10'
21 libelogind_version = '0.22.0'
24 # We need the same data in two different formats, ugh!
25 # Also, for hysterical reasons, we use different variable
26 # names, sometimes. Not all variables are included in every
28 conf = configuration_data()
29 conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
30 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
32 substs = configuration_data()
33 #if 0 /// Set elogind Package PACKAGE_URL
34 # substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
36 substs.set('PACKAGE_URL', 'https://github.com/elogind/elogind')
38 substs.set('PACKAGE_VERSION', meson.project_version())
40 #####################################################################
41 #if 0 /// elogind does not need this
43 # # Try to install the git pre-commit hook
44 # git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
45 # if git_hook.returncode() == 0
46 # message(git_hook.stdout().strip())
49 # elogind Note: We use precompiler masks for two reasons:
50 # 1) The masking is consistent with the sources
51 # 2) The git patch creator we use for preparing upstream patches
52 # manipulates commits to not take those masks out. Therefore
53 # it can be used to add commits updating the meson files, too.
56 #####################################################################
58 if get_option('split-usr') == 'auto'
59 split_usr = run_command('test', '-L', '/bin').returncode() != 0
61 split_usr = get_option('split-usr') == 'true'
63 conf.set10('HAVE_SPLIT_USR', split_usr,
64 description : '/usr/bin and /bin directories are separate')
66 if get_option('split-bin') == 'auto'
67 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
69 split_bin = get_option('split-bin') == 'true'
71 conf.set10('HAVE_SPLIT_BIN', split_bin,
72 description : 'bin and sbin directories are separate')
74 rootprefixdir = get_option('rootprefix')
75 # Unusual rootprefixdir values are used by some distros
76 # (see https://github.com/systemd/systemd/pull/7461).
77 rootprefix_default = split_usr ? '/' : '/usr'
78 if rootprefixdir == ''
79 rootprefixdir = rootprefix_default
82 #if 0 /// UNNEEDED by elogind
83 # sysvinit_path = get_option('sysvinit-path')
84 # sysvrcnd_path = get_option('sysvrcnd-path')
85 # conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
86 # description : 'SysV init scripts and rcN.d links are supported')
89 # join_paths ignore the preceding arguments if an absolute component is
90 # encountered, so this should canonicalize various paths when they are
91 # absolute or relative.
92 prefixdir = get_option('prefix')
93 if not prefixdir.startswith('/')
94 error('Prefix is not absolute: "@0@"'.format(prefixdir))
96 bindir = join_paths(prefixdir, get_option('bindir'))
97 libdir = join_paths(prefixdir, get_option('libdir'))
98 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
99 includedir = join_paths(prefixdir, get_option('includedir'))
100 datadir = join_paths(prefixdir, get_option('datadir'))
101 localstatedir = join_paths('/', get_option('localstatedir'))
103 rootbindir = join_paths(rootprefixdir, 'bin')
104 rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
105 #if 0 /// elogind has a different default
106 # rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
108 rootlibexecdir = get_option('rootlibexecdir')
109 rootlibexecdir = rootlibexecdir != '' ? rootlibexecdir : join_paths(rootprefixdir, 'lib/elogind')
112 rootlibdir = get_option('rootlibdir')
114 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
117 # Dirs of external packages
118 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
119 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
120 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
121 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
122 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
123 varlogdir = join_paths(localstatedir, 'log')
124 #if 0 /// UNNEEDED by elogind
125 # xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
126 # rpmmacrosdir = get_option('rpmmacrosdir')
127 # if rpmmacrosdir != 'no'
128 # rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
131 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
134 #if 0 /// elogind has a bit different layout and does not need all of theses
135 # pkgdatadir = join_paths(datadir, 'systemd')
136 # environmentdir = join_paths(prefixdir, 'lib/environment.d')
137 # pkgsysconfdir = join_paths(sysconfdir, 'systemd')
138 # userunitdir = join_paths(prefixdir, 'lib/systemd/user')
139 # userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
140 # tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
141 # sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
142 # sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
143 # binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
144 # modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
145 # networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
146 # pkgincludedir = join_paths(includedir, 'systemd')
147 # systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
148 # usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
149 # systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
150 # userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
151 # systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
152 # systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
153 # systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
154 # systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
155 # udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
156 # udevhomedir = udevlibexecdir
157 # udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
158 # udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
159 # catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
160 # kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
161 # factorydir = join_paths(datadir, 'factory')
162 # bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
163 # testsdir = join_paths(prefixdir, 'lib/systemd/tests')
164 # systemdstatedir = join_paths(localstatedir, 'lib/systemd')
165 # catalogstatedir = join_paths(systemdstatedir, 'catalog')
166 # randomseeddir = join_paths(localstatedir, 'lib/systemd')
167 # profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
169 # docdir = get_option('docdir')
171 # docdir = join_paths(datadir, 'doc/systemd')
174 pkgdatadir = join_paths(datadir, 'elogind')
175 pkgsysconfdir = join_paths(sysconfdir, 'elogind')
176 pkgincludedir = join_paths(includedir, 'elogind/systemd')
177 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
178 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
180 # in elogind, udev is external and thus configurable
181 udevlibexecdir = get_option('udevbindir')
182 udevlibexecdir = udevlibexecdir != '' ? udevlibexecdir : join_paths(rootprefixdir, 'lib/udev')
183 udevrulesdir = get_option('udevrulesdir')
184 udevrulesdir = udevrulesdir != '' ? udevrulesdir : join_paths(udevlibexecdir, 'rules.d')
185 udevhomedir = udevlibexecdir
186 factorydir = join_paths(datadir, 'factory')
187 docdir = get_option('docdir')
188 docdir = docdir != '' ? docdir: '-'.join([join_paths(datadir, 'doc/elogind'),
189 meson.project_version()])
190 testsdir = join_paths(prefixdir, 'lib/elogind/tests')
191 randomseeddir = join_paths(localstatedir, 'lib/elogind')
194 dbuspolicydir = get_option('dbuspolicydir')
195 if dbuspolicydir == ''
196 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
199 dbussessionservicedir = get_option('dbussessionservicedir')
200 if dbussessionservicedir == ''
201 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
204 dbussystemservicedir = get_option('dbussystemservicedir')
205 if dbussystemservicedir == ''
206 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
209 pamlibdir = get_option('pamlibdir')
211 pamlibdir = join_paths(rootlibdir, 'security')
214 pamconfdir = get_option('pamconfdir')
216 pamconfdir = join_paths(sysconfdir, 'pam.d')
219 #if 0 /// UNNEEDED by elogind
220 # memory_accounting_default = get_option('memory-accounting-default')
223 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
224 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
225 #if 0 /// UNNEEDED by elogind
226 # conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
227 # conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
228 # conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
229 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
230 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
232 # conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
234 # conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
235 # conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
236 # conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
237 # conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
238 # conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
239 # conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
240 # conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
241 # conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
242 # conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
243 # conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
244 # conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
245 # conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
246 # conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
247 # conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
249 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'elogind-cgroups-agent'))
250 conf.set_quoted('ELOGIND_UACCESS_COMMAND_PATH', join_paths(rootlibexecdir, 'elogind-uaccess-command'))
251 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'elogind'))
253 conf.set_quoted('ROOTPREFIX', rootprefixdir)
254 #if 0 /// UNNEEDED by elogind
255 # conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
256 # conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
257 # conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
258 # conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
259 # conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
260 # conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
261 # conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
263 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
264 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
265 #if 0 /// UNNEEDED by elogind
266 # conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
267 # conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
269 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
270 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
271 conf.set_quoted('LIBDIR', libdir)
272 conf.set_quoted('ROOTLIBDIR', rootlibdir)
273 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
274 #if 0 /// UNNEEDED by elogind
275 # conf.set_quoted('BOOTLIBDIR', bootlibdir)
276 # conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
277 # conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
278 # conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
279 # conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
280 # conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
281 # conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
282 # conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false')
284 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
286 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
287 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
289 substs.set('prefix', prefixdir)
290 substs.set('exec_prefix', prefixdir)
291 substs.set('libdir', libdir)
292 substs.set('rootlibdir', rootlibdir)
293 substs.set('includedir', includedir)
294 substs.set('pkgsysconfdir', pkgsysconfdir)
295 substs.set('bindir', bindir)
296 substs.set('rootbindir', rootbindir)
297 substs.set('rootlibexecdir', rootlibexecdir)
298 #if 0 /// UNNEEDED by elogind
299 # substs.set('systemunitdir', systemunitdir)
300 # substs.set('userunitdir', userunitdir)
301 # substs.set('systempresetdir', systempresetdir)
302 # substs.set('userpresetdir', userpresetdir)
303 # substs.set('udevhwdbdir', udevhwdbdir)
305 substs.set('udevrulesdir', udevrulesdir)
306 substs.set('udevlibexecdir', udevlibexecdir)
307 substs.set('environmentdir', environmentdir)
308 #if 0 /// UNNEEDED by elogind
309 # substs.set('catalogdir', catalogdir)
310 # substs.set('tmpfilesdir', tmpfilesdir)
311 # substs.set('sysusersdir', sysusersdir)
312 # substs.set('sysctldir', sysctldir)
313 # substs.set('binfmtdir', binfmtdir)
314 # substs.set('modulesloaddir', modulesloaddir)
315 # substs.set('modprobedir', modprobedir)
316 # substs.set('systemgeneratordir', systemgeneratordir)
317 # substs.set('usergeneratordir', usergeneratordir)
318 # substs.set('systemenvgeneratordir', systemenvgeneratordir)
319 # substs.set('userenvgeneratordir', userenvgeneratordir)
321 substs.set('systemshutdowndir', systemshutdowndir)
322 substs.set('systemsleepdir', systemsleepdir)
323 substs.set('VARLOGDIR', varlogdir)
324 #if 0 /// UNNEEDED by elogind
325 # substs.set('CERTIFICATEROOT', get_option('certificate-root'))
326 # substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
327 # substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
328 # substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
329 # substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
330 # substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
331 # substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
332 # substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
335 #####################################################################
337 cc = meson.get_compiler('c')
338 pkgconfig = import('pkgconfig')
339 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
340 meson_build_sh = find_program('tools/meson-build.sh')
342 if get_option('tests') != 'false'
343 cxx = find_program('c++', required : false)
345 # Used only for tests
350 #if 0 /// elogind does not support fuzz stress testing (, yet).
351 # want_ossfuzz = get_option('oss-fuzz')
352 # want_libfuzzer = get_option('llvm-fuzz')
353 # fuzzer_build = want_ossfuzz or want_libfuzzer
354 # if want_ossfuzz and want_libfuzzer
355 # error('only one of oss-fuzz and llvm-fuzz can be specified')
358 # fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
361 # fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
364 # possible_cc_flags = [
368 # '-Wmissing-include-dirs',
369 # '-Wold-style-definition',
373 # '-Wsuggest-attribute=noreturn',
374 # '-Werror=missing-prototypes',
375 # '-Werror=implicit-function-declaration',
376 # '-Werror=missing-declarations',
377 # '-Werror=return-type',
378 # '-Werror=incompatible-pointer-types',
379 # '-Werror=format=2',
380 # '-Wstrict-prototypes',
381 # '-Wredundant-decls',
382 # '-Wmissing-noreturn',
383 # '-Wimplicit-fallthrough=5',
386 # '-Wstrict-aliasing=2',
388 # '-Werror=overflow',
389 # '-Werror=shift-count-overflow',
390 # '-Werror=shift-overflow=2',
392 # '-Wnested-externs',
395 # '-fdiagnostics-show-option',
396 # '-fno-strict-aliasing',
397 # '-fvisibility=hidden',
398 # '-fstack-protector',
399 # '-fstack-protector-strong',
400 # '--param=ssp-buffer-size=4',
403 # # --as-needed and --no-undefined are provided by meson by default,
404 # # run mesonconf to see what is enabled
405 # possible_link_flags = [
413 # the oss-fuzz fuzzers are not built with -fPIE, so don't
414 # enable it when we are linking against them
416 possible_cc_flags += '-fPIE'
417 possible_link_flags += '-pie'
420 if cc.get_id() == 'clang'
421 possible_cc_flags += [
422 '-Wno-typedef-redefinition',
423 '-Wno-gnu-variable-sized-type-not-at-end',
427 if get_option('buildtype') != 'debug'
428 possible_cc_flags += [
429 '-ffunction-sections',
433 possible_link_flags += '-Wl,--gc-sections'
436 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
438 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
439 # arguments, just emits a warning. So test for the "positive" version instead.
440 foreach arg : ['unused-parameter',
441 'missing-field-initializers',
444 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
446 if cc.has_argument('-W' + arg)
447 add_project_arguments('-Wno-' + arg, language : 'c')
453 #include <inttypes.h>
454 typedef uint64_t usec_t;
455 usec_t now(clockid_t clock);
460 ''', name : '-Werror=shadow with local shadowing')
461 add_project_arguments('-Werror=shadow', language : 'c')
464 link_test_c = files('tools/meson-link-test.c')
466 foreach arg : possible_link_flags
467 have = run_command(check_compilation_sh,
468 cc.cmd_array(), '-x', 'c', arg,
469 '-include', link_test_c).returncode() == 0
470 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
472 add_project_link_arguments(arg, language : 'c')
476 cpp = ' '.join(cc.cmd_array()) + ' -E'
478 #####################################################################
479 # compilation result tests
481 conf.set('_GNU_SOURCE', true)
482 conf.set('__SANE_USERSPACE_TYPES__', true)
484 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
485 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
486 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
487 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
488 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
489 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
490 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
494 #include <linux/ethtool.h>
495 #include <linux/fib_rules.h>
496 //#include <linux/stat.h>
497 //#include <sys/stat.h>
499 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
501 foreach decl : ['char16_t',
504 'struct ethtool_link_settings',
505 'struct fib_rule_uid_range',
509 # We get -1 if the size cannot be determined
510 have = cc.sizeof(decl, prefix : decl_headers) > 0
511 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
514 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
515 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
516 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
517 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
518 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
519 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
520 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
521 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
522 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
523 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
524 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
525 # if_tunnel.h is buggy and cannot be included on its own
526 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
527 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
528 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
529 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
530 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
531 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
532 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
533 ['IPVLAN_F_PRIVATE', 'linux/if_link.h'],
534 ['NDA_IFINDEX', 'linux/neighbour.h'],
535 ['IFA_FLAGS', 'linux/if_addr.h'],
536 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
537 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
538 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
540 prefix = decl.length() > 2 ? decl[2] : ''
541 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
542 conf.set10('HAVE_' + decl[0], have)
545 foreach ident : ['secure_getenv', '__secure_getenv']
546 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
550 ['memfd_create', '''#include <sys/mman.h>'''],
551 ['gettid', '''#include <sys/types.h>
552 #include <unistd.h>'''],
553 ['pivot_root', '''#include <stdlib.h>
554 #include <unistd.h>'''], # no known header declares pivot_root
555 ['name_to_handle_at', '''#include <sys/types.h>
556 #include <sys/stat.h>
557 #include <fcntl.h>'''],
558 ['setns', '''#include <sched.h>'''],
559 ['renameat2', '''#include <stdio.h>
560 // #include <fcntl.h>'''],
561 ['kcmp', '''#include <linux/kcmp.h>'''],
562 ['keyctl', '''#include <sys/types.h>
563 #include <keyutils.h>'''],
564 ['copy_file_range', '''#include <sys/syscall.h>
565 #include <unistd.h>'''],
566 ['bpf', '''#include <sys/syscall.h>
567 #include <unistd.h>'''],
568 ['statx', '''#include <sys/types.h>
569 #include <sys/stat.h>
570 // #include <unistd.h>'''],
571 ['explicit_bzero' , '''#include <string.h>'''],
572 ['reallocarray', '''#include <malloc.h>'''],
575 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
576 conf.set10('HAVE_' + ident[0].to_upper(), have)
579 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
580 conf.set10('USE_SYS_RANDOM_H', true)
581 conf.set10('HAVE_GETRANDOM', true)
583 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
584 conf.set10('USE_SYS_RANDOM_H', false)
585 conf.set10('HAVE_GETRANDOM', have)
588 #####################################################################
590 sed = find_program('sed')
591 awk = find_program('awk')
592 m4 = find_program('m4')
593 stat = find_program('stat')
594 git = find_program('git', required : false)
595 env = find_program('env')
596 perl = find_program('perl', required : false)
598 #if 0 /// elogind does not use this but needs a tool to symlink its installed headers.
599 # meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
600 #else /// Needed by elogind
601 meson_symlink_headers = meson.source_root() + '/tools/meson-symlink_headers.sh'
603 mkdir_p = 'mkdir -p $DESTDIR/@0@'
604 #if 0 /// unneeded by elogind
605 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
606 # splash_bmp = files('test/splash.bmp')
609 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
610 # /usr/sbin, /sbin, and fall back to the default from middle column.
611 #if 0 /// elogind has a bit different list and some adaptions
612 # progs = [['quotaon', '/usr/sbin/quotaon' ],
613 # ['quotacheck', '/usr/sbin/quotacheck' ],
614 # ['kmod', '/usr/bin/kmod' ],
615 # ['kexec', '/usr/sbin/kexec' ],
616 # ['sulogin', '/usr/sbin/sulogin' ],
617 # ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
618 # ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
619 # ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
620 # ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
623 progs = [['halt', '/sbin/halt', 'HALT'],
624 ['kexec', '/usr/sbin/kexec', 'KEXEC'],
625 ['poweroff', '/sbin/poweroff', 'POWEROFF'],
626 ['reboot', '/sbin/reboot', 'REBOOT'],
630 path = get_option(prog[0] + '-path')
632 message('Using @1@ for @0@'.format(prog[0], path))
634 exe = find_program(prog[0],
635 '/usr/sbin/' + prog[0],
638 path = exe.found() ? exe.path() : prog[1]
640 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
641 conf.set_quoted(name, path)
642 substs.set(name, path)
645 #if 0 /// unneeded by elogind
646 # conf.set_quoted('TELINIT', get_option('telinit-path'))
648 # if run_command('ln', '--relative', '--help').returncode() != 0
649 # 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',
687 'linux/vm_sockets.h',
689 'valgrind/memcheck.h',
690 'valgrind/valgrind.h',
693 conf.set10('HAVE_' + header.underscorify().to_upper(),
694 cc.has_header(header))
697 ############################################################
699 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
700 #if 0 /// UNNEEDED by elogind
701 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
702 # 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 #if 0 /// UNNEEDED by elogind
717 # time_epoch = get_option('time-epoch')
718 # if time_epoch == ''
719 # NEWS = files('NEWS')
720 # time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
722 # time_epoch = time_epoch.to_int()
723 # conf.set('TIME_EPOCH', time_epoch)
725 ############################################################
726 # elogind needs to know which cgroups controller to follow.
727 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
728 with_cgroupctrl = get_option('cgroup-controller')
729 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
730 with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
731 elif with_cgroupctrl == 'none'
732 with_cgroupctrl = 'elogind'
735 # No controller now is a problem:
736 if with_cgroupctrl == ''
737 error('Unable to determine cgroup controller, but cgroups support is mandatory!')
740 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
741 description : 'name of the cgroup controller to use')
742 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
743 '='.join(['name', with_cgroupctrl]))
744 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
745 '='.join(['name', with_cgroupctrl]))
746 ############################################################
749 system_uid_max = get_option('system-uid-max')
750 if system_uid_max == ''
751 system_uid_max = run_command(
753 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
754 '/etc/login.defs').stdout().strip()
755 if system_uid_max == ''
756 system_uid_max = '999'
759 system_uid_max = system_uid_max.to_int()
760 conf.set('SYSTEM_UID_MAX', system_uid_max)
761 substs.set('systemuidmax', system_uid_max)
762 message('maximum system UID is @0@'.format(system_uid_max))
764 system_gid_max = get_option('system-gid-max')
765 if system_gid_max == ''
766 system_gid_max = run_command(
768 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
769 '/etc/login.defs').stdout().strip()
770 if system_gid_max == ''
771 system_gid_max = '999'
774 system_gid_max = system_gid_max.to_int()
775 conf.set('SYSTEM_GID_MAX', system_gid_max)
776 substs.set('systemgidmax', system_gid_max)
777 message('maximum system GID is @0@'.format(system_gid_max))
779 #if 0 /// UNNEEDED by elogind
780 # dynamic_uid_min = get_option('dynamic-uid-min').to_int()
781 # dynamic_uid_max = get_option('dynamic-uid-max').to_int()
782 # conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
783 # conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
784 # substs.set('dynamicuidmin', dynamic_uid_min)
785 # substs.set('dynamicuidmax', dynamic_uid_max)
787 # container_uid_base_min = get_option('container-uid-base-min').to_int()
788 # container_uid_base_max = get_option('container-uid-base-max').to_int()
789 # conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
790 # conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
791 # substs.set('containeruidbasemin', container_uid_base_min)
792 # substs.set('containeruidbasemax', container_uid_base_max)
795 nobody_user = get_option('nobody-user')
796 nobody_group = get_option('nobody-group')
798 getent_result = run_command('getent', 'passwd', '65534')
799 if getent_result.returncode() == 0
800 name = getent_result.stdout().split(':')[0]
801 if name != nobody_user
803 '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) +
804 'Your build will result in an user table setup that is incompatible with the local system.')
807 id_result = run_command('id', '-u', nobody_user)
808 if id_result.returncode() == 0
809 id = id_result.stdout().to_int()
812 '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) +
813 'Your build will result in an user table setup that is incompatible with the local system.')
817 getent_result = run_command('getent', 'group', '65534')
818 if getent_result.returncode() == 0
819 name = getent_result.stdout().split(':')[0]
820 if name != nobody_group
822 '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) +
823 'Your build will result in an group table setup that is incompatible with the local system.')
826 id_result = run_command('id', '-g', nobody_group)
827 if id_result.returncode() == 0
828 id = id_result.stdout().to_int()
831 '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) +
832 'Your build will result in an group table setup that is incompatible with the local system.')
835 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
837 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
838 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
841 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
842 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
843 substs.set('NOBODY_USER_NAME', nobody_user)
844 substs.set('NOBODY_GROUP_NAME', nobody_group)
846 tty_gid = get_option('tty-gid')
847 conf.set('TTY_GID', tty_gid)
848 substs.set('TTY_GID', tty_gid)
850 #if 0 /// UNNEEDED by elogind
851 # # Ensure provided GID argument is numeric, otherwise fallback to default assignment
852 # if get_option('users-gid') != ''
853 # users_gid = get_option('users-gid').to_int()
857 # substs.set('USERS_GID', users_gid)
859 # conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
860 # conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
862 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
863 # substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
866 kill_user_processes = get_option('default-kill-user-processes')
867 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
868 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
869 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
871 #if 0 /// UNNEEDED by elogind
872 # dns_servers = get_option('dns-servers')
873 # conf.set_quoted('DNS_SERVERS', dns_servers)
874 # substs.set('DNS_SERVERS', dns_servers)
876 # ntp_servers = get_option('ntp-servers')
877 # conf.set_quoted('NTP_SERVERS', ntp_servers)
878 # substs.set('NTP_SERVERS', ntp_servers)
881 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
883 #if 0 /// UNNEEDED by elogind
884 # substs.set('SUSHELL', get_option('debug-shell'))
885 # substs.set('DEBUGTTY', get_option('debug-tty'))
888 enable_debug_hashmap = false
889 enable_debug_mmap_cache = false
890 #if 1 /// additional elogind debug mode
891 enable_debug_elogind = false
893 #if 1 /// additional elogind debug mode
894 elif name == 'elogind'
895 enable_debug_elogind = true
897 foreach name : get_option('debug')
899 enable_debug_hashmap = true
900 elif name == 'mmap-cache'
901 enable_debug_mmap_cache = true
903 message('unknown debug option "@0@", ignoring'.format(name))
906 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
907 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
908 #if 1 /// additional elogind debug mode
909 conf.set10('ENABLE_DEBUG_ELOGIND', enable_debug_elogind)
912 conf.set10('VALGRIND', get_option('valgrind'))
914 #####################################################################
916 threads = dependency('threads')
917 librt = cc.find_library('rt')
918 libm = cc.find_library('m')
919 libdl = cc.find_library('dl')
920 libcrypt = cc.find_library('crypt')
922 libcap = dependency('libcap', required : false)
923 if not libcap.found()
924 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
925 libcap = cc.find_library('cap')
928 #if 0 /// UNNEEDED by elogind
929 # libmount = dependency('mount',
930 # version : fuzzer_build ? '>= 0' : '>= 2.30')
932 # want_seccomp = get_option('seccomp')
933 # if want_seccomp != 'false' and not fuzzer_build
934 # libseccomp = dependency('libseccomp',
935 # version : '>= 2.3.1',
936 # required : want_seccomp == 'true')
937 # have = libseccomp.found()
945 conf.set10('HAVE_SECCOMP', have)
947 want_selinux = get_option('selinux')
948 if want_selinux != 'false' and not fuzzer_build
949 libselinux = dependency('libselinux',
950 version : '>= 2.1.9',
951 required : want_selinux == 'true')
952 have = libselinux.found()
957 conf.set10('HAVE_SELINUX', have)
959 #if 0 /// UNNEEDED by elogind
960 # want_apparmor = get_option('apparmor')
961 # if want_apparmor != 'false' and not fuzzer_build
962 # libapparmor = dependency('libapparmor',
963 # required : want_apparmor == 'true')
964 # have = libapparmor.found()
972 conf.set10('HAVE_APPARMOR', have)
974 smack_run_label = get_option('smack-run-label')
975 if smack_run_label != ''
976 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
979 want_polkit = get_option('polkit')
980 install_polkit = false
981 install_polkit_pkla = false
982 if want_polkit != 'false' and not fuzzer_build
983 install_polkit = true
985 libpolkit = dependency('polkit-gobject-1',
987 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
988 message('Old polkit detected, will install pkla files')
989 install_polkit_pkla = true
992 conf.set10('ENABLE_POLKIT', install_polkit)
994 want_acl = get_option('acl')
995 if want_acl != 'false' and not fuzzer_build
996 libacl = cc.find_library('acl', required : want_acl == 'true')
997 have = libacl.found()
1002 conf.set10('HAVE_ACL', have)
1004 want_audit = get_option('audit')
1005 if want_audit != 'false' and not fuzzer_build
1006 libaudit = dependency('audit', required : want_audit == 'true')
1007 have = libaudit.found()
1012 conf.set10('HAVE_AUDIT', have)
1014 #if 0 /// UNNEEDED by elogind
1015 # want_blkid = get_option('blkid')
1016 # if want_blkid != 'false' and not fuzzer_build
1017 # libblkid = dependency('blkid', required : want_blkid == 'true')
1018 # have = libblkid.found()
1023 # conf.set10('HAVE_BLKID', have)
1025 # want_kmod = get_option('kmod')
1026 # if want_kmod != 'false' and not fuzzer_build
1027 # libkmod = dependency('libkmod',
1028 # version : '>= 15',
1029 # required : want_kmod == 'true')
1030 # have = libkmod.found()
1035 # conf.set10('HAVE_KMOD', have)
1041 want_pam = get_option('pam')
1042 if want_pam != 'false' and not fuzzer_build
1043 libpam = cc.find_library('pam', required : want_pam == 'true')
1044 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1045 have = libpam.found() and libpam_misc.found()
1051 conf.set10('HAVE_PAM', have)
1053 #if 0 /// UNNEEDED by elogind
1054 # want_microhttpd = get_option('microhttpd')
1055 # if want_microhttpd != 'false' and not fuzzer_build
1056 # libmicrohttpd = dependency('libmicrohttpd',
1057 # version : '>= 0.9.33',
1058 # required : want_microhttpd == 'true')
1059 # have = libmicrohttpd.found()
1062 # libmicrohttpd = []
1064 # conf.set10('HAVE_MICROHTTPD', have)
1066 # want_libcryptsetup = get_option('libcryptsetup')
1067 # if want_libcryptsetup != 'false' and not fuzzer_build
1068 # libcryptsetup = dependency('libcryptsetup',
1069 # version : '>= 1.6.0',
1070 # required : want_libcryptsetup == 'true')
1071 # have = libcryptsetup.found()
1074 # libcryptsetup = []
1076 # conf.set10('HAVE_LIBCRYPTSETUP', have)
1078 # want_libcurl = get_option('libcurl')
1079 # if want_libcurl != 'false' and not fuzzer_build
1080 # libcurl = dependency('libcurl',
1081 # version : '>= 7.32.0',
1082 # required : want_libcurl == 'true')
1083 # have = libcurl.found()
1088 # conf.set10('HAVE_LIBCURL', have)
1090 # want_libidn = get_option('libidn')
1091 # want_libidn2 = get_option('libidn2')
1092 # if want_libidn == 'true' and want_libidn2 == 'true'
1093 # error('libidn and libidn2 cannot be requested simultaneously')
1096 # if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
1097 # libidn = dependency('libidn',
1098 # required : want_libidn == 'true')
1099 # have = libidn.found()
1104 # conf.set10('HAVE_LIBIDN', have)
1105 # if not have and want_libidn2 != 'false' and not fuzzer_build
1106 # # libidn is used for both libidn and libidn2 objects
1107 # libidn = dependency('libidn2',
1108 # required : want_libidn2 == 'true')
1109 # have = libidn.found()
1113 # conf.set10('HAVE_LIBIDN2', have)
1115 # want_libiptc = get_option('libiptc')
1116 # if want_libiptc != 'false' and not fuzzer_build
1117 # libiptc = dependency('libiptc',
1118 # required : want_libiptc == 'true')
1119 # have = libiptc.found()
1124 # conf.set10('HAVE_LIBIPTC', have)
1126 # want_qrencode = get_option('qrencode')
1127 # if want_qrencode != 'false' and not fuzzer_build
1128 # libqrencode = dependency('libqrencode',
1129 # required : want_qrencode == 'true')
1130 # have = libqrencode.found()
1135 # conf.set10('HAVE_QRENCODE', have)
1137 # want_gcrypt = get_option('gcrypt')
1138 # if want_gcrypt != 'false' and not fuzzer_build
1139 # libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1140 # libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1141 # have = libgcrypt.found() and libgpg_error.found()
1146 # # link to neither of the libs if one is not found
1150 # conf.set10('HAVE_GCRYPT', have)
1152 # want_gnutls = get_option('gnutls')
1153 # if want_gnutls != 'false' and not fuzzer_build
1154 # libgnutls = dependency('gnutls',
1155 # version : '>= 3.1.4',
1156 # required : want_gnutls == 'true')
1157 # have = libgnutls.found()
1162 # conf.set10('HAVE_GNUTLS', have)
1164 # want_elfutils = get_option('elfutils')
1165 # if want_elfutils != 'false' and not fuzzer_build
1166 # libdw = dependency('libdw',
1167 # required : want_elfutils == 'true')
1168 # have = libdw.found()
1173 # conf.set10('HAVE_ELFUTILS', have)
1175 # want_zlib = get_option('zlib')
1176 # if want_zlib != 'false' and not fuzzer_build
1177 # libz = dependency('zlib',
1178 # required : want_zlib == 'true')
1179 # have = libz.found()
1184 # conf.set10('HAVE_ZLIB', have)
1186 # want_bzip2 = get_option('bzip2')
1187 # if want_bzip2 != 'false' and not fuzzer_build
1188 # libbzip2 = cc.find_library('bz2',
1189 # required : want_bzip2 == 'true')
1190 # have = libbzip2.found()
1195 # conf.set10('HAVE_BZIP2', have)
1197 # want_xz = get_option('xz')
1198 # if want_xz != 'false' and not fuzzer_build
1199 # libxz = dependency('liblzma',
1200 # required : want_xz == 'true')
1201 # have = libxz.found()
1206 # conf.set10('HAVE_XZ', have)
1208 # want_lz4 = get_option('lz4')
1209 # if want_lz4 != 'false' and not fuzzer_build
1210 # liblz4 = dependency('liblz4',
1211 # required : want_lz4 == 'true')
1212 # have = liblz4.found()
1217 # conf.set10('HAVE_LZ4', have)
1219 # want_xkbcommon = get_option('xkbcommon')
1220 # if want_xkbcommon != 'false' and not fuzzer_build
1221 # libxkbcommon = dependency('xkbcommon',
1222 # version : '>= 0.3.0',
1223 # required : want_xkbcommon == 'true')
1224 # have = libxkbcommon.found()
1246 conf.set10('HAVE_XKBCOMMON', have)
1248 want_pcre2 = get_option('pcre2')
1249 if want_pcre2 != 'false'
1250 libpcre2 = dependency('libpcre2-8',
1251 required : want_pcre2 == 'true')
1252 have = libpcre2.found()
1257 conf.set10('HAVE_PCRE2', have)
1259 want_glib = get_option('glib')
1260 if want_glib != 'false' and not fuzzer_build
1261 libglib = dependency('glib-2.0',
1262 version : '>= 2.22.0',
1263 required : want_glib == 'true')
1264 libgobject = dependency('gobject-2.0',
1265 version : '>= 2.22.0',
1266 required : want_glib == 'true')
1267 libgio = dependency('gio-2.0',
1268 required : want_glib == 'true')
1269 have = libglib.found() and libgobject.found() and libgio.found()
1276 conf.set10('HAVE_GLIB', have)
1278 want_dbus = get_option('dbus')
1279 if want_dbus != 'false' and not fuzzer_build
1280 libdbus = dependency('dbus-1',
1281 version : '>= 1.3.2',
1282 required : want_dbus == 'true')
1283 have = libdbus.found()
1288 conf.set10('HAVE_DBUS', have)
1290 #if 0 /// UNNEEDED by elogind
1291 # default_dnssec = get_option('default-dnssec')
1293 # default_dnssec = 'no'
1295 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1296 # message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1297 # default_dnssec = 'no'
1299 # conf.set('DEFAULT_DNSSEC_MODE',
1300 # 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1301 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1303 # default_private_dns = get_option('default-private-dns')
1305 # default_private_dns = 'no'
1307 # if default_private_dns != 'no' and conf.get('HAVE_GNUTLS') == 0
1308 # message('default-private-dns cannot be set to strict or opportunistic when gnutls is disabled. Setting default-private-dns to no.')
1309 # default_private_dns = 'no'
1311 # conf.set('DEFAULT_PRIVATE_DNS_MODE',
1312 # 'PRIVATE_DNS_' + default_private_dns.underscorify().to_upper())
1313 # substs.set('DEFAULT_PRIVATE_DNS_MODE', default_private_dns)
1315 # want_importd = get_option('importd')
1316 # if want_importd != 'false'
1317 # have = (conf.get('HAVE_LIBCURL') == 1 and
1318 # conf.get('HAVE_ZLIB') == 1 and
1319 # conf.get('HAVE_BZIP2') == 1 and
1320 # conf.get('HAVE_XZ') == 1 and
1321 # conf.get('HAVE_GCRYPT') == 1)
1322 # if want_importd == 'true' and not have
1323 # error('importd support was requested, but dependencies are not available')
1328 # conf.set10('ENABLE_IMPORTD', have)
1330 # want_remote = get_option('remote')
1331 # if want_remote != 'false'
1332 # have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1333 # conf.get('HAVE_LIBCURL') == 1]
1334 # # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1335 # # it's possible to build one without the other. Complain only if
1336 # # support was explictly requested. The auxiliary files like sysusers
1337 # # config should be installed when any of the programs are built.
1338 # if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1339 # error('remote support was requested, but dependencies are not available')
1341 # have = have_deps[0] or have_deps[1]
1346 conf.set10('ENABLE_REMOTE', have)
1348 foreach term : ['utmp',
1349 #if 0 /// UNNEEDED by elogind
1384 have = get_option(term)
1385 name = 'ENABLE_' + term.underscorify().to_upper()
1386 conf.set10(name, have)
1389 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1391 want_tests = get_option('tests')
1392 install_tests = get_option('install-tests')
1393 slow_tests = get_option('slow-tests')
1397 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1399 #####################################################################
1401 #if 0 /// UNNEEDED by elogind
1402 # if get_option('efi')
1403 # efi_arch = host_machine.cpu_family()
1405 # if efi_arch == 'x86'
1406 # EFI_MACHINE_TYPE_NAME = 'ia32'
1407 # gnu_efi_arch = 'ia32'
1408 # elif efi_arch == 'x86_64'
1409 # EFI_MACHINE_TYPE_NAME = 'x64'
1410 # gnu_efi_arch = 'x86_64'
1411 # elif efi_arch == 'arm'
1412 # EFI_MACHINE_TYPE_NAME = 'arm'
1413 # gnu_efi_arch = 'arm'
1414 # elif efi_arch == 'aarch64'
1415 # EFI_MACHINE_TYPE_NAME = 'aa64'
1416 # gnu_efi_arch = 'aarch64'
1418 # EFI_MACHINE_TYPE_NAME = ''
1423 # conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1425 # conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1430 conf.set10('ENABLE_EFI', have)
1432 #####################################################################
1434 config_h = configure_file(
1435 output : 'config.h',
1436 configuration : conf)
1438 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1440 includes = include_directories('src/basic',
1443 #if 0 /// UNNEEDED by elogind
1445 # 'src/journal-remote',
1450 'src/time-wait-sync',
1452 #if 0 /// UNNEEDED by elogind
1457 #if 0 /// elogind has a different list
1458 # 'src/libsystemd/sd-bus',
1459 # 'src/libsystemd/sd-device',
1460 # 'src/libsystemd/sd-hwdb',
1461 # 'src/libsystemd/sd-id128',
1462 # 'src/libsystemd/sd-netlink',
1463 # 'src/libsystemd/sd-network',
1464 # 'src/libsystemd-network',
1466 'src/libelogind/sd-bus',
1467 'src/libelogind/sd-id128',
1473 add_project_arguments('-include', 'config.h', language : 'c')
1476 #if 0 /// UNNEEDED by elogind
1479 subdir('src/systemd')
1481 #if 0 /// UNNEEDED by elogind
1482 # subdir('src/libsystemd')
1483 # subdir('src/libsystemd-network')
1484 # subdir('src/journal')
1487 subdir('src/libelogind')
1489 subdir('src/update-utmp')
1493 #if 0 /// UNNEEDED by elogind
1494 # libjournal_core = static_library(
1496 # libjournal_core_sources,
1498 # include_directories : includes,
1502 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1503 libelogind = shared_library(
1505 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
1506 version : libelogind_version,
1507 include_directories : includes,
1508 link_args : ['-shared',
1509 '-Wl,--version-script=' + libelogind_sym_path],
1510 #if 0 /// elogind does not need gcrypt or libjournal_client, only threads.
1511 # link_with : [libbasic,
1513 # link_whole : [libsystemd_static,
1514 # libjournal_client],
1515 # dependencies : [threads,
1519 # link_depends : libsystemd_sym,
1521 link_with : [libbasic],
1522 link_whole : [libelogind_static],
1523 dependencies : [threads],
1524 link_depends : libelogind_sym,
1527 install_dir : rootlibdir)
1529 static_libelogind = get_option('static-libelogind')
1530 static_libelogind_pic = static_libelogind == 'true' or static_libelogind == 'pic'
1532 install_libelogind_static = static_library(
1535 journal_client_sources,
1537 basic_gcrypt_sources,
1538 include_directories : includes,
1539 build_by_default : static_libelogind != 'false',
1540 install : static_libelogind != 'false',
1541 install_dir : rootlibdir,
1542 pic : static_libelogind == 'true' or static_libelogind == 'pic',
1543 dependencies : [threads,
1552 c_args : libelogind_c_args + (static_libelogind_pic ? [] : ['-fno-PIC']))
1554 ############################################################
1556 # binaries that have --help and are intended for use by humans,
1557 # usually, but not always, installed in /bin.
1558 public_programs = []
1560 #if 0 /// UNNEEDED by elogind
1561 # subdir('src/libudev')
1563 # elogind depends on external libudev:
1564 libudev = dependency('libudev', required : true)
1566 subdir('src/shared')
1567 #if 0 /// UNNEEDED by elogind
1568 # subdir('src/core')
1569 # subdir('src/udev')
1570 # subdir('src/network')
1572 # subdir('src/analyze')
1573 # subdir('src/journal-remote')
1574 # subdir('src/coredump')
1575 # subdir('src/hostname')
1576 # subdir('src/import')
1577 # subdir('src/kernel-install')
1578 # subdir('src/locale')
1579 # subdir('src/machine')
1580 # subdir('src/portable')
1581 # subdir('src/nspawn')
1582 # subdir('src/resolve')
1583 # subdir('src/timedate')
1584 # subdir('src/timesync')
1585 # subdir('src/vconsole')
1586 # subdir('src/boot/efi')
1590 #if 0 /// UNNEEDED by elogind
1591 # subdir('src/fuzz')
1596 ############################################################
1598 # only static linking apart from libdl, to make sure that the
1599 # module is linked to all libraries that it uses.
1600 test_dlopen = executable(
1603 include_directories : includes,
1604 link_with : [libbasic],
1605 dependencies : [libdl])
1607 #if 0 /// UNNEEDED by elogind
1608 # foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1609 # ['systemd', 'ENABLE_NSS_SYSTEMD'],
1610 # ['mymachines', 'ENABLE_MACHINED'],
1611 # ['resolve', 'ENABLE_RESOLVE']]
1613 # condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1617 # sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1618 # version_script_arg = join_paths(meson.current_source_dir(), sym)
1620 # nss = shared_library(
1622 # 'src/nss-@0@/nss-@0@.c'.format(module),
1624 # include_directories : includes,
1625 # # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1626 # link_args : ['-Wl,-z,nodelete',
1628 # '-Wl,--version-script=' + version_script_arg,
1629 # '-Wl,--undefined'],
1630 # link_with : [libsystemd_static,
1632 # dependencies : [threads,
1634 # link_depends : sym,
1636 # install_dir : rootlibdir)
1638 # # We cannot use shared_module because it does not support version suffix.
1639 # # Unfortunately shared_library insists on creating the symlink…
1640 # meson.add_install_script('sh', '-c',
1641 # 'rm $DESTDIR@0@/libnss_@1@.so'
1642 # .format(rootlibdir, module))
1644 # test('dlopen-nss_' + module,
1646 # args : [nss.full_path()]) # path to dlopen must include a slash
1651 ############################################################
1653 #if 0 /// UNNEEDED by elogind
1654 # executable('systemd',
1656 # include_directories : includes,
1657 # link_with : [libcore,
1659 # dependencies : [threads,
1665 # install_rpath : rootlibexecdir,
1667 # install_dir : rootlibexecdir)
1669 # meson.add_install_script(meson_make_symlink,
1670 # join_paths(rootlibexecdir, 'systemd'),
1671 # join_paths(rootsbindir, 'init'))
1673 # exe = executable('systemd-analyze',
1674 # systemd_analyze_sources,
1675 # include_directories : includes,
1676 # link_with : [libcore,
1678 # dependencies : [threads,
1684 # install_rpath : rootlibexecdir,
1686 # public_programs += [exe]
1688 # executable('systemd-journald',
1689 # systemd_journald_sources,
1690 # include_directories : includes,
1691 # link_with : [libjournal_core,
1693 # dependencies : [threads,
1697 # install_rpath : rootlibexecdir,
1699 # install_dir : rootlibexecdir)
1701 # exe = executable('systemd-cat',
1702 # systemd_cat_sources,
1703 # include_directories : includes,
1704 # link_with : [libjournal_core,
1706 # dependencies : [threads],
1707 # install_rpath : rootlibexecdir,
1709 # public_programs += [exe]
1711 # exe = executable('journalctl',
1712 # journalctl_sources,
1713 # include_directories : includes,
1714 # link_with : [libshared],
1715 # dependencies : [threads,
1720 # install_rpath : rootlibexecdir,
1722 # install_dir : rootbindir)
1723 # public_programs += [exe]
1725 # executable('systemd-getty-generator',
1726 # 'src/getty-generator/getty-generator.c',
1727 # include_directories : includes,
1728 # link_with : [libshared],
1729 # install_rpath : rootlibexecdir,
1731 # install_dir : systemgeneratordir)
1733 # executable('systemd-debug-generator',
1734 # 'src/debug-generator/debug-generator.c',
1735 # include_directories : includes,
1736 # link_with : [libshared],
1737 # install_rpath : rootlibexecdir,
1739 # install_dir : systemgeneratordir)
1741 # executable('systemd-fstab-generator',
1742 # 'src/fstab-generator/fstab-generator.c',
1743 # 'src/core/mount-setup.c',
1744 # include_directories : includes,
1745 # link_with : [libshared],
1746 # install_rpath : rootlibexecdir,
1748 # install_dir : systemgeneratordir)
1750 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1751 # executable('30-systemd-environment-d-generator',
1752 # 'src/environment-d-generator/environment-d-generator.c',
1753 # include_directories : includes,
1754 # link_with : [libshared],
1755 # install_rpath : rootlibexecdir,
1757 # install_dir : userenvgeneratordir)
1759 # meson.add_install_script(meson_make_symlink,
1760 # join_paths(sysconfdir, 'environment'),
1761 # join_paths(environmentdir, '99-environment.conf'))
1764 # if conf.get('ENABLE_HIBERNATE') == 1
1765 # executable('systemd-hibernate-resume-generator',
1766 # 'src/hibernate-resume/hibernate-resume-generator.c',
1767 # include_directories : includes,
1768 # link_with : [libshared],
1769 # install_rpath : rootlibexecdir,
1771 # install_dir : systemgeneratordir)
1773 # executable('systemd-hibernate-resume',
1774 # 'src/hibernate-resume/hibernate-resume.c',
1775 # include_directories : includes,
1776 # link_with : [libshared],
1777 # install_rpath : rootlibexecdir,
1779 # install_dir : rootlibexecdir)
1782 # if conf.get('HAVE_BLKID') == 1
1783 # executable('systemd-gpt-auto-generator',
1784 # 'src/gpt-auto-generator/gpt-auto-generator.c',
1785 # 'src/basic/blkid-util.h',
1786 # include_directories : includes,
1787 # link_with : [libshared],
1788 # dependencies : libblkid,
1789 # install_rpath : rootlibexecdir,
1791 # install_dir : systemgeneratordir)
1793 # exe = executable('systemd-dissect',
1794 # 'src/dissect/dissect.c',
1795 # include_directories : includes,
1796 # link_with : [libshared],
1797 # install_rpath : rootlibexecdir,
1799 # install_dir : rootlibexecdir)
1800 # public_programs += [exe]
1803 # if conf.get('ENABLE_RESOLVE') == 1
1804 # executable('systemd-resolved',
1805 # systemd_resolved_sources,
1806 # include_directories : includes,
1807 # link_with : [libshared,
1809 # libsystemd_resolve_core],
1810 # dependencies : [threads,
1815 # install_rpath : rootlibexecdir,
1817 # install_dir : rootlibexecdir)
1819 # exe = executable('resolvectl',
1820 # resolvectl_sources,
1821 # include_directories : includes,
1822 # link_with : [libshared,
1824 # libsystemd_resolve_core],
1825 # dependencies : [threads,
1829 # install_rpath : rootlibexecdir,
1831 # public_programs += [exe]
1833 # meson.add_install_script(meson_make_symlink,
1834 # join_paths(bindir, 'resolvectl'),
1835 # join_paths(rootsbindir, 'resolvconf'))
1837 # meson.add_install_script(meson_make_symlink,
1838 # join_paths(bindir, 'resolvectl'),
1839 # join_paths(bindir, 'systemd-resolve'))
1842 # if conf.get('ENABLE_LOGIND') == 1
1843 # executable('systemd-logind',
1844 # systemd_logind_sources,
1845 # include_directories : includes,
1846 # link_with : [liblogind_core,
1848 # dependencies : [threads,
1850 # install_rpath : rootlibexecdir,
1852 # install_dir : rootlibexecdir)
1854 # exe = executable('loginctl',
1856 # include_directories : includes,
1857 # link_with : [libshared],
1858 # dependencies : [threads,
1861 # install_rpath : rootlibexecdir,
1863 # install_dir : rootbindir)
1864 # public_programs += [exe]
1866 # exe = executable('systemd-inhibit',
1867 # 'src/login/inhibit.c',
1868 # include_directories : includes,
1869 # link_with : [libshared],
1870 # install_rpath : rootlibexecdir,
1872 # install_dir : rootbindir)
1873 # public_programs += [exe]
1875 # if conf.get('HAVE_PAM') == 1
1876 # version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1877 # pam_systemd = shared_library(
1881 # include_directories : includes,
1882 # link_args : ['-shared',
1883 # '-Wl,--version-script=' + version_script_arg],
1884 # link_with : [libsystemd_static,
1885 # libshared_static],
1886 # dependencies : [threads,
1889 # link_depends : pam_systemd_sym,
1891 # install_dir : pamlibdir)
1893 # test('dlopen-pam_systemd',
1895 # args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1901 executable('elogind',
1903 include_directories : includes,
1904 link_with : [liblogind_core,
1906 dependencies : [threads,
1909 install_rpath : rootlibexecdir,
1911 install_dir : rootlibexecdir)
1913 exe = executable('loginctl',
1915 include_directories : includes,
1916 link_with : [libshared],
1917 dependencies : [threads,
1919 install_rpath : rootlibexecdir,
1921 install_dir : rootbindir)
1922 public_programs += [exe]
1924 exe = executable('elogind-inhibit',
1925 'src/login/inhibit.c',
1926 include_directories : includes,
1927 link_with : [libshared],
1928 dependencies : [threads],
1929 install_rpath : rootlibexecdir,
1931 install_dir : rootbindir)
1932 public_programs += [exe]
1933 executable('elogind-user-runtime-dir',
1934 executable('elogind-user-runtime-dir',
1935 executable('elogind-user-runtime-dir',
1936 executable('elogind-user-runtime-dir',
1937 executable('elogind-user-runtime-dir',
1938 executable('elogind-user-runtime-dir',
1939 executable('elogind-user-runtime-dir',
1940 executable('elogind-user-runtime-dir',
1941 executable('elogind-user-runtime-dir',
1942 executable('elogind-user-runtime-dir',
1943 executable('elogind-user-runtime-dir',
1944 executable('elogind-user-runtime-dir',
1945 executable('elogind-user-runtime-dir',
1946 executable('elogind-user-runtime-dir',
1947 executable('elogind-user-runtime-dir',
1948 executable('elogind-user-runtime-dir',
1949 user_runtime_dir_sources,
1950 include_directories : includes,
1951 link_with : [libshared, liblogind_core],
1952 install_rpath : rootlibexecdir,
1954 install_dir : rootlibexecdir)
1956 if conf.get('HAVE_PAM') == 1
1957 version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1958 pam_elogind = shared_library(
1962 include_directories : includes,
1963 link_args : ['-shared',
1964 '-Wl,--version-script=' + version_script_arg],
1965 link_with : [libelogind_static,
1967 dependencies : [threads,
1970 link_depends : pam_elogind_sym,
1972 install_dir : pamlibdir)
1974 test('dlopen-pam_elogind',
1976 args : [pam_elogind.full_path()]) # path to dlopen must include a slash
1979 #if 0 /// UNNEEDED by elogind
1980 # executable('systemd-user-sessions',
1981 # 'src/user-sessions/user-sessions.c',
1982 # include_directories : includes,
1983 # link_with : [libshared],
1984 # install_rpath : rootlibexecdir,
1986 # install_dir : rootlibexecdir)
1989 # if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1990 # exe = executable('bootctl',
1991 # 'src/boot/bootctl.c',
1992 # include_directories : includes,
1993 # link_with : [libshared],
1994 # dependencies : [libblkid],
1995 # install_rpath : rootlibexecdir,
1997 # public_programs += [exe]
2000 # exe = executable('systemd-socket-activate', 'src/activate/activate.c',
2001 # include_directories : includes,
2002 # link_with : [libshared],
2003 # dependencies : [threads],
2004 # install_rpath : rootlibexecdir,
2006 # public_programs += [exe]
2009 # if get_option('link-systemctl-shared')
2010 # systemctl_link_with = [libshared]
2012 # systemctl_link_with = [libsystemd_static,
2014 # libjournal_client,
2018 # exe = executable('systemctl', 'src/systemctl/systemctl.c',
2019 # include_directories : includes,
2020 # link_with : systemctl_link_with,
2021 # dependencies : [threads,
2026 # install_rpath : rootlibexecdir,
2028 # install_dir : rootbindir)
2029 # public_programs += [exe]
2031 # if conf.get('ENABLE_PORTABLED') == 1
2032 # executable('systemd-portabled',
2033 # systemd_portabled_sources,
2034 # include_directories : includes,
2035 # link_with : [libshared],
2036 # dependencies : [threads],
2037 # install_rpath : rootlibexecdir,
2039 # install_dir : rootlibexecdir)
2041 # exe = executable('portablectl', 'src/portable/portablectl.c',
2042 # include_directories : includes,
2043 # link_with : [libshared],
2044 # dependencies : [threads],
2045 # install_rpath : rootlibexecdir,
2047 # install_dir : rootlibexecdir)
2048 # public_programs += [exe]
2051 # foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit']
2052 # meson.add_install_script(meson_make_symlink,
2053 # join_paths(rootbindir, 'systemctl'),
2054 # join_paths(rootsbindir, alias))
2057 # if conf.get('ENABLE_BACKLIGHT') == 1
2058 # executable('systemd-backlight',
2059 # 'src/backlight/backlight.c',
2060 # include_directories : includes,
2061 # link_with : [libshared],
2062 # install_rpath : rootlibexecdir,
2064 # install_dir : rootlibexecdir)
2067 # if conf.get('ENABLE_RFKILL') == 1
2068 # executable('systemd-rfkill',
2069 # 'src/rfkill/rfkill.c',
2070 # include_directories : includes,
2071 # link_with : [libshared],
2072 # install_rpath : rootlibexecdir,
2074 # install_dir : rootlibexecdir)
2077 # executable('systemd-system-update-generator',
2078 # 'src/system-update-generator/system-update-generator.c',
2079 # include_directories : includes,
2080 # link_with : [libshared],
2081 # install_rpath : rootlibexecdir,
2083 # install_dir : systemgeneratordir)
2085 # if conf.get('HAVE_LIBCRYPTSETUP') == 1
2086 # executable('systemd-cryptsetup',
2087 # 'src/cryptsetup/cryptsetup.c',
2088 # include_directories : includes,
2089 # link_with : [libshared],
2090 # dependencies : [libcryptsetup],
2091 # install_rpath : rootlibexecdir,
2093 # install_dir : rootlibexecdir)
2095 # executable('systemd-cryptsetup-generator',
2096 # 'src/cryptsetup/cryptsetup-generator.c',
2097 # include_directories : includes,
2098 # link_with : [libshared],
2099 # dependencies : [libcryptsetup],
2100 # install_rpath : rootlibexecdir,
2102 # install_dir : systemgeneratordir)
2104 # executable('systemd-veritysetup',
2105 # 'src/veritysetup/veritysetup.c',
2106 # include_directories : includes,
2107 # link_with : [libshared],
2108 # dependencies : [libcryptsetup],
2109 # install_rpath : rootlibexecdir,
2111 # install_dir : rootlibexecdir)
2113 # executable('systemd-veritysetup-generator',
2114 # 'src/veritysetup/veritysetup-generator.c',
2115 # include_directories : includes,
2116 # link_with : [libshared],
2117 # dependencies : [libcryptsetup],
2118 # install_rpath : rootlibexecdir,
2120 # install_dir : systemgeneratordir)
2123 # if conf.get('HAVE_SYSV_COMPAT') == 1
2124 # executable('systemd-sysv-generator',
2125 # 'src/sysv-generator/sysv-generator.c',
2126 # include_directories : includes,
2127 # link_with : [libshared],
2128 # install_rpath : rootlibexecdir,
2130 # install_dir : systemgeneratordir)
2132 # executable('systemd-rc-local-generator',
2133 # 'src/rc-local-generator/rc-local-generator.c',
2134 # include_directories : includes,
2135 # link_with : [libshared],
2136 # install_rpath : rootlibexecdir,
2138 # install_dir : systemgeneratordir)
2141 # if conf.get('ENABLE_HOSTNAMED') == 1
2142 # executable('systemd-hostnamed',
2143 # 'src/hostname/hostnamed.c',
2144 # include_directories : includes,
2145 # link_with : [libshared],
2146 # install_rpath : rootlibexecdir,
2148 # install_dir : rootlibexecdir)
2150 # exe = executable('hostnamectl',
2151 # 'src/hostname/hostnamectl.c',
2152 # include_directories : includes,
2153 # link_with : [libshared],
2154 # install_rpath : rootlibexecdir,
2156 # public_programs += [exe]
2159 # if conf.get('ENABLE_LOCALED') == 1
2160 # if conf.get('HAVE_XKBCOMMON') == 1
2161 # # logind will load libxkbcommon.so dynamically on its own
2167 # executable('systemd-localed',
2168 # systemd_localed_sources,
2169 # include_directories : includes,
2170 # link_with : [libshared],
2171 # dependencies : deps,
2172 # install_rpath : rootlibexecdir,
2174 # install_dir : rootlibexecdir)
2176 # exe = executable('localectl',
2177 # localectl_sources,
2178 # include_directories : includes,
2179 # link_with : [libshared],
2180 # install_rpath : rootlibexecdir,
2182 # public_programs += [exe]
2185 # if conf.get('ENABLE_TIMEDATED') == 1
2186 # executable('systemd-timedated',
2187 # 'src/timedate/timedated.c',
2188 # include_directories : includes,
2189 # link_with : [libshared],
2190 # install_rpath : rootlibexecdir,
2192 # install_dir : rootlibexecdir)
2195 # if conf.get('ENABLE_TIMEDATECTL') == 1
2196 # exe = executable('timedatectl',
2197 # 'src/timedate/timedatectl.c',
2198 # include_directories : includes,
2199 # install_rpath : rootlibexecdir,
2200 # link_with : [libshared],
2201 # dependencies : [libm],
2203 # public_programs += [exe]
2206 # if conf.get('ENABLE_TIMESYNCD') == 1
2207 # executable('systemd-timesyncd',
2208 # systemd_timesyncd_sources,
2209 # include_directories : includes,
2210 # link_with : [libshared],
2211 # dependencies : [threads,
2213 # install_rpath : rootlibexecdir,
2215 # install_dir : rootlibexecdir)
2217 # executable('systemd-time-wait-sync',
2218 # 'src/time-wait-sync/time-wait-sync.c',
2219 # include_directories : includes,
2220 # link_with : [libshared],
2221 # install_rpath : rootlibexecdir,
2223 # install_dir : rootlibexecdir)
2226 # if conf.get('ENABLE_MACHINED') == 1
2227 # executable('systemd-machined',
2228 # systemd_machined_sources,
2229 # include_directories : includes,
2230 # link_with : [libmachine_core,
2232 # install_rpath : rootlibexecdir,
2234 # install_dir : rootlibexecdir)
2236 # exe = executable('machinectl',
2237 # 'src/machine/machinectl.c',
2238 # include_directories : includes,
2239 # link_with : [libshared],
2240 # dependencies : [threads,
2243 # install_rpath : rootlibexecdir,
2245 # install_dir : rootbindir)
2246 # public_programs += [exe]
2249 # if conf.get('ENABLE_IMPORTD') == 1
2250 # executable('systemd-importd',
2251 # systemd_importd_sources,
2252 # include_directories : includes,
2253 # link_with : [libshared],
2254 # dependencies : [threads],
2255 # install_rpath : rootlibexecdir,
2257 # install_dir : rootlibexecdir)
2259 # systemd_pull = executable('systemd-pull',
2260 # systemd_pull_sources,
2261 # include_directories : includes,
2262 # link_with : [libshared],
2263 # dependencies : [libcurl,
2268 # install_rpath : rootlibexecdir,
2270 # install_dir : rootlibexecdir)
2272 # systemd_import = executable('systemd-import',
2273 # systemd_import_sources,
2274 # include_directories : includes,
2275 # link_with : [libshared],
2276 # dependencies : [libcurl,
2280 # install_rpath : rootlibexecdir,
2282 # install_dir : rootlibexecdir)
2284 # systemd_export = executable('systemd-export',
2285 # systemd_export_sources,
2286 # include_directories : includes,
2287 # link_with : [libshared],
2288 # dependencies : [libcurl,
2292 # install_rpath : rootlibexecdir,
2294 # install_dir : rootlibexecdir)
2295 # public_programs += [systemd_pull, systemd_import, systemd_export]
2298 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2299 # exe = executable('systemd-journal-upload',
2300 # systemd_journal_upload_sources,
2301 # include_directories : includes,
2302 # link_with : [libshared],
2303 # dependencies : [threads,
2308 # install_rpath : rootlibexecdir,
2310 # install_dir : rootlibexecdir)
2311 # public_programs += [exe]
2314 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2315 # s_j_remote = executable('systemd-journal-remote',
2316 # systemd_journal_remote_sources,
2317 # include_directories : includes,
2318 # link_with : [libshared,
2319 # libsystemd_journal_remote],
2320 # dependencies : [threads,
2325 # install_rpath : rootlibexecdir,
2327 # install_dir : rootlibexecdir)
2329 # s_j_gatewayd = executable('systemd-journal-gatewayd',
2330 # systemd_journal_gatewayd_sources,
2331 # include_directories : includes,
2332 # link_with : [libshared],
2333 # dependencies : [threads,
2338 # install_rpath : rootlibexecdir,
2340 # install_dir : rootlibexecdir)
2341 # public_programs += [s_j_remote, s_j_gatewayd]
2344 # if conf.get('ENABLE_COREDUMP') == 1
2345 # executable('systemd-coredump',
2346 # systemd_coredump_sources,
2347 # include_directories : includes,
2348 # link_with : [libshared],
2349 # dependencies : [threads,
2354 # install_rpath : rootlibexecdir,
2356 # install_dir : rootlibexecdir)
2358 # exe = executable('coredumpctl',
2359 # coredumpctl_sources,
2360 # include_directories : includes,
2361 # link_with : [libshared],
2362 # dependencies : [threads,
2365 # install_rpath : rootlibexecdir,
2367 # public_programs += [exe]
2370 # if conf.get('ENABLE_BINFMT') == 1
2371 # exe = executable('systemd-binfmt',
2372 # 'src/binfmt/binfmt.c',
2373 # include_directories : includes,
2374 # link_with : [libshared],
2375 # install_rpath : rootlibexecdir,
2377 # install_dir : rootlibexecdir)
2378 # public_programs += [exe]
2380 # meson.add_install_script('sh', '-c',
2381 # mkdir_p.format(binfmtdir))
2382 # meson.add_install_script('sh', '-c',
2383 # mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2386 # if conf.get('ENABLE_VCONSOLE') == 1
2387 # executable('systemd-vconsole-setup',
2388 # 'src/vconsole/vconsole-setup.c',
2389 # include_directories : includes,
2390 # link_with : [libshared],
2391 # install_rpath : rootlibexecdir,
2393 # install_dir : rootlibexecdir)
2396 # if conf.get('ENABLE_RANDOMSEED') == 1
2397 # executable('systemd-random-seed',
2398 # 'src/random-seed/random-seed.c',
2399 # include_directories : includes,
2400 # link_with : [libshared],
2401 # install_rpath : rootlibexecdir,
2403 # install_dir : rootlibexecdir)
2406 # if conf.get('ENABLE_FIRSTBOOT') == 1
2407 # executable('systemd-firstboot',
2408 # 'src/firstboot/firstboot.c',
2409 # include_directories : includes,
2410 # link_with : [libshared],
2411 # dependencies : [libcrypt],
2412 # install_rpath : rootlibexecdir,
2414 # install_dir : rootbindir)
2417 # executable('systemd-remount-fs',
2418 # 'src/remount-fs/remount-fs.c',
2419 # 'src/core/mount-setup.c',
2420 # 'src/core/mount-setup.h',
2421 # include_directories : includes,
2422 # link_with : [libshared],
2423 # install_rpath : rootlibexecdir,
2425 # install_dir : rootlibexecdir)
2427 # executable('systemd-machine-id-setup',
2428 # 'src/machine-id-setup/machine-id-setup-main.c',
2429 # 'src/core/machine-id-setup.c',
2430 # 'src/core/machine-id-setup.h',
2431 # include_directories : includes,
2432 # link_with : [libshared],
2433 # install_rpath : rootlibexecdir,
2435 # install_dir : rootbindir)
2437 # executable('systemd-fsck',
2438 # 'src/fsck/fsck.c',
2439 # include_directories : includes,
2440 # link_with : [libshared],
2441 # install_rpath : rootlibexecdir,
2443 # install_dir : rootlibexecdir)
2445 # executable('elogind-growfs',
2446 # 'src/partition/growfs.c',
2447 # include_directories : includes,
2448 # link_with : [libshared],
2449 # dependencies : [libcryptsetup],
2450 # install_rpath : rootlibexecdir,
2452 # install_dir : rootlibexecdir)
2454 # executable('elogind-makefs',
2455 # 'src/partition/makefs.c',
2456 # include_directories : includes,
2457 # link_with : [libshared],
2458 # install_rpath : rootlibexecdir,
2460 # install_dir : rootlibexecdir)
2462 # executable('systemd-sleep',
2463 # 'src/sleep/sleep.c',
2464 # include_directories : includes,
2465 # link_with : [libshared],
2466 # install_rpath : rootlibexecdir,
2468 # install_dir : rootlibexecdir)
2470 # exe = executable('systemd-sysctl',
2471 # 'src/sysctl/sysctl.c',
2472 # include_directories : includes,
2473 # link_with : [libshared],
2474 # install_rpath : rootlibexecdir,
2476 # install_dir : rootlibexecdir)
2477 # public_programs += [exe]
2479 # executable('systemd-ac-power',
2480 # 'src/ac-power/ac-power.c',
2481 # include_directories : includes,
2482 # link_with : [libshared],
2483 # install_rpath : rootlibexecdir,
2485 # install_dir : rootlibexecdir)
2487 # exe = executable('systemd-detect-virt',
2488 # 'src/detect-virt/detect-virt.c',
2489 # include_directories : includes,
2490 # link_with : [libshared],
2491 # install_rpath : rootlibexecdir,
2493 # public_programs += [exe]
2495 # exe = executable('systemd-delta',
2496 # 'src/delta/delta.c',
2497 # include_directories : includes,
2498 # link_with : [libshared],
2499 # install_rpath : rootlibexecdir,
2501 # public_programs += [exe]
2503 # exe = executable('systemd-escape',
2504 # 'src/escape/escape.c',
2505 # include_directories : includes,
2506 # link_with : [libshared],
2507 # install_rpath : rootlibexecdir,
2509 # install_dir : rootbindir)
2510 # public_programs += [exe]
2512 # exe = executable('systemd-notify',
2513 # 'src/notify/notify.c',
2514 # include_directories : includes,
2515 # link_with : [libshared],
2516 # install_rpath : rootlibexecdir,
2518 # install_dir : rootbindir)
2519 # public_programs += [exe]
2521 # executable('systemd-volatile-root',
2522 # 'src/volatile-root/volatile-root.c',
2523 # include_directories : includes,
2524 # link_with : [libshared],
2525 # install_rpath : rootlibexecdir,
2527 # install_dir : rootlibexecdir)
2529 # executable('systemd-cgroups-agent',
2530 # 'src/cgroups-agent/cgroups-agent.c',
2531 # include_directories : includes,
2532 # link_with : [libshared],
2533 # install_rpath : rootlibexecdir,
2535 # install_dir : rootlibexecdir)
2537 executable('elogind-cgroups-agent',
2538 'src/cgroups-agent/cgroups-agent.c',
2539 include_directories : includes,
2540 link_with : [libshared],
2541 install_rpath : rootlibexecdir,
2543 install_dir : rootlibexecdir)
2546 #if 0 /// UNNEEDED by elogind
2547 # exe = executable('systemd-path',
2548 # 'src/path/path.c',
2549 # include_directories : includes,
2550 # link_with : [libshared],
2551 # install_rpath : rootlibexecdir,
2553 # public_programs += [exe]
2555 # exe = executable('systemd-ask-password',
2556 # 'src/ask-password/ask-password.c',
2557 # include_directories : includes,
2558 # link_with : [libshared],
2559 # install_rpath : rootlibexecdir,
2561 # install_dir : rootbindir)
2562 # public_programs += [exe]
2564 # executable('systemd-reply-password',
2565 # 'src/reply-password/reply-password.c',
2566 # include_directories : includes,
2567 # link_with : [libshared],
2568 # install_rpath : rootlibexecdir,
2570 # install_dir : rootlibexecdir)
2572 # exe = executable('systemd-tty-ask-password-agent',
2573 # 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2574 # include_directories : includes,
2575 # link_with : [libshared],
2576 # install_rpath : rootlibexecdir,
2578 # install_dir : rootbindir)
2579 # public_programs += [exe]
2581 # exe = executable('systemd-cgls',
2582 # 'src/cgls/cgls.c',
2583 # include_directories : includes,
2584 # link_with : [libshared],
2585 # install_rpath : rootlibexecdir,
2587 # public_programs += [exe]
2589 # exe = executable('systemd-cgtop',
2590 # 'src/cgtop/cgtop.c',
2591 # include_directories : includes,
2592 # link_with : [libshared],
2593 # install_rpath : rootlibexecdir,
2595 # public_programs += [exe]
2597 # executable('systemd-initctl',
2598 # 'src/initctl/initctl.c',
2599 # include_directories : includes,
2600 # link_with : [libshared],
2601 # install_rpath : rootlibexecdir,
2603 # install_dir : rootlibexecdir)
2605 # exe = executable('systemd-mount',
2606 # 'src/mount/mount-tool.c',
2607 # include_directories : includes,
2608 # link_with : [libshared],
2609 # install_rpath : rootlibexecdir,
2611 # public_programs += [exe]
2613 # meson.add_install_script(meson_make_symlink,
2614 # 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2616 # exe = executable('systemd-run',
2618 # include_directories : includes,
2619 # link_with : [libshared],
2620 # install_rpath : rootlibexecdir,
2622 # public_programs += [exe]
2624 # exe = executable('systemd-stdio-bridge',
2625 # 'src/stdio-bridge/stdio-bridge.c',
2626 # include_directories : includes,
2627 # link_with : [libshared],
2628 # install_rpath : rootlibexecdir,
2630 # public_programs += [exe]
2632 # exe = executable('busctl',
2633 # 'src/busctl/busctl.c',
2634 # 'src/busctl/busctl-introspect.c',
2635 # 'src/busctl/busctl-introspect.h',
2636 # include_directories : includes,
2637 # link_with : [libshared],
2638 # install_rpath : rootlibexecdir,
2640 # public_programs += [exe]
2642 # if conf.get('ENABLE_SYSUSERS') == 1
2643 # exe = executable('systemd-sysusers',
2644 # 'src/sysusers/sysusers.c',
2645 # include_directories : includes,
2646 # link_with : [libshared],
2647 # install_rpath : rootlibexecdir,
2649 # install_dir : rootbindir)
2650 # public_programs += [exe]
2653 # if conf.get('ENABLE_TMPFILES') == 1
2654 # exe = executable('systemd-tmpfiles',
2655 # 'src/tmpfiles/tmpfiles.c',
2656 # include_directories : includes,
2657 # link_with : [libshared],
2658 # dependencies : [libacl],
2659 # install_rpath : rootlibexecdir,
2661 # install_dir : rootbindir)
2662 # public_programs += [exe]
2664 # test('test-systemd-tmpfiles',
2665 # test_systemd_tmpfiles_py,
2666 # args : exe.full_path())
2667 # # https://github.com/mesonbuild/meson/issues/2681
2670 # if conf.get('ENABLE_HWDB') == 1
2671 # exe = executable('systemd-hwdb',
2672 # 'src/hwdb/hwdb.c',
2673 # 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2674 # include_directories : includes,
2675 # link_with : [libudev_static],
2676 # install_rpath : udev_rpath,
2678 # install_dir : rootbindir)
2679 # public_programs += [exe]
2682 # if conf.get('ENABLE_QUOTACHECK') == 1
2683 # executable('systemd-quotacheck',
2684 # 'src/quotacheck/quotacheck.c',
2685 # include_directories : includes,
2686 # link_with : [libshared],
2687 # install_rpath : rootlibexecdir,
2689 # install_dir : rootlibexecdir)
2692 # exe = executable('systemd-socket-proxyd',
2693 # 'src/socket-proxy/socket-proxyd.c',
2694 # include_directories : includes,
2695 # link_with : [libshared],
2696 # dependencies : [threads],
2697 # install_rpath : rootlibexecdir,
2699 # install_dir : rootlibexecdir)
2700 # public_programs += [exe]
2702 # exe = executable('systemd-udevd',
2703 # systemd_udevd_sources,
2704 # include_directories : includes,
2705 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2706 # link_with : [libudev_core,
2707 # libsystemd_network,
2709 # dependencies : [threads,
2714 # install_rpath : udev_rpath,
2716 # install_dir : rootlibexecdir)
2717 # public_programs += [exe]
2719 # exe = executable('udevadm',
2721 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2722 # include_directories : includes,
2723 # link_with : [libudev_core,
2724 # libsystemd_network,
2726 # dependencies : [threads,
2731 # install_rpath : udev_rpath,
2733 # install_dir : rootbindir)
2734 # public_programs += [exe]
2736 # executable('systemd-shutdown',
2737 # systemd_shutdown_sources,
2738 # include_directories : includes,
2739 # link_with : [libshared],
2740 # dependencies : [libmount],
2741 # install_rpath : rootlibexecdir,
2743 # install_dir : rootlibexecdir)
2745 # executable('systemd-update-done',
2746 # 'src/update-done/update-done.c',
2747 # include_directories : includes,
2748 # link_with : [libshared],
2749 # install_rpath : rootlibexecdir,
2751 # install_dir : rootlibexecdir)
2753 # executable('systemd-update-utmp',
2754 # 'src/update-utmp/update-utmp.c',
2755 # include_directories : includes,
2756 # link_with : [libshared],
2757 # dependencies : [libaudit],
2758 # install_rpath : rootlibexecdir,
2760 # install_dir : rootlibexecdir)
2762 # if conf.get('HAVE_KMOD') == 1
2763 # executable('systemd-modules-load',
2764 # 'src/modules-load/modules-load.c',
2765 # include_directories : includes,
2766 # link_with : [libshared],
2767 # dependencies : [libkmod],
2768 # install_rpath : rootlibexecdir,
2770 # install_dir : rootlibexecdir)
2772 # meson.add_install_script('sh', '-c',
2773 # mkdir_p.format(modulesloaddir))
2774 # meson.add_install_script('sh', '-c',
2775 # mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2778 # exe = executable('systemd-nspawn',
2779 # systemd_nspawn_sources,
2780 # 'src/core/mount-setup.c', # FIXME: use a variable?
2781 # 'src/core/mount-setup.h',
2782 # 'src/core/loopback-setup.c',
2783 # 'src/core/loopback-setup.h',
2784 # include_directories : includes,
2785 # link_with : [libnspawn_core,
2787 # dependencies : [libblkid],
2788 # install_rpath : rootlibexecdir,
2790 # public_programs += [exe]
2792 # if conf.get('ENABLE_NETWORKD') == 1
2793 # executable('systemd-networkd',
2794 # systemd_networkd_sources,
2795 # include_directories : includes,
2796 # link_with : [libnetworkd_core,
2797 # libsystemd_network,
2800 # dependencies : [threads],
2801 # install_rpath : rootlibexecdir,
2803 # install_dir : rootlibexecdir)
2805 # executable('systemd-networkd-wait-online',
2806 # systemd_networkd_wait_online_sources,
2807 # include_directories : includes,
2808 # link_with : [libnetworkd_core,
2810 # install_rpath : rootlibexecdir,
2812 # install_dir : rootlibexecdir)
2814 # exe = executable('networkctl',
2815 # networkctl_sources,
2816 # include_directories : includes,
2817 # link_with : [libsystemd_network,
2819 # install_rpath : rootlibexecdir,
2821 # install_dir : rootbindir)
2822 # public_programs += [exe]
2825 # executable('systemd-sulogin-shell',
2826 # ['src/sulogin-shell/sulogin-shell.c'],
2827 # include_directories : includes,
2828 # link_with : [libshared],
2829 # install_rpath : rootlibexecdir,
2831 # install_dir : rootlibexecdir)
2833 executable('elogind-uaccess-command',
2834 'src/uaccess-command/uaccess-command.c',
2835 include_directories : includes,
2836 link_with : [liblogind_core,
2838 dependencies: [libacl,
2840 install_rpath : rootlibexecdir,
2842 install_dir : rootlibexecdir)
2845 ############################################################
2847 foreach tuple : tests
2849 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2850 dependencies = tuple[2]
2851 condition = tuple.length() >= 4 ? tuple[3] : ''
2852 type = tuple.length() >= 5 ? tuple[4] : ''
2853 defs = tuple.length() >= 6 ? tuple[5] : []
2854 incs = tuple.length() >= 7 ? tuple[6] : includes
2857 name = sources[0].split('/')[-1].split('.')[0]
2858 if type.startswith('timeout=')
2859 timeout = type.split('=')[1].to_int()
2862 if want_tests == 'false'
2863 message('Not compiling @0@ because tests is set to false'.format(name))
2864 elif condition == '' or conf.get(condition) == 1
2868 include_directories : incs,
2869 link_with : link_with,
2870 dependencies : dependencies,
2872 install_rpath : rootlibexecdir,
2873 install : install_tests,
2874 install_dir : join_paths(testsdir, type))
2877 message('@0@ is a manual test'.format(name))
2878 elif type == 'unsafe' and want_tests != 'unsafe'
2879 message('@0@ is an unsafe test'.format(name))
2886 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2890 #if 0 /// UNNEEDED by elogind
2892 # 'test-libsystemd-sym',
2893 # test_libsystemd_sym_c,
2894 # include_directories : includes,
2895 # link_with : [libsystemd],
2896 # install : install_tests,
2897 # install_dir : testsdir)
2898 # test('test-libsystemd-sym', exe)
2901 # 'test-libsystemd-static-sym',
2902 # test_libsystemd_sym_c,
2903 # include_directories : includes,
2904 # link_with : [install_libsystemd_static],
2905 # dependencies : [threads], # threads is already included in dependencies on the library,
2906 # # but does not seem to get propagated. Add here as a work-around.
2907 # build_by_default : static_libsystemd_pic,
2908 # install : install_tests and static_libsystemd_pic,
2909 # install_dir : testsdir)
2910 # if static_libsystemd_pic
2911 # test('test-libsystemd-static-sym', exe)
2915 # 'test-libudev-sym',
2916 # test_libudev_sym_c,
2917 # include_directories : includes,
2918 # c_args : ['-Wno-deprecated-declarations'],
2919 # link_with : [libudev],
2920 # install : install_tests,
2921 # install_dir : testsdir)
2922 # test('test-libudev-sym', exe)
2925 # 'test-libudev-static-sym',
2926 # test_libudev_sym_c,
2927 # include_directories : includes,
2928 # c_args : ['-Wno-deprecated-declarations'],
2929 # link_with : [install_libudev_static],
2930 # build_by_default : static_libudev_pic,
2931 # install : install_tests and static_libudev_pic,
2932 # install_dir : testsdir)
2933 # if static_libudev_pic
2934 # test('test-libudev-static-sym', exe)
2937 # ############################################################
2941 # foreach tuple : fuzzers
2942 # sources = tuple[0]
2943 # link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2944 # dependencies = tuple[2]
2945 # defs = tuple.length() >= 4 ? tuple[3] : []
2946 # incs = tuple.length() >= 5 ? tuple[4] : includes
2949 # dependencies += fuzzing_engine
2951 # sources += 'src/fuzz/fuzz-main.c'
2954 # name = sources[0].split('/')[-1].split('.')[0]
2956 # fuzzer_exes += executable(
2959 # include_directories : [incs, include_directories('src/fuzz')],
2960 # link_with : link_with,
2961 # dependencies : dependencies,
2966 # run_target('fuzzers',
2967 # depends : fuzzer_exes,
2968 # command : ['true'])
2970 # ############################################################
2973 test_libelogind_sym = executable(
2974 'test-libelogind-sym',
2975 test_libelogind_sym_c,
2976 include_directories : includes,
2977 link_with : [libelogind],
2978 install : install_tests,
2979 install_dir : testsdir)
2980 test('test-libelogind-sym',
2981 test_libelogind_sym)
2983 make_directive_index_py = find_program('tools/make-directive-index.py')
2984 make_man_index_py = find_program('tools/make-man-index.py')
2985 xml_helper_py = find_program('tools/xml_helper.py')
2986 #if 0 /// UNNEEDED by elogind
2987 # hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2990 # subdir('sysctl.d')
2991 # subdir('sysusers.d')
2992 # subdir('tmpfiles.d')
2998 subdir('shell-completion/bash')
2999 subdir('shell-completion/zsh')
3000 #if 0 /// UNNEEDED by elogind
3002 subdir('doc/sysvinit')
3003 subdir('doc/var-log')
3005 # FIXME: figure out if the warning is true:
3006 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
3007 install_subdir('factory/etc',
3008 install_dir : factorydir)
3011 #if 0 /// UNNEEDED by elogind
3012 # install_data('xorg/50-systemd-user.sh',
3013 # install_dir : xinitrcdir)
3014 # install_data('modprobe.d/systemd.conf',
3015 # install_dir : modprobedir)
3017 install_data('LICENSE.GPL2',
3022 #if 0 /// irrelevant for elogind
3023 # 'doc/DISTRO_PORTING',
3024 # 'doc/ENVIRONMENT.md',
3026 # 'doc/TRANSIENT-SETTINGS.md',
3027 # 'doc/TRANSLATORS',
3028 # 'doc/UIDS-GIDS.md',
3030 'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
3031 install_dir : docdir)
3033 #if 0 /// UNNEEDED by elogind
3034 # meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3036 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3038 ############################################################
3040 meson_check_help = find_program('tools/meson-check-help.sh')
3042 foreach exec : public_programs
3043 name = exec.full_path().split('/')[-1]
3044 test('check-help-' + name,
3046 args : [exec.full_path()])
3049 ############################################################
3051 #if 0 /// fuzz regression tests are not supported by elogind
3052 # # Enable tests for all supported sanitizers
3053 # foreach tuple : sanitizers
3054 # sanitizer = tuple[0]
3057 # have = run_command(check_compilation_sh,
3058 # cc.cmd_array(), '-x', 'c',
3059 # '-fsanitize=@0@'.format(sanitizer),
3060 # '-include', link_test_c).returncode() == 0
3061 # message('@0@ sanitizer supported: @1@'.format(sanitizer, have ? 'yes' : 'no'))
3065 # foreach p : fuzz_regression_tests
3066 # b = p.split('/')[-2]
3067 # c = p.split('/')[-1]
3069 # name = '@0@:@1@'.format(b, sanitizer)
3072 # if want_tests == 'false'
3073 # message('Not compiling @0@ because tests is set to false'.format(name))
3075 # exe = custom_target(
3079 # command : [env, 'ln', '-fs',
3080 # join_paths(build.full_path(), b),
3082 # build_by_default : true)
3084 # message('Not compiling @0@ because slow-tests is set to false'.format(name))
3089 # if want_tests != 'false' and slow_tests
3090 # test('@0@:@1@:@2@'.format(b, c, sanitizer),
3092 # args : [exe.full_path(),
3093 # join_paths(meson.source_root(),
3094 # 'test/fuzz-regressions',
3103 ############################################################
3106 all_files = run_command(
3108 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3111 all_files = files(all_files.stdout().split())
3116 command : [env, 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
3119 command : [env, 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
3122 #if 0 /// UNNEEDED by elogind
3124 # meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
3127 # command : [meson_git_contrib_sh])
3132 git_head = run_command(
3134 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3135 'rev-parse', 'HEAD']).stdout().strip()
3136 git_head_short = run_command(
3138 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3139 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3143 command : ['git', 'archive',
3144 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
3146 '--prefix', 'systemd-@0@/'.format(git_head),
3150 ############################################################
3152 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
3155 #if 0 /// libudev is external, elogind does not need to document it.
3156 # depends : [man, libsystemd, libudev],
3157 # command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3159 depends : [man, libelogind],
3160 command : [meson_check_api_docs_sh, libelogind.full_path()])
3163 ############################################################
3166 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3168 'split /usr: @0@'.format(split_usr),
3169 'split bin-sbin: @0@'.format(split_bin),
3170 #if 0 /// UNSUPPORTED by elogind
3171 # 'prefix directory: @0@'.format(prefixdir),
3172 # 'rootprefix directory: @0@'.format(rootprefixdir),
3173 # 'sysconf directory: @0@'.format(sysconfdir),
3174 # 'include directory: @0@'.format(includedir),
3175 # 'lib directory: @0@'.format(libdir),
3176 # 'rootlib directory: @0@'.format(rootlibdir),
3177 # 'SysV init scripts: @0@'.format(sysvinit_path),
3178 # 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3180 'rootexeclib dir: @0@'.format(rootlibexecdir),
3182 #if 0 /// UNSUPPORTED by elogind
3183 # 'PAM modules directory: @0@'.format(pamlibdir),
3184 # 'PAM configuration directory: @0@'.format(pamconfdir),
3185 # 'RPM macros directory: @0@'.format(rpmmacrosdir),
3186 # 'modprobe.d directory: @0@'.format(modprobedir),
3187 # 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3188 # 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3189 # 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3190 # 'bash completions directory: @0@'.format(bashcompletiondir),
3191 # 'zsh completions directory: @0@'.format(zshcompletiondir),
3192 # 'extra start script: @0@'.format(get_option('rc-local')),
3193 # 'extra stop script: @0@'.format(get_option('halt-local')),
3194 # 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3195 # get_option('debug-tty')),
3197 'TTY GID: @0@'.format(tty_gid),
3198 #if 0 /// UNSUPPORTED by elogind
3199 # 'users GID: @0@'.format(users_gid),
3201 'maximum system UID: @0@'.format(system_uid_max),
3202 'maximum system GID: @0@'.format(system_gid_max),
3203 #if 0 /// UNSUPPORTED by elogind
3204 # 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
3205 # 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
3206 # 'minimum container UID base: @0@'.format(container_uid_base_min),
3207 # 'maximum container UID base: @0@'.format(container_uid_base_max),
3208 # '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3209 # 'render group access mode: @0@'.format(get_option('group-render-mode')),
3210 # 'certificate root directory: @0@'.format(get_option('certificate-root')),
3211 # 'support URL: @0@'.format(support_url),
3212 # 'nobody user name: @0@'.format(nobody_user),
3213 # 'nobody group name: @0@'.format(nobody_group),
3214 # 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3215 # 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
3217 # 'default DNSSEC mode: @0@'.format(default_dnssec),
3218 # 'default private DNS mode: @0@'.format(default_private_dns),
3219 # 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3221 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
3223 #if 0 /// UNSUPPORTED by elogind
3224 # alt_dns_servers = '\n '.join(dns_servers.split(' '))
3225 # alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3227 # 'default DNS servers: @0@'.format(alt_dns_servers),
3228 # 'default NTP servers: @0@'.format(alt_ntp_servers)]
3230 # alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3231 # '@@0@'.format(time_epoch)).stdout().strip()
3233 # 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3237 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3238 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3239 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3241 #if 0 /// UNNEEDED by elogind
3242 # if conf.get('ENABLE_EFI') == 1
3244 # 'efi arch: @0@'.format(efi_arch)]
3248 # 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3249 # 'EFI CC @0@'.format(efi_cc),
3250 # 'EFI lib directory: @0@'.format(efi_libdir),
3251 # 'EFI lds directory: @0@'.format(efi_ldsdir),
3252 # 'EFI include directory: @0@'.format(efi_incdir)]
3261 #if 0 /// UNNEEDED by elogind
3262 # ['libcryptsetup'],
3266 #if 0 /// UNNEEDED by elogind
3271 #if 0 /// UNNEEDED by elogind
3275 #if 0 /// UNNEEDED by elogind
3282 #if 0 /// UNNEEDED by elogind
3298 # ['environment.d'],
3317 ['legacy pkla', install_polkit_pkla],
3318 #if 0 /// UNNEEDED by elogind
3320 # ['gnu-efi', have_gnu_efi],
3328 #if 0 /// UNNEEDED by elogind
3329 # ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
3333 ['man pages', want_man],
3334 ['html pages', want_html],
3335 ['man page indices', want_man and have_lxml],
3336 #if 0 /// UNNEEDED by elogind
3340 #if 0 /// UNNEEDED by elogind
3343 # ['adm group', get_option('adm-group')],
3344 # ['wheel group', get_option('wheel-group')],
3346 # ['valgrind', conf.get('VALGRIND') == 1],
3351 ['debug mmap cache'],
3354 if tuple.length() >= 2
3357 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3358 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3359 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3364 missing += [tuple[0]]
3370 'enabled features: @0@'.format(', '.join(found)),
3372 'disabled features: @0@'.format(', '.join(missing)),
3374 message('\n '.join(status))
3376 if rootprefixdir != rootprefix_default
3378 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3379 'elogind used fixed names for unit file directories and other paths, so anything\n' +
3380 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))