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 if cc.has_argument('-W' + arg)
290 add_project_arguments('-Wno-' + arg, language : 'c')
296 #include <inttypes.h>
297 typedef uint64_t usec_t;
298 usec_t now(clockid_t clock);
303 ', name : '-Werror=shadow with local shadowing')
304 add_project_arguments('-Werror=shadow', language : 'c')
307 if cc.get_id() == 'clang'
308 foreach arg : ['-Wno-typedef-redefinition',
309 '-Wno-gnu-variable-sized-type-not-at-end',
311 if cc.has_argument(arg,
312 name : '@0@ is supported'.format(arg))
313 add_project_arguments(arg, language : 'c')
318 link_test_c = files('tools/meson-link-test.c')
320 # --as-needed and --no-undefined are provided by meson by default,
321 # run mesonconf to see what is enabled
322 foreach arg : ['-Wl,-z,relro',
327 have = run_command(check_compilation_sh,
328 cc.cmd_array(), '-x', 'c', arg,
329 '-include', link_test_c).returncode() == 0
330 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
332 add_project_link_arguments(arg, language : 'c')
336 if get_option('buildtype') != 'debug'
337 foreach arg : ['-ffunction-sections',
339 if cc.has_argument(arg,
340 name : '@0@ is supported'.format(arg))
341 add_project_arguments(arg, language : 'c')
345 foreach arg : ['-Wl,--gc-sections']
346 have = run_command(check_compilation_sh,
347 cc.cmd_array(), '-x', 'c', arg,
348 '-include', link_test_c).returncode() == 0
349 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
351 add_project_link_arguments(arg, language : 'c')
356 cpp = ' '.join(cc.cmd_array()) + ' -E'
358 #####################################################################
359 # compilation result tests
361 conf.set('_GNU_SOURCE', true)
362 conf.set('__SANE_USERSPACE_TYPES__', true)
364 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
365 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
366 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
367 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
368 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
369 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
370 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
374 #include <linux/ethtool.h>
376 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
378 foreach decl : ['char16_t',
381 'struct ethtool_link_settings',
384 # We get -1 if the size cannot be determined
385 have = cc.sizeof(decl, prefix : decl_headers) > 0
386 conf.set('HAVE_' + decl.underscorify().to_upper(), have)
389 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
390 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
391 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
392 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
393 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
394 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
395 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
396 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
397 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
398 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
399 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
400 # if_tunnel.h is buggy and cannot be included on its own
401 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
402 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
403 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
404 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
405 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
406 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
407 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
408 ['NDA_IFINDEX', 'linux/neighbour.h'],
409 ['IFA_FLAGS', 'linux/if_addr.h'],
410 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
412 prefix = decl.length() > 2 ? decl[2] : ''
413 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
414 conf.set10('HAVE_DECL_' + decl[0], have)
418 foreach ident : ['secure_getenv', '__secure_getenv']
419 if not skip and cc.has_function(ident)
420 conf.set('HAVE_' + ident.to_upper(), true)
426 ['memfd_create', '''#include <sys/memfd.h>'''],
427 ['gettid', '''#include <sys/types.h>'''],
428 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
429 ['name_to_handle_at', '''#define _GNU_SOURCE
430 #include <sys/types.h>
431 #include <sys/stat.h>
432 #include <fcntl.h>'''],
433 ['setns', '''#define _GNU_SOURCE
434 #include <sched.h>'''],
435 ['renameat2', '''#include <stdio.h>'''],
436 ['kcmp', '''#include <linux/kcmp.h>'''],
437 ['keyctl', '''#include <sys/types.h>
438 #include <keyutils.h>'''],
439 ['copy_file_range', '''#include <sys/syscall.h>
440 #include <unistd.h>'''],
441 ['explicit_bzero' , '''#include <string.h>'''],
444 have = cc.has_function(ident[0], prefix : ident[1])
445 conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
448 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
449 conf.set('USE_SYS_RANDOM_H', true)
450 conf.set10('HAVE_DECL_GETRANDOM', true)
452 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
453 conf.set10('HAVE_DECL_GETRANDOM', have)
456 #####################################################################
458 sed = find_program('sed')
459 grep = find_program('grep')
460 awk = find_program('awk')
461 m4 = find_program('m4')
462 stat = find_program('stat')
463 git = find_program('git', required : false)
465 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
466 mkdir_p = 'mkdir -p $DESTDIR/@0@'
467 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
468 splash_bmp = files('test/splash.bmp')
470 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
471 # /usr/sbin, /sbin, and fall back to the default from middle column.
472 progs = [['telinit', '/lib/sysvinit/telinit'],
473 ['quotaon', '/usr/sbin/quotaon' ],
474 ['quotacheck', '/usr/sbin/quotacheck' ],
475 ['kill', '/usr/bin/kill' ],
476 ['kmod', '/usr/bin/kmod' ],
477 ['kexec', '/usr/sbin/kexec' ],
478 ['sulogin', '/usr/sbin/sulogin' ],
479 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
480 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
481 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
482 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
485 path = get_option(prog[0] + '-path')
487 message('Using @1@ for @0@'.format(prog[0], path))
489 exe = find_program(prog[0],
490 '/usr/sbin/' + prog[0],
493 path = exe.found() ? exe.path() : prog[1]
495 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
496 conf.set_quoted(name, path)
497 substs.set(name, path)
500 if run_command('ln', '--relative', '--help').returncode() != 0
501 error('ln does not support --relative')
504 ############################################################
506 gperf = find_program('gperf')
508 gperf_test_format = '''
510 const char * in_word_set(const char *, @0@);
513 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
514 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
515 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
516 if cc.compiles(gperf_test)
517 gperf_len_type = 'size_t'
519 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
520 if cc.compiles(gperf_test)
521 gperf_len_type = 'unsigned'
523 error('unable to determine gperf len type')
526 message('gperf len type is @0@'.format(gperf_len_type))
527 conf.set('GPERF_LEN_TYPE', gperf_len_type,
528 description : 'The type of gperf "len" parameter')
530 ############################################################
532 if not cc.has_header('sys/capability.h')
533 error('POSIX caps headers not found')
535 foreach header : ['linux/btrfs.h',
537 'linux/vm_sockets.h',
538 'valgrind/memcheck.h',
539 'valgrind/valgrind.h',
542 conf.set('HAVE_' + header.underscorify().to_upper(),
543 cc.has_header(header))
546 ############################################################
548 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
549 conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
550 gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
552 default_hierarchy = get_option('default-hierarchy')
553 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
554 description : 'default cgroup hierarchy as string')
555 if default_hierarchy == 'legacy'
556 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
557 elif default_hierarchy == 'hybrid'
558 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
560 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
563 time_epoch = get_option('time-epoch')
566 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
568 time_epoch = time_epoch.to_int()
569 conf.set('TIME_EPOCH', time_epoch)
571 system_uid_max = get_option('system-uid-max')
572 if system_uid_max == ''
573 system_uid_max = run_command(
575 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
576 '/etc/login.defs').stdout()
578 system_uid_max = system_uid_max.to_int()
579 conf.set('SYSTEM_UID_MAX', system_uid_max)
580 substs.set('systemuidmax', system_uid_max)
581 message('maximum system UID is @0@'.format(system_uid_max))
583 conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
584 conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
586 system_gid_max = get_option('system-gid-max')
587 if system_gid_max == ''
588 system_gid_max = run_command(
590 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
591 '/etc/login.defs').stdout()
593 system_gid_max = system_gid_max.to_int()
594 conf.set('SYSTEM_GID_MAX', system_gid_max)
595 substs.set('systemgidmax', system_gid_max)
596 message('maximum system GID is @0@'.format(system_gid_max))
598 tty_gid = get_option('tty-gid')
599 conf.set('TTY_GID', tty_gid)
600 substs.set('TTY_GID', tty_gid)
602 if get_option('adm-group')
603 m4_defines += ['-DENABLE_ADM_GROUP']
606 if get_option('wheel-group')
607 m4_defines += ['-DENABLE_WHEEL_GROUP']
610 substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
612 kill_user_processes = get_option('default-kill-user-processes')
613 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
614 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
616 dns_servers = get_option('dns-servers')
617 conf.set_quoted('DNS_SERVERS', dns_servers)
618 substs.set('DNS_SERVERS', dns_servers)
620 ntp_servers = get_option('ntp-servers')
621 conf.set_quoted('NTP_SERVERS', ntp_servers)
622 substs.set('NTP_SERVERS', ntp_servers)
624 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
626 substs.set('SUSHELL', get_option('debug-shell'))
627 substs.set('DEBUGTTY', get_option('debug-tty'))
629 debug = get_option('debug')
631 foreach name : debug.split(',')
633 conf.set('ENABLE_DEBUG_HASHMAP', true)
634 elif name == 'mmap-cache'
635 conf.set('ENABLE_DEBUG_MMAP_CACHE', true)
637 message('unknown debug option "@0@", ignoring'.format(name))
642 #####################################################################
644 threads = dependency('threads')
645 librt = cc.find_library('rt')
646 libm = cc.find_library('m')
647 libdl = cc.find_library('dl')
648 libcrypt = cc.find_library('crypt')
650 libcap = dependency('libcap', required : false)
651 if not libcap.found()
652 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
653 libcap = cc.find_library('cap')
656 libmount = dependency('mount',
659 want_seccomp = get_option('seccomp')
660 if want_seccomp != 'false'
661 libseccomp = dependency('libseccomp',
662 version : '>= 2.3.1',
663 required : want_seccomp == 'true')
664 if libseccomp.found()
665 conf.set('HAVE_SECCOMP', true)
666 m4_defines += ['-DHAVE_SECCOMP']
672 want_selinux = get_option('selinux')
673 if want_selinux != 'false'
674 libselinux = dependency('libselinux',
675 version : '>= 2.1.9',
676 required : want_selinux == 'true')
677 if libselinux.found()
678 conf.set('HAVE_SELINUX', true)
679 m4_defines += ['-DHAVE_SELINUX']
685 want_apparmor = get_option('apparmor')
686 if want_apparmor != 'false'
687 libapparmor = dependency('libapparmor',
688 required : want_apparmor == 'true')
689 if libapparmor.found()
690 conf.set('HAVE_APPARMOR', true)
691 m4_defines += ['-DHAVE_APPARMOR']
697 smack_run_label = get_option('smack-run-label')
698 if smack_run_label != ''
699 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
700 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
703 want_polkit = get_option('polkit')
704 install_polkit = false
705 install_polkit_pkla = false
706 if want_polkit != 'false'
707 conf.set('ENABLE_POLKIT', true)
708 install_polkit = true
710 libpolkit = dependency('polkit-gobject-1',
712 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
713 message('Old polkit detected, will install pkla files')
714 install_polkit_pkla = true
718 want_acl = get_option('acl')
719 if want_acl != 'false'
720 libacl = cc.find_library('acl', required : want_acl == 'true')
722 conf.set('HAVE_ACL', true)
723 m4_defines += ['-DHAVE_ACL']
729 want_audit = get_option('audit')
730 if want_audit != 'false'
731 libaudit = dependency('audit', required : want_audit == 'true')
732 conf.set('HAVE_AUDIT', libaudit.found())
737 want_blkid = get_option('blkid')
738 if want_blkid != 'false'
739 libblkid = dependency('blkid', required : want_blkid == 'true')
740 conf.set('HAVE_BLKID', libblkid.found())
745 want_kmod = get_option('kmod')
746 if want_kmod != 'false'
747 libkmod = dependency('libkmod',
749 required : want_kmod == 'true')
750 conf.set('HAVE_KMOD', libkmod.found())
755 want_pam = get_option('pam')
756 if want_pam != 'false'
757 libpam = cc.find_library('pam', required : want_pam == 'true')
758 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
759 if libpam.found() and libpam_misc.found()
760 conf.set('HAVE_PAM', true)
761 m4_defines += ['-DHAVE_PAM']
768 want_microhttpd = get_option('microhttpd')
769 if want_microhttpd != 'false'
770 libmicrohttpd = dependency('libmicrohttpd',
771 version : '>= 0.9.33',
772 required : want_microhttpd == 'true')
773 if libmicrohttpd.found()
774 conf.set('HAVE_MICROHTTPD', true)
775 m4_defines += ['-DHAVE_MICROHTTPD']
781 want_libcryptsetup = get_option('libcryptsetup')
782 if want_libcryptsetup != 'false'
783 libcryptsetup = dependency('libcryptsetup',
784 version : '>= 1.6.0',
785 required : want_libcryptsetup == 'true')
786 conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found())
791 want_libcurl = get_option('libcurl')
792 if want_libcurl != 'false'
793 libcurl = dependency('libcurl',
794 version : '>= 7.32.0',
795 required : want_libcurl == 'true')
797 conf.set('HAVE_LIBCURL', true)
798 m4_defines += ['-DHAVE_LIBCURL']
804 want_libidn = get_option('libidn')
805 want_libidn2 = get_option('libidn2')
806 if want_libidn == 'true' and want_libidn2 == 'true'
807 error('libidn and libidn2 cannot be requested simultaneously')
810 if want_libidn != 'false' and want_libidn2 != 'true'
811 libidn = dependency('libidn',
812 required : want_libidn == 'true')
814 conf.set('HAVE_LIBIDN', true)
815 m4_defines += ['-DHAVE_LIBIDN']
820 if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false'
821 # libidn is used for both libidn and libidn2 objects
822 libidn = dependency('libidn2',
823 required : want_libidn2 == 'true')
825 conf.set('HAVE_LIBIDN2', true)
826 m4_defines += ['-DHAVE_LIBIDN2']
830 want_libiptc = get_option('libiptc')
831 if want_libiptc != 'false'
832 libiptc = dependency('libiptc',
833 required : want_libiptc == 'true')
835 conf.set('HAVE_LIBIPTC', true)
836 m4_defines += ['-DHAVE_LIBIPTC']
842 want_qrencode = get_option('qrencode')
843 if want_qrencode != 'false'
844 libqrencode = dependency('libqrencode',
845 required : want_qrencode == 'true')
846 conf.set('HAVE_QRENCODE', libqrencode.found())
851 want_gcrypt = get_option('gcrypt')
852 if want_gcrypt != 'false'
853 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
854 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
856 have_deps = libgcrypt.found() and libgpg_error.found()
857 conf.set('HAVE_GCRYPT', have_deps)
859 # link to neither of the libs if one is not found
868 want_gnutls = get_option('gnutls')
869 if want_gnutls != 'false'
870 libgnutls = dependency('gnutls',
871 version : '>= 3.1.4',
872 required : want_gnutls == 'true')
873 conf.set('HAVE_GNUTLS', libgnutls.found())
878 want_elfutils = get_option('elfutils')
879 if want_elfutils != 'false'
880 libdw = dependency('libdw',
881 required : want_elfutils == 'true')
882 conf.set('HAVE_ELFUTILS', libdw.found())
887 want_zlib = get_option('zlib')
888 if want_zlib != 'false'
889 libz = dependency('zlib',
890 required : want_zlib == 'true')
891 conf.set('HAVE_ZLIB', libz.found())
896 want_bzip2 = get_option('bzip2')
897 if want_bzip2 != 'false'
898 libbzip2 = cc.find_library('bz2',
899 required : want_bzip2 == 'true')
900 conf.set('HAVE_BZIP2', libbzip2.found())
905 want_xz = get_option('xz')
906 if want_xz != 'false'
907 libxz = dependency('liblzma',
908 required : want_xz == 'true')
909 conf.set('HAVE_XZ', libxz.found())
914 want_lz4 = get_option('lz4')
915 if want_lz4 != 'false'
916 liblz4 = dependency('liblz4',
917 required : want_lz4 == 'true')
918 conf.set('HAVE_LZ4', liblz4.found())
923 want_xkbcommon = get_option('xkbcommon')
924 if want_xkbcommon != 'false'
925 libxkbcommon = dependency('xkbcommon',
926 version : '>= 0.3.0',
927 required : want_xkbcommon == 'true')
928 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
933 want_glib = get_option('glib')
934 if want_glib != 'false'
935 libglib = dependency('glib-2.0',
936 version : '>= 2.22.0',
937 required : want_glib == 'true')
938 libgobject = dependency('gobject-2.0',
939 version : '>= 2.22.0',
940 required : want_glib == 'true')
941 libgio = dependency('gio-2.0',
942 required : want_glib == 'true')
943 have = libglib.found() and libgobject.found() and libgio.found()
944 conf.set('HAVE_GLIB', have)
951 want_dbus = get_option('dbus')
952 if want_dbus != 'false'
953 libdbus = dependency('dbus-1',
954 version : '>= 1.3.2',
955 required : want_dbus == 'true')
956 conf.set('HAVE_DBUS', libdbus.found())
961 default_dnssec = get_option('default-dnssec')
962 if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false)
963 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
964 default_dnssec = 'no'
966 conf.set('DEFAULT_DNSSEC_MODE',
967 'DNSSEC_' + default_dnssec.underscorify().to_upper())
968 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
970 want_importd = get_option('importd')
971 if want_importd != 'false'
972 have_deps = (conf.get('HAVE_LIBCURL', false) and
973 conf.get('HAVE_ZLIB', false) and
974 conf.get('HAVE_BZIP2', false) and
975 conf.get('HAVE_XZ', false) and
976 conf.get('HAVE_GCRYPT', false))
977 conf.set('ENABLE_IMPORTD', have_deps)
978 if want_importd == 'true' and not have_deps
979 error('importd support was requested, but dependencies are not available')
983 want_remote = get_option('remote')
984 if want_remote != 'false'
985 have_deps = [conf.get('HAVE_MICROHTTPD', false),
986 conf.get('HAVE_LIBCURL', false)]
987 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
988 # it's possible to build one without the other. Complain only if
989 # support was explictly requested. The auxiliary files like sysusers
990 # config should be installed when any of the programs are built.
991 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
992 error('remote support was requested, but dependencies are not available')
994 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
997 foreach pair : [['utmp', 'HAVE_UTMP'],
998 ['hibernate', 'ENABLE_HIBERNATE'],
999 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
1000 ['binfmt', 'ENABLE_BINFMT'],
1001 ['coredump', 'ENABLE_COREDUMP'],
1002 ['resolve', 'ENABLE_RESOLVED'],
1003 ['logind', 'ENABLE_LOGIND'],
1004 ['hostnamed', 'ENABLE_HOSTNAMED'],
1005 ['localed', 'ENABLE_LOCALED'],
1006 ['machined', 'ENABLE_MACHINED'],
1007 ['networkd', 'ENABLE_NETWORKD'],
1008 ['timedated', 'ENABLE_TIMEDATED'],
1009 ['timesyncd', 'ENABLE_TIMESYNCD'],
1010 ['myhostname', 'HAVE_MYHOSTNAME'],
1011 ['firstboot', 'ENABLE_FIRSTBOOT'],
1012 ['randomseed', 'ENABLE_RANDOMSEED'],
1013 ['backlight', 'ENABLE_BACKLIGHT'],
1014 ['vconsole', 'ENABLE_VCONSOLE'],
1015 ['quotacheck', 'ENABLE_QUOTACHECK'],
1016 ['sysusers', 'ENABLE_SYSUSERS'],
1017 ['tmpfiles', 'ENABLE_TMPFILES'],
1018 ['hwdb', 'ENABLE_HWDB'],
1019 ['rfkill', 'ENABLE_RFKILL'],
1020 ['ldconfig', 'ENABLE_LDCONFIG'],
1021 ['efi', 'ENABLE_EFI'],
1022 ['tpm', 'ENABLE_TPM'],
1023 ['ima', 'HAVE_IMA'],
1024 ['smack', 'HAVE_SMACK'],
1025 ['gshadow', 'ENABLE_GSHADOW'],
1026 ['idn', 'ENABLE_IDN'],
1027 ['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
1030 if get_option(pair[0])
1031 conf.set(pair[1], true)
1032 m4_defines += ['-D' + pair[1]]
1036 want_tests = get_option('tests')
1037 install_tests = get_option('install-tests')
1040 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1042 #####################################################################
1044 if get_option('efi')
1045 efi_arch = host_machine.cpu_family()
1047 if efi_arch == 'x86'
1048 EFI_MACHINE_TYPE_NAME = 'ia32'
1049 gnu_efi_arch = 'ia32'
1050 elif efi_arch == 'x86_64'
1051 EFI_MACHINE_TYPE_NAME = 'x64'
1052 gnu_efi_arch = 'x86_64'
1053 elif efi_arch == 'arm'
1054 EFI_MACHINE_TYPE_NAME = 'arm'
1055 gnu_efi_arch = 'arm'
1056 elif efi_arch == 'aarch64'
1057 EFI_MACHINE_TYPE_NAME = 'aa64'
1058 gnu_efi_arch = 'aarch64'
1060 EFI_MACHINE_TYPE_NAME = ''
1064 conf.set('ENABLE_EFI', true)
1065 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1067 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1070 #####################################################################
1072 config_h = configure_file(
1073 output : 'config.h',
1074 configuration : conf)
1076 includes = include_directories('src/basic',
1086 'src/libsystemd/sd-bus',
1087 'src/libsystemd/sd-device',
1088 'src/libsystemd/sd-hwdb',
1089 'src/libsystemd/sd-id128',
1090 'src/libsystemd/sd-netlink',
1091 'src/libsystemd/sd-network',
1092 'src/libsystemd-network',
1096 add_project_arguments('-include', 'config.h', language : 'c')
1098 gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1099 'src/shared/gcrypt-util.c')
1103 subdir('src/systemd')
1105 subdir('src/libsystemd')
1106 subdir('src/libsystemd-network')
1107 subdir('src/journal')
1110 libjournal_core = static_library(
1112 libjournal_core_sources,
1114 include_directories : includes,
1117 libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1118 libsystemd = shared_library(
1120 libsystemd_internal_sources,
1121 journal_internal_sources,
1123 include_directories : includes,
1124 link_args : ['-shared',
1125 '-Wl,--version-script=' + libsystemd_sym_path],
1126 link_with : [libbasic],
1127 dependencies : [threads,
1132 link_depends : libsystemd_sym,
1134 install_dir : rootlibdir)
1136 ############################################################
1138 # binaries that have --help and are intended for use by humans,
1139 # usually, but not always, installed in /bin.
1140 public_programs = []
1142 subdir('src/libudev')
1143 subdir('src/shared')
1146 subdir('src/network')
1148 subdir('src/analyze')
1149 subdir('src/journal-remote')
1150 subdir('src/coredump')
1151 subdir('src/hostname')
1152 subdir('src/import')
1153 subdir('src/kernel-install')
1154 subdir('src/locale')
1155 subdir('src/machine')
1156 subdir('src/nspawn')
1157 subdir('src/resolve')
1158 subdir('src/timedate')
1159 subdir('src/timesync')
1160 subdir('src/vconsole')
1161 subdir('src/sulogin-shell')
1162 subdir('src/boot/efi')
1167 ############################################################
1169 # only static linking apart from libdl, to make sure that the
1170 # module is linked to all libraries that it uses.
1171 test_dlopen = executable(
1174 include_directories : includes,
1175 link_with : [libbasic],
1176 dependencies : [libdl])
1178 foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
1179 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1180 ['mymachines', 'ENABLE_MACHINED'],
1181 ['resolve', 'ENABLE_RESOLVED']]
1183 condition = tuple[1] == '' or conf.get(tuple[1], false)
1187 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1188 version_script_arg = join_paths(meson.current_source_dir(), sym)
1190 nss = shared_library(
1192 'src/nss-@0@/nss-@0@.c'.format(module),
1194 include_directories : includes,
1195 link_args : ['-shared',
1196 '-Wl,--version-script=' + version_script_arg,
1198 link_with : [libsystemd_internal,
1200 dependencies : [threads,
1204 install_dir : rootlibdir)
1206 # We cannot use shared_module because it does not support version suffix.
1207 # Unfortunately shared_library insists on creating the symlink…
1208 meson.add_install_script('sh', '-c',
1209 'rm $DESTDIR@0@/libnss_@1@.so'
1210 .format(rootlibdir, module))
1212 test('dlopen-nss_' + module,
1214 args : [nss.full_path()]) # path to dlopen must include a slash
1218 ############################################################
1220 executable('systemd',
1222 include_directories : includes,
1223 link_with : [libcore,
1225 dependencies : [threads,
1231 install_rpath : rootlibexecdir,
1233 install_dir : rootlibexecdir)
1235 exe = executable('systemd-analyze',
1236 systemd_analyze_sources,
1237 include_directories : includes,
1238 link_with : [libcore,
1240 dependencies : [threads,
1246 install_rpath : rootlibexecdir,
1248 public_programs += [exe]
1250 executable('systemd-journald',
1251 systemd_journald_sources,
1252 include_directories : includes,
1253 link_with : [libjournal_core,
1255 dependencies : [threads,
1259 install_rpath : rootlibexecdir,
1261 install_dir : rootlibexecdir)
1263 exe = executable('systemd-cat',
1264 systemd_cat_sources,
1265 include_directories : includes,
1266 link_with : [libjournal_core,
1268 dependencies : [threads],
1269 install_rpath : rootlibexecdir,
1271 public_programs += [exe]
1273 exe = executable('journalctl',
1275 include_directories : includes,
1276 link_with : [libshared],
1277 dependencies : [threads,
1281 install_rpath : rootlibexecdir,
1283 install_dir : rootbindir)
1284 public_programs += [exe]
1286 executable('systemd-getty-generator',
1287 'src/getty-generator/getty-generator.c',
1288 include_directories : includes,
1289 link_with : [libshared],
1290 install_rpath : rootlibexecdir,
1292 install_dir : systemgeneratordir)
1294 executable('systemd-debug-generator',
1295 'src/debug-generator/debug-generator.c',
1296 include_directories : includes,
1297 link_with : [libshared],
1298 install_rpath : rootlibexecdir,
1300 install_dir : systemgeneratordir)
1302 executable('systemd-fstab-generator',
1303 'src/fstab-generator/fstab-generator.c',
1304 'src/core/mount-setup.c',
1305 include_directories : includes,
1306 link_with : [libshared],
1307 install_rpath : rootlibexecdir,
1309 install_dir : systemgeneratordir)
1311 if conf.get('ENABLE_ENVIRONMENT_D', false)
1312 executable('30-systemd-environment-d-generator',
1313 'src/environment-d-generator/environment-d-generator.c',
1314 include_directories : includes,
1315 link_with : [libshared],
1316 install_rpath : rootlibexecdir,
1318 install_dir : userenvgeneratordir)
1320 meson.add_install_script(meson_make_symlink,
1321 join_paths(sysconfdir, 'environment'),
1322 join_paths(environmentdir, '99-environment.conf'))
1325 if conf.get('ENABLE_HIBERNATE', false)
1326 executable('systemd-hibernate-resume-generator',
1327 'src/hibernate-resume/hibernate-resume-generator.c',
1328 include_directories : includes,
1329 link_with : [libshared],
1330 install_rpath : rootlibexecdir,
1332 install_dir : systemgeneratordir)
1334 executable('systemd-hibernate-resume',
1335 'src/hibernate-resume/hibernate-resume.c',
1336 include_directories : includes,
1337 link_with : [libshared],
1338 install_rpath : rootlibexecdir,
1340 install_dir : rootlibexecdir)
1343 if conf.get('HAVE_BLKID', false)
1344 executable('systemd-gpt-auto-generator',
1345 'src/gpt-auto-generator/gpt-auto-generator.c',
1346 'src/basic/blkid-util.h',
1347 include_directories : includes,
1348 link_with : [libshared],
1349 dependencies : libblkid,
1350 install_rpath : rootlibexecdir,
1352 install_dir : systemgeneratordir)
1354 exe = executable('systemd-dissect',
1355 'src/dissect/dissect.c',
1356 include_directories : includes,
1357 link_with : [libshared],
1358 install_rpath : rootlibexecdir,
1360 install_dir : rootlibexecdir)
1361 public_programs += [exe]
1364 if conf.get('ENABLE_RESOLVED', false)
1365 executable('systemd-resolved',
1366 systemd_resolved_sources,
1367 gcrypt_util_sources,
1368 include_directories : includes,
1369 link_with : [libshared],
1370 dependencies : [threads,
1375 install_rpath : rootlibexecdir,
1377 install_dir : rootlibexecdir)
1379 exe = executable('systemd-resolve',
1380 systemd_resolve_sources,
1381 gcrypt_util_sources,
1382 include_directories : includes,
1383 link_with : [libshared],
1384 dependencies : [threads,
1389 install_rpath : rootlibexecdir,
1391 public_programs += [exe]
1394 if conf.get('ENABLE_LOGIND', false)
1395 executable('systemd-logind',
1396 systemd_logind_sources,
1397 include_directories : includes,
1398 link_with : [liblogind_core,
1400 dependencies : [threads,
1402 install_rpath : rootlibexecdir,
1404 install_dir : rootlibexecdir)
1406 exe = executable('loginctl',
1408 include_directories : includes,
1409 link_with : [libshared],
1410 dependencies : [threads,
1413 install_rpath : rootlibexecdir,
1415 install_dir : rootbindir)
1416 public_programs += [exe]
1418 exe = executable('systemd-inhibit',
1419 'src/login/inhibit.c',
1420 include_directories : includes,
1421 link_with : [libshared],
1422 install_rpath : rootlibexecdir,
1424 install_dir : rootbindir)
1425 public_programs += [exe]
1427 if conf.get('HAVE_PAM', false)
1428 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1429 pam_systemd = shared_library(
1433 include_directories : includes,
1434 link_args : ['-shared',
1435 '-Wl,--version-script=' + version_script_arg],
1436 link_with : [libsystemd_internal,
1438 dependencies : [threads,
1441 link_depends : pam_systemd_sym,
1443 install_dir : pamlibdir)
1445 test('dlopen-pam_systemd',
1447 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1451 if conf.get('HAVE_PAM', false)
1452 executable('systemd-user-sessions',
1453 'src/user-sessions/user-sessions.c',
1454 include_directories : includes,
1455 link_with : [libshared],
1456 install_rpath : rootlibexecdir,
1458 install_dir : rootlibexecdir)
1461 if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
1462 exe = executable('bootctl',
1463 'src/boot/bootctl.c',
1464 include_directories : includes,
1465 link_with : [libshared],
1466 dependencies : [libblkid],
1467 install_rpath : rootlibexecdir,
1469 public_programs += [exe]
1472 exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1473 include_directories : includes,
1474 link_with : [libshared],
1475 dependencies : [threads],
1476 install_rpath : rootlibexecdir,
1478 public_programs += [exe]
1480 exe = executable('systemctl', 'src/systemctl/systemctl.c',
1481 include_directories : includes,
1482 link_with : [libshared],
1483 dependencies : [threads,
1488 install_rpath : rootlibexecdir,
1490 install_dir : rootbindir)
1491 public_programs += [exe]
1493 if conf.get('ENABLE_BACKLIGHT', false)
1494 executable('systemd-backlight',
1495 'src/backlight/backlight.c',
1496 include_directories : includes,
1497 link_with : [libshared],
1498 install_rpath : rootlibexecdir,
1500 install_dir : rootlibexecdir)
1503 if conf.get('ENABLE_RFKILL', false)
1504 executable('systemd-rfkill',
1505 'src/rfkill/rfkill.c',
1506 include_directories : includes,
1507 link_with : [libshared],
1508 install_rpath : rootlibexecdir,
1510 install_dir : rootlibexecdir)
1513 executable('systemd-system-update-generator',
1514 'src/system-update-generator/system-update-generator.c',
1515 include_directories : includes,
1516 link_with : [libshared],
1517 install_rpath : rootlibexecdir,
1519 install_dir : systemgeneratordir)
1521 if conf.get('HAVE_LIBCRYPTSETUP', false)
1522 executable('systemd-cryptsetup',
1523 'src/cryptsetup/cryptsetup.c',
1524 include_directories : includes,
1525 link_with : [libshared],
1526 dependencies : [libcryptsetup],
1527 install_rpath : rootlibexecdir,
1529 install_dir : rootlibexecdir)
1531 executable('systemd-cryptsetup-generator',
1532 'src/cryptsetup/cryptsetup-generator.c',
1533 include_directories : includes,
1534 link_with : [libshared],
1535 dependencies : [libcryptsetup],
1536 install_rpath : rootlibexecdir,
1538 install_dir : systemgeneratordir)
1540 executable('systemd-veritysetup',
1541 'src/veritysetup/veritysetup.c',
1542 include_directories : includes,
1543 link_with : [libshared],
1544 dependencies : [libcryptsetup],
1545 install_rpath : rootlibexecdir,
1547 install_dir : rootlibexecdir)
1549 executable('systemd-veritysetup-generator',
1550 'src/veritysetup/veritysetup-generator.c',
1551 include_directories : includes,
1552 link_with : [libshared],
1553 dependencies : [libcryptsetup],
1554 install_rpath : rootlibexecdir,
1556 install_dir : systemgeneratordir)
1559 if conf.get('HAVE_SYSV_COMPAT', false)
1560 executable('systemd-sysv-generator',
1561 'src/sysv-generator/sysv-generator.c',
1562 include_directories : includes,
1563 link_with : [libshared],
1564 install_rpath : rootlibexecdir,
1566 install_dir : systemgeneratordir)
1568 executable('systemd-rc-local-generator',
1569 'src/rc-local-generator/rc-local-generator.c',
1570 include_directories : includes,
1571 link_with : [libshared],
1572 install_rpath : rootlibexecdir,
1574 install_dir : systemgeneratordir)
1577 if conf.get('ENABLE_HOSTNAMED', false)
1578 executable('systemd-hostnamed',
1579 'src/hostname/hostnamed.c',
1580 include_directories : includes,
1581 link_with : [libshared],
1582 install_rpath : rootlibexecdir,
1584 install_dir : rootlibexecdir)
1586 exe = executable('hostnamectl',
1587 'src/hostname/hostnamectl.c',
1588 include_directories : includes,
1589 link_with : [libshared],
1590 install_rpath : rootlibexecdir,
1592 public_programs += [exe]
1595 if conf.get('ENABLE_LOCALED', false)
1596 if conf.get('HAVE_XKBCOMMON', false)
1597 # logind will load libxkbcommon.so dynamically on its own
1603 executable('systemd-localed',
1604 systemd_localed_sources,
1605 include_directories : includes,
1606 link_with : [libshared],
1607 dependencies : deps,
1608 install_rpath : rootlibexecdir,
1610 install_dir : rootlibexecdir)
1612 exe = executable('localectl',
1614 include_directories : includes,
1615 link_with : [libshared],
1616 install_rpath : rootlibexecdir,
1618 public_programs += [exe]
1621 if conf.get('ENABLE_TIMEDATED', false)
1622 executable('systemd-timedated',
1623 'src/timedate/timedated.c',
1624 include_directories : includes,
1625 link_with : [libshared],
1626 install_rpath : rootlibexecdir,
1628 install_dir : rootlibexecdir)
1630 exe = executable('timedatectl',
1631 'src/timedate/timedatectl.c',
1632 include_directories : includes,
1633 install_rpath : rootlibexecdir,
1634 link_with : [libshared],
1636 public_programs += [exe]
1639 if conf.get('ENABLE_TIMESYNCD', false)
1640 executable('systemd-timesyncd',
1641 systemd_timesyncd_sources,
1642 include_directories : includes,
1643 link_with : [libshared],
1644 dependencies : [threads,
1646 install_rpath : rootlibexecdir,
1648 install_dir : rootlibexecdir)
1651 if conf.get('ENABLE_MACHINED', false)
1652 executable('systemd-machined',
1653 systemd_machined_sources,
1654 include_directories : includes,
1655 link_with : [libmachine_core,
1657 install_rpath : rootlibexecdir,
1659 install_dir : rootlibexecdir)
1661 exe = executable('machinectl',
1662 'src/machine/machinectl.c',
1663 include_directories : includes,
1664 link_with : [libshared],
1665 dependencies : [threads,
1668 install_rpath : rootlibexecdir,
1670 install_dir : rootbindir)
1671 public_programs += [exe]
1674 if conf.get('ENABLE_IMPORTD', false)
1675 executable('systemd-importd',
1676 systemd_importd_sources,
1677 include_directories : includes,
1678 link_with : [libshared],
1679 dependencies : [threads],
1680 install_rpath : rootlibexecdir,
1682 install_dir : rootlibexecdir)
1684 systemd_pull = executable('systemd-pull',
1685 systemd_pull_sources,
1686 include_directories : includes,
1687 link_with : [libshared],
1688 dependencies : [libcurl,
1693 install_rpath : rootlibexecdir,
1695 install_dir : rootlibexecdir)
1697 systemd_import = executable('systemd-import',
1698 systemd_import_sources,
1699 include_directories : includes,
1700 link_with : [libshared],
1701 dependencies : [libcurl,
1705 install_rpath : rootlibexecdir,
1707 install_dir : rootlibexecdir)
1709 systemd_export = executable('systemd-export',
1710 systemd_export_sources,
1711 include_directories : includes,
1712 link_with : [libshared],
1713 dependencies : [libcurl,
1717 install_rpath : rootlibexecdir,
1719 install_dir : rootlibexecdir)
1720 public_programs += [systemd_pull, systemd_import, systemd_export]
1723 if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
1724 exe = executable('systemd-journal-upload',
1725 systemd_journal_upload_sources,
1726 include_directories : includes,
1727 link_with : [libshared],
1728 dependencies : [threads,
1733 install_rpath : rootlibexecdir,
1735 install_dir : rootlibexecdir)
1736 public_programs += [exe]
1739 if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
1740 s_j_remote = executable('systemd-journal-remote',
1741 systemd_journal_remote_sources,
1742 include_directories : includes,
1743 link_with : [libshared],
1744 dependencies : [threads,
1749 install_rpath : rootlibexecdir,
1751 install_dir : rootlibexecdir)
1753 s_j_gatewayd = executable('systemd-journal-gatewayd',
1754 systemd_journal_gatewayd_sources,
1755 include_directories : includes,
1756 link_with : [libshared],
1757 dependencies : [threads,
1762 install_rpath : rootlibexecdir,
1764 install_dir : rootlibexecdir)
1765 public_programs += [s_j_remote, s_j_gatewayd]
1768 if conf.get('ENABLE_COREDUMP', false)
1769 executable('systemd-coredump',
1770 systemd_coredump_sources,
1771 include_directories : includes,
1772 link_with : [libshared],
1773 dependencies : [threads,
1778 install_rpath : rootlibexecdir,
1780 install_dir : rootlibexecdir)
1782 exe = executable('coredumpctl',
1783 coredumpctl_sources,
1784 include_directories : includes,
1785 link_with : [libshared],
1786 dependencies : [threads,
1789 install_rpath : rootlibexecdir,
1791 public_programs += [exe]
1794 if conf.get('ENABLE_BINFMT', false)
1795 exe = executable('systemd-binfmt',
1796 'src/binfmt/binfmt.c',
1797 include_directories : includes,
1798 link_with : [libshared],
1799 install_rpath : rootlibexecdir,
1801 install_dir : rootlibexecdir)
1802 public_programs += [exe]
1804 meson.add_install_script('sh', '-c',
1805 mkdir_p.format(binfmtdir))
1806 meson.add_install_script('sh', '-c',
1807 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1810 if conf.get('ENABLE_VCONSOLE', false)
1811 executable('systemd-vconsole-setup',
1812 'src/vconsole/vconsole-setup.c',
1813 include_directories : includes,
1814 link_with : [libshared],
1815 install_rpath : rootlibexecdir,
1817 install_dir : rootlibexecdir)
1820 if conf.get('ENABLE_RANDOMSEED', false)
1821 executable('systemd-random-seed',
1822 'src/random-seed/random-seed.c',
1823 include_directories : includes,
1824 link_with : [libshared],
1825 install_rpath : rootlibexecdir,
1827 install_dir : rootlibexecdir)
1830 if conf.get('ENABLE_FIRSTBOOT', false)
1831 executable('systemd-firstboot',
1832 'src/firstboot/firstboot.c',
1833 include_directories : includes,
1834 link_with : [libshared],
1835 dependencies : [libcrypt],
1836 install_rpath : rootlibexecdir,
1838 install_dir : rootbindir)
1841 executable('systemd-remount-fs',
1842 'src/remount-fs/remount-fs.c',
1843 'src/core/mount-setup.c',
1844 'src/core/mount-setup.h',
1845 include_directories : includes,
1846 link_with : [libshared],
1847 install_rpath : rootlibexecdir,
1849 install_dir : rootlibexecdir)
1851 executable('systemd-machine-id-setup',
1852 'src/machine-id-setup/machine-id-setup-main.c',
1853 'src/core/machine-id-setup.c',
1854 'src/core/machine-id-setup.h',
1855 include_directories : includes,
1856 link_with : [libshared],
1857 install_rpath : rootlibexecdir,
1859 install_dir : rootbindir)
1861 executable('systemd-fsck',
1863 include_directories : includes,
1864 link_with : [libshared],
1865 install_rpath : rootlibexecdir,
1867 install_dir : rootlibexecdir)
1869 executable('systemd-sleep',
1870 'src/sleep/sleep.c',
1871 include_directories : includes,
1872 link_with : [libshared],
1873 install_rpath : rootlibexecdir,
1875 install_dir : rootlibexecdir)
1877 exe = executable('systemd-sysctl',
1878 'src/sysctl/sysctl.c',
1879 include_directories : includes,
1880 link_with : [libshared],
1881 install_rpath : rootlibexecdir,
1883 install_dir : rootlibexecdir)
1884 public_programs += [exe]
1886 executable('systemd-ac-power',
1887 'src/ac-power/ac-power.c',
1888 include_directories : includes,
1889 link_with : [libshared],
1890 install_rpath : rootlibexecdir,
1892 install_dir : rootlibexecdir)
1894 exe = executable('systemd-detect-virt',
1895 'src/detect-virt/detect-virt.c',
1896 include_directories : includes,
1897 link_with : [libshared],
1898 install_rpath : rootlibexecdir,
1900 public_programs += [exe]
1902 exe = executable('systemd-delta',
1903 'src/delta/delta.c',
1904 include_directories : includes,
1905 link_with : [libshared],
1906 install_rpath : rootlibexecdir,
1908 public_programs += [exe]
1910 exe = executable('systemd-escape',
1911 'src/escape/escape.c',
1912 include_directories : includes,
1913 link_with : [libshared],
1914 install_rpath : rootlibexecdir,
1916 install_dir : rootbindir)
1917 public_programs += [exe]
1919 exe = executable('systemd-notify',
1920 'src/notify/notify.c',
1921 include_directories : includes,
1922 link_with : [libshared],
1923 install_rpath : rootlibexecdir,
1925 install_dir : rootbindir)
1926 public_programs += [exe]
1928 executable('systemd-volatile-root',
1929 'src/volatile-root/volatile-root.c',
1930 include_directories : includes,
1931 link_with : [libshared],
1932 install_rpath : rootlibexecdir,
1934 install_dir : rootlibexecdir)
1936 executable('systemd-cgroups-agent',
1937 'src/cgroups-agent/cgroups-agent.c',
1938 include_directories : includes,
1939 link_with : [libshared],
1940 install_rpath : rootlibexecdir,
1942 install_dir : rootlibexecdir)
1944 exe = executable('systemd-path',
1946 include_directories : includes,
1947 link_with : [libshared],
1948 install_rpath : rootlibexecdir,
1950 public_programs += [exe]
1952 exe = executable('systemd-ask-password',
1953 'src/ask-password/ask-password.c',
1954 include_directories : includes,
1955 link_with : [libshared],
1956 install_rpath : rootlibexecdir,
1958 install_dir : rootbindir)
1959 public_programs += [exe]
1961 executable('systemd-reply-password',
1962 'src/reply-password/reply-password.c',
1963 include_directories : includes,
1964 link_with : [libshared],
1965 install_rpath : rootlibexecdir,
1967 install_dir : rootlibexecdir)
1969 exe = executable('systemd-tty-ask-password-agent',
1970 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1971 include_directories : includes,
1972 link_with : [libshared],
1973 install_rpath : rootlibexecdir,
1975 install_dir : rootbindir)
1976 public_programs += [exe]
1978 exe = executable('systemd-cgls',
1980 include_directories : includes,
1981 link_with : [libshared],
1982 install_rpath : rootlibexecdir,
1984 public_programs += [exe]
1986 exe = executable('systemd-cgtop',
1987 'src/cgtop/cgtop.c',
1988 include_directories : includes,
1989 link_with : [libshared],
1990 install_rpath : rootlibexecdir,
1992 public_programs += [exe]
1994 executable('systemd-initctl',
1995 'src/initctl/initctl.c',
1996 include_directories : includes,
1997 link_with : [libshared],
1998 install_rpath : rootlibexecdir,
2000 install_dir : rootlibexecdir)
2002 exe = executable('systemd-mount',
2003 'src/mount/mount-tool.c',
2004 include_directories : includes,
2005 link_with : [libshared],
2006 install_rpath : rootlibexecdir,
2008 public_programs += [exe]
2010 meson.add_install_script(meson_make_symlink,
2011 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2013 exe = executable('systemd-run',
2015 include_directories : includes,
2016 link_with : [libshared],
2017 install_rpath : rootlibexecdir,
2019 public_programs += [exe]
2021 exe = executable('systemd-stdio-bridge',
2022 'src/stdio-bridge/stdio-bridge.c',
2023 include_directories : includes,
2024 link_with : [libshared],
2025 install_rpath : rootlibexecdir,
2027 public_programs += [exe]
2029 exe = executable('busctl',
2030 'src/busctl/busctl.c',
2031 'src/busctl/busctl-introspect.c',
2032 'src/busctl/busctl-introspect.h',
2033 include_directories : includes,
2034 link_with : [libshared],
2035 install_rpath : rootlibexecdir,
2037 public_programs += [exe]
2039 if conf.get('ENABLE_SYSUSERS', false)
2040 exe = executable('systemd-sysusers',
2041 'src/sysusers/sysusers.c',
2042 include_directories : includes,
2043 link_with : [libshared],
2044 install_rpath : rootlibexecdir,
2046 install_dir : rootbindir)
2047 public_programs += [exe]
2050 if conf.get('ENABLE_TMPFILES', false)
2051 exe = executable('systemd-tmpfiles',
2052 'src/tmpfiles/tmpfiles.c',
2053 include_directories : includes,
2054 link_with : [libshared],
2055 dependencies : [libacl],
2056 install_rpath : rootlibexecdir,
2058 install_dir : rootbindir)
2059 public_programs += [exe]
2062 if conf.get('ENABLE_HWDB', false)
2063 exe = executable('systemd-hwdb',
2065 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2066 include_directories : includes,
2067 link_with : [libudev_internal],
2068 install_rpath : udev_rpath,
2070 install_dir : rootbindir)
2071 public_programs += [exe]
2074 if conf.get('ENABLE_QUOTACHECK', false)
2075 executable('systemd-quotacheck',
2076 'src/quotacheck/quotacheck.c',
2077 include_directories : includes,
2078 link_with : [libshared],
2079 install_rpath : rootlibexecdir,
2081 install_dir : rootlibexecdir)
2084 exe = executable('systemd-socket-proxyd',
2085 'src/socket-proxy/socket-proxyd.c',
2086 include_directories : includes,
2087 link_with : [libshared],
2088 dependencies : [threads],
2089 install_rpath : rootlibexecdir,
2091 install_dir : rootlibexecdir)
2092 public_programs += [exe]
2094 exe = executable('systemd-udevd',
2095 systemd_udevd_sources,
2096 include_directories : includes,
2097 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2098 link_with : [libudev_core,
2101 dependencies : [threads,
2106 install_rpath : udev_rpath,
2108 install_dir : rootlibexecdir)
2109 public_programs += [exe]
2111 exe = executable('udevadm',
2113 include_directories : includes,
2114 link_with : [libudev_core,
2117 dependencies : [threads,
2122 install_rpath : udev_rpath,
2124 install_dir : rootbindir)
2125 public_programs += [exe]
2127 executable('systemd-shutdown',
2128 systemd_shutdown_sources,
2129 include_directories : includes,
2130 link_with : [libshared],
2131 install_rpath : rootlibexecdir,
2133 install_dir : rootlibexecdir)
2135 executable('systemd-update-done',
2136 'src/update-done/update-done.c',
2137 include_directories : includes,
2138 link_with : [libshared],
2139 install_rpath : rootlibexecdir,
2141 install_dir : rootlibexecdir)
2143 executable('systemd-update-utmp',
2144 'src/update-utmp/update-utmp.c',
2145 include_directories : includes,
2146 link_with : [libshared],
2147 dependencies : [libaudit],
2148 install_rpath : rootlibexecdir,
2150 install_dir : rootlibexecdir)
2152 if conf.get('HAVE_KMOD', false)
2153 executable('systemd-modules-load',
2154 'src/modules-load/modules-load.c',
2155 include_directories : includes,
2156 link_with : [libshared],
2157 dependencies : [libkmod],
2158 install_rpath : rootlibexecdir,
2160 install_dir : rootlibexecdir)
2162 meson.add_install_script('sh', '-c',
2163 mkdir_p.format(modulesloaddir))
2164 meson.add_install_script('sh', '-c',
2165 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2168 exe = executable('systemd-nspawn',
2169 systemd_nspawn_sources,
2170 'src/core/mount-setup.c', # FIXME: use a variable?
2171 'src/core/mount-setup.h',
2172 'src/core/loopback-setup.c',
2173 'src/core/loopback-setup.h',
2174 include_directories : [includes, include_directories('src/nspawn')],
2175 link_with : [libshared],
2176 dependencies : [libacl,
2180 install_rpath : rootlibexecdir,
2182 public_programs += [exe]
2184 if conf.get('ENABLE_NETWORKD', false)
2185 executable('systemd-networkd',
2186 systemd_networkd_sources,
2187 include_directories : includes,
2188 link_with : [libnetworkd_core,
2192 dependencies : [threads],
2193 install_rpath : rootlibexecdir,
2195 install_dir : rootlibexecdir)
2197 executable('systemd-networkd-wait-online',
2198 systemd_networkd_wait_online_sources,
2199 include_directories : includes,
2200 link_with : [libnetworkd_core,
2202 install_rpath : rootlibexecdir,
2204 install_dir : rootlibexecdir)
2206 exe = executable('networkctl',
2208 include_directories : includes,
2209 link_with : [libsystemd_network,
2211 install_rpath : rootlibexecdir,
2213 install_dir : rootbindir)
2214 public_programs += [exe]
2216 ############################################################
2218 foreach tuple : tests
2220 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2221 dependencies = tuple[2]
2222 condition = tuple.length() >= 4 ? tuple[3] : ''
2223 type = tuple.length() >= 5 ? tuple[4] : ''
2224 defs = tuple.length() >= 6 ? tuple[5] : []
2225 incs = tuple.length() >= 7 ? tuple[6] : includes
2228 name = sources[0].split('/')[-1].split('.')[0]
2229 if type.startswith('timeout=')
2230 timeout = type.split('=')[1].to_int()
2234 if condition == '' or conf.get(condition, false)
2238 include_directories : incs,
2239 link_with : link_with,
2240 dependencies : dependencies,
2242 install_rpath : rootlibexecdir,
2243 install : install_tests,
2244 install_dir : join_paths(testsdir, type))
2247 message('@0@ is a manual test'.format(name))
2248 elif type == 'unsafe' and want_tests != 'unsafe'
2249 message('@0@ is an unsafe test'.format(name))
2256 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2260 test_libsystemd_sym = executable(
2261 'test-libsystemd-sym',
2262 test_libsystemd_sym_c,
2263 include_directories : includes,
2264 link_with : [libsystemd],
2265 install : install_tests,
2266 install_dir : testsdir)
2267 test('test-libsystemd-sym',
2268 test_libsystemd_sym)
2270 test_libudev_sym = executable(
2273 include_directories : includes,
2274 c_args : ['-Wno-deprecated-declarations'],
2275 link_with : [libudev],
2276 install : install_tests,
2277 install_dir : testsdir)
2278 test('test-libudev-sym',
2281 ############################################################
2283 make_directive_index_py = find_program('tools/make-directive-index.py')
2284 make_man_index_py = find_program('tools/make-man-index.py')
2285 xml_helper_py = find_program('tools/xml_helper.py')
2286 hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2290 subdir('sysusers.d')
2291 subdir('tmpfiles.d')
2296 subdir('shell-completion/bash')
2297 subdir('shell-completion/zsh')
2298 subdir('docs/sysvinit')
2299 subdir('docs/var-log')
2301 # FIXME: figure out if the warning is true:
2302 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2303 install_subdir('factory/etc',
2304 install_dir : factorydir)
2307 install_data('xorg/50-systemd-user.sh',
2308 install_dir : xinitrcdir)
2309 install_data('system-preset/90-systemd.preset',
2310 install_dir : systempresetdir)
2311 install_data('modprobe.d/systemd.conf',
2312 install_dir : modprobedir)
2313 install_data('README',
2320 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2321 install_dir : docdir)
2323 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2324 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2326 ############################################################
2328 meson_check_help = find_program('tools/meson-check-help.sh')
2330 foreach exec : public_programs
2331 name = exec.full_path().split('/')[-1]
2332 test('check-help-' + name,
2334 args : [exec.full_path()])
2337 ############################################################
2340 all_files = run_command(
2342 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2345 all_files = files(all_files.stdout().split())
2350 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2354 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2358 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2361 command : [meson_git_contrib_sh])
2365 git_head = run_command(
2367 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2368 'rev-parse', 'HEAD']).stdout().strip()
2369 git_head_short = run_command(
2371 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2372 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2376 command : ['git', 'archive',
2377 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2379 '--prefix', 'systemd-@0@/'.format(git_head),
2383 ############################################################
2386 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2388 'prefix: @0@'.format(prefixdir),
2389 'rootprefix: @0@'.format(rootprefixdir),
2390 'sysconf dir: @0@'.format(sysconfdir),
2391 'includedir: @0@'.format(includedir),
2392 'lib dir: @0@'.format(libdir),
2393 'rootlib dir: @0@'.format(rootlibdir),
2394 'SysV init scripts: @0@'.format(sysvinit_path),
2395 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2396 'PAM modules dir: @0@'.format(pamlibdir),
2397 'PAM configuration dir: @0@'.format(pamconfdir),
2398 'RPM macros dir: @0@'.format(rpmmacrosdir),
2399 'modprobe.d dir: @0@'.format(modprobedir),
2400 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2401 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2402 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2403 'bash completions dir: @0@'.format(bashcompletiondir),
2404 'zsh completions dir: @0@'.format(zshcompletiondir),
2405 'extra start script: @0@'.format(get_option('rc-local')),
2406 'extra stop script: @0@'.format(get_option('halt-local')),
2407 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2408 get_option('debug-tty')),
2409 'TTY GID: @0@'.format(tty_gid),
2410 'maximum system UID: @0@'.format(system_uid_max),
2411 'maximum system GID: @0@'.format(system_gid_max),
2412 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2413 'certificate root: @0@'.format(get_option('certificate-root')),
2414 'support URL: @0@'.format(support_url),
2415 'nobody user name: @0@'.format(get_option('nobody-user')),
2416 'nobody group name: @0@'.format(get_option('nobody-group')),
2417 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2418 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
2420 'default DNSSEC mode: @0@'.format(default_dnssec),
2421 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2422 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2424 alt_dns_servers = '\n '.join(dns_servers.split(' '))
2425 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2427 'default DNS servers: @0@'.format(alt_dns_servers),
2428 'default NTP servers: @0@'.format(alt_ntp_servers)]
2430 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2431 '@@0@'.format(time_epoch)).stdout().strip()
2433 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2436 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2437 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2438 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2440 if conf.get('ENABLE_EFI', false)
2442 'efi arch: @0@'.format(efi_arch)]
2446 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2447 'EFI CC @0@'.format(efi_cc),
2448 'EFI libdir: @0@'.format(efi_libdir),
2449 'EFI ldsdir: @0@'.format(efi_ldsdir),
2450 'EFI includedir: @0@'.format(efi_incdir)]
2503 ['legacy pkla', install_polkit_pkla],
2505 ['gnu-efi', have_gnu_efi],
2511 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
2514 ['man pages', want_man],
2515 ['html pages', want_html],
2516 ['man page indices', want_man and have_lxml],
2517 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
2522 ['adm group', get_option('adm-group')],
2523 ['wheel group', get_option('wheel-group')],
2526 ['debug mmap cache'],
2529 cond = tuple.get(1, '')
2531 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2532 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2533 cond = conf.get(ident1, false) or conf.get(ident2, false)
2538 missing += [tuple[0]]
2544 'enabled features: @0@'.format(', '.join(found)),
2546 'disabled features: @0@'.format(', '.join(missing)),
2548 message('\n '.join(status))