1 # SPDX-License-Identifier: LGPL-2.1+
3 # Copyright 2017 Zbigniew Jędrzejewski-Szmek
5 # elogind is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) any later version.
10 # elogind is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with elogind; If not, see <http://www.gnu.org/licenses/>.
18 project('elogind', 'c',
27 meson_version : '>= 0.41',
30 #if 0 /// UNNEEDED by elogind - libudev is external
31 # libsystemd_version = '0.21.0'
32 # libudev_version = '1.6.9'
34 libelogind_version = '0.20.0'
37 # We need the same data in three different formats, ugh!
38 # Also, for hysterical reasons, we use different variable
39 # names, sometimes. Not all variables are included in every
41 conf = configuration_data()
42 conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
43 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
45 substs = configuration_data()
46 #if 0 /// Set elogind Package PACKAGE_URL
47 # substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
49 substs.set('PACKAGE_URL', 'https://github.com/elogind/elogind')
51 substs.set('PACKAGE_VERSION', meson.project_version())
55 #####################################################################
56 #if 0 /// elogind does not need this
58 # # Try to install the git pre-commit hook
59 # git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
60 # if git_hook.returncode() == 0
61 # message(git_hook.stdout().strip())
64 # elogind Note: We use precompiler masks for two reasons:
65 # 1) The masking is consistent with the sources
66 # 2) The git patch creator we use for preparing upstream patches
67 # manipulates commits to not take those masks out. Therefore
68 # it can be used to add commits updating the meson files, too.
71 #####################################################################
73 split_usr = get_option('split-usr')
74 conf.set10('HAVE_SPLIT_USR', split_usr)
76 rootprefixdir = get_option('rootprefix')
77 # Unusual rootprefixdir values are used by some distros
78 # (see https://github.com/systemd/systemd/pull/7461).
79 rootprefix_default = get_option('split-usr') ? '/' : '/usr'
80 if rootprefixdir == ''
81 rootprefixdir = rootprefix_default
84 #if 0 /// UNNEEDED by elogind
85 # sysvinit_path = get_option('sysvinit-path')
86 # sysvrcnd_path = get_option('sysvrcnd-path')
87 # have = sysvinit_path != '' and sysvrcnd_path != ''
88 # conf.set10('HAVE_SYSV_COMPAT', have,
89 # description : 'SysV init scripts and rcN.d links are supported')
90 # m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
93 # join_paths ignore the preceding arguments if an absolute component is
94 # encountered, so this should canonicalize various paths when they are
95 # absolute or relative.
96 prefixdir = get_option('prefix')
97 if not prefixdir.startswith('/')
98 error('Prefix is not absolute: "@0@"'.format(prefixdir))
100 bindir = join_paths(prefixdir, get_option('bindir'))
101 libdir = join_paths(prefixdir, get_option('libdir'))
102 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
103 includedir = join_paths(prefixdir, get_option('includedir'))
104 datadir = join_paths(prefixdir, get_option('datadir'))
105 localstatedir = join_paths('/', get_option('localstatedir'))
107 rootbindir = join_paths(rootprefixdir, 'bin')
108 #if 0 /// elogind has a different default
109 # rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
111 rootlibexecdir = get_option('rootlibexecdir')
112 rootlibexecdir = rootlibexecdir != '' ? rootlibexecdir : join_paths(rootprefixdir, 'lib/elogind')
115 rootlibdir = get_option('rootlibdir')
117 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
120 # Dirs of external packages
121 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
122 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
123 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
124 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
125 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
126 varlogdir = join_paths(localstatedir, 'log')
127 #if 0 /// UNNEEDED by elogind
128 # xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
129 # rpmmacrosdir = get_option('rpmmacrosdir')
130 # if rpmmacrosdir != 'no'
131 # rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
134 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
137 #if 0 /// elogind has a bit different layout and does not need all of theses
138 # pkgdatadir = join_paths(datadir, 'systemd')
139 # environmentdir = join_paths(prefixdir, 'lib/environment.d')
140 # pkgsysconfdir = join_paths(sysconfdir, 'systemd')
141 # userunitdir = join_paths(prefixdir, 'lib/systemd/user')
142 # userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
143 # tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
144 # sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
145 # sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
146 # binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
147 # modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
148 # networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
149 # pkgincludedir = join_paths(includedir, 'systemd')
150 # systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
151 # usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
152 # systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
153 # userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
154 # systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
155 # systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
156 # systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
157 # systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
158 # udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
159 # udevhomedir = udevlibexecdir
160 # udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
161 # udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
162 # catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
163 # kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
164 # factorydir = join_paths(datadir, 'factory')
165 # bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
166 # testsdir = join_paths(prefixdir, 'lib/systemd/tests')
167 # systemdstatedir = join_paths(localstatedir, 'lib/systemd')
168 # catalogstatedir = join_paths(systemdstatedir, 'catalog')
169 # randomseeddir = join_paths(localstatedir, 'lib/systemd')
171 # docdir = get_option('docdir')
173 # docdir = join_paths(datadir, 'doc/systemd')
176 pkgdatadir = join_paths(datadir, 'elogind')
177 pkgsysconfdir = join_paths(sysconfdir, 'elogind')
178 pkgincludedir = join_paths(includedir, 'elogind/systemd')
179 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
180 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
182 # in elogind, udev is external and thus configurable
183 udevlibexecdir = get_option('udevbindir')
184 udevlibexecdir = udevlibexecdir != '' ? udevlibexecdir : join_paths(rootprefixdir, 'lib/udev')
185 udevrulesdir = get_option('udevrulesdir')
186 udevrulesdir = udevrulesdir != '' ? udevrulesdir : join_paths(udevlibexecdir, 'rules.d')
187 udevhomedir = udevlibexecdir
188 factorydir = join_paths(datadir, 'factory')
189 docdir = get_option('docdir')
190 docdir = docdir != '' ? docdir: '-'.join([join_paths(datadir, 'doc/elogind'),
191 meson.project_version()])
192 testsdir = join_paths(prefixdir, 'lib/elogind/tests')
193 randomseeddir = join_paths(localstatedir, 'lib/elogind')
196 dbuspolicydir = get_option('dbuspolicydir')
197 if dbuspolicydir == ''
198 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
201 dbussessionservicedir = get_option('dbussessionservicedir')
202 if dbussessionservicedir == ''
203 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
206 dbussystemservicedir = get_option('dbussystemservicedir')
207 if dbussystemservicedir == ''
208 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
211 pamlibdir = get_option('pamlibdir')
213 pamlibdir = join_paths(rootlibdir, 'security')
216 pamconfdir = get_option('pamconfdir')
218 pamconfdir = join_paths(sysconfdir, 'pam.d')
221 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'))
231 # conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
232 # conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
233 # conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
234 # conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
235 # conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
236 # conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
237 # conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
238 # conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
239 # conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
240 # conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
241 # conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
242 # conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
243 # conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
244 # conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
246 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'elogind-cgroups-agent'))
247 conf.set_quoted('ELOGIND_UACCESS_COMMAND_PATH', join_paths(rootlibexecdir, 'elogind-uaccess-command'))
248 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'elogind'))
250 conf.set_quoted('ROOTPREFIX', rootprefixdir)
251 #if 0 /// UNNEEDED by elogind
252 # conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
253 # conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
254 # conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
255 # conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
256 # conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
257 # conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
258 # conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
260 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
261 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
262 #if 0 /// UNNEEDED by elogind
263 # conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
264 # conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
266 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
267 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
268 conf.set_quoted('LIBDIR', libdir)
269 conf.set_quoted('ROOTLIBDIR', rootlibdir)
270 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
271 #if 0 /// UNNEEDED by elogind
272 # conf.set_quoted('BOOTLIBDIR', bootlibdir)
273 # conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
274 # conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
275 # conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
276 # conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
277 # conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
278 # conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
280 conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false')
281 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_ON_OFF', memory_accounting_default ? 'on' : 'off')
283 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
284 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
286 substs.set('prefix', prefixdir)
287 substs.set('exec_prefix', prefixdir)
288 substs.set('libdir', libdir)
289 substs.set('rootlibdir', rootlibdir)
290 substs.set('includedir', includedir)
291 substs.set('pkgsysconfdir', pkgsysconfdir)
292 substs.set('bindir', bindir)
293 substs.set('rootbindir', rootbindir)
294 substs.set('rootlibexecdir', rootlibexecdir)
295 #if 0 /// UNNEEDED by elogind
296 # substs.set('systemunitdir', systemunitdir)
297 # substs.set('userunitdir', userunitdir)
298 # substs.set('systempresetdir', systempresetdir)
299 # substs.set('userpresetdir', userpresetdir)
300 # substs.set('udevhwdbdir', udevhwdbdir)
302 substs.set('udevrulesdir', udevrulesdir)
303 substs.set('udevlibexecdir', udevlibexecdir)
304 #if 0 /// UNNEEDED by elogind
305 # substs.set('catalogdir', catalogdir)
306 # substs.set('tmpfilesdir', tmpfilesdir)
307 # substs.set('sysusersdir', sysusersdir)
308 # substs.set('sysctldir', sysctldir)
309 # substs.set('binfmtdir', binfmtdir)
310 # substs.set('modulesloaddir', modulesloaddir)
311 # substs.set('systemgeneratordir', systemgeneratordir)
312 # substs.set('usergeneratordir', usergeneratordir)
313 # substs.set('systemenvgeneratordir', systemenvgeneratordir)
314 # substs.set('userenvgeneratordir', userenvgeneratordir)
316 substs.set('systemshutdowndir', systemshutdowndir)
317 substs.set('systemsleepdir', systemsleepdir)
318 substs.set('VARLOGDIR', varlogdir)
319 #if 0 /// UNNEEDED by elogind
320 # substs.set('CERTIFICATEROOT', get_option('certificate-root'))
321 # substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
322 # substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
323 # substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
324 # substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
325 # substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
326 # substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
328 substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
330 #####################################################################
332 cc = meson.get_compiler('c')
333 pkgconfig = import('pkgconfig')
334 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
335 meson_build_sh = find_program('tools/meson-build.sh')
337 if get_option('tests') != 'false'
338 cxx = find_program('c++', required : false)
340 # Used only for tests
345 want_ossfuzz = get_option('oss-fuzz')
346 want_libfuzzer = get_option('llvm-fuzz')
347 fuzzer_build = want_ossfuzz or want_libfuzzer
348 if want_ossfuzz and want_libfuzzer
349 error('only one of oss-fuzz and llvm-fuzz can be specified')
352 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
355 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
358 foreach arg : ['-Wextra',
361 '-Wmissing-include-dirs',
362 '-Wold-style-definition',
365 '-Wdeclaration-after-statement',
367 '-Wsuggest-attribute=noreturn',
368 '-Werror=missing-prototypes',
369 '-Werror=implicit-function-declaration',
370 '-Werror=missing-declarations',
371 '-Werror=return-type',
372 '-Werror=incompatible-pointer-types',
374 '-Wstrict-prototypes',
376 '-Wmissing-noreturn',
377 '-Wimplicit-fallthrough=5',
380 '-Wstrict-aliasing=2',
387 '-fdiagnostics-show-option',
388 '-fno-strict-aliasing',
389 '-fvisibility=hidden',
391 '-fstack-protector-strong',
392 '--param=ssp-buffer-size=4',
394 if cc.has_argument(arg)
395 add_project_arguments(arg, language : 'c')
399 # the oss-fuzz fuzzers are not built with -fPIE, so don't
400 # enable it when we are linking against them
402 if cc.has_argument('-fPIE')
403 add_project_arguments('-fPIE', language : 'c')
407 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
408 # arguments, just emits a warnings. So test for the "positive" version instead.
409 foreach arg : ['unused-parameter',
410 'missing-field-initializers',
413 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
415 if cc.has_argument('-W' + arg)
416 add_project_arguments('-Wno-' + arg, language : 'c')
422 #include <inttypes.h>
423 typedef uint64_t usec_t;
424 usec_t now(clockid_t clock);
429 ''', name : '-Werror=shadow with local shadowing')
430 add_project_arguments('-Werror=shadow', language : 'c')
433 if cc.get_id() == 'clang'
434 foreach arg : ['-Wno-typedef-redefinition',
435 '-Wno-gnu-variable-sized-type-not-at-end',
437 if cc.has_argument(arg,
438 name : '@0@ is supported'.format(arg))
439 add_project_arguments(arg, language : 'c')
444 link_test_c = files('tools/meson-link-test.c')
446 # --as-needed and --no-undefined are provided by meson by default,
447 # run mesonconf to see what is enabled
448 foreach arg : ['-Wl,-z,relro',
453 have = run_command(check_compilation_sh,
454 cc.cmd_array(), '-x', 'c', arg,
455 '-include', link_test_c).returncode() == 0
456 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
457 if have and (arg != '-pie' or not fuzzer_build)
458 add_project_link_arguments(arg, language : 'c')
462 # Check if various sanitizers are supported
464 foreach arg : ['address']
466 have = run_command(check_compilation_sh,
467 cc.cmd_array(), '-x', 'c',
468 '-fsanitize=@0@'.format(arg),
469 '-include', link_test_c).returncode() == 0
470 message('@0@ sanitizer supported: @1@'.format(arg, have ? 'yes' : 'no'))
476 if get_option('buildtype') != 'debug'
477 foreach arg : ['-ffunction-sections',
479 if cc.has_argument(arg,
480 name : '@0@ is supported'.format(arg))
481 add_project_arguments(arg, language : 'c')
485 foreach arg : ['-Wl,--gc-sections']
486 have = run_command(check_compilation_sh,
487 cc.cmd_array(), '-x', 'c', arg,
488 '-include', link_test_c).returncode() == 0
489 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
491 add_project_link_arguments(arg, language : 'c')
496 cpp = ' '.join(cc.cmd_array()) + ' -E'
498 #####################################################################
499 # compilation result tests
501 conf.set('_GNU_SOURCE', true)
502 conf.set('__SANE_USERSPACE_TYPES__', true)
504 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
505 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
506 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
507 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
508 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
509 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
510 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
514 #include <linux/ethtool.h>
515 #include <linux/fib_rules.h>
516 //#include <linux/stat.h>
517 //#include <sys/stat.h>
519 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
521 foreach decl : ['char16_t',
524 'struct ethtool_link_settings',
525 'struct fib_rule_uid_range',
529 # We get -1 if the size cannot be determined
530 have = cc.sizeof(decl, prefix : decl_headers) > 0
531 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
534 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
535 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
536 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
537 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
538 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
539 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
540 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
541 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
542 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
543 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
544 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
545 # if_tunnel.h is buggy and cannot be included on its own
546 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
547 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
548 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
549 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
550 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
551 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
552 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
553 ['IPVLAN_F_PRIVATE', 'linux/if_link.h'],
554 ['NDA_IFINDEX', 'linux/neighbour.h'],
555 ['IFA_FLAGS', 'linux/if_addr.h'],
556 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
557 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
558 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
560 prefix = decl.length() > 2 ? decl[2] : ''
561 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
562 conf.set10('HAVE_' + decl[0], have)
565 foreach ident : ['secure_getenv', '__secure_getenv']
566 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
570 ['memfd_create', '''#include <sys/mman.h>'''],
571 ['gettid', '''#include <sys/types.h>
572 #include <unistd.h>'''],
573 ['pivot_root', '''#include <stdlib.h>
574 #include <unistd.h>'''], # no known header declares pivot_root
575 ['name_to_handle_at', '''#include <sys/types.h>
576 #include <sys/stat.h>
577 #include <fcntl.h>'''],
578 ['setns', '''#include <sched.h>'''],
579 ['renameat2', '''#include <stdio.h>
580 // #include <fcntl.h>'''],
581 ['kcmp', '''#include <linux/kcmp.h>'''],
582 ['keyctl', '''#include <sys/types.h>
583 #include <keyutils.h>'''],
584 ['copy_file_range', '''#include <sys/syscall.h>
585 #include <unistd.h>'''],
586 ['bpf', '''#include <sys/syscall.h>
587 #include <unistd.h>'''],
588 ['explicit_bzero' , '''#include <string.h>'''],
589 ['statx', '''#include <sys/types.h>
590 #include <sys/stat.h>
591 // #include <unistd.h>'''],
594 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
595 conf.set10('HAVE_' + ident[0].to_upper(), have)
598 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
599 conf.set10('USE_SYS_RANDOM_H', true)
600 conf.set10('HAVE_GETRANDOM', true)
602 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
603 conf.set10('USE_SYS_RANDOM_H', false)
604 conf.set10('HAVE_GETRANDOM', have)
607 #####################################################################
609 sed = find_program('sed')
610 awk = find_program('awk')
611 m4 = find_program('m4')
612 stat = find_program('stat')
613 git = find_program('git', required : false)
614 env = find_program('env')
616 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
617 #if 1 /// Needed by elogind
618 meson_symlink_headers = meson.source_root() + '/tools/meson-symlink_headers.sh'
620 mkdir_p = 'mkdir -p $DESTDIR/@0@'
621 #if 0 /// unneeded by elogind
622 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
623 # splash_bmp = files('test/splash.bmp')
626 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
627 # /usr/sbin, /sbin, and fall back to the default from middle column.
628 #if 0 /// elogind has a bit different list and some adaptions
629 # progs = [['quotaon', '/usr/sbin/quotaon' ],
630 # ['quotacheck', '/usr/sbin/quotacheck' ],
631 # ['kill', '/usr/bin/kill' ],
632 # ['kmod', '/usr/bin/kmod' ],
633 # ['kexec', '/usr/sbin/kexec' ],
634 # ['sulogin', '/usr/sbin/sulogin' ],
635 # ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
636 # ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
637 # ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
638 # ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
641 progs = [['kexec', '/usr/sbin/kexec', 'KEXEC'],
642 ['reboot', '/sbin/reboot', 'REBOOT'],
643 ['halt', '/sbin/halt', 'HALT'],
647 path = get_option(prog[0] + '-path')
649 message('Using @1@ for @0@'.format(prog[0], path))
651 exe = find_program(prog[0],
652 '/usr/sbin/' + prog[0],
655 path = exe.found() ? exe.path() : prog[1]
657 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
658 conf.set_quoted(name, path)
659 substs.set(name, path)
662 conf.set_quoted('TELINIT', get_option('telinit-path'))
664 if run_command('ln', '--relative', '--help').returncode() != 0
665 error('ln does not support --relative')
668 ############################################################
670 gperf = find_program('gperf')
672 gperf_test_format = '''
674 const char * in_word_set(const char *, @0@);
677 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
678 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
679 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
680 if cc.compiles(gperf_test)
681 gperf_len_type = 'size_t'
683 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
684 if cc.compiles(gperf_test)
685 gperf_len_type = 'unsigned'
687 error('unable to determine gperf len type')
690 message('gperf len type is @0@'.format(gperf_len_type))
691 conf.set('GPERF_LEN_TYPE', gperf_len_type,
692 description : 'The type of gperf "len" parameter')
694 ############################################################
696 if not cc.has_header('sys/capability.h')
697 error('POSIX caps headers not found')
699 foreach header : ['crypt.h',
702 'linux/vm_sockets.h',
704 'valgrind/memcheck.h',
705 'valgrind/valgrind.h',
708 conf.set10('HAVE_' + header.underscorify().to_upper(),
709 cc.has_header(header))
712 ############################################################
714 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
715 #if 0 /// UNNEEDED by elogind
716 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
717 # gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
720 default_hierarchy = get_option('default-hierarchy')
721 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
722 description : 'default cgroup hierarchy as string')
723 if default_hierarchy == 'legacy'
724 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
725 elif default_hierarchy == 'hybrid'
726 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
728 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
731 #if 0 /// UNNEEDED by elogind
732 # time_epoch = get_option('time-epoch')
733 # if time_epoch == ''
734 # NEWS = files('NEWS')
735 # time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
737 # time_epoch = time_epoch.to_int()
738 # conf.set('TIME_EPOCH', time_epoch)
740 ############################################################
741 # elogind needs to know which cgroups controller to follow.
742 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
743 with_cgroupctrl = get_option('cgroup-controller')
744 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
745 with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
746 elif with_cgroupctrl == 'none'
747 with_cgroupctrl = 'elogind'
750 # No controller now is a problem:
751 if with_cgroupctrl == ''
752 error('Unable to determine cgroup controller, but cgroups support is mandatory!')
755 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
756 description : 'name of the cgroup controller to use')
757 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
758 '='.join(['name', with_cgroupctrl]))
759 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
760 '='.join(['name', with_cgroupctrl]))
761 ############################################################
764 system_uid_max = get_option('system-uid-max')
765 if system_uid_max == ''
766 system_uid_max = run_command(
768 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
769 '/etc/login.defs').stdout().strip()
770 if system_uid_max == ''
771 system_uid_max = '999'
774 system_uid_max = system_uid_max.to_int()
775 conf.set('SYSTEM_UID_MAX', system_uid_max)
776 substs.set('systemuidmax', system_uid_max)
777 message('maximum system UID is @0@'.format(system_uid_max))
779 system_gid_max = get_option('system-gid-max')
780 if system_gid_max == ''
781 system_gid_max = run_command(
783 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
784 '/etc/login.defs').stdout().strip()
785 if system_gid_max == ''
786 system_gid_max = '999'
789 system_gid_max = system_gid_max.to_int()
790 conf.set('SYSTEM_GID_MAX', system_gid_max)
791 substs.set('systemgidmax', system_gid_max)
792 message('maximum system GID is @0@'.format(system_gid_max))
794 #if 0 /// UNNEEDED by elogind
795 # dynamic_uid_min = get_option('dynamic-uid-min').to_int()
796 # dynamic_uid_max = get_option('dynamic-uid-max').to_int()
797 # conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
798 # conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
799 # substs.set('dynamicuidmin', dynamic_uid_min)
800 # substs.set('dynamicuidmax', dynamic_uid_max)
802 # container_uid_base_min = get_option('container-uid-base-min').to_int()
803 # container_uid_base_max = get_option('container-uid-base-max').to_int()
804 # conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
805 # conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
806 # substs.set('containeruidbasemin', container_uid_base_min)
807 # substs.set('containeruidbasemax', container_uid_base_max)
810 nobody_user = get_option('nobody-user')
811 nobody_group = get_option('nobody-group')
813 getent_result = run_command('getent', 'passwd', '65534')
814 if getent_result.returncode() == 0
815 name = getent_result.stdout().split(':')[0]
816 if name != nobody_user
817 message('WARNING:\n' +
818 ' 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) +
819 ' Your build will result in an user table setup that is incompatible with the local system.')
822 id_result = run_command('id', '-u', nobody_user)
823 if id_result.returncode() == 0
824 id = id_result.stdout().to_int()
826 message('WARNING:\n' +
827 ' 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) +
828 ' Your build will result in an user table setup that is incompatible with the local system.')
832 getent_result = run_command('getent', 'group', '65534')
833 if getent_result.returncode() == 0
834 name = getent_result.stdout().split(':')[0]
835 if name != nobody_group
836 message('WARNING:\n' +
837 ' 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) +
838 ' Your build will result in an group table setup that is incompatible with the local system.')
841 id_result = run_command('id', '-g', nobody_group)
842 if id_result.returncode() == 0
843 id = id_result.stdout().to_int()
845 message('WARNING:\n' +
846 ' 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) +
847 ' Your build will result in an group table setup that is incompatible with the local system.')
850 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
851 message('WARNING:\n' +
852 ' The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
853 ' Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
856 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
857 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
858 substs.set('NOBODY_USER_NAME', nobody_user)
859 substs.set('NOBODY_GROUP_NAME', nobody_group)
861 tty_gid = get_option('tty-gid')
862 conf.set('TTY_GID', tty_gid)
863 substs.set('TTY_GID', tty_gid)
865 #if 0 /// UNNEEDED by elogind
866 # # Ensure provided GID argument is numeric, otherwise fallback to default assignment
867 # if get_option('users-gid') != ''
868 # users_gid = get_option('users-gid').to_int()
872 # substs.set('USERS_GID', users_gid)
874 # if get_option('adm-group')
875 # m4_defines += ['-DENABLE_ADM_GROUP']
878 # if get_option('wheel-group')
879 # m4_defines += ['-DENABLE_WHEEL_GROUP']
882 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
883 # substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
886 kill_user_processes = get_option('default-kill-user-processes')
887 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
888 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
890 #if 0 /// UNNEEDED by elogind
891 # dns_servers = get_option('dns-servers')
892 # conf.set_quoted('DNS_SERVERS', dns_servers)
893 # substs.set('DNS_SERVERS', dns_servers)
895 # ntp_servers = get_option('ntp-servers')
896 # conf.set_quoted('NTP_SERVERS', ntp_servers)
897 # substs.set('NTP_SERVERS', ntp_servers)
900 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
902 #if 0 /// UNNEEDED by elogind
903 # substs.set('SUSHELL', get_option('debug-shell'))
904 # substs.set('DEBUGTTY', get_option('debug-tty'))
907 debug = get_option('debug')
908 enable_debug_hashmap = false
909 enable_debug_mmap_cache = false
910 #if 1 /// additional elogind debug mode
911 enable_debug_elogind = false
914 foreach name : debug.split(',')
916 enable_debug_hashmap = true
917 elif name == 'mmap-cache'
918 enable_debug_mmap_cache = true
919 #if 1 /// additional elogind debug mode
920 elif name == 'elogind'
921 enable_debug_elogind = true
924 message('unknown debug option "@0@", ignoring'.format(name))
928 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
929 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
930 #if 1 /// additional elogind debug mode
931 conf.set10('ENABLE_DEBUG_ELOGIND', enable_debug_elogind)
934 #####################################################################
936 threads = dependency('threads')
937 librt = cc.find_library('rt')
938 libm = cc.find_library('m')
939 libdl = cc.find_library('dl')
940 libcrypt = cc.find_library('crypt')
942 libcap = dependency('libcap', required : false)
943 if not libcap.found()
944 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
945 libcap = cc.find_library('cap')
948 #if 0 /// UNNEEDED by elogind
949 # libmount = dependency('mount',
950 # version : '>= 2.30',
951 # required : not fuzzer_build)
953 # want_seccomp = get_option('seccomp')
954 # if want_seccomp != 'false' and not fuzzer_build
955 # libseccomp = dependency('libseccomp',
956 # version : '>= 2.3.1',
957 # required : want_seccomp == 'true')
958 # have = libseccomp.found()
966 conf.set10('HAVE_SECCOMP', have)
967 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
969 want_selinux = get_option('selinux')
970 if want_selinux != 'false' and not fuzzer_build
971 libselinux = dependency('libselinux',
972 version : '>= 2.1.9',
973 required : want_selinux == 'true')
974 have = libselinux.found()
979 conf.set10('HAVE_SELINUX', have)
980 m4_defines += have ? ['-DHAVE_SELINUX'] : []
982 #if 0 /// UNNEEDED by elogind
983 # want_apparmor = get_option('apparmor')
984 # if want_apparmor != 'false' and not fuzzer_build
985 # libapparmor = dependency('libapparmor',
986 # required : want_apparmor == 'true')
987 # have = libapparmor.found()
995 conf.set10('HAVE_APPARMOR', have)
996 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
998 smack_run_label = get_option('smack-run-label')
999 if smack_run_label != ''
1000 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
1001 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
1004 want_polkit = get_option('polkit')
1005 install_polkit = false
1006 install_polkit_pkla = false
1007 if want_polkit != 'false' and not fuzzer_build
1008 install_polkit = true
1010 libpolkit = dependency('polkit-gobject-1',
1012 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1013 message('Old polkit detected, will install pkla files')
1014 install_polkit_pkla = true
1017 conf.set10('ENABLE_POLKIT', install_polkit)
1019 want_acl = get_option('acl')
1020 if want_acl != 'false' and not fuzzer_build
1021 libacl = cc.find_library('acl', required : want_acl == 'true')
1022 have = libacl.found()
1027 conf.set10('HAVE_ACL', have)
1028 m4_defines += have ? ['-DHAVE_ACL'] : []
1030 want_audit = get_option('audit')
1031 if want_audit != 'false' and not fuzzer_build
1032 libaudit = dependency('audit', required : want_audit == 'true')
1033 have = libaudit.found()
1038 conf.set10('HAVE_AUDIT', have)
1040 #if 0 /// UNNEEDED by elogind
1041 # want_blkid = get_option('blkid')
1042 # if want_blkid != 'false' and not fuzzer_build
1043 # libblkid = dependency('blkid', required : want_blkid == 'true')
1044 # have = libblkid.found()
1049 # conf.set10('HAVE_BLKID', have)
1051 # want_kmod = get_option('kmod')
1052 # if want_kmod != 'false' and not fuzzer_build
1053 # libkmod = dependency('libkmod',
1054 # version : '>= 15',
1055 # required : want_kmod == 'true')
1056 # have = libkmod.found()
1061 # conf.set10('HAVE_KMOD', have)
1067 want_pam = get_option('pam')
1068 if want_pam != 'false' and not fuzzer_build
1069 libpam = cc.find_library('pam', required : want_pam == 'true')
1070 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1071 have = libpam.found() and libpam_misc.found()
1077 conf.set10('HAVE_PAM', have)
1078 m4_defines += have ? ['-DHAVE_PAM'] : []
1080 #if 0 /// UNNEEDED by elogind
1081 # want_microhttpd = get_option('microhttpd')
1082 # if want_microhttpd != 'false' and not fuzzer_build
1083 # libmicrohttpd = dependency('libmicrohttpd',
1084 # version : '>= 0.9.33',
1085 # required : want_microhttpd == 'true')
1086 # have = libmicrohttpd.found()
1089 # libmicrohttpd = []
1091 # conf.set10('HAVE_MICROHTTPD', have)
1092 # m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
1094 # want_libcryptsetup = get_option('libcryptsetup')
1095 # if want_libcryptsetup != 'false' and not fuzzer_build
1096 # libcryptsetup = dependency('libcryptsetup',
1097 # version : '>= 1.6.0',
1098 # required : want_libcryptsetup == 'true')
1099 # have = libcryptsetup.found()
1102 # libcryptsetup = []
1104 # conf.set10('HAVE_LIBCRYPTSETUP', have)
1106 # want_libcurl = get_option('libcurl')
1107 # if want_libcurl != 'false' and not fuzzer_build
1108 # libcurl = dependency('libcurl',
1109 # version : '>= 7.32.0',
1110 # required : want_libcurl == 'true')
1111 # have = libcurl.found()
1116 # conf.set10('HAVE_LIBCURL', have)
1117 # m4_defines += have ? ['-DHAVE_LIBCURL'] : []
1119 # want_libidn = get_option('libidn')
1120 # want_libidn2 = get_option('libidn2')
1121 # if want_libidn == 'true' and want_libidn2 == 'true'
1122 # error('libidn and libidn2 cannot be requested simultaneously')
1125 # if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
1126 # libidn = dependency('libidn',
1127 # required : want_libidn == 'true')
1128 # have = libidn.found()
1133 # conf.set10('HAVE_LIBIDN', have)
1134 # m4_defines += have ? ['-DHAVE_LIBIDN'] : []
1135 # if not have and want_libidn2 != 'false' and not fuzzer_build
1136 # # libidn is used for both libidn and libidn2 objects
1137 # libidn = dependency('libidn2',
1138 # required : want_libidn2 == 'true')
1139 # have = libidn.found()
1143 # conf.set10('HAVE_LIBIDN2', have)
1144 # m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
1146 # want_libiptc = get_option('libiptc')
1147 # if want_libiptc != 'false' and not fuzzer_build
1148 # libiptc = dependency('libiptc',
1149 # required : want_libiptc == 'true')
1150 # have = libiptc.found()
1155 # conf.set10('HAVE_LIBIPTC', have)
1156 # m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
1158 # want_qrencode = get_option('qrencode')
1159 # if want_qrencode != 'false' and not fuzzer_build
1160 # libqrencode = dependency('libqrencode',
1161 # required : want_qrencode == 'true')
1162 # have = libqrencode.found()
1167 # conf.set10('HAVE_QRENCODE', have)
1169 # want_gcrypt = get_option('gcrypt')
1170 # if want_gcrypt != 'false' and not fuzzer_build
1171 # libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1172 # libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1173 # have = libgcrypt.found() and libgpg_error.found()
1178 # # link to neither of the libs if one is not found
1182 # conf.set10('HAVE_GCRYPT', have)
1184 # want_gnutls = get_option('gnutls')
1185 # if want_gnutls != 'false' and not fuzzer_build
1186 # libgnutls = dependency('gnutls',
1187 # version : '>= 3.1.4',
1188 # required : want_gnutls == 'true')
1189 # have = libgnutls.found()
1194 # conf.set10('HAVE_GNUTLS', have)
1196 # want_elfutils = get_option('elfutils')
1197 # if want_elfutils != 'false' and not fuzzer_build
1198 # libdw = dependency('libdw',
1199 # required : want_elfutils == 'true')
1200 # have = libdw.found()
1205 # conf.set10('HAVE_ELFUTILS', have)
1207 # want_zlib = get_option('zlib')
1208 # if want_zlib != 'false' and not fuzzer_build
1209 # libz = dependency('zlib',
1210 # required : want_zlib == 'true')
1211 # have = libz.found()
1216 # conf.set10('HAVE_ZLIB', have)
1218 # want_bzip2 = get_option('bzip2')
1219 # if want_bzip2 != 'false' and not fuzzer_build
1220 # libbzip2 = cc.find_library('bz2',
1221 # required : want_bzip2 == 'true')
1222 # have = libbzip2.found()
1227 # conf.set10('HAVE_BZIP2', have)
1229 # want_xz = get_option('xz')
1230 # if want_xz != 'false' and not fuzzer_build
1231 # libxz = dependency('liblzma',
1232 # required : want_xz == 'true')
1233 # have = libxz.found()
1238 # conf.set10('HAVE_XZ', have)
1240 # want_lz4 = get_option('lz4')
1241 # if want_lz4 != 'false' and not fuzzer_build
1242 # liblz4 = dependency('liblz4',
1243 # required : want_lz4 == 'true')
1244 # have = liblz4.found()
1249 # conf.set10('HAVE_LZ4', have)
1251 # want_xkbcommon = get_option('xkbcommon')
1252 # if want_xkbcommon != 'false' and not fuzzer_build
1253 # libxkbcommon = dependency('xkbcommon',
1254 # version : '>= 0.3.0',
1255 # required : want_xkbcommon == 'true')
1256 # have = libxkbcommon.found()
1278 conf.set10('HAVE_XKBCOMMON', have)
1280 want_pcre2 = get_option('pcre2')
1281 if want_pcre2 != 'false'
1282 libpcre2 = dependency('libpcre2-8',
1283 required : want_pcre2 == 'true')
1284 have = libpcre2.found()
1289 conf.set10('HAVE_PCRE2', have)
1291 want_glib = get_option('glib')
1292 if want_glib != 'false' and not fuzzer_build
1293 libglib = dependency('glib-2.0',
1294 version : '>= 2.22.0',
1295 required : want_glib == 'true')
1296 libgobject = dependency('gobject-2.0',
1297 version : '>= 2.22.0',
1298 required : want_glib == 'true')
1299 libgio = dependency('gio-2.0',
1300 required : want_glib == 'true')
1301 have = libglib.found() and libgobject.found() and libgio.found()
1308 conf.set10('HAVE_GLIB', have)
1310 want_dbus = get_option('dbus')
1311 if want_dbus != 'false' and not fuzzer_build
1312 libdbus = dependency('dbus-1',
1313 version : '>= 1.3.2',
1314 required : want_dbus == 'true')
1315 have = libdbus.found()
1320 conf.set10('HAVE_DBUS', have)
1322 #if 0 /// UNNEEDED by elogind
1323 # default_dnssec = get_option('default-dnssec')
1325 # default_dnssec = 'no'
1327 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1328 # message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1329 # default_dnssec = 'no'
1331 # conf.set('DEFAULT_DNSSEC_MODE',
1332 # 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1333 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1335 # want_importd = get_option('importd')
1336 # if want_importd != 'false'
1337 # have = (conf.get('HAVE_LIBCURL') == 1 and
1338 # conf.get('HAVE_ZLIB') == 1 and
1339 # conf.get('HAVE_BZIP2') == 1 and
1340 # conf.get('HAVE_XZ') == 1 and
1341 # conf.get('HAVE_GCRYPT') == 1)
1342 # if want_importd == 'true' and not have
1343 # error('importd support was requested, but dependencies are not available')
1348 # conf.set10('ENABLE_IMPORTD', have)
1350 # want_remote = get_option('remote')
1351 # if want_remote != 'false'
1352 # have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1353 # conf.get('HAVE_LIBCURL') == 1]
1354 # # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1355 # # it's possible to build one without the other. Complain only if
1356 # # support was explictly requested. The auxiliary files like sysusers
1357 # # config should be installed when any of the programs are built.
1358 # if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1359 # error('remote support was requested, but dependencies are not available')
1361 # have = have_deps[0] or have_deps[1]
1366 conf.set10('ENABLE_REMOTE', have)
1368 foreach term : ['utmp',
1369 #if 0 /// UNNEEDED by elogind
1403 have = get_option(term)
1404 name = 'ENABLE_' + term.underscorify().to_upper()
1405 conf.set10(name, have)
1406 m4_defines += have ? ['-D' + name] : []
1409 want_tests = get_option('tests')
1410 install_tests = get_option('install-tests')
1411 slow_tests = get_option('slow-tests')
1415 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1417 #####################################################################
1419 #if 0 /// UNNEEDED by elogind
1420 # if get_option('efi')
1421 # efi_arch = host_machine.cpu_family()
1423 # if efi_arch == 'x86'
1424 # EFI_MACHINE_TYPE_NAME = 'ia32'
1425 # gnu_efi_arch = 'ia32'
1426 # elif efi_arch == 'x86_64'
1427 # EFI_MACHINE_TYPE_NAME = 'x64'
1428 # gnu_efi_arch = 'x86_64'
1429 # elif efi_arch == 'arm'
1430 # EFI_MACHINE_TYPE_NAME = 'arm'
1431 # gnu_efi_arch = 'arm'
1432 # elif efi_arch == 'aarch64'
1433 # EFI_MACHINE_TYPE_NAME = 'aa64'
1434 # gnu_efi_arch = 'aarch64'
1436 # EFI_MACHINE_TYPE_NAME = ''
1441 # conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1443 # conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1448 conf.set10('ENABLE_EFI', have)
1450 #####################################################################
1452 config_h = configure_file(
1453 output : 'config.h',
1454 configuration : conf)
1456 includes = include_directories('src/basic',
1459 #if 0 /// UNNEEDED by elogind
1465 #if 0 /// UNNEEDED by elogind
1470 #if 0 /// elogind has a different list
1471 # 'src/libsystemd/sd-bus',
1472 # 'src/libsystemd/sd-device',
1473 # 'src/libsystemd/sd-hwdb',
1474 # 'src/libsystemd/sd-id128',
1475 # 'src/libsystemd/sd-netlink',
1476 # 'src/libsystemd/sd-network',
1477 # 'src/libsystemd-network',
1480 'src/libelogind/sd-bus',
1481 'src/libelogind/sd-id128',
1486 add_project_arguments('-include', 'config.h', language : 'c')
1488 #if 0 /// UNNEEDED by elogind
1491 #if 0 /// UNNEEDED by elogind
1494 subdir('src/systemd')
1496 #if 0 /// UNNEEDED by elogind
1497 # subdir('src/libsystemd')
1498 # subdir('src/libsystemd-network')
1499 # subdir('src/journal')
1502 subdir('src/libelogind')
1504 subdir('src/update-utmp')
1508 #if 0 /// UNNEEDED by elogind
1509 # libjournal_core = static_library(
1511 # libjournal_core_sources,
1513 # include_directories : includes,
1516 # libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1517 # libsystemd = shared_library(
1519 # 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
1520 # version : libsystemd_version,
1521 # include_directories : includes,
1522 # link_args : ['-shared',
1523 # '-Wl,--version-script=' + libsystemd_sym_path],
1524 # link_with : [libbasic,
1526 # link_whole : [libsystemd_static,
1527 # libjournal_client],
1528 # dependencies : [threads,
1532 # link_depends : libsystemd_sym,
1534 # install_dir : rootlibdir)
1536 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1537 libelogind = shared_library(
1539 libelogind_internal_sources,
1540 version : libelogind_version,
1541 include_directories : includes,
1542 link_args : ['-shared',
1543 '-Wl,--version-script=' + libelogind_sym_path],
1544 link_with : [libbasic],
1545 dependencies : [threads],
1546 link_depends : libelogind_sym,
1548 install_dir : rootlibdir)
1551 ############################################################
1553 # binaries that have --help and are intended for use by humans,
1554 # usually, but not always, installed in /bin.
1555 public_programs = []
1557 #if 0 /// UNNEEDED by elogind
1558 # subdir('src/libudev')
1560 # elogind depends on external libudev:
1561 libudev = dependency('libudev', required : true)
1563 subdir('src/shared')
1564 #if 0 /// UNNEEDED by elogind
1565 # subdir('src/core')
1566 # subdir('src/udev')
1567 # subdir('src/network')
1569 # subdir('src/analyze')
1570 # subdir('src/journal-remote')
1571 # subdir('src/coredump')
1572 # subdir('src/hostname')
1573 # subdir('src/import')
1574 # subdir('src/kernel-install')
1575 # subdir('src/locale')
1576 # subdir('src/machine')
1577 # subdir('src/nspawn')
1578 # subdir('src/resolve')
1579 # subdir('src/timedate')
1580 # subdir('src/timesync')
1581 # subdir('src/vconsole')
1582 # subdir('src/boot/efi')
1587 #if 0 /// UNNEEDED in elogind
1592 ############################################################
1594 # only static linking apart from libdl, to make sure that the
1595 # module is linked to all libraries that it uses.
1596 test_dlopen = executable(
1599 include_directories : includes,
1600 link_with : [libbasic],
1601 dependencies : [libdl])
1603 #if 0 /// UNNEEDED by elogind
1604 # foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1605 # ['systemd', 'ENABLE_NSS_SYSTEMD'],
1606 # ['mymachines', 'ENABLE_MACHINED'],
1607 # ['resolve', 'ENABLE_RESOLVE']]
1609 # condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1613 # sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1614 # version_script_arg = join_paths(meson.current_source_dir(), sym)
1616 # nss = shared_library(
1618 # 'src/nss-@0@/nss-@0@.c'.format(module),
1620 # include_directories : includes,
1621 # # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1622 # link_args : ['-Wl,-z,nodelete',
1624 # '-Wl,--version-script=' + version_script_arg,
1625 # '-Wl,--undefined'],
1626 # link_with : [libsystemd_static,
1628 # dependencies : [threads,
1630 # link_depends : sym,
1632 # install_dir : rootlibdir)
1634 # # We cannot use shared_module because it does not support version suffix.
1635 # # Unfortunately shared_library insists on creating the symlink…
1636 # meson.add_install_script('sh', '-c',
1637 # 'rm $DESTDIR@0@/libnss_@1@.so'
1638 # .format(rootlibdir, module))
1640 # test('dlopen-nss_' + module,
1642 # args : [nss.full_path()]) # path to dlopen must include a slash
1647 ############################################################
1649 #if 0 /// UNNEEDED by elogind
1650 # executable('systemd',
1652 # include_directories : includes,
1653 # link_with : [libcore,
1655 # dependencies : [threads,
1661 # install_rpath : rootlibexecdir,
1663 # install_dir : rootlibexecdir)
1665 # exe = executable('systemd-analyze',
1666 # systemd_analyze_sources,
1667 # include_directories : includes,
1668 # link_with : [libcore,
1670 # dependencies : [threads,
1676 # install_rpath : rootlibexecdir,
1678 # public_programs += [exe]
1680 # executable('systemd-journald',
1681 # systemd_journald_sources,
1682 # include_directories : includes,
1683 # link_with : [libjournal_core,
1685 # dependencies : [threads,
1689 # install_rpath : rootlibexecdir,
1691 # install_dir : rootlibexecdir)
1693 # exe = executable('systemd-cat',
1694 # systemd_cat_sources,
1695 # include_directories : includes,
1696 # link_with : [libjournal_core,
1698 # dependencies : [threads],
1699 # install_rpath : rootlibexecdir,
1701 # public_programs += [exe]
1703 # exe = executable('journalctl',
1704 # journalctl_sources,
1705 # include_directories : includes,
1706 # link_with : [libshared],
1707 # dependencies : [threads,
1712 # install_rpath : rootlibexecdir,
1714 # install_dir : rootbindir)
1715 # public_programs += [exe]
1717 # executable('systemd-getty-generator',
1718 # 'src/getty-generator/getty-generator.c',
1719 # include_directories : includes,
1720 # link_with : [libshared],
1721 # install_rpath : rootlibexecdir,
1723 # install_dir : systemgeneratordir)
1725 # executable('systemd-debug-generator',
1726 # 'src/debug-generator/debug-generator.c',
1727 # include_directories : includes,
1728 # link_with : [libshared],
1729 # install_rpath : rootlibexecdir,
1731 # install_dir : systemgeneratordir)
1733 # executable('systemd-fstab-generator',
1734 # 'src/fstab-generator/fstab-generator.c',
1735 # 'src/core/mount-setup.c',
1736 # include_directories : includes,
1737 # link_with : [libshared],
1738 # install_rpath : rootlibexecdir,
1740 # install_dir : systemgeneratordir)
1742 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1743 # executable('30-systemd-environment-d-generator',
1744 # 'src/environment-d-generator/environment-d-generator.c',
1745 # include_directories : includes,
1746 # link_with : [libshared],
1747 # install_rpath : rootlibexecdir,
1749 # install_dir : userenvgeneratordir)
1751 # meson.add_install_script(meson_make_symlink,
1752 # join_paths(sysconfdir, 'environment'),
1753 # join_paths(environmentdir, '99-environment.conf'))
1756 # if conf.get('ENABLE_HIBERNATE') == 1
1757 # executable('systemd-hibernate-resume-generator',
1758 # 'src/hibernate-resume/hibernate-resume-generator.c',
1759 # include_directories : includes,
1760 # link_with : [libshared],
1761 # install_rpath : rootlibexecdir,
1763 # install_dir : systemgeneratordir)
1765 # executable('systemd-hibernate-resume',
1766 # 'src/hibernate-resume/hibernate-resume.c',
1767 # include_directories : includes,
1768 # link_with : [libshared],
1769 # install_rpath : rootlibexecdir,
1771 # install_dir : rootlibexecdir)
1774 # if conf.get('HAVE_BLKID') == 1
1775 # executable('systemd-gpt-auto-generator',
1776 # 'src/gpt-auto-generator/gpt-auto-generator.c',
1777 # 'src/basic/blkid-util.h',
1778 # include_directories : includes,
1779 # link_with : [libshared],
1780 # dependencies : libblkid,
1781 # install_rpath : rootlibexecdir,
1783 # install_dir : systemgeneratordir)
1785 # exe = executable('systemd-dissect',
1786 # 'src/dissect/dissect.c',
1787 # include_directories : includes,
1788 # link_with : [libshared],
1789 # install_rpath : rootlibexecdir,
1791 # install_dir : rootlibexecdir)
1792 # public_programs += [exe]
1795 # if conf.get('ENABLE_RESOLVE') == 1
1796 # executable('systemd-resolved',
1797 # systemd_resolved_sources,
1798 # include_directories : includes,
1799 # link_with : [libshared,
1801 # libsystemd_resolve_core],
1802 # dependencies : [threads,
1806 # install_rpath : rootlibexecdir,
1808 # install_dir : rootlibexecdir)
1810 # exe = executable('systemd-resolve',
1811 # systemd_resolve_sources,
1812 # include_directories : includes,
1813 # link_with : [libshared,
1815 # libsystemd_resolve_core],
1816 # dependencies : [threads,
1820 # install_rpath : rootlibexecdir,
1822 # public_programs += [exe]
1825 # if conf.get('ENABLE_LOGIND') == 1
1826 # executable('systemd-logind',
1827 # systemd_logind_sources,
1828 # include_directories : includes,
1829 # link_with : [liblogind_core,
1831 # dependencies : [threads,
1833 # install_rpath : rootlibexecdir,
1835 # install_dir : rootlibexecdir)
1837 # exe = executable('loginctl',
1839 # include_directories : includes,
1840 # link_with : [libshared],
1841 # dependencies : [threads,
1844 # install_rpath : rootlibexecdir,
1846 # install_dir : rootbindir)
1847 # public_programs += [exe]
1849 # exe = executable('systemd-inhibit',
1850 # 'src/login/inhibit.c',
1851 # include_directories : includes,
1852 # link_with : [libshared],
1853 # install_rpath : rootlibexecdir,
1855 # install_dir : rootbindir)
1856 # public_programs += [exe]
1858 # if conf.get('HAVE_PAM') == 1
1859 # version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1860 # pam_systemd = shared_library(
1864 # include_directories : includes,
1865 # link_args : ['-shared',
1866 # '-Wl,--version-script=' + version_script_arg],
1867 # link_with : [libsystemd_static,
1868 # libshared_static],
1869 # dependencies : [threads,
1872 # link_depends : pam_systemd_sym,
1874 # install_dir : pamlibdir)
1876 # test('dlopen-pam_systemd',
1878 # args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1883 executable('elogind',
1885 include_directories : includes,
1886 link_with : [liblogind_core,
1888 dependencies : [threads,
1891 install_rpath : rootlibexecdir,
1893 install_dir : rootlibexecdir)
1895 exe = executable('loginctl',
1897 include_directories : includes,
1898 link_with : [libshared],
1899 dependencies : [threads,
1901 install_rpath : rootlibexecdir,
1903 install_dir : rootbindir)
1904 public_programs += [exe]
1906 exe = executable('elogind-inhibit',
1907 'src/login/inhibit.c',
1908 include_directories : includes,
1909 link_with : [libshared],
1910 dependencies : [threads],
1911 install_rpath : rootlibexecdir,
1913 install_dir : rootbindir)
1914 public_programs += [exe]
1916 if conf.get('HAVE_PAM') == 1
1917 version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1918 pam_elogind = shared_library(
1922 include_directories : includes,
1923 link_args : ['-shared',
1924 '-Wl,--version-script=' + version_script_arg],
1925 link_with : [libelogind,
1927 dependencies : [threads,
1930 link_depends : pam_elogind_sym,
1932 install_dir : pamlibdir)
1934 test('dlopen-pam_elogind',
1936 args : [pam_elogind.full_path()]) # path to dlopen must include a slash
1939 #if 0 /// UNNEEDED by elogind
1940 # executable('systemd-user-sessions',
1941 # 'src/user-sessions/user-sessions.c',
1942 # include_directories : includes,
1943 # link_with : [libshared],
1944 # install_rpath : rootlibexecdir,
1946 # install_dir : rootlibexecdir)
1949 # if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1950 # exe = executable('bootctl',
1951 # 'src/boot/bootctl.c',
1952 # include_directories : includes,
1953 # link_with : [libshared],
1954 # dependencies : [libblkid],
1955 # install_rpath : rootlibexecdir,
1957 # public_programs += [exe]
1960 # exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1961 # include_directories : includes,
1962 # link_with : [libshared],
1963 # dependencies : [threads],
1964 # install_rpath : rootlibexecdir,
1966 # public_programs += [exe]
1968 # exe = executable('systemctl', 'src/systemctl/systemctl.c',
1969 # include_directories : includes,
1970 # link_with : [libshared],
1971 # dependencies : [threads,
1976 # install_rpath : rootlibexecdir,
1978 # install_dir : rootbindir)
1979 # public_programs += [exe]
1981 # if conf.get('ENABLE_BACKLIGHT') == 1
1982 # executable('systemd-backlight',
1983 # 'src/backlight/backlight.c',
1984 # include_directories : includes,
1985 # link_with : [libshared],
1986 # install_rpath : rootlibexecdir,
1988 # install_dir : rootlibexecdir)
1991 # if conf.get('ENABLE_RFKILL') == 1
1992 # executable('systemd-rfkill',
1993 # 'src/rfkill/rfkill.c',
1994 # include_directories : includes,
1995 # link_with : [libshared],
1996 # install_rpath : rootlibexecdir,
1998 # install_dir : rootlibexecdir)
2001 # executable('systemd-system-update-generator',
2002 # 'src/system-update-generator/system-update-generator.c',
2003 # include_directories : includes,
2004 # link_with : [libshared],
2005 # install_rpath : rootlibexecdir,
2007 # install_dir : systemgeneratordir)
2009 # if conf.get('HAVE_LIBCRYPTSETUP') == 1
2010 # executable('systemd-cryptsetup',
2011 # 'src/cryptsetup/cryptsetup.c',
2012 # include_directories : includes,
2013 # link_with : [libshared],
2014 # dependencies : [libcryptsetup],
2015 # install_rpath : rootlibexecdir,
2017 # install_dir : rootlibexecdir)
2019 # executable('systemd-cryptsetup-generator',
2020 # 'src/cryptsetup/cryptsetup-generator.c',
2021 # include_directories : includes,
2022 # link_with : [libshared],
2023 # dependencies : [libcryptsetup],
2024 # install_rpath : rootlibexecdir,
2026 # install_dir : systemgeneratordir)
2028 # executable('systemd-veritysetup',
2029 # 'src/veritysetup/veritysetup.c',
2030 # include_directories : includes,
2031 # link_with : [libshared],
2032 # dependencies : [libcryptsetup],
2033 # install_rpath : rootlibexecdir,
2035 # install_dir : rootlibexecdir)
2037 # executable('systemd-veritysetup-generator',
2038 # 'src/veritysetup/veritysetup-generator.c',
2039 # include_directories : includes,
2040 # link_with : [libshared],
2041 # dependencies : [libcryptsetup],
2042 # install_rpath : rootlibexecdir,
2044 # install_dir : systemgeneratordir)
2047 # if conf.get('HAVE_SYSV_COMPAT') == 1
2048 # executable('systemd-sysv-generator',
2049 # 'src/sysv-generator/sysv-generator.c',
2050 # include_directories : includes,
2051 # link_with : [libshared],
2052 # install_rpath : rootlibexecdir,
2054 # install_dir : systemgeneratordir)
2056 # executable('systemd-rc-local-generator',
2057 # 'src/rc-local-generator/rc-local-generator.c',
2058 # include_directories : includes,
2059 # link_with : [libshared],
2060 # install_rpath : rootlibexecdir,
2062 # install_dir : systemgeneratordir)
2065 # if conf.get('ENABLE_HOSTNAMED') == 1
2066 # executable('systemd-hostnamed',
2067 # 'src/hostname/hostnamed.c',
2068 # include_directories : includes,
2069 # link_with : [libshared],
2070 # install_rpath : rootlibexecdir,
2072 # install_dir : rootlibexecdir)
2074 # exe = executable('hostnamectl',
2075 # 'src/hostname/hostnamectl.c',
2076 # include_directories : includes,
2077 # link_with : [libshared],
2078 # install_rpath : rootlibexecdir,
2080 # public_programs += [exe]
2083 # if conf.get('ENABLE_LOCALED') == 1
2084 # if conf.get('HAVE_XKBCOMMON') == 1
2085 # # logind will load libxkbcommon.so dynamically on its own
2091 # executable('systemd-localed',
2092 # systemd_localed_sources,
2093 # include_directories : includes,
2094 # link_with : [libshared],
2095 # dependencies : deps,
2096 # install_rpath : rootlibexecdir,
2098 # install_dir : rootlibexecdir)
2100 # exe = executable('localectl',
2101 # localectl_sources,
2102 # include_directories : includes,
2103 # link_with : [libshared],
2104 # install_rpath : rootlibexecdir,
2106 # public_programs += [exe]
2109 # if conf.get('ENABLE_TIMEDATED') == 1
2110 # executable('systemd-timedated',
2111 # 'src/timedate/timedated.c',
2112 # include_directories : includes,
2113 # link_with : [libshared],
2114 # install_rpath : rootlibexecdir,
2116 # install_dir : rootlibexecdir)
2118 # exe = executable('timedatectl',
2119 # 'src/timedate/timedatectl.c',
2120 # include_directories : includes,
2121 # install_rpath : rootlibexecdir,
2122 # link_with : [libshared],
2124 # public_programs += [exe]
2127 # if conf.get('ENABLE_TIMESYNCD') == 1
2128 # executable('systemd-timesyncd',
2129 # systemd_timesyncd_sources,
2130 # include_directories : includes,
2131 # link_with : [libshared],
2132 # dependencies : [threads,
2134 # install_rpath : rootlibexecdir,
2136 # install_dir : rootlibexecdir)
2139 # if conf.get('ENABLE_MACHINED') == 1
2140 # executable('systemd-machined',
2141 # systemd_machined_sources,
2142 # include_directories : includes,
2143 # link_with : [libmachine_core,
2145 # install_rpath : rootlibexecdir,
2147 # install_dir : rootlibexecdir)
2149 # exe = executable('machinectl',
2150 # 'src/machine/machinectl.c',
2151 # include_directories : includes,
2152 # link_with : [libshared],
2153 # dependencies : [threads,
2156 # install_rpath : rootlibexecdir,
2158 # install_dir : rootbindir)
2159 # public_programs += [exe]
2162 # if conf.get('ENABLE_IMPORTD') == 1
2163 # executable('systemd-importd',
2164 # systemd_importd_sources,
2165 # include_directories : includes,
2166 # link_with : [libshared],
2167 # dependencies : [threads],
2168 # install_rpath : rootlibexecdir,
2170 # install_dir : rootlibexecdir)
2172 # systemd_pull = executable('systemd-pull',
2173 # systemd_pull_sources,
2174 # include_directories : includes,
2175 # link_with : [libshared],
2176 # dependencies : [libcurl,
2181 # install_rpath : rootlibexecdir,
2183 # install_dir : rootlibexecdir)
2185 # systemd_import = executable('systemd-import',
2186 # systemd_import_sources,
2187 # include_directories : includes,
2188 # link_with : [libshared],
2189 # dependencies : [libcurl,
2193 # install_rpath : rootlibexecdir,
2195 # install_dir : rootlibexecdir)
2197 # systemd_export = executable('systemd-export',
2198 # systemd_export_sources,
2199 # include_directories : includes,
2200 # link_with : [libshared],
2201 # dependencies : [libcurl,
2205 # install_rpath : rootlibexecdir,
2207 # install_dir : rootlibexecdir)
2208 # public_programs += [systemd_pull, systemd_import, systemd_export]
2211 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2212 # exe = executable('systemd-journal-upload',
2213 # systemd_journal_upload_sources,
2214 # include_directories : includes,
2215 # link_with : [libshared],
2216 # dependencies : [threads,
2221 # install_rpath : rootlibexecdir,
2223 # install_dir : rootlibexecdir)
2224 # public_programs += [exe]
2227 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2228 # s_j_remote = executable('systemd-journal-remote',
2229 # systemd_journal_remote_sources,
2230 # include_directories : includes,
2231 # link_with : [libshared],
2232 # dependencies : [threads,
2237 # install_rpath : rootlibexecdir,
2239 # install_dir : rootlibexecdir)
2241 # s_j_gatewayd = executable('systemd-journal-gatewayd',
2242 # systemd_journal_gatewayd_sources,
2243 # include_directories : includes,
2244 # link_with : [libshared],
2245 # dependencies : [threads,
2250 # install_rpath : rootlibexecdir,
2252 # install_dir : rootlibexecdir)
2253 # public_programs += [s_j_remote, s_j_gatewayd]
2256 # if conf.get('ENABLE_COREDUMP') == 1
2257 # executable('systemd-coredump',
2258 # systemd_coredump_sources,
2259 # include_directories : includes,
2260 # link_with : [libshared],
2261 # dependencies : [threads,
2266 # install_rpath : rootlibexecdir,
2268 # install_dir : rootlibexecdir)
2270 # exe = executable('coredumpctl',
2271 # coredumpctl_sources,
2272 # include_directories : includes,
2273 # link_with : [libshared],
2274 # dependencies : [threads,
2277 # install_rpath : rootlibexecdir,
2279 # public_programs += [exe]
2282 # if conf.get('ENABLE_BINFMT') == 1
2283 # exe = executable('systemd-binfmt',
2284 # 'src/binfmt/binfmt.c',
2285 # include_directories : includes,
2286 # link_with : [libshared],
2287 # install_rpath : rootlibexecdir,
2289 # install_dir : rootlibexecdir)
2290 # public_programs += [exe]
2292 # meson.add_install_script('sh', '-c',
2293 # mkdir_p.format(binfmtdir))
2294 # meson.add_install_script('sh', '-c',
2295 # mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2298 # if conf.get('ENABLE_VCONSOLE') == 1
2299 # executable('systemd-vconsole-setup',
2300 # 'src/vconsole/vconsole-setup.c',
2301 # include_directories : includes,
2302 # link_with : [libshared],
2303 # install_rpath : rootlibexecdir,
2305 # install_dir : rootlibexecdir)
2308 # if conf.get('ENABLE_RANDOMSEED') == 1
2309 # executable('systemd-random-seed',
2310 # 'src/random-seed/random-seed.c',
2311 # include_directories : includes,
2312 # link_with : [libshared],
2313 # install_rpath : rootlibexecdir,
2315 # install_dir : rootlibexecdir)
2318 # if conf.get('ENABLE_FIRSTBOOT') == 1
2319 # executable('systemd-firstboot',
2320 # 'src/firstboot/firstboot.c',
2321 # include_directories : includes,
2322 # link_with : [libshared],
2323 # dependencies : [libcrypt],
2324 # install_rpath : rootlibexecdir,
2326 # install_dir : rootbindir)
2329 # executable('systemd-remount-fs',
2330 # 'src/remount-fs/remount-fs.c',
2331 # 'src/core/mount-setup.c',
2332 # 'src/core/mount-setup.h',
2333 # include_directories : includes,
2334 # link_with : [libshared],
2335 # install_rpath : rootlibexecdir,
2337 # install_dir : rootlibexecdir)
2339 # executable('systemd-machine-id-setup',
2340 # 'src/machine-id-setup/machine-id-setup-main.c',
2341 # 'src/core/machine-id-setup.c',
2342 # 'src/core/machine-id-setup.h',
2343 # include_directories : includes,
2344 # link_with : [libshared],
2345 # install_rpath : rootlibexecdir,
2347 # install_dir : rootbindir)
2349 # executable('systemd-fsck',
2350 # 'src/fsck/fsck.c',
2351 # include_directories : includes,
2352 # link_with : [libshared],
2353 # install_rpath : rootlibexecdir,
2355 # install_dir : rootlibexecdir)
2357 # executable('elogind-growfs',
2358 # 'src/partition/growfs.c',
2359 # include_directories : includes,
2360 # link_with : [libshared],
2361 # dependencies : [libcryptsetup],
2362 # install_rpath : rootlibexecdir,
2364 # install_dir : rootlibexecdir)
2366 # executable('elogind-makefs',
2367 # 'src/partition/makefs.c',
2368 # include_directories : includes,
2369 # link_with : [libshared],
2370 # install_rpath : rootlibexecdir,
2372 # install_dir : rootlibexecdir)
2374 # executable('systemd-sleep',
2375 # 'src/sleep/sleep.c',
2376 # include_directories : includes,
2377 # link_with : [libshared],
2378 # install_rpath : rootlibexecdir,
2380 # install_dir : rootlibexecdir)
2382 # exe = executable('systemd-sysctl',
2383 # 'src/sysctl/sysctl.c',
2384 # include_directories : includes,
2385 # link_with : [libshared],
2386 # install_rpath : rootlibexecdir,
2388 # install_dir : rootlibexecdir)
2389 # public_programs += [exe]
2391 # executable('systemd-ac-power',
2392 # 'src/ac-power/ac-power.c',
2393 # include_directories : includes,
2394 # link_with : [libshared],
2395 # install_rpath : rootlibexecdir,
2397 # install_dir : rootlibexecdir)
2399 # exe = executable('systemd-detect-virt',
2400 # 'src/detect-virt/detect-virt.c',
2401 # include_directories : includes,
2402 # link_with : [libshared],
2403 # install_rpath : rootlibexecdir,
2405 # public_programs += [exe]
2407 # exe = executable('systemd-delta',
2408 # 'src/delta/delta.c',
2409 # include_directories : includes,
2410 # link_with : [libshared],
2411 # install_rpath : rootlibexecdir,
2413 # public_programs += [exe]
2415 # exe = executable('systemd-escape',
2416 # 'src/escape/escape.c',
2417 # include_directories : includes,
2418 # link_with : [libshared],
2419 # install_rpath : rootlibexecdir,
2421 # install_dir : rootbindir)
2422 # public_programs += [exe]
2424 # exe = executable('systemd-notify',
2425 # 'src/notify/notify.c',
2426 # include_directories : includes,
2427 # link_with : [libshared],
2428 # install_rpath : rootlibexecdir,
2430 # install_dir : rootbindir)
2431 # public_programs += [exe]
2433 # executable('systemd-volatile-root',
2434 # 'src/volatile-root/volatile-root.c',
2435 # include_directories : includes,
2436 # link_with : [libshared],
2437 # install_rpath : rootlibexecdir,
2439 # install_dir : rootlibexecdir)
2441 # executable('systemd-cgroups-agent',
2442 # 'src/cgroups-agent/cgroups-agent.c',
2443 # include_directories : includes,
2444 # link_with : [libshared],
2445 # install_rpath : rootlibexecdir,
2447 # install_dir : rootlibexecdir)
2449 executable('elogind-cgroups-agent',
2450 'src/cgroups-agent/cgroups-agent.c',
2451 include_directories : includes,
2452 link_with : [libshared_static],
2453 install_rpath : rootlibexecdir,
2455 install_dir : rootlibexecdir)
2458 #if 0 /// UNNEEDED by elogind
2459 # exe = executable('systemd-path',
2460 # 'src/path/path.c',
2461 # include_directories : includes,
2462 # link_with : [libshared],
2463 # install_rpath : rootlibexecdir,
2465 # public_programs += [exe]
2467 # exe = executable('systemd-ask-password',
2468 # 'src/ask-password/ask-password.c',
2469 # include_directories : includes,
2470 # link_with : [libshared],
2471 # install_rpath : rootlibexecdir,
2473 # install_dir : rootbindir)
2474 # public_programs += [exe]
2476 # executable('systemd-reply-password',
2477 # 'src/reply-password/reply-password.c',
2478 # include_directories : includes,
2479 # link_with : [libshared],
2480 # install_rpath : rootlibexecdir,
2482 # install_dir : rootlibexecdir)
2484 # exe = executable('systemd-tty-ask-password-agent',
2485 # 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2486 # include_directories : includes,
2487 # link_with : [libshared],
2488 # install_rpath : rootlibexecdir,
2490 # install_dir : rootbindir)
2491 # public_programs += [exe]
2493 # exe = executable('systemd-cgls',
2494 # 'src/cgls/cgls.c',
2495 # include_directories : includes,
2496 # link_with : [libshared],
2497 # install_rpath : rootlibexecdir,
2499 # public_programs += [exe]
2501 # exe = executable('systemd-cgtop',
2502 # 'src/cgtop/cgtop.c',
2503 # include_directories : includes,
2504 # link_with : [libshared],
2505 # install_rpath : rootlibexecdir,
2507 # public_programs += [exe]
2509 # executable('systemd-initctl',
2510 # 'src/initctl/initctl.c',
2511 # include_directories : includes,
2512 # link_with : [libshared],
2513 # install_rpath : rootlibexecdir,
2515 # install_dir : rootlibexecdir)
2517 # exe = executable('systemd-mount',
2518 # 'src/mount/mount-tool.c',
2519 # include_directories : includes,
2520 # link_with : [libshared],
2521 # install_rpath : rootlibexecdir,
2523 # public_programs += [exe]
2525 # meson.add_install_script(meson_make_symlink,
2526 # 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2528 # exe = executable('systemd-run',
2530 # include_directories : includes,
2531 # link_with : [libshared],
2532 # install_rpath : rootlibexecdir,
2534 # public_programs += [exe]
2536 # exe = executable('systemd-stdio-bridge',
2537 # 'src/stdio-bridge/stdio-bridge.c',
2538 # include_directories : includes,
2539 # link_with : [libshared],
2540 # install_rpath : rootlibexecdir,
2542 # public_programs += [exe]
2544 # exe = executable('busctl',
2545 # 'src/busctl/busctl.c',
2546 # 'src/busctl/busctl-introspect.c',
2547 # 'src/busctl/busctl-introspect.h',
2548 # include_directories : includes,
2549 # link_with : [libshared],
2550 # install_rpath : rootlibexecdir,
2552 # public_programs += [exe]
2554 # if conf.get('ENABLE_SYSUSERS') == 1
2555 # exe = executable('systemd-sysusers',
2556 # 'src/sysusers/sysusers.c',
2557 # include_directories : includes,
2558 # link_with : [libshared],
2559 # install_rpath : rootlibexecdir,
2561 # install_dir : rootbindir)
2562 # public_programs += [exe]
2565 # if conf.get('ENABLE_TMPFILES') == 1
2566 # exe = executable('systemd-tmpfiles',
2567 # 'src/tmpfiles/tmpfiles.c',
2568 # include_directories : includes,
2569 # link_with : [libshared],
2570 # dependencies : [libacl],
2571 # install_rpath : rootlibexecdir,
2573 # install_dir : rootbindir)
2574 # public_programs += [exe]
2576 # test('test-systemd-tmpfiles',
2577 # test_systemd_tmpfiles_py,
2578 # args : exe.full_path())
2579 # # https://github.com/mesonbuild/meson/issues/2681
2582 # if conf.get('ENABLE_HWDB') == 1
2583 # exe = executable('systemd-hwdb',
2584 # 'src/hwdb/hwdb.c',
2585 # 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2586 # include_directories : includes,
2587 # link_with : [libudev_static],
2588 # install_rpath : udev_rpath,
2590 # install_dir : rootbindir)
2591 # public_programs += [exe]
2594 # if conf.get('ENABLE_QUOTACHECK') == 1
2595 # executable('systemd-quotacheck',
2596 # 'src/quotacheck/quotacheck.c',
2597 # include_directories : includes,
2598 # link_with : [libshared],
2599 # install_rpath : rootlibexecdir,
2601 # install_dir : rootlibexecdir)
2604 # exe = executable('systemd-socket-proxyd',
2605 # 'src/socket-proxy/socket-proxyd.c',
2606 # include_directories : includes,
2607 # link_with : [libshared],
2608 # dependencies : [threads],
2609 # install_rpath : rootlibexecdir,
2611 # install_dir : rootlibexecdir)
2612 # public_programs += [exe]
2614 # exe = executable('systemd-udevd',
2615 # systemd_udevd_sources,
2616 # include_directories : includes,
2617 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2618 # link_with : [libudev_core,
2619 # libsystemd_network,
2621 # dependencies : [threads,
2626 # install_rpath : udev_rpath,
2628 # install_dir : rootlibexecdir)
2629 # public_programs += [exe]
2631 # exe = executable('udevadm',
2633 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2634 # include_directories : includes,
2635 # link_with : [libudev_core,
2636 # libsystemd_network,
2638 # dependencies : [threads,
2643 # install_rpath : udev_rpath,
2645 # install_dir : rootbindir)
2646 # public_programs += [exe]
2648 # executable('systemd-shutdown',
2649 # systemd_shutdown_sources,
2650 # include_directories : includes,
2651 # link_with : [libshared],
2652 # install_rpath : rootlibexecdir,
2654 # install_dir : rootlibexecdir)
2656 # executable('systemd-update-done',
2657 # 'src/update-done/update-done.c',
2658 # include_directories : includes,
2659 # link_with : [libshared],
2660 # install_rpath : rootlibexecdir,
2662 # install_dir : rootlibexecdir)
2664 # executable('systemd-update-utmp',
2665 # 'src/update-utmp/update-utmp.c',
2666 # include_directories : includes,
2667 # link_with : [libshared],
2668 # dependencies : [libaudit],
2669 # install_rpath : rootlibexecdir,
2671 # install_dir : rootlibexecdir)
2673 # if conf.get('HAVE_KMOD') == 1
2674 # executable('systemd-modules-load',
2675 # 'src/modules-load/modules-load.c',
2676 # include_directories : includes,
2677 # link_with : [libshared],
2678 # dependencies : [libkmod],
2679 # install_rpath : rootlibexecdir,
2681 # install_dir : rootlibexecdir)
2683 # meson.add_install_script('sh', '-c',
2684 # mkdir_p.format(modulesloaddir))
2685 # meson.add_install_script('sh', '-c',
2686 # mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2689 # exe = executable('systemd-nspawn',
2690 # systemd_nspawn_sources,
2691 # 'src/core/mount-setup.c', # FIXME: use a variable?
2692 # 'src/core/mount-setup.h',
2693 # 'src/core/loopback-setup.c',
2694 # 'src/core/loopback-setup.h',
2695 # include_directories : [includes, include_directories('src/nspawn')],
2696 # link_with : [libshared],
2697 # dependencies : [libacl,
2701 # install_rpath : rootlibexecdir,
2703 # public_programs += [exe]
2705 # if conf.get('ENABLE_NETWORKD') == 1
2706 # executable('systemd-networkd',
2707 # systemd_networkd_sources,
2708 # include_directories : includes,
2709 # link_with : [libnetworkd_core,
2710 # libsystemd_network,
2713 # dependencies : [threads],
2714 # install_rpath : rootlibexecdir,
2716 # install_dir : rootlibexecdir)
2718 # executable('systemd-networkd-wait-online',
2719 # systemd_networkd_wait_online_sources,
2720 # include_directories : includes,
2721 # link_with : [libnetworkd_core,
2723 # install_rpath : rootlibexecdir,
2725 # install_dir : rootlibexecdir)
2727 # exe = executable('networkctl',
2728 # networkctl_sources,
2729 # include_directories : includes,
2730 # link_with : [libsystemd_network,
2732 # install_rpath : rootlibexecdir,
2734 # install_dir : rootbindir)
2735 # public_programs += [exe]
2738 # executable('systemd-sulogin-shell',
2739 # ['src/sulogin-shell/sulogin-shell.c'],
2740 # include_directories : includes,
2741 # link_with : [libshared],
2742 # install_rpath : rootlibexecdir,
2744 # install_dir : rootlibexecdir)
2746 executable('elogind-uaccess-command',
2747 'src/uaccess-command/uaccess-command.c',
2748 include_directories : includes,
2749 link_with : [liblogind_core,
2751 dependencies: [libacl,
2753 install_rpath : rootlibexecdir,
2755 install_dir : rootlibexecdir)
2758 ############################################################
2760 foreach tuple : tests
2762 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2763 dependencies = tuple[2]
2764 condition = tuple.length() >= 4 ? tuple[3] : ''
2765 type = tuple.length() >= 5 ? tuple[4] : ''
2766 defs = tuple.length() >= 6 ? tuple[5] : []
2767 incs = tuple.length() >= 7 ? tuple[6] : includes
2770 name = sources[0].split('/')[-1].split('.')[0]
2771 if type.startswith('timeout=')
2772 timeout = type.split('=')[1].to_int()
2775 if want_tests == 'false'
2776 message('Not compiling @0@ because tests is set to false'.format(name))
2777 elif condition == '' or conf.get(condition) == 1
2781 include_directories : incs,
2782 link_with : link_with,
2783 dependencies : dependencies,
2785 install_rpath : rootlibexecdir,
2786 install : install_tests,
2787 install_dir : join_paths(testsdir, type))
2790 message('@0@ is a manual test'.format(name))
2791 elif type == 'unsafe' and want_tests != 'unsafe'
2792 message('@0@ is an unsafe test'.format(name))
2799 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2803 #if 0 /// UNNEEDED by elogind
2804 # test_libsystemd_sym = executable(
2805 # 'test-libsystemd-sym',
2806 # test_libsystemd_sym_c,
2807 # include_directories : includes,
2808 # link_with : [libsystemd],
2809 # install : install_tests,
2810 # install_dir : testsdir)
2811 # test('test-libsystemd-sym',
2812 # test_libsystemd_sym)
2814 # test_libudev_sym = executable(
2815 # 'test-libudev-sym',
2816 # test_libudev_sym_c,
2817 # include_directories : includes,
2818 # c_args : ['-Wno-deprecated-declarations'],
2819 # link_with : [libudev],
2820 # install : install_tests,
2821 # install_dir : testsdir)
2822 # test('test-libudev-sym',
2825 # ############################################################
2829 # foreach tuple : fuzzers
2830 # sources = tuple[0]
2831 # link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2832 # dependencies = tuple[2]
2833 # defs = tuple.length() >= 4 ? tuple[3] : []
2834 # incs = tuple.length() >= 5 ? tuple[4] : includes
2837 # dependencies += fuzzing_engine
2839 # sources += 'src/fuzz/fuzz-main.c'
2842 # name = sources[0].split('/')[-1].split('.')[0]
2844 # fuzzer_exes += executable(
2847 # include_directories : [incs, include_directories('src/fuzz')],
2848 # link_with : link_with,
2849 # dependencies : dependencies,
2854 # run_target('fuzzers',
2855 # depends : fuzzer_exes,
2856 # command : ['true'])
2858 # ############################################################
2861 test_libelogind_sym = executable(
2862 'test-libelogind-sym',
2863 test_libelogind_sym_c,
2864 include_directories : includes,
2865 link_with : [libelogind],
2866 install : install_tests,
2867 install_dir : testsdir)
2868 test('test-libelogind-sym',
2869 test_libelogind_sym)
2871 make_directive_index_py = find_program('tools/make-directive-index.py')
2872 make_man_index_py = find_program('tools/make-man-index.py')
2873 xml_helper_py = find_program('tools/xml_helper.py')
2874 #if 0 /// UNNEEDED by elogind
2875 # hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2878 # subdir('sysctl.d')
2879 # subdir('sysusers.d')
2880 # subdir('tmpfiles.d')
2886 subdir('shell-completion/bash')
2887 subdir('shell-completion/zsh')
2888 #if 0 /// UNNEEDED by elogind
2889 # subdir('docs/sysvinit')
2890 # subdir('docs/var-log')
2893 # FIXME: figure out if the warning is true:
2894 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2895 install_subdir('factory/etc',
2896 install_dir : factorydir)
2899 #if 0 /// UNNEEDED by elogind
2900 # install_data('xorg/50-systemd-user.sh',
2901 # install_dir : xinitrcdir)
2902 # install_data('modprobe.d/systemd.conf',
2903 # install_dir : modprobedir)
2905 install_data('README',
2908 #if 0 /// UNNEEDED by elogind
2914 'TRANSIENT-SETTINGS.md',
2916 'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
2917 install_dir : docdir)
2919 #if 0 /// UNNEEDED by elogind
2920 # meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2922 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2924 ############################################################
2926 meson_check_help = find_program('tools/meson-check-help.sh')
2928 foreach exec : public_programs
2929 name = exec.full_path().split('/')[-1]
2930 test('check-help-' + name,
2932 args : [exec.full_path()])
2935 ############################################################
2938 foreach p : fuzz_regression_tests
2939 a = p.split('/')[-3]
2940 b = p.split('/')[-2]
2941 c = p.split('/')[-1]
2944 build = sanitize_address
2946 error('unknown sanitizer @0@'.format(a))
2949 name = '@1@:@0@'.format(a, b)
2952 if want_tests == 'false'
2953 message('Not compiling @0@ because tests is set to false'.format(name))
2954 elif not sanitizers.contains(a)
2955 message('Not compiling @0@ because @1@ sanitizer is not available'.format(name, a))
2957 exe = custom_target(
2961 command : [env, 'ln', '-fs',
2962 join_paths(build.full_path(), b),
2964 build_by_default : true)
2966 message('Not compiling @0@ because slow-tests is set to false'.format(name))
2971 if want_tests != 'false' and slow_tests
2972 test(c, env, args : [exe.full_path(),
2973 join_paths(meson.source_root(),
2974 'test/fuzz-regressions',
2979 ############################################################
2982 all_files = run_command(
2984 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2987 all_files = files(all_files.stdout().split())
2992 command : [env, 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2996 command : [env, 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2999 #if 0 /// UNNEEDED by elogind
3001 # meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
3004 # command : [meson_git_contrib_sh])
3009 git_head = run_command(
3011 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3012 'rev-parse', 'HEAD']).stdout().strip()
3013 git_head_short = run_command(
3015 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3016 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3020 command : ['git', 'archive',
3021 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
3023 '--prefix', 'systemd-@0@/'.format(git_head),
3027 ############################################################
3029 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
3032 depends : [man, libelogind, libudev],
3033 command : [meson_check_api_docs_sh, libelogind.full_path(), libudev.full_path()])
3035 ############################################################
3038 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3040 #if 0 /// UNSUPPORTED by elogind
3041 # 'prefix directory: @0@'.format(prefixdir),
3042 # 'rootprefix directory: @0@'.format(rootprefixdir),
3043 # 'sysconf directory: @0@'.format(sysconfdir),
3044 # 'include directory: @0@'.format(includedir),
3045 # 'lib directory: @0@'.format(libdir),
3046 # 'rootlib directory: @0@'.format(rootlibdir),
3047 # 'SysV init scripts: @0@'.format(sysvinit_path),
3048 # 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3050 'rootexeclib dir: @0@'.format(rootlibexecdir),
3052 #if 0 /// UNSUPPORTED by elogind
3053 # 'PAM modules directory: @0@'.format(pamlibdir),
3054 # 'PAM configuration directory: @0@'.format(pamconfdir),
3055 # 'RPM macros directory: @0@'.format(rpmmacrosdir),
3056 # 'modprobe.d directory: @0@'.format(modprobedir),
3057 # 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3058 # 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3059 # 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3060 # 'bash completions directory: @0@'.format(bashcompletiondir),
3061 # 'zsh completions directory: @0@'.format(zshcompletiondir),
3062 # 'extra start script: @0@'.format(get_option('rc-local')),
3063 # 'extra stop script: @0@'.format(get_option('halt-local')),
3064 # 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3065 # get_option('debug-tty')),
3067 'TTY GID: @0@'.format(tty_gid),
3068 #if 0 /// UNSUPPORTED by elogind
3069 # 'users GID: @0@'.format(users_gid),
3071 'maximum system UID: @0@'.format(system_uid_max),
3072 'maximum system GID: @0@'.format(system_gid_max),
3073 #if 0 /// UNSUPPORTED by elogind
3074 # 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
3075 # 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
3076 # 'minimum container UID base: @0@'.format(container_uid_base_min),
3077 # 'maximum container UID base: @0@'.format(container_uid_base_max),
3078 # '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3079 # 'render group access mode: @0@'.format(get_option('group-render-mode')),
3080 # 'certificate root directory: @0@'.format(get_option('certificate-root')),
3081 # 'support URL: @0@'.format(support_url),
3082 # 'nobody user name: @0@'.format(nobody_user),
3083 # 'nobody group name: @0@'.format(nobody_group),
3084 # 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3085 # 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
3087 # 'default DNSSEC mode: @0@'.format(default_dnssec),
3088 # 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3090 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
3092 #if 0 /// UNSUPPORTED by elogind
3093 # alt_dns_servers = '\n '.join(dns_servers.split(' '))
3094 # alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3096 # 'default DNS servers: @0@'.format(alt_dns_servers),
3097 # 'default NTP servers: @0@'.format(alt_ntp_servers)]
3099 # alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3100 # '@@0@'.format(time_epoch)).stdout().strip()
3102 # 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3106 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3107 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3108 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3110 #if 0 /// UNNEEDED by elogind
3111 # if conf.get('ENABLE_EFI') == 1
3113 # 'efi arch: @0@'.format(efi_arch)]
3117 # 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3118 # 'EFI CC @0@'.format(efi_cc),
3119 # 'EFI lib directory: @0@'.format(efi_libdir),
3120 # 'EFI lds directory: @0@'.format(efi_ldsdir),
3121 # 'EFI include directory: @0@'.format(efi_incdir)]
3130 #if 0 /// UNNEEDED by elogind
3131 # ['libcryptsetup'],
3135 #if 0 /// UNNEEDED by elogind
3140 #if 0 /// UNNEEDED by elogind
3144 #if 0 /// UNNEEDED by elogind
3151 #if 0 /// UNNEEDED by elogind
3167 # ['environment.d'],
3185 ['legacy pkla', install_polkit_pkla],
3186 #if 0 /// UNNEEDED by elogind
3188 # ['gnu-efi', have_gnu_efi],
3196 #if 0 /// UNNEEDED by elogind
3197 # ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
3201 ['man pages', want_man],
3202 ['html pages', want_html],
3203 ['man page indices', want_man and have_lxml],
3204 #if 0 /// UNNEEDED by elogind
3205 # ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
3209 #if 0 /// UNNEEDED by elogind
3212 # ['adm group', get_option('adm-group')],
3213 # ['wheel group', get_option('wheel-group')],
3219 ['debug mmap cache'],
3222 cond = tuple.get(1, '')
3224 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3225 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3226 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3231 missing += [tuple[0]]
3237 'enabled features: @0@'.format(', '.join(found)),
3239 'disabled features: @0@'.format(', '.join(missing)),
3241 message('\n '.join(status))
3243 if rootprefixdir != rootprefix_default
3244 message('WARNING:\n' +
3245 ' Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3246 ' elogind used fixed names for unit file directories and other paths, so anything\n' +
3247 ' except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))