1 project('systemd', 'c',
10 meson_version : '>= 0.40',
13 # We need the same data in three different formats, ugh!
14 # Also, for hysterical reasons, we use different variable
15 # names, sometimes. Not all variables are included in every
17 conf = configuration_data()
18 conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
19 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
21 substs = configuration_data()
22 substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
23 substs.set('PACKAGE_VERSION', meson.project_version())
27 #####################################################################
29 # Try to install the git pre-commit hook
30 git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
31 if git_hook.returncode() == 0
32 message(git_hook.stdout().strip())
35 #####################################################################
37 rootprefixdir = get_option('rootprefix')
38 if get_option('split-usr')
39 conf.set('HAVE_SPLIT_USR', true)
40 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/'
42 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr'
45 sysvinit_path = get_option('sysvinit-path')
46 sysvrcnd_path = get_option('sysvrcnd-path')
47 if sysvinit_path != '' or sysvrcnd_path != ''
48 conf.set('HAVE_SYSV_COMPAT', true,
49 description : 'SysV init scripts and rcN.d links are supported')
50 m4_defines += ['-DHAVE_SYSV_COMPAT']
53 # join_paths ignore the preceding arguments if an absolute component is
54 # encountered, so this should canonicalize various paths when they are
55 # absolute or relative.
56 prefixdir = get_option('prefix')
57 if not prefixdir.startswith('/')
58 error('Prefix is not absolute: "@0@"'.format(prefixdir))
60 bindir = join_paths(prefixdir, get_option('bindir'))
61 libdir = join_paths(prefixdir, get_option('libdir'))
62 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
63 includedir = join_paths(prefixdir, get_option('includedir'))
64 datadir = join_paths(prefixdir, get_option('datadir'))
65 localstatedir = join_paths('/', get_option('localstatedir'))
67 rootbindir = join_paths(rootprefixdir, 'bin')
68 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
70 rootlibdir = get_option('rootlibdir')
72 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
75 # Dirs of external packages
76 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
77 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
78 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
79 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
80 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
81 varlogdir = join_paths(localstatedir, 'log')
82 xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
83 rpmmacrosdir = get_option('rpmmacrosdir')
84 modprobedir = join_paths(prefixdir, 'lib/modprobe.d')
87 pkgdatadir = join_paths(datadir, 'systemd')
88 environmentdir = join_paths(prefixdir, 'lib/environment.d')
89 pkgsysconfdir = join_paths(sysconfdir, 'systemd')
90 userunitdir = join_paths(prefixdir, 'lib/systemd/user')
91 userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
92 tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
93 sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
94 sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
95 binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
96 modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
97 networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
98 pkgincludedir = join_paths(includedir, 'systemd')
99 systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
100 usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
101 systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
102 userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
103 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
104 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
105 systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
106 systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
107 udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
108 udevhomedir = udevlibexecdir
109 udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
110 udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
111 catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
112 kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
113 factorydir = join_paths(datadir, 'factory')
114 docdir = join_paths(datadir, 'doc/systemd')
115 bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
116 testsdir = join_paths(prefixdir, 'lib/systemd/tests')
117 systemdstatedir = join_paths(localstatedir, 'lib/systemd')
118 catalogstatedir = join_paths(systemdstatedir, 'catalog')
119 randomseeddir = join_paths(localstatedir, 'lib/systemd')
121 dbuspolicydir = get_option('dbuspolicydir')
122 if dbuspolicydir == ''
123 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
126 dbussessionservicedir = get_option('dbussessionservicedir')
127 if dbussessionservicedir == ''
128 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
131 dbussystemservicedir = get_option('dbussystemservicedir')
132 if dbussystemservicedir == ''
133 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
136 pamlibdir = get_option('pamlibdir')
138 pamlibdir = join_paths(rootlibdir, 'security')
141 pamconfdir = get_option('pamconfdir')
143 pamconfdir = join_paths(sysconfdir, 'pam.d')
146 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
147 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
148 conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
149 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
150 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
151 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
152 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
153 conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
154 conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
155 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
156 conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
157 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
158 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
159 conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
160 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
161 conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
162 conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
163 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
164 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
165 conf.set_quoted('ROOTPREFIX', rootprefixdir)
166 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
167 conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
168 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
169 conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
170 conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
171 conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
172 conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
173 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
174 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
175 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
176 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
177 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
178 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
179 conf.set_quoted('LIBDIR', libdir)
180 conf.set_quoted('ROOTLIBDIR', rootlibdir)
181 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
182 conf.set_quoted('BOOTLIBDIR', bootlibdir)
183 conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
184 conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
185 conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
186 conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
187 conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
188 conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
190 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
191 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
193 substs.set('prefix', prefixdir)
194 substs.set('exec_prefix', prefixdir)
195 substs.set('libdir', libdir)
196 substs.set('rootlibdir', rootlibdir)
197 substs.set('includedir', includedir)
198 substs.set('pkgsysconfdir', pkgsysconfdir)
199 substs.set('bindir', bindir)
200 substs.set('rootbindir', rootbindir)
201 substs.set('rootlibexecdir', rootlibexecdir)
202 substs.set('systemunitdir', systemunitdir)
203 substs.set('userunitdir', userunitdir)
204 substs.set('systempresetdir', systempresetdir)
205 substs.set('userpresetdir', userpresetdir)
206 substs.set('udevhwdbdir', udevhwdbdir)
207 substs.set('udevrulesdir', udevrulesdir)
208 substs.set('udevlibexecdir', udevlibexecdir)
209 substs.set('catalogdir', catalogdir)
210 substs.set('tmpfilesdir', tmpfilesdir)
211 substs.set('sysusersdir', sysusersdir)
212 substs.set('sysctldir', sysctldir)
213 substs.set('binfmtdir', binfmtdir)
214 substs.set('modulesloaddir', modulesloaddir)
215 substs.set('systemgeneratordir', systemgeneratordir)
216 substs.set('usergeneratordir', usergeneratordir)
217 substs.set('systemenvgeneratordir', systemenvgeneratordir)
218 substs.set('userenvgeneratordir', userenvgeneratordir)
219 substs.set('systemshutdowndir', systemshutdowndir)
220 substs.set('systemsleepdir', systemsleepdir)
221 substs.set('VARLOGDIR', varlogdir)
222 substs.set('CERTIFICATEROOT', get_option('certificate-root'))
223 substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
224 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
225 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
226 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
227 substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
228 substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
230 #####################################################################
232 cc = meson.get_compiler('c')
233 pkgconfig = import('pkgconfig')
234 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
236 cxx = find_program('c++', required : false)
238 # Used only for tests
242 foreach arg : ['-Wextra',
245 '-Wmissing-include-dirs',
246 '-Wold-style-definition',
249 '-Wdeclaration-after-statement',
251 '-Wsuggest-attribute=noreturn',
252 '-Werror=missing-prototypes',
253 '-Werror=implicit-function-declaration',
254 '-Werror=missing-declarations',
255 '-Werror=return-type',
256 '-Werror=incompatible-pointer-types',
258 '-Wstrict-prototypes',
260 '-Wmissing-noreturn',
263 '-Wstrict-aliasing=2',
270 '-fdiagnostics-show-option',
271 '-fno-strict-aliasing',
272 '-fvisibility=hidden',
274 '-fstack-protector-strong',
276 '--param=ssp-buffer-size=4',
278 if cc.has_argument(arg)
279 add_project_arguments(arg, language : 'c')
283 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
284 # arguments, just emits a warnings. So test for the "positive" version instead.
285 foreach arg : ['unused-parameter',
286 'missing-field-initializers',
289 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
291 if cc.has_argument('-W' + arg)
292 add_project_arguments('-Wno-' + arg, language : 'c')
298 #include <inttypes.h>
299 typedef uint64_t usec_t;
300 usec_t now(clockid_t clock);
305 ', name : '-Werror=shadow with local shadowing')
306 add_project_arguments('-Werror=shadow', language : 'c')
309 if cc.get_id() == 'clang'
310 foreach arg : ['-Wno-typedef-redefinition',
311 '-Wno-gnu-variable-sized-type-not-at-end',
313 if cc.has_argument(arg,
314 name : '@0@ is supported'.format(arg))
315 add_project_arguments(arg, language : 'c')
320 link_test_c = files('tools/meson-link-test.c')
322 # --as-needed and --no-undefined are provided by meson by default,
323 # run mesonconf to see what is enabled
324 foreach arg : ['-Wl,-z,relro',
329 have = run_command(check_compilation_sh,
330 cc.cmd_array(), '-x', 'c', arg,
331 '-include', link_test_c).returncode() == 0
332 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
334 add_project_link_arguments(arg, language : 'c')
338 if get_option('buildtype') != 'debug'
339 foreach arg : ['-ffunction-sections',
341 if cc.has_argument(arg,
342 name : '@0@ is supported'.format(arg))
343 add_project_arguments(arg, language : 'c')
347 foreach arg : ['-Wl,--gc-sections']
348 have = run_command(check_compilation_sh,
349 cc.cmd_array(), '-x', 'c', arg,
350 '-include', link_test_c).returncode() == 0
351 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
353 add_project_link_arguments(arg, language : 'c')
358 cpp = ' '.join(cc.cmd_array()) + ' -E'
360 #####################################################################
361 # compilation result tests
363 conf.set('_GNU_SOURCE', true)
364 conf.set('__SANE_USERSPACE_TYPES__', true)
366 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
367 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
368 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
369 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
370 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
371 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
372 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
376 #include <linux/ethtool.h>
378 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
380 foreach decl : ['char16_t',
383 'struct ethtool_link_settings',
386 # We get -1 if the size cannot be determined
387 have = cc.sizeof(decl, prefix : decl_headers) > 0
388 conf.set('HAVE_' + decl.underscorify().to_upper(), have)
391 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
392 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
393 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
394 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
395 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
396 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
397 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
398 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
399 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
400 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
401 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
402 # if_tunnel.h is buggy and cannot be included on its own
403 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
404 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
405 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
406 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
407 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
408 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
409 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
410 ['NDA_IFINDEX', 'linux/neighbour.h'],
411 ['IFA_FLAGS', 'linux/if_addr.h'],
412 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
414 prefix = decl.length() > 2 ? decl[2] : ''
415 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
416 conf.set10('HAVE_DECL_' + decl[0], have)
420 foreach ident : ['secure_getenv', '__secure_getenv']
421 if not skip and cc.has_function(ident)
422 conf.set('HAVE_' + ident.to_upper(), true)
428 ['memfd_create', '''#include <sys/memfd.h>'''],
429 ['gettid', '''#include <sys/types.h>'''],
430 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
431 ['name_to_handle_at', '''#define _GNU_SOURCE
432 #include <sys/types.h>
433 #include <sys/stat.h>
434 #include <fcntl.h>'''],
435 ['setns', '''#define _GNU_SOURCE
436 #include <sched.h>'''],
437 ['renameat2', '''#include <stdio.h>'''],
438 ['kcmp', '''#include <linux/kcmp.h>'''],
439 ['keyctl', '''#include <sys/types.h>
440 #include <keyutils.h>'''],
441 ['copy_file_range', '''#include <sys/syscall.h>
442 #include <unistd.h>'''],
443 ['explicit_bzero' , '''#include <string.h>'''],
446 have = cc.has_function(ident[0], prefix : ident[1])
447 conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
450 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
451 conf.set('USE_SYS_RANDOM_H', true)
452 conf.set10('HAVE_DECL_GETRANDOM', true)
454 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
455 conf.set10('HAVE_DECL_GETRANDOM', have)
458 #####################################################################
460 sed = find_program('sed')
461 grep = find_program('grep')
462 awk = find_program('awk')
463 m4 = find_program('m4')
464 stat = find_program('stat')
465 git = find_program('git', required : false)
467 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
468 mkdir_p = 'mkdir -p $DESTDIR/@0@'
469 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
470 splash_bmp = files('test/splash.bmp')
472 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
473 # /usr/sbin, /sbin, and fall back to the default from middle column.
474 progs = [['telinit', '/lib/sysvinit/telinit'],
475 ['quotaon', '/usr/sbin/quotaon' ],
476 ['quotacheck', '/usr/sbin/quotacheck' ],
477 ['kill', '/usr/bin/kill' ],
478 ['kmod', '/usr/bin/kmod' ],
479 ['kexec', '/usr/sbin/kexec' ],
480 ['sulogin', '/usr/sbin/sulogin' ],
481 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
482 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
483 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
484 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
487 path = get_option(prog[0] + '-path')
489 message('Using @1@ for @0@'.format(prog[0], path))
491 exe = find_program(prog[0],
492 '/usr/sbin/' + prog[0],
495 path = exe.found() ? exe.path() : prog[1]
497 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
498 conf.set_quoted(name, path)
499 substs.set(name, path)
502 if run_command('ln', '--relative', '--help').returncode() != 0
503 error('ln does not support --relative')
506 ############################################################
508 gperf = find_program('gperf')
510 gperf_test_format = '''
512 const char * in_word_set(const char *, @0@);
515 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
516 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
517 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
518 if cc.compiles(gperf_test)
519 gperf_len_type = 'size_t'
521 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
522 if cc.compiles(gperf_test)
523 gperf_len_type = 'unsigned'
525 error('unable to determine gperf len type')
528 message('gperf len type is @0@'.format(gperf_len_type))
529 conf.set('GPERF_LEN_TYPE', gperf_len_type,
530 description : 'The type of gperf "len" parameter')
532 ############################################################
534 if not cc.has_header('sys/capability.h')
535 error('POSIX caps headers not found')
537 foreach header : ['linux/btrfs.h',
539 'linux/vm_sockets.h',
540 'valgrind/memcheck.h',
541 'valgrind/valgrind.h',
544 conf.set('HAVE_' + header.underscorify().to_upper(),
545 cc.has_header(header))
548 ############################################################
550 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
551 conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
552 gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
554 default_hierarchy = get_option('default-hierarchy')
555 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
556 description : 'default cgroup hierarchy as string')
557 if default_hierarchy == 'legacy'
558 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
559 elif default_hierarchy == 'hybrid'
560 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
562 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
565 time_epoch = get_option('time-epoch')
568 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
570 time_epoch = time_epoch.to_int()
571 conf.set('TIME_EPOCH', time_epoch)
573 system_uid_max = get_option('system-uid-max')
574 if system_uid_max == ''
575 system_uid_max = run_command(
577 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
578 '/etc/login.defs').stdout()
580 system_uid_max = system_uid_max.to_int()
581 conf.set('SYSTEM_UID_MAX', system_uid_max)
582 substs.set('systemuidmax', system_uid_max)
583 message('maximum system UID is @0@'.format(system_uid_max))
585 conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
586 conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
588 system_gid_max = get_option('system-gid-max')
589 if system_gid_max == ''
590 system_gid_max = run_command(
592 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
593 '/etc/login.defs').stdout()
595 system_gid_max = system_gid_max.to_int()
596 conf.set('SYSTEM_GID_MAX', system_gid_max)
597 substs.set('systemgidmax', system_gid_max)
598 message('maximum system GID is @0@'.format(system_gid_max))
600 tty_gid = get_option('tty-gid')
601 conf.set('TTY_GID', tty_gid)
602 substs.set('TTY_GID', tty_gid)
604 if get_option('adm-group')
605 m4_defines += ['-DENABLE_ADM_GROUP']
608 if get_option('wheel-group')
609 m4_defines += ['-DENABLE_WHEEL_GROUP']
612 substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
614 kill_user_processes = get_option('default-kill-user-processes')
615 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
616 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
618 dns_servers = get_option('dns-servers')
619 conf.set_quoted('DNS_SERVERS', dns_servers)
620 substs.set('DNS_SERVERS', dns_servers)
622 ntp_servers = get_option('ntp-servers')
623 conf.set_quoted('NTP_SERVERS', ntp_servers)
624 substs.set('NTP_SERVERS', ntp_servers)
626 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
628 substs.set('SUSHELL', get_option('debug-shell'))
629 substs.set('DEBUGTTY', get_option('debug-tty'))
631 debug = get_option('debug')
633 foreach name : debug.split(',')
635 conf.set('ENABLE_DEBUG_HASHMAP', true)
636 elif name == 'mmap-cache'
637 conf.set('ENABLE_DEBUG_MMAP_CACHE', true)
639 message('unknown debug option "@0@", ignoring'.format(name))
644 #####################################################################
646 threads = dependency('threads')
647 librt = cc.find_library('rt')
648 libm = cc.find_library('m')
649 libdl = cc.find_library('dl')
650 libcrypt = cc.find_library('crypt')
652 libcap = dependency('libcap', required : false)
653 if not libcap.found()
654 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
655 libcap = cc.find_library('cap')
658 libmount = dependency('mount',
661 want_seccomp = get_option('seccomp')
662 if want_seccomp != 'false'
663 libseccomp = dependency('libseccomp',
664 version : '>= 2.3.1',
665 required : want_seccomp == 'true')
666 if libseccomp.found()
667 conf.set('HAVE_SECCOMP', true)
668 m4_defines += ['-DHAVE_SECCOMP']
674 want_selinux = get_option('selinux')
675 if want_selinux != 'false'
676 libselinux = dependency('libselinux',
677 version : '>= 2.1.9',
678 required : want_selinux == 'true')
679 if libselinux.found()
680 conf.set('HAVE_SELINUX', true)
681 m4_defines += ['-DHAVE_SELINUX']
687 want_apparmor = get_option('apparmor')
688 if want_apparmor != 'false'
689 libapparmor = dependency('libapparmor',
690 required : want_apparmor == 'true')
691 if libapparmor.found()
692 conf.set('HAVE_APPARMOR', true)
693 m4_defines += ['-DHAVE_APPARMOR']
699 smack_run_label = get_option('smack-run-label')
700 if smack_run_label != ''
701 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
702 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
705 want_polkit = get_option('polkit')
706 install_polkit = false
707 install_polkit_pkla = false
708 if want_polkit != 'false'
709 conf.set('ENABLE_POLKIT', true)
710 install_polkit = true
712 libpolkit = dependency('polkit-gobject-1',
714 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
715 message('Old polkit detected, will install pkla files')
716 install_polkit_pkla = true
720 want_acl = get_option('acl')
721 if want_acl != 'false'
722 libacl = cc.find_library('acl', required : want_acl == 'true')
724 conf.set('HAVE_ACL', true)
725 m4_defines += ['-DHAVE_ACL']
731 want_audit = get_option('audit')
732 if want_audit != 'false'
733 libaudit = dependency('audit', required : want_audit == 'true')
734 conf.set('HAVE_AUDIT', libaudit.found())
739 want_blkid = get_option('blkid')
740 if want_blkid != 'false'
741 libblkid = dependency('blkid', required : want_blkid == 'true')
742 conf.set('HAVE_BLKID', libblkid.found())
747 want_kmod = get_option('kmod')
748 if want_kmod != 'false'
749 libkmod = dependency('libkmod',
751 required : want_kmod == 'true')
752 conf.set('HAVE_KMOD', libkmod.found())
757 want_pam = get_option('pam')
758 if want_pam != 'false'
759 libpam = cc.find_library('pam', required : want_pam == 'true')
760 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
761 if libpam.found() and libpam_misc.found()
762 conf.set('HAVE_PAM', true)
763 m4_defines += ['-DHAVE_PAM']
770 want_microhttpd = get_option('microhttpd')
771 if want_microhttpd != 'false'
772 libmicrohttpd = dependency('libmicrohttpd',
773 version : '>= 0.9.33',
774 required : want_microhttpd == 'true')
775 if libmicrohttpd.found()
776 conf.set('HAVE_MICROHTTPD', true)
777 m4_defines += ['-DHAVE_MICROHTTPD']
783 want_libcryptsetup = get_option('libcryptsetup')
784 if want_libcryptsetup != 'false'
785 libcryptsetup = dependency('libcryptsetup',
786 version : '>= 1.6.0',
787 required : want_libcryptsetup == 'true')
788 conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found())
793 want_libcurl = get_option('libcurl')
794 if want_libcurl != 'false'
795 libcurl = dependency('libcurl',
796 version : '>= 7.32.0',
797 required : want_libcurl == 'true')
799 conf.set('HAVE_LIBCURL', true)
800 m4_defines += ['-DHAVE_LIBCURL']
806 want_libidn = get_option('libidn')
807 want_libidn2 = get_option('libidn2')
808 if want_libidn == 'true' and want_libidn2 == 'true'
809 error('libidn and libidn2 cannot be requested simultaneously')
812 if want_libidn != 'false' and want_libidn2 != 'true'
813 libidn = dependency('libidn',
814 required : want_libidn == 'true')
816 conf.set('HAVE_LIBIDN', true)
817 m4_defines += ['-DHAVE_LIBIDN']
822 if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false'
823 # libidn is used for both libidn and libidn2 objects
824 libidn = dependency('libidn2',
825 required : want_libidn2 == 'true')
827 conf.set('HAVE_LIBIDN2', true)
828 m4_defines += ['-DHAVE_LIBIDN2']
832 want_libiptc = get_option('libiptc')
833 if want_libiptc != 'false'
834 libiptc = dependency('libiptc',
835 required : want_libiptc == 'true')
837 conf.set('HAVE_LIBIPTC', true)
838 m4_defines += ['-DHAVE_LIBIPTC']
844 want_qrencode = get_option('qrencode')
845 if want_qrencode != 'false'
846 libqrencode = dependency('libqrencode',
847 required : want_qrencode == 'true')
848 conf.set('HAVE_QRENCODE', libqrencode.found())
853 want_gcrypt = get_option('gcrypt')
854 if want_gcrypt != 'false'
855 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
856 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
858 have_deps = libgcrypt.found() and libgpg_error.found()
859 conf.set('HAVE_GCRYPT', have_deps)
861 # link to neither of the libs if one is not found
870 want_gnutls = get_option('gnutls')
871 if want_gnutls != 'false'
872 libgnutls = dependency('gnutls',
873 version : '>= 3.1.4',
874 required : want_gnutls == 'true')
875 conf.set('HAVE_GNUTLS', libgnutls.found())
880 want_elfutils = get_option('elfutils')
881 if want_elfutils != 'false'
882 libdw = dependency('libdw',
883 required : want_elfutils == 'true')
884 conf.set('HAVE_ELFUTILS', libdw.found())
889 want_zlib = get_option('zlib')
890 if want_zlib != 'false'
891 libz = dependency('zlib',
892 required : want_zlib == 'true')
893 conf.set('HAVE_ZLIB', libz.found())
898 want_bzip2 = get_option('bzip2')
899 if want_bzip2 != 'false'
900 libbzip2 = cc.find_library('bz2',
901 required : want_bzip2 == 'true')
902 conf.set('HAVE_BZIP2', libbzip2.found())
907 want_xz = get_option('xz')
908 if want_xz != 'false'
909 libxz = dependency('liblzma',
910 required : want_xz == 'true')
911 conf.set('HAVE_XZ', libxz.found())
916 want_lz4 = get_option('lz4')
917 if want_lz4 != 'false'
918 liblz4 = dependency('liblz4',
919 required : want_lz4 == 'true')
920 conf.set('HAVE_LZ4', liblz4.found())
925 want_xkbcommon = get_option('xkbcommon')
926 if want_xkbcommon != 'false'
927 libxkbcommon = dependency('xkbcommon',
928 version : '>= 0.3.0',
929 required : want_xkbcommon == 'true')
930 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
935 want_glib = get_option('glib')
936 if want_glib != 'false'
937 libglib = dependency('glib-2.0',
938 version : '>= 2.22.0',
939 required : want_glib == 'true')
940 libgobject = dependency('gobject-2.0',
941 version : '>= 2.22.0',
942 required : want_glib == 'true')
943 libgio = dependency('gio-2.0',
944 required : want_glib == 'true')
945 have = libglib.found() and libgobject.found() and libgio.found()
946 conf.set('HAVE_GLIB', have)
953 want_dbus = get_option('dbus')
954 if want_dbus != 'false'
955 libdbus = dependency('dbus-1',
956 version : '>= 1.3.2',
957 required : want_dbus == 'true')
958 conf.set('HAVE_DBUS', libdbus.found())
963 default_dnssec = get_option('default-dnssec')
964 if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false)
965 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
966 default_dnssec = 'no'
968 conf.set('DEFAULT_DNSSEC_MODE',
969 'DNSSEC_' + default_dnssec.underscorify().to_upper())
970 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
972 want_importd = get_option('importd')
973 if want_importd != 'false'
974 have_deps = (conf.get('HAVE_LIBCURL', false) and
975 conf.get('HAVE_ZLIB', false) and
976 conf.get('HAVE_BZIP2', false) and
977 conf.get('HAVE_XZ', false) and
978 conf.get('HAVE_GCRYPT', false))
979 conf.set('ENABLE_IMPORTD', have_deps)
980 if want_importd == 'true' and not have_deps
981 error('importd support was requested, but dependencies are not available')
985 want_remote = get_option('remote')
986 if want_remote != 'false'
987 have_deps = [conf.get('HAVE_MICROHTTPD', false),
988 conf.get('HAVE_LIBCURL', false)]
989 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
990 # it's possible to build one without the other. Complain only if
991 # support was explictly requested. The auxiliary files like sysusers
992 # config should be installed when any of the programs are built.
993 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
994 error('remote support was requested, but dependencies are not available')
996 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
999 foreach pair : [['utmp', 'HAVE_UTMP'],
1000 ['hibernate', 'ENABLE_HIBERNATE'],
1001 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
1002 ['binfmt', 'ENABLE_BINFMT'],
1003 ['coredump', 'ENABLE_COREDUMP'],
1004 ['resolve', 'ENABLE_RESOLVED'],
1005 ['logind', 'ENABLE_LOGIND'],
1006 ['hostnamed', 'ENABLE_HOSTNAMED'],
1007 ['localed', 'ENABLE_LOCALED'],
1008 ['machined', 'ENABLE_MACHINED'],
1009 ['networkd', 'ENABLE_NETWORKD'],
1010 ['timedated', 'ENABLE_TIMEDATED'],
1011 ['timesyncd', 'ENABLE_TIMESYNCD'],
1012 ['myhostname', 'HAVE_MYHOSTNAME'],
1013 ['firstboot', 'ENABLE_FIRSTBOOT'],
1014 ['randomseed', 'ENABLE_RANDOMSEED'],
1015 ['backlight', 'ENABLE_BACKLIGHT'],
1016 ['vconsole', 'ENABLE_VCONSOLE'],
1017 ['quotacheck', 'ENABLE_QUOTACHECK'],
1018 ['sysusers', 'ENABLE_SYSUSERS'],
1019 ['tmpfiles', 'ENABLE_TMPFILES'],
1020 ['hwdb', 'ENABLE_HWDB'],
1021 ['rfkill', 'ENABLE_RFKILL'],
1022 ['ldconfig', 'ENABLE_LDCONFIG'],
1023 ['efi', 'ENABLE_EFI'],
1024 ['tpm', 'ENABLE_TPM'],
1025 ['ima', 'HAVE_IMA'],
1026 ['smack', 'HAVE_SMACK'],
1027 ['gshadow', 'ENABLE_GSHADOW'],
1028 ['idn', 'ENABLE_IDN'],
1029 ['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
1032 if get_option(pair[0])
1033 conf.set(pair[1], true)
1034 m4_defines += ['-D' + pair[1]]
1038 want_tests = get_option('tests')
1039 install_tests = get_option('install-tests')
1042 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1044 #####################################################################
1046 if get_option('efi')
1047 efi_arch = host_machine.cpu_family()
1049 if efi_arch == 'x86'
1050 EFI_MACHINE_TYPE_NAME = 'ia32'
1051 gnu_efi_arch = 'ia32'
1052 elif efi_arch == 'x86_64'
1053 EFI_MACHINE_TYPE_NAME = 'x64'
1054 gnu_efi_arch = 'x86_64'
1055 elif efi_arch == 'arm'
1056 EFI_MACHINE_TYPE_NAME = 'arm'
1057 gnu_efi_arch = 'arm'
1058 elif efi_arch == 'aarch64'
1059 EFI_MACHINE_TYPE_NAME = 'aa64'
1060 gnu_efi_arch = 'aarch64'
1062 EFI_MACHINE_TYPE_NAME = ''
1066 conf.set('ENABLE_EFI', true)
1067 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1069 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1072 #####################################################################
1074 config_h = configure_file(
1075 output : 'config.h',
1076 configuration : conf)
1078 includes = include_directories('src/basic',
1088 'src/libsystemd/sd-bus',
1089 'src/libsystemd/sd-device',
1090 'src/libsystemd/sd-hwdb',
1091 'src/libsystemd/sd-id128',
1092 'src/libsystemd/sd-netlink',
1093 'src/libsystemd/sd-network',
1094 'src/libsystemd-network',
1098 add_project_arguments('-include', 'config.h', language : 'c')
1100 gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1101 'src/shared/gcrypt-util.c')
1105 subdir('src/systemd')
1107 subdir('src/libsystemd')
1108 subdir('src/libsystemd-network')
1109 subdir('src/journal')
1112 libjournal_core = static_library(
1114 libjournal_core_sources,
1116 include_directories : includes,
1119 libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1120 libsystemd = shared_library(
1122 libsystemd_internal_sources,
1123 journal_internal_sources,
1125 include_directories : includes,
1126 link_args : ['-shared',
1127 '-Wl,--version-script=' + libsystemd_sym_path],
1128 link_with : [libbasic],
1129 dependencies : [threads,
1134 link_depends : libsystemd_sym,
1136 install_dir : rootlibdir)
1138 ############################################################
1140 # binaries that have --help and are intended for use by humans,
1141 # usually, but not always, installed in /bin.
1142 public_programs = []
1144 subdir('src/libudev')
1145 subdir('src/shared')
1148 subdir('src/network')
1150 subdir('src/analyze')
1151 subdir('src/journal-remote')
1152 subdir('src/coredump')
1153 subdir('src/hostname')
1154 subdir('src/import')
1155 subdir('src/kernel-install')
1156 subdir('src/locale')
1157 subdir('src/machine')
1158 subdir('src/nspawn')
1159 subdir('src/resolve')
1160 subdir('src/timedate')
1161 subdir('src/timesync')
1162 subdir('src/vconsole')
1163 subdir('src/sulogin-shell')
1164 subdir('src/boot/efi')
1169 ############################################################
1171 # only static linking apart from libdl, to make sure that the
1172 # module is linked to all libraries that it uses.
1173 test_dlopen = executable(
1176 include_directories : includes,
1177 link_with : [libbasic],
1178 dependencies : [libdl])
1180 foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
1181 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1182 ['mymachines', 'ENABLE_MACHINED'],
1183 ['resolve', 'ENABLE_RESOLVED']]
1185 condition = tuple[1] == '' or conf.get(tuple[1], false)
1189 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1190 version_script_arg = join_paths(meson.current_source_dir(), sym)
1192 nss = shared_library(
1194 'src/nss-@0@/nss-@0@.c'.format(module),
1196 include_directories : includes,
1197 link_args : ['-shared',
1198 '-Wl,--version-script=' + version_script_arg,
1200 link_with : [libsystemd_internal,
1202 dependencies : [threads,
1206 install_dir : rootlibdir)
1208 # We cannot use shared_module because it does not support version suffix.
1209 # Unfortunately shared_library insists on creating the symlink…
1210 meson.add_install_script('sh', '-c',
1211 'rm $DESTDIR@0@/libnss_@1@.so'
1212 .format(rootlibdir, module))
1214 test('dlopen-nss_' + module,
1216 args : [nss.full_path()]) # path to dlopen must include a slash
1220 ############################################################
1222 executable('systemd',
1224 include_directories : includes,
1225 link_with : [libcore,
1227 dependencies : [threads,
1233 install_rpath : rootlibexecdir,
1235 install_dir : rootlibexecdir)
1237 exe = executable('systemd-analyze',
1238 systemd_analyze_sources,
1239 include_directories : includes,
1240 link_with : [libcore,
1242 dependencies : [threads,
1248 install_rpath : rootlibexecdir,
1250 public_programs += [exe]
1252 executable('systemd-journald',
1253 systemd_journald_sources,
1254 include_directories : includes,
1255 link_with : [libjournal_core,
1257 dependencies : [threads,
1261 install_rpath : rootlibexecdir,
1263 install_dir : rootlibexecdir)
1265 exe = executable('systemd-cat',
1266 systemd_cat_sources,
1267 include_directories : includes,
1268 link_with : [libjournal_core,
1270 dependencies : [threads],
1271 install_rpath : rootlibexecdir,
1273 public_programs += [exe]
1275 exe = executable('journalctl',
1277 include_directories : includes,
1278 link_with : [libshared],
1279 dependencies : [threads,
1283 install_rpath : rootlibexecdir,
1285 install_dir : rootbindir)
1286 public_programs += [exe]
1288 executable('systemd-getty-generator',
1289 'src/getty-generator/getty-generator.c',
1290 include_directories : includes,
1291 link_with : [libshared],
1292 install_rpath : rootlibexecdir,
1294 install_dir : systemgeneratordir)
1296 executable('systemd-debug-generator',
1297 'src/debug-generator/debug-generator.c',
1298 include_directories : includes,
1299 link_with : [libshared],
1300 install_rpath : rootlibexecdir,
1302 install_dir : systemgeneratordir)
1304 executable('systemd-fstab-generator',
1305 'src/fstab-generator/fstab-generator.c',
1306 'src/core/mount-setup.c',
1307 include_directories : includes,
1308 link_with : [libshared],
1309 install_rpath : rootlibexecdir,
1311 install_dir : systemgeneratordir)
1313 if conf.get('ENABLE_ENVIRONMENT_D', false)
1314 executable('30-systemd-environment-d-generator',
1315 'src/environment-d-generator/environment-d-generator.c',
1316 include_directories : includes,
1317 link_with : [libshared],
1318 install_rpath : rootlibexecdir,
1320 install_dir : userenvgeneratordir)
1322 meson.add_install_script(meson_make_symlink,
1323 join_paths(sysconfdir, 'environment'),
1324 join_paths(environmentdir, '99-environment.conf'))
1327 if conf.get('ENABLE_HIBERNATE', false)
1328 executable('systemd-hibernate-resume-generator',
1329 'src/hibernate-resume/hibernate-resume-generator.c',
1330 include_directories : includes,
1331 link_with : [libshared],
1332 install_rpath : rootlibexecdir,
1334 install_dir : systemgeneratordir)
1336 executable('systemd-hibernate-resume',
1337 'src/hibernate-resume/hibernate-resume.c',
1338 include_directories : includes,
1339 link_with : [libshared],
1340 install_rpath : rootlibexecdir,
1342 install_dir : rootlibexecdir)
1345 if conf.get('HAVE_BLKID', false)
1346 executable('systemd-gpt-auto-generator',
1347 'src/gpt-auto-generator/gpt-auto-generator.c',
1348 'src/basic/blkid-util.h',
1349 include_directories : includes,
1350 link_with : [libshared],
1351 dependencies : libblkid,
1352 install_rpath : rootlibexecdir,
1354 install_dir : systemgeneratordir)
1356 exe = executable('systemd-dissect',
1357 'src/dissect/dissect.c',
1358 include_directories : includes,
1359 link_with : [libshared],
1360 install_rpath : rootlibexecdir,
1362 install_dir : rootlibexecdir)
1363 public_programs += [exe]
1366 if conf.get('ENABLE_RESOLVED', false)
1367 executable('systemd-resolved',
1368 systemd_resolved_sources,
1369 gcrypt_util_sources,
1370 include_directories : includes,
1371 link_with : [libshared],
1372 dependencies : [threads,
1377 install_rpath : rootlibexecdir,
1379 install_dir : rootlibexecdir)
1381 exe = executable('systemd-resolve',
1382 systemd_resolve_sources,
1383 gcrypt_util_sources,
1384 include_directories : includes,
1385 link_with : [libshared],
1386 dependencies : [threads,
1391 install_rpath : rootlibexecdir,
1393 public_programs += [exe]
1396 if conf.get('ENABLE_LOGIND', false)
1397 executable('systemd-logind',
1398 systemd_logind_sources,
1399 include_directories : includes,
1400 link_with : [liblogind_core,
1402 dependencies : [threads,
1404 install_rpath : rootlibexecdir,
1406 install_dir : rootlibexecdir)
1408 exe = executable('loginctl',
1410 include_directories : includes,
1411 link_with : [libshared],
1412 dependencies : [threads,
1415 install_rpath : rootlibexecdir,
1417 install_dir : rootbindir)
1418 public_programs += [exe]
1420 exe = executable('systemd-inhibit',
1421 'src/login/inhibit.c',
1422 include_directories : includes,
1423 link_with : [libshared],
1424 install_rpath : rootlibexecdir,
1426 install_dir : rootbindir)
1427 public_programs += [exe]
1429 if conf.get('HAVE_PAM', false)
1430 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1431 pam_systemd = shared_library(
1435 include_directories : includes,
1436 link_args : ['-shared',
1437 '-Wl,--version-script=' + version_script_arg],
1438 link_with : [libsystemd_internal,
1440 dependencies : [threads,
1443 link_depends : pam_systemd_sym,
1445 install_dir : pamlibdir)
1447 test('dlopen-pam_systemd',
1449 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1453 if conf.get('HAVE_PAM', false)
1454 executable('systemd-user-sessions',
1455 'src/user-sessions/user-sessions.c',
1456 include_directories : includes,
1457 link_with : [libshared],
1458 install_rpath : rootlibexecdir,
1460 install_dir : rootlibexecdir)
1463 if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
1464 exe = executable('bootctl',
1465 'src/boot/bootctl.c',
1466 include_directories : includes,
1467 link_with : [libshared],
1468 dependencies : [libblkid],
1469 install_rpath : rootlibexecdir,
1471 public_programs += [exe]
1474 exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1475 include_directories : includes,
1476 link_with : [libshared],
1477 dependencies : [threads],
1478 install_rpath : rootlibexecdir,
1480 public_programs += [exe]
1482 exe = executable('systemctl', 'src/systemctl/systemctl.c',
1483 include_directories : includes,
1484 link_with : [libshared],
1485 dependencies : [threads,
1490 install_rpath : rootlibexecdir,
1492 install_dir : rootbindir)
1493 public_programs += [exe]
1495 if conf.get('ENABLE_BACKLIGHT', false)
1496 executable('systemd-backlight',
1497 'src/backlight/backlight.c',
1498 include_directories : includes,
1499 link_with : [libshared],
1500 install_rpath : rootlibexecdir,
1502 install_dir : rootlibexecdir)
1505 if conf.get('ENABLE_RFKILL', false)
1506 executable('systemd-rfkill',
1507 'src/rfkill/rfkill.c',
1508 include_directories : includes,
1509 link_with : [libshared],
1510 install_rpath : rootlibexecdir,
1512 install_dir : rootlibexecdir)
1515 executable('systemd-system-update-generator',
1516 'src/system-update-generator/system-update-generator.c',
1517 include_directories : includes,
1518 link_with : [libshared],
1519 install_rpath : rootlibexecdir,
1521 install_dir : systemgeneratordir)
1523 if conf.get('HAVE_LIBCRYPTSETUP', false)
1524 executable('systemd-cryptsetup',
1525 'src/cryptsetup/cryptsetup.c',
1526 include_directories : includes,
1527 link_with : [libshared],
1528 dependencies : [libcryptsetup],
1529 install_rpath : rootlibexecdir,
1531 install_dir : rootlibexecdir)
1533 executable('systemd-cryptsetup-generator',
1534 'src/cryptsetup/cryptsetup-generator.c',
1535 include_directories : includes,
1536 link_with : [libshared],
1537 dependencies : [libcryptsetup],
1538 install_rpath : rootlibexecdir,
1540 install_dir : systemgeneratordir)
1542 executable('systemd-veritysetup',
1543 'src/veritysetup/veritysetup.c',
1544 include_directories : includes,
1545 link_with : [libshared],
1546 dependencies : [libcryptsetup],
1547 install_rpath : rootlibexecdir,
1549 install_dir : rootlibexecdir)
1551 executable('systemd-veritysetup-generator',
1552 'src/veritysetup/veritysetup-generator.c',
1553 include_directories : includes,
1554 link_with : [libshared],
1555 dependencies : [libcryptsetup],
1556 install_rpath : rootlibexecdir,
1558 install_dir : systemgeneratordir)
1561 if conf.get('HAVE_SYSV_COMPAT', false)
1562 executable('systemd-sysv-generator',
1563 'src/sysv-generator/sysv-generator.c',
1564 include_directories : includes,
1565 link_with : [libshared],
1566 install_rpath : rootlibexecdir,
1568 install_dir : systemgeneratordir)
1570 executable('systemd-rc-local-generator',
1571 'src/rc-local-generator/rc-local-generator.c',
1572 include_directories : includes,
1573 link_with : [libshared],
1574 install_rpath : rootlibexecdir,
1576 install_dir : systemgeneratordir)
1579 if conf.get('ENABLE_HOSTNAMED', false)
1580 executable('systemd-hostnamed',
1581 'src/hostname/hostnamed.c',
1582 include_directories : includes,
1583 link_with : [libshared],
1584 install_rpath : rootlibexecdir,
1586 install_dir : rootlibexecdir)
1588 exe = executable('hostnamectl',
1589 'src/hostname/hostnamectl.c',
1590 include_directories : includes,
1591 link_with : [libshared],
1592 install_rpath : rootlibexecdir,
1594 public_programs += [exe]
1597 if conf.get('ENABLE_LOCALED', false)
1598 if conf.get('HAVE_XKBCOMMON', false)
1599 # logind will load libxkbcommon.so dynamically on its own
1605 executable('systemd-localed',
1606 systemd_localed_sources,
1607 include_directories : includes,
1608 link_with : [libshared],
1609 dependencies : deps,
1610 install_rpath : rootlibexecdir,
1612 install_dir : rootlibexecdir)
1614 exe = executable('localectl',
1616 include_directories : includes,
1617 link_with : [libshared],
1618 install_rpath : rootlibexecdir,
1620 public_programs += [exe]
1623 if conf.get('ENABLE_TIMEDATED', false)
1624 executable('systemd-timedated',
1625 'src/timedate/timedated.c',
1626 include_directories : includes,
1627 link_with : [libshared],
1628 install_rpath : rootlibexecdir,
1630 install_dir : rootlibexecdir)
1632 exe = executable('timedatectl',
1633 'src/timedate/timedatectl.c',
1634 include_directories : includes,
1635 install_rpath : rootlibexecdir,
1636 link_with : [libshared],
1638 public_programs += [exe]
1641 if conf.get('ENABLE_TIMESYNCD', false)
1642 executable('systemd-timesyncd',
1643 systemd_timesyncd_sources,
1644 include_directories : includes,
1645 link_with : [libshared],
1646 dependencies : [threads,
1648 install_rpath : rootlibexecdir,
1650 install_dir : rootlibexecdir)
1653 if conf.get('ENABLE_MACHINED', false)
1654 executable('systemd-machined',
1655 systemd_machined_sources,
1656 include_directories : includes,
1657 link_with : [libmachine_core,
1659 install_rpath : rootlibexecdir,
1661 install_dir : rootlibexecdir)
1663 exe = executable('machinectl',
1664 'src/machine/machinectl.c',
1665 include_directories : includes,
1666 link_with : [libshared],
1667 dependencies : [threads,
1670 install_rpath : rootlibexecdir,
1672 install_dir : rootbindir)
1673 public_programs += [exe]
1676 if conf.get('ENABLE_IMPORTD', false)
1677 executable('systemd-importd',
1678 systemd_importd_sources,
1679 include_directories : includes,
1680 link_with : [libshared],
1681 dependencies : [threads],
1682 install_rpath : rootlibexecdir,
1684 install_dir : rootlibexecdir)
1686 systemd_pull = executable('systemd-pull',
1687 systemd_pull_sources,
1688 include_directories : includes,
1689 link_with : [libshared],
1690 dependencies : [libcurl,
1695 install_rpath : rootlibexecdir,
1697 install_dir : rootlibexecdir)
1699 systemd_import = executable('systemd-import',
1700 systemd_import_sources,
1701 include_directories : includes,
1702 link_with : [libshared],
1703 dependencies : [libcurl,
1707 install_rpath : rootlibexecdir,
1709 install_dir : rootlibexecdir)
1711 systemd_export = executable('systemd-export',
1712 systemd_export_sources,
1713 include_directories : includes,
1714 link_with : [libshared],
1715 dependencies : [libcurl,
1719 install_rpath : rootlibexecdir,
1721 install_dir : rootlibexecdir)
1722 public_programs += [systemd_pull, systemd_import, systemd_export]
1725 if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
1726 exe = executable('systemd-journal-upload',
1727 systemd_journal_upload_sources,
1728 include_directories : includes,
1729 link_with : [libshared],
1730 dependencies : [threads,
1735 install_rpath : rootlibexecdir,
1737 install_dir : rootlibexecdir)
1738 public_programs += [exe]
1741 if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
1742 s_j_remote = executable('systemd-journal-remote',
1743 systemd_journal_remote_sources,
1744 include_directories : includes,
1745 link_with : [libshared],
1746 dependencies : [threads,
1751 install_rpath : rootlibexecdir,
1753 install_dir : rootlibexecdir)
1755 s_j_gatewayd = executable('systemd-journal-gatewayd',
1756 systemd_journal_gatewayd_sources,
1757 include_directories : includes,
1758 link_with : [libshared],
1759 dependencies : [threads,
1764 install_rpath : rootlibexecdir,
1766 install_dir : rootlibexecdir)
1767 public_programs += [s_j_remote, s_j_gatewayd]
1770 if conf.get('ENABLE_COREDUMP', false)
1771 executable('systemd-coredump',
1772 systemd_coredump_sources,
1773 include_directories : includes,
1774 link_with : [libshared],
1775 dependencies : [threads,
1780 install_rpath : rootlibexecdir,
1782 install_dir : rootlibexecdir)
1784 exe = executable('coredumpctl',
1785 coredumpctl_sources,
1786 include_directories : includes,
1787 link_with : [libshared],
1788 dependencies : [threads,
1791 install_rpath : rootlibexecdir,
1793 public_programs += [exe]
1796 if conf.get('ENABLE_BINFMT', false)
1797 exe = executable('systemd-binfmt',
1798 'src/binfmt/binfmt.c',
1799 include_directories : includes,
1800 link_with : [libshared],
1801 install_rpath : rootlibexecdir,
1803 install_dir : rootlibexecdir)
1804 public_programs += [exe]
1806 meson.add_install_script('sh', '-c',
1807 mkdir_p.format(binfmtdir))
1808 meson.add_install_script('sh', '-c',
1809 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1812 if conf.get('ENABLE_VCONSOLE', false)
1813 executable('systemd-vconsole-setup',
1814 'src/vconsole/vconsole-setup.c',
1815 include_directories : includes,
1816 link_with : [libshared],
1817 install_rpath : rootlibexecdir,
1819 install_dir : rootlibexecdir)
1822 if conf.get('ENABLE_RANDOMSEED', false)
1823 executable('systemd-random-seed',
1824 'src/random-seed/random-seed.c',
1825 include_directories : includes,
1826 link_with : [libshared],
1827 install_rpath : rootlibexecdir,
1829 install_dir : rootlibexecdir)
1832 if conf.get('ENABLE_FIRSTBOOT', false)
1833 executable('systemd-firstboot',
1834 'src/firstboot/firstboot.c',
1835 include_directories : includes,
1836 link_with : [libshared],
1837 dependencies : [libcrypt],
1838 install_rpath : rootlibexecdir,
1840 install_dir : rootbindir)
1843 executable('systemd-remount-fs',
1844 'src/remount-fs/remount-fs.c',
1845 'src/core/mount-setup.c',
1846 'src/core/mount-setup.h',
1847 include_directories : includes,
1848 link_with : [libshared],
1849 install_rpath : rootlibexecdir,
1851 install_dir : rootlibexecdir)
1853 executable('systemd-machine-id-setup',
1854 'src/machine-id-setup/machine-id-setup-main.c',
1855 'src/core/machine-id-setup.c',
1856 'src/core/machine-id-setup.h',
1857 include_directories : includes,
1858 link_with : [libshared],
1859 install_rpath : rootlibexecdir,
1861 install_dir : rootbindir)
1863 executable('systemd-fsck',
1865 include_directories : includes,
1866 link_with : [libshared],
1867 install_rpath : rootlibexecdir,
1869 install_dir : rootlibexecdir)
1871 executable('systemd-sleep',
1872 'src/sleep/sleep.c',
1873 include_directories : includes,
1874 link_with : [libshared],
1875 install_rpath : rootlibexecdir,
1877 install_dir : rootlibexecdir)
1879 exe = executable('systemd-sysctl',
1880 'src/sysctl/sysctl.c',
1881 include_directories : includes,
1882 link_with : [libshared],
1883 install_rpath : rootlibexecdir,
1885 install_dir : rootlibexecdir)
1886 public_programs += [exe]
1888 executable('systemd-ac-power',
1889 'src/ac-power/ac-power.c',
1890 include_directories : includes,
1891 link_with : [libshared],
1892 install_rpath : rootlibexecdir,
1894 install_dir : rootlibexecdir)
1896 exe = executable('systemd-detect-virt',
1897 'src/detect-virt/detect-virt.c',
1898 include_directories : includes,
1899 link_with : [libshared],
1900 install_rpath : rootlibexecdir,
1902 public_programs += [exe]
1904 exe = executable('systemd-delta',
1905 'src/delta/delta.c',
1906 include_directories : includes,
1907 link_with : [libshared],
1908 install_rpath : rootlibexecdir,
1910 public_programs += [exe]
1912 exe = executable('systemd-escape',
1913 'src/escape/escape.c',
1914 include_directories : includes,
1915 link_with : [libshared],
1916 install_rpath : rootlibexecdir,
1918 install_dir : rootbindir)
1919 public_programs += [exe]
1921 exe = executable('systemd-notify',
1922 'src/notify/notify.c',
1923 include_directories : includes,
1924 link_with : [libshared],
1925 install_rpath : rootlibexecdir,
1927 install_dir : rootbindir)
1928 public_programs += [exe]
1930 executable('systemd-volatile-root',
1931 'src/volatile-root/volatile-root.c',
1932 include_directories : includes,
1933 link_with : [libshared],
1934 install_rpath : rootlibexecdir,
1936 install_dir : rootlibexecdir)
1938 executable('systemd-cgroups-agent',
1939 'src/cgroups-agent/cgroups-agent.c',
1940 include_directories : includes,
1941 link_with : [libshared],
1942 install_rpath : rootlibexecdir,
1944 install_dir : rootlibexecdir)
1946 exe = executable('systemd-path',
1948 include_directories : includes,
1949 link_with : [libshared],
1950 install_rpath : rootlibexecdir,
1952 public_programs += [exe]
1954 exe = executable('systemd-ask-password',
1955 'src/ask-password/ask-password.c',
1956 include_directories : includes,
1957 link_with : [libshared],
1958 install_rpath : rootlibexecdir,
1960 install_dir : rootbindir)
1961 public_programs += [exe]
1963 executable('systemd-reply-password',
1964 'src/reply-password/reply-password.c',
1965 include_directories : includes,
1966 link_with : [libshared],
1967 install_rpath : rootlibexecdir,
1969 install_dir : rootlibexecdir)
1971 exe = executable('systemd-tty-ask-password-agent',
1972 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1973 include_directories : includes,
1974 link_with : [libshared],
1975 install_rpath : rootlibexecdir,
1977 install_dir : rootbindir)
1978 public_programs += [exe]
1980 exe = executable('systemd-cgls',
1982 include_directories : includes,
1983 link_with : [libshared],
1984 install_rpath : rootlibexecdir,
1986 public_programs += [exe]
1988 exe = executable('systemd-cgtop',
1989 'src/cgtop/cgtop.c',
1990 include_directories : includes,
1991 link_with : [libshared],
1992 install_rpath : rootlibexecdir,
1994 public_programs += [exe]
1996 executable('systemd-initctl',
1997 'src/initctl/initctl.c',
1998 include_directories : includes,
1999 link_with : [libshared],
2000 install_rpath : rootlibexecdir,
2002 install_dir : rootlibexecdir)
2004 exe = executable('systemd-mount',
2005 'src/mount/mount-tool.c',
2006 include_directories : includes,
2007 link_with : [libshared],
2008 install_rpath : rootlibexecdir,
2010 public_programs += [exe]
2012 meson.add_install_script(meson_make_symlink,
2013 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2015 exe = executable('systemd-run',
2017 include_directories : includes,
2018 link_with : [libshared],
2019 install_rpath : rootlibexecdir,
2021 public_programs += [exe]
2023 exe = executable('systemd-stdio-bridge',
2024 'src/stdio-bridge/stdio-bridge.c',
2025 include_directories : includes,
2026 link_with : [libshared],
2027 install_rpath : rootlibexecdir,
2029 public_programs += [exe]
2031 exe = executable('busctl',
2032 'src/busctl/busctl.c',
2033 'src/busctl/busctl-introspect.c',
2034 'src/busctl/busctl-introspect.h',
2035 include_directories : includes,
2036 link_with : [libshared],
2037 install_rpath : rootlibexecdir,
2039 public_programs += [exe]
2041 if conf.get('ENABLE_SYSUSERS', false)
2042 exe = executable('systemd-sysusers',
2043 'src/sysusers/sysusers.c',
2044 include_directories : includes,
2045 link_with : [libshared],
2046 install_rpath : rootlibexecdir,
2048 install_dir : rootbindir)
2049 public_programs += [exe]
2052 if conf.get('ENABLE_TMPFILES', false)
2053 exe = executable('systemd-tmpfiles',
2054 'src/tmpfiles/tmpfiles.c',
2055 include_directories : includes,
2056 link_with : [libshared],
2057 dependencies : [libacl],
2058 install_rpath : rootlibexecdir,
2060 install_dir : rootbindir)
2061 public_programs += [exe]
2064 if conf.get('ENABLE_HWDB', false)
2065 exe = executable('systemd-hwdb',
2067 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2068 include_directories : includes,
2069 link_with : [libudev_internal],
2070 install_rpath : udev_rpath,
2072 install_dir : rootbindir)
2073 public_programs += [exe]
2076 if conf.get('ENABLE_QUOTACHECK', false)
2077 executable('systemd-quotacheck',
2078 'src/quotacheck/quotacheck.c',
2079 include_directories : includes,
2080 link_with : [libshared],
2081 install_rpath : rootlibexecdir,
2083 install_dir : rootlibexecdir)
2086 exe = executable('systemd-socket-proxyd',
2087 'src/socket-proxy/socket-proxyd.c',
2088 include_directories : includes,
2089 link_with : [libshared],
2090 dependencies : [threads],
2091 install_rpath : rootlibexecdir,
2093 install_dir : rootlibexecdir)
2094 public_programs += [exe]
2096 exe = executable('systemd-udevd',
2097 systemd_udevd_sources,
2098 include_directories : includes,
2099 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2100 link_with : [libudev_core,
2103 dependencies : [threads,
2108 install_rpath : udev_rpath,
2110 install_dir : rootlibexecdir)
2111 public_programs += [exe]
2113 exe = executable('udevadm',
2115 include_directories : includes,
2116 link_with : [libudev_core,
2119 dependencies : [threads,
2124 install_rpath : udev_rpath,
2126 install_dir : rootbindir)
2127 public_programs += [exe]
2129 executable('systemd-shutdown',
2130 systemd_shutdown_sources,
2131 include_directories : includes,
2132 link_with : [libshared],
2133 install_rpath : rootlibexecdir,
2135 install_dir : rootlibexecdir)
2137 executable('systemd-update-done',
2138 'src/update-done/update-done.c',
2139 include_directories : includes,
2140 link_with : [libshared],
2141 install_rpath : rootlibexecdir,
2143 install_dir : rootlibexecdir)
2145 executable('systemd-update-utmp',
2146 'src/update-utmp/update-utmp.c',
2147 include_directories : includes,
2148 link_with : [libshared],
2149 dependencies : [libaudit],
2150 install_rpath : rootlibexecdir,
2152 install_dir : rootlibexecdir)
2154 if conf.get('HAVE_KMOD', false)
2155 executable('systemd-modules-load',
2156 'src/modules-load/modules-load.c',
2157 include_directories : includes,
2158 link_with : [libshared],
2159 dependencies : [libkmod],
2160 install_rpath : rootlibexecdir,
2162 install_dir : rootlibexecdir)
2164 meson.add_install_script('sh', '-c',
2165 mkdir_p.format(modulesloaddir))
2166 meson.add_install_script('sh', '-c',
2167 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2170 exe = executable('systemd-nspawn',
2171 systemd_nspawn_sources,
2172 'src/core/mount-setup.c', # FIXME: use a variable?
2173 'src/core/mount-setup.h',
2174 'src/core/loopback-setup.c',
2175 'src/core/loopback-setup.h',
2176 include_directories : [includes, include_directories('src/nspawn')],
2177 link_with : [libshared],
2178 dependencies : [libacl,
2182 install_rpath : rootlibexecdir,
2184 public_programs += [exe]
2186 if conf.get('ENABLE_NETWORKD', false)
2187 executable('systemd-networkd',
2188 systemd_networkd_sources,
2189 include_directories : includes,
2190 link_with : [libnetworkd_core,
2194 dependencies : [threads],
2195 install_rpath : rootlibexecdir,
2197 install_dir : rootlibexecdir)
2199 executable('systemd-networkd-wait-online',
2200 systemd_networkd_wait_online_sources,
2201 include_directories : includes,
2202 link_with : [libnetworkd_core,
2204 install_rpath : rootlibexecdir,
2206 install_dir : rootlibexecdir)
2208 exe = executable('networkctl',
2210 include_directories : includes,
2211 link_with : [libsystemd_network,
2213 install_rpath : rootlibexecdir,
2215 install_dir : rootbindir)
2216 public_programs += [exe]
2218 ############################################################
2220 foreach tuple : tests
2222 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2223 dependencies = tuple[2]
2224 condition = tuple.length() >= 4 ? tuple[3] : ''
2225 type = tuple.length() >= 5 ? tuple[4] : ''
2226 defs = tuple.length() >= 6 ? tuple[5] : []
2227 incs = tuple.length() >= 7 ? tuple[6] : includes
2230 name = sources[0].split('/')[-1].split('.')[0]
2231 if type.startswith('timeout=')
2232 timeout = type.split('=')[1].to_int()
2236 if condition == '' or conf.get(condition, false)
2240 include_directories : incs,
2241 link_with : link_with,
2242 dependencies : dependencies,
2244 install_rpath : rootlibexecdir,
2245 install : install_tests,
2246 install_dir : join_paths(testsdir, type))
2249 message('@0@ is a manual test'.format(name))
2250 elif type == 'unsafe' and want_tests != 'unsafe'
2251 message('@0@ is an unsafe test'.format(name))
2258 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2262 test_libsystemd_sym = executable(
2263 'test-libsystemd-sym',
2264 test_libsystemd_sym_c,
2265 include_directories : includes,
2266 link_with : [libsystemd],
2267 install : install_tests,
2268 install_dir : testsdir)
2269 test('test-libsystemd-sym',
2270 test_libsystemd_sym)
2272 test_libudev_sym = executable(
2275 include_directories : includes,
2276 c_args : ['-Wno-deprecated-declarations'],
2277 link_with : [libudev],
2278 install : install_tests,
2279 install_dir : testsdir)
2280 test('test-libudev-sym',
2283 ############################################################
2285 make_directive_index_py = find_program('tools/make-directive-index.py')
2286 make_man_index_py = find_program('tools/make-man-index.py')
2287 xml_helper_py = find_program('tools/xml_helper.py')
2288 hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2292 subdir('sysusers.d')
2293 subdir('tmpfiles.d')
2298 subdir('shell-completion/bash')
2299 subdir('shell-completion/zsh')
2300 subdir('docs/sysvinit')
2301 subdir('docs/var-log')
2303 # FIXME: figure out if the warning is true:
2304 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2305 install_subdir('factory/etc',
2306 install_dir : factorydir)
2309 install_data('xorg/50-systemd-user.sh',
2310 install_dir : xinitrcdir)
2311 install_data('system-preset/90-systemd.preset',
2312 install_dir : systempresetdir)
2313 install_data('modprobe.d/systemd.conf',
2314 install_dir : modprobedir)
2315 install_data('README',
2322 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2323 install_dir : docdir)
2325 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2326 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2328 ############################################################
2330 meson_check_help = find_program('tools/meson-check-help.sh')
2332 foreach exec : public_programs
2333 name = exec.full_path().split('/')[-1]
2334 test('check-help-' + name,
2336 args : [exec.full_path()])
2339 ############################################################
2342 all_files = run_command(
2344 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2347 all_files = files(all_files.stdout().split())
2352 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2356 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2360 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2363 command : [meson_git_contrib_sh])
2367 git_head = run_command(
2369 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2370 'rev-parse', 'HEAD']).stdout().strip()
2371 git_head_short = run_command(
2373 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2374 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2378 command : ['git', 'archive',
2379 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2381 '--prefix', 'systemd-@0@/'.format(git_head),
2385 ############################################################
2388 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2390 'prefix: @0@'.format(prefixdir),
2391 'rootprefix: @0@'.format(rootprefixdir),
2392 'sysconf dir: @0@'.format(sysconfdir),
2393 'includedir: @0@'.format(includedir),
2394 'lib dir: @0@'.format(libdir),
2395 'rootlib dir: @0@'.format(rootlibdir),
2396 'SysV init scripts: @0@'.format(sysvinit_path),
2397 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2398 'PAM modules dir: @0@'.format(pamlibdir),
2399 'PAM configuration dir: @0@'.format(pamconfdir),
2400 'RPM macros dir: @0@'.format(rpmmacrosdir),
2401 'modprobe.d dir: @0@'.format(modprobedir),
2402 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2403 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2404 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2405 'bash completions dir: @0@'.format(bashcompletiondir),
2406 'zsh completions dir: @0@'.format(zshcompletiondir),
2407 'extra start script: @0@'.format(get_option('rc-local')),
2408 'extra stop script: @0@'.format(get_option('halt-local')),
2409 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2410 get_option('debug-tty')),
2411 'TTY GID: @0@'.format(tty_gid),
2412 'maximum system UID: @0@'.format(system_uid_max),
2413 'maximum system GID: @0@'.format(system_gid_max),
2414 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2415 'certificate root: @0@'.format(get_option('certificate-root')),
2416 'support URL: @0@'.format(support_url),
2417 'nobody user name: @0@'.format(get_option('nobody-user')),
2418 'nobody group name: @0@'.format(get_option('nobody-group')),
2419 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2420 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
2422 'default DNSSEC mode: @0@'.format(default_dnssec),
2423 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2424 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2426 alt_dns_servers = '\n '.join(dns_servers.split(' '))
2427 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2429 'default DNS servers: @0@'.format(alt_dns_servers),
2430 'default NTP servers: @0@'.format(alt_ntp_servers)]
2432 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2433 '@@0@'.format(time_epoch)).stdout().strip()
2435 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2438 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2439 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2440 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2442 if conf.get('ENABLE_EFI', false)
2444 'efi arch: @0@'.format(efi_arch)]
2448 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2449 'EFI CC @0@'.format(efi_cc),
2450 'EFI libdir: @0@'.format(efi_libdir),
2451 'EFI ldsdir: @0@'.format(efi_ldsdir),
2452 'EFI includedir: @0@'.format(efi_incdir)]
2505 ['legacy pkla', install_polkit_pkla],
2507 ['gnu-efi', have_gnu_efi],
2513 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
2516 ['man pages', want_man],
2517 ['html pages', want_html],
2518 ['man page indices', want_man and have_lxml],
2519 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
2524 ['adm group', get_option('adm-group')],
2525 ['wheel group', get_option('wheel-group')],
2528 ['debug mmap cache'],
2531 cond = tuple.get(1, '')
2533 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2534 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2535 cond = conf.get(ident1, false) or conf.get(ident2, false)
2540 missing += [tuple[0]]
2546 'enabled features: @0@'.format(', '.join(found)),
2548 'disabled features: @0@'.format(', '.join(missing)),
2550 message('\n '.join(status))