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>
377 #include <linux/fib_rules.h>
379 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
381 foreach decl : ['char16_t',
384 'struct ethtool_link_settings',
385 'struct fib_rule_uid_range',
388 # We get -1 if the size cannot be determined
389 have = cc.sizeof(decl, prefix : decl_headers) > 0
390 conf.set('HAVE_' + decl.underscorify().to_upper(), have)
393 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
394 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
395 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
396 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
397 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
398 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
399 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
400 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
401 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
402 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
403 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
404 # if_tunnel.h is buggy and cannot be included on its own
405 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
406 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
407 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
408 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
409 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
410 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
411 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
412 ['NDA_IFINDEX', 'linux/neighbour.h'],
413 ['IFA_FLAGS', 'linux/if_addr.h'],
414 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
415 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
417 prefix = decl.length() > 2 ? decl[2] : ''
418 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
419 conf.set10('HAVE_DECL_' + decl[0], have)
423 foreach ident : ['secure_getenv', '__secure_getenv']
424 if not skip and cc.has_function(ident)
425 conf.set('HAVE_' + ident.to_upper(), true)
431 ['memfd_create', '''#include <sys/memfd.h>'''],
432 ['gettid', '''#include <sys/types.h>'''],
433 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
434 ['name_to_handle_at', '''#define _GNU_SOURCE
435 #include <sys/types.h>
436 #include <sys/stat.h>
437 #include <fcntl.h>'''],
438 ['setns', '''#define _GNU_SOURCE
439 #include <sched.h>'''],
440 ['renameat2', '''#include <stdio.h>'''],
441 ['kcmp', '''#include <linux/kcmp.h>'''],
442 ['keyctl', '''#include <sys/types.h>
443 #include <keyutils.h>'''],
444 ['copy_file_range', '''#include <sys/syscall.h>
445 #include <unistd.h>'''],
446 ['explicit_bzero' , '''#include <string.h>'''],
449 have = cc.has_function(ident[0], prefix : ident[1])
450 conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
453 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
454 conf.set('USE_SYS_RANDOM_H', true)
455 conf.set10('HAVE_DECL_GETRANDOM', true)
457 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
458 conf.set10('HAVE_DECL_GETRANDOM', have)
461 #####################################################################
463 sed = find_program('sed')
464 grep = find_program('grep')
465 awk = find_program('awk')
466 m4 = find_program('m4')
467 stat = find_program('stat')
468 git = find_program('git', required : false)
470 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
471 mkdir_p = 'mkdir -p $DESTDIR/@0@'
472 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
473 splash_bmp = files('test/splash.bmp')
475 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
476 # /usr/sbin, /sbin, and fall back to the default from middle column.
477 progs = [['telinit', '/lib/sysvinit/telinit'],
478 ['quotaon', '/usr/sbin/quotaon' ],
479 ['quotacheck', '/usr/sbin/quotacheck' ],
480 ['kill', '/usr/bin/kill' ],
481 ['kmod', '/usr/bin/kmod' ],
482 ['kexec', '/usr/sbin/kexec' ],
483 ['sulogin', '/usr/sbin/sulogin' ],
484 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
485 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
486 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
487 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
490 path = get_option(prog[0] + '-path')
492 message('Using @1@ for @0@'.format(prog[0], path))
494 exe = find_program(prog[0],
495 '/usr/sbin/' + prog[0],
498 path = exe.found() ? exe.path() : prog[1]
500 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
501 conf.set_quoted(name, path)
502 substs.set(name, path)
505 if run_command('ln', '--relative', '--help').returncode() != 0
506 error('ln does not support --relative')
509 ############################################################
511 gperf = find_program('gperf')
513 gperf_test_format = '''
515 const char * in_word_set(const char *, @0@);
518 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
519 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
520 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
521 if cc.compiles(gperf_test)
522 gperf_len_type = 'size_t'
524 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
525 if cc.compiles(gperf_test)
526 gperf_len_type = 'unsigned'
528 error('unable to determine gperf len type')
531 message('gperf len type is @0@'.format(gperf_len_type))
532 conf.set('GPERF_LEN_TYPE', gperf_len_type,
533 description : 'The type of gperf "len" parameter')
535 ############################################################
537 if not cc.has_header('sys/capability.h')
538 error('POSIX caps headers not found')
540 foreach header : ['linux/btrfs.h',
542 'linux/vm_sockets.h',
543 'valgrind/memcheck.h',
544 'valgrind/valgrind.h',
547 conf.set('HAVE_' + header.underscorify().to_upper(),
548 cc.has_header(header))
551 ############################################################
553 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
554 conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
555 gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
557 default_hierarchy = get_option('default-hierarchy')
558 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
559 description : 'default cgroup hierarchy as string')
560 if default_hierarchy == 'legacy'
561 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
562 elif default_hierarchy == 'hybrid'
563 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
565 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
568 time_epoch = get_option('time-epoch')
571 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
573 time_epoch = time_epoch.to_int()
574 conf.set('TIME_EPOCH', time_epoch)
576 system_uid_max = get_option('system-uid-max')
577 if system_uid_max == ''
578 system_uid_max = run_command(
580 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
581 '/etc/login.defs').stdout()
583 system_uid_max = system_uid_max.to_int()
584 conf.set('SYSTEM_UID_MAX', system_uid_max)
585 substs.set('systemuidmax', system_uid_max)
586 message('maximum system UID is @0@'.format(system_uid_max))
588 conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
589 conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
591 system_gid_max = get_option('system-gid-max')
592 if system_gid_max == ''
593 system_gid_max = run_command(
595 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
596 '/etc/login.defs').stdout()
598 system_gid_max = system_gid_max.to_int()
599 conf.set('SYSTEM_GID_MAX', system_gid_max)
600 substs.set('systemgidmax', system_gid_max)
601 message('maximum system GID is @0@'.format(system_gid_max))
603 tty_gid = get_option('tty-gid')
604 conf.set('TTY_GID', tty_gid)
605 substs.set('TTY_GID', tty_gid)
607 if get_option('adm-group')
608 m4_defines += ['-DENABLE_ADM_GROUP']
611 if get_option('wheel-group')
612 m4_defines += ['-DENABLE_WHEEL_GROUP']
615 substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
617 kill_user_processes = get_option('default-kill-user-processes')
618 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
619 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
621 dns_servers = get_option('dns-servers')
622 conf.set_quoted('DNS_SERVERS', dns_servers)
623 substs.set('DNS_SERVERS', dns_servers)
625 ntp_servers = get_option('ntp-servers')
626 conf.set_quoted('NTP_SERVERS', ntp_servers)
627 substs.set('NTP_SERVERS', ntp_servers)
629 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
631 substs.set('SUSHELL', get_option('debug-shell'))
632 substs.set('DEBUGTTY', get_option('debug-tty'))
634 debug = get_option('debug')
636 foreach name : debug.split(',')
638 conf.set('ENABLE_DEBUG_HASHMAP', true)
639 elif name == 'mmap-cache'
640 conf.set('ENABLE_DEBUG_MMAP_CACHE', true)
642 message('unknown debug option "@0@", ignoring'.format(name))
647 #####################################################################
649 threads = dependency('threads')
650 librt = cc.find_library('rt')
651 libm = cc.find_library('m')
652 libdl = cc.find_library('dl')
653 libcrypt = cc.find_library('crypt')
655 libcap = dependency('libcap', required : false)
656 if not libcap.found()
657 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
658 libcap = cc.find_library('cap')
661 libmount = dependency('mount',
664 want_seccomp = get_option('seccomp')
665 if want_seccomp != 'false'
666 libseccomp = dependency('libseccomp',
667 version : '>= 2.3.1',
668 required : want_seccomp == 'true')
669 if libseccomp.found()
670 conf.set('HAVE_SECCOMP', true)
671 m4_defines += ['-DHAVE_SECCOMP']
677 want_selinux = get_option('selinux')
678 if want_selinux != 'false'
679 libselinux = dependency('libselinux',
680 version : '>= 2.1.9',
681 required : want_selinux == 'true')
682 if libselinux.found()
683 conf.set('HAVE_SELINUX', true)
684 m4_defines += ['-DHAVE_SELINUX']
690 want_apparmor = get_option('apparmor')
691 if want_apparmor != 'false'
692 libapparmor = dependency('libapparmor',
693 required : want_apparmor == 'true')
694 if libapparmor.found()
695 conf.set('HAVE_APPARMOR', true)
696 m4_defines += ['-DHAVE_APPARMOR']
702 smack_run_label = get_option('smack-run-label')
703 if smack_run_label != ''
704 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
705 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
708 want_polkit = get_option('polkit')
709 install_polkit = false
710 install_polkit_pkla = false
711 if want_polkit != 'false'
712 conf.set('ENABLE_POLKIT', true)
713 install_polkit = true
715 libpolkit = dependency('polkit-gobject-1',
717 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
718 message('Old polkit detected, will install pkla files')
719 install_polkit_pkla = true
723 want_acl = get_option('acl')
724 if want_acl != 'false'
725 libacl = cc.find_library('acl', required : want_acl == 'true')
727 conf.set('HAVE_ACL', true)
728 m4_defines += ['-DHAVE_ACL']
734 want_audit = get_option('audit')
735 if want_audit != 'false'
736 libaudit = dependency('audit', required : want_audit == 'true')
737 conf.set('HAVE_AUDIT', libaudit.found())
742 want_blkid = get_option('blkid')
743 if want_blkid != 'false'
744 libblkid = dependency('blkid', required : want_blkid == 'true')
745 conf.set('HAVE_BLKID', libblkid.found())
750 want_kmod = get_option('kmod')
751 if want_kmod != 'false'
752 libkmod = dependency('libkmod',
754 required : want_kmod == 'true')
755 conf.set('HAVE_KMOD', libkmod.found())
760 want_pam = get_option('pam')
761 if want_pam != 'false'
762 libpam = cc.find_library('pam', required : want_pam == 'true')
763 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
764 if libpam.found() and libpam_misc.found()
765 conf.set('HAVE_PAM', true)
766 m4_defines += ['-DHAVE_PAM']
773 want_microhttpd = get_option('microhttpd')
774 if want_microhttpd != 'false'
775 libmicrohttpd = dependency('libmicrohttpd',
776 version : '>= 0.9.33',
777 required : want_microhttpd == 'true')
778 if libmicrohttpd.found()
779 conf.set('HAVE_MICROHTTPD', true)
780 m4_defines += ['-DHAVE_MICROHTTPD']
786 want_libcryptsetup = get_option('libcryptsetup')
787 if want_libcryptsetup != 'false'
788 libcryptsetup = dependency('libcryptsetup',
789 version : '>= 1.6.0',
790 required : want_libcryptsetup == 'true')
791 conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found())
796 want_libcurl = get_option('libcurl')
797 if want_libcurl != 'false'
798 libcurl = dependency('libcurl',
799 version : '>= 7.32.0',
800 required : want_libcurl == 'true')
802 conf.set('HAVE_LIBCURL', true)
803 m4_defines += ['-DHAVE_LIBCURL']
809 want_libidn = get_option('libidn')
810 want_libidn2 = get_option('libidn2')
811 if want_libidn == 'true' and want_libidn2 == 'true'
812 error('libidn and libidn2 cannot be requested simultaneously')
815 if want_libidn != 'false' and want_libidn2 != 'true'
816 libidn = dependency('libidn',
817 required : want_libidn == 'true')
819 conf.set('HAVE_LIBIDN', true)
820 m4_defines += ['-DHAVE_LIBIDN']
825 if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false'
826 # libidn is used for both libidn and libidn2 objects
827 libidn = dependency('libidn2',
828 required : want_libidn2 == 'true')
830 conf.set('HAVE_LIBIDN2', true)
831 m4_defines += ['-DHAVE_LIBIDN2']
835 want_libiptc = get_option('libiptc')
836 if want_libiptc != 'false'
837 libiptc = dependency('libiptc',
838 required : want_libiptc == 'true')
840 conf.set('HAVE_LIBIPTC', true)
841 m4_defines += ['-DHAVE_LIBIPTC']
847 want_qrencode = get_option('qrencode')
848 if want_qrencode != 'false'
849 libqrencode = dependency('libqrencode',
850 required : want_qrencode == 'true')
851 conf.set('HAVE_QRENCODE', libqrencode.found())
856 want_gcrypt = get_option('gcrypt')
857 if want_gcrypt != 'false'
858 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
859 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
861 have_deps = libgcrypt.found() and libgpg_error.found()
862 conf.set('HAVE_GCRYPT', have_deps)
864 # link to neither of the libs if one is not found
873 want_gnutls = get_option('gnutls')
874 if want_gnutls != 'false'
875 libgnutls = dependency('gnutls',
876 version : '>= 3.1.4',
877 required : want_gnutls == 'true')
878 conf.set('HAVE_GNUTLS', libgnutls.found())
883 want_elfutils = get_option('elfutils')
884 if want_elfutils != 'false'
885 libdw = dependency('libdw',
886 required : want_elfutils == 'true')
887 conf.set('HAVE_ELFUTILS', libdw.found())
892 want_zlib = get_option('zlib')
893 if want_zlib != 'false'
894 libz = dependency('zlib',
895 required : want_zlib == 'true')
896 conf.set('HAVE_ZLIB', libz.found())
901 want_bzip2 = get_option('bzip2')
902 if want_bzip2 != 'false'
903 libbzip2 = cc.find_library('bz2',
904 required : want_bzip2 == 'true')
905 conf.set('HAVE_BZIP2', libbzip2.found())
910 want_xz = get_option('xz')
911 if want_xz != 'false'
912 libxz = dependency('liblzma',
913 required : want_xz == 'true')
914 conf.set('HAVE_XZ', libxz.found())
919 want_lz4 = get_option('lz4')
920 if want_lz4 != 'false'
921 liblz4 = dependency('liblz4',
922 required : want_lz4 == 'true')
923 conf.set('HAVE_LZ4', liblz4.found())
928 want_xkbcommon = get_option('xkbcommon')
929 if want_xkbcommon != 'false'
930 libxkbcommon = dependency('xkbcommon',
931 version : '>= 0.3.0',
932 required : want_xkbcommon == 'true')
933 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
938 want_glib = get_option('glib')
939 if want_glib != 'false'
940 libglib = dependency('glib-2.0',
941 version : '>= 2.22.0',
942 required : want_glib == 'true')
943 libgobject = dependency('gobject-2.0',
944 version : '>= 2.22.0',
945 required : want_glib == 'true')
946 libgio = dependency('gio-2.0',
947 required : want_glib == 'true')
948 have = libglib.found() and libgobject.found() and libgio.found()
949 conf.set('HAVE_GLIB', have)
956 want_dbus = get_option('dbus')
957 if want_dbus != 'false'
958 libdbus = dependency('dbus-1',
959 version : '>= 1.3.2',
960 required : want_dbus == 'true')
961 conf.set('HAVE_DBUS', libdbus.found())
966 default_dnssec = get_option('default-dnssec')
967 if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false)
968 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
969 default_dnssec = 'no'
971 conf.set('DEFAULT_DNSSEC_MODE',
972 'DNSSEC_' + default_dnssec.underscorify().to_upper())
973 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
975 want_importd = get_option('importd')
976 if want_importd != 'false'
977 have_deps = (conf.get('HAVE_LIBCURL', false) and
978 conf.get('HAVE_ZLIB', false) and
979 conf.get('HAVE_BZIP2', false) and
980 conf.get('HAVE_XZ', false) and
981 conf.get('HAVE_GCRYPT', false))
982 conf.set('ENABLE_IMPORTD', have_deps)
983 if want_importd == 'true' and not have_deps
984 error('importd support was requested, but dependencies are not available')
988 want_remote = get_option('remote')
989 if want_remote != 'false'
990 have_deps = [conf.get('HAVE_MICROHTTPD', false),
991 conf.get('HAVE_LIBCURL', false)]
992 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
993 # it's possible to build one without the other. Complain only if
994 # support was explictly requested. The auxiliary files like sysusers
995 # config should be installed when any of the programs are built.
996 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
997 error('remote support was requested, but dependencies are not available')
999 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
1002 foreach pair : [['utmp', 'HAVE_UTMP'],
1003 ['hibernate', 'ENABLE_HIBERNATE'],
1004 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
1005 ['binfmt', 'ENABLE_BINFMT'],
1006 ['coredump', 'ENABLE_COREDUMP'],
1007 ['resolve', 'ENABLE_RESOLVED'],
1008 ['logind', 'ENABLE_LOGIND'],
1009 ['hostnamed', 'ENABLE_HOSTNAMED'],
1010 ['localed', 'ENABLE_LOCALED'],
1011 ['machined', 'ENABLE_MACHINED'],
1012 ['networkd', 'ENABLE_NETWORKD'],
1013 ['timedated', 'ENABLE_TIMEDATED'],
1014 ['timesyncd', 'ENABLE_TIMESYNCD'],
1015 ['myhostname', 'HAVE_MYHOSTNAME'],
1016 ['firstboot', 'ENABLE_FIRSTBOOT'],
1017 ['randomseed', 'ENABLE_RANDOMSEED'],
1018 ['backlight', 'ENABLE_BACKLIGHT'],
1019 ['vconsole', 'ENABLE_VCONSOLE'],
1020 ['quotacheck', 'ENABLE_QUOTACHECK'],
1021 ['sysusers', 'ENABLE_SYSUSERS'],
1022 ['tmpfiles', 'ENABLE_TMPFILES'],
1023 ['hwdb', 'ENABLE_HWDB'],
1024 ['rfkill', 'ENABLE_RFKILL'],
1025 ['ldconfig', 'ENABLE_LDCONFIG'],
1026 ['efi', 'ENABLE_EFI'],
1027 ['tpm', 'ENABLE_TPM'],
1028 ['ima', 'HAVE_IMA'],
1029 ['smack', 'HAVE_SMACK'],
1030 ['gshadow', 'ENABLE_GSHADOW'],
1031 ['idn', 'ENABLE_IDN'],
1032 ['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
1035 if get_option(pair[0])
1036 conf.set(pair[1], true)
1037 m4_defines += ['-D' + pair[1]]
1041 want_tests = get_option('tests')
1042 install_tests = get_option('install-tests')
1045 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1047 #####################################################################
1049 if get_option('efi')
1050 efi_arch = host_machine.cpu_family()
1052 if efi_arch == 'x86'
1053 EFI_MACHINE_TYPE_NAME = 'ia32'
1054 gnu_efi_arch = 'ia32'
1055 elif efi_arch == 'x86_64'
1056 EFI_MACHINE_TYPE_NAME = 'x64'
1057 gnu_efi_arch = 'x86_64'
1058 elif efi_arch == 'arm'
1059 EFI_MACHINE_TYPE_NAME = 'arm'
1060 gnu_efi_arch = 'arm'
1061 elif efi_arch == 'aarch64'
1062 EFI_MACHINE_TYPE_NAME = 'aa64'
1063 gnu_efi_arch = 'aarch64'
1065 EFI_MACHINE_TYPE_NAME = ''
1069 conf.set('ENABLE_EFI', true)
1070 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1072 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1075 #####################################################################
1077 config_h = configure_file(
1078 output : 'config.h',
1079 configuration : conf)
1081 includes = include_directories('src/basic',
1091 'src/libsystemd/sd-bus',
1092 'src/libsystemd/sd-device',
1093 'src/libsystemd/sd-hwdb',
1094 'src/libsystemd/sd-id128',
1095 'src/libsystemd/sd-netlink',
1096 'src/libsystemd/sd-network',
1097 'src/libsystemd-network',
1101 add_project_arguments('-include', 'config.h', language : 'c')
1103 gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1104 'src/shared/gcrypt-util.c')
1108 subdir('src/systemd')
1110 subdir('src/libsystemd')
1111 subdir('src/libsystemd-network')
1112 subdir('src/journal')
1115 libjournal_core = static_library(
1117 libjournal_core_sources,
1119 include_directories : includes,
1122 libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1123 libsystemd = shared_library(
1125 libsystemd_internal_sources,
1126 journal_internal_sources,
1128 include_directories : includes,
1129 link_args : ['-shared',
1130 '-Wl,--version-script=' + libsystemd_sym_path],
1131 link_with : [libbasic],
1132 dependencies : [threads,
1137 link_depends : libsystemd_sym,
1139 install_dir : rootlibdir)
1141 ############################################################
1143 # binaries that have --help and are intended for use by humans,
1144 # usually, but not always, installed in /bin.
1145 public_programs = []
1147 subdir('src/libudev')
1148 subdir('src/shared')
1151 subdir('src/network')
1153 subdir('src/analyze')
1154 subdir('src/journal-remote')
1155 subdir('src/coredump')
1156 subdir('src/hostname')
1157 subdir('src/import')
1158 subdir('src/kernel-install')
1159 subdir('src/locale')
1160 subdir('src/machine')
1161 subdir('src/nspawn')
1162 subdir('src/resolve')
1163 subdir('src/timedate')
1164 subdir('src/timesync')
1165 subdir('src/vconsole')
1166 subdir('src/sulogin-shell')
1167 subdir('src/boot/efi')
1172 ############################################################
1174 # only static linking apart from libdl, to make sure that the
1175 # module is linked to all libraries that it uses.
1176 test_dlopen = executable(
1179 include_directories : includes,
1180 link_with : [libbasic],
1181 dependencies : [libdl])
1183 foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
1184 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1185 ['mymachines', 'ENABLE_MACHINED'],
1186 ['resolve', 'ENABLE_RESOLVED']]
1188 condition = tuple[1] == '' or conf.get(tuple[1], false)
1192 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1193 version_script_arg = join_paths(meson.current_source_dir(), sym)
1195 nss = shared_library(
1197 'src/nss-@0@/nss-@0@.c'.format(module),
1199 include_directories : includes,
1200 link_args : ['-shared',
1201 '-Wl,--version-script=' + version_script_arg,
1203 link_with : [libsystemd_internal,
1205 dependencies : [threads,
1209 install_dir : rootlibdir)
1211 # We cannot use shared_module because it does not support version suffix.
1212 # Unfortunately shared_library insists on creating the symlink…
1213 meson.add_install_script('sh', '-c',
1214 'rm $DESTDIR@0@/libnss_@1@.so'
1215 .format(rootlibdir, module))
1217 test('dlopen-nss_' + module,
1219 args : [nss.full_path()]) # path to dlopen must include a slash
1223 ############################################################
1225 executable('systemd',
1227 include_directories : includes,
1228 link_with : [libcore,
1230 dependencies : [threads,
1236 install_rpath : rootlibexecdir,
1238 install_dir : rootlibexecdir)
1240 exe = executable('systemd-analyze',
1241 systemd_analyze_sources,
1242 include_directories : includes,
1243 link_with : [libcore,
1245 dependencies : [threads,
1251 install_rpath : rootlibexecdir,
1253 public_programs += [exe]
1255 executable('systemd-journald',
1256 systemd_journald_sources,
1257 include_directories : includes,
1258 link_with : [libjournal_core,
1260 dependencies : [threads,
1264 install_rpath : rootlibexecdir,
1266 install_dir : rootlibexecdir)
1268 exe = executable('systemd-cat',
1269 systemd_cat_sources,
1270 include_directories : includes,
1271 link_with : [libjournal_core,
1273 dependencies : [threads],
1274 install_rpath : rootlibexecdir,
1276 public_programs += [exe]
1278 exe = executable('journalctl',
1280 include_directories : includes,
1281 link_with : [libshared],
1282 dependencies : [threads,
1286 install_rpath : rootlibexecdir,
1288 install_dir : rootbindir)
1289 public_programs += [exe]
1291 executable('systemd-getty-generator',
1292 'src/getty-generator/getty-generator.c',
1293 include_directories : includes,
1294 link_with : [libshared],
1295 install_rpath : rootlibexecdir,
1297 install_dir : systemgeneratordir)
1299 executable('systemd-debug-generator',
1300 'src/debug-generator/debug-generator.c',
1301 include_directories : includes,
1302 link_with : [libshared],
1303 install_rpath : rootlibexecdir,
1305 install_dir : systemgeneratordir)
1307 executable('systemd-fstab-generator',
1308 'src/fstab-generator/fstab-generator.c',
1309 'src/core/mount-setup.c',
1310 include_directories : includes,
1311 link_with : [libshared],
1312 install_rpath : rootlibexecdir,
1314 install_dir : systemgeneratordir)
1316 if conf.get('ENABLE_ENVIRONMENT_D', false)
1317 executable('30-systemd-environment-d-generator',
1318 'src/environment-d-generator/environment-d-generator.c',
1319 include_directories : includes,
1320 link_with : [libshared],
1321 install_rpath : rootlibexecdir,
1323 install_dir : userenvgeneratordir)
1325 meson.add_install_script(meson_make_symlink,
1326 join_paths(sysconfdir, 'environment'),
1327 join_paths(environmentdir, '99-environment.conf'))
1330 if conf.get('ENABLE_HIBERNATE', false)
1331 executable('systemd-hibernate-resume-generator',
1332 'src/hibernate-resume/hibernate-resume-generator.c',
1333 include_directories : includes,
1334 link_with : [libshared],
1335 install_rpath : rootlibexecdir,
1337 install_dir : systemgeneratordir)
1339 executable('systemd-hibernate-resume',
1340 'src/hibernate-resume/hibernate-resume.c',
1341 include_directories : includes,
1342 link_with : [libshared],
1343 install_rpath : rootlibexecdir,
1345 install_dir : rootlibexecdir)
1348 if conf.get('HAVE_BLKID', false)
1349 executable('systemd-gpt-auto-generator',
1350 'src/gpt-auto-generator/gpt-auto-generator.c',
1351 'src/basic/blkid-util.h',
1352 include_directories : includes,
1353 link_with : [libshared],
1354 dependencies : libblkid,
1355 install_rpath : rootlibexecdir,
1357 install_dir : systemgeneratordir)
1359 exe = executable('systemd-dissect',
1360 'src/dissect/dissect.c',
1361 include_directories : includes,
1362 link_with : [libshared],
1363 install_rpath : rootlibexecdir,
1365 install_dir : rootlibexecdir)
1366 public_programs += [exe]
1369 if conf.get('ENABLE_RESOLVED', false)
1370 executable('systemd-resolved',
1371 systemd_resolved_sources,
1372 gcrypt_util_sources,
1373 include_directories : includes,
1374 link_with : [libshared],
1375 dependencies : [threads,
1380 install_rpath : rootlibexecdir,
1382 install_dir : rootlibexecdir)
1384 exe = executable('systemd-resolve',
1385 systemd_resolve_sources,
1386 gcrypt_util_sources,
1387 include_directories : includes,
1388 link_with : [libshared],
1389 dependencies : [threads,
1394 install_rpath : rootlibexecdir,
1396 public_programs += [exe]
1399 if conf.get('ENABLE_LOGIND', false)
1400 executable('systemd-logind',
1401 systemd_logind_sources,
1402 include_directories : includes,
1403 link_with : [liblogind_core,
1405 dependencies : [threads,
1407 install_rpath : rootlibexecdir,
1409 install_dir : rootlibexecdir)
1411 exe = executable('loginctl',
1413 include_directories : includes,
1414 link_with : [libshared],
1415 dependencies : [threads,
1418 install_rpath : rootlibexecdir,
1420 install_dir : rootbindir)
1421 public_programs += [exe]
1423 exe = executable('systemd-inhibit',
1424 'src/login/inhibit.c',
1425 include_directories : includes,
1426 link_with : [libshared],
1427 install_rpath : rootlibexecdir,
1429 install_dir : rootbindir)
1430 public_programs += [exe]
1432 if conf.get('HAVE_PAM', false)
1433 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1434 pam_systemd = shared_library(
1438 include_directories : includes,
1439 link_args : ['-shared',
1440 '-Wl,--version-script=' + version_script_arg],
1441 link_with : [libsystemd_internal,
1443 dependencies : [threads,
1446 link_depends : pam_systemd_sym,
1448 install_dir : pamlibdir)
1450 test('dlopen-pam_systemd',
1452 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1456 if conf.get('HAVE_PAM', false)
1457 executable('systemd-user-sessions',
1458 'src/user-sessions/user-sessions.c',
1459 include_directories : includes,
1460 link_with : [libshared],
1461 install_rpath : rootlibexecdir,
1463 install_dir : rootlibexecdir)
1466 if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
1467 exe = executable('bootctl',
1468 'src/boot/bootctl.c',
1469 include_directories : includes,
1470 link_with : [libshared],
1471 dependencies : [libblkid],
1472 install_rpath : rootlibexecdir,
1474 public_programs += [exe]
1477 exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1478 include_directories : includes,
1479 link_with : [libshared],
1480 dependencies : [threads],
1481 install_rpath : rootlibexecdir,
1483 public_programs += [exe]
1485 exe = executable('systemctl', 'src/systemctl/systemctl.c',
1486 include_directories : includes,
1487 link_with : [libshared],
1488 dependencies : [threads,
1493 install_rpath : rootlibexecdir,
1495 install_dir : rootbindir)
1496 public_programs += [exe]
1498 if conf.get('ENABLE_BACKLIGHT', false)
1499 executable('systemd-backlight',
1500 'src/backlight/backlight.c',
1501 include_directories : includes,
1502 link_with : [libshared],
1503 install_rpath : rootlibexecdir,
1505 install_dir : rootlibexecdir)
1508 if conf.get('ENABLE_RFKILL', false)
1509 executable('systemd-rfkill',
1510 'src/rfkill/rfkill.c',
1511 include_directories : includes,
1512 link_with : [libshared],
1513 install_rpath : rootlibexecdir,
1515 install_dir : rootlibexecdir)
1518 executable('systemd-system-update-generator',
1519 'src/system-update-generator/system-update-generator.c',
1520 include_directories : includes,
1521 link_with : [libshared],
1522 install_rpath : rootlibexecdir,
1524 install_dir : systemgeneratordir)
1526 if conf.get('HAVE_LIBCRYPTSETUP', false)
1527 executable('systemd-cryptsetup',
1528 'src/cryptsetup/cryptsetup.c',
1529 include_directories : includes,
1530 link_with : [libshared],
1531 dependencies : [libcryptsetup],
1532 install_rpath : rootlibexecdir,
1534 install_dir : rootlibexecdir)
1536 executable('systemd-cryptsetup-generator',
1537 'src/cryptsetup/cryptsetup-generator.c',
1538 include_directories : includes,
1539 link_with : [libshared],
1540 dependencies : [libcryptsetup],
1541 install_rpath : rootlibexecdir,
1543 install_dir : systemgeneratordir)
1545 executable('systemd-veritysetup',
1546 'src/veritysetup/veritysetup.c',
1547 include_directories : includes,
1548 link_with : [libshared],
1549 dependencies : [libcryptsetup],
1550 install_rpath : rootlibexecdir,
1552 install_dir : rootlibexecdir)
1554 executable('systemd-veritysetup-generator',
1555 'src/veritysetup/veritysetup-generator.c',
1556 include_directories : includes,
1557 link_with : [libshared],
1558 dependencies : [libcryptsetup],
1559 install_rpath : rootlibexecdir,
1561 install_dir : systemgeneratordir)
1564 if conf.get('HAVE_SYSV_COMPAT', false)
1565 executable('systemd-sysv-generator',
1566 'src/sysv-generator/sysv-generator.c',
1567 include_directories : includes,
1568 link_with : [libshared],
1569 install_rpath : rootlibexecdir,
1571 install_dir : systemgeneratordir)
1573 executable('systemd-rc-local-generator',
1574 'src/rc-local-generator/rc-local-generator.c',
1575 include_directories : includes,
1576 link_with : [libshared],
1577 install_rpath : rootlibexecdir,
1579 install_dir : systemgeneratordir)
1582 if conf.get('ENABLE_HOSTNAMED', false)
1583 executable('systemd-hostnamed',
1584 'src/hostname/hostnamed.c',
1585 include_directories : includes,
1586 link_with : [libshared],
1587 install_rpath : rootlibexecdir,
1589 install_dir : rootlibexecdir)
1591 exe = executable('hostnamectl',
1592 'src/hostname/hostnamectl.c',
1593 include_directories : includes,
1594 link_with : [libshared],
1595 install_rpath : rootlibexecdir,
1597 public_programs += [exe]
1600 if conf.get('ENABLE_LOCALED', false)
1601 if conf.get('HAVE_XKBCOMMON', false)
1602 # logind will load libxkbcommon.so dynamically on its own
1608 executable('systemd-localed',
1609 systemd_localed_sources,
1610 include_directories : includes,
1611 link_with : [libshared],
1612 dependencies : deps,
1613 install_rpath : rootlibexecdir,
1615 install_dir : rootlibexecdir)
1617 exe = executable('localectl',
1619 include_directories : includes,
1620 link_with : [libshared],
1621 install_rpath : rootlibexecdir,
1623 public_programs += [exe]
1626 if conf.get('ENABLE_TIMEDATED', false)
1627 executable('systemd-timedated',
1628 'src/timedate/timedated.c',
1629 include_directories : includes,
1630 link_with : [libshared],
1631 install_rpath : rootlibexecdir,
1633 install_dir : rootlibexecdir)
1635 exe = executable('timedatectl',
1636 'src/timedate/timedatectl.c',
1637 include_directories : includes,
1638 install_rpath : rootlibexecdir,
1639 link_with : [libshared],
1641 public_programs += [exe]
1644 if conf.get('ENABLE_TIMESYNCD', false)
1645 executable('systemd-timesyncd',
1646 systemd_timesyncd_sources,
1647 include_directories : includes,
1648 link_with : [libshared],
1649 dependencies : [threads,
1651 install_rpath : rootlibexecdir,
1653 install_dir : rootlibexecdir)
1656 if conf.get('ENABLE_MACHINED', false)
1657 executable('systemd-machined',
1658 systemd_machined_sources,
1659 include_directories : includes,
1660 link_with : [libmachine_core,
1662 install_rpath : rootlibexecdir,
1664 install_dir : rootlibexecdir)
1666 exe = executable('machinectl',
1667 'src/machine/machinectl.c',
1668 include_directories : includes,
1669 link_with : [libshared],
1670 dependencies : [threads,
1673 install_rpath : rootlibexecdir,
1675 install_dir : rootbindir)
1676 public_programs += [exe]
1679 if conf.get('ENABLE_IMPORTD', false)
1680 executable('systemd-importd',
1681 systemd_importd_sources,
1682 include_directories : includes,
1683 link_with : [libshared],
1684 dependencies : [threads],
1685 install_rpath : rootlibexecdir,
1687 install_dir : rootlibexecdir)
1689 systemd_pull = executable('systemd-pull',
1690 systemd_pull_sources,
1691 include_directories : includes,
1692 link_with : [libshared],
1693 dependencies : [libcurl,
1698 install_rpath : rootlibexecdir,
1700 install_dir : rootlibexecdir)
1702 systemd_import = executable('systemd-import',
1703 systemd_import_sources,
1704 include_directories : includes,
1705 link_with : [libshared],
1706 dependencies : [libcurl,
1710 install_rpath : rootlibexecdir,
1712 install_dir : rootlibexecdir)
1714 systemd_export = executable('systemd-export',
1715 systemd_export_sources,
1716 include_directories : includes,
1717 link_with : [libshared],
1718 dependencies : [libcurl,
1722 install_rpath : rootlibexecdir,
1724 install_dir : rootlibexecdir)
1725 public_programs += [systemd_pull, systemd_import, systemd_export]
1728 if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
1729 exe = executable('systemd-journal-upload',
1730 systemd_journal_upload_sources,
1731 include_directories : includes,
1732 link_with : [libshared],
1733 dependencies : [threads,
1738 install_rpath : rootlibexecdir,
1740 install_dir : rootlibexecdir)
1741 public_programs += [exe]
1744 if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
1745 s_j_remote = executable('systemd-journal-remote',
1746 systemd_journal_remote_sources,
1747 include_directories : includes,
1748 link_with : [libshared],
1749 dependencies : [threads,
1754 install_rpath : rootlibexecdir,
1756 install_dir : rootlibexecdir)
1758 s_j_gatewayd = executable('systemd-journal-gatewayd',
1759 systemd_journal_gatewayd_sources,
1760 include_directories : includes,
1761 link_with : [libshared],
1762 dependencies : [threads,
1767 install_rpath : rootlibexecdir,
1769 install_dir : rootlibexecdir)
1770 public_programs += [s_j_remote, s_j_gatewayd]
1773 if conf.get('ENABLE_COREDUMP', false)
1774 executable('systemd-coredump',
1775 systemd_coredump_sources,
1776 include_directories : includes,
1777 link_with : [libshared],
1778 dependencies : [threads,
1783 install_rpath : rootlibexecdir,
1785 install_dir : rootlibexecdir)
1787 exe = executable('coredumpctl',
1788 coredumpctl_sources,
1789 include_directories : includes,
1790 link_with : [libshared],
1791 dependencies : [threads,
1794 install_rpath : rootlibexecdir,
1796 public_programs += [exe]
1799 if conf.get('ENABLE_BINFMT', false)
1800 exe = executable('systemd-binfmt',
1801 'src/binfmt/binfmt.c',
1802 include_directories : includes,
1803 link_with : [libshared],
1804 install_rpath : rootlibexecdir,
1806 install_dir : rootlibexecdir)
1807 public_programs += [exe]
1809 meson.add_install_script('sh', '-c',
1810 mkdir_p.format(binfmtdir))
1811 meson.add_install_script('sh', '-c',
1812 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1815 if conf.get('ENABLE_VCONSOLE', false)
1816 executable('systemd-vconsole-setup',
1817 'src/vconsole/vconsole-setup.c',
1818 include_directories : includes,
1819 link_with : [libshared],
1820 install_rpath : rootlibexecdir,
1822 install_dir : rootlibexecdir)
1825 if conf.get('ENABLE_RANDOMSEED', false)
1826 executable('systemd-random-seed',
1827 'src/random-seed/random-seed.c',
1828 include_directories : includes,
1829 link_with : [libshared],
1830 install_rpath : rootlibexecdir,
1832 install_dir : rootlibexecdir)
1835 if conf.get('ENABLE_FIRSTBOOT', false)
1836 executable('systemd-firstboot',
1837 'src/firstboot/firstboot.c',
1838 include_directories : includes,
1839 link_with : [libshared],
1840 dependencies : [libcrypt],
1841 install_rpath : rootlibexecdir,
1843 install_dir : rootbindir)
1846 executable('systemd-remount-fs',
1847 'src/remount-fs/remount-fs.c',
1848 'src/core/mount-setup.c',
1849 'src/core/mount-setup.h',
1850 include_directories : includes,
1851 link_with : [libshared],
1852 install_rpath : rootlibexecdir,
1854 install_dir : rootlibexecdir)
1856 executable('systemd-machine-id-setup',
1857 'src/machine-id-setup/machine-id-setup-main.c',
1858 'src/core/machine-id-setup.c',
1859 'src/core/machine-id-setup.h',
1860 include_directories : includes,
1861 link_with : [libshared],
1862 install_rpath : rootlibexecdir,
1864 install_dir : rootbindir)
1866 executable('systemd-fsck',
1868 include_directories : includes,
1869 link_with : [libshared],
1870 install_rpath : rootlibexecdir,
1872 install_dir : rootlibexecdir)
1874 executable('systemd-sleep',
1875 'src/sleep/sleep.c',
1876 include_directories : includes,
1877 link_with : [libshared],
1878 install_rpath : rootlibexecdir,
1880 install_dir : rootlibexecdir)
1882 exe = executable('systemd-sysctl',
1883 'src/sysctl/sysctl.c',
1884 include_directories : includes,
1885 link_with : [libshared],
1886 install_rpath : rootlibexecdir,
1888 install_dir : rootlibexecdir)
1889 public_programs += [exe]
1891 executable('systemd-ac-power',
1892 'src/ac-power/ac-power.c',
1893 include_directories : includes,
1894 link_with : [libshared],
1895 install_rpath : rootlibexecdir,
1897 install_dir : rootlibexecdir)
1899 exe = executable('systemd-detect-virt',
1900 'src/detect-virt/detect-virt.c',
1901 include_directories : includes,
1902 link_with : [libshared],
1903 install_rpath : rootlibexecdir,
1905 public_programs += [exe]
1907 exe = executable('systemd-delta',
1908 'src/delta/delta.c',
1909 include_directories : includes,
1910 link_with : [libshared],
1911 install_rpath : rootlibexecdir,
1913 public_programs += [exe]
1915 exe = executable('systemd-escape',
1916 'src/escape/escape.c',
1917 include_directories : includes,
1918 link_with : [libshared],
1919 install_rpath : rootlibexecdir,
1921 install_dir : rootbindir)
1922 public_programs += [exe]
1924 exe = executable('systemd-notify',
1925 'src/notify/notify.c',
1926 include_directories : includes,
1927 link_with : [libshared],
1928 install_rpath : rootlibexecdir,
1930 install_dir : rootbindir)
1931 public_programs += [exe]
1933 executable('systemd-volatile-root',
1934 'src/volatile-root/volatile-root.c',
1935 include_directories : includes,
1936 link_with : [libshared],
1937 install_rpath : rootlibexecdir,
1939 install_dir : rootlibexecdir)
1941 executable('systemd-cgroups-agent',
1942 'src/cgroups-agent/cgroups-agent.c',
1943 include_directories : includes,
1944 link_with : [libshared],
1945 install_rpath : rootlibexecdir,
1947 install_dir : rootlibexecdir)
1949 exe = executable('systemd-path',
1951 include_directories : includes,
1952 link_with : [libshared],
1953 install_rpath : rootlibexecdir,
1955 public_programs += [exe]
1957 exe = executable('systemd-ask-password',
1958 'src/ask-password/ask-password.c',
1959 include_directories : includes,
1960 link_with : [libshared],
1961 install_rpath : rootlibexecdir,
1963 install_dir : rootbindir)
1964 public_programs += [exe]
1966 executable('systemd-reply-password',
1967 'src/reply-password/reply-password.c',
1968 include_directories : includes,
1969 link_with : [libshared],
1970 install_rpath : rootlibexecdir,
1972 install_dir : rootlibexecdir)
1974 exe = executable('systemd-tty-ask-password-agent',
1975 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1976 include_directories : includes,
1977 link_with : [libshared],
1978 install_rpath : rootlibexecdir,
1980 install_dir : rootbindir)
1981 public_programs += [exe]
1983 exe = executable('systemd-cgls',
1985 include_directories : includes,
1986 link_with : [libshared],
1987 install_rpath : rootlibexecdir,
1989 public_programs += [exe]
1991 exe = executable('systemd-cgtop',
1992 'src/cgtop/cgtop.c',
1993 include_directories : includes,
1994 link_with : [libshared],
1995 install_rpath : rootlibexecdir,
1997 public_programs += [exe]
1999 executable('systemd-initctl',
2000 'src/initctl/initctl.c',
2001 include_directories : includes,
2002 link_with : [libshared],
2003 install_rpath : rootlibexecdir,
2005 install_dir : rootlibexecdir)
2007 exe = executable('systemd-mount',
2008 'src/mount/mount-tool.c',
2009 include_directories : includes,
2010 link_with : [libshared],
2011 install_rpath : rootlibexecdir,
2013 public_programs += [exe]
2015 meson.add_install_script(meson_make_symlink,
2016 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2018 exe = executable('systemd-run',
2020 include_directories : includes,
2021 link_with : [libshared],
2022 install_rpath : rootlibexecdir,
2024 public_programs += [exe]
2026 exe = executable('systemd-stdio-bridge',
2027 'src/stdio-bridge/stdio-bridge.c',
2028 include_directories : includes,
2029 link_with : [libshared],
2030 install_rpath : rootlibexecdir,
2032 public_programs += [exe]
2034 exe = executable('busctl',
2035 'src/busctl/busctl.c',
2036 'src/busctl/busctl-introspect.c',
2037 'src/busctl/busctl-introspect.h',
2038 include_directories : includes,
2039 link_with : [libshared],
2040 install_rpath : rootlibexecdir,
2042 public_programs += [exe]
2044 if conf.get('ENABLE_SYSUSERS', false)
2045 exe = executable('systemd-sysusers',
2046 'src/sysusers/sysusers.c',
2047 include_directories : includes,
2048 link_with : [libshared],
2049 install_rpath : rootlibexecdir,
2051 install_dir : rootbindir)
2052 public_programs += [exe]
2055 if conf.get('ENABLE_TMPFILES', false)
2056 exe = executable('systemd-tmpfiles',
2057 'src/tmpfiles/tmpfiles.c',
2058 include_directories : includes,
2059 link_with : [libshared],
2060 dependencies : [libacl],
2061 install_rpath : rootlibexecdir,
2063 install_dir : rootbindir)
2064 public_programs += [exe]
2067 if conf.get('ENABLE_HWDB', false)
2068 exe = executable('systemd-hwdb',
2070 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2071 include_directories : includes,
2072 link_with : [libudev_internal],
2073 install_rpath : udev_rpath,
2075 install_dir : rootbindir)
2076 public_programs += [exe]
2079 if conf.get('ENABLE_QUOTACHECK', false)
2080 executable('systemd-quotacheck',
2081 'src/quotacheck/quotacheck.c',
2082 include_directories : includes,
2083 link_with : [libshared],
2084 install_rpath : rootlibexecdir,
2086 install_dir : rootlibexecdir)
2089 exe = executable('systemd-socket-proxyd',
2090 'src/socket-proxy/socket-proxyd.c',
2091 include_directories : includes,
2092 link_with : [libshared],
2093 dependencies : [threads],
2094 install_rpath : rootlibexecdir,
2096 install_dir : rootlibexecdir)
2097 public_programs += [exe]
2099 exe = executable('systemd-udevd',
2100 systemd_udevd_sources,
2101 include_directories : includes,
2102 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2103 link_with : [libudev_core,
2106 dependencies : [threads,
2111 install_rpath : udev_rpath,
2113 install_dir : rootlibexecdir)
2114 public_programs += [exe]
2116 exe = executable('udevadm',
2118 include_directories : includes,
2119 link_with : [libudev_core,
2122 dependencies : [threads,
2127 install_rpath : udev_rpath,
2129 install_dir : rootbindir)
2130 public_programs += [exe]
2132 executable('systemd-shutdown',
2133 systemd_shutdown_sources,
2134 include_directories : includes,
2135 link_with : [libshared],
2136 install_rpath : rootlibexecdir,
2138 install_dir : rootlibexecdir)
2140 executable('systemd-update-done',
2141 'src/update-done/update-done.c',
2142 include_directories : includes,
2143 link_with : [libshared],
2144 install_rpath : rootlibexecdir,
2146 install_dir : rootlibexecdir)
2148 executable('systemd-update-utmp',
2149 'src/update-utmp/update-utmp.c',
2150 include_directories : includes,
2151 link_with : [libshared],
2152 dependencies : [libaudit],
2153 install_rpath : rootlibexecdir,
2155 install_dir : rootlibexecdir)
2157 if conf.get('HAVE_KMOD', false)
2158 executable('systemd-modules-load',
2159 'src/modules-load/modules-load.c',
2160 include_directories : includes,
2161 link_with : [libshared],
2162 dependencies : [libkmod],
2163 install_rpath : rootlibexecdir,
2165 install_dir : rootlibexecdir)
2167 meson.add_install_script('sh', '-c',
2168 mkdir_p.format(modulesloaddir))
2169 meson.add_install_script('sh', '-c',
2170 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2173 exe = executable('systemd-nspawn',
2174 systemd_nspawn_sources,
2175 'src/core/mount-setup.c', # FIXME: use a variable?
2176 'src/core/mount-setup.h',
2177 'src/core/loopback-setup.c',
2178 'src/core/loopback-setup.h',
2179 include_directories : [includes, include_directories('src/nspawn')],
2180 link_with : [libshared],
2181 dependencies : [libacl,
2185 install_rpath : rootlibexecdir,
2187 public_programs += [exe]
2189 if conf.get('ENABLE_NETWORKD', false)
2190 executable('systemd-networkd',
2191 systemd_networkd_sources,
2192 include_directories : includes,
2193 link_with : [libnetworkd_core,
2197 dependencies : [threads],
2198 install_rpath : rootlibexecdir,
2200 install_dir : rootlibexecdir)
2202 executable('systemd-networkd-wait-online',
2203 systemd_networkd_wait_online_sources,
2204 include_directories : includes,
2205 link_with : [libnetworkd_core,
2207 install_rpath : rootlibexecdir,
2209 install_dir : rootlibexecdir)
2211 exe = executable('networkctl',
2213 include_directories : includes,
2214 link_with : [libsystemd_network,
2216 install_rpath : rootlibexecdir,
2218 install_dir : rootbindir)
2219 public_programs += [exe]
2221 ############################################################
2223 foreach tuple : tests
2225 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2226 dependencies = tuple[2]
2227 condition = tuple.length() >= 4 ? tuple[3] : ''
2228 type = tuple.length() >= 5 ? tuple[4] : ''
2229 defs = tuple.length() >= 6 ? tuple[5] : []
2230 incs = tuple.length() >= 7 ? tuple[6] : includes
2233 name = sources[0].split('/')[-1].split('.')[0]
2234 if type.startswith('timeout=')
2235 timeout = type.split('=')[1].to_int()
2239 if condition == '' or conf.get(condition, false)
2243 include_directories : incs,
2244 link_with : link_with,
2245 dependencies : dependencies,
2247 install_rpath : rootlibexecdir,
2248 install : install_tests,
2249 install_dir : join_paths(testsdir, type))
2252 message('@0@ is a manual test'.format(name))
2253 elif type == 'unsafe' and want_tests != 'unsafe'
2254 message('@0@ is an unsafe test'.format(name))
2261 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2265 test_libsystemd_sym = executable(
2266 'test-libsystemd-sym',
2267 test_libsystemd_sym_c,
2268 include_directories : includes,
2269 link_with : [libsystemd],
2270 install : install_tests,
2271 install_dir : testsdir)
2272 test('test-libsystemd-sym',
2273 test_libsystemd_sym)
2275 test_libudev_sym = executable(
2278 include_directories : includes,
2279 c_args : ['-Wno-deprecated-declarations'],
2280 link_with : [libudev],
2281 install : install_tests,
2282 install_dir : testsdir)
2283 test('test-libudev-sym',
2286 ############################################################
2288 make_directive_index_py = find_program('tools/make-directive-index.py')
2289 make_man_index_py = find_program('tools/make-man-index.py')
2290 xml_helper_py = find_program('tools/xml_helper.py')
2291 hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2295 subdir('sysusers.d')
2296 subdir('tmpfiles.d')
2301 subdir('shell-completion/bash')
2302 subdir('shell-completion/zsh')
2303 subdir('docs/sysvinit')
2304 subdir('docs/var-log')
2306 # FIXME: figure out if the warning is true:
2307 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2308 install_subdir('factory/etc',
2309 install_dir : factorydir)
2312 install_data('xorg/50-systemd-user.sh',
2313 install_dir : xinitrcdir)
2314 install_data('system-preset/90-systemd.preset',
2315 install_dir : systempresetdir)
2316 install_data('modprobe.d/systemd.conf',
2317 install_dir : modprobedir)
2318 install_data('README',
2325 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2326 install_dir : docdir)
2328 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2329 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2331 ############################################################
2333 meson_check_help = find_program('tools/meson-check-help.sh')
2335 foreach exec : public_programs
2336 name = exec.full_path().split('/')[-1]
2337 test('check-help-' + name,
2339 args : [exec.full_path()])
2342 ############################################################
2345 all_files = run_command(
2347 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2350 all_files = files(all_files.stdout().split())
2355 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2359 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2363 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2366 command : [meson_git_contrib_sh])
2370 git_head = run_command(
2372 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2373 'rev-parse', 'HEAD']).stdout().strip()
2374 git_head_short = run_command(
2376 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2377 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2381 command : ['git', 'archive',
2382 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2384 '--prefix', 'systemd-@0@/'.format(git_head),
2388 ############################################################
2391 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2393 'prefix: @0@'.format(prefixdir),
2394 'rootprefix: @0@'.format(rootprefixdir),
2395 'sysconf dir: @0@'.format(sysconfdir),
2396 'includedir: @0@'.format(includedir),
2397 'lib dir: @0@'.format(libdir),
2398 'rootlib dir: @0@'.format(rootlibdir),
2399 'SysV init scripts: @0@'.format(sysvinit_path),
2400 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2401 'PAM modules dir: @0@'.format(pamlibdir),
2402 'PAM configuration dir: @0@'.format(pamconfdir),
2403 'RPM macros dir: @0@'.format(rpmmacrosdir),
2404 'modprobe.d dir: @0@'.format(modprobedir),
2405 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2406 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2407 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2408 'bash completions dir: @0@'.format(bashcompletiondir),
2409 'zsh completions dir: @0@'.format(zshcompletiondir),
2410 'extra start script: @0@'.format(get_option('rc-local')),
2411 'extra stop script: @0@'.format(get_option('halt-local')),
2412 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2413 get_option('debug-tty')),
2414 'TTY GID: @0@'.format(tty_gid),
2415 'maximum system UID: @0@'.format(system_uid_max),
2416 'maximum system GID: @0@'.format(system_gid_max),
2417 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2418 'certificate root: @0@'.format(get_option('certificate-root')),
2419 'support URL: @0@'.format(support_url),
2420 'nobody user name: @0@'.format(get_option('nobody-user')),
2421 'nobody group name: @0@'.format(get_option('nobody-group')),
2422 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2423 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
2425 'default DNSSEC mode: @0@'.format(default_dnssec),
2426 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2427 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2429 alt_dns_servers = '\n '.join(dns_servers.split(' '))
2430 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2432 'default DNS servers: @0@'.format(alt_dns_servers),
2433 'default NTP servers: @0@'.format(alt_ntp_servers)]
2435 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2436 '@@0@'.format(time_epoch)).stdout().strip()
2438 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2441 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2442 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2443 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2445 if conf.get('ENABLE_EFI', false)
2447 'efi arch: @0@'.format(efi_arch)]
2451 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2452 'EFI CC @0@'.format(efi_cc),
2453 'EFI libdir: @0@'.format(efi_libdir),
2454 'EFI ldsdir: @0@'.format(efi_ldsdir),
2455 'EFI includedir: @0@'.format(efi_incdir)]
2508 ['legacy pkla', install_polkit_pkla],
2510 ['gnu-efi', have_gnu_efi],
2516 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
2519 ['man pages', want_man],
2520 ['html pages', want_html],
2521 ['man page indices', want_man and have_lxml],
2522 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
2527 ['adm group', get_option('adm-group')],
2528 ['wheel group', get_option('wheel-group')],
2531 ['debug mmap cache'],
2534 cond = tuple.get(1, '')
2536 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2537 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2538 cond = conf.get(ident1, false) or conf.get(ident2, false)
2543 missing += [tuple[0]]
2549 'enabled features: @0@'.format(', '.join(found)),
2551 'disabled features: @0@'.format(', '.join(missing)),
2553 message('\n '.join(status))