1 project('elogind', 'c',
10 meson_version : '>= 0.40',
13 libelogind_version = '0.19.1'
14 libudev_version = '1.6.7'
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 #if 1 /// Needed by elogind
528 meson_symlink_headers = meson.source_root() + '/tools/meson-symlink_headers.sh'
530 mkdir_p = 'mkdir -p $DESTDIR/@0@'
531 #if 0 /// unneeded by elogind
532 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
533 # splash_bmp = files('test/splash.bmp')
536 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
537 # /usr/sbin, /sbin, and fall back to the default from middle column.
538 #if 0 /// elogind has a bit different list and some adaptions
539 # progs = [['telinit', '/lib/sysvinit/telinit'],
540 # ['quotaon', '/usr/sbin/quotaon' ],
541 # ['quotacheck', '/usr/sbin/quotacheck' ],
542 # ['kill', '/usr/bin/kill' ],
543 # ['kmod', '/usr/bin/kmod' ],
544 # ['kexec', '/usr/sbin/kexec' ],
545 # ['sulogin', '/usr/sbin/sulogin' ],
546 # ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
547 # ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
548 # ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
549 # ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
552 progs = [['kexec', '/usr/sbin/kexec', 'KEXEC'],
553 ['reboot', '/sbin/reboot', 'REBOOT'],
554 ['halt', '/sbin/halt', 'HALT'],
558 path = get_option(prog[0] + '-path')
560 message('Using @1@ for @0@'.format(prog[0], path))
562 exe = find_program(prog[0],
563 '/usr/sbin/' + prog[0],
566 path = exe.found() ? exe.path() : prog[1]
568 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
569 conf.set_quoted(name, path)
570 substs.set(name, path)
573 if run_command('ln', '--relative', '--help').returncode() != 0
574 error('ln does not support --relative')
577 ############################################################
579 gperf = find_program('gperf')
581 gperf_test_format = '''
583 const char * in_word_set(const char *, @0@);
586 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
587 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
588 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
589 if cc.compiles(gperf_test)
590 gperf_len_type = 'size_t'
592 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
593 if cc.compiles(gperf_test)
594 gperf_len_type = 'unsigned'
596 error('unable to determine gperf len type')
599 message('gperf len type is @0@'.format(gperf_len_type))
600 conf.set('GPERF_LEN_TYPE', gperf_len_type,
601 description : 'The type of gperf "len" parameter')
603 ############################################################
605 if not cc.has_header('sys/capability.h')
606 error('POSIX caps headers not found')
608 foreach header : ['linux/btrfs.h',
610 'linux/vm_sockets.h',
612 'valgrind/memcheck.h',
613 'valgrind/valgrind.h',
616 conf.set10('HAVE_' + header.underscorify().to_upper(),
617 cc.has_header(header))
620 ############################################################
622 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
623 #if 0 /// UNNEEDED by elogind
624 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
625 # gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
628 default_hierarchy = get_option('default-hierarchy')
629 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
630 description : 'default cgroup hierarchy as string')
631 if default_hierarchy == 'legacy'
632 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
633 elif default_hierarchy == 'hybrid'
634 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
636 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
639 #if 0 /// UNNEEDED by elogind
640 # time_epoch = get_option('time-epoch')
641 # if time_epoch == ''
642 # NEWS = files('NEWS')
643 # time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
645 # time_epoch = time_epoch.to_int()
646 # conf.set('TIME_EPOCH', time_epoch)
648 ############################################################
649 # elogind needs to know which cgroups controller to follow.
650 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
651 with_cgroupctrl = get_option('cgroup-controller')
652 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
653 with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
654 elif with_cgroupctrl == 'none'
655 with_cgroupctrl = 'elogind'
658 # No controller now is a problem:
659 if with_cgroupctrl == ''
660 error('Unable to determine cgroup controller, but cgroups support is mandatory!')
663 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
664 description : 'name of the cgroup controller to use')
665 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
666 '='.join(['name', with_cgroupctrl]))
667 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
668 '='.join(['name', with_cgroupctrl]))
669 ############################################################
672 system_uid_max = get_option('system-uid-max')
673 if system_uid_max == ''
674 system_uid_max = run_command(
676 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
677 '/etc/login.defs').stdout()
679 system_uid_max = system_uid_max.to_int()
680 conf.set('SYSTEM_UID_MAX', system_uid_max)
681 substs.set('systemuidmax', system_uid_max)
682 message('maximum system UID is @0@'.format(system_uid_max))
684 #if 0 /// UNNEEDED by elogind
685 # conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
686 # conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
689 system_gid_max = get_option('system-gid-max')
690 if system_gid_max == ''
691 system_gid_max = run_command(
693 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
694 '/etc/login.defs').stdout()
696 system_gid_max = system_gid_max.to_int()
697 conf.set('SYSTEM_GID_MAX', system_gid_max)
698 substs.set('systemgidmax', system_gid_max)
699 message('maximum system GID is @0@'.format(system_gid_max))
701 tty_gid = get_option('tty-gid')
702 conf.set('TTY_GID', tty_gid)
703 substs.set('TTY_GID', tty_gid)
705 #if 0 /// UNNEEDED by elogind
706 # if get_option('adm-group')
707 # m4_defines += ['-DENABLE_ADM_GROUP']
710 # if get_option('wheel-group')
711 # m4_defines += ['-DENABLE_WHEEL_GROUP']
714 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
717 kill_user_processes = get_option('default-kill-user-processes')
718 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
719 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
721 #if 0 /// UNNEEDED by elogind
722 # dns_servers = get_option('dns-servers')
723 # conf.set_quoted('DNS_SERVERS', dns_servers)
724 # substs.set('DNS_SERVERS', dns_servers)
726 # ntp_servers = get_option('ntp-servers')
727 # conf.set_quoted('NTP_SERVERS', ntp_servers)
728 # substs.set('NTP_SERVERS', ntp_servers)
731 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
733 #if 0 /// UNNEEDED by elogind
734 # substs.set('SUSHELL', get_option('debug-shell'))
735 # substs.set('DEBUGTTY', get_option('debug-tty'))
738 debug = get_option('debug')
739 enable_debug_hashmap = false
740 enable_debug_mmap_cache = false
742 foreach name : debug.split(',')
744 enable_debug_hashmap = true
745 elif name == 'mmap-cache'
746 #if 1 /// additional elogind debug mode
747 elif name == 'elogind'
748 conf.set('ENABLE_DEBUG_ELOGIND', true)
750 enable_debug_mmap_cache = true
752 message('unknown debug option "@0@", ignoring'.format(name))
756 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
757 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
759 #####################################################################
761 threads = dependency('threads')
762 librt = cc.find_library('rt')
763 libm = cc.find_library('m')
764 libdl = cc.find_library('dl')
765 libcrypt = cc.find_library('crypt')
767 libcap = dependency('libcap', required : false)
768 if not libcap.found()
769 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
770 libcap = cc.find_library('cap')
773 #if 0 /// UNNEEDED by elogind
774 # libmount = dependency('mount',
775 # version : '>= 2.30')
777 # want_seccomp = get_option('seccomp')
778 # if want_seccomp != 'false'
779 # libseccomp = dependency('libseccomp',
780 # version : '>= 2.3.1',
781 # required : want_seccomp == 'true')
782 # have = libseccomp.found()
790 conf.set10('HAVE_SECCOMP', have)
791 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
793 want_selinux = get_option('selinux')
794 if want_selinux != 'false'
795 libselinux = dependency('libselinux',
796 version : '>= 2.1.9',
797 required : want_selinux == 'true')
798 have = libselinux.found()
803 conf.set10('HAVE_SELINUX', have)
804 m4_defines += have ? ['-DHAVE_SELINUX'] : []
806 #if 0 /// UNNEEDED by elogind
807 # want_apparmor = get_option('apparmor')
808 # if want_apparmor != 'false'
809 # libapparmor = dependency('libapparmor',
810 # required : want_apparmor == 'true')
811 # have = libapparmor.found()
819 conf.set10('HAVE_APPARMOR', have)
820 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
822 smack_run_label = get_option('smack-run-label')
823 if smack_run_label != ''
824 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
825 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
828 want_polkit = get_option('polkit')
829 install_polkit = false
830 install_polkit_pkla = false
831 if want_polkit != 'false'
832 install_polkit = true
834 libpolkit = dependency('polkit-gobject-1',
836 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
837 message('Old polkit detected, will install pkla files')
838 install_polkit_pkla = true
841 conf.set10('ENABLE_POLKIT', install_polkit)
843 want_acl = get_option('acl')
844 if want_acl != 'false'
845 libacl = cc.find_library('acl', required : want_acl == 'true')
846 have = libacl.found()
851 conf.set10('HAVE_ACL', have)
852 m4_defines += have ? ['-DHAVE_ACL'] : []
854 want_audit = get_option('audit')
855 if want_audit != 'false'
856 libaudit = dependency('audit', required : want_audit == 'true')
857 have = libaudit.found()
862 conf.set10('HAVE_AUDIT', have)
864 #if 0 /// UNNEEDED by elogind
865 # want_blkid = get_option('blkid')
866 # if want_blkid != 'false'
867 # libblkid = dependency('blkid', required : want_blkid == 'true')
868 # have = libblkid.found()
873 # conf.set10('HAVE_BLKID', have)
875 # want_kmod = get_option('kmod')
876 # if want_kmod != 'false'
877 # libkmod = dependency('libkmod',
879 # required : want_kmod == 'true')
880 # have = libkmod.found()
885 # conf.set10('HAVE_KMOD', have)
891 want_pam = get_option('pam')
892 if want_pam != 'false'
893 libpam = cc.find_library('pam', required : want_pam == 'true')
894 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
895 have = libpam.found() and libpam_misc.found()
901 conf.set10('HAVE_PAM', have)
902 m4_defines += have ? ['-DHAVE_PAM'] : []
904 #if 0 /// UNNEEDED by elogind
905 # want_microhttpd = get_option('microhttpd')
906 # if want_microhttpd != 'false'
907 # libmicrohttpd = dependency('libmicrohttpd',
908 # version : '>= 0.9.33',
909 # required : want_microhttpd == 'true')
910 # have = libmicrohttpd.found()
915 # conf.set10('HAVE_MICROHTTPD', have)
916 # m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
918 # want_libcryptsetup = get_option('libcryptsetup')
919 # if want_libcryptsetup != 'false'
920 # libcryptsetup = dependency('libcryptsetup',
921 # version : '>= 1.6.0',
922 # required : want_libcryptsetup == 'true')
923 # have = libcryptsetup.found()
928 # conf.set10('HAVE_LIBCRYPTSETUP', have)
930 # want_libcurl = get_option('libcurl')
931 # if want_libcurl != 'false'
932 # libcurl = dependency('libcurl',
933 # version : '>= 7.32.0',
934 # required : want_libcurl == 'true')
935 # have = libcurl.found()
940 # conf.set10('HAVE_LIBCURL', have)
941 # m4_defines += have ? ['-DHAVE_LIBCURL'] : []
943 # want_libidn = get_option('libidn')
944 # want_libidn2 = get_option('libidn2')
945 # if want_libidn == 'true' and want_libidn2 == 'true'
946 # error('libidn and libidn2 cannot be requested simultaneously')
949 # if want_libidn != 'false' and want_libidn2 != 'true'
950 # libidn = dependency('libidn',
951 # required : want_libidn == 'true')
952 # have = libidn.found()
957 # conf.set10('HAVE_LIBIDN', have)
958 # m4_defines += have ? ['-DHAVE_LIBIDN'] : []
959 # if not have and want_libidn2 != 'false'
960 # # libidn is used for both libidn and libidn2 objects
961 # libidn = dependency('libidn2',
962 # required : want_libidn2 == 'true')
963 # have = libidn.found()
967 # conf.set10('HAVE_LIBIDN2', have)
968 # m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
970 # want_libiptc = get_option('libiptc')
971 # if want_libiptc != 'false'
972 # libiptc = dependency('libiptc',
973 # required : want_libiptc == 'true')
974 # have = libiptc.found()
979 # conf.set10('HAVE_LIBIPTC', have)
980 # m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
982 # want_qrencode = get_option('qrencode')
983 # if want_qrencode != 'false'
984 # libqrencode = dependency('libqrencode',
985 # required : want_qrencode == 'true')
986 # have = libqrencode.found()
991 # conf.set10('HAVE_QRENCODE', have)
993 # want_gcrypt = get_option('gcrypt')
994 # if want_gcrypt != 'false'
995 # libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
996 # libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
997 # have = libgcrypt.found() and libgpg_error.found()
1002 # # link to neither of the libs if one is not found
1006 # conf.set10('HAVE_GCRYPT', have)
1008 # want_gnutls = get_option('gnutls')
1009 # if want_gnutls != 'false'
1010 # libgnutls = dependency('gnutls',
1011 # version : '>= 3.1.4',
1012 # required : want_gnutls == 'true')
1013 # have = libgnutls.found()
1018 # conf.set10('HAVE_GNUTLS', have)
1020 # want_elfutils = get_option('elfutils')
1021 # if want_elfutils != 'false'
1022 # libdw = dependency('libdw',
1023 # required : want_elfutils == 'true')
1024 # have = libdw.found()
1029 # conf.set10('HAVE_ELFUTILS', have)
1031 # want_zlib = get_option('zlib')
1032 # if want_zlib != 'false'
1033 # libz = dependency('zlib',
1034 # required : want_zlib == 'true')
1035 # have = libz.found()
1040 # conf.set10('HAVE_ZLIB', have)
1042 # want_bzip2 = get_option('bzip2')
1043 # if want_bzip2 != 'false'
1044 # libbzip2 = cc.find_library('bz2',
1045 # required : want_bzip2 == 'true')
1046 # have = libbzip2.found()
1051 # conf.set10('HAVE_BZIP2', have)
1053 # want_xz = get_option('xz')
1054 # if want_xz != 'false'
1055 # libxz = dependency('liblzma',
1056 # required : want_xz == 'true')
1057 # have = libxz.found()
1062 # conf.set10('HAVE_XZ', have)
1064 # want_lz4 = get_option('lz4')
1065 # if want_lz4 != 'false'
1066 # liblz4 = dependency('liblz4',
1067 # required : want_lz4 == 'true')
1068 # have = liblz4.found()
1073 # conf.set10('HAVE_LZ4', have)
1075 # want_xkbcommon = get_option('xkbcommon')
1076 # if want_xkbcommon != 'false'
1077 # libxkbcommon = dependency('xkbcommon',
1078 # version : '>= 0.3.0',
1079 # required : want_xkbcommon == 'true')
1080 # have = libxkbcommon.found()
1102 conf.set10('HAVE_XKBCOMMON', have)
1104 want_glib = get_option('glib')
1105 if want_glib != 'false'
1106 libglib = dependency('glib-2.0',
1107 version : '>= 2.22.0',
1108 required : want_glib == 'true')
1109 libgobject = dependency('gobject-2.0',
1110 version : '>= 2.22.0',
1111 required : want_glib == 'true')
1112 libgio = dependency('gio-2.0',
1113 required : want_glib == 'true')
1114 have = libglib.found() and libgobject.found() and libgio.found()
1121 conf.set10('HAVE_GLIB', have)
1123 want_dbus = get_option('dbus')
1124 if want_dbus != 'false'
1125 libdbus = dependency('dbus-1',
1126 version : '>= 1.3.2',
1127 required : want_dbus == 'true')
1128 have = libdbus.found()
1133 conf.set10('HAVE_DBUS', have)
1135 #if 0 /// UNNEEDED by elogind
1136 # default_dnssec = get_option('default-dnssec')
1137 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1138 # message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1139 # default_dnssec = 'no'
1141 # conf.set('DEFAULT_DNSSEC_MODE',
1142 # 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1143 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1145 # want_importd = get_option('importd')
1146 # if want_importd != 'false'
1147 # have = (conf.get('HAVE_LIBCURL') == 1 and
1148 # conf.get('HAVE_ZLIB') == 1 and
1149 # conf.get('HAVE_BZIP2') == 1 and
1150 # conf.get('HAVE_XZ') == 1 and
1151 # conf.get('HAVE_GCRYPT') == 1)
1152 # if want_importd == 'true' and not have
1153 # error('importd support was requested, but dependencies are not available')
1158 # conf.set10('ENABLE_IMPORTD', have)
1160 # want_remote = get_option('remote')
1161 # if want_remote != 'false'
1162 # have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1163 # conf.get('HAVE_LIBCURL') == 1]
1164 # # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1165 # # it's possible to build one without the other. Complain only if
1166 # # support was explictly requested. The auxiliary files like sysusers
1167 # # config should be installed when any of the programs are built.
1168 # if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1169 # error('remote support was requested, but dependencies are not available')
1171 # have = have_deps[0] or have_deps[1]
1176 conf.set10('ENABLE_REMOTE', have)
1178 foreach term : ['utmp',
1179 #if 0 /// UNNEEDED by elogind
1212 have = get_option(term)
1213 name = 'ENABLE_' + term.underscorify().to_upper()
1214 conf.set10(name, have)
1215 m4_defines += have ? ['-D' + name] : []
1218 want_tests = get_option('tests')
1219 install_tests = get_option('install-tests')
1222 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1224 #####################################################################
1226 #if 0 /// UNNEEDED by elogind
1227 # if get_option('efi')
1228 # efi_arch = host_machine.cpu_family()
1230 # if efi_arch == 'x86'
1231 # EFI_MACHINE_TYPE_NAME = 'ia32'
1232 # gnu_efi_arch = 'ia32'
1233 # elif efi_arch == 'x86_64'
1234 # EFI_MACHINE_TYPE_NAME = 'x64'
1235 # gnu_efi_arch = 'x86_64'
1236 # elif efi_arch == 'arm'
1237 # EFI_MACHINE_TYPE_NAME = 'arm'
1238 # gnu_efi_arch = 'arm'
1239 # elif efi_arch == 'aarch64'
1240 # EFI_MACHINE_TYPE_NAME = 'aa64'
1241 # gnu_efi_arch = 'aarch64'
1243 # EFI_MACHINE_TYPE_NAME = ''
1248 # conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1250 # conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1255 conf.set10('ENABLE_EFI', have)
1257 #####################################################################
1259 config_h = configure_file(
1260 output : 'config.h',
1261 configuration : conf)
1263 includes = include_directories('src/basic',
1266 #if 0 /// UNNEEDED by elogind
1272 #if 0 /// UNNEEDED by elogind
1277 #if 0 /// elogind has a different list
1278 # 'src/libsystemd/sd-bus',
1279 # 'src/libsystemd/sd-device',
1280 # 'src/libsystemd/sd-hwdb',
1281 # 'src/libsystemd/sd-id128',
1282 # 'src/libsystemd/sd-netlink',
1283 # 'src/libsystemd/sd-network',
1284 # 'src/libsystemd-network',
1286 'src/libelogind/sd-bus',
1287 'src/libelogind/sd-id128',
1294 add_project_arguments('-include', 'config.h', language : 'c')
1296 #if 0 /// UNNEEDED by elogind
1297 # gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1298 # 'src/shared/gcrypt-util.c')
1302 #if 0 /// UNNEEDED by elogind
1305 subdir('src/systemd')
1307 #if 0 /// UNNEEDED by elogind
1308 # subdir('src/libsystemd')
1309 # subdir('src/libsystemd-network')
1310 # subdir('src/journal')
1313 subdir('src/libelogind')
1315 subdir('src/update-utmp')
1319 #if 0 /// UNNEEDED by elogind
1320 # libjournal_core = static_library(
1322 # libjournal_core_sources,
1324 # include_directories : includes,
1327 # libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1328 # libsystemd = shared_library(
1330 # libsystemd_internal_sources,
1331 # journal_internal_sources,
1332 # version : libsystemd_version,
1333 # include_directories : includes,
1334 # link_args : ['-shared',
1335 # '-Wl,--version-script=' + libsystemd_sym_path],
1336 # link_with : [libbasic],
1337 # dependencies : [threads,
1342 # link_depends : libsystemd_sym,
1344 # install_dir : rootlibdir)
1346 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1347 libelogind = shared_library(
1349 libelogind_internal_sources,
1350 version : libelogind_version,
1351 include_directories : includes,
1352 link_args : ['-shared',
1353 '-Wl,--version-script=' + libelogind_sym_path],
1354 link_with : [libbasic],
1355 dependencies : [threads],
1356 link_depends : libelogind_sym,
1358 install_dir : rootlibdir)
1361 ############################################################
1363 # binaries that have --help and are intended for use by humans,
1364 # usually, but not always, installed in /bin.
1365 public_programs = []
1367 #if 0 /// UNNEEDED by elogind
1368 # subdir('src/libudev')
1370 # elogind depends on external libudev:
1371 libudev = dependency('libudev', required : true)
1373 subdir('src/shared')
1374 #if 0 /// UNNEEDED by elogind
1375 # subdir('src/core')
1376 # subdir('src/udev')
1377 # subdir('src/network')
1379 # subdir('src/analyze')
1380 # subdir('src/journal-remote')
1381 # subdir('src/coredump')
1382 # subdir('src/hostname')
1383 # subdir('src/import')
1384 # subdir('src/kernel-install')
1385 # subdir('src/locale')
1386 # subdir('src/machine')
1387 # subdir('src/nspawn')
1388 # subdir('src/resolve')
1389 # subdir('src/timedate')
1390 # subdir('src/timesync')
1391 # subdir('src/vconsole')
1392 # subdir('src/sulogin-shell')
1393 # subdir('src/boot/efi')
1397 #if 0 /// UNNEEDED in elogind
1401 ############################################################
1403 # only static linking apart from libdl, to make sure that the
1404 # module is linked to all libraries that it uses.
1405 test_dlopen = executable(
1408 include_directories : includes,
1409 link_with : [libbasic],
1410 dependencies : [libdl])
1412 #if 0 /// UNNEEDED by elogind
1413 # foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1414 # ['systemd', 'ENABLE_NSS_SYSTEMD'],
1415 # ['mymachines', 'ENABLE_MACHINED'],
1416 # ['resolve', 'ENABLE_RESOLVE']]
1418 # condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1422 # sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1423 # version_script_arg = join_paths(meson.current_source_dir(), sym)
1425 # nss = shared_library(
1427 # 'src/nss-@0@/nss-@0@.c'.format(module),
1429 # include_directories : includes,
1430 # link_args : ['-shared',
1431 # '-Wl,--version-script=' + version_script_arg,
1432 # '-Wl,--undefined'],
1433 # link_with : [libsystemd_internal,
1435 # dependencies : [threads,
1437 # link_depends : sym,
1439 # install_dir : rootlibdir)
1441 # # We cannot use shared_module because it does not support version suffix.
1442 # # Unfortunately shared_library insists on creating the symlink…
1443 # meson.add_install_script('sh', '-c',
1444 # 'rm $DESTDIR@0@/libnss_@1@.so'
1445 # .format(rootlibdir, module))
1447 # test('dlopen-nss_' + module,
1449 # args : [nss.full_path()]) # path to dlopen must include a slash
1454 ############################################################
1456 #if 0 /// UNNEEDED by elogind
1457 # executable('systemd',
1459 # include_directories : includes,
1460 # link_with : [libcore,
1462 # dependencies : [threads,
1468 # install_rpath : rootlibexecdir,
1470 # install_dir : rootlibexecdir)
1472 # exe = executable('systemd-analyze',
1473 # systemd_analyze_sources,
1474 # include_directories : includes,
1475 # link_with : [libcore,
1477 # dependencies : [threads,
1483 # install_rpath : rootlibexecdir,
1485 # public_programs += [exe]
1487 # executable('systemd-journald',
1488 # systemd_journald_sources,
1489 # include_directories : includes,
1490 # link_with : [libjournal_core,
1492 # dependencies : [threads,
1496 # install_rpath : rootlibexecdir,
1498 # install_dir : rootlibexecdir)
1500 # exe = executable('systemd-cat',
1501 # systemd_cat_sources,
1502 # include_directories : includes,
1503 # link_with : [libjournal_core,
1505 # dependencies : [threads],
1506 # install_rpath : rootlibexecdir,
1508 # public_programs += [exe]
1510 # exe = executable('journalctl',
1511 # journalctl_sources,
1512 # include_directories : includes,
1513 # link_with : [libshared],
1514 # dependencies : [threads,
1518 # install_rpath : rootlibexecdir,
1520 # install_dir : rootbindir)
1521 # public_programs += [exe]
1523 # executable('systemd-getty-generator',
1524 # 'src/getty-generator/getty-generator.c',
1525 # include_directories : includes,
1526 # link_with : [libshared],
1527 # install_rpath : rootlibexecdir,
1529 # install_dir : systemgeneratordir)
1531 # executable('systemd-debug-generator',
1532 # 'src/debug-generator/debug-generator.c',
1533 # include_directories : includes,
1534 # link_with : [libshared],
1535 # install_rpath : rootlibexecdir,
1537 # install_dir : systemgeneratordir)
1539 # executable('systemd-fstab-generator',
1540 # 'src/fstab-generator/fstab-generator.c',
1541 # 'src/core/mount-setup.c',
1542 # include_directories : includes,
1543 # link_with : [libshared],
1544 # install_rpath : rootlibexecdir,
1546 # install_dir : systemgeneratordir)
1548 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1549 # executable('30-systemd-environment-d-generator',
1550 # 'src/environment-d-generator/environment-d-generator.c',
1551 # include_directories : includes,
1552 # link_with : [libshared],
1553 # install_rpath : rootlibexecdir,
1555 # install_dir : userenvgeneratordir)
1557 # meson.add_install_script(meson_make_symlink,
1558 # join_paths(sysconfdir, 'environment'),
1559 # join_paths(environmentdir, '99-environment.conf'))
1562 # if conf.get('ENABLE_HIBERNATE') == 1
1563 # executable('systemd-hibernate-resume-generator',
1564 # 'src/hibernate-resume/hibernate-resume-generator.c',
1565 # include_directories : includes,
1566 # link_with : [libshared],
1567 # install_rpath : rootlibexecdir,
1569 # install_dir : systemgeneratordir)
1571 # executable('systemd-hibernate-resume',
1572 # 'src/hibernate-resume/hibernate-resume.c',
1573 # include_directories : includes,
1574 # link_with : [libshared],
1575 # install_rpath : rootlibexecdir,
1577 # install_dir : rootlibexecdir)
1580 # if conf.get('HAVE_BLKID') == 1
1581 # executable('systemd-gpt-auto-generator',
1582 # 'src/gpt-auto-generator/gpt-auto-generator.c',
1583 # 'src/basic/blkid-util.h',
1584 # include_directories : includes,
1585 # link_with : [libshared],
1586 # dependencies : libblkid,
1587 # install_rpath : rootlibexecdir,
1589 # install_dir : systemgeneratordir)
1591 # exe = executable('systemd-dissect',
1592 # 'src/dissect/dissect.c',
1593 # include_directories : includes,
1594 # link_with : [libshared],
1595 # install_rpath : rootlibexecdir,
1597 # install_dir : rootlibexecdir)
1598 # public_programs += [exe]
1601 # if conf.get('ENABLE_RESOLVE') == 1
1602 # executable('systemd-resolved',
1603 # systemd_resolved_sources,
1604 # gcrypt_util_sources,
1605 # include_directories : includes,
1606 # link_with : [libshared],
1607 # dependencies : [threads,
1612 # install_rpath : rootlibexecdir,
1614 # install_dir : rootlibexecdir)
1616 # exe = executable('systemd-resolve',
1617 # systemd_resolve_sources,
1618 # gcrypt_util_sources,
1619 # include_directories : includes,
1620 # link_with : [libshared],
1621 # dependencies : [threads,
1626 # install_rpath : rootlibexecdir,
1628 # public_programs += [exe]
1631 # if conf.get('ENABLE_LOGIND') == 1
1632 # executable('systemd-logind',
1633 # systemd_logind_sources,
1634 # include_directories : includes,
1635 # link_with : [liblogind_core,
1637 # dependencies : [threads,
1639 # install_rpath : rootlibexecdir,
1641 # install_dir : rootlibexecdir)
1643 # exe = executable('loginctl',
1645 # include_directories : includes,
1646 # link_with : [libshared],
1647 # dependencies : [threads,
1650 # install_rpath : rootlibexecdir,
1652 # install_dir : rootbindir)
1653 # public_programs += [exe]
1655 # exe = executable('systemd-inhibit',
1656 # 'src/login/inhibit.c',
1657 # include_directories : includes,
1658 # link_with : [libshared],
1659 # install_rpath : rootlibexecdir,
1661 # install_dir : rootbindir)
1662 # public_programs += [exe]
1664 # if conf.get('HAVE_PAM') == 1
1665 # version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1666 # pam_systemd = shared_library(
1670 # include_directories : includes,
1671 # link_args : ['-shared',
1672 # '-Wl,--version-script=' + version_script_arg],
1673 # link_with : [libsystemd_internal,
1674 # libshared_static],
1675 # dependencies : [threads,
1678 # link_depends : pam_systemd_sym,
1680 # install_dir : pamlibdir)
1682 # test('dlopen-pam_systemd',
1684 # args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1689 executable('elogind',
1691 include_directories : includes,
1692 link_with : [liblogind_core,
1694 dependencies : [threads,
1697 install_rpath : rootlibexecdir,
1699 install_dir : rootlibexecdir)
1701 exe = executable('loginctl',
1703 include_directories : includes,
1704 link_with : [libshared],
1705 dependencies : [threads,
1707 install_rpath : rootlibexecdir,
1709 install_dir : rootbindir)
1710 public_programs += [exe]
1712 exe = executable('elogind-inhibit',
1713 'src/login/inhibit.c',
1714 include_directories : includes,
1715 link_with : [libshared],
1716 dependencies : [threads],
1717 install_rpath : rootlibexecdir,
1719 install_dir : rootbindir)
1720 public_programs += [exe]
1722 if conf.get('HAVE_PAM') == 1
1723 version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1724 pam_elogind = shared_library(
1728 include_directories : includes,
1729 link_args : ['-shared',
1730 '-Wl,--version-script=' + version_script_arg],
1731 link_with : [libelogind,
1733 dependencies : [threads,
1736 link_depends : pam_elogind_sym,
1738 install_dir : pamlibdir)
1740 test('dlopen-pam_elogind',
1742 args : [pam_elogind.full_path()]) # path to dlopen must include a slash
1746 #if 0 /// UNNEEDED by elogind
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('ENABLE_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))