1 project('elogind', 'c',
10 meson_version : '>= 0.40',
13 libsystemd_version = '0.19.0'
14 libudev_version = '1.6.6'
16 # We need the same data in three different formats, ugh!
17 # Also, for hysterical reasons, we use different variable
18 # names, sometimes. Not all variables are included in every
20 conf = configuration_data()
21 conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
22 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
24 substs = configuration_data()
25 substs.set('PACKAGE_URL', 'https://github.com/elogind/elogind')
26 substs.set('PACKAGE_VERSION', meson.project_version())
30 #####################################################################
31 #if 0 /// elogind does not need this
33 # Try to install the git pre-commit hook
34 # git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
35 # if git_hook.returncode() == 0
36 # message(git_hook.stdout().strip())
39 # elogind Note: We use precompiler masks for two reasons:
40 # 1) The masking is consistent with the sources
41 # 2) The git patch creator we use for preparing upstream patches
42 # manipulates commits to not take those masks out. Therefore
43 # it can be used to add commits updating the meson files, too.
46 #####################################################################
48 rootprefixdir = get_option('rootprefix')
49 conf.set10('HAVE_SPLIT_USR', get_option('split-usr'))
50 if get_option('split-usr')
51 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/'
53 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr'
56 #if 0 /// UNNEEDED by elogind
57 # sysvinit_path = get_option('sysvinit-path')
58 # sysvrcnd_path = get_option('sysvrcnd-path')
59 # have = sysvinit_path != '' or sysvrcnd_path != ''
60 # conf.set10('HAVE_SYSV_COMPAT', have,
61 # description : 'SysV init scripts and rcN.d links are supported')
62 # m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
65 # join_paths ignore the preceding arguments if an absolute component is
66 # encountered, so this should canonicalize various paths when they are
67 # absolute or relative.
68 prefixdir = get_option('prefix')
69 if not prefixdir.startswith('/')
70 error('Prefix is not absolute: "@0@"'.format(prefixdir))
72 bindir = join_paths(prefixdir, get_option('bindir'))
73 libdir = join_paths(prefixdir, get_option('libdir'))
74 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
75 includedir = join_paths(prefixdir, get_option('includedir'))
76 datadir = join_paths(prefixdir, get_option('datadir'))
77 localstatedir = join_paths('/', get_option('localstatedir'))
79 rootbindir = join_paths(rootprefixdir, 'bin')
80 #if 0 /// elogind has a different default
81 # rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
83 rootlibexecdir = get_option('rootlibexecdir')
84 rootlibexecdir = rootlibexecdir != '' ? rootlibexecdir : join_paths(rootprefixdir, 'lib/elogind')
87 rootlibdir = get_option('rootlibdir')
89 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
92 # Dirs of external packages
93 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
94 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
95 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
96 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
97 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
98 varlogdir = join_paths(localstatedir, 'log')
99 #if 0 /// UNNEEDED by elogind
100 # xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
101 # rpmmacrosdir = get_option('rpmmacrosdir')
102 # modprobedir = join_paths(prefixdir, 'lib/modprobe.d')
106 #if 0 /// elogind has a bit different layout and does not need all of theses
107 # pkgdatadir = join_paths(datadir, 'systemd')
108 # environmentdir = join_paths(prefixdir, 'lib/environment.d')
109 # pkgsysconfdir = join_paths(sysconfdir, 'systemd')
110 # userunitdir = join_paths(prefixdir, 'lib/systemd/user')
111 # userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
112 # tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
113 # sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
114 # sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
115 # binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
116 # modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
117 # networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
118 # pkgincludedir = join_paths(includedir, 'systemd')
119 # systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
120 # usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
121 # systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
122 # userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
123 # systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
124 # systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
125 # systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
126 # systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
127 # udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
128 # udevhomedir = udevlibexecdir
129 # udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
130 # udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
131 # catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
132 # kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
133 # factorydir = join_paths(datadir, 'factory')
134 # docdir = join_paths(datadir, 'doc/systemd')
135 # bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
136 # testsdir = join_paths(prefixdir, 'lib/systemd/tests')
137 # systemdstatedir = join_paths(localstatedir, 'lib/systemd')
138 # catalogstatedir = join_paths(systemdstatedir, 'catalog')
139 # randomseeddir = join_paths(localstatedir, 'lib/systemd')
141 pkgdatadir = join_paths(datadir, 'elogind')
142 pkgsysconfdir = join_paths(sysconfdir, 'elogind')
143 pkgincludedir = join_paths(includedir, 'elogind/systemd')
144 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
145 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
147 # in elogind, udev is external and hus configurable
148 udevlibexecdir = get_option('udevbindir')
149 udevlibexecdir = udevlibexecdir != '' ? udevlibexecdir : join_paths(rootprefixdir, 'lib/udev')
150 udevrulesdir = get_option('udevrulesdir')
151 udevrulesdir = udevrulesdir != '' ? udevrulesdir : join_paths(udevlibexecdir, 'rules.d')
152 udevhomedir = udevlibexecdir
153 factorydir = join_paths(datadir, 'factory')
154 docdir = '-'.join([join_paths(datadir, 'doc/elogind'),
155 meson.project_version()])
156 testsdir = join_paths(prefixdir, 'lib/elogind/tests')
157 systemdstatedir = join_paths(localstatedir, 'lib/elogind')
158 randomseeddir = join_paths(localstatedir, 'lib/elogind')
161 dbuspolicydir = get_option('dbuspolicydir')
162 if dbuspolicydir == ''
163 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
166 dbussessionservicedir = get_option('dbussessionservicedir')
167 if dbussessionservicedir == ''
168 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
171 dbussystemservicedir = get_option('dbussystemservicedir')
172 if dbussystemservicedir == ''
173 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
176 pamlibdir = get_option('pamlibdir')
178 pamlibdir = join_paths(rootlibdir, 'security')
181 pamconfdir = get_option('pamconfdir')
183 pamconfdir = join_paths(sysconfdir, 'pam.d')
186 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
187 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
188 #if 0 /// UNNEEDED by elogind
189 # conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
190 # conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
191 # conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
192 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
193 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
194 # conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
195 # conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
196 # conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
197 # conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
198 # conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
199 # conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
200 # conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
201 # conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
202 # conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
203 # conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
204 # conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
205 # conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
207 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'elogind-cgroups-agent'))
208 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'elogind'))
210 conf.set_quoted('ROOTPREFIX', rootprefixdir)
211 #if 0 /// UNNEEDED by elogind
212 # conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
213 # conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
214 # conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
215 # conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
216 # conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
217 # conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
218 # conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
220 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
221 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
222 #if 0 /// UNNEEDED by elogind
223 # conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
224 # conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
226 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
227 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
228 conf.set_quoted('LIBDIR', libdir)
229 conf.set_quoted('ROOTLIBDIR', rootlibdir)
230 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
231 #if 0 /// UNNEEDED by elogind
232 # conf.set_quoted('BOOTLIBDIR', bootlibdir)
233 # conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
234 # conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
235 # conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
236 # conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
237 # conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
238 # conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
241 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
242 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
244 substs.set('prefix', prefixdir)
245 substs.set('exec_prefix', prefixdir)
246 substs.set('libdir', libdir)
247 substs.set('rootlibdir', rootlibdir)
248 substs.set('includedir', includedir)
249 substs.set('pkgsysconfdir', pkgsysconfdir)
250 substs.set('bindir', bindir)
251 substs.set('rootbindir', rootbindir)
252 substs.set('rootlibexecdir', rootlibexecdir)
253 #if 0 /// UNNEEDED by elogind
254 # substs.set('systemunitdir', systemunitdir)
255 # substs.set('userunitdir', userunitdir)
256 # substs.set('systempresetdir', systempresetdir)
257 # substs.set('userpresetdir', userpresetdir)
258 # substs.set('udevhwdbdir', udevhwdbdir)
260 substs.set('udevrulesdir', udevrulesdir)
261 substs.set('udevlibexecdir', udevlibexecdir)
262 #if 0 /// UNNEEDED by elogind
263 # substs.set('catalogdir', catalogdir)
264 # substs.set('tmpfilesdir', tmpfilesdir)
265 # substs.set('sysusersdir', sysusersdir)
266 # substs.set('sysctldir', sysctldir)
267 # substs.set('binfmtdir', binfmtdir)
268 # substs.set('modulesloaddir', modulesloaddir)
269 # substs.set('systemgeneratordir', systemgeneratordir)
270 # substs.set('usergeneratordir', usergeneratordir)
271 # substs.set('systemenvgeneratordir', systemenvgeneratordir)
272 # substs.set('userenvgeneratordir', userenvgeneratordir)
274 substs.set('systemshutdowndir', systemshutdowndir)
275 substs.set('systemsleepdir', systemsleepdir)
276 substs.set('VARLOGDIR', varlogdir)
277 #if 0 /// UNNEEDED by elogind
278 # substs.set('CERTIFICATEROOT', get_option('certificate-root'))
279 # substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
280 # substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
281 # substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
282 # substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
283 # substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
284 # substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
287 #####################################################################
289 cc = meson.get_compiler('c')
290 pkgconfig = import('pkgconfig')
291 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
293 cxx = find_program('c++', required : false)
295 # Used only for tests
299 foreach arg : ['-Wextra',
302 '-Wmissing-include-dirs',
303 '-Wold-style-definition',
306 '-Wdeclaration-after-statement',
308 '-Wsuggest-attribute=noreturn',
309 '-Werror=missing-prototypes',
310 '-Werror=implicit-function-declaration',
311 '-Werror=missing-declarations',
312 '-Werror=return-type',
313 '-Werror=incompatible-pointer-types',
315 '-Wstrict-prototypes',
317 '-Wmissing-noreturn',
320 '-Wstrict-aliasing=2',
327 '-fdiagnostics-show-option',
328 '-fno-strict-aliasing',
329 '-fvisibility=hidden',
331 '-fstack-protector-strong',
333 '--param=ssp-buffer-size=4',
335 if cc.has_argument(arg)
336 add_project_arguments(arg, language : 'c')
340 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
341 # arguments, just emits a warnings. So test for the "positive" version instead.
342 foreach arg : ['unused-parameter',
343 'missing-field-initializers',
346 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
348 if cc.has_argument('-W' + arg)
349 add_project_arguments('-Wno-' + arg, language : 'c')
355 #include <inttypes.h>
356 typedef uint64_t usec_t;
357 usec_t now(clockid_t clock);
362 ', name : '-Werror=shadow with local shadowing')
363 add_project_arguments('-Werror=shadow', language : 'c')
366 if cc.get_id() == 'clang'
367 foreach arg : ['-Wno-typedef-redefinition',
368 '-Wno-gnu-variable-sized-type-not-at-end',
370 if cc.has_argument(arg,
371 name : '@0@ is supported'.format(arg))
372 add_project_arguments(arg, language : 'c')
377 link_test_c = files('tools/meson-link-test.c')
379 # --as-needed and --no-undefined are provided by meson by default,
380 # run mesonconf to see what is enabled
381 foreach arg : ['-Wl,-z,relro',
386 have = run_command(check_compilation_sh,
387 cc.cmd_array(), '-x', 'c', arg,
388 '-include', link_test_c).returncode() == 0
389 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
391 add_project_link_arguments(arg, language : 'c')
395 if get_option('buildtype') != 'debug'
396 foreach arg : ['-ffunction-sections',
398 if cc.has_argument(arg,
399 name : '@0@ is supported'.format(arg))
400 add_project_arguments(arg, language : 'c')
404 foreach arg : ['-Wl,--gc-sections']
405 have = run_command(check_compilation_sh,
406 cc.cmd_array(), '-x', 'c', arg,
407 '-include', link_test_c).returncode() == 0
408 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
410 add_project_link_arguments(arg, language : 'c')
415 cpp = ' '.join(cc.cmd_array()) + ' -E'
417 #####################################################################
418 # compilation result tests
420 conf.set('_GNU_SOURCE', true)
421 conf.set('__SANE_USERSPACE_TYPES__', true)
423 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
424 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
425 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
426 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
427 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
428 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
429 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
433 #include <linux/ethtool.h>
434 #include <linux/fib_rules.h>
436 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
438 foreach decl : ['char16_t',
441 'struct ethtool_link_settings',
442 'struct fib_rule_uid_range',
445 # We get -1 if the size cannot be determined
446 have = cc.sizeof(decl, prefix : decl_headers) > 0
447 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
450 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
451 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
452 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
453 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
454 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
455 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
456 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
457 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
458 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
459 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
460 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
461 # if_tunnel.h is buggy and cannot be included on its own
462 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
463 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
464 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
465 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
466 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
467 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
468 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
469 ['NDA_IFINDEX', 'linux/neighbour.h'],
470 ['IFA_FLAGS', 'linux/if_addr.h'],
471 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
472 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
474 prefix = decl.length() > 2 ? decl[2] : ''
475 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
476 conf.set10('HAVE_' + decl[0], have)
479 foreach ident : ['secure_getenv', '__secure_getenv']
480 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
484 ['memfd_create', '''#include <sys/memfd.h>'''],
485 ['gettid', '''#include <sys/types.h>'''],
486 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
487 ['name_to_handle_at', '''#define _GNU_SOURCE
488 #include <sys/types.h>
489 #include <sys/stat.h>
490 #include <fcntl.h>'''],
491 ['setns', '''#define _GNU_SOURCE
492 #include <sched.h>'''],
493 ['renameat2', '''#include <stdio.h>'''],
494 ['kcmp', '''#include <linux/kcmp.h>'''],
495 ['keyctl', '''#include <sys/types.h>
496 #include <keyutils.h>'''],
497 ['copy_file_range', '''#include <sys/syscall.h>
498 #include <unistd.h>'''],
499 ['bpf', '''#include <sys/syscall.h>
500 #include <unistd.h>'''],
501 ['explicit_bzero' , '''#include <string.h>'''],
504 have = cc.has_function(ident[0], prefix : ident[1])
505 conf.set10('HAVE_' + ident[0].to_upper(), have)
508 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
509 conf.set10('USE_SYS_RANDOM_H', true)
510 conf.set10('HAVE_GETRANDOM', true)
512 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
513 conf.set10('USE_SYS_RANDOM_H', false)
514 conf.set10('HAVE_GETRANDOM', have)
517 #####################################################################
519 sed = find_program('sed')
520 grep = find_program('grep')
521 awk = find_program('awk')
522 m4 = find_program('m4')
523 stat = find_program('stat')
524 git = find_program('git', required : false)
526 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
527 mkdir_p = 'mkdir -p $DESTDIR/@0@'
528 #if 0 /// unneeded by elogind
529 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
530 # splash_bmp = files('test/splash.bmp')
533 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
534 # /usr/sbin, /sbin, and fall back to the default from middle column.
535 #if 0 /// elogind has a bit different list and some adaptions
536 # progs = [['telinit', '/lib/sysvinit/telinit'],
537 # ['quotaon', '/usr/sbin/quotaon' ],
538 # ['quotacheck', '/usr/sbin/quotacheck' ],
539 # ['kill', '/usr/bin/kill' ],
540 # ['kmod', '/usr/bin/kmod' ],
541 # ['kexec', '/usr/sbin/kexec' ],
542 # ['sulogin', '/usr/sbin/sulogin' ],
543 # ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
544 # ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
545 # ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
546 # ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
549 progs = [['kexec', '/usr/sbin/kexec', 'KEXEC'],
550 ['reboot', '/sbin/reboot', 'REBOOT'],
551 ['halt', '/sbin/halt', 'HALT'],
555 path = get_option(prog[0] + '-path')
557 message('Using @1@ for @0@'.format(prog[0], path))
559 exe = find_program(prog[0],
560 '/usr/sbin/' + prog[0],
563 path = exe.found() ? exe.path() : prog[1]
565 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
566 conf.set_quoted(name, path)
567 substs.set(name, path)
570 if run_command('ln', '--relative', '--help').returncode() != 0
571 error('ln does not support --relative')
574 ############################################################
576 gperf = find_program('gperf')
578 gperf_test_format = '''
580 const char * in_word_set(const char *, @0@);
583 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
584 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
585 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
586 if cc.compiles(gperf_test)
587 gperf_len_type = 'size_t'
589 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
590 if cc.compiles(gperf_test)
591 gperf_len_type = 'unsigned'
593 error('unable to determine gperf len type')
596 message('gperf len type is @0@'.format(gperf_len_type))
597 conf.set('GPERF_LEN_TYPE', gperf_len_type,
598 description : 'The type of gperf "len" parameter')
600 ############################################################
602 if not cc.has_header('sys/capability.h')
603 error('POSIX caps headers not found')
605 foreach header : ['linux/btrfs.h',
607 'linux/vm_sockets.h',
609 'valgrind/memcheck.h',
610 'valgrind/valgrind.h',
613 conf.set10('HAVE_' + header.underscorify().to_upper(),
614 cc.has_header(header))
617 ############################################################
619 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
620 #if 0 /// UNNEEDED by elogind
621 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
622 # gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
625 default_hierarchy = get_option('default-hierarchy')
626 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
627 description : 'default cgroup hierarchy as string')
628 if default_hierarchy == 'legacy'
629 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
630 elif default_hierarchy == 'hybrid'
631 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
633 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
636 #if 0 /// UNNEEDED by elogind
637 # time_epoch = get_option('time-epoch')
638 # if time_epoch == ''
639 # NEWS = files('NEWS')
640 # time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
642 # time_epoch = time_epoch.to_int()
643 # conf.set('TIME_EPOCH', time_epoch)
645 ############################################################
646 # elogind needs to know which cgroups controller to follow.
647 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
648 with_cgroupctrl = get_option('cgroup-controller')
649 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
650 with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
651 elif with_cgroupctrl == 'none'
652 with_cgroupctrl = 'elogind'
655 # No controller now is a problem:
656 if with_cgroupctrl == ''
657 error('Unable to determine cgroup controller, but cgroups support is mandatory!')
660 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
661 description : 'name of the cgroup controller to use')
662 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
663 '='.join(['name', with_cgroupctrl]))
664 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
665 '='.join(['name', with_cgroupctrl]))
666 ############################################################
669 system_uid_max = get_option('system-uid-max')
670 if system_uid_max == ''
671 system_uid_max = run_command(
673 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
674 '/etc/login.defs').stdout()
676 system_uid_max = system_uid_max.to_int()
677 conf.set('SYSTEM_UID_MAX', system_uid_max)
678 substs.set('systemuidmax', system_uid_max)
679 message('maximum system UID is @0@'.format(system_uid_max))
681 #if 0 /// UNNEEDED by elogind
682 # conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
683 # conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
686 system_gid_max = get_option('system-gid-max')
687 if system_gid_max == ''
688 system_gid_max = run_command(
690 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
691 '/etc/login.defs').stdout()
693 system_gid_max = system_gid_max.to_int()
694 conf.set('SYSTEM_GID_MAX', system_gid_max)
695 substs.set('systemgidmax', system_gid_max)
696 message('maximum system GID is @0@'.format(system_gid_max))
698 tty_gid = get_option('tty-gid')
699 conf.set('TTY_GID', tty_gid)
700 substs.set('TTY_GID', tty_gid)
702 #if 0 /// UNNEEDED by elogind
703 # if get_option('adm-group')
704 # m4_defines += ['-DENABLE_ADM_GROUP']
707 # if get_option('wheel-group')
708 # m4_defines += ['-DENABLE_WHEEL_GROUP']
711 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
714 kill_user_processes = get_option('default-kill-user-processes')
715 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
716 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
718 #if 0 /// UNNEEDED by elogind
719 # dns_servers = get_option('dns-servers')
720 # conf.set_quoted('DNS_SERVERS', dns_servers)
721 # substs.set('DNS_SERVERS', dns_servers)
723 # ntp_servers = get_option('ntp-servers')
724 # conf.set_quoted('NTP_SERVERS', ntp_servers)
725 # substs.set('NTP_SERVERS', ntp_servers)
728 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
730 #if 0 /// UNNEEDED by elogind
731 # substs.set('SUSHELL', get_option('debug-shell'))
732 # substs.set('DEBUGTTY', get_option('debug-tty'))
735 debug = get_option('debug')
736 enable_debug_hashmap = false
737 enable_debug_mmap_cache = false
739 foreach name : debug.split(',')
741 enable_debug_hashmap = true
742 elif name == 'mmap-cache'
743 #if 1 /// additional elogind debug mode
744 elif name == 'elogind'
745 conf.set('ENABLE_DEBUG_ELOGIND', true)
747 enable_debug_mmap_cache = true
749 message('unknown debug option "@0@", ignoring'.format(name))
753 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
754 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
756 #####################################################################
758 threads = dependency('threads')
759 librt = cc.find_library('rt')
760 libm = cc.find_library('m')
761 libdl = cc.find_library('dl')
762 libcrypt = cc.find_library('crypt')
764 libcap = dependency('libcap', required : false)
765 if not libcap.found()
766 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
767 libcap = cc.find_library('cap')
770 #if 0 /// UNNEEDED by elogind
771 # libmount = dependency('mount',
772 # version : '>= 2.30')
774 # want_seccomp = get_option('seccomp')
775 # if want_seccomp != 'false'
776 # libseccomp = dependency('libseccomp',
777 # version : '>= 2.3.1',
778 # required : want_seccomp == 'true')
779 # have = libseccomp.found()
787 conf.set10('HAVE_SECCOMP', have)
788 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
790 want_selinux = get_option('selinux')
791 if want_selinux != 'false'
792 libselinux = dependency('libselinux',
793 version : '>= 2.1.9',
794 required : want_selinux == 'true')
795 have = libselinux.found()
800 conf.set10('HAVE_SELINUX', have)
801 m4_defines += have ? ['-DHAVE_SELINUX'] : []
803 #if 0 /// UNNEEDED by elogind
804 # want_apparmor = get_option('apparmor')
805 # if want_apparmor != 'false'
806 # libapparmor = dependency('libapparmor',
807 # required : want_apparmor == 'true')
808 # have = libapparmor.found()
816 conf.set10('HAVE_APPARMOR', have)
817 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
819 smack_run_label = get_option('smack-run-label')
820 if smack_run_label != ''
821 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
822 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
825 want_polkit = get_option('polkit')
826 install_polkit = false
827 install_polkit_pkla = false
828 if want_polkit != 'false'
829 install_polkit = true
831 libpolkit = dependency('polkit-gobject-1',
833 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
834 message('Old polkit detected, will install pkla files')
835 install_polkit_pkla = true
838 conf.set10('ENABLE_POLKIT', install_polkit)
840 want_acl = get_option('acl')
841 if want_acl != 'false'
842 libacl = cc.find_library('acl', required : want_acl == 'true')
843 have = libacl.found()
848 conf.set10('HAVE_ACL', have)
849 m4_defines += have ? ['-DHAVE_ACL'] : []
851 want_audit = get_option('audit')
852 if want_audit != 'false'
853 libaudit = dependency('audit', required : want_audit == 'true')
854 have = libaudit.found()
859 conf.set10('HAVE_AUDIT', have)
861 #if 0 /// UNNEEDED by elogind
862 # want_blkid = get_option('blkid')
863 # if want_blkid != 'false'
864 # libblkid = dependency('blkid', required : want_blkid == 'true')
865 # have = libblkid.found()
870 # conf.set10('HAVE_BLKID', have)
872 # want_kmod = get_option('kmod')
873 # if want_kmod != 'false'
874 # libkmod = dependency('libkmod',
876 # required : want_kmod == 'true')
877 # have = libkmod.found()
882 # conf.set10('HAVE_KMOD', have)
888 want_pam = get_option('pam')
889 if want_pam != 'false'
890 libpam = cc.find_library('pam', required : want_pam == 'true')
891 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
892 have = libpam.found() and libpam_misc.found()
898 conf.set10('HAVE_PAM', have)
899 m4_defines += have ? ['-DHAVE_PAM'] : []
901 #if 0 /// UNNEEDED by elogind
902 # want_microhttpd = get_option('microhttpd')
903 # if want_microhttpd != 'false'
904 # libmicrohttpd = dependency('libmicrohttpd',
905 # version : '>= 0.9.33',
906 # required : want_microhttpd == 'true')
907 # have = libmicrohttpd.found()
912 # conf.set10('HAVE_MICROHTTPD', have)
913 # m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
915 # want_libcryptsetup = get_option('libcryptsetup')
916 # if want_libcryptsetup != 'false'
917 # libcryptsetup = dependency('libcryptsetup',
918 # version : '>= 1.6.0',
919 # required : want_libcryptsetup == 'true')
920 # have = libcryptsetup.found()
925 # conf.set10('HAVE_LIBCRYPTSETUP', have)
927 # want_libcurl = get_option('libcurl')
928 # if want_libcurl != 'false'
929 # libcurl = dependency('libcurl',
930 # version : '>= 7.32.0',
931 # required : want_libcurl == 'true')
932 # have = libcurl.found()
937 # conf.set10('HAVE_LIBCURL', have)
938 # m4_defines += have ? ['-DHAVE_LIBCURL'] : []
940 # want_libidn = get_option('libidn')
941 # want_libidn2 = get_option('libidn2')
942 # if want_libidn == 'true' and want_libidn2 == 'true'
943 # error('libidn and libidn2 cannot be requested simultaneously')
946 # if want_libidn != 'false' and want_libidn2 != 'true'
947 # libidn = dependency('libidn',
948 # required : want_libidn == 'true')
949 # have = libidn.found()
954 # conf.set10('HAVE_LIBIDN', have)
955 # m4_defines += have ? ['-DHAVE_LIBIDN'] : []
956 # if not have and want_libidn2 != 'false'
957 # # libidn is used for both libidn and libidn2 objects
958 # libidn = dependency('libidn2',
959 # required : want_libidn2 == 'true')
960 # have = libidn.found()
964 # conf.set10('HAVE_LIBIDN2', have)
965 # m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
967 # want_libiptc = get_option('libiptc')
968 # if want_libiptc != 'false'
969 # libiptc = dependency('libiptc',
970 # required : want_libiptc == 'true')
971 # have = libiptc.found()
976 # conf.set10('HAVE_LIBIPTC', have)
977 # m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
979 # want_qrencode = get_option('qrencode')
980 # if want_qrencode != 'false'
981 # libqrencode = dependency('libqrencode',
982 # required : want_qrencode == 'true')
983 # have = libqrencode.found()
988 # conf.set10('HAVE_QRENCODE', have)
990 # want_gcrypt = get_option('gcrypt')
991 # if want_gcrypt != 'false'
992 # libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
993 # libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
994 # have = libgcrypt.found() and libgpg_error.found()
999 # # link to neither of the libs if one is not found
1003 # conf.set10('HAVE_GCRYPT', have)
1005 # want_gnutls = get_option('gnutls')
1006 # if want_gnutls != 'false'
1007 # libgnutls = dependency('gnutls',
1008 # version : '>= 3.1.4',
1009 # required : want_gnutls == 'true')
1010 # have = libgnutls.found()
1015 # conf.set10('HAVE_GNUTLS', have)
1017 # want_elfutils = get_option('elfutils')
1018 # if want_elfutils != 'false'
1019 # libdw = dependency('libdw',
1020 # required : want_elfutils == 'true')
1021 # have = libdw.found()
1026 # conf.set10('HAVE_ELFUTILS', have)
1028 # want_zlib = get_option('zlib')
1029 # if want_zlib != 'false'
1030 # libz = dependency('zlib',
1031 # required : want_zlib == 'true')
1032 # have = libz.found()
1037 # conf.set10('HAVE_ZLIB', have)
1039 # want_bzip2 = get_option('bzip2')
1040 # if want_bzip2 != 'false'
1041 # libbzip2 = cc.find_library('bz2',
1042 # required : want_bzip2 == 'true')
1043 # have = libbzip2.found()
1048 # conf.set10('HAVE_BZIP2', have)
1050 # want_xz = get_option('xz')
1051 # if want_xz != 'false'
1052 # libxz = dependency('liblzma',
1053 # required : want_xz == 'true')
1054 # have = libxz.found()
1059 # conf.set10('HAVE_XZ', have)
1061 # want_lz4 = get_option('lz4')
1062 # if want_lz4 != 'false'
1063 # liblz4 = dependency('liblz4',
1064 # required : want_lz4 == 'true')
1065 # have = liblz4.found()
1070 # conf.set10('HAVE_LZ4', have)
1072 # want_xkbcommon = get_option('xkbcommon')
1073 # if want_xkbcommon != 'false'
1074 # libxkbcommon = dependency('xkbcommon',
1075 # version : '>= 0.3.0',
1076 # required : want_xkbcommon == 'true')
1077 # have = libxkbcommon.found()
1099 conf.set10('HAVE_XKBCOMMON', have)
1101 want_glib = get_option('glib')
1102 if want_glib != 'false'
1103 libglib = dependency('glib-2.0',
1104 version : '>= 2.22.0',
1105 required : want_glib == 'true')
1106 libgobject = dependency('gobject-2.0',
1107 version : '>= 2.22.0',
1108 required : want_glib == 'true')
1109 libgio = dependency('gio-2.0',
1110 required : want_glib == 'true')
1111 have = libglib.found() and libgobject.found() and libgio.found()
1118 conf.set10('HAVE_GLIB', have)
1120 want_dbus = get_option('dbus')
1121 if want_dbus != 'false'
1122 libdbus = dependency('dbus-1',
1123 version : '>= 1.3.2',
1124 required : want_dbus == 'true')
1125 have = libdbus.found()
1130 conf.set10('HAVE_DBUS', have)
1132 #if 0 /// UNNEEDED by elogind
1133 # default_dnssec = get_option('default-dnssec')
1134 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1135 # message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1136 # default_dnssec = 'no'
1138 # conf.set('DEFAULT_DNSSEC_MODE',
1139 # 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1140 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1142 # want_importd = get_option('importd')
1143 # if want_importd != 'false'
1144 # have = (conf.get('HAVE_LIBCURL') == 1 and
1145 # conf.get('HAVE_ZLIB') == 1 and
1146 # conf.get('HAVE_BZIP2') == 1 and
1147 # conf.get('HAVE_XZ') == 1 and
1148 # conf.get('HAVE_GCRYPT') == 1)
1149 # if want_importd == 'true' and not have
1150 # error('importd support was requested, but dependencies are not available')
1155 # conf.set10('ENABLE_IMPORTD', have)
1157 # want_remote = get_option('remote')
1158 # if want_remote != 'false'
1159 # have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1160 # conf.get('HAVE_LIBCURL') == 1]
1161 # # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1162 # # it's possible to build one without the other. Complain only if
1163 # # support was explictly requested. The auxiliary files like sysusers
1164 # # config should be installed when any of the programs are built.
1165 # if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1166 # error('remote support was requested, but dependencies are not available')
1168 # have = have_deps[0] or have_deps[1]
1173 conf.set10('ENABLE_REMOTE', have)
1175 foreach pair : [['utmp', 'HAVE_UTMP'],
1176 #if 0 /// UNNEEDED by elogind
1177 # ['hibernate', 'ENABLE_HIBERNATE'],
1178 # ['environment-d', 'ENABLE_ENVIRONMENT_D'],
1179 # ['binfmt', 'ENABLE_BINFMT'],
1180 # ['coredump', 'ENABLE_COREDUMP'],
1181 # ['resolve', 'ENABLE_RESOLVED'],
1182 # ['logind', 'ENABLE_LOGIND'],
1183 # ['hostnamed', 'ENABLE_HOSTNAMED'],
1184 # ['localed', 'ENABLE_LOCALED'],
1185 # ['machined', 'ENABLE_MACHINED'],
1186 # ['networkd', 'ENABLE_NETWORKD'],
1187 # ['timedated', 'ENABLE_TIMEDATED'],
1188 # ['timesyncd', 'ENABLE_TIMESYNCD'],
1189 # ['myhostname', 'HAVE_MYHOSTNAME'],
1190 # ['firstboot', 'ENABLE_FIRSTBOOT'],
1191 # ['randomseed', 'ENABLE_RANDOMSEED'],
1192 # ['backlight', 'ENABLE_BACKLIGHT'],
1193 # ['vconsole', 'ENABLE_VCONSOLE'],
1194 # ['quotacheck', 'ENABLE_QUOTACHECK'],
1195 # ['sysusers', 'ENABLE_SYSUSERS'],
1196 # ['tmpfiles', 'ENABLE_TMPFILES'],
1197 # ['hwdb', 'ENABLE_HWDB'],
1198 # ['rfkill', 'ENABLE_RFKILL'],
1199 # ['ldconfig', 'ENABLE_LDCONFIG'],
1200 # ['efi', 'ENABLE_EFI'],
1201 # ['tpm', 'ENABLE_TPM'],
1202 # ['ima', 'HAVE_IMA'],
1204 ['smack', 'HAVE_SMACK'],
1205 #if 0 /// UNNEEDED by elogind
1206 # ['gshadow', 'ENABLE_GSHADOW'],
1207 # ['idn', 'ENABLE_IDN'],
1208 # ['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
1212 have = get_option(pair[0])
1213 conf.set10(pair[1], have)
1214 m4_defines += have ? ['-D' + pair[1]] : []
1217 want_tests = get_option('tests')
1218 install_tests = get_option('install-tests')
1221 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1223 #####################################################################
1225 #if 0 /// UNNEEDED by elogind
1226 # if get_option('efi')
1227 # efi_arch = host_machine.cpu_family()
1229 # if efi_arch == 'x86'
1230 # EFI_MACHINE_TYPE_NAME = 'ia32'
1231 # gnu_efi_arch = 'ia32'
1232 # elif efi_arch == 'x86_64'
1233 # EFI_MACHINE_TYPE_NAME = 'x64'
1234 # gnu_efi_arch = 'x86_64'
1235 # elif efi_arch == 'arm'
1236 # EFI_MACHINE_TYPE_NAME = 'arm'
1237 # gnu_efi_arch = 'arm'
1238 # elif efi_arch == 'aarch64'
1239 # EFI_MACHINE_TYPE_NAME = 'aa64'
1240 # gnu_efi_arch = 'aarch64'
1242 # EFI_MACHINE_TYPE_NAME = ''
1247 # conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1249 # conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1254 conf.set10('ENABLE_EFI', have)
1256 #####################################################################
1258 config_h = configure_file(
1259 output : 'config.h',
1260 configuration : conf)
1262 includes = include_directories('src/basic',
1265 #if 0 /// UNNEEDED by elogind
1271 #if 0 /// UNNEEDED by elogind
1276 #if 0 /// elogind has a different list
1277 # 'src/libsystemd/sd-bus',
1278 # 'src/libsystemd/sd-device',
1279 # 'src/libsystemd/sd-hwdb',
1280 # 'src/libsystemd/sd-id128',
1281 # 'src/libsystemd/sd-netlink',
1282 # 'src/libsystemd/sd-network',
1283 # 'src/libsystemd-network',
1285 'src/libelogind/sd-bus',
1286 'src/libelogind/sd-id128',
1293 add_project_arguments('-include', 'config.h', language : 'c')
1295 #if 0 /// UNNEEDED by elogind
1296 # gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1297 # 'src/shared/gcrypt-util.c')
1301 #if 0 /// UNNEEDED by elogind
1304 subdir('src/systemd')
1306 #if 0 /// UNNEEDED by elogind
1307 # subdir('src/libsystemd')
1308 # subdir('src/libsystemd-network')
1309 # subdir('src/journal')
1312 subdir('src/libelogind')
1314 subdir('src/update-utmp')
1318 #if 0 /// UNNEEDED by elogind
1319 # libjournal_core = static_library(
1321 # libjournal_core_sources,
1323 # include_directories : includes,
1326 # libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1327 # libsystemd = shared_library(
1329 # libsystemd_internal_sources,
1330 # journal_internal_sources,
1331 # version : libsystemd_version,
1332 # include_directories : includes,
1333 # link_args : ['-shared',
1334 # '-Wl,--version-script=' + libsystemd_sym_path],
1335 # link_with : [libbasic],
1336 # dependencies : [threads,
1341 # link_depends : libsystemd_sym,
1343 # install_dir : rootlibdir)
1345 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1346 libelogind = shared_library(
1348 libelogind_internal_sources,
1350 include_directories : includes,
1351 link_args : ['-shared',
1352 '-Wl,--version-script=' + libelogind_sym_path],
1353 link_with : [libbasic],
1354 dependencies : [threads],
1355 link_depends : libelogind_sym,
1357 install_dir : rootlibdir)
1360 ############################################################
1362 # binaries that have --help and are intended for use by humans,
1363 # usually, but not always, installed in /bin.
1364 public_programs = []
1366 #if 0 /// UNNEEDED by elogind
1367 # subdir('src/libudev')
1369 # elogind depends on external libudev:
1370 libudev = dependency('libudev', required : true)
1372 subdir('src/shared')
1373 #if 0 /// UNNEEDED by elogind
1374 # subdir('src/core')
1375 # subdir('src/udev')
1376 # subdir('src/network')
1378 # subdir('src/analyze')
1379 # subdir('src/journal-remote')
1380 # subdir('src/coredump')
1381 # subdir('src/hostname')
1382 # subdir('src/import')
1383 # subdir('src/kernel-install')
1384 # subdir('src/locale')
1385 # subdir('src/machine')
1386 # subdir('src/nspawn')
1387 # subdir('src/resolve')
1388 # subdir('src/timedate')
1389 # subdir('src/timesync')
1390 # subdir('src/vconsole')
1391 # subdir('src/sulogin-shell')
1392 # subdir('src/boot/efi')
1396 #if 0 /// UNNEEDED in elogind
1400 ############################################################
1402 # only static linking apart from libdl, to make sure that the
1403 # module is linked to all libraries that it uses.
1404 test_dlopen = executable(
1407 include_directories : includes,
1408 link_with : [libbasic],
1409 dependencies : [libdl])
1411 #if 0 /// UNNEEDED by elogind
1412 # foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
1413 # ['systemd', 'ENABLE_NSS_SYSTEMD'],
1414 # ['mymachines', 'ENABLE_MACHINED'],
1415 # ['resolve', 'ENABLE_RESOLVED']]
1417 # condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1421 # sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1422 # version_script_arg = join_paths(meson.current_source_dir(), sym)
1424 # nss = shared_library(
1426 # 'src/nss-@0@/nss-@0@.c'.format(module),
1428 # include_directories : includes,
1429 # link_args : ['-shared',
1430 # '-Wl,--version-script=' + version_script_arg,
1431 # '-Wl,--undefined'],
1432 # link_with : [libsystemd_internal,
1434 # dependencies : [threads,
1436 # link_depends : sym,
1438 # install_dir : rootlibdir)
1440 # # We cannot use shared_module because it does not support version suffix.
1441 # # Unfortunately shared_library insists on creating the symlink…
1442 # meson.add_install_script('sh', '-c',
1443 # 'rm $DESTDIR@0@/libnss_@1@.so'
1444 # .format(rootlibdir, module))
1446 # test('dlopen-nss_' + module,
1448 # args : [nss.full_path()]) # path to dlopen must include a slash
1453 ############################################################
1455 #if 0 /// UNNEEDED by elogind
1456 # executable('systemd',
1458 # include_directories : includes,
1459 # link_with : [libcore,
1461 # dependencies : [threads,
1467 # install_rpath : rootlibexecdir,
1469 # install_dir : rootlibexecdir)
1471 # exe = executable('systemd-analyze',
1472 # systemd_analyze_sources,
1473 # include_directories : includes,
1474 # link_with : [libcore,
1476 # dependencies : [threads,
1482 # install_rpath : rootlibexecdir,
1484 # public_programs += [exe]
1486 # executable('systemd-journald',
1487 # systemd_journald_sources,
1488 # include_directories : includes,
1489 # link_with : [libjournal_core,
1491 # dependencies : [threads,
1495 # install_rpath : rootlibexecdir,
1497 # install_dir : rootlibexecdir)
1499 # exe = executable('systemd-cat',
1500 # systemd_cat_sources,
1501 # include_directories : includes,
1502 # link_with : [libjournal_core,
1504 # dependencies : [threads],
1505 # install_rpath : rootlibexecdir,
1507 # public_programs += [exe]
1509 # exe = executable('journalctl',
1510 # journalctl_sources,
1511 # include_directories : includes,
1512 # link_with : [libshared],
1513 # dependencies : [threads,
1517 # install_rpath : rootlibexecdir,
1519 # install_dir : rootbindir)
1520 # public_programs += [exe]
1522 # executable('systemd-getty-generator',
1523 # 'src/getty-generator/getty-generator.c',
1524 # include_directories : includes,
1525 # link_with : [libshared],
1526 # install_rpath : rootlibexecdir,
1528 # install_dir : systemgeneratordir)
1530 # executable('systemd-debug-generator',
1531 # 'src/debug-generator/debug-generator.c',
1532 # include_directories : includes,
1533 # link_with : [libshared],
1534 # install_rpath : rootlibexecdir,
1536 # install_dir : systemgeneratordir)
1538 # executable('systemd-fstab-generator',
1539 # 'src/fstab-generator/fstab-generator.c',
1540 # 'src/core/mount-setup.c',
1541 # include_directories : includes,
1542 # link_with : [libshared],
1543 # install_rpath : rootlibexecdir,
1545 # install_dir : systemgeneratordir)
1547 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1548 # executable('30-systemd-environment-d-generator',
1549 # 'src/environment-d-generator/environment-d-generator.c',
1550 # include_directories : includes,
1551 # link_with : [libshared],
1552 # install_rpath : rootlibexecdir,
1554 # install_dir : userenvgeneratordir)
1556 # meson.add_install_script(meson_make_symlink,
1557 # join_paths(sysconfdir, 'environment'),
1558 # join_paths(environmentdir, '99-environment.conf'))
1561 # if conf.get('ENABLE_HIBERNATE') == 1
1562 # executable('systemd-hibernate-resume-generator',
1563 # 'src/hibernate-resume/hibernate-resume-generator.c',
1564 # include_directories : includes,
1565 # link_with : [libshared],
1566 # install_rpath : rootlibexecdir,
1568 # install_dir : systemgeneratordir)
1570 # executable('systemd-hibernate-resume',
1571 # 'src/hibernate-resume/hibernate-resume.c',
1572 # include_directories : includes,
1573 # link_with : [libshared],
1574 # install_rpath : rootlibexecdir,
1576 # install_dir : rootlibexecdir)
1579 # if conf.get('HAVE_BLKID') == 1
1580 # executable('systemd-gpt-auto-generator',
1581 # 'src/gpt-auto-generator/gpt-auto-generator.c',
1582 # 'src/basic/blkid-util.h',
1583 # include_directories : includes,
1584 # link_with : [libshared],
1585 # dependencies : libblkid,
1586 # install_rpath : rootlibexecdir,
1588 # install_dir : systemgeneratordir)
1590 # exe = executable('systemd-dissect',
1591 # 'src/dissect/dissect.c',
1592 # include_directories : includes,
1593 # link_with : [libshared],
1594 # install_rpath : rootlibexecdir,
1596 # install_dir : rootlibexecdir)
1597 # public_programs += [exe]
1600 # if conf.get('ENABLE_RESOLVED') == 1
1601 # executable('systemd-resolved',
1602 # systemd_resolved_sources,
1603 # gcrypt_util_sources,
1604 # include_directories : includes,
1605 # link_with : [libshared],
1606 # dependencies : [threads,
1611 # install_rpath : rootlibexecdir,
1613 # install_dir : rootlibexecdir)
1615 # exe = executable('systemd-resolve',
1616 # systemd_resolve_sources,
1617 # gcrypt_util_sources,
1618 # include_directories : includes,
1619 # link_with : [libshared],
1620 # dependencies : [threads,
1625 # install_rpath : rootlibexecdir,
1627 # public_programs += [exe]
1630 # if conf.get('ENABLE_LOGIND') == 1
1631 # executable('systemd-logind',
1632 # systemd_logind_sources,
1633 # include_directories : includes,
1634 # link_with : [liblogind_core,
1636 # dependencies : [threads,
1638 # install_rpath : rootlibexecdir,
1640 # install_dir : rootlibexecdir)
1642 # exe = executable('loginctl',
1644 # include_directories : includes,
1645 # link_with : [libshared],
1646 # dependencies : [threads,
1649 # install_rpath : rootlibexecdir,
1651 # install_dir : rootbindir)
1652 # public_programs += [exe]
1654 # exe = executable('systemd-inhibit',
1655 # 'src/login/inhibit.c',
1656 # include_directories : includes,
1657 # link_with : [libshared],
1658 # install_rpath : rootlibexecdir,
1660 # install_dir : rootbindir)
1661 # public_programs += [exe]
1663 # if conf.get('HAVE_PAM') == 1
1664 # version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1665 # pam_systemd = shared_library(
1669 # include_directories : includes,
1670 # link_args : ['-shared',
1671 # '-Wl,--version-script=' + version_script_arg],
1672 # link_with : [libsystemd_internal,
1673 # libshared_static],
1674 # dependencies : [threads,
1677 # link_depends : pam_systemd_sym,
1679 # install_dir : pamlibdir)
1681 # test('dlopen-pam_systemd',
1683 # args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1688 executable('elogind',
1690 include_directories : includes,
1691 link_with : [liblogind_core,
1693 dependencies : [threads,
1696 install_rpath : rootlibexecdir,
1698 install_dir : rootlibexecdir)
1700 exe = executable('loginctl',
1702 include_directories : includes,
1703 link_with : [libshared],
1704 dependencies : [threads,
1706 install_rpath : rootlibexecdir,
1708 install_dir : rootbindir)
1709 public_programs += [exe]
1711 exe = executable('elogind-inhibit',
1712 'src/login/inhibit.c',
1713 include_directories : includes,
1714 link_with : [libshared],
1715 dependencies : [threads],
1716 install_rpath : rootlibexecdir,
1718 install_dir : rootbindir)
1719 public_programs += [exe]
1721 if conf.get('HAVE_PAM') == 1
1722 version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1723 pam_elogind = shared_library(
1727 include_directories : includes,
1728 link_args : ['-shared',
1729 '-Wl,--version-script=' + version_script_arg],
1730 link_with : [libelogind,
1732 dependencies : [threads,
1735 link_depends : pam_elogind_sym,
1737 install_dir : pamlibdir)
1739 test('dlopen-pam_elogind',
1741 args : [pam_elogind.full_path()]) # path to dlopen must include a slash
1745 #if 0 /// UNNEEDED by elogind
1746 # if conf.get('HAVE_PAM') == 1
1747 # executable('systemd-user-sessions',
1748 # 'src/user-sessions/user-sessions.c',
1749 # include_directories : includes,
1750 # link_with : [libshared],
1751 # install_rpath : rootlibexecdir,
1753 # install_dir : rootlibexecdir)
1756 # if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1757 # exe = executable('bootctl',
1758 # 'src/boot/bootctl.c',
1759 # include_directories : includes,
1760 # link_with : [libshared],
1761 # dependencies : [libblkid],
1762 # install_rpath : rootlibexecdir,
1764 # public_programs += [exe]
1767 # exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1768 # include_directories : includes,
1769 # link_with : [libshared],
1770 # dependencies : [threads],
1771 # install_rpath : rootlibexecdir,
1773 # public_programs += [exe]
1775 # exe = executable('systemctl', 'src/systemctl/systemctl.c',
1776 # include_directories : includes,
1777 # link_with : [libshared],
1778 # dependencies : [threads,
1783 # install_rpath : rootlibexecdir,
1785 # install_dir : rootbindir)
1786 # public_programs += [exe]
1788 # if conf.get('ENABLE_BACKLIGHT') == 1
1789 # executable('systemd-backlight',
1790 # 'src/backlight/backlight.c',
1791 # include_directories : includes,
1792 # link_with : [libshared],
1793 # install_rpath : rootlibexecdir,
1795 # install_dir : rootlibexecdir)
1798 # if conf.get('ENABLE_RFKILL') == 1
1799 # executable('systemd-rfkill',
1800 # 'src/rfkill/rfkill.c',
1801 # include_directories : includes,
1802 # link_with : [libshared],
1803 # install_rpath : rootlibexecdir,
1805 # install_dir : rootlibexecdir)
1808 # executable('systemd-system-update-generator',
1809 # 'src/system-update-generator/system-update-generator.c',
1810 # include_directories : includes,
1811 # link_with : [libshared],
1812 # install_rpath : rootlibexecdir,
1814 # install_dir : systemgeneratordir)
1816 # if conf.get('HAVE_LIBCRYPTSETUP') == 1
1817 # executable('systemd-cryptsetup',
1818 # 'src/cryptsetup/cryptsetup.c',
1819 # include_directories : includes,
1820 # link_with : [libshared],
1821 # dependencies : [libcryptsetup],
1822 # install_rpath : rootlibexecdir,
1824 # install_dir : rootlibexecdir)
1826 # executable('systemd-cryptsetup-generator',
1827 # 'src/cryptsetup/cryptsetup-generator.c',
1828 # include_directories : includes,
1829 # link_with : [libshared],
1830 # dependencies : [libcryptsetup],
1831 # install_rpath : rootlibexecdir,
1833 # install_dir : systemgeneratordir)
1835 # executable('systemd-veritysetup',
1836 # 'src/veritysetup/veritysetup.c',
1837 # include_directories : includes,
1838 # link_with : [libshared],
1839 # dependencies : [libcryptsetup],
1840 # install_rpath : rootlibexecdir,
1842 # install_dir : rootlibexecdir)
1844 # executable('systemd-veritysetup-generator',
1845 # 'src/veritysetup/veritysetup-generator.c',
1846 # include_directories : includes,
1847 # link_with : [libshared],
1848 # dependencies : [libcryptsetup],
1849 # install_rpath : rootlibexecdir,
1851 # install_dir : systemgeneratordir)
1854 # if conf.get('HAVE_SYSV_COMPAT') == 1
1855 # executable('systemd-sysv-generator',
1856 # 'src/sysv-generator/sysv-generator.c',
1857 # include_directories : includes,
1858 # link_with : [libshared],
1859 # install_rpath : rootlibexecdir,
1861 # install_dir : systemgeneratordir)
1863 # executable('systemd-rc-local-generator',
1864 # 'src/rc-local-generator/rc-local-generator.c',
1865 # include_directories : includes,
1866 # link_with : [libshared],
1867 # install_rpath : rootlibexecdir,
1869 # install_dir : systemgeneratordir)
1872 # if conf.get('ENABLE_HOSTNAMED') == 1
1873 # executable('systemd-hostnamed',
1874 # 'src/hostname/hostnamed.c',
1875 # include_directories : includes,
1876 # link_with : [libshared],
1877 # install_rpath : rootlibexecdir,
1879 # install_dir : rootlibexecdir)
1881 # exe = executable('hostnamectl',
1882 # 'src/hostname/hostnamectl.c',
1883 # include_directories : includes,
1884 # link_with : [libshared],
1885 # install_rpath : rootlibexecdir,
1887 # public_programs += [exe]
1890 # if conf.get('ENABLE_LOCALED') == 1
1891 # if conf.get('HAVE_XKBCOMMON') == 1
1892 # # logind will load libxkbcommon.so dynamically on its own
1898 # executable('systemd-localed',
1899 # systemd_localed_sources,
1900 # include_directories : includes,
1901 # link_with : [libshared],
1902 # dependencies : deps,
1903 # install_rpath : rootlibexecdir,
1905 # install_dir : rootlibexecdir)
1907 # exe = executable('localectl',
1908 # localectl_sources,
1909 # include_directories : includes,
1910 # link_with : [libshared],
1911 # install_rpath : rootlibexecdir,
1913 # public_programs += [exe]
1916 # if conf.get('ENABLE_TIMEDATED') == 1
1917 # executable('systemd-timedated',
1918 # 'src/timedate/timedated.c',
1919 # include_directories : includes,
1920 # link_with : [libshared],
1921 # install_rpath : rootlibexecdir,
1923 # install_dir : rootlibexecdir)
1925 # exe = executable('timedatectl',
1926 # 'src/timedate/timedatectl.c',
1927 # include_directories : includes,
1928 # install_rpath : rootlibexecdir,
1929 # link_with : [libshared],
1931 # public_programs += [exe]
1934 # if conf.get('ENABLE_TIMESYNCD') == 1
1935 # executable('systemd-timesyncd',
1936 # systemd_timesyncd_sources,
1937 # include_directories : includes,
1938 # link_with : [libshared],
1939 # dependencies : [threads,
1941 # install_rpath : rootlibexecdir,
1943 # install_dir : rootlibexecdir)
1946 # if conf.get('ENABLE_MACHINED') == 1
1947 # executable('systemd-machined',
1948 # systemd_machined_sources,
1949 # include_directories : includes,
1950 # link_with : [libmachine_core,
1952 # install_rpath : rootlibexecdir,
1954 # install_dir : rootlibexecdir)
1956 # exe = executable('machinectl',
1957 # 'src/machine/machinectl.c',
1958 # include_directories : includes,
1959 # link_with : [libshared],
1960 # dependencies : [threads,
1963 # install_rpath : rootlibexecdir,
1965 # install_dir : rootbindir)
1966 # public_programs += [exe]
1969 # if conf.get('ENABLE_IMPORTD') == 1
1970 # executable('systemd-importd',
1971 # systemd_importd_sources,
1972 # include_directories : includes,
1973 # link_with : [libshared],
1974 # dependencies : [threads],
1975 # install_rpath : rootlibexecdir,
1977 # install_dir : rootlibexecdir)
1979 # systemd_pull = executable('systemd-pull',
1980 # systemd_pull_sources,
1981 # include_directories : includes,
1982 # link_with : [libshared],
1983 # dependencies : [libcurl,
1988 # install_rpath : rootlibexecdir,
1990 # install_dir : rootlibexecdir)
1992 # systemd_import = executable('systemd-import',
1993 # systemd_import_sources,
1994 # include_directories : includes,
1995 # link_with : [libshared],
1996 # dependencies : [libcurl,
2000 # install_rpath : rootlibexecdir,
2002 # install_dir : rootlibexecdir)
2004 # systemd_export = executable('systemd-export',
2005 # systemd_export_sources,
2006 # include_directories : includes,
2007 # link_with : [libshared],
2008 # dependencies : [libcurl,
2012 # install_rpath : rootlibexecdir,
2014 # install_dir : rootlibexecdir)
2015 # public_programs += [systemd_pull, systemd_import, systemd_export]
2018 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2019 # exe = executable('systemd-journal-upload',
2020 # systemd_journal_upload_sources,
2021 # include_directories : includes,
2022 # link_with : [libshared],
2023 # dependencies : [threads,
2028 # install_rpath : rootlibexecdir,
2030 # install_dir : rootlibexecdir)
2031 # public_programs += [exe]
2034 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2035 # s_j_remote = executable('systemd-journal-remote',
2036 # systemd_journal_remote_sources,
2037 # include_directories : includes,
2038 # link_with : [libshared],
2039 # dependencies : [threads,
2044 # install_rpath : rootlibexecdir,
2046 # install_dir : rootlibexecdir)
2048 # s_j_gatewayd = executable('systemd-journal-gatewayd',
2049 # systemd_journal_gatewayd_sources,
2050 # include_directories : includes,
2051 # link_with : [libshared],
2052 # dependencies : [threads,
2057 # install_rpath : rootlibexecdir,
2059 # install_dir : rootlibexecdir)
2060 # public_programs += [s_j_remote, s_j_gatewayd]
2063 # if conf.get('ENABLE_COREDUMP') == 1
2064 # executable('systemd-coredump',
2065 # systemd_coredump_sources,
2066 # include_directories : includes,
2067 # link_with : [libshared],
2068 # dependencies : [threads,
2073 # install_rpath : rootlibexecdir,
2075 # install_dir : rootlibexecdir)
2077 # exe = executable('coredumpctl',
2078 # coredumpctl_sources,
2079 # include_directories : includes,
2080 # link_with : [libshared],
2081 # dependencies : [threads,
2084 # install_rpath : rootlibexecdir,
2086 # public_programs += [exe]
2089 # if conf.get('ENABLE_BINFMT') == 1
2090 # exe = executable('systemd-binfmt',
2091 # 'src/binfmt/binfmt.c',
2092 # include_directories : includes,
2093 # link_with : [libshared],
2094 # install_rpath : rootlibexecdir,
2096 # install_dir : rootlibexecdir)
2097 # public_programs += [exe]
2099 # meson.add_install_script('sh', '-c',
2100 # mkdir_p.format(binfmtdir))
2101 # meson.add_install_script('sh', '-c',
2102 # mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2105 # if conf.get('ENABLE_VCONSOLE') == 1
2106 # executable('systemd-vconsole-setup',
2107 # 'src/vconsole/vconsole-setup.c',
2108 # include_directories : includes,
2109 # link_with : [libshared],
2110 # install_rpath : rootlibexecdir,
2112 # install_dir : rootlibexecdir)
2115 # if conf.get('ENABLE_RANDOMSEED') == 1
2116 # executable('systemd-random-seed',
2117 # 'src/random-seed/random-seed.c',
2118 # include_directories : includes,
2119 # link_with : [libshared],
2120 # install_rpath : rootlibexecdir,
2122 # install_dir : rootlibexecdir)
2125 # if conf.get('ENABLE_FIRSTBOOT') == 1
2126 # executable('systemd-firstboot',
2127 # 'src/firstboot/firstboot.c',
2128 # include_directories : includes,
2129 # link_with : [libshared],
2130 # dependencies : [libcrypt],
2131 # install_rpath : rootlibexecdir,
2133 # install_dir : rootbindir)
2136 # executable('systemd-remount-fs',
2137 # 'src/remount-fs/remount-fs.c',
2138 # 'src/core/mount-setup.c',
2139 # 'src/core/mount-setup.h',
2140 # include_directories : includes,
2141 # link_with : [libshared],
2142 # install_rpath : rootlibexecdir,
2144 # install_dir : rootlibexecdir)
2146 # executable('systemd-machine-id-setup',
2147 # 'src/machine-id-setup/machine-id-setup-main.c',
2148 # 'src/core/machine-id-setup.c',
2149 # 'src/core/machine-id-setup.h',
2150 # include_directories : includes,
2151 # link_with : [libshared],
2152 # install_rpath : rootlibexecdir,
2154 # install_dir : rootbindir)
2156 # executable('systemd-fsck',
2157 # 'src/fsck/fsck.c',
2158 # include_directories : includes,
2159 # link_with : [libshared],
2160 # install_rpath : rootlibexecdir,
2162 # install_dir : rootlibexecdir)
2164 # executable('systemd-sleep',
2165 # 'src/sleep/sleep.c',
2166 # include_directories : includes,
2167 # link_with : [libshared],
2168 # install_rpath : rootlibexecdir,
2170 # install_dir : rootlibexecdir)
2172 # exe = executable('systemd-sysctl',
2173 # 'src/sysctl/sysctl.c',
2174 # include_directories : includes,
2175 # link_with : [libshared],
2176 # install_rpath : rootlibexecdir,
2178 # install_dir : rootlibexecdir)
2179 # public_programs += [exe]
2181 # executable('systemd-ac-power',
2182 # 'src/ac-power/ac-power.c',
2183 # include_directories : includes,
2184 # link_with : [libshared],
2185 # install_rpath : rootlibexecdir,
2187 # install_dir : rootlibexecdir)
2189 # exe = executable('systemd-detect-virt',
2190 # 'src/detect-virt/detect-virt.c',
2191 # include_directories : includes,
2192 # link_with : [libshared],
2193 # install_rpath : rootlibexecdir,
2195 # public_programs += [exe]
2197 # exe = executable('systemd-delta',
2198 # 'src/delta/delta.c',
2199 # include_directories : includes,
2200 # link_with : [libshared],
2201 # install_rpath : rootlibexecdir,
2203 # public_programs += [exe]
2205 # exe = executable('systemd-escape',
2206 # 'src/escape/escape.c',
2207 # include_directories : includes,
2208 # link_with : [libshared],
2209 # install_rpath : rootlibexecdir,
2211 # install_dir : rootbindir)
2212 # public_programs += [exe]
2214 # exe = executable('systemd-notify',
2215 # 'src/notify/notify.c',
2216 # include_directories : includes,
2217 # link_with : [libshared],
2218 # install_rpath : rootlibexecdir,
2220 # install_dir : rootbindir)
2221 # public_programs += [exe]
2223 # executable('systemd-volatile-root',
2224 # 'src/volatile-root/volatile-root.c',
2225 # include_directories : includes,
2226 # link_with : [libshared],
2227 # install_rpath : rootlibexecdir,
2229 # install_dir : rootlibexecdir)
2231 # executable('systemd-cgroups-agent',
2232 # 'src/cgroups-agent/cgroups-agent.c',
2233 # include_directories : includes,
2234 # link_with : [libshared],
2235 # install_rpath : rootlibexecdir,
2237 # install_dir : rootlibexecdir)
2239 executable('elogind-cgroups-agent',
2240 'src/cgroups-agent/cgroups-agent.c',
2241 include_directories : includes,
2242 link_with : [libshared_static],
2243 install_rpath : rootlibexecdir,
2245 install_dir : rootlibexecdir)
2248 #if 0 /// UNNEEDED by elogind
2249 # exe = executable('systemd-path',
2250 # 'src/path/path.c',
2251 # include_directories : includes,
2252 # link_with : [libshared],
2253 # install_rpath : rootlibexecdir,
2255 # public_programs += [exe]
2257 # exe = executable('systemd-ask-password',
2258 # 'src/ask-password/ask-password.c',
2259 # include_directories : includes,
2260 # link_with : [libshared],
2261 # install_rpath : rootlibexecdir,
2263 # install_dir : rootbindir)
2264 # public_programs += [exe]
2266 # executable('systemd-reply-password',
2267 # 'src/reply-password/reply-password.c',
2268 # include_directories : includes,
2269 # link_with : [libshared],
2270 # install_rpath : rootlibexecdir,
2272 # install_dir : rootlibexecdir)
2274 # exe = executable('systemd-tty-ask-password-agent',
2275 # 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2276 # include_directories : includes,
2277 # link_with : [libshared],
2278 # install_rpath : rootlibexecdir,
2280 # install_dir : rootbindir)
2281 # public_programs += [exe]
2283 # exe = executable('systemd-cgls',
2284 # 'src/cgls/cgls.c',
2285 # include_directories : includes,
2286 # link_with : [libshared],
2287 # install_rpath : rootlibexecdir,
2289 # public_programs += [exe]
2291 # exe = executable('systemd-cgtop',
2292 # 'src/cgtop/cgtop.c',
2293 # include_directories : includes,
2294 # link_with : [libshared],
2295 # install_rpath : rootlibexecdir,
2297 # public_programs += [exe]
2299 # executable('systemd-initctl',
2300 # 'src/initctl/initctl.c',
2301 # include_directories : includes,
2302 # link_with : [libshared],
2303 # install_rpath : rootlibexecdir,
2305 # install_dir : rootlibexecdir)
2307 # exe = executable('systemd-mount',
2308 # 'src/mount/mount-tool.c',
2309 # include_directories : includes,
2310 # link_with : [libshared],
2311 # install_rpath : rootlibexecdir,
2313 # public_programs += [exe]
2315 # meson.add_install_script(meson_make_symlink,
2316 # 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2318 # exe = executable('systemd-run',
2320 # include_directories : includes,
2321 # link_with : [libshared],
2322 # install_rpath : rootlibexecdir,
2324 # public_programs += [exe]
2326 # exe = executable('systemd-stdio-bridge',
2327 # 'src/stdio-bridge/stdio-bridge.c',
2328 # include_directories : includes,
2329 # link_with : [libshared],
2330 # install_rpath : rootlibexecdir,
2332 # public_programs += [exe]
2334 # exe = executable('busctl',
2335 # 'src/busctl/busctl.c',
2336 # 'src/busctl/busctl-introspect.c',
2337 # 'src/busctl/busctl-introspect.h',
2338 # include_directories : includes,
2339 # link_with : [libshared],
2340 # install_rpath : rootlibexecdir,
2342 # public_programs += [exe]
2344 # if conf.get('ENABLE_SYSUSERS') == 1
2345 # exe = executable('systemd-sysusers',
2346 # 'src/sysusers/sysusers.c',
2347 # include_directories : includes,
2348 # link_with : [libshared],
2349 # install_rpath : rootlibexecdir,
2351 # install_dir : rootbindir)
2352 # public_programs += [exe]
2355 # if conf.get('ENABLE_TMPFILES') == 1
2356 # exe = executable('systemd-tmpfiles',
2357 # 'src/tmpfiles/tmpfiles.c',
2358 # include_directories : includes,
2359 # link_with : [libshared],
2360 # dependencies : [libacl],
2361 # install_rpath : rootlibexecdir,
2363 # install_dir : rootbindir)
2364 # public_programs += [exe]
2367 # if conf.get('ENABLE_HWDB') == 1
2368 # exe = executable('systemd-hwdb',
2369 # 'src/hwdb/hwdb.c',
2370 # 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2371 # include_directories : includes,
2372 # link_with : [libudev_internal],
2373 # install_rpath : udev_rpath,
2375 # install_dir : rootbindir)
2376 # public_programs += [exe]
2379 # if conf.get('ENABLE_QUOTACHECK') == 1
2380 # executable('systemd-quotacheck',
2381 # 'src/quotacheck/quotacheck.c',
2382 # include_directories : includes,
2383 # link_with : [libshared],
2384 # install_rpath : rootlibexecdir,
2386 # install_dir : rootlibexecdir)
2389 # exe = executable('systemd-socket-proxyd',
2390 # 'src/socket-proxy/socket-proxyd.c',
2391 # include_directories : includes,
2392 # link_with : [libshared],
2393 # dependencies : [threads],
2394 # install_rpath : rootlibexecdir,
2396 # install_dir : rootlibexecdir)
2397 # public_programs += [exe]
2399 # exe = executable('systemd-udevd',
2400 # systemd_udevd_sources,
2401 # include_directories : includes,
2402 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2403 # link_with : [libudev_core,
2404 # libsystemd_network,
2405 # libudev_internal],
2406 # dependencies : [threads,
2411 # install_rpath : udev_rpath,
2413 # install_dir : rootlibexecdir)
2414 # public_programs += [exe]
2416 # exe = executable('udevadm',
2418 # include_directories : includes,
2419 # link_with : [libudev_core,
2420 # libsystemd_network,
2421 # libudev_internal],
2422 # dependencies : [threads,
2427 # install_rpath : udev_rpath,
2429 # install_dir : rootbindir)
2430 # public_programs += [exe]
2432 # executable('systemd-shutdown',
2433 # systemd_shutdown_sources,
2434 # include_directories : includes,
2435 # link_with : [libshared],
2436 # install_rpath : rootlibexecdir,
2438 # install_dir : rootlibexecdir)
2440 # executable('systemd-update-done',
2441 # 'src/update-done/update-done.c',
2442 # include_directories : includes,
2443 # link_with : [libshared],
2444 # install_rpath : rootlibexecdir,
2446 # install_dir : rootlibexecdir)
2448 # executable('systemd-update-utmp',
2449 # 'src/update-utmp/update-utmp.c',
2450 # include_directories : includes,
2451 # link_with : [libshared],
2452 # dependencies : [libaudit],
2453 # install_rpath : rootlibexecdir,
2455 # install_dir : rootlibexecdir)
2457 # if conf.get('HAVE_KMOD') == 1
2458 # executable('systemd-modules-load',
2459 # 'src/modules-load/modules-load.c',
2460 # include_directories : includes,
2461 # link_with : [libshared],
2462 # dependencies : [libkmod],
2463 # install_rpath : rootlibexecdir,
2465 # install_dir : rootlibexecdir)
2467 # meson.add_install_script('sh', '-c',
2468 # mkdir_p.format(modulesloaddir))
2469 # meson.add_install_script('sh', '-c',
2470 # mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2473 # exe = executable('systemd-nspawn',
2474 # systemd_nspawn_sources,
2475 # 'src/core/mount-setup.c', # FIXME: use a variable?
2476 # 'src/core/mount-setup.h',
2477 # 'src/core/loopback-setup.c',
2478 # 'src/core/loopback-setup.h',
2479 # include_directories : [includes, include_directories('src/nspawn')],
2480 # link_with : [libshared],
2481 # dependencies : [libacl,
2485 # install_rpath : rootlibexecdir,
2487 # public_programs += [exe]
2489 # if conf.get('ENABLE_NETWORKD') == 1
2490 # executable('systemd-networkd',
2491 # systemd_networkd_sources,
2492 # include_directories : includes,
2493 # link_with : [libnetworkd_core,
2494 # libsystemd_network,
2497 # dependencies : [threads],
2498 # install_rpath : rootlibexecdir,
2500 # install_dir : rootlibexecdir)
2502 # executable('systemd-networkd-wait-online',
2503 # systemd_networkd_wait_online_sources,
2504 # include_directories : includes,
2505 # link_with : [libnetworkd_core,
2507 # install_rpath : rootlibexecdir,
2509 # install_dir : rootlibexecdir)
2511 # exe = executable('networkctl',
2512 # networkctl_sources,
2513 # include_directories : includes,
2514 # link_with : [libsystemd_network,
2516 # install_rpath : rootlibexecdir,
2518 # install_dir : rootbindir)
2519 # public_programs += [exe]
2522 ############################################################
2524 foreach tuple : tests
2526 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2527 dependencies = tuple[2]
2528 condition = tuple.length() >= 4 ? tuple[3] : ''
2529 type = tuple.length() >= 5 ? tuple[4] : ''
2530 defs = tuple.length() >= 6 ? tuple[5] : []
2531 incs = tuple.length() >= 7 ? tuple[6] : includes
2534 name = sources[0].split('/')[-1].split('.')[0]
2535 if type.startswith('timeout=')
2536 timeout = type.split('=')[1].to_int()
2540 if condition == '' or conf.get(condition) == 1
2544 include_directories : incs,
2545 link_with : link_with,
2546 dependencies : dependencies,
2548 install_rpath : rootlibexecdir,
2549 install : install_tests,
2550 install_dir : join_paths(testsdir, type))
2553 message('@0@ is a manual test'.format(name))
2554 elif type == 'unsafe' and want_tests != 'unsafe'
2555 message('@0@ is an unsafe test'.format(name))
2562 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2566 #if 0 /// UNNEEDED by elogind
2567 # test_libsystemd_sym = executable(
2568 # 'test-libsystemd-sym',
2569 # test_libsystemd_sym_c,
2570 # include_directories : includes,
2571 # link_with : [libsystemd],
2572 # install : install_tests,
2573 # install_dir : testsdir)
2574 # test('test-libsystemd-sym',
2575 # test_libsystemd_sym)
2577 # test_libudev_sym = executable(
2578 # 'test-libudev-sym',
2579 # test_libudev_sym_c,
2580 # include_directories : includes,
2581 # c_args : ['-Wno-deprecated-declarations'],
2582 # link_with : [libudev],
2583 # install : install_tests,
2584 # install_dir : testsdir)
2585 # test('test-libudev-sym',
2588 test_libelogind_sym = executable(
2589 'test-libelogind-sym',
2590 test_libelogind_sym_c,
2591 include_directories : includes,
2592 link_with : [libelogind],
2593 install : install_tests,
2594 install_dir : testsdir)
2595 test('test-libelogind-sym',
2596 test_libelogind_sym)
2599 ############################################################
2601 make_directive_index_py = find_program('tools/make-directive-index.py')
2602 make_man_index_py = find_program('tools/make-man-index.py')
2603 xml_helper_py = find_program('tools/xml_helper.py')
2604 #if 0 /// UNNEEDED by elogind
2605 # hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2608 # subdir('sysctl.d')
2609 # subdir('sysusers.d')
2610 # subdir('tmpfiles.d')
2616 subdir('shell-completion/bash')
2617 subdir('shell-completion/zsh')
2618 #if 0 /// UNNEEDED by elogind
2619 # subdir('docs/sysvinit')
2620 # subdir('docs/var-log')
2623 # FIXME: figure out if the warning is true:
2624 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2625 install_subdir('factory/etc',
2626 install_dir : factorydir)
2629 #if 0 /// UNNEEDED by elogind
2630 # install_data('xorg/50-systemd-user.sh',
2631 # install_dir : xinitrcdir)
2632 # install_data('system-preset/90-systemd.preset',
2633 # install_dir : systempresetdir)
2634 # install_data('modprobe.d/systemd.conf',
2635 # install_dir : modprobedir)
2637 install_data('README',
2640 #if 0 /// UNNEEDED by elogind
2646 'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
2647 install_dir : docdir)
2649 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2650 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2652 ############################################################
2654 meson_check_help = find_program('tools/meson-check-help.sh')
2656 foreach exec : public_programs
2657 name = exec.full_path().split('/')[-1]
2658 test('check-help-' + name,
2660 args : [exec.full_path()])
2663 ############################################################
2666 all_files = run_command(
2668 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2671 all_files = files(all_files.stdout().split())
2676 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2680 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2684 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2687 command : [meson_git_contrib_sh])
2691 git_head = run_command(
2693 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2694 'rev-parse', 'HEAD']).stdout().strip()
2695 git_head_short = run_command(
2697 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2698 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2702 command : ['git', 'archive',
2703 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2705 '--prefix', 'systemd-@0@/'.format(git_head),
2709 ############################################################
2712 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2714 'prefix: @0@'.format(prefixdir),
2715 'rootprefix: @0@'.format(rootprefixdir),
2716 'sysconf dir: @0@'.format(sysconfdir),
2717 'includedir: @0@'.format(includedir),
2718 'lib dir: @0@'.format(libdir),
2719 'rootlib dir: @0@'.format(rootlibdir),
2720 #if 0 /// UNSUPPORTED by elogind
2721 # 'SysV init scripts: @0@'.format(sysvinit_path),
2722 # 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2724 'rootexeclib dir: @0@'.format(rootlibexecdir),
2726 'PAM modules dir: @0@'.format(pamlibdir),
2727 'PAM configuration dir: @0@'.format(pamconfdir),
2728 #if 0 /// UNSUPPORTED by elogind
2729 # 'RPM macros dir: @0@'.format(rpmmacrosdir),
2730 # 'modprobe.d dir: @0@'.format(modprobedir),
2732 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2733 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2734 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2735 'bash completions dir: @0@'.format(bashcompletiondir),
2736 'zsh completions dir: @0@'.format(zshcompletiondir),
2737 #if 0 /// UNSUPPORTED by elogind
2738 # 'extra start script: @0@'.format(get_option('rc-local')),
2739 # 'extra stop script: @0@'.format(get_option('halt-local')),
2740 # 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2741 # get_option('debug-tty')),
2743 'TTY GID: @0@'.format(tty_gid),
2744 'maximum system UID: @0@'.format(system_uid_max),
2745 'maximum system GID: @0@'.format(system_gid_max),
2746 #if 0 /// UNSUPPORTED by elogind
2747 # '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2748 # 'certificate root: @0@'.format(get_option('certificate-root')),
2749 # 'support URL: @0@'.format(support_url),
2750 # 'nobody user name: @0@'.format(get_option('nobody-user')),
2751 # 'nobody group name: @0@'.format(get_option('nobody-group')),
2752 # 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2753 # 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
2755 # 'default DNSSEC mode: @0@'.format(default_dnssec),
2756 # 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2758 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2760 #if 0 /// UNSUPPORTED by elogind
2761 # alt_dns_servers = '\n '.join(dns_servers.split(' '))
2762 # alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2764 # 'default DNS servers: @0@'.format(alt_dns_servers),
2765 # 'default NTP servers: @0@'.format(alt_ntp_servers)]
2767 # alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2768 # '@@0@'.format(time_epoch)).stdout().strip()
2770 # 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2774 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2775 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2776 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2778 #if 0 /// UNNEEDED by elogind
2779 # if conf.get('ENABLE_EFI') == 1
2781 # 'efi arch: @0@'.format(efi_arch)]
2785 # 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2786 # 'EFI CC @0@'.format(efi_cc),
2787 # 'EFI libdir: @0@'.format(efi_libdir),
2788 # 'EFI ldsdir: @0@'.format(efi_ldsdir),
2789 # 'EFI includedir: @0@'.format(efi_incdir)]
2798 #if 0 /// UNNEEDED by elogind
2799 # ['libcryptsetup'],
2803 #if 0 /// UNNEEDED by elogind
2808 #if 0 /// UNNEEDED by elogind
2812 #if 0 /// UNNEEDED by elogind
2819 #if 0 /// UNNEEDED by elogind
2835 # ['environment.d'],
2853 ['legacy pkla', install_polkit_pkla],
2854 #if 0 /// UNNEEDED by elogind
2856 # ['gnu-efi', have_gnu_efi],
2863 #if 0 /// UNNEEDED by elogind
2864 # ['nss-myhostname', conf.get('HAVE_MYHOSTNAME') == 1],
2868 ['man pages', want_man],
2869 ['html pages', want_html],
2870 ['man page indices', want_man and have_lxml],
2871 #if 0 /// UNNEEDED by elogind
2872 # ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
2876 #if 0 /// UNNEEDED by elogind
2879 # ['adm group', get_option('adm-group')],
2880 # ['wheel group', get_option('wheel-group')],
2886 ['debug mmap cache'],
2889 cond = tuple.get(1, '')
2891 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2892 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2893 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
2898 missing += [tuple[0]]
2904 'enabled features: @0@'.format(', '.join(found)),
2906 'disabled features: @0@'.format(', '.join(missing)),
2908 message('\n '.join(status))