1 # SPDX-License-Identifier: LGPL-2.1+
3 # Copyright 2017 Zbigniew Jędrzejewski-Szmek
5 # systemd is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) any later version.
10 # systemd is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
18 project('systemd', 'c',
27 meson_version : '>= 0.40',
30 libsystemd_version = '0.19.1'
31 libudev_version = '1.6.7'
33 # We need the same data in three different formats, ugh!
34 # Also, for hysterical reasons, we use different variable
35 # names, sometimes. Not all variables are included in every
37 conf = configuration_data()
38 conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
39 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
41 substs = configuration_data()
42 substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
43 substs.set('PACKAGE_VERSION', meson.project_version())
47 #####################################################################
49 # Try to install the git pre-commit hook
50 git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
51 if git_hook.returncode() == 0
52 message(git_hook.stdout().strip())
55 #####################################################################
57 conf.set10('HAVE_SPLIT_USR', get_option('split-usr'))
58 rootprefixdir = get_option('split-usr') ? '/' : '/usr'
60 sysvinit_path = get_option('sysvinit-path')
61 sysvrcnd_path = get_option('sysvrcnd-path')
62 have = sysvinit_path != '' or sysvrcnd_path != ''
63 conf.set10('HAVE_SYSV_COMPAT', have,
64 description : 'SysV init scripts and rcN.d links are supported')
65 m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
67 # join_paths ignore the preceding arguments if an absolute component is
68 # encountered, so this should canonicalize various paths when they are
69 # absolute or relative.
70 prefixdir = get_option('prefix')
71 if not prefixdir.startswith('/')
72 error('Prefix is not absolute: "@0@"'.format(prefixdir))
74 bindir = join_paths(prefixdir, get_option('bindir'))
75 libdir = join_paths(prefixdir, get_option('libdir'))
76 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
77 includedir = join_paths(prefixdir, get_option('includedir'))
78 datadir = join_paths(prefixdir, get_option('datadir'))
79 localstatedir = join_paths('/', get_option('localstatedir'))
81 rootbindir = join_paths(rootprefixdir, 'bin')
82 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
84 rootlibdir = get_option('rootlibdir')
86 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
89 # Dirs of external packages
90 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
91 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
92 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
93 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
94 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
95 varlogdir = join_paths(localstatedir, 'log')
96 xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
97 rpmmacrosdir = join_paths(prefixdir, get_option('rpmmacrosdir'))
98 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
101 pkgdatadir = join_paths(datadir, 'systemd')
102 environmentdir = join_paths(prefixdir, 'lib/environment.d')
103 pkgsysconfdir = join_paths(sysconfdir, 'systemd')
104 userunitdir = join_paths(prefixdir, 'lib/systemd/user')
105 userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
106 tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
107 sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
108 sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
109 binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
110 modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
111 networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
112 pkgincludedir = join_paths(includedir, 'systemd')
113 systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
114 usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
115 systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
116 userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
117 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
118 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
119 systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
120 systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
121 udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
122 udevhomedir = udevlibexecdir
123 udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
124 udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
125 catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
126 kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
127 factorydir = join_paths(datadir, 'factory')
128 docdir = join_paths(datadir, 'doc/systemd')
129 bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
130 testsdir = join_paths(prefixdir, 'lib/systemd/tests')
131 systemdstatedir = join_paths(localstatedir, 'lib/systemd')
132 catalogstatedir = join_paths(systemdstatedir, 'catalog')
133 randomseeddir = join_paths(localstatedir, 'lib/systemd')
135 dbuspolicydir = get_option('dbuspolicydir')
136 if dbuspolicydir == ''
137 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
140 dbussessionservicedir = get_option('dbussessionservicedir')
141 if dbussessionservicedir == ''
142 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
145 dbussystemservicedir = get_option('dbussystemservicedir')
146 if dbussystemservicedir == ''
147 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
150 pamlibdir = get_option('pamlibdir')
152 pamlibdir = join_paths(rootlibdir, 'security')
155 pamconfdir = get_option('pamconfdir')
157 pamconfdir = join_paths(sysconfdir, 'pam.d')
160 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
161 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
162 conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
163 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
164 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
165 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
166 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
167 conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
168 conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
169 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
170 conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
171 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
172 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
173 conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
174 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
175 conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
176 conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
177 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
178 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
179 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
180 conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
181 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
182 conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
183 conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
184 conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
185 conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
186 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
187 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
188 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
189 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
190 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
191 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
192 conf.set_quoted('LIBDIR', libdir)
193 conf.set_quoted('ROOTLIBDIR', rootlibdir)
194 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
195 conf.set_quoted('BOOTLIBDIR', bootlibdir)
196 conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
197 conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
198 conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
199 conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
200 conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
201 conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
203 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
204 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
206 substs.set('prefix', prefixdir)
207 substs.set('exec_prefix', prefixdir)
208 substs.set('libdir', libdir)
209 substs.set('rootlibdir', rootlibdir)
210 substs.set('includedir', includedir)
211 substs.set('pkgsysconfdir', pkgsysconfdir)
212 substs.set('bindir', bindir)
213 substs.set('rootbindir', rootbindir)
214 substs.set('rootlibexecdir', rootlibexecdir)
215 substs.set('systemunitdir', systemunitdir)
216 substs.set('userunitdir', userunitdir)
217 substs.set('systempresetdir', systempresetdir)
218 substs.set('userpresetdir', userpresetdir)
219 substs.set('udevhwdbdir', udevhwdbdir)
220 substs.set('udevrulesdir', udevrulesdir)
221 substs.set('udevlibexecdir', udevlibexecdir)
222 substs.set('catalogdir', catalogdir)
223 substs.set('tmpfilesdir', tmpfilesdir)
224 substs.set('sysusersdir', sysusersdir)
225 substs.set('sysctldir', sysctldir)
226 substs.set('binfmtdir', binfmtdir)
227 substs.set('modulesloaddir', modulesloaddir)
228 substs.set('systemgeneratordir', systemgeneratordir)
229 substs.set('usergeneratordir', usergeneratordir)
230 substs.set('systemenvgeneratordir', systemenvgeneratordir)
231 substs.set('userenvgeneratordir', userenvgeneratordir)
232 substs.set('systemshutdowndir', systemshutdowndir)
233 substs.set('systemsleepdir', systemsleepdir)
234 substs.set('VARLOGDIR', varlogdir)
235 substs.set('CERTIFICATEROOT', get_option('certificate-root'))
236 substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
237 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
238 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
239 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
240 substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
241 substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
243 #####################################################################
245 cc = meson.get_compiler('c')
246 pkgconfig = import('pkgconfig')
247 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
249 cxx = find_program('c++', required : false)
251 # Used only for tests
255 foreach arg : ['-Wextra',
258 '-Wmissing-include-dirs',
259 '-Wold-style-definition',
262 '-Wdeclaration-after-statement',
264 '-Wsuggest-attribute=noreturn',
265 '-Werror=missing-prototypes',
266 '-Werror=implicit-function-declaration',
267 '-Werror=missing-declarations',
268 '-Werror=return-type',
269 '-Werror=incompatible-pointer-types',
271 '-Wstrict-prototypes',
273 '-Wmissing-noreturn',
276 '-Wstrict-aliasing=2',
283 '-fdiagnostics-show-option',
284 '-fno-strict-aliasing',
285 '-fvisibility=hidden',
287 '-fstack-protector-strong',
289 '--param=ssp-buffer-size=4',
291 if cc.has_argument(arg)
292 add_project_arguments(arg, language : 'c')
296 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
297 # arguments, just emits a warnings. So test for the "positive" version instead.
298 foreach arg : ['unused-parameter',
299 'missing-field-initializers',
302 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
304 if cc.has_argument('-W' + arg)
305 add_project_arguments('-Wno-' + arg, language : 'c')
311 #include <inttypes.h>
312 typedef uint64_t usec_t;
313 usec_t now(clockid_t clock);
318 ', name : '-Werror=shadow with local shadowing')
319 add_project_arguments('-Werror=shadow', language : 'c')
322 if cc.get_id() == 'clang'
323 foreach arg : ['-Wno-typedef-redefinition',
324 '-Wno-gnu-variable-sized-type-not-at-end',
326 if cc.has_argument(arg,
327 name : '@0@ is supported'.format(arg))
328 add_project_arguments(arg, language : 'c')
333 link_test_c = files('tools/meson-link-test.c')
335 # --as-needed and --no-undefined are provided by meson by default,
336 # run mesonconf to see what is enabled
337 foreach arg : ['-Wl,-z,relro',
342 have = run_command(check_compilation_sh,
343 cc.cmd_array(), '-x', 'c', arg,
344 '-include', link_test_c).returncode() == 0
345 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
347 add_project_link_arguments(arg, language : 'c')
351 if get_option('buildtype') != 'debug'
352 foreach arg : ['-ffunction-sections',
354 if cc.has_argument(arg,
355 name : '@0@ is supported'.format(arg))
356 add_project_arguments(arg, language : 'c')
360 foreach arg : ['-Wl,--gc-sections']
361 have = run_command(check_compilation_sh,
362 cc.cmd_array(), '-x', 'c', arg,
363 '-include', link_test_c).returncode() == 0
364 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
366 add_project_link_arguments(arg, language : 'c')
371 cpp = ' '.join(cc.cmd_array()) + ' -E'
373 #####################################################################
374 # compilation result tests
376 conf.set('_GNU_SOURCE', true)
377 conf.set('__SANE_USERSPACE_TYPES__', true)
379 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
380 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
381 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
382 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
383 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
384 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
385 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
389 #include <linux/ethtool.h>
390 #include <linux/fib_rules.h>
392 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
394 foreach decl : ['char16_t',
397 'struct ethtool_link_settings',
398 'struct fib_rule_uid_range',
401 # We get -1 if the size cannot be determined
402 have = cc.sizeof(decl, prefix : decl_headers) > 0
403 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
406 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
407 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
408 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
409 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
410 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
411 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
412 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
413 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
414 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
415 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
416 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
417 # if_tunnel.h is buggy and cannot be included on its own
418 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
419 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
420 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
421 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
422 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
423 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
424 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
425 ['NDA_IFINDEX', 'linux/neighbour.h'],
426 ['IFA_FLAGS', 'linux/if_addr.h'],
427 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
428 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
430 prefix = decl.length() > 2 ? decl[2] : ''
431 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
432 conf.set10('HAVE_' + decl[0], have)
435 foreach ident : ['secure_getenv', '__secure_getenv']
436 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
440 ['memfd_create', '''#include <sys/memfd.h>'''],
441 ['gettid', '''#include <sys/types.h>'''],
442 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
443 ['name_to_handle_at', '''#define _GNU_SOURCE
444 #include <sys/types.h>
445 #include <sys/stat.h>
446 #include <fcntl.h>'''],
447 ['setns', '''#define _GNU_SOURCE
448 #include <sched.h>'''],
449 ['renameat2', '''#include <stdio.h>'''],
450 ['kcmp', '''#include <linux/kcmp.h>'''],
451 ['keyctl', '''#include <sys/types.h>
452 #include <keyutils.h>'''],
453 ['copy_file_range', '''#include <sys/syscall.h>
454 #include <unistd.h>'''],
455 ['bpf', '''#include <sys/syscall.h>
456 #include <unistd.h>'''],
457 ['explicit_bzero' , '''#include <string.h>'''],
460 have = cc.has_function(ident[0], prefix : ident[1])
461 conf.set10('HAVE_' + ident[0].to_upper(), have)
464 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
465 conf.set10('USE_SYS_RANDOM_H', true)
466 conf.set10('HAVE_GETRANDOM', true)
468 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
469 conf.set10('USE_SYS_RANDOM_H', false)
470 conf.set10('HAVE_GETRANDOM', have)
473 #####################################################################
475 sed = find_program('sed')
476 awk = find_program('awk')
477 m4 = find_program('m4')
478 stat = find_program('stat')
479 git = find_program('git', required : false)
481 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
482 mkdir_p = 'mkdir -p $DESTDIR/@0@'
483 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
484 splash_bmp = files('test/splash.bmp')
486 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
487 # /usr/sbin, /sbin, and fall back to the default from middle column.
488 progs = [['telinit', '/lib/sysvinit/telinit'],
489 ['quotaon', '/usr/sbin/quotaon' ],
490 ['quotacheck', '/usr/sbin/quotacheck' ],
491 ['kill', '/usr/bin/kill' ],
492 ['kmod', '/usr/bin/kmod' ],
493 ['kexec', '/usr/sbin/kexec' ],
494 ['sulogin', '/usr/sbin/sulogin' ],
495 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
496 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
497 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
498 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
501 path = get_option(prog[0] + '-path')
503 message('Using @1@ for @0@'.format(prog[0], path))
505 exe = find_program(prog[0],
506 '/usr/sbin/' + prog[0],
509 path = exe.found() ? exe.path() : prog[1]
511 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
512 conf.set_quoted(name, path)
513 substs.set(name, path)
516 if run_command('ln', '--relative', '--help').returncode() != 0
517 error('ln does not support --relative')
520 ############################################################
522 gperf = find_program('gperf')
524 gperf_test_format = '''
526 const char * in_word_set(const char *, @0@);
529 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
530 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
531 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
532 if cc.compiles(gperf_test)
533 gperf_len_type = 'size_t'
535 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
536 if cc.compiles(gperf_test)
537 gperf_len_type = 'unsigned'
539 error('unable to determine gperf len type')
542 message('gperf len type is @0@'.format(gperf_len_type))
543 conf.set('GPERF_LEN_TYPE', gperf_len_type,
544 description : 'The type of gperf "len" parameter')
546 ############################################################
548 if not cc.has_header('sys/capability.h')
549 error('POSIX caps headers not found')
551 foreach header : ['linux/btrfs.h',
553 'linux/vm_sockets.h',
555 'valgrind/memcheck.h',
556 'valgrind/valgrind.h',
559 conf.set10('HAVE_' + header.underscorify().to_upper(),
560 cc.has_header(header))
563 ############################################################
565 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
566 conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
567 gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
569 default_hierarchy = get_option('default-hierarchy')
570 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
571 description : 'default cgroup hierarchy as string')
572 if default_hierarchy == 'legacy'
573 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
574 elif default_hierarchy == 'hybrid'
575 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
577 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
580 time_epoch = get_option('time-epoch')
583 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
585 time_epoch = time_epoch.to_int()
586 conf.set('TIME_EPOCH', time_epoch)
588 system_uid_max = get_option('system-uid-max')
589 if system_uid_max == ''
590 system_uid_max = run_command(
592 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
593 '/etc/login.defs').stdout()
595 system_uid_max = system_uid_max.to_int()
596 conf.set('SYSTEM_UID_MAX', system_uid_max)
597 substs.set('systemuidmax', system_uid_max)
598 message('maximum system UID is @0@'.format(system_uid_max))
600 conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
601 conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
603 system_gid_max = get_option('system-gid-max')
604 if system_gid_max == ''
605 system_gid_max = run_command(
607 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
608 '/etc/login.defs').stdout()
610 system_gid_max = system_gid_max.to_int()
611 conf.set('SYSTEM_GID_MAX', system_gid_max)
612 substs.set('systemgidmax', system_gid_max)
613 message('maximum system GID is @0@'.format(system_gid_max))
615 tty_gid = get_option('tty-gid')
616 conf.set('TTY_GID', tty_gid)
617 substs.set('TTY_GID', tty_gid)
619 if get_option('adm-group')
620 m4_defines += ['-DENABLE_ADM_GROUP']
623 if get_option('wheel-group')
624 m4_defines += ['-DENABLE_WHEEL_GROUP']
627 substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
628 substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
630 kill_user_processes = get_option('default-kill-user-processes')
631 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
632 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
634 dns_servers = get_option('dns-servers')
635 conf.set_quoted('DNS_SERVERS', dns_servers)
636 substs.set('DNS_SERVERS', dns_servers)
638 ntp_servers = get_option('ntp-servers')
639 conf.set_quoted('NTP_SERVERS', ntp_servers)
640 substs.set('NTP_SERVERS', ntp_servers)
642 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
644 substs.set('SUSHELL', get_option('debug-shell'))
645 substs.set('DEBUGTTY', get_option('debug-tty'))
647 debug = get_option('debug')
648 enable_debug_hashmap = false
649 enable_debug_mmap_cache = false
651 foreach name : debug.split(',')
653 enable_debug_hashmap = true
654 elif name == 'mmap-cache'
655 enable_debug_mmap_cache = true
657 message('unknown debug option "@0@", ignoring'.format(name))
661 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
662 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
664 #####################################################################
666 threads = dependency('threads')
667 librt = cc.find_library('rt')
668 libm = cc.find_library('m')
669 libdl = cc.find_library('dl')
670 libcrypt = cc.find_library('crypt')
672 libcap = dependency('libcap', required : false)
673 if not libcap.found()
674 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
675 libcap = cc.find_library('cap')
678 libmount = dependency('mount',
681 want_seccomp = get_option('seccomp')
682 if want_seccomp != 'false'
683 libseccomp = dependency('libseccomp',
684 version : '>= 2.3.1',
685 required : want_seccomp == 'true')
686 have = libseccomp.found()
691 conf.set10('HAVE_SECCOMP', have)
692 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
694 want_selinux = get_option('selinux')
695 if want_selinux != 'false'
696 libselinux = dependency('libselinux',
697 version : '>= 2.1.9',
698 required : want_selinux == 'true')
699 have = libselinux.found()
704 conf.set10('HAVE_SELINUX', have)
705 m4_defines += have ? ['-DHAVE_SELINUX'] : []
707 want_apparmor = get_option('apparmor')
708 if want_apparmor != 'false'
709 libapparmor = dependency('libapparmor',
710 required : want_apparmor == 'true')
711 have = libapparmor.found()
716 conf.set10('HAVE_APPARMOR', have)
717 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
719 smack_run_label = get_option('smack-run-label')
720 if smack_run_label != ''
721 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
722 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
725 want_polkit = get_option('polkit')
726 install_polkit = false
727 install_polkit_pkla = false
728 if want_polkit != 'false'
729 install_polkit = true
731 libpolkit = dependency('polkit-gobject-1',
733 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
734 message('Old polkit detected, will install pkla files')
735 install_polkit_pkla = true
738 conf.set10('ENABLE_POLKIT', install_polkit)
740 want_acl = get_option('acl')
741 if want_acl != 'false'
742 libacl = cc.find_library('acl', required : want_acl == 'true')
743 have = libacl.found()
748 conf.set10('HAVE_ACL', have)
749 m4_defines += have ? ['-DHAVE_ACL'] : []
751 want_audit = get_option('audit')
752 if want_audit != 'false'
753 libaudit = dependency('audit', required : want_audit == 'true')
754 have = libaudit.found()
759 conf.set10('HAVE_AUDIT', have)
761 want_blkid = get_option('blkid')
762 if want_blkid != 'false'
763 libblkid = dependency('blkid', required : want_blkid == 'true')
764 have = libblkid.found()
769 conf.set10('HAVE_BLKID', have)
771 want_kmod = get_option('kmod')
772 if want_kmod != 'false'
773 libkmod = dependency('libkmod',
775 required : want_kmod == 'true')
776 have = libkmod.found()
781 conf.set10('HAVE_KMOD', have)
783 want_pam = get_option('pam')
784 if want_pam != 'false'
785 libpam = cc.find_library('pam', required : want_pam == 'true')
786 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
787 have = libpam.found() and libpam_misc.found()
793 conf.set10('HAVE_PAM', have)
794 m4_defines += have ? ['-DHAVE_PAM'] : []
796 want_microhttpd = get_option('microhttpd')
797 if want_microhttpd != 'false'
798 libmicrohttpd = dependency('libmicrohttpd',
799 version : '>= 0.9.33',
800 required : want_microhttpd == 'true')
801 have = libmicrohttpd.found()
806 conf.set10('HAVE_MICROHTTPD', have)
807 m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
809 want_libcryptsetup = get_option('libcryptsetup')
810 if want_libcryptsetup != 'false'
811 libcryptsetup = dependency('libcryptsetup',
812 version : '>= 1.6.0',
813 required : want_libcryptsetup == 'true')
814 have = libcryptsetup.found()
819 conf.set10('HAVE_LIBCRYPTSETUP', have)
821 want_libcurl = get_option('libcurl')
822 if want_libcurl != 'false'
823 libcurl = dependency('libcurl',
824 version : '>= 7.32.0',
825 required : want_libcurl == 'true')
826 have = libcurl.found()
831 conf.set10('HAVE_LIBCURL', have)
832 m4_defines += have ? ['-DHAVE_LIBCURL'] : []
834 want_libidn = get_option('libidn')
835 want_libidn2 = get_option('libidn2')
836 if want_libidn == 'true' and want_libidn2 == 'true'
837 error('libidn and libidn2 cannot be requested simultaneously')
840 if want_libidn != 'false' and want_libidn2 != 'true'
841 libidn = dependency('libidn',
842 required : want_libidn == 'true')
843 have = libidn.found()
848 conf.set10('HAVE_LIBIDN', have)
849 m4_defines += have ? ['-DHAVE_LIBIDN'] : []
850 if not have and want_libidn2 != 'false'
851 # libidn is used for both libidn and libidn2 objects
852 libidn = dependency('libidn2',
853 required : want_libidn2 == 'true')
854 have = libidn.found()
858 conf.set10('HAVE_LIBIDN2', have)
859 m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
861 want_libiptc = get_option('libiptc')
862 if want_libiptc != 'false'
863 libiptc = dependency('libiptc',
864 required : want_libiptc == 'true')
865 have = libiptc.found()
870 conf.set10('HAVE_LIBIPTC', have)
871 m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
873 want_qrencode = get_option('qrencode')
874 if want_qrencode != 'false'
875 libqrencode = dependency('libqrencode',
876 required : want_qrencode == 'true')
877 have = libqrencode.found()
882 conf.set10('HAVE_QRENCODE', have)
884 want_gcrypt = get_option('gcrypt')
885 if want_gcrypt != 'false'
886 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
887 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
888 have = libgcrypt.found() and libgpg_error.found()
893 # link to neither of the libs if one is not found
897 conf.set10('HAVE_GCRYPT', have)
899 want_gnutls = get_option('gnutls')
900 if want_gnutls != 'false'
901 libgnutls = dependency('gnutls',
902 version : '>= 3.1.4',
903 required : want_gnutls == 'true')
904 have = libgnutls.found()
909 conf.set10('HAVE_GNUTLS', have)
911 want_elfutils = get_option('elfutils')
912 if want_elfutils != 'false'
913 libdw = dependency('libdw',
914 required : want_elfutils == 'true')
920 conf.set10('HAVE_ELFUTILS', have)
922 want_zlib = get_option('zlib')
923 if want_zlib != 'false'
924 libz = dependency('zlib',
925 required : want_zlib == 'true')
931 conf.set10('HAVE_ZLIB', have)
933 want_bzip2 = get_option('bzip2')
934 if want_bzip2 != 'false'
935 libbzip2 = cc.find_library('bz2',
936 required : want_bzip2 == 'true')
937 have = libbzip2.found()
942 conf.set10('HAVE_BZIP2', have)
944 want_xz = get_option('xz')
945 if want_xz != 'false'
946 libxz = dependency('liblzma',
947 required : want_xz == 'true')
953 conf.set10('HAVE_XZ', have)
955 want_lz4 = get_option('lz4')
956 if want_lz4 != 'false'
957 liblz4 = dependency('liblz4',
958 required : want_lz4 == 'true')
959 have = liblz4.found()
964 conf.set10('HAVE_LZ4', have)
966 want_xkbcommon = get_option('xkbcommon')
967 if want_xkbcommon != 'false'
968 libxkbcommon = dependency('xkbcommon',
969 version : '>= 0.3.0',
970 required : want_xkbcommon == 'true')
971 have = libxkbcommon.found()
976 conf.set10('HAVE_XKBCOMMON', have)
978 want_glib = get_option('glib')
979 if want_glib != 'false'
980 libglib = dependency('glib-2.0',
981 version : '>= 2.22.0',
982 required : want_glib == 'true')
983 libgobject = dependency('gobject-2.0',
984 version : '>= 2.22.0',
985 required : want_glib == 'true')
986 libgio = dependency('gio-2.0',
987 required : want_glib == 'true')
988 have = libglib.found() and libgobject.found() and libgio.found()
995 conf.set10('HAVE_GLIB', have)
997 want_dbus = get_option('dbus')
998 if want_dbus != 'false'
999 libdbus = dependency('dbus-1',
1000 version : '>= 1.3.2',
1001 required : want_dbus == 'true')
1002 have = libdbus.found()
1007 conf.set10('HAVE_DBUS', have)
1009 default_dnssec = get_option('default-dnssec')
1010 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1011 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1012 default_dnssec = 'no'
1014 conf.set('DEFAULT_DNSSEC_MODE',
1015 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1016 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1018 want_importd = get_option('importd')
1019 if want_importd != 'false'
1020 have = (conf.get('HAVE_LIBCURL') == 1 and
1021 conf.get('HAVE_ZLIB') == 1 and
1022 conf.get('HAVE_BZIP2') == 1 and
1023 conf.get('HAVE_XZ') == 1 and
1024 conf.get('HAVE_GCRYPT') == 1)
1025 if want_importd == 'true' and not have
1026 error('importd support was requested, but dependencies are not available')
1031 conf.set10('ENABLE_IMPORTD', have)
1033 want_remote = get_option('remote')
1034 if want_remote != 'false'
1035 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1036 conf.get('HAVE_LIBCURL') == 1]
1037 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1038 # it's possible to build one without the other. Complain only if
1039 # support was explictly requested. The auxiliary files like sysusers
1040 # config should be installed when any of the programs are built.
1041 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1042 error('remote support was requested, but dependencies are not available')
1044 have = have_deps[0] or have_deps[1]
1048 conf.set10('ENABLE_REMOTE', have)
1050 foreach term : ['utmp',
1081 have = get_option(term)
1082 name = 'ENABLE_' + term.underscorify().to_upper()
1083 conf.set10(name, have)
1084 m4_defines += have ? ['-D' + name] : []
1087 want_tests = get_option('tests')
1088 install_tests = get_option('install-tests')
1091 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1093 #####################################################################
1095 if get_option('efi')
1096 efi_arch = host_machine.cpu_family()
1098 if efi_arch == 'x86'
1099 EFI_MACHINE_TYPE_NAME = 'ia32'
1100 gnu_efi_arch = 'ia32'
1101 elif efi_arch == 'x86_64'
1102 EFI_MACHINE_TYPE_NAME = 'x64'
1103 gnu_efi_arch = 'x86_64'
1104 elif efi_arch == 'arm'
1105 EFI_MACHINE_TYPE_NAME = 'arm'
1106 gnu_efi_arch = 'arm'
1107 elif efi_arch == 'aarch64'
1108 EFI_MACHINE_TYPE_NAME = 'aa64'
1109 gnu_efi_arch = 'aarch64'
1111 EFI_MACHINE_TYPE_NAME = ''
1116 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1118 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1122 conf.set10('ENABLE_EFI', have)
1124 #####################################################################
1126 config_h = configure_file(
1127 output : 'config.h',
1128 configuration : conf)
1130 includes = include_directories('src/basic',
1140 'src/libsystemd/sd-bus',
1141 'src/libsystemd/sd-device',
1142 'src/libsystemd/sd-hwdb',
1143 'src/libsystemd/sd-id128',
1144 'src/libsystemd/sd-netlink',
1145 'src/libsystemd/sd-network',
1146 'src/libsystemd-network',
1150 add_project_arguments('-include', 'config.h', language : 'c')
1152 gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1153 'src/shared/gcrypt-util.c')
1157 subdir('src/systemd')
1159 subdir('src/libsystemd')
1160 subdir('src/libsystemd-network')
1161 subdir('src/journal')
1164 libjournal_core = static_library(
1166 libjournal_core_sources,
1168 include_directories : includes,
1171 libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1172 libsystemd = shared_library(
1174 libsystemd_internal_sources,
1175 journal_internal_sources,
1176 version : libsystemd_version,
1177 include_directories : includes,
1178 link_args : ['-shared',
1179 '-Wl,--version-script=' + libsystemd_sym_path],
1180 link_with : [libbasic],
1181 dependencies : [threads,
1186 link_depends : libsystemd_sym,
1188 install_dir : rootlibdir)
1190 ############################################################
1192 # binaries that have --help and are intended for use by humans,
1193 # usually, but not always, installed in /bin.
1194 public_programs = []
1196 subdir('src/libudev')
1197 subdir('src/shared')
1200 subdir('src/network')
1202 subdir('src/analyze')
1203 subdir('src/journal-remote')
1204 subdir('src/coredump')
1205 subdir('src/hostname')
1206 subdir('src/import')
1207 subdir('src/kernel-install')
1208 subdir('src/locale')
1209 subdir('src/machine')
1210 subdir('src/nspawn')
1211 subdir('src/resolve')
1212 subdir('src/timedate')
1213 subdir('src/timesync')
1214 subdir('src/vconsole')
1215 subdir('src/sulogin-shell')
1216 subdir('src/boot/efi')
1221 ############################################################
1223 # only static linking apart from libdl, to make sure that the
1224 # module is linked to all libraries that it uses.
1225 test_dlopen = executable(
1228 include_directories : includes,
1229 link_with : [libbasic],
1230 dependencies : [libdl])
1232 foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1233 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1234 ['mymachines', 'ENABLE_MACHINED'],
1235 ['resolve', 'ENABLE_RESOLVE']]
1237 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1241 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1242 version_script_arg = join_paths(meson.current_source_dir(), sym)
1244 nss = shared_library(
1246 'src/nss-@0@/nss-@0@.c'.format(module),
1248 include_directories : includes,
1249 link_args : ['-shared',
1250 '-Wl,--version-script=' + version_script_arg,
1252 link_with : [libsystemd_internal,
1254 dependencies : [threads,
1258 install_dir : rootlibdir)
1260 # We cannot use shared_module because it does not support version suffix.
1261 # Unfortunately shared_library insists on creating the symlink…
1262 meson.add_install_script('sh', '-c',
1263 'rm $DESTDIR@0@/libnss_@1@.so'
1264 .format(rootlibdir, module))
1266 test('dlopen-nss_' + module,
1268 args : [nss.full_path()]) # path to dlopen must include a slash
1272 ############################################################
1274 executable('systemd',
1276 include_directories : includes,
1277 link_with : [libcore,
1279 dependencies : [threads,
1285 install_rpath : rootlibexecdir,
1287 install_dir : rootlibexecdir)
1289 exe = executable('systemd-analyze',
1290 systemd_analyze_sources,
1291 include_directories : includes,
1292 link_with : [libcore,
1294 dependencies : [threads,
1300 install_rpath : rootlibexecdir,
1302 public_programs += [exe]
1304 executable('systemd-journald',
1305 systemd_journald_sources,
1306 include_directories : includes,
1307 link_with : [libjournal_core,
1309 dependencies : [threads,
1313 install_rpath : rootlibexecdir,
1315 install_dir : rootlibexecdir)
1317 exe = executable('systemd-cat',
1318 systemd_cat_sources,
1319 include_directories : includes,
1320 link_with : [libjournal_core,
1322 dependencies : [threads],
1323 install_rpath : rootlibexecdir,
1325 public_programs += [exe]
1327 exe = executable('journalctl',
1329 include_directories : includes,
1330 link_with : [libshared],
1331 dependencies : [threads,
1335 install_rpath : rootlibexecdir,
1337 install_dir : rootbindir)
1338 public_programs += [exe]
1340 executable('systemd-getty-generator',
1341 'src/getty-generator/getty-generator.c',
1342 include_directories : includes,
1343 link_with : [libshared],
1344 install_rpath : rootlibexecdir,
1346 install_dir : systemgeneratordir)
1348 executable('systemd-debug-generator',
1349 'src/debug-generator/debug-generator.c',
1350 include_directories : includes,
1351 link_with : [libshared],
1352 install_rpath : rootlibexecdir,
1354 install_dir : systemgeneratordir)
1356 executable('systemd-fstab-generator',
1357 'src/fstab-generator/fstab-generator.c',
1358 'src/core/mount-setup.c',
1359 include_directories : includes,
1360 link_with : [libshared],
1361 install_rpath : rootlibexecdir,
1363 install_dir : systemgeneratordir)
1365 if conf.get('ENABLE_ENVIRONMENT_D') == 1
1366 executable('30-systemd-environment-d-generator',
1367 'src/environment-d-generator/environment-d-generator.c',
1368 include_directories : includes,
1369 link_with : [libshared],
1370 install_rpath : rootlibexecdir,
1372 install_dir : userenvgeneratordir)
1374 meson.add_install_script(meson_make_symlink,
1375 join_paths(sysconfdir, 'environment'),
1376 join_paths(environmentdir, '99-environment.conf'))
1379 if conf.get('ENABLE_HIBERNATE') == 1
1380 executable('systemd-hibernate-resume-generator',
1381 'src/hibernate-resume/hibernate-resume-generator.c',
1382 include_directories : includes,
1383 link_with : [libshared],
1384 install_rpath : rootlibexecdir,
1386 install_dir : systemgeneratordir)
1388 executable('systemd-hibernate-resume',
1389 'src/hibernate-resume/hibernate-resume.c',
1390 include_directories : includes,
1391 link_with : [libshared],
1392 install_rpath : rootlibexecdir,
1394 install_dir : rootlibexecdir)
1397 if conf.get('HAVE_BLKID') == 1
1398 executable('systemd-gpt-auto-generator',
1399 'src/gpt-auto-generator/gpt-auto-generator.c',
1400 'src/basic/blkid-util.h',
1401 include_directories : includes,
1402 link_with : [libshared],
1403 dependencies : libblkid,
1404 install_rpath : rootlibexecdir,
1406 install_dir : systemgeneratordir)
1408 exe = executable('systemd-dissect',
1409 'src/dissect/dissect.c',
1410 include_directories : includes,
1411 link_with : [libshared],
1412 install_rpath : rootlibexecdir,
1414 install_dir : rootlibexecdir)
1415 public_programs += [exe]
1418 if conf.get('ENABLE_RESOLVE') == 1
1419 executable('systemd-resolved',
1420 systemd_resolved_sources,
1421 gcrypt_util_sources,
1422 include_directories : includes,
1423 link_with : [libshared],
1424 dependencies : [threads,
1429 install_rpath : rootlibexecdir,
1431 install_dir : rootlibexecdir)
1433 exe = executable('systemd-resolve',
1434 systemd_resolve_sources,
1435 gcrypt_util_sources,
1436 include_directories : includes,
1437 link_with : [libshared],
1438 dependencies : [threads,
1443 install_rpath : rootlibexecdir,
1445 public_programs += [exe]
1448 if conf.get('ENABLE_LOGIND') == 1
1449 executable('systemd-logind',
1450 systemd_logind_sources,
1451 include_directories : includes,
1452 link_with : [liblogind_core,
1454 dependencies : [threads,
1456 install_rpath : rootlibexecdir,
1458 install_dir : rootlibexecdir)
1460 exe = executable('loginctl',
1462 include_directories : includes,
1463 link_with : [libshared],
1464 dependencies : [threads,
1467 install_rpath : rootlibexecdir,
1469 install_dir : rootbindir)
1470 public_programs += [exe]
1472 exe = executable('systemd-inhibit',
1473 'src/login/inhibit.c',
1474 include_directories : includes,
1475 link_with : [libshared],
1476 install_rpath : rootlibexecdir,
1478 install_dir : rootbindir)
1479 public_programs += [exe]
1481 if conf.get('HAVE_PAM') == 1
1482 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1483 pam_systemd = shared_library(
1487 include_directories : includes,
1488 link_args : ['-shared',
1489 '-Wl,--version-script=' + version_script_arg],
1490 link_with : [libsystemd_internal,
1492 dependencies : [threads,
1495 link_depends : pam_systemd_sym,
1497 install_dir : pamlibdir)
1499 test('dlopen-pam_systemd',
1501 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1505 if conf.get('HAVE_PAM') == 1
1506 executable('systemd-user-sessions',
1507 'src/user-sessions/user-sessions.c',
1508 include_directories : includes,
1509 link_with : [libshared],
1510 install_rpath : rootlibexecdir,
1512 install_dir : rootlibexecdir)
1515 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1516 exe = executable('bootctl',
1517 'src/boot/bootctl.c',
1518 include_directories : includes,
1519 link_with : [libshared],
1520 dependencies : [libblkid],
1521 install_rpath : rootlibexecdir,
1523 public_programs += [exe]
1526 exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1527 include_directories : includes,
1528 link_with : [libshared],
1529 dependencies : [threads],
1530 install_rpath : rootlibexecdir,
1532 public_programs += [exe]
1534 exe = executable('systemctl', 'src/systemctl/systemctl.c',
1535 include_directories : includes,
1536 link_with : [libshared],
1537 dependencies : [threads,
1542 install_rpath : rootlibexecdir,
1544 install_dir : rootbindir)
1545 public_programs += [exe]
1547 if conf.get('ENABLE_BACKLIGHT') == 1
1548 executable('systemd-backlight',
1549 'src/backlight/backlight.c',
1550 include_directories : includes,
1551 link_with : [libshared],
1552 install_rpath : rootlibexecdir,
1554 install_dir : rootlibexecdir)
1557 if conf.get('ENABLE_RFKILL') == 1
1558 executable('systemd-rfkill',
1559 'src/rfkill/rfkill.c',
1560 include_directories : includes,
1561 link_with : [libshared],
1562 install_rpath : rootlibexecdir,
1564 install_dir : rootlibexecdir)
1567 executable('systemd-system-update-generator',
1568 'src/system-update-generator/system-update-generator.c',
1569 include_directories : includes,
1570 link_with : [libshared],
1571 install_rpath : rootlibexecdir,
1573 install_dir : systemgeneratordir)
1575 if conf.get('HAVE_LIBCRYPTSETUP') == 1
1576 executable('systemd-cryptsetup',
1577 'src/cryptsetup/cryptsetup.c',
1578 include_directories : includes,
1579 link_with : [libshared],
1580 dependencies : [libcryptsetup],
1581 install_rpath : rootlibexecdir,
1583 install_dir : rootlibexecdir)
1585 executable('systemd-cryptsetup-generator',
1586 'src/cryptsetup/cryptsetup-generator.c',
1587 include_directories : includes,
1588 link_with : [libshared],
1589 dependencies : [libcryptsetup],
1590 install_rpath : rootlibexecdir,
1592 install_dir : systemgeneratordir)
1594 executable('systemd-veritysetup',
1595 'src/veritysetup/veritysetup.c',
1596 include_directories : includes,
1597 link_with : [libshared],
1598 dependencies : [libcryptsetup],
1599 install_rpath : rootlibexecdir,
1601 install_dir : rootlibexecdir)
1603 executable('systemd-veritysetup-generator',
1604 'src/veritysetup/veritysetup-generator.c',
1605 include_directories : includes,
1606 link_with : [libshared],
1607 dependencies : [libcryptsetup],
1608 install_rpath : rootlibexecdir,
1610 install_dir : systemgeneratordir)
1613 if conf.get('HAVE_SYSV_COMPAT') == 1
1614 executable('systemd-sysv-generator',
1615 'src/sysv-generator/sysv-generator.c',
1616 include_directories : includes,
1617 link_with : [libshared],
1618 install_rpath : rootlibexecdir,
1620 install_dir : systemgeneratordir)
1622 executable('systemd-rc-local-generator',
1623 'src/rc-local-generator/rc-local-generator.c',
1624 include_directories : includes,
1625 link_with : [libshared],
1626 install_rpath : rootlibexecdir,
1628 install_dir : systemgeneratordir)
1631 if conf.get('ENABLE_HOSTNAMED') == 1
1632 executable('systemd-hostnamed',
1633 'src/hostname/hostnamed.c',
1634 include_directories : includes,
1635 link_with : [libshared],
1636 install_rpath : rootlibexecdir,
1638 install_dir : rootlibexecdir)
1640 exe = executable('hostnamectl',
1641 'src/hostname/hostnamectl.c',
1642 include_directories : includes,
1643 link_with : [libshared],
1644 install_rpath : rootlibexecdir,
1646 public_programs += [exe]
1649 if conf.get('ENABLE_LOCALED') == 1
1650 if conf.get('HAVE_XKBCOMMON') == 1
1651 # logind will load libxkbcommon.so dynamically on its own
1657 executable('systemd-localed',
1658 systemd_localed_sources,
1659 include_directories : includes,
1660 link_with : [libshared],
1661 dependencies : deps,
1662 install_rpath : rootlibexecdir,
1664 install_dir : rootlibexecdir)
1666 exe = executable('localectl',
1668 include_directories : includes,
1669 link_with : [libshared],
1670 install_rpath : rootlibexecdir,
1672 public_programs += [exe]
1675 if conf.get('ENABLE_TIMEDATED') == 1
1676 executable('systemd-timedated',
1677 'src/timedate/timedated.c',
1678 include_directories : includes,
1679 link_with : [libshared],
1680 install_rpath : rootlibexecdir,
1682 install_dir : rootlibexecdir)
1684 exe = executable('timedatectl',
1685 'src/timedate/timedatectl.c',
1686 include_directories : includes,
1687 install_rpath : rootlibexecdir,
1688 link_with : [libshared],
1690 public_programs += [exe]
1693 if conf.get('ENABLE_TIMESYNCD') == 1
1694 executable('systemd-timesyncd',
1695 systemd_timesyncd_sources,
1696 include_directories : includes,
1697 link_with : [libshared],
1698 dependencies : [threads,
1700 install_rpath : rootlibexecdir,
1702 install_dir : rootlibexecdir)
1705 if conf.get('ENABLE_MACHINED') == 1
1706 executable('systemd-machined',
1707 systemd_machined_sources,
1708 include_directories : includes,
1709 link_with : [libmachine_core,
1711 install_rpath : rootlibexecdir,
1713 install_dir : rootlibexecdir)
1715 exe = executable('machinectl',
1716 'src/machine/machinectl.c',
1717 include_directories : includes,
1718 link_with : [libshared],
1719 dependencies : [threads,
1722 install_rpath : rootlibexecdir,
1724 install_dir : rootbindir)
1725 public_programs += [exe]
1728 if conf.get('ENABLE_IMPORTD') == 1
1729 executable('systemd-importd',
1730 systemd_importd_sources,
1731 include_directories : includes,
1732 link_with : [libshared],
1733 dependencies : [threads],
1734 install_rpath : rootlibexecdir,
1736 install_dir : rootlibexecdir)
1738 systemd_pull = executable('systemd-pull',
1739 systemd_pull_sources,
1740 include_directories : includes,
1741 link_with : [libshared],
1742 dependencies : [libcurl,
1747 install_rpath : rootlibexecdir,
1749 install_dir : rootlibexecdir)
1751 systemd_import = executable('systemd-import',
1752 systemd_import_sources,
1753 include_directories : includes,
1754 link_with : [libshared],
1755 dependencies : [libcurl,
1759 install_rpath : rootlibexecdir,
1761 install_dir : rootlibexecdir)
1763 systemd_export = executable('systemd-export',
1764 systemd_export_sources,
1765 include_directories : includes,
1766 link_with : [libshared],
1767 dependencies : [libcurl,
1771 install_rpath : rootlibexecdir,
1773 install_dir : rootlibexecdir)
1774 public_programs += [systemd_pull, systemd_import, systemd_export]
1777 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
1778 exe = executable('systemd-journal-upload',
1779 systemd_journal_upload_sources,
1780 include_directories : includes,
1781 link_with : [libshared],
1782 dependencies : [threads,
1787 install_rpath : rootlibexecdir,
1789 install_dir : rootlibexecdir)
1790 public_programs += [exe]
1793 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
1794 s_j_remote = executable('systemd-journal-remote',
1795 systemd_journal_remote_sources,
1796 include_directories : includes,
1797 link_with : [libshared],
1798 dependencies : [threads,
1803 install_rpath : rootlibexecdir,
1805 install_dir : rootlibexecdir)
1807 s_j_gatewayd = executable('systemd-journal-gatewayd',
1808 systemd_journal_gatewayd_sources,
1809 include_directories : includes,
1810 link_with : [libshared],
1811 dependencies : [threads,
1816 install_rpath : rootlibexecdir,
1818 install_dir : rootlibexecdir)
1819 public_programs += [s_j_remote, s_j_gatewayd]
1822 if conf.get('ENABLE_COREDUMP') == 1
1823 executable('systemd-coredump',
1824 systemd_coredump_sources,
1825 include_directories : includes,
1826 link_with : [libshared],
1827 dependencies : [threads,
1832 install_rpath : rootlibexecdir,
1834 install_dir : rootlibexecdir)
1836 exe = executable('coredumpctl',
1837 coredumpctl_sources,
1838 include_directories : includes,
1839 link_with : [libshared],
1840 dependencies : [threads,
1843 install_rpath : rootlibexecdir,
1845 public_programs += [exe]
1848 if conf.get('ENABLE_BINFMT') == 1
1849 exe = executable('systemd-binfmt',
1850 'src/binfmt/binfmt.c',
1851 include_directories : includes,
1852 link_with : [libshared],
1853 install_rpath : rootlibexecdir,
1855 install_dir : rootlibexecdir)
1856 public_programs += [exe]
1858 meson.add_install_script('sh', '-c',
1859 mkdir_p.format(binfmtdir))
1860 meson.add_install_script('sh', '-c',
1861 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1864 if conf.get('ENABLE_VCONSOLE') == 1
1865 executable('systemd-vconsole-setup',
1866 'src/vconsole/vconsole-setup.c',
1867 include_directories : includes,
1868 link_with : [libshared],
1869 install_rpath : rootlibexecdir,
1871 install_dir : rootlibexecdir)
1874 if conf.get('ENABLE_RANDOMSEED') == 1
1875 executable('systemd-random-seed',
1876 'src/random-seed/random-seed.c',
1877 include_directories : includes,
1878 link_with : [libshared],
1879 install_rpath : rootlibexecdir,
1881 install_dir : rootlibexecdir)
1884 if conf.get('ENABLE_FIRSTBOOT') == 1
1885 executable('systemd-firstboot',
1886 'src/firstboot/firstboot.c',
1887 include_directories : includes,
1888 link_with : [libshared],
1889 dependencies : [libcrypt],
1890 install_rpath : rootlibexecdir,
1892 install_dir : rootbindir)
1895 executable('systemd-remount-fs',
1896 'src/remount-fs/remount-fs.c',
1897 'src/core/mount-setup.c',
1898 'src/core/mount-setup.h',
1899 include_directories : includes,
1900 link_with : [libshared],
1901 install_rpath : rootlibexecdir,
1903 install_dir : rootlibexecdir)
1905 executable('systemd-machine-id-setup',
1906 'src/machine-id-setup/machine-id-setup-main.c',
1907 'src/core/machine-id-setup.c',
1908 'src/core/machine-id-setup.h',
1909 include_directories : includes,
1910 link_with : [libshared],
1911 install_rpath : rootlibexecdir,
1913 install_dir : rootbindir)
1915 executable('systemd-fsck',
1917 include_directories : includes,
1918 link_with : [libshared],
1919 install_rpath : rootlibexecdir,
1921 install_dir : rootlibexecdir)
1923 executable('systemd-sleep',
1924 'src/sleep/sleep.c',
1925 include_directories : includes,
1926 link_with : [libshared],
1927 install_rpath : rootlibexecdir,
1929 install_dir : rootlibexecdir)
1931 exe = executable('systemd-sysctl',
1932 'src/sysctl/sysctl.c',
1933 include_directories : includes,
1934 link_with : [libshared],
1935 install_rpath : rootlibexecdir,
1937 install_dir : rootlibexecdir)
1938 public_programs += [exe]
1940 executable('systemd-ac-power',
1941 'src/ac-power/ac-power.c',
1942 include_directories : includes,
1943 link_with : [libshared],
1944 install_rpath : rootlibexecdir,
1946 install_dir : rootlibexecdir)
1948 exe = executable('systemd-detect-virt',
1949 'src/detect-virt/detect-virt.c',
1950 include_directories : includes,
1951 link_with : [libshared],
1952 install_rpath : rootlibexecdir,
1954 public_programs += [exe]
1956 exe = executable('systemd-delta',
1957 'src/delta/delta.c',
1958 include_directories : includes,
1959 link_with : [libshared],
1960 install_rpath : rootlibexecdir,
1962 public_programs += [exe]
1964 exe = executable('systemd-escape',
1965 'src/escape/escape.c',
1966 include_directories : includes,
1967 link_with : [libshared],
1968 install_rpath : rootlibexecdir,
1970 install_dir : rootbindir)
1971 public_programs += [exe]
1973 exe = executable('systemd-notify',
1974 'src/notify/notify.c',
1975 include_directories : includes,
1976 link_with : [libshared],
1977 install_rpath : rootlibexecdir,
1979 install_dir : rootbindir)
1980 public_programs += [exe]
1982 executable('systemd-volatile-root',
1983 'src/volatile-root/volatile-root.c',
1984 include_directories : includes,
1985 link_with : [libshared],
1986 install_rpath : rootlibexecdir,
1988 install_dir : rootlibexecdir)
1990 executable('systemd-cgroups-agent',
1991 'src/cgroups-agent/cgroups-agent.c',
1992 include_directories : includes,
1993 link_with : [libshared],
1994 install_rpath : rootlibexecdir,
1996 install_dir : rootlibexecdir)
1998 exe = executable('systemd-path',
2000 include_directories : includes,
2001 link_with : [libshared],
2002 install_rpath : rootlibexecdir,
2004 public_programs += [exe]
2006 exe = executable('systemd-ask-password',
2007 'src/ask-password/ask-password.c',
2008 include_directories : includes,
2009 link_with : [libshared],
2010 install_rpath : rootlibexecdir,
2012 install_dir : rootbindir)
2013 public_programs += [exe]
2015 executable('systemd-reply-password',
2016 'src/reply-password/reply-password.c',
2017 include_directories : includes,
2018 link_with : [libshared],
2019 install_rpath : rootlibexecdir,
2021 install_dir : rootlibexecdir)
2023 exe = executable('systemd-tty-ask-password-agent',
2024 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2025 include_directories : includes,
2026 link_with : [libshared],
2027 install_rpath : rootlibexecdir,
2029 install_dir : rootbindir)
2030 public_programs += [exe]
2032 exe = executable('systemd-cgls',
2034 include_directories : includes,
2035 link_with : [libshared],
2036 install_rpath : rootlibexecdir,
2038 public_programs += [exe]
2040 exe = executable('systemd-cgtop',
2041 'src/cgtop/cgtop.c',
2042 include_directories : includes,
2043 link_with : [libshared],
2044 install_rpath : rootlibexecdir,
2046 public_programs += [exe]
2048 executable('systemd-initctl',
2049 'src/initctl/initctl.c',
2050 include_directories : includes,
2051 link_with : [libshared],
2052 install_rpath : rootlibexecdir,
2054 install_dir : rootlibexecdir)
2056 exe = executable('systemd-mount',
2057 'src/mount/mount-tool.c',
2058 include_directories : includes,
2059 link_with : [libshared],
2060 install_rpath : rootlibexecdir,
2062 public_programs += [exe]
2064 meson.add_install_script(meson_make_symlink,
2065 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2067 exe = executable('systemd-run',
2069 include_directories : includes,
2070 link_with : [libshared],
2071 install_rpath : rootlibexecdir,
2073 public_programs += [exe]
2075 exe = executable('systemd-stdio-bridge',
2076 'src/stdio-bridge/stdio-bridge.c',
2077 include_directories : includes,
2078 link_with : [libshared],
2079 install_rpath : rootlibexecdir,
2081 public_programs += [exe]
2083 exe = executable('busctl',
2084 'src/busctl/busctl.c',
2085 'src/busctl/busctl-introspect.c',
2086 'src/busctl/busctl-introspect.h',
2087 include_directories : includes,
2088 link_with : [libshared],
2089 install_rpath : rootlibexecdir,
2091 public_programs += [exe]
2093 if conf.get('ENABLE_SYSUSERS') == 1
2094 exe = executable('systemd-sysusers',
2095 'src/sysusers/sysusers.c',
2096 include_directories : includes,
2097 link_with : [libshared],
2098 install_rpath : rootlibexecdir,
2100 install_dir : rootbindir)
2101 public_programs += [exe]
2104 if conf.get('ENABLE_TMPFILES') == 1
2105 exe = executable('systemd-tmpfiles',
2106 'src/tmpfiles/tmpfiles.c',
2107 include_directories : includes,
2108 link_with : [libshared],
2109 dependencies : [libacl],
2110 install_rpath : rootlibexecdir,
2112 install_dir : rootbindir)
2113 public_programs += [exe]
2116 if conf.get('ENABLE_HWDB') == 1
2117 exe = executable('systemd-hwdb',
2119 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2120 include_directories : includes,
2121 link_with : [libudev_internal],
2122 install_rpath : udev_rpath,
2124 install_dir : rootbindir)
2125 public_programs += [exe]
2128 if conf.get('ENABLE_QUOTACHECK') == 1
2129 executable('systemd-quotacheck',
2130 'src/quotacheck/quotacheck.c',
2131 include_directories : includes,
2132 link_with : [libshared],
2133 install_rpath : rootlibexecdir,
2135 install_dir : rootlibexecdir)
2138 exe = executable('systemd-socket-proxyd',
2139 'src/socket-proxy/socket-proxyd.c',
2140 include_directories : includes,
2141 link_with : [libshared],
2142 dependencies : [threads],
2143 install_rpath : rootlibexecdir,
2145 install_dir : rootlibexecdir)
2146 public_programs += [exe]
2148 exe = executable('systemd-udevd',
2149 systemd_udevd_sources,
2150 include_directories : includes,
2151 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2152 link_with : [libudev_core,
2155 dependencies : [threads,
2160 install_rpath : udev_rpath,
2162 install_dir : rootlibexecdir)
2163 public_programs += [exe]
2165 exe = executable('udevadm',
2167 include_directories : includes,
2168 link_with : [libudev_core,
2171 dependencies : [threads,
2176 install_rpath : udev_rpath,
2178 install_dir : rootbindir)
2179 public_programs += [exe]
2181 executable('systemd-shutdown',
2182 systemd_shutdown_sources,
2183 include_directories : includes,
2184 link_with : [libshared],
2185 install_rpath : rootlibexecdir,
2187 install_dir : rootlibexecdir)
2189 executable('systemd-update-done',
2190 'src/update-done/update-done.c',
2191 include_directories : includes,
2192 link_with : [libshared],
2193 install_rpath : rootlibexecdir,
2195 install_dir : rootlibexecdir)
2197 executable('systemd-update-utmp',
2198 'src/update-utmp/update-utmp.c',
2199 include_directories : includes,
2200 link_with : [libshared],
2201 dependencies : [libaudit],
2202 install_rpath : rootlibexecdir,
2204 install_dir : rootlibexecdir)
2206 if conf.get('HAVE_KMOD') == 1
2207 executable('systemd-modules-load',
2208 'src/modules-load/modules-load.c',
2209 include_directories : includes,
2210 link_with : [libshared],
2211 dependencies : [libkmod],
2212 install_rpath : rootlibexecdir,
2214 install_dir : rootlibexecdir)
2216 meson.add_install_script('sh', '-c',
2217 mkdir_p.format(modulesloaddir))
2218 meson.add_install_script('sh', '-c',
2219 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2222 exe = executable('systemd-nspawn',
2223 systemd_nspawn_sources,
2224 'src/core/mount-setup.c', # FIXME: use a variable?
2225 'src/core/mount-setup.h',
2226 'src/core/loopback-setup.c',
2227 'src/core/loopback-setup.h',
2228 include_directories : [includes, include_directories('src/nspawn')],
2229 link_with : [libshared],
2230 dependencies : [libacl,
2234 install_rpath : rootlibexecdir,
2236 public_programs += [exe]
2238 if conf.get('ENABLE_NETWORKD') == 1
2239 executable('systemd-networkd',
2240 systemd_networkd_sources,
2241 include_directories : includes,
2242 link_with : [libnetworkd_core,
2246 dependencies : [threads],
2247 install_rpath : rootlibexecdir,
2249 install_dir : rootlibexecdir)
2251 executable('systemd-networkd-wait-online',
2252 systemd_networkd_wait_online_sources,
2253 include_directories : includes,
2254 link_with : [libnetworkd_core,
2256 install_rpath : rootlibexecdir,
2258 install_dir : rootlibexecdir)
2260 exe = executable('networkctl',
2262 include_directories : includes,
2263 link_with : [libsystemd_network,
2265 install_rpath : rootlibexecdir,
2267 install_dir : rootbindir)
2268 public_programs += [exe]
2270 ############################################################
2272 foreach tuple : tests
2274 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2275 dependencies = tuple[2]
2276 condition = tuple.length() >= 4 ? tuple[3] : ''
2277 type = tuple.length() >= 5 ? tuple[4] : ''
2278 defs = tuple.length() >= 6 ? tuple[5] : []
2279 incs = tuple.length() >= 7 ? tuple[6] : includes
2282 name = sources[0].split('/')[-1].split('.')[0]
2283 if type.startswith('timeout=')
2284 timeout = type.split('=')[1].to_int()
2288 if condition == '' or conf.get(condition) == 1
2292 include_directories : incs,
2293 link_with : link_with,
2294 dependencies : dependencies,
2296 install_rpath : rootlibexecdir,
2297 install : install_tests,
2298 install_dir : join_paths(testsdir, type))
2301 message('@0@ is a manual test'.format(name))
2302 elif type == 'unsafe' and want_tests != 'unsafe'
2303 message('@0@ is an unsafe test'.format(name))
2310 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2314 test_libsystemd_sym = executable(
2315 'test-libsystemd-sym',
2316 test_libsystemd_sym_c,
2317 include_directories : includes,
2318 link_with : [libsystemd],
2319 install : install_tests,
2320 install_dir : testsdir)
2321 test('test-libsystemd-sym',
2322 test_libsystemd_sym)
2324 test_libudev_sym = executable(
2327 include_directories : includes,
2328 c_args : ['-Wno-deprecated-declarations'],
2329 link_with : [libudev],
2330 install : install_tests,
2331 install_dir : testsdir)
2332 test('test-libudev-sym',
2335 ############################################################
2337 make_directive_index_py = find_program('tools/make-directive-index.py')
2338 make_man_index_py = find_program('tools/make-man-index.py')
2339 xml_helper_py = find_program('tools/xml_helper.py')
2340 hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2344 subdir('sysusers.d')
2345 subdir('tmpfiles.d')
2350 subdir('shell-completion/bash')
2351 subdir('shell-completion/zsh')
2352 subdir('docs/sysvinit')
2353 subdir('docs/var-log')
2355 # FIXME: figure out if the warning is true:
2356 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2357 install_subdir('factory/etc',
2358 install_dir : factorydir)
2361 install_data('xorg/50-systemd-user.sh',
2362 install_dir : xinitrcdir)
2363 install_data('system-preset/90-systemd.preset',
2364 install_dir : systempresetdir)
2365 install_data('modprobe.d/systemd.conf',
2366 install_dir : modprobedir)
2367 install_data('README',
2374 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2375 install_dir : docdir)
2377 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2378 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2380 ############################################################
2382 meson_check_help = find_program('tools/meson-check-help.sh')
2384 foreach exec : public_programs
2385 name = exec.full_path().split('/')[-1]
2386 test('check-help-' + name,
2388 args : [exec.full_path()])
2391 ############################################################
2394 all_files = run_command(
2396 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2399 all_files = files(all_files.stdout().split())
2404 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2408 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2412 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2415 command : [meson_git_contrib_sh])
2419 git_head = run_command(
2421 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2422 'rev-parse', 'HEAD']).stdout().strip()
2423 git_head_short = run_command(
2425 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2426 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2430 command : ['git', 'archive',
2431 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2433 '--prefix', 'systemd-@0@/'.format(git_head),
2437 ############################################################
2440 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2442 'prefix: @0@'.format(prefixdir),
2443 'rootprefix: @0@'.format(rootprefixdir),
2444 'sysconf dir: @0@'.format(sysconfdir),
2445 'includedir: @0@'.format(includedir),
2446 'lib dir: @0@'.format(libdir),
2447 'rootlib dir: @0@'.format(rootlibdir),
2448 'SysV init scripts: @0@'.format(sysvinit_path),
2449 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2450 'PAM modules dir: @0@'.format(pamlibdir),
2451 'PAM configuration dir: @0@'.format(pamconfdir),
2452 'RPM macros dir: @0@'.format(rpmmacrosdir),
2453 'modprobe.d dir: @0@'.format(modprobedir),
2454 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2455 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2456 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2457 'bash completions dir: @0@'.format(bashcompletiondir),
2458 'zsh completions dir: @0@'.format(zshcompletiondir),
2459 'extra start script: @0@'.format(get_option('rc-local')),
2460 'extra stop script: @0@'.format(get_option('halt-local')),
2461 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2462 get_option('debug-tty')),
2463 'TTY GID: @0@'.format(tty_gid),
2464 'maximum system UID: @0@'.format(system_uid_max),
2465 'maximum system GID: @0@'.format(system_gid_max),
2466 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2467 'render group access mode: @0@'.format(get_option('group-render-mode')),
2468 'certificate root: @0@'.format(get_option('certificate-root')),
2469 'support URL: @0@'.format(support_url),
2470 'nobody user name: @0@'.format(get_option('nobody-user')),
2471 'nobody group name: @0@'.format(get_option('nobody-group')),
2472 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2473 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
2475 'default DNSSEC mode: @0@'.format(default_dnssec),
2476 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2477 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2479 alt_dns_servers = '\n '.join(dns_servers.split(' '))
2480 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2482 'default DNS servers: @0@'.format(alt_dns_servers),
2483 'default NTP servers: @0@'.format(alt_ntp_servers)]
2485 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2486 '@@0@'.format(time_epoch)).stdout().strip()
2488 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2491 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2492 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2493 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2495 if conf.get('ENABLE_EFI') == 1
2497 'efi arch: @0@'.format(efi_arch)]
2501 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2502 'EFI CC @0@'.format(efi_cc),
2503 'EFI libdir: @0@'.format(efi_libdir),
2504 'EFI ldsdir: @0@'.format(efi_ldsdir),
2505 'EFI includedir: @0@'.format(efi_incdir)]
2558 ['legacy pkla', install_polkit_pkla],
2560 ['gnu-efi', have_gnu_efi],
2566 ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
2569 ['man pages', want_man],
2570 ['html pages', want_html],
2571 ['man page indices', want_man and have_lxml],
2572 ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
2577 ['adm group', get_option('adm-group')],
2578 ['wheel group', get_option('wheel-group')],
2581 ['debug mmap cache'],
2584 cond = tuple.get(1, '')
2586 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2587 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2588 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
2593 missing += [tuple[0]]
2599 'enabled features: @0@'.format(', '.join(found)),
2601 'disabled features: @0@'.format(', '.join(missing)),
2603 message('\n '.join(status))