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 ['bpf', '''#include <sys/syscall.h>
447 #include <unistd.h>'''],
448 ['explicit_bzero' , '''#include <string.h>'''],
451 have = cc.has_function(ident[0], prefix : ident[1])
452 conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
455 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
456 conf.set('USE_SYS_RANDOM_H', true)
457 conf.set10('HAVE_DECL_GETRANDOM', true)
459 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
460 conf.set10('HAVE_DECL_GETRANDOM', have)
463 #####################################################################
465 sed = find_program('sed')
466 grep = find_program('grep')
467 awk = find_program('awk')
468 m4 = find_program('m4')
469 stat = find_program('stat')
470 git = find_program('git', required : false)
472 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
473 mkdir_p = 'mkdir -p $DESTDIR/@0@'
474 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
475 splash_bmp = files('test/splash.bmp')
477 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
478 # /usr/sbin, /sbin, and fall back to the default from middle column.
479 progs = [['telinit', '/lib/sysvinit/telinit'],
480 ['quotaon', '/usr/sbin/quotaon' ],
481 ['quotacheck', '/usr/sbin/quotacheck' ],
482 ['kill', '/usr/bin/kill' ],
483 ['kmod', '/usr/bin/kmod' ],
484 ['kexec', '/usr/sbin/kexec' ],
485 ['sulogin', '/usr/sbin/sulogin' ],
486 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
487 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
488 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
489 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
492 path = get_option(prog[0] + '-path')
494 message('Using @1@ for @0@'.format(prog[0], path))
496 exe = find_program(prog[0],
497 '/usr/sbin/' + prog[0],
500 path = exe.found() ? exe.path() : prog[1]
502 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
503 conf.set_quoted(name, path)
504 substs.set(name, path)
507 if run_command('ln', '--relative', '--help').returncode() != 0
508 error('ln does not support --relative')
511 ############################################################
513 gperf = find_program('gperf')
515 gperf_test_format = '''
517 const char * in_word_set(const char *, @0@);
520 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
521 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
522 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
523 if cc.compiles(gperf_test)
524 gperf_len_type = 'size_t'
526 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
527 if cc.compiles(gperf_test)
528 gperf_len_type = 'unsigned'
530 error('unable to determine gperf len type')
533 message('gperf len type is @0@'.format(gperf_len_type))
534 conf.set('GPERF_LEN_TYPE', gperf_len_type,
535 description : 'The type of gperf "len" parameter')
537 ############################################################
539 if not cc.has_header('sys/capability.h')
540 error('POSIX caps headers not found')
542 foreach header : ['linux/btrfs.h',
544 'linux/vm_sockets.h',
545 'valgrind/memcheck.h',
546 'valgrind/valgrind.h',
549 conf.set('HAVE_' + header.underscorify().to_upper(),
550 cc.has_header(header))
553 ############################################################
555 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
556 conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
557 gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
559 default_hierarchy = get_option('default-hierarchy')
560 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
561 description : 'default cgroup hierarchy as string')
562 if default_hierarchy == 'legacy'
563 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
564 elif default_hierarchy == 'hybrid'
565 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
567 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
570 time_epoch = get_option('time-epoch')
573 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
575 time_epoch = time_epoch.to_int()
576 conf.set('TIME_EPOCH', time_epoch)
578 system_uid_max = get_option('system-uid-max')
579 if system_uid_max == ''
580 system_uid_max = run_command(
582 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
583 '/etc/login.defs').stdout()
585 system_uid_max = system_uid_max.to_int()
586 conf.set('SYSTEM_UID_MAX', system_uid_max)
587 substs.set('systemuidmax', system_uid_max)
588 message('maximum system UID is @0@'.format(system_uid_max))
590 conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
591 conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
593 system_gid_max = get_option('system-gid-max')
594 if system_gid_max == ''
595 system_gid_max = run_command(
597 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
598 '/etc/login.defs').stdout()
600 system_gid_max = system_gid_max.to_int()
601 conf.set('SYSTEM_GID_MAX', system_gid_max)
602 substs.set('systemgidmax', system_gid_max)
603 message('maximum system GID is @0@'.format(system_gid_max))
605 tty_gid = get_option('tty-gid')
606 conf.set('TTY_GID', tty_gid)
607 substs.set('TTY_GID', tty_gid)
609 if get_option('adm-group')
610 m4_defines += ['-DENABLE_ADM_GROUP']
613 if get_option('wheel-group')
614 m4_defines += ['-DENABLE_WHEEL_GROUP']
617 substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
619 kill_user_processes = get_option('default-kill-user-processes')
620 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
621 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
623 dns_servers = get_option('dns-servers')
624 conf.set_quoted('DNS_SERVERS', dns_servers)
625 substs.set('DNS_SERVERS', dns_servers)
627 ntp_servers = get_option('ntp-servers')
628 conf.set_quoted('NTP_SERVERS', ntp_servers)
629 substs.set('NTP_SERVERS', ntp_servers)
631 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
633 substs.set('SUSHELL', get_option('debug-shell'))
634 substs.set('DEBUGTTY', get_option('debug-tty'))
636 debug = get_option('debug')
638 foreach name : debug.split(',')
640 conf.set('ENABLE_DEBUG_HASHMAP', true)
641 elif name == 'mmap-cache'
642 conf.set('ENABLE_DEBUG_MMAP_CACHE', true)
644 message('unknown debug option "@0@", ignoring'.format(name))
649 #####################################################################
651 threads = dependency('threads')
652 librt = cc.find_library('rt')
653 libm = cc.find_library('m')
654 libdl = cc.find_library('dl')
655 libcrypt = cc.find_library('crypt')
657 libcap = dependency('libcap', required : false)
658 if not libcap.found()
659 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
660 libcap = cc.find_library('cap')
663 libmount = dependency('mount',
666 want_seccomp = get_option('seccomp')
667 if want_seccomp != 'false'
668 libseccomp = dependency('libseccomp',
669 version : '>= 2.3.1',
670 required : want_seccomp == 'true')
671 if libseccomp.found()
672 conf.set('HAVE_SECCOMP', true)
673 m4_defines += ['-DHAVE_SECCOMP']
679 want_selinux = get_option('selinux')
680 if want_selinux != 'false'
681 libselinux = dependency('libselinux',
682 version : '>= 2.1.9',
683 required : want_selinux == 'true')
684 if libselinux.found()
685 conf.set('HAVE_SELINUX', true)
686 m4_defines += ['-DHAVE_SELINUX']
692 want_apparmor = get_option('apparmor')
693 if want_apparmor != 'false'
694 libapparmor = dependency('libapparmor',
695 required : want_apparmor == 'true')
696 if libapparmor.found()
697 conf.set('HAVE_APPARMOR', true)
698 m4_defines += ['-DHAVE_APPARMOR']
704 smack_run_label = get_option('smack-run-label')
705 if smack_run_label != ''
706 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
707 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
710 want_polkit = get_option('polkit')
711 install_polkit = false
712 install_polkit_pkla = false
713 if want_polkit != 'false'
714 conf.set('ENABLE_POLKIT', true)
715 install_polkit = true
717 libpolkit = dependency('polkit-gobject-1',
719 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
720 message('Old polkit detected, will install pkla files')
721 install_polkit_pkla = true
725 want_acl = get_option('acl')
726 if want_acl != 'false'
727 libacl = cc.find_library('acl', required : want_acl == 'true')
729 conf.set('HAVE_ACL', true)
730 m4_defines += ['-DHAVE_ACL']
736 want_audit = get_option('audit')
737 if want_audit != 'false'
738 libaudit = dependency('audit', required : want_audit == 'true')
739 conf.set('HAVE_AUDIT', libaudit.found())
744 want_blkid = get_option('blkid')
745 if want_blkid != 'false'
746 libblkid = dependency('blkid', required : want_blkid == 'true')
747 conf.set('HAVE_BLKID', libblkid.found())
752 want_kmod = get_option('kmod')
753 if want_kmod != 'false'
754 libkmod = dependency('libkmod',
756 required : want_kmod == 'true')
757 conf.set('HAVE_KMOD', libkmod.found())
762 want_pam = get_option('pam')
763 if want_pam != 'false'
764 libpam = cc.find_library('pam', required : want_pam == 'true')
765 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
766 if libpam.found() and libpam_misc.found()
767 conf.set('HAVE_PAM', true)
768 m4_defines += ['-DHAVE_PAM']
775 want_microhttpd = get_option('microhttpd')
776 if want_microhttpd != 'false'
777 libmicrohttpd = dependency('libmicrohttpd',
778 version : '>= 0.9.33',
779 required : want_microhttpd == 'true')
780 if libmicrohttpd.found()
781 conf.set('HAVE_MICROHTTPD', true)
782 m4_defines += ['-DHAVE_MICROHTTPD']
788 want_libcryptsetup = get_option('libcryptsetup')
789 if want_libcryptsetup != 'false'
790 libcryptsetup = dependency('libcryptsetup',
791 version : '>= 1.6.0',
792 required : want_libcryptsetup == 'true')
793 conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found())
798 want_libcurl = get_option('libcurl')
799 if want_libcurl != 'false'
800 libcurl = dependency('libcurl',
801 version : '>= 7.32.0',
802 required : want_libcurl == 'true')
804 conf.set('HAVE_LIBCURL', true)
805 m4_defines += ['-DHAVE_LIBCURL']
811 want_libidn = get_option('libidn')
812 want_libidn2 = get_option('libidn2')
813 if want_libidn == 'true' and want_libidn2 == 'true'
814 error('libidn and libidn2 cannot be requested simultaneously')
817 if want_libidn != 'false' and want_libidn2 != 'true'
818 libidn = dependency('libidn',
819 required : want_libidn == 'true')
821 conf.set('HAVE_LIBIDN', true)
822 m4_defines += ['-DHAVE_LIBIDN']
827 if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false'
828 # libidn is used for both libidn and libidn2 objects
829 libidn = dependency('libidn2',
830 required : want_libidn2 == 'true')
832 conf.set('HAVE_LIBIDN2', true)
833 m4_defines += ['-DHAVE_LIBIDN2']
837 want_libiptc = get_option('libiptc')
838 if want_libiptc != 'false'
839 libiptc = dependency('libiptc',
840 required : want_libiptc == 'true')
842 conf.set('HAVE_LIBIPTC', true)
843 m4_defines += ['-DHAVE_LIBIPTC']
849 want_qrencode = get_option('qrencode')
850 if want_qrencode != 'false'
851 libqrencode = dependency('libqrencode',
852 required : want_qrencode == 'true')
853 conf.set('HAVE_QRENCODE', libqrencode.found())
858 want_gcrypt = get_option('gcrypt')
859 if want_gcrypt != 'false'
860 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
861 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
863 have_deps = libgcrypt.found() and libgpg_error.found()
864 conf.set('HAVE_GCRYPT', have_deps)
866 # link to neither of the libs if one is not found
875 want_gnutls = get_option('gnutls')
876 if want_gnutls != 'false'
877 libgnutls = dependency('gnutls',
878 version : '>= 3.1.4',
879 required : want_gnutls == 'true')
880 conf.set('HAVE_GNUTLS', libgnutls.found())
885 want_elfutils = get_option('elfutils')
886 if want_elfutils != 'false'
887 libdw = dependency('libdw',
888 required : want_elfutils == 'true')
889 conf.set('HAVE_ELFUTILS', libdw.found())
894 want_zlib = get_option('zlib')
895 if want_zlib != 'false'
896 libz = dependency('zlib',
897 required : want_zlib == 'true')
898 conf.set('HAVE_ZLIB', libz.found())
903 want_bzip2 = get_option('bzip2')
904 if want_bzip2 != 'false'
905 libbzip2 = cc.find_library('bz2',
906 required : want_bzip2 == 'true')
907 conf.set('HAVE_BZIP2', libbzip2.found())
912 want_xz = get_option('xz')
913 if want_xz != 'false'
914 libxz = dependency('liblzma',
915 required : want_xz == 'true')
916 conf.set('HAVE_XZ', libxz.found())
921 want_lz4 = get_option('lz4')
922 if want_lz4 != 'false'
923 liblz4 = dependency('liblz4',
924 required : want_lz4 == 'true')
925 conf.set('HAVE_LZ4', liblz4.found())
930 want_xkbcommon = get_option('xkbcommon')
931 if want_xkbcommon != 'false'
932 libxkbcommon = dependency('xkbcommon',
933 version : '>= 0.3.0',
934 required : want_xkbcommon == 'true')
935 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
940 want_glib = get_option('glib')
941 if want_glib != 'false'
942 libglib = dependency('glib-2.0',
943 version : '>= 2.22.0',
944 required : want_glib == 'true')
945 libgobject = dependency('gobject-2.0',
946 version : '>= 2.22.0',
947 required : want_glib == 'true')
948 libgio = dependency('gio-2.0',
949 required : want_glib == 'true')
950 have = libglib.found() and libgobject.found() and libgio.found()
951 conf.set('HAVE_GLIB', have)
958 want_dbus = get_option('dbus')
959 if want_dbus != 'false'
960 libdbus = dependency('dbus-1',
961 version : '>= 1.3.2',
962 required : want_dbus == 'true')
963 conf.set('HAVE_DBUS', libdbus.found())
968 default_dnssec = get_option('default-dnssec')
969 if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false)
970 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
971 default_dnssec = 'no'
973 conf.set('DEFAULT_DNSSEC_MODE',
974 'DNSSEC_' + default_dnssec.underscorify().to_upper())
975 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
977 want_importd = get_option('importd')
978 if want_importd != 'false'
979 have_deps = (conf.get('HAVE_LIBCURL', false) and
980 conf.get('HAVE_ZLIB', false) and
981 conf.get('HAVE_BZIP2', false) and
982 conf.get('HAVE_XZ', false) and
983 conf.get('HAVE_GCRYPT', false))
984 conf.set('ENABLE_IMPORTD', have_deps)
985 if want_importd == 'true' and not have_deps
986 error('importd support was requested, but dependencies are not available')
990 want_remote = get_option('remote')
991 if want_remote != 'false'
992 have_deps = [conf.get('HAVE_MICROHTTPD', false),
993 conf.get('HAVE_LIBCURL', false)]
994 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
995 # it's possible to build one without the other. Complain only if
996 # support was explictly requested. The auxiliary files like sysusers
997 # config should be installed when any of the programs are built.
998 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
999 error('remote support was requested, but dependencies are not available')
1001 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
1004 foreach pair : [['utmp', 'HAVE_UTMP'],
1005 ['hibernate', 'ENABLE_HIBERNATE'],
1006 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
1007 ['binfmt', 'ENABLE_BINFMT'],
1008 ['coredump', 'ENABLE_COREDUMP'],
1009 ['resolve', 'ENABLE_RESOLVED'],
1010 ['logind', 'ENABLE_LOGIND'],
1011 ['hostnamed', 'ENABLE_HOSTNAMED'],
1012 ['localed', 'ENABLE_LOCALED'],
1013 ['machined', 'ENABLE_MACHINED'],
1014 ['networkd', 'ENABLE_NETWORKD'],
1015 ['timedated', 'ENABLE_TIMEDATED'],
1016 ['timesyncd', 'ENABLE_TIMESYNCD'],
1017 ['myhostname', 'HAVE_MYHOSTNAME'],
1018 ['firstboot', 'ENABLE_FIRSTBOOT'],
1019 ['randomseed', 'ENABLE_RANDOMSEED'],
1020 ['backlight', 'ENABLE_BACKLIGHT'],
1021 ['vconsole', 'ENABLE_VCONSOLE'],
1022 ['quotacheck', 'ENABLE_QUOTACHECK'],
1023 ['sysusers', 'ENABLE_SYSUSERS'],
1024 ['tmpfiles', 'ENABLE_TMPFILES'],
1025 ['hwdb', 'ENABLE_HWDB'],
1026 ['rfkill', 'ENABLE_RFKILL'],
1027 ['ldconfig', 'ENABLE_LDCONFIG'],
1028 ['efi', 'ENABLE_EFI'],
1029 ['tpm', 'ENABLE_TPM'],
1030 ['ima', 'HAVE_IMA'],
1031 ['smack', 'HAVE_SMACK'],
1032 ['gshadow', 'ENABLE_GSHADOW'],
1033 ['idn', 'ENABLE_IDN'],
1034 ['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
1037 if get_option(pair[0])
1038 conf.set(pair[1], true)
1039 m4_defines += ['-D' + pair[1]]
1043 want_tests = get_option('tests')
1044 install_tests = get_option('install-tests')
1047 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1049 #####################################################################
1051 if get_option('efi')
1052 efi_arch = host_machine.cpu_family()
1054 if efi_arch == 'x86'
1055 EFI_MACHINE_TYPE_NAME = 'ia32'
1056 gnu_efi_arch = 'ia32'
1057 elif efi_arch == 'x86_64'
1058 EFI_MACHINE_TYPE_NAME = 'x64'
1059 gnu_efi_arch = 'x86_64'
1060 elif efi_arch == 'arm'
1061 EFI_MACHINE_TYPE_NAME = 'arm'
1062 gnu_efi_arch = 'arm'
1063 elif efi_arch == 'aarch64'
1064 EFI_MACHINE_TYPE_NAME = 'aa64'
1065 gnu_efi_arch = 'aarch64'
1067 EFI_MACHINE_TYPE_NAME = ''
1071 conf.set('ENABLE_EFI', true)
1072 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1074 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1077 #####################################################################
1079 config_h = configure_file(
1080 output : 'config.h',
1081 configuration : conf)
1083 includes = include_directories('src/basic',
1093 'src/libsystemd/sd-bus',
1094 'src/libsystemd/sd-device',
1095 'src/libsystemd/sd-hwdb',
1096 'src/libsystemd/sd-id128',
1097 'src/libsystemd/sd-netlink',
1098 'src/libsystemd/sd-network',
1099 'src/libsystemd-network',
1103 add_project_arguments('-include', 'config.h', language : 'c')
1105 gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1106 'src/shared/gcrypt-util.c')
1110 subdir('src/systemd')
1112 subdir('src/libsystemd')
1113 subdir('src/libsystemd-network')
1114 subdir('src/journal')
1117 libjournal_core = static_library(
1119 libjournal_core_sources,
1121 include_directories : includes,
1124 libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1125 libsystemd = shared_library(
1127 libsystemd_internal_sources,
1128 journal_internal_sources,
1130 include_directories : includes,
1131 link_args : ['-shared',
1132 '-Wl,--version-script=' + libsystemd_sym_path],
1133 link_with : [libbasic],
1134 dependencies : [threads,
1139 link_depends : libsystemd_sym,
1141 install_dir : rootlibdir)
1143 ############################################################
1145 # binaries that have --help and are intended for use by humans,
1146 # usually, but not always, installed in /bin.
1147 public_programs = []
1149 subdir('src/libudev')
1150 subdir('src/shared')
1153 subdir('src/network')
1155 subdir('src/analyze')
1156 subdir('src/journal-remote')
1157 subdir('src/coredump')
1158 subdir('src/hostname')
1159 subdir('src/import')
1160 subdir('src/kernel-install')
1161 subdir('src/locale')
1162 subdir('src/machine')
1163 subdir('src/nspawn')
1164 subdir('src/resolve')
1165 subdir('src/timedate')
1166 subdir('src/timesync')
1167 subdir('src/vconsole')
1168 subdir('src/sulogin-shell')
1169 subdir('src/boot/efi')
1174 ############################################################
1176 # only static linking apart from libdl, to make sure that the
1177 # module is linked to all libraries that it uses.
1178 test_dlopen = executable(
1181 include_directories : includes,
1182 link_with : [libbasic],
1183 dependencies : [libdl])
1185 foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
1186 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1187 ['mymachines', 'ENABLE_MACHINED'],
1188 ['resolve', 'ENABLE_RESOLVED']]
1190 condition = tuple[1] == '' or conf.get(tuple[1], false)
1194 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1195 version_script_arg = join_paths(meson.current_source_dir(), sym)
1197 nss = shared_library(
1199 'src/nss-@0@/nss-@0@.c'.format(module),
1201 include_directories : includes,
1202 link_args : ['-shared',
1203 '-Wl,--version-script=' + version_script_arg,
1205 link_with : [libsystemd_internal,
1207 dependencies : [threads,
1211 install_dir : rootlibdir)
1213 # We cannot use shared_module because it does not support version suffix.
1214 # Unfortunately shared_library insists on creating the symlink…
1215 meson.add_install_script('sh', '-c',
1216 'rm $DESTDIR@0@/libnss_@1@.so'
1217 .format(rootlibdir, module))
1219 test('dlopen-nss_' + module,
1221 args : [nss.full_path()]) # path to dlopen must include a slash
1225 ############################################################
1227 executable('systemd',
1229 include_directories : includes,
1230 link_with : [libcore,
1232 dependencies : [threads,
1238 install_rpath : rootlibexecdir,
1240 install_dir : rootlibexecdir)
1242 exe = executable('systemd-analyze',
1243 systemd_analyze_sources,
1244 include_directories : includes,
1245 link_with : [libcore,
1247 dependencies : [threads,
1253 install_rpath : rootlibexecdir,
1255 public_programs += [exe]
1257 executable('systemd-journald',
1258 systemd_journald_sources,
1259 include_directories : includes,
1260 link_with : [libjournal_core,
1262 dependencies : [threads,
1266 install_rpath : rootlibexecdir,
1268 install_dir : rootlibexecdir)
1270 exe = executable('systemd-cat',
1271 systemd_cat_sources,
1272 include_directories : includes,
1273 link_with : [libjournal_core,
1275 dependencies : [threads],
1276 install_rpath : rootlibexecdir,
1278 public_programs += [exe]
1280 exe = executable('journalctl',
1282 include_directories : includes,
1283 link_with : [libshared],
1284 dependencies : [threads,
1288 install_rpath : rootlibexecdir,
1290 install_dir : rootbindir)
1291 public_programs += [exe]
1293 executable('systemd-getty-generator',
1294 'src/getty-generator/getty-generator.c',
1295 include_directories : includes,
1296 link_with : [libshared],
1297 install_rpath : rootlibexecdir,
1299 install_dir : systemgeneratordir)
1301 executable('systemd-debug-generator',
1302 'src/debug-generator/debug-generator.c',
1303 include_directories : includes,
1304 link_with : [libshared],
1305 install_rpath : rootlibexecdir,
1307 install_dir : systemgeneratordir)
1309 executable('systemd-fstab-generator',
1310 'src/fstab-generator/fstab-generator.c',
1311 'src/core/mount-setup.c',
1312 include_directories : includes,
1313 link_with : [libshared],
1314 install_rpath : rootlibexecdir,
1316 install_dir : systemgeneratordir)
1318 if conf.get('ENABLE_ENVIRONMENT_D', false)
1319 executable('30-systemd-environment-d-generator',
1320 'src/environment-d-generator/environment-d-generator.c',
1321 include_directories : includes,
1322 link_with : [libshared],
1323 install_rpath : rootlibexecdir,
1325 install_dir : userenvgeneratordir)
1327 meson.add_install_script(meson_make_symlink,
1328 join_paths(sysconfdir, 'environment'),
1329 join_paths(environmentdir, '99-environment.conf'))
1332 if conf.get('ENABLE_HIBERNATE', false)
1333 executable('systemd-hibernate-resume-generator',
1334 'src/hibernate-resume/hibernate-resume-generator.c',
1335 include_directories : includes,
1336 link_with : [libshared],
1337 install_rpath : rootlibexecdir,
1339 install_dir : systemgeneratordir)
1341 executable('systemd-hibernate-resume',
1342 'src/hibernate-resume/hibernate-resume.c',
1343 include_directories : includes,
1344 link_with : [libshared],
1345 install_rpath : rootlibexecdir,
1347 install_dir : rootlibexecdir)
1350 if conf.get('HAVE_BLKID', false)
1351 executable('systemd-gpt-auto-generator',
1352 'src/gpt-auto-generator/gpt-auto-generator.c',
1353 'src/basic/blkid-util.h',
1354 include_directories : includes,
1355 link_with : [libshared],
1356 dependencies : libblkid,
1357 install_rpath : rootlibexecdir,
1359 install_dir : systemgeneratordir)
1361 exe = executable('systemd-dissect',
1362 'src/dissect/dissect.c',
1363 include_directories : includes,
1364 link_with : [libshared],
1365 install_rpath : rootlibexecdir,
1367 install_dir : rootlibexecdir)
1368 public_programs += [exe]
1371 if conf.get('ENABLE_RESOLVED', false)
1372 executable('systemd-resolved',
1373 systemd_resolved_sources,
1374 gcrypt_util_sources,
1375 include_directories : includes,
1376 link_with : [libshared],
1377 dependencies : [threads,
1382 install_rpath : rootlibexecdir,
1384 install_dir : rootlibexecdir)
1386 exe = executable('systemd-resolve',
1387 systemd_resolve_sources,
1388 gcrypt_util_sources,
1389 include_directories : includes,
1390 link_with : [libshared],
1391 dependencies : [threads,
1396 install_rpath : rootlibexecdir,
1398 public_programs += [exe]
1401 if conf.get('ENABLE_LOGIND', false)
1402 executable('systemd-logind',
1403 systemd_logind_sources,
1404 include_directories : includes,
1405 link_with : [liblogind_core,
1407 dependencies : [threads,
1409 install_rpath : rootlibexecdir,
1411 install_dir : rootlibexecdir)
1413 exe = executable('loginctl',
1415 include_directories : includes,
1416 link_with : [libshared],
1417 dependencies : [threads,
1420 install_rpath : rootlibexecdir,
1422 install_dir : rootbindir)
1423 public_programs += [exe]
1425 exe = executable('systemd-inhibit',
1426 'src/login/inhibit.c',
1427 include_directories : includes,
1428 link_with : [libshared],
1429 install_rpath : rootlibexecdir,
1431 install_dir : rootbindir)
1432 public_programs += [exe]
1434 if conf.get('HAVE_PAM', false)
1435 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1436 pam_systemd = shared_library(
1440 include_directories : includes,
1441 link_args : ['-shared',
1442 '-Wl,--version-script=' + version_script_arg],
1443 link_with : [libsystemd_internal,
1445 dependencies : [threads,
1448 link_depends : pam_systemd_sym,
1450 install_dir : pamlibdir)
1452 test('dlopen-pam_systemd',
1454 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1458 if conf.get('HAVE_PAM', false)
1459 executable('systemd-user-sessions',
1460 'src/user-sessions/user-sessions.c',
1461 include_directories : includes,
1462 link_with : [libshared],
1463 install_rpath : rootlibexecdir,
1465 install_dir : rootlibexecdir)
1468 if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
1469 exe = executable('bootctl',
1470 'src/boot/bootctl.c',
1471 include_directories : includes,
1472 link_with : [libshared],
1473 dependencies : [libblkid],
1474 install_rpath : rootlibexecdir,
1476 public_programs += [exe]
1479 exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1480 include_directories : includes,
1481 link_with : [libshared],
1482 dependencies : [threads],
1483 install_rpath : rootlibexecdir,
1485 public_programs += [exe]
1487 exe = executable('systemctl', 'src/systemctl/systemctl.c',
1488 include_directories : includes,
1489 link_with : [libshared],
1490 dependencies : [threads,
1495 install_rpath : rootlibexecdir,
1497 install_dir : rootbindir)
1498 public_programs += [exe]
1500 if conf.get('ENABLE_BACKLIGHT', false)
1501 executable('systemd-backlight',
1502 'src/backlight/backlight.c',
1503 include_directories : includes,
1504 link_with : [libshared],
1505 install_rpath : rootlibexecdir,
1507 install_dir : rootlibexecdir)
1510 if conf.get('ENABLE_RFKILL', false)
1511 executable('systemd-rfkill',
1512 'src/rfkill/rfkill.c',
1513 include_directories : includes,
1514 link_with : [libshared],
1515 install_rpath : rootlibexecdir,
1517 install_dir : rootlibexecdir)
1520 executable('systemd-system-update-generator',
1521 'src/system-update-generator/system-update-generator.c',
1522 include_directories : includes,
1523 link_with : [libshared],
1524 install_rpath : rootlibexecdir,
1526 install_dir : systemgeneratordir)
1528 if conf.get('HAVE_LIBCRYPTSETUP', false)
1529 executable('systemd-cryptsetup',
1530 'src/cryptsetup/cryptsetup.c',
1531 include_directories : includes,
1532 link_with : [libshared],
1533 dependencies : [libcryptsetup],
1534 install_rpath : rootlibexecdir,
1536 install_dir : rootlibexecdir)
1538 executable('systemd-cryptsetup-generator',
1539 'src/cryptsetup/cryptsetup-generator.c',
1540 include_directories : includes,
1541 link_with : [libshared],
1542 dependencies : [libcryptsetup],
1543 install_rpath : rootlibexecdir,
1545 install_dir : systemgeneratordir)
1547 executable('systemd-veritysetup',
1548 'src/veritysetup/veritysetup.c',
1549 include_directories : includes,
1550 link_with : [libshared],
1551 dependencies : [libcryptsetup],
1552 install_rpath : rootlibexecdir,
1554 install_dir : rootlibexecdir)
1556 executable('systemd-veritysetup-generator',
1557 'src/veritysetup/veritysetup-generator.c',
1558 include_directories : includes,
1559 link_with : [libshared],
1560 dependencies : [libcryptsetup],
1561 install_rpath : rootlibexecdir,
1563 install_dir : systemgeneratordir)
1566 if conf.get('HAVE_SYSV_COMPAT', false)
1567 executable('systemd-sysv-generator',
1568 'src/sysv-generator/sysv-generator.c',
1569 include_directories : includes,
1570 link_with : [libshared],
1571 install_rpath : rootlibexecdir,
1573 install_dir : systemgeneratordir)
1575 executable('systemd-rc-local-generator',
1576 'src/rc-local-generator/rc-local-generator.c',
1577 include_directories : includes,
1578 link_with : [libshared],
1579 install_rpath : rootlibexecdir,
1581 install_dir : systemgeneratordir)
1584 if conf.get('ENABLE_HOSTNAMED', false)
1585 executable('systemd-hostnamed',
1586 'src/hostname/hostnamed.c',
1587 include_directories : includes,
1588 link_with : [libshared],
1589 install_rpath : rootlibexecdir,
1591 install_dir : rootlibexecdir)
1593 exe = executable('hostnamectl',
1594 'src/hostname/hostnamectl.c',
1595 include_directories : includes,
1596 link_with : [libshared],
1597 install_rpath : rootlibexecdir,
1599 public_programs += [exe]
1602 if conf.get('ENABLE_LOCALED', false)
1603 if conf.get('HAVE_XKBCOMMON', false)
1604 # logind will load libxkbcommon.so dynamically on its own
1610 executable('systemd-localed',
1611 systemd_localed_sources,
1612 include_directories : includes,
1613 link_with : [libshared],
1614 dependencies : deps,
1615 install_rpath : rootlibexecdir,
1617 install_dir : rootlibexecdir)
1619 exe = executable('localectl',
1621 include_directories : includes,
1622 link_with : [libshared],
1623 install_rpath : rootlibexecdir,
1625 public_programs += [exe]
1628 if conf.get('ENABLE_TIMEDATED', false)
1629 executable('systemd-timedated',
1630 'src/timedate/timedated.c',
1631 include_directories : includes,
1632 link_with : [libshared],
1633 install_rpath : rootlibexecdir,
1635 install_dir : rootlibexecdir)
1637 exe = executable('timedatectl',
1638 'src/timedate/timedatectl.c',
1639 include_directories : includes,
1640 install_rpath : rootlibexecdir,
1641 link_with : [libshared],
1643 public_programs += [exe]
1646 if conf.get('ENABLE_TIMESYNCD', false)
1647 executable('systemd-timesyncd',
1648 systemd_timesyncd_sources,
1649 include_directories : includes,
1650 link_with : [libshared],
1651 dependencies : [threads,
1653 install_rpath : rootlibexecdir,
1655 install_dir : rootlibexecdir)
1658 if conf.get('ENABLE_MACHINED', false)
1659 executable('systemd-machined',
1660 systemd_machined_sources,
1661 include_directories : includes,
1662 link_with : [libmachine_core,
1664 install_rpath : rootlibexecdir,
1666 install_dir : rootlibexecdir)
1668 exe = executable('machinectl',
1669 'src/machine/machinectl.c',
1670 include_directories : includes,
1671 link_with : [libshared],
1672 dependencies : [threads,
1675 install_rpath : rootlibexecdir,
1677 install_dir : rootbindir)
1678 public_programs += [exe]
1681 if conf.get('ENABLE_IMPORTD', false)
1682 executable('systemd-importd',
1683 systemd_importd_sources,
1684 include_directories : includes,
1685 link_with : [libshared],
1686 dependencies : [threads],
1687 install_rpath : rootlibexecdir,
1689 install_dir : rootlibexecdir)
1691 systemd_pull = executable('systemd-pull',
1692 systemd_pull_sources,
1693 include_directories : includes,
1694 link_with : [libshared],
1695 dependencies : [libcurl,
1700 install_rpath : rootlibexecdir,
1702 install_dir : rootlibexecdir)
1704 systemd_import = executable('systemd-import',
1705 systemd_import_sources,
1706 include_directories : includes,
1707 link_with : [libshared],
1708 dependencies : [libcurl,
1712 install_rpath : rootlibexecdir,
1714 install_dir : rootlibexecdir)
1716 systemd_export = executable('systemd-export',
1717 systemd_export_sources,
1718 include_directories : includes,
1719 link_with : [libshared],
1720 dependencies : [libcurl,
1724 install_rpath : rootlibexecdir,
1726 install_dir : rootlibexecdir)
1727 public_programs += [systemd_pull, systemd_import, systemd_export]
1730 if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
1731 exe = executable('systemd-journal-upload',
1732 systemd_journal_upload_sources,
1733 include_directories : includes,
1734 link_with : [libshared],
1735 dependencies : [threads,
1740 install_rpath : rootlibexecdir,
1742 install_dir : rootlibexecdir)
1743 public_programs += [exe]
1746 if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
1747 s_j_remote = executable('systemd-journal-remote',
1748 systemd_journal_remote_sources,
1749 include_directories : includes,
1750 link_with : [libshared],
1751 dependencies : [threads,
1756 install_rpath : rootlibexecdir,
1758 install_dir : rootlibexecdir)
1760 s_j_gatewayd = executable('systemd-journal-gatewayd',
1761 systemd_journal_gatewayd_sources,
1762 include_directories : includes,
1763 link_with : [libshared],
1764 dependencies : [threads,
1769 install_rpath : rootlibexecdir,
1771 install_dir : rootlibexecdir)
1772 public_programs += [s_j_remote, s_j_gatewayd]
1775 if conf.get('ENABLE_COREDUMP', false)
1776 executable('systemd-coredump',
1777 systemd_coredump_sources,
1778 include_directories : includes,
1779 link_with : [libshared],
1780 dependencies : [threads,
1785 install_rpath : rootlibexecdir,
1787 install_dir : rootlibexecdir)
1789 exe = executable('coredumpctl',
1790 coredumpctl_sources,
1791 include_directories : includes,
1792 link_with : [libshared],
1793 dependencies : [threads,
1796 install_rpath : rootlibexecdir,
1798 public_programs += [exe]
1801 if conf.get('ENABLE_BINFMT', false)
1802 exe = executable('systemd-binfmt',
1803 'src/binfmt/binfmt.c',
1804 include_directories : includes,
1805 link_with : [libshared],
1806 install_rpath : rootlibexecdir,
1808 install_dir : rootlibexecdir)
1809 public_programs += [exe]
1811 meson.add_install_script('sh', '-c',
1812 mkdir_p.format(binfmtdir))
1813 meson.add_install_script('sh', '-c',
1814 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1817 if conf.get('ENABLE_VCONSOLE', false)
1818 executable('systemd-vconsole-setup',
1819 'src/vconsole/vconsole-setup.c',
1820 include_directories : includes,
1821 link_with : [libshared],
1822 install_rpath : rootlibexecdir,
1824 install_dir : rootlibexecdir)
1827 if conf.get('ENABLE_RANDOMSEED', false)
1828 executable('systemd-random-seed',
1829 'src/random-seed/random-seed.c',
1830 include_directories : includes,
1831 link_with : [libshared],
1832 install_rpath : rootlibexecdir,
1834 install_dir : rootlibexecdir)
1837 if conf.get('ENABLE_FIRSTBOOT', false)
1838 executable('systemd-firstboot',
1839 'src/firstboot/firstboot.c',
1840 include_directories : includes,
1841 link_with : [libshared],
1842 dependencies : [libcrypt],
1843 install_rpath : rootlibexecdir,
1845 install_dir : rootbindir)
1848 executable('systemd-remount-fs',
1849 'src/remount-fs/remount-fs.c',
1850 'src/core/mount-setup.c',
1851 'src/core/mount-setup.h',
1852 include_directories : includes,
1853 link_with : [libshared],
1854 install_rpath : rootlibexecdir,
1856 install_dir : rootlibexecdir)
1858 executable('systemd-machine-id-setup',
1859 'src/machine-id-setup/machine-id-setup-main.c',
1860 'src/core/machine-id-setup.c',
1861 'src/core/machine-id-setup.h',
1862 include_directories : includes,
1863 link_with : [libshared],
1864 install_rpath : rootlibexecdir,
1866 install_dir : rootbindir)
1868 executable('systemd-fsck',
1870 include_directories : includes,
1871 link_with : [libshared],
1872 install_rpath : rootlibexecdir,
1874 install_dir : rootlibexecdir)
1876 executable('systemd-sleep',
1877 'src/sleep/sleep.c',
1878 include_directories : includes,
1879 link_with : [libshared],
1880 install_rpath : rootlibexecdir,
1882 install_dir : rootlibexecdir)
1884 exe = executable('systemd-sysctl',
1885 'src/sysctl/sysctl.c',
1886 include_directories : includes,
1887 link_with : [libshared],
1888 install_rpath : rootlibexecdir,
1890 install_dir : rootlibexecdir)
1891 public_programs += [exe]
1893 executable('systemd-ac-power',
1894 'src/ac-power/ac-power.c',
1895 include_directories : includes,
1896 link_with : [libshared],
1897 install_rpath : rootlibexecdir,
1899 install_dir : rootlibexecdir)
1901 exe = executable('systemd-detect-virt',
1902 'src/detect-virt/detect-virt.c',
1903 include_directories : includes,
1904 link_with : [libshared],
1905 install_rpath : rootlibexecdir,
1907 public_programs += [exe]
1909 exe = executable('systemd-delta',
1910 'src/delta/delta.c',
1911 include_directories : includes,
1912 link_with : [libshared],
1913 install_rpath : rootlibexecdir,
1915 public_programs += [exe]
1917 exe = executable('systemd-escape',
1918 'src/escape/escape.c',
1919 include_directories : includes,
1920 link_with : [libshared],
1921 install_rpath : rootlibexecdir,
1923 install_dir : rootbindir)
1924 public_programs += [exe]
1926 exe = executable('systemd-notify',
1927 'src/notify/notify.c',
1928 include_directories : includes,
1929 link_with : [libshared],
1930 install_rpath : rootlibexecdir,
1932 install_dir : rootbindir)
1933 public_programs += [exe]
1935 executable('systemd-volatile-root',
1936 'src/volatile-root/volatile-root.c',
1937 include_directories : includes,
1938 link_with : [libshared],
1939 install_rpath : rootlibexecdir,
1941 install_dir : rootlibexecdir)
1943 executable('systemd-cgroups-agent',
1944 'src/cgroups-agent/cgroups-agent.c',
1945 include_directories : includes,
1946 link_with : [libshared],
1947 install_rpath : rootlibexecdir,
1949 install_dir : rootlibexecdir)
1951 exe = executable('systemd-path',
1953 include_directories : includes,
1954 link_with : [libshared],
1955 install_rpath : rootlibexecdir,
1957 public_programs += [exe]
1959 exe = executable('systemd-ask-password',
1960 'src/ask-password/ask-password.c',
1961 include_directories : includes,
1962 link_with : [libshared],
1963 install_rpath : rootlibexecdir,
1965 install_dir : rootbindir)
1966 public_programs += [exe]
1968 executable('systemd-reply-password',
1969 'src/reply-password/reply-password.c',
1970 include_directories : includes,
1971 link_with : [libshared],
1972 install_rpath : rootlibexecdir,
1974 install_dir : rootlibexecdir)
1976 exe = executable('systemd-tty-ask-password-agent',
1977 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1978 include_directories : includes,
1979 link_with : [libshared],
1980 install_rpath : rootlibexecdir,
1982 install_dir : rootbindir)
1983 public_programs += [exe]
1985 exe = executable('systemd-cgls',
1987 include_directories : includes,
1988 link_with : [libshared],
1989 install_rpath : rootlibexecdir,
1991 public_programs += [exe]
1993 exe = executable('systemd-cgtop',
1994 'src/cgtop/cgtop.c',
1995 include_directories : includes,
1996 link_with : [libshared],
1997 install_rpath : rootlibexecdir,
1999 public_programs += [exe]
2001 executable('systemd-initctl',
2002 'src/initctl/initctl.c',
2003 include_directories : includes,
2004 link_with : [libshared],
2005 install_rpath : rootlibexecdir,
2007 install_dir : rootlibexecdir)
2009 exe = executable('systemd-mount',
2010 'src/mount/mount-tool.c',
2011 include_directories : includes,
2012 link_with : [libshared],
2013 install_rpath : rootlibexecdir,
2015 public_programs += [exe]
2017 meson.add_install_script(meson_make_symlink,
2018 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2020 exe = executable('systemd-run',
2022 include_directories : includes,
2023 link_with : [libshared],
2024 install_rpath : rootlibexecdir,
2026 public_programs += [exe]
2028 exe = executable('systemd-stdio-bridge',
2029 'src/stdio-bridge/stdio-bridge.c',
2030 include_directories : includes,
2031 link_with : [libshared],
2032 install_rpath : rootlibexecdir,
2034 public_programs += [exe]
2036 exe = executable('busctl',
2037 'src/busctl/busctl.c',
2038 'src/busctl/busctl-introspect.c',
2039 'src/busctl/busctl-introspect.h',
2040 include_directories : includes,
2041 link_with : [libshared],
2042 install_rpath : rootlibexecdir,
2044 public_programs += [exe]
2046 if conf.get('ENABLE_SYSUSERS', false)
2047 exe = executable('systemd-sysusers',
2048 'src/sysusers/sysusers.c',
2049 include_directories : includes,
2050 link_with : [libshared],
2051 install_rpath : rootlibexecdir,
2053 install_dir : rootbindir)
2054 public_programs += [exe]
2057 if conf.get('ENABLE_TMPFILES', false)
2058 exe = executable('systemd-tmpfiles',
2059 'src/tmpfiles/tmpfiles.c',
2060 include_directories : includes,
2061 link_with : [libshared],
2062 dependencies : [libacl],
2063 install_rpath : rootlibexecdir,
2065 install_dir : rootbindir)
2066 public_programs += [exe]
2069 if conf.get('ENABLE_HWDB', false)
2070 exe = executable('systemd-hwdb',
2072 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2073 include_directories : includes,
2074 link_with : [libudev_internal],
2075 install_rpath : udev_rpath,
2077 install_dir : rootbindir)
2078 public_programs += [exe]
2081 if conf.get('ENABLE_QUOTACHECK', false)
2082 executable('systemd-quotacheck',
2083 'src/quotacheck/quotacheck.c',
2084 include_directories : includes,
2085 link_with : [libshared],
2086 install_rpath : rootlibexecdir,
2088 install_dir : rootlibexecdir)
2091 exe = executable('systemd-socket-proxyd',
2092 'src/socket-proxy/socket-proxyd.c',
2093 include_directories : includes,
2094 link_with : [libshared],
2095 dependencies : [threads],
2096 install_rpath : rootlibexecdir,
2098 install_dir : rootlibexecdir)
2099 public_programs += [exe]
2101 exe = executable('systemd-udevd',
2102 systemd_udevd_sources,
2103 include_directories : includes,
2104 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2105 link_with : [libudev_core,
2108 dependencies : [threads,
2113 install_rpath : udev_rpath,
2115 install_dir : rootlibexecdir)
2116 public_programs += [exe]
2118 exe = executable('udevadm',
2120 include_directories : includes,
2121 link_with : [libudev_core,
2124 dependencies : [threads,
2129 install_rpath : udev_rpath,
2131 install_dir : rootbindir)
2132 public_programs += [exe]
2134 executable('systemd-shutdown',
2135 systemd_shutdown_sources,
2136 include_directories : includes,
2137 link_with : [libshared],
2138 install_rpath : rootlibexecdir,
2140 install_dir : rootlibexecdir)
2142 executable('systemd-update-done',
2143 'src/update-done/update-done.c',
2144 include_directories : includes,
2145 link_with : [libshared],
2146 install_rpath : rootlibexecdir,
2148 install_dir : rootlibexecdir)
2150 executable('systemd-update-utmp',
2151 'src/update-utmp/update-utmp.c',
2152 include_directories : includes,
2153 link_with : [libshared],
2154 dependencies : [libaudit],
2155 install_rpath : rootlibexecdir,
2157 install_dir : rootlibexecdir)
2159 if conf.get('HAVE_KMOD', false)
2160 executable('systemd-modules-load',
2161 'src/modules-load/modules-load.c',
2162 include_directories : includes,
2163 link_with : [libshared],
2164 dependencies : [libkmod],
2165 install_rpath : rootlibexecdir,
2167 install_dir : rootlibexecdir)
2169 meson.add_install_script('sh', '-c',
2170 mkdir_p.format(modulesloaddir))
2171 meson.add_install_script('sh', '-c',
2172 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2175 exe = executable('systemd-nspawn',
2176 systemd_nspawn_sources,
2177 'src/core/mount-setup.c', # FIXME: use a variable?
2178 'src/core/mount-setup.h',
2179 'src/core/loopback-setup.c',
2180 'src/core/loopback-setup.h',
2181 include_directories : [includes, include_directories('src/nspawn')],
2182 link_with : [libshared],
2183 dependencies : [libacl,
2187 install_rpath : rootlibexecdir,
2189 public_programs += [exe]
2191 if conf.get('ENABLE_NETWORKD', false)
2192 executable('systemd-networkd',
2193 systemd_networkd_sources,
2194 include_directories : includes,
2195 link_with : [libnetworkd_core,
2199 dependencies : [threads],
2200 install_rpath : rootlibexecdir,
2202 install_dir : rootlibexecdir)
2204 executable('systemd-networkd-wait-online',
2205 systemd_networkd_wait_online_sources,
2206 include_directories : includes,
2207 link_with : [libnetworkd_core,
2209 install_rpath : rootlibexecdir,
2211 install_dir : rootlibexecdir)
2213 exe = executable('networkctl',
2215 include_directories : includes,
2216 link_with : [libsystemd_network,
2218 install_rpath : rootlibexecdir,
2220 install_dir : rootbindir)
2221 public_programs += [exe]
2223 ############################################################
2225 foreach tuple : tests
2227 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2228 dependencies = tuple[2]
2229 condition = tuple.length() >= 4 ? tuple[3] : ''
2230 type = tuple.length() >= 5 ? tuple[4] : ''
2231 defs = tuple.length() >= 6 ? tuple[5] : []
2232 incs = tuple.length() >= 7 ? tuple[6] : includes
2235 name = sources[0].split('/')[-1].split('.')[0]
2236 if type.startswith('timeout=')
2237 timeout = type.split('=')[1].to_int()
2241 if condition == '' or conf.get(condition, false)
2245 include_directories : incs,
2246 link_with : link_with,
2247 dependencies : dependencies,
2249 install_rpath : rootlibexecdir,
2250 install : install_tests,
2251 install_dir : join_paths(testsdir, type))
2254 message('@0@ is a manual test'.format(name))
2255 elif type == 'unsafe' and want_tests != 'unsafe'
2256 message('@0@ is an unsafe test'.format(name))
2263 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2267 test_libsystemd_sym = executable(
2268 'test-libsystemd-sym',
2269 test_libsystemd_sym_c,
2270 include_directories : includes,
2271 link_with : [libsystemd],
2272 install : install_tests,
2273 install_dir : testsdir)
2274 test('test-libsystemd-sym',
2275 test_libsystemd_sym)
2277 test_libudev_sym = executable(
2280 include_directories : includes,
2281 c_args : ['-Wno-deprecated-declarations'],
2282 link_with : [libudev],
2283 install : install_tests,
2284 install_dir : testsdir)
2285 test('test-libudev-sym',
2288 ############################################################
2290 make_directive_index_py = find_program('tools/make-directive-index.py')
2291 make_man_index_py = find_program('tools/make-man-index.py')
2292 xml_helper_py = find_program('tools/xml_helper.py')
2293 hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2297 subdir('sysusers.d')
2298 subdir('tmpfiles.d')
2303 subdir('shell-completion/bash')
2304 subdir('shell-completion/zsh')
2305 subdir('docs/sysvinit')
2306 subdir('docs/var-log')
2308 # FIXME: figure out if the warning is true:
2309 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2310 install_subdir('factory/etc',
2311 install_dir : factorydir)
2314 install_data('xorg/50-systemd-user.sh',
2315 install_dir : xinitrcdir)
2316 install_data('system-preset/90-systemd.preset',
2317 install_dir : systempresetdir)
2318 install_data('modprobe.d/systemd.conf',
2319 install_dir : modprobedir)
2320 install_data('README',
2327 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2328 install_dir : docdir)
2330 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2331 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2333 ############################################################
2335 meson_check_help = find_program('tools/meson-check-help.sh')
2337 foreach exec : public_programs
2338 name = exec.full_path().split('/')[-1]
2339 test('check-help-' + name,
2341 args : [exec.full_path()])
2344 ############################################################
2347 all_files = run_command(
2349 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2352 all_files = files(all_files.stdout().split())
2357 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2361 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2365 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2368 command : [meson_git_contrib_sh])
2372 git_head = run_command(
2374 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2375 'rev-parse', 'HEAD']).stdout().strip()
2376 git_head_short = run_command(
2378 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2379 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2383 command : ['git', 'archive',
2384 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2386 '--prefix', 'systemd-@0@/'.format(git_head),
2390 ############################################################
2393 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2395 'prefix: @0@'.format(prefixdir),
2396 'rootprefix: @0@'.format(rootprefixdir),
2397 'sysconf dir: @0@'.format(sysconfdir),
2398 'includedir: @0@'.format(includedir),
2399 'lib dir: @0@'.format(libdir),
2400 'rootlib dir: @0@'.format(rootlibdir),
2401 'SysV init scripts: @0@'.format(sysvinit_path),
2402 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2403 'PAM modules dir: @0@'.format(pamlibdir),
2404 'PAM configuration dir: @0@'.format(pamconfdir),
2405 'RPM macros dir: @0@'.format(rpmmacrosdir),
2406 'modprobe.d dir: @0@'.format(modprobedir),
2407 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2408 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2409 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2410 'bash completions dir: @0@'.format(bashcompletiondir),
2411 'zsh completions dir: @0@'.format(zshcompletiondir),
2412 'extra start script: @0@'.format(get_option('rc-local')),
2413 'extra stop script: @0@'.format(get_option('halt-local')),
2414 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2415 get_option('debug-tty')),
2416 'TTY GID: @0@'.format(tty_gid),
2417 'maximum system UID: @0@'.format(system_uid_max),
2418 'maximum system GID: @0@'.format(system_gid_max),
2419 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2420 'certificate root: @0@'.format(get_option('certificate-root')),
2421 'support URL: @0@'.format(support_url),
2422 'nobody user name: @0@'.format(get_option('nobody-user')),
2423 'nobody group name: @0@'.format(get_option('nobody-group')),
2424 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2425 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
2427 'default DNSSEC mode: @0@'.format(default_dnssec),
2428 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2429 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2431 alt_dns_servers = '\n '.join(dns_servers.split(' '))
2432 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2434 'default DNS servers: @0@'.format(alt_dns_servers),
2435 'default NTP servers: @0@'.format(alt_ntp_servers)]
2437 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2438 '@@0@'.format(time_epoch)).stdout().strip()
2440 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2443 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2444 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2445 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2447 if conf.get('ENABLE_EFI', false)
2449 'efi arch: @0@'.format(efi_arch)]
2453 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2454 'EFI CC @0@'.format(efi_cc),
2455 'EFI libdir: @0@'.format(efi_libdir),
2456 'EFI ldsdir: @0@'.format(efi_ldsdir),
2457 'EFI includedir: @0@'.format(efi_incdir)]
2510 ['legacy pkla', install_polkit_pkla],
2512 ['gnu-efi', have_gnu_efi],
2518 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
2521 ['man pages', want_man],
2522 ['html pages', want_html],
2523 ['man page indices', want_man and have_lxml],
2524 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
2529 ['adm group', get_option('adm-group')],
2530 ['wheel group', get_option('wheel-group')],
2533 ['debug mmap cache'],
2536 cond = tuple.get(1, '')
2538 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2539 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2540 cond = conf.get(ident1, false) or conf.get(ident2, false)
2545 missing += [tuple[0]]
2551 'enabled features: @0@'.format(', '.join(found)),
2553 'disabled features: @0@'.format(', '.join(missing)),
2555 message('\n '.join(status))