1 # SPDX-License-Identifier: LGPL-2.1-or-later
3 project('systemd', 'c',
13 meson_version : '>= 0.53.2',
16 libsystemd_version = '0.34.0'
17 libudev_version = '1.7.4'
19 conf = configuration_data()
20 conf.set_quoted('PROJECT_URL', 'https://systemd.io/')
21 conf.set('PROJECT_VERSION', meson.project_version(),
22 description : 'Numerical project version (used where a simple number is expected)')
24 # This is to be used instead of meson.source_root(), as the latter will return
25 # the wrong result when systemd is being built as a meson subproject
26 project_source_root = meson.current_source_dir()
27 project_build_root = meson.current_build_dir()
28 relative_source_path = run_command('realpath',
29 '--relative-to=@0@'.format(project_build_root),
31 check : true).stdout().strip()
32 conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
34 conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer',
35 description : 'tailor build to development or release builds')
36 verification = get_option('log-message-verification')
37 if verification == 'auto'
38 verification = conf.get('BUILD_MODE_DEVELOPER') == 1
40 verification = verification == 'true'
42 conf.set10('LOG_MESSAGE_VERIFICATION', verification)
44 want_ossfuzz = get_option('oss-fuzz')
45 want_libfuzzer = get_option('llvm-fuzz')
46 if want_ossfuzz and want_libfuzzer
47 error('only one of oss-fuzz or llvm-fuzz can be specified')
50 skip_deps = want_ossfuzz or get_option('skip-deps')
51 fuzzer_build = want_ossfuzz or want_libfuzzer
53 # If we're building *not* for actual fuzzing, allow input samples of any size
54 # (for testing and for reproduction of issues discovered with previously-higher
56 conf.set10('FUZZ_USE_SIZE_LIMIT', fuzzer_build)
58 # Create a title-less summary section early, so it ends up first in the output.
59 # More items are added later after they have been detected.
60 summary({'build mode' : get_option('mode')})
62 #####################################################################
64 # Try to install the git pre-commit hook
65 add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
66 if add_git_hook_sh.found()
67 git_hook = run_command(add_git_hook_sh, check : false)
68 if git_hook.returncode() == 0
69 message(git_hook.stdout().strip())
73 #####################################################################
76 if get_option('split-usr') == 'auto'
77 split_usr = not fs.is_symlink('/bin')
79 split_usr = get_option('split-usr') == 'true'
82 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
83 + ' split-usr mode is going to be removed\n' +
84 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
86 conf.set10('HAVE_SPLIT_USR', split_usr,
87 description : '/usr/bin and /bin directories are separate')
89 if get_option('split-bin') == 'auto'
90 split_bin = not fs.is_symlink('/usr/sbin')
92 split_bin = get_option('split-bin') == 'true'
94 conf.set10('HAVE_SPLIT_BIN', split_bin,
95 description : 'bin and sbin directories are separate')
97 rootprefixdir = get_option('rootprefix')
98 # Unusual rootprefixdir values are used by some distros
99 # (see https://github.com/systemd/systemd/pull/7461).
100 rootprefix_default = split_usr ? '/' : '/usr'
101 if rootprefixdir == ''
102 rootprefixdir = rootprefix_default
104 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
106 have_standalone_binaries = get_option('standalone-binaries')
108 sysvinit_path = get_option('sysvinit-path')
109 sysvrcnd_path = get_option('sysvrcnd-path')
110 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
111 description : 'SysV init scripts and rcN.d links are supported')
112 conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
114 if get_option('hibernate') and not get_option('initrd')
115 error('hibernate depends on initrd')
118 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
119 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
120 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
122 # Meson ignores the preceding arguments when joining paths if an absolute
123 # component is encountered, so this should canonicalize various paths when they
124 # are absolute or relative.
125 prefixdir = get_option('prefix')
126 if not prefixdir.startswith('/')
127 error('Prefix is not absolute: "@0@"'.format(prefixdir))
129 if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
130 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
131 rootprefixdir, prefixdir))
134 bindir = prefixdir / get_option('bindir')
135 libdir = prefixdir / get_option('libdir')
136 sysconfdir = prefixdir / get_option('sysconfdir')
137 includedir = prefixdir / get_option('includedir')
138 datadir = prefixdir / get_option('datadir')
139 localstatedir = '/' / get_option('localstatedir')
141 rootbindir = rootprefixdir / 'bin'
142 rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin')
143 rootlibexecdir = rootprefixdir / 'lib/systemd'
145 rootlibdir = get_option('rootlibdir')
147 rootlibdir = rootprefixdir / libdir.split('/')[-1]
150 install_sysconfdir = get_option('install-sysconfdir') != 'false'
151 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
152 # Dirs of external packages
153 pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig'
154 pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
155 polkitpolicydir = datadir / 'polkit-1/actions'
156 polkitrulesdir = datadir / 'polkit-1/rules.d'
157 polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
158 xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d'
159 rpmmacrosdir = get_option('rpmmacrosdir')
160 if rpmmacrosdir != 'no'
161 rpmmacrosdir = prefixdir / rpmmacrosdir
163 modprobedir = rootprefixdir / 'lib/modprobe.d'
166 pkgdatadir = datadir / 'systemd'
167 environmentdir = prefixdir / 'lib/environment.d'
168 pkgsysconfdir = sysconfdir / 'systemd'
169 userunitdir = prefixdir / 'lib/systemd/user'
170 userpresetdir = prefixdir / 'lib/systemd/user-preset'
171 tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
172 sysusersdir = prefixdir / 'lib/sysusers.d'
173 sysctldir = prefixdir / 'lib/sysctl.d'
174 binfmtdir = prefixdir / 'lib/binfmt.d'
175 modulesloaddir = prefixdir / 'lib/modules-load.d'
176 networkdir = rootprefixdir / 'lib/systemd/network'
177 pkgincludedir = includedir / 'systemd'
178 systemgeneratordir = rootlibexecdir / 'system-generators'
179 usergeneratordir = prefixdir / 'lib/systemd/user-generators'
180 systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
181 userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
182 systemshutdowndir = rootlibexecdir / 'system-shutdown'
183 systemsleepdir = rootlibexecdir / 'system-sleep'
184 systemunitdir = rootprefixdir / 'lib/systemd/system'
185 systempresetdir = rootprefixdir / 'lib/systemd/system-preset'
186 udevlibexecdir = rootprefixdir / 'lib/udev'
187 udevrulesdir = udevlibexecdir / 'rules.d'
188 udevhwdbdir = udevlibexecdir / 'hwdb.d'
189 catalogdir = prefixdir / 'lib/systemd/catalog'
190 kerneldir = prefixdir / 'lib/kernel'
191 kernelinstalldir = kerneldir / 'install.d'
192 factorydir = datadir / 'factory'
193 bootlibdir = prefixdir / 'lib/systemd/boot/efi'
194 testsdir = prefixdir / 'lib/systemd/tests'
195 systemdstatedir = localstatedir / 'lib/systemd'
196 catalogstatedir = systemdstatedir / 'catalog'
197 randomseeddir = localstatedir / 'lib/systemd'
198 profiledir = rootlibexecdir / 'portable' / 'profile'
199 ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
201 docdir = get_option('docdir')
203 docdir = datadir / 'doc/systemd'
206 pamlibdir = get_option('pamlibdir')
208 pamlibdir = rootlibdir / 'security'
211 pamconfdir = get_option('pamconfdir')
213 pamconfdir = prefixdir / 'lib/pam.d'
216 libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir')
217 if libcryptsetup_plugins_dir == ''
218 libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup'
221 memory_accounting_default = get_option('memory-accounting-default')
222 status_unit_format_default = get_option('status-unit-format-default')
224 conf.set_quoted('BINFMT_DIR', binfmtdir)
225 conf.set_quoted('BOOTLIBDIR', bootlibdir)
226 conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database')
227 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
228 conf.set_quoted('DOC_DIR', docdir)
229 conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd')
230 conf.set_quoted('ENVIRONMENT_DIR', environmentdir)
231 conf.set_quoted('INCLUDE_DIR', includedir)
232 conf.set_quoted('LIBDIR', libdir)
233 conf.set_quoted('MODPROBE_DIR', modprobedir)
234 conf.set_quoted('MODULESLOAD_DIR', modulesloaddir)
235 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
236 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent')
237 conf.set_quoted('PREFIX', prefixdir)
238 conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed')
239 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
240 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
241 conf.set_quoted('ROOTBINDIR', rootbindir)
242 conf.set_quoted('ROOTLIBDIR', rootlibdir)
243 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
244 conf.set_quoted('ROOTPREFIX', rootprefixdir)
245 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
246 conf.set_quoted('SYSCONF_DIR', sysconfdir)
247 conf.set_quoted('SYSCTL_DIR', sysctldir)
248 conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl')
249 conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd')
250 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
251 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent')
252 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup')
253 conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export')
254 conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck')
255 conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs')
256 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework')
257 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs')
258 conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import')
259 conf.set_quoted('SYSTEMD_INTEGRITYSETUP_PATH', rootlibexecdir / 'systemd-integritysetup')
260 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map')
261 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map')
262 conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs')
263 conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull')
264 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown')
265 conf.set_quoted('SYSTEMD_TEST_DATA', testsdir / 'testdata')
266 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent')
267 conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper')
268 conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork')
269 conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup')
270 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system')
271 conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir)
272 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
273 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
274 conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
275 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
276 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
277 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
278 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
279 conf.set_quoted('SYSUSERS_DIR', sysusersdir)
280 conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
281 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
282 conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
283 conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
284 conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout'))
285 conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user')
286 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
287 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
288 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
289 conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg')
290 conf.set_quoted('USER_PRESET_DIR', userpresetdir)
291 conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg')
293 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
294 conf.set10('ENABLE_URLIFY', get_option('urlify'))
295 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
296 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
297 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
298 conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default)
300 #####################################################################
302 cc = meson.get_compiler('c')
303 pkgconfig = import('pkgconfig')
304 meson_build_sh = find_program('tools/meson-build.sh')
306 want_tests = get_option('tests')
307 slow_tests = want_tests != 'false' and get_option('slow-tests')
308 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
309 install_tests = get_option('install-tests')
311 if add_languages('cpp', required : fuzzer_build)
312 # Used only for tests
313 cxx = meson.get_compiler('cpp')
314 cxx_cmd = ' '.join(cxx.cmd_array())
320 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
321 if fuzzing_engine.found()
322 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
323 elif cc.has_argument('-fsanitize=fuzzer-no-link')
324 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
326 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
329 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
332 # Those generate many false positives, and we do not want to change the code to
334 basic_disabled_warnings = [
335 '-Wno-format-signedness',
336 '-Wno-missing-field-initializers',
337 '-Wno-unused-parameter',
340 possible_common_cc_flags = [
344 '-Werror=implicit-function-declaration',
345 '-Werror=incompatible-pointer-types',
346 '-Werror=int-conversion',
348 '-Werror=override-init',
349 '-Werror=return-type',
350 '-Werror=shift-count-overflow',
351 '-Werror=shift-overflow=2',
354 # gperf prevents us from enabling this because it does not emit fallthrough
355 # attribute with clang.
356 #'-Wimplicit-fallthrough',
357 '-Wimplicit-fallthrough=5',
360 '-Wmissing-include-dirs',
361 '-Wmissing-noreturn',
363 '-Wold-style-definition',
367 '-Wstrict-aliasing=2',
368 '-Wstrict-prototypes',
369 '-Wsuggest-attribute=noreturn',
373 # negative arguments are correctly detected starting with meson 0.46.
374 '-Wno-error=#warnings', # clang
375 '-Wno-string-plus-int', # clang
378 c_args = get_option('c_args')
380 # Disable -Wmaybe-uninitialized when compiling with -Os/-O1/-O3/etc. There are
381 # too many false positives with gcc >= 8. Effectively, we only test with -O0
382 # and -O2; this should be enough to catch most important cases without too much
383 # busywork. See https://github.com/systemd/systemd/pull/19226.
384 if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
385 cc.version().version_compare('<10') or
390 possible_common_cc_flags += '-Wno-maybe-uninitialized'
393 # Disable -Wno-unused-result with gcc, see
394 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
395 if cc.get_id() == 'gcc'
396 possible_common_cc_flags += '-Wno-unused-result'
399 # --as-needed and --no-undefined are provided by meson by default,
400 # run 'meson configure' to see what is enabled
401 possible_link_flags = [
402 '-Wl,--fatal-warnings',
408 if get_option('b_sanitize') == 'none'
409 possible_link_flags += '-Wl,--warn-common'
412 if cc.get_id() == 'clang'
413 possible_common_cc_flags += [
414 '-Wno-typedef-redefinition',
415 '-Wno-gnu-variable-sized-type-not-at-end',
419 if get_option('mode') == 'release'
420 # We could enable 'pattern' for developer mode, but that can interfere with
421 # valgrind and sanitizer builds. Also, clang does not zero-initialize unions,
422 # breaking some of our code (https://reviews.llvm.org/D68115).
423 possible_common_cc_flags += '-ftrivial-auto-var-init=zero'
426 possible_cc_flags = possible_common_cc_flags + [
427 '-Werror=missing-declarations',
428 '-Werror=missing-prototypes',
429 '-fdiagnostics-show-option',
431 '-fno-strict-aliasing',
433 '-fstack-protector-strong',
434 '-fvisibility=hidden',
435 '--param=ssp-buffer-size=4',
438 if get_option('buildtype') != 'debug'
439 possible_cc_flags += [
440 '-ffunction-sections',
444 possible_link_flags += '-Wl,--gc-sections'
447 add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
448 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
449 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
451 have = cc.has_argument('-Wzero-length-bounds')
452 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
456 #include <inttypes.h>
457 typedef uint64_t usec_t;
458 usec_t now(clockid_t clock);
463 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
464 add_project_arguments('-Werror=shadow', language : 'c')
468 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
471 cpp = ' '.join(cc.cmd_array()) + ' -E'
473 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
475 #####################################################################
476 # compilation result tests
478 conf.set('_GNU_SOURCE', true)
479 conf.set('__SANE_USERSPACE_TYPES__', true)
480 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
482 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
483 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
484 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
485 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
486 conf.set('SIZEOF_TIMEX_MEMBER', cc.sizeof('typeof(((struct timex *)0)->freq)', prefix : '#include <sys/timex.h>'))
490 #include <sys/mount.h>
491 #include <sys/stat.h>
492 #include <linux/fs.h>
495 foreach decl : ['char16_t',
501 # We get -1 if the size cannot be determined
502 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
504 if decl == 'struct statx'
506 want_linux_stat_h = false
508 have = cc.sizeof(decl,
509 prefix : decl_headers + '#include <linux/stat.h>',
510 args : '-D_GNU_SOURCE') > 0
511 want_linux_stat_h = have
515 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
518 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
520 foreach ident : ['secure_getenv', '__secure_getenv']
521 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
525 ['memfd_create', '''#include <sys/mman.h>'''],
526 ['gettid', '''#include <sys/types.h>
527 #include <unistd.h>'''],
528 ['pivot_root', '''#include <stdlib.h>
529 #include <unistd.h>'''], # no known header declares pivot_root
530 ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get
531 ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set
532 ['name_to_handle_at', '''#include <sys/types.h>
533 #include <sys/stat.h>
534 #include <fcntl.h>'''],
535 ['setns', '''#include <sched.h>'''],
536 ['renameat2', '''#include <stdio.h>
537 #include <fcntl.h>'''],
538 ['kcmp', '''#include <linux/kcmp.h>'''],
539 ['keyctl', '''#include <sys/types.h>
540 #include <keyutils.h>'''],
541 ['copy_file_range', '''#include <sys/syscall.h>
542 #include <unistd.h>'''],
543 ['bpf', '''#include <sys/syscall.h>
544 #include <unistd.h>'''],
545 ['statx', '''#include <sys/types.h>
546 #include <sys/stat.h>
547 #include <unistd.h>'''],
548 ['explicit_bzero' , '''#include <string.h>'''],
549 ['reallocarray', '''#include <stdlib.h>'''],
550 ['set_mempolicy', '''#include <stdlib.h>
551 #include <unistd.h>'''],
552 ['get_mempolicy', '''#include <stdlib.h>
553 #include <unistd.h>'''],
554 ['pidfd_send_signal', '''#include <stdlib.h>
557 #include <sys/wait.h>'''],
558 ['pidfd_open', '''#include <stdlib.h>
561 #include <sys/wait.h>'''],
562 ['rt_sigqueueinfo', '''#include <stdlib.h>
565 #include <sys/wait.h>'''],
566 ['mallinfo', '''#include <malloc.h>'''],
567 ['mallinfo2', '''#include <malloc.h>'''],
568 ['execveat', '''#include <unistd.h>'''],
569 ['close_range', '''#include <unistd.h>'''],
570 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
571 ['mount_setattr', '''#include <sys/mount.h>'''],
572 ['move_mount', '''#include <sys/mount.h>'''],
573 ['open_tree', '''#include <sys/mount.h>'''],
574 ['getdents64', '''#include <dirent.h>'''],
577 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
578 conf.set10('HAVE_' + ident[0].to_upper(), have)
581 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
582 conf.set10('USE_SYS_RANDOM_H', true)
583 conf.set10('HAVE_GETRANDOM', true)
585 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
586 conf.set10('USE_SYS_RANDOM_H', false)
587 conf.set10('HAVE_GETRANDOM', have)
590 #####################################################################
592 version_tag = get_option('version-tag')
594 vcs_data = configuration_data()
595 vcs_data.set('VCS_TAG', version_tag)
596 version_h = configure_file(configuration : vcs_data,
597 input : 'src/version/version.h.in',
598 output : 'version.h')
601 project_source_root + '/tools/meson-vcs-tag.sh',
603 meson.project_version()]
606 input : 'src/version/version.h.in',
607 output : 'version.h',
611 versiondep = declare_dependency(sources: version_h)
613 shared_lib_tag = get_option('shared-lib-tag')
614 if shared_lib_tag == ''
615 shared_lib_tag = meson.project_version()
618 sh = find_program('sh')
619 echo = find_program('echo')
620 sed = find_program('sed')
621 awk = find_program('awk')
622 stat = find_program('stat')
623 ln = find_program('ln')
624 git = find_program('git', required : false)
625 env = find_program('env')
626 perl = find_program('perl', required : false)
627 rsync = find_program('rsync', required : false)
628 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
630 mkdir_p = 'mkdir -p $DESTDIR/@0@'
632 # If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
633 # /usr/sbin, /sbin, and fall back to the default from middle column.
634 progs = [['quotaon', '/usr/sbin/quotaon' ],
635 ['quotacheck', '/usr/sbin/quotacheck' ],
636 ['kmod', '/usr/bin/kmod' ],
637 ['kexec', '/usr/sbin/kexec' ],
638 ['sulogin', '/usr/sbin/sulogin' ],
639 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
640 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
641 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
642 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
643 ['nologin', '/usr/sbin/nologin', ],
646 path = get_option(prog[0] + '-path')
648 message('Using @1@ for @0@'.format(prog[0], path))
650 exe = find_program(prog[0],
651 '/usr/sbin/' + prog[0],
654 path = exe.found() ? exe.path() : prog[1]
656 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
657 conf.set_quoted(name, path)
660 conf.set_quoted('TELINIT', get_option('telinit-path'))
662 if run_command(ln, '--relative', '--help', check : false).returncode() != 0
663 error('ln does not support --relative (added in coreutils 8.16)')
666 ############################################################
668 python = find_program('python3')
669 if run_command(python, '-c', 'import jinja2', check : false).returncode() != 0
670 error('python3 jinja2 missing')
673 ############################################################
675 gperf = find_program('gperf')
677 gperf_test_format = '''
679 const char * in_word_set(const char *, @0@);
682 gperf_snippet = run_command(sh, '-c', 'echo foo,bar | "$1" -L ANSI-C', '_', gperf,
684 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
685 if cc.compiles(gperf_test)
686 gperf_len_type = 'size_t'
688 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
689 if cc.compiles(gperf_test)
690 gperf_len_type = 'unsigned'
692 error('unable to determine gperf len type')
695 message('gperf len type is @0@'.format(gperf_len_type))
696 conf.set('GPERF_LEN_TYPE', gperf_len_type,
697 description : 'The type of gperf "len" parameter')
699 ############################################################
701 if not cc.has_header('sys/capability.h')
702 error('POSIX caps headers not found')
704 foreach header : ['crypt.h',
706 'linux/vm_sockets.h',
708 'valgrind/memcheck.h',
709 'valgrind/valgrind.h',
710 'linux/time_types.h',
714 conf.set10('HAVE_' + header.underscorify().to_upper(),
715 cc.has_header(header))
718 ############################################################
720 fallback_hostname = get_option('fallback-hostname')
721 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
722 error('Invalid fallback-hostname configuration')
723 # A more extensive test is done in test-hostname-util. Let's catch
724 # the most obvious errors here so we don't fail with an assert later.
726 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
728 default_hierarchy = get_option('default-hierarchy')
729 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
730 description : 'default cgroup hierarchy as string')
731 if default_hierarchy == 'legacy'
732 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
733 elif default_hierarchy == 'hybrid'
734 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
736 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
739 extra_net_naming_schemes = []
740 extra_net_naming_map = []
741 foreach scheme: get_option('extra-net-naming-schemes').split(',')
743 name = scheme.split('=')[0]
744 value = scheme.split('=')[1]
745 NAME = name.underscorify().to_upper()
747 foreach field: value.split('+')
748 VALUE += 'NAMING_' + field.underscorify().to_upper()
750 extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE))
751 extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME)
754 conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes))
755 conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map))
757 default_net_naming_scheme = get_option('default-net-naming-scheme')
758 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
759 if default_net_naming_scheme != 'latest'
760 conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST',
761 'NAMING_' + default_net_naming_scheme.underscorify().to_upper())
764 time_epoch = get_option('time-epoch')
766 time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check : true).stdout().strip()
767 if time_epoch == '' and git.found() and fs.exists('.git')
768 # If we're in a git repository, use the creation time of the latest git tag.
769 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags',
771 if latest_tag.returncode() == 0
772 time_epoch = run_command(
773 git, 'log', '--no-show-signature', '-1', '--format=%at',
774 latest_tag.stdout().strip(),
775 check : false).stdout()
780 time_epoch = run_command(stat, '-c', '%Y', NEWS,
781 check : true).stdout()
783 time_epoch = time_epoch.to_int()
785 conf.set('TIME_EPOCH', time_epoch)
787 conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max'))
789 default_user_shell = get_option('default-user-shell')
790 conf.set_quoted('DEFAULT_USER_SHELL', default_user_shell)
791 conf.set_quoted('DEFAULT_USER_SHELL_NAME', fs.name(default_user_shell))
793 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
794 ['system-uid-max', 'SYS_UID_MAX', 999],
795 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
796 ['system-gid-max', 'SYS_GID_MAX', 999]]
797 v = get_option(tuple[0])
801 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
803 check : false).stdout().strip()
810 conf.set(tuple[0].underscorify().to_upper(), v)
812 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
813 error('Invalid uid allocation range')
815 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
816 error('Invalid gid allocation range')
819 dynamic_uid_min = get_option('dynamic-uid-min')
820 dynamic_uid_max = get_option('dynamic-uid-max')
821 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
822 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
824 container_uid_base_min = get_option('container-uid-base-min')
825 container_uid_base_max = get_option('container-uid-base-max')
826 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
827 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
829 nobody_user = get_option('nobody-user')
830 nobody_group = get_option('nobody-group')
832 if not meson.is_cross_build()
833 getent_result = run_command('getent', 'passwd', '65534', check : false)
834 if getent_result.returncode() == 0
835 name = getent_result.stdout().split(':')[0]
836 if name != nobody_user
838 'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
839 'Your build will result in an user table setup that is incompatible with the local system.')
842 id_result = run_command('id', '-u', nobody_user, check : false)
843 if id_result.returncode() == 0
844 id = id_result.stdout().to_int()
847 'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
848 'Your build will result in an user table setup that is incompatible with the local system.')
852 getent_result = run_command('getent', 'group', '65534', check : false)
853 if getent_result.returncode() == 0
854 name = getent_result.stdout().split(':')[0]
855 if name != nobody_group
857 'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
858 'Your build will result in an group table setup that is incompatible with the local system.')
861 id_result = run_command('id', '-g', nobody_group, check : false)
862 if id_result.returncode() == 0
863 id = id_result.stdout().to_int()
866 'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n'.format(nobody_group, id) +
867 'Your build will result in an group table setup that is incompatible with the local system.')
871 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
873 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
874 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
877 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
878 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
881 foreach option : ['adm-gid',
898 'systemd-journal-gid',
899 'systemd-network-uid',
900 'systemd-resolve-uid',
901 'systemd-timesync-uid']
902 name = option.underscorify().to_upper()
903 val = get_option(option)
905 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
906 conf.set(name, val >= 0 ? val : '-')
908 static_ugids += '@0@:@1@'.format(option, val)
912 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
913 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
915 dev_kvm_mode = get_option('dev-kvm-mode')
916 conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation
917 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
918 group_render_mode = get_option('group-render-mode')
919 conf.set_quoted('GROUP_RENDER_MODE', group_render_mode)
920 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
922 kill_user_processes = get_option('default-kill-user-processes')
923 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
925 dns_servers = get_option('dns-servers')
926 conf.set_quoted('DNS_SERVERS', dns_servers)
928 ntp_servers = get_option('ntp-servers')
929 conf.set_quoted('NTP_SERVERS', ntp_servers)
931 default_locale = get_option('default-locale')
932 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
934 localegen_path = get_option('localegen-path')
935 if localegen_path != ''
936 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
938 conf.set10('HAVE_LOCALEGEN', localegen_path != '')
940 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
942 service_watchdog = get_option('service-watchdog')
943 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
944 conf.set_quoted('SERVICE_WATCHDOG', watchdog_value)
946 conf.set_quoted('SUSHELL', get_option('debug-shell'))
947 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
949 enable_debug_hashmap = false
950 enable_debug_mmap_cache = false
951 enable_debug_siphash = false
952 foreach name : get_option('debug-extra')
954 enable_debug_hashmap = true
955 elif name == 'mmap-cache'
956 enable_debug_mmap_cache = true
957 elif name == 'siphash'
958 enable_debug_siphash = true
960 message('unknown debug option "@0@", ignoring'.format(name))
963 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
964 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
965 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
967 conf.set10('VALGRIND', get_option('valgrind'))
968 conf.set10('LOG_TRACE', get_option('log-trace'))
970 default_user_path = get_option('user-path')
971 if default_user_path != ''
972 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
976 #####################################################################
978 threads = dependency('threads')
979 librt = cc.find_library('rt')
980 libm = cc.find_library('m')
981 libdl = cc.find_library('dl')
982 libcrypt = cc.find_library('crypt')
984 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
986 ['crypt_ra', crypt_header],
987 ['crypt_preferred_method', crypt_header],
988 ['crypt_gensalt_ra', crypt_header]]
990 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
991 dependencies : libcrypt)
992 conf.set10('HAVE_' + ident[0].to_upper(), have)
995 libcap = dependency('libcap', required : false)
996 if not libcap.found()
997 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
998 libcap = cc.find_library('cap')
1001 want_bpf_framework = get_option('bpf-framework')
1002 bpf_framework_required = want_bpf_framework == 'true'
1004 libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2')
1005 conf.set10('HAVE_LIBBPF', libbpf.found())
1007 if want_bpf_framework == 'false' or not libbpf.found() or skip_deps
1008 conf.set10('BPF_FRAMEWORK', false)
1010 # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
1011 # (like clang-10/llvm-strip-10)
1012 if meson.is_cross_build() or cc.get_id() != 'clang' or cc.cmd_array()[0].contains('afl-clang') or cc.cmd_array()[0].contains('hfuzz-clang')
1013 r = find_program('clang', required : bpf_framework_required, version : '>= 10.0.0')
1014 clang_found = r.found()
1018 # Assume that the required flags are supported by the found clang.
1019 clang_supports_flags = clang_found
1022 clang = cc.cmd_array()
1023 clang_supports_flags = cc.has_argument('-Wno-compare-distinct-pointer-types')
1027 # Check if 'clang -target bpf' is supported.
1028 clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
1030 clang_supports_bpf = false
1033 # Debian installs this in /usr/sbin/ which is not in $PATH.
1034 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1035 # We use 'bpftool gen' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
1036 bpftool = find_program('bpftool',
1037 '/usr/sbin/bpftool',
1039 version : '>= 5.13.0')
1042 bpftool_strip = true
1044 bpftool_strip = false
1045 bpftool = find_program('bpftool',
1046 '/usr/sbin/bpftool',
1047 required : bpf_framework_required,
1048 version : '>= 5.6.0')
1051 if not bpftool_strip
1052 if not meson.is_cross_build() and clang_found
1053 llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
1054 check : true).stdout().strip()
1056 llvm_strip_bin = 'llvm-strip'
1058 llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
1061 deps_found = clang_found and clang_supports_bpf and clang_supports_flags and (bpftool_strip or llvm_strip.found()) and bpftool.found()
1063 # Can build BPF program from source code in restricted C
1064 conf.set10('BPF_FRAMEWORK', deps_found)
1067 libmount = dependency('mount',
1068 version : fuzzer_build ? '>= 0' : '>= 2.30')
1070 want_libfdisk = get_option('fdisk')
1071 if want_libfdisk != 'false' and not skip_deps
1072 libfdisk = dependency('fdisk',
1073 version : '>= 2.32',
1074 required : want_libfdisk == 'true')
1075 have = libfdisk.found()
1080 conf.set10('HAVE_LIBFDISK', have)
1082 want_pwquality = get_option('pwquality')
1083 if want_pwquality != 'false' and not skip_deps
1084 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1085 have = libpwquality.found()
1090 conf.set10('HAVE_PWQUALITY', have)
1092 want_seccomp = get_option('seccomp')
1093 if want_seccomp != 'false' and not skip_deps
1094 libseccomp = dependency('libseccomp',
1095 version : '>= 2.3.1',
1096 required : want_seccomp == 'true')
1097 have = libseccomp.found()
1102 conf.set10('HAVE_SECCOMP', have)
1104 want_selinux = get_option('selinux')
1105 if want_selinux != 'false' and not skip_deps
1106 libselinux = dependency('libselinux',
1107 version : '>= 2.1.9',
1108 required : want_selinux == 'true')
1109 have = libselinux.found()
1114 conf.set10('HAVE_SELINUX', have)
1116 want_apparmor = get_option('apparmor')
1117 if want_apparmor != 'false' and not skip_deps
1118 libapparmor = dependency('libapparmor',
1119 version : '>= 2.13',
1120 required : want_apparmor == 'true')
1121 have = libapparmor.found()
1126 conf.set10('HAVE_APPARMOR', have)
1128 have = get_option('smack') and get_option('smack-run-label') != ''
1129 conf.set10('HAVE_SMACK_RUN_LABEL', have)
1131 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1134 want_polkit = get_option('polkit')
1135 install_polkit = false
1136 install_polkit_pkla = false
1137 if want_polkit != 'false' and not skip_deps
1138 install_polkit = true
1140 libpolkit = dependency('polkit-gobject-1',
1142 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1143 message('Old polkit detected, will install pkla files')
1144 install_polkit_pkla = true
1147 conf.set10('ENABLE_POLKIT', install_polkit)
1149 want_acl = get_option('acl')
1150 if want_acl != 'false' and not skip_deps
1151 libacl = cc.find_library('acl', required : want_acl == 'true')
1152 have = libacl.found()
1157 conf.set10('HAVE_ACL', have)
1159 want_audit = get_option('audit')
1160 if want_audit != 'false' and not skip_deps
1161 libaudit = dependency('audit', required : want_audit == 'true')
1162 have = libaudit.found()
1167 conf.set10('HAVE_AUDIT', have)
1169 want_blkid = get_option('blkid')
1170 if want_blkid != 'false' and not skip_deps
1171 libblkid = dependency('blkid', required : want_blkid == 'true')
1172 have = libblkid.found()
1174 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1175 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1180 conf.set10('HAVE_BLKID', have)
1182 want_kmod = get_option('kmod')
1183 if want_kmod != 'false' and not skip_deps
1184 libkmod = dependency('libkmod',
1186 required : want_kmod == 'true')
1187 have = libkmod.found()
1192 conf.set10('HAVE_KMOD', have)
1194 want_pam = get_option('pam')
1195 if want_pam != 'false' and not skip_deps
1196 libpam = cc.find_library('pam', required : want_pam == 'true')
1197 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1198 have = libpam.found() and libpam_misc.found()
1204 conf.set10('HAVE_PAM', have)
1206 want_microhttpd = get_option('microhttpd')
1207 if want_microhttpd != 'false' and not skip_deps
1208 libmicrohttpd = dependency('libmicrohttpd',
1209 version : '>= 0.9.33',
1210 required : want_microhttpd == 'true')
1211 have = libmicrohttpd.found()
1216 conf.set10('HAVE_MICROHTTPD', have)
1218 want_libcryptsetup = get_option('libcryptsetup')
1219 want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1221 if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1222 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1225 if want_libcryptsetup != 'false' and not skip_deps
1226 libcryptsetup = dependency('libcryptsetup',
1227 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1228 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
1229 have = libcryptsetup.found()
1231 foreach ident : ['crypt_set_metadata_size',
1232 'crypt_activate_by_signed_key',
1234 have_ident = have and cc.has_function(
1236 prefix : '#include <libcryptsetup.h>',
1237 dependencies : libcryptsetup)
1238 conf.set10('HAVE_' + ident.to_upper(), have_ident)
1244 conf.set10('HAVE_LIBCRYPTSETUP', have)
1246 if want_libcryptsetup_plugins != 'false' and not skip_deps
1247 have = (cc.has_function(
1248 'crypt_activate_by_token_pin',
1249 prefix : '#include <libcryptsetup.h>',
1250 dependencies : libcryptsetup) and
1252 'crypt_token_external_path',
1253 prefix : '#include <libcryptsetup.h>',
1254 dependencies : libcryptsetup))
1258 conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1260 want_libcurl = get_option('libcurl')
1261 if want_libcurl != 'false' and not skip_deps
1262 libcurl = dependency('libcurl',
1263 version : '>= 7.32.0',
1264 required : want_libcurl == 'true')
1265 have = libcurl.found()
1270 conf.set10('HAVE_LIBCURL', have)
1271 conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
1273 want_libidn = get_option('libidn')
1274 want_libidn2 = get_option('libidn2')
1275 if want_libidn == 'true' and want_libidn2 == 'true'
1276 error('libidn and libidn2 cannot be requested simultaneously')
1279 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1280 libidn = dependency('libidn2',
1281 required : want_libidn2 == 'true')
1282 have = libidn.found()
1287 conf.set10('HAVE_LIBIDN2', have)
1288 if not have and want_libidn != 'false' and not skip_deps
1289 # libidn is used for both libidn and libidn2 objects
1290 libidn = dependency('libidn',
1291 required : want_libidn == 'true')
1292 have = libidn.found()
1296 conf.set10('HAVE_LIBIDN', have)
1298 want_libiptc = get_option('libiptc')
1299 if want_libiptc != 'false' and not skip_deps
1300 libiptc = dependency('libiptc',
1301 required : want_libiptc == 'true')
1302 have = libiptc.found()
1307 conf.set10('HAVE_LIBIPTC', have)
1309 want_qrencode = get_option('qrencode')
1310 if want_qrencode != 'false' and not skip_deps
1311 libqrencode = dependency('libqrencode',
1313 required : want_qrencode == 'true')
1314 have = libqrencode.found()
1319 conf.set10('HAVE_QRENCODE', have)
1321 want_gcrypt = get_option('gcrypt')
1322 if want_gcrypt != 'false' and not skip_deps
1323 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1324 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1325 have = libgcrypt.found() and libgpg_error.found()
1330 # link to neither of the libs if one is not found
1334 conf.set10('HAVE_GCRYPT', have)
1336 want_gnutls = get_option('gnutls')
1337 if want_gnutls != 'false' and not skip_deps
1338 libgnutls = dependency('gnutls',
1339 version : '>= 3.1.4',
1340 required : want_gnutls == 'true')
1341 have = libgnutls.found()
1346 conf.set10('HAVE_GNUTLS', have)
1348 want_openssl = get_option('openssl')
1349 if want_openssl != 'false' and not skip_deps
1350 libopenssl = dependency('openssl',
1351 version : '>= 1.1.0',
1352 required : want_openssl == 'true')
1353 have = libopenssl.found()
1358 conf.set10('HAVE_OPENSSL', have)
1360 want_p11kit = get_option('p11kit')
1361 if want_p11kit != 'false' and not skip_deps
1362 libp11kit = dependency('p11-kit-1',
1363 version : '>= 0.23.3',
1364 required : want_p11kit == 'true')
1365 have = libp11kit.found()
1370 conf.set10('HAVE_P11KIT', have)
1372 want_libfido2 = get_option('libfido2')
1373 if want_libfido2 != 'false' and not skip_deps
1374 libfido2 = dependency('libfido2',
1375 required : want_libfido2 == 'true')
1376 have = libfido2.found()
1381 conf.set10('HAVE_LIBFIDO2', have)
1383 want_tpm2 = get_option('tpm2')
1384 if want_tpm2 != 'false' and not skip_deps
1385 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1386 required : want_tpm2 == 'true')
1392 conf.set10('HAVE_TPM2', have)
1394 want_elfutils = get_option('elfutils')
1395 if want_elfutils != 'false' and not skip_deps
1396 libdw = dependency('libdw',
1397 required : want_elfutils == 'true')
1398 have = libdw.found()
1400 # New in elfutils 0.177
1401 conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING',
1402 have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw))
1407 conf.set10('HAVE_ELFUTILS', have)
1409 want_zlib = get_option('zlib')
1410 if want_zlib != 'false' and not skip_deps
1411 libz = dependency('zlib',
1412 required : want_zlib == 'true')
1418 conf.set10('HAVE_ZLIB', have)
1420 want_bzip2 = get_option('bzip2')
1421 if want_bzip2 != 'false' and not skip_deps
1422 libbzip2 = cc.find_library('bz2',
1423 required : want_bzip2 == 'true')
1424 have = libbzip2.found()
1429 conf.set10('HAVE_BZIP2', have)
1431 want_xz = get_option('xz')
1432 if want_xz != 'false' and not skip_deps
1433 libxz = dependency('liblzma',
1434 required : want_xz == 'true')
1435 have_xz = libxz.found()
1440 conf.set10('HAVE_XZ', have_xz)
1442 want_lz4 = get_option('lz4')
1443 if want_lz4 != 'false' and not skip_deps
1444 liblz4 = dependency('liblz4',
1445 version : '>= 1.3.0',
1446 required : want_lz4 == 'true')
1447 have_lz4 = liblz4.found()
1452 conf.set10('HAVE_LZ4', have_lz4)
1454 want_zstd = get_option('zstd')
1455 if want_zstd != 'false' and not skip_deps
1456 libzstd = dependency('libzstd',
1457 required : want_zstd == 'true',
1458 version : '>= 1.4.0')
1459 have_zstd = libzstd.found()
1464 conf.set10('HAVE_ZSTD', have_zstd)
1466 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1468 compression = get_option('default-compression')
1469 if compression == 'auto'
1471 compression = 'zstd'
1477 compression = 'none'
1479 elif compression == 'zstd' and not have_zstd
1480 error('default-compression=zstd requires zstd')
1481 elif compression == 'lz4' and not have_lz4
1482 error('default-compression=lz4 requires lz4')
1483 elif compression == 'xz' and not have_xz
1484 error('default-compression=xz requires xz')
1486 conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper()))
1488 want_xkbcommon = get_option('xkbcommon')
1489 if want_xkbcommon != 'false' and not skip_deps
1490 libxkbcommon = dependency('xkbcommon',
1491 version : '>= 0.3.0',
1492 required : want_xkbcommon == 'true')
1493 have = libxkbcommon.found()
1498 conf.set10('HAVE_XKBCOMMON', have)
1500 want_pcre2 = get_option('pcre2')
1501 if want_pcre2 != 'false' and not skip_deps
1502 libpcre2 = dependency('libpcre2-8',
1503 required : want_pcre2 == 'true')
1504 have = libpcre2.found()
1509 conf.set10('HAVE_PCRE2', have)
1511 want_glib = get_option('glib')
1512 if want_glib != 'false' and not skip_deps
1513 libglib = dependency('glib-2.0',
1514 version : '>= 2.22.0',
1515 required : want_glib == 'true')
1516 libgobject = dependency('gobject-2.0',
1517 version : '>= 2.22.0',
1518 required : want_glib == 'true')
1519 libgio = dependency('gio-2.0',
1520 required : want_glib == 'true')
1521 have = libglib.found() and libgobject.found() and libgio.found()
1528 conf.set10('HAVE_GLIB', have)
1530 want_dbus = get_option('dbus')
1531 if want_dbus != 'false' and not skip_deps
1532 libdbus = dependency('dbus-1',
1533 version : '>= 1.3.2',
1534 required : want_dbus == 'true')
1535 have = libdbus.found()
1540 conf.set10('HAVE_DBUS', have)
1542 dbusdatadir = datadir / 'dbus-1'
1543 if conf.get('HAVE_DBUS') == 1
1544 dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
1547 dbuspolicydir = get_option('dbuspolicydir')
1548 if dbuspolicydir == ''
1549 dbuspolicydir = dbusdatadir / 'system.d'
1552 dbussessionservicedir = get_option('dbussessionservicedir')
1553 if dbussessionservicedir == ''
1554 dbussessionservicedir = dbusdatadir / 'services'
1555 if conf.get('HAVE_DBUS') == 1
1556 dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
1560 dbussystemservicedir = get_option('dbussystemservicedir')
1561 if dbussystemservicedir == ''
1562 dbussystemservicedir = dbusdatadir / 'system-services'
1563 if conf.get('HAVE_DBUS') == 1
1564 dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
1568 dbus_interfaces_dir = get_option('dbus-interfaces-dir')
1569 if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
1570 if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
1571 dbus_interfaces_dir = 'no'
1572 warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
1574 dbus_interfaces_dir = dbusdatadir / 'interfaces'
1575 if conf.get('HAVE_DBUS') == 1
1576 dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
1581 # We support one or the other. If gcrypt is available, we assume it's there to
1582 # be used, and use it in preference.
1583 opt = get_option('cryptolib')
1584 if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1585 error('openssl requested as the default cryptolib, but not available')
1587 conf.set10('PREFER_OPENSSL',
1588 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1589 conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1590 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
1591 lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? [libopenssl] : [libgcrypt, libgpg_error]
1593 dns_over_tls = get_option('dns-over-tls')
1594 if dns_over_tls != 'false'
1595 if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1
1596 error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib')
1599 if dns_over_tls == 'gnutls'
1600 have_openssl = false
1602 have_openssl = conf.get('HAVE_OPENSSL') == 1
1603 if dns_over_tls == 'openssl' and not have_openssl
1604 error('DNS-over-TLS support was requested with openssl, but dependencies are not available')
1607 if dns_over_tls == 'openssl' or have_openssl
1610 have_gnutls = conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0')
1611 if dns_over_tls != 'auto' and not have_gnutls
1612 str = dns_over_tls == 'gnutls' ? ' with gnutls' : ''
1613 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1616 have = have_gnutls or have_openssl
1620 have_openssl = false
1622 conf.set10('ENABLE_DNS_OVER_TLS', have)
1623 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1624 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1626 default_dns_over_tls = get_option('default-dns-over-tls')
1628 default_dns_over_tls = 'no'
1630 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1631 message('default-dns-over-tls cannot be enabled or set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.')
1632 default_dns_over_tls = 'no'
1634 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1635 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1636 conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
1638 default_mdns = get_option('default-mdns')
1639 conf.set('DEFAULT_MDNS_MODE',
1640 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1641 conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
1643 default_llmnr = get_option('default-llmnr')
1644 conf.set('DEFAULT_LLMNR_MODE',
1645 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1646 conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
1648 want_repart = get_option('repart')
1649 if want_repart != 'false'
1650 have = conf.get('HAVE_LIBFDISK') == 1
1651 if want_repart == 'true' and not have
1652 error('repart support was requested, but dependencies are not available')
1657 conf.set10('ENABLE_REPART', have)
1659 default_dnssec = get_option('default-dnssec')
1661 default_dnssec = 'no'
1663 if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0
1664 message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.')
1665 default_dnssec = 'no'
1667 conf.set('DEFAULT_DNSSEC_MODE',
1668 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1669 conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1671 want_sysupdate = get_option('sysupdate')
1672 if want_sysupdate != 'false'
1673 have = (conf.get('HAVE_OPENSSL') == 1 and
1674 conf.get('HAVE_LIBFDISK') == 1)
1675 if want_sysupdate == 'true' and not have
1676 error('sysupdate support was requested, but dependencies are not available')
1681 conf.set10('ENABLE_SYSUPDATE', have)
1683 want_importd = get_option('importd')
1684 if want_importd != 'false'
1685 have = (conf.get('HAVE_LIBCURL') == 1 and
1686 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
1687 conf.get('HAVE_ZLIB') == 1 and
1688 conf.get('HAVE_XZ') == 1)
1689 if want_importd == 'true' and not have
1690 error('importd support was requested, but dependencies are not available')
1695 conf.set10('ENABLE_IMPORTD', have)
1697 want_kernel_install = get_option('kernel-install')
1698 conf.set10('ENABLE_KERNEL_INSTALL', want_kernel_install)
1700 want_homed = get_option('homed')
1701 if want_homed != 'false'
1702 have = (conf.get('HAVE_OPENSSL') == 1 and
1703 conf.get('HAVE_LIBFDISK') == 1 and
1704 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1705 if want_homed == 'true' and not have
1706 error('homed support was requested, but dependencies are not available')
1711 conf.set10('ENABLE_HOMED', have)
1713 have = have and conf.get('HAVE_PAM') == 1
1714 conf.set10('ENABLE_PAM_HOME', have)
1716 have = get_option('oomd')
1717 conf.set10('ENABLE_OOMD', have)
1719 want_remote = get_option('remote')
1720 if want_remote != 'false'
1721 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1722 conf.get('HAVE_LIBCURL') == 1]
1723 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1724 # it's possible to build one without the other. Complain only if
1725 # support was explicitly requested. The auxiliary files like sysusers
1726 # config should be installed when any of the programs are built.
1727 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1728 error('remote support was requested, but dependencies are not available')
1730 have = have_deps[0] or have_deps[1]
1734 conf.set10('ENABLE_REMOTE', have)
1736 foreach term : ['analyze',
1750 'compat-mutable-uid-boundaries',
1776 have = get_option(term)
1777 name = 'ENABLE_' + term.underscorify().to_upper()
1778 conf.set10(name, have)
1781 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1783 foreach tuple : [['nss-mymachines', 'machined'],
1784 ['nss-resolve', 'resolve']]
1785 want = get_option(tuple[0])
1787 have = get_option(tuple[1])
1788 if want == 'true' and not have
1789 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1794 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1795 conf.set10(name, have)
1799 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1800 'ENABLE_NSS_MYMACHINES',
1801 'ENABLE_NSS_RESOLVE',
1802 'ENABLE_NSS_SYSTEMD']
1803 if conf.get(term) == 1
1807 conf.set10('ENABLE_NSS', enable_nss)
1809 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1811 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1813 ############################################################
1819 ############################################################
1821 # Include these now as they provide gnu-efi detection.
1822 subdir('src/fundamental')
1823 subdir('src/boot/efi')
1825 ############################################################
1827 generate_gperfs = find_program('tools/generate-gperfs.py')
1828 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1829 make_directive_index_py = find_program('tools/make-directive-index.py')
1830 make_man_index_py = find_program('tools/make-man-index.py')
1831 meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
1832 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1833 update_man_rules_py = find_program('tools/update-man-rules.py')
1834 update_hwdb_sh = find_program('tools/update-hwdb.sh')
1835 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1836 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1837 xml_helper_py = find_program('tools/xml_helper.py')
1838 export_dbus_interfaces_py = find_program('tools/dbus_exporter.py')
1840 ############################################################
1842 if get_option('b_coverage')
1843 add_project_arguments('-include', 'src/basic/coverage.h', language : 'c')
1846 ############################################################
1848 config_h = configure_file(
1849 output : 'config.h',
1850 configuration : conf)
1852 add_project_arguments('-include', 'config.h', language : 'c')
1854 jinja2_cmdline = [meson_render_jinja2, config_h, version_h]
1856 ############################################################
1858 # binaries that have --help and are intended for use by humans,
1859 # usually, but not always, installed in /bin.
1860 public_programs = []
1862 # D-Bus introspection XML export
1865 basic_includes = include_directories(
1871 libsystemd_includes = [basic_includes, include_directories(
1872 'src/libsystemd/sd-bus',
1873 'src/libsystemd/sd-device',
1874 'src/libsystemd/sd-event',
1875 'src/libsystemd/sd-hwdb',
1876 'src/libsystemd/sd-id128',
1877 'src/libsystemd/sd-journal',
1878 'src/libsystemd/sd-netlink',
1879 'src/libsystemd/sd-network',
1880 'src/libsystemd/sd-resolve')]
1882 includes = [libsystemd_includes, include_directories('src/shared')]
1887 subdir('src/libsystemd')
1888 subdir('src/shared')
1890 subdir('src/libudev')
1891 subdir('src/cryptsetup/cryptsetup-tokens')
1893 libsystemd = shared_library(
1896 version : libsystemd_version,
1897 include_directories : libsystemd_includes,
1898 link_args : ['-shared',
1899 '-Wl,--version-script=' + libsystemd_sym_path],
1900 link_with : [libbasic,
1903 link_whole : [libsystemd_static],
1904 dependencies : [threads,
1906 link_depends : libsystemd_sym,
1908 install_tag: 'libsystemd',
1909 install_dir : rootlibdir)
1911 install_libsystemd_static = static_library(
1915 basic_gcrypt_sources,
1916 basic_compress_sources,
1917 fundamental_sources,
1919 include_directories : libsystemd_includes,
1920 build_by_default : static_libsystemd != 'false',
1921 install : static_libsystemd != 'false',
1922 install_tag: 'libsystemd',
1923 install_dir : rootlibdir,
1924 pic : static_libsystemd_pic,
1925 dependencies : [threads,
1936 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1938 libudev = shared_library(
1941 version : libudev_version,
1942 include_directories : includes,
1943 link_args : ['-shared',
1944 '-Wl,--version-script=' + libudev_sym_path],
1945 link_with : [libsystemd_static, libshared_static],
1946 link_whole : libudev_basic,
1947 dependencies : [threads],
1948 link_depends : libudev_sym,
1950 install_tag: 'libudev',
1951 install_dir : rootlibdir)
1953 install_libudev_static = static_library(
1956 fundamental_sources,
1961 include_directories : includes,
1962 build_by_default : static_libudev != 'false',
1963 install : static_libudev != 'false',
1964 install_tag: 'libudev',
1965 install_dir : rootlibdir,
1966 link_depends : libudev_sym,
1967 dependencies : libshared_deps + [libmount],
1968 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1969 pic : static_libudev_pic)
1971 if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
1972 if conf.get('HAVE_TPM2') == 1
1973 cryptsetup_token_systemd_tpm2 = shared_library(
1974 'cryptsetup-token-systemd-tpm2',
1975 cryptsetup_token_systemd_tpm2_sources,
1976 include_directories : includes,
1977 link_args : ['-shared',
1978 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1979 link_with : [lib_cryptsetup_token_common,
1981 dependencies : [libcryptsetup,
1984 link_depends : cryptsetup_token_sym,
1985 install_rpath : rootlibexecdir,
1987 install_dir : libcryptsetup_plugins_dir)
1990 if conf.get('HAVE_LIBFIDO2') == 1
1991 cryptsetup_token_systemd_fido2 = shared_library(
1992 'cryptsetup-token-systemd-fido2',
1993 cryptsetup_token_systemd_fido2_sources,
1994 include_directories : includes,
1995 link_args : ['-shared',
1996 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1997 link_with : [lib_cryptsetup_token_common,
1999 dependencies : [libcryptsetup,
2002 link_depends : cryptsetup_token_sym,
2003 install_rpath : rootlibexecdir,
2005 install_dir : libcryptsetup_plugins_dir)
2008 if conf.get('HAVE_P11KIT') == 1
2009 cryptsetup_token_systemd_pkcs11 = shared_library(
2010 'cryptsetup-token-systemd-pkcs11',
2011 cryptsetup_token_systemd_pkcs11_sources,
2012 include_directories : includes,
2013 link_args : ['-shared',
2014 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2015 link_with : [lib_cryptsetup_token_common,
2017 dependencies : [libcryptsetup,
2020 link_depends : cryptsetup_token_sym,
2021 install_rpath : rootlibexecdir,
2023 install_dir : libcryptsetup_plugins_dir)
2027 ############################################################
2029 # systemd-analyze requires 'libcore'
2031 # systemd-journal-remote requires 'libjournal_core'
2032 subdir('src/journal')
2033 # systemd-networkd requires 'libsystemd_network'
2034 subdir('src/libsystemd-network')
2036 subdir('src/analyze')
2037 subdir('src/busctl')
2038 subdir('src/coredump')
2039 subdir('src/cryptenroll')
2040 subdir('src/cryptsetup')
2042 subdir('src/hostname')
2043 subdir('src/import')
2044 subdir('src/journal-remote')
2045 subdir('src/kernel-install')
2046 subdir('src/locale')
2048 subdir('src/machine')
2049 subdir('src/network')
2050 subdir('src/nspawn')
2052 subdir('src/partition')
2053 subdir('src/portable')
2054 subdir('src/pstore')
2055 subdir('src/resolve')
2057 subdir('src/shutdown')
2058 subdir('src/sysext')
2059 subdir('src/systemctl')
2060 subdir('src/sysupdate')
2061 subdir('src/timedate')
2062 subdir('src/timesync')
2063 subdir('src/tmpfiles')
2064 subdir('src/userdb')
2065 subdir('src/xdg-autostart-generator')
2067 subdir('src/systemd')
2074 ############################################################
2076 # only static linking apart from libdl, to make sure that the
2077 # module is linked to all libraries that it uses.
2078 test_dlopen = executable(
2082 include_directories : includes,
2083 link_with : [libbasic],
2084 dependencies : [libdl],
2085 build_by_default : want_tests != 'false')
2087 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
2088 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
2089 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
2090 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
2092 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
2096 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
2097 version_script_arg = project_source_root / sym
2099 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
2100 if tuple.length() > 2
2101 foreach s : tuple[2]
2102 sources += ['src/nss-@0@/@1@'.format(module, s)]
2106 incs = tuple.length() > 3 ? tuple[3] : includes
2108 nss = shared_library(
2113 include_directories : incs,
2114 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
2115 link_args : ['-Wl,-z,nodelete',
2117 '-Wl,--version-script=' + version_script_arg],
2118 link_with : [libsystemd_static,
2121 dependencies : [threads,
2125 install_tag : 'nss',
2126 install_dir : rootlibdir)
2128 # We cannot use shared_module because it does not support version suffix.
2129 # Unfortunately shared_library insists on creating the symlink…
2130 meson.add_install_script('sh', '-c',
2131 'rm $DESTDIR@0@/libnss_@1@.so'
2132 .format(rootlibdir, module),
2136 if want_tests != 'false'
2137 test('dlopen-nss_' + module,
2139 # path to dlopen must include a slash
2140 args : nss.full_path(),
2146 ############################################################
2151 include_directories : includes,
2152 link_with : [libcore,
2154 dependencies : [versiondep,
2156 install_rpath : rootlibexecdir,
2158 install_dir : rootlibexecdir)
2159 dbus_programs += exe
2160 public_programs += exe
2162 meson.add_install_script(meson_make_symlink,
2163 rootlibexecdir / 'systemd',
2164 rootsbindir / 'init')
2168 systemd_analyze_sources,
2169 include_directories : core_includes,
2170 link_with : [libcore,
2172 dependencies : [versiondep,
2174 install_rpath : rootlibexecdir,
2175 install : conf.get('ENABLE_ANALYZE'))
2176 public_programs += exe
2178 if want_tests != 'false'
2179 test('test-compare-versions',
2180 test_compare_versions_sh,
2181 args : exe.full_path())
2186 systemd_journald_sources,
2187 include_directories : includes,
2188 link_with : [libjournal_core,
2190 dependencies : [threads,
2195 install_rpath : rootlibexecdir,
2197 install_dir : rootlibexecdir)
2199 public_programs += executable(
2201 systemd_cat_sources,
2202 include_directories : includes,
2203 link_with : [libjournal_core,
2205 dependencies : [threads],
2206 install_rpath : rootlibexecdir,
2209 public_programs += executable(
2212 include_directories : includes,
2213 link_with : [libshared],
2214 dependencies : [threads,
2220 install_rpath : rootlibexecdir,
2222 install_dir : rootbindir)
2225 'systemd-getty-generator',
2226 'src/getty-generator/getty-generator.c',
2227 include_directories : includes,
2228 link_with : [libshared],
2229 install_rpath : rootlibexecdir,
2231 install_dir : systemgeneratordir)
2234 'systemd-debug-generator',
2235 'src/debug-generator/debug-generator.c',
2236 include_directories : includes,
2237 link_with : [libshared],
2238 install_rpath : rootlibexecdir,
2240 install_dir : systemgeneratordir)
2243 'systemd-run-generator',
2244 'src/run-generator/run-generator.c',
2245 include_directories : includes,
2246 link_with : [libshared],
2247 install_rpath : rootlibexecdir,
2249 install_dir : systemgeneratordir)
2252 'systemd-fstab-generator',
2253 'src/fstab-generator/fstab-generator.c',
2254 include_directories : includes,
2255 link_with : [libshared],
2256 install_rpath : rootlibexecdir,
2258 install_dir : systemgeneratordir)
2260 if want_tests != 'false'
2261 test('test-fstab-generator',
2262 test_fstab_generator_sh,
2263 # https://github.com/mesonbuild/meson/issues/2681
2264 args : exe.full_path(),
2268 if conf.get('ENABLE_ENVIRONMENT_D') == 1
2270 '30-systemd-environment-d-generator',
2271 'src/environment-d-generator/environment-d-generator.c',
2272 include_directories : includes,
2273 link_with : [libshared],
2274 install_rpath : rootlibexecdir,
2276 install_dir : userenvgeneratordir)
2278 meson.add_install_script(meson_make_symlink,
2279 sysconfdir / 'environment',
2280 environmentdir / '99-environment.conf')
2283 if conf.get('ENABLE_HIBERNATE') == 1
2285 'systemd-hibernate-resume-generator',
2286 'src/hibernate-resume/hibernate-resume-generator.c',
2287 include_directories : includes,
2288 link_with : [libshared],
2289 install_rpath : rootlibexecdir,
2291 install_dir : systemgeneratordir)
2294 'systemd-hibernate-resume',
2295 'src/hibernate-resume/hibernate-resume.c',
2296 include_directories : includes,
2297 link_with : [libshared],
2298 install_rpath : rootlibexecdir,
2300 install_dir : rootlibexecdir)
2303 if conf.get('HAVE_BLKID') == 1
2305 'systemd-gpt-auto-generator',
2306 'src/gpt-auto-generator/gpt-auto-generator.c',
2307 include_directories : includes,
2308 link_with : [libshared],
2309 dependencies : libblkid,
2310 install_rpath : rootlibexecdir,
2312 install_dir : systemgeneratordir)
2314 public_programs += executable(
2316 'src/dissect/dissect.c',
2317 include_directories : includes,
2318 link_with : [libshared],
2319 install_rpath : rootlibexecdir,
2323 if conf.get('ENABLE_RESOLVE') == 1
2324 dbus_programs += executable(
2326 systemd_resolved_sources,
2327 include_directories : resolve_includes,
2328 link_with : [libshared,
2330 libsystemd_resolve_core],
2331 dependencies : systemd_resolved_dependencies,
2332 install_rpath : rootlibexecdir,
2334 install_dir : rootlibexecdir)
2336 public_programs += executable(
2339 include_directories : includes,
2340 link_with : [libshared,
2342 libsystemd_resolve_core],
2343 dependencies : [threads,
2344 lib_openssl_or_gcrypt,
2347 install_rpath : rootlibexecdir,
2350 meson.add_install_script(meson_make_symlink,
2351 bindir / 'resolvectl',
2352 rootsbindir / 'resolvconf')
2354 meson.add_install_script(meson_make_symlink,
2355 bindir / 'resolvectl',
2356 bindir / 'systemd-resolve')
2359 if conf.get('ENABLE_LOGIND') == 1
2360 dbus_programs += executable(
2362 systemd_logind_sources,
2363 include_directories : includes,
2364 link_with : [liblogind_core,
2366 dependencies : [threads,
2368 install_rpath : rootlibexecdir,
2370 install_dir : rootlibexecdir)
2372 public_programs += executable(
2375 include_directories : includes,
2376 link_with : [libshared],
2377 dependencies : [threads,
2381 install_rpath : rootlibexecdir,
2383 install_dir : rootbindir)
2385 public_programs += executable(
2387 'src/login/inhibit.c',
2388 include_directories : includes,
2389 link_with : [libshared],
2390 install_rpath : rootlibexecdir,
2392 install_dir : rootbindir)
2394 if conf.get('HAVE_PAM') == 1
2395 version_script_arg = project_source_root / pam_systemd_sym
2396 pam_systemd = shared_library(
2400 include_directories : includes,
2401 link_args : ['-shared',
2402 '-Wl,--version-script=' + version_script_arg],
2403 link_with : [libsystemd_static,
2405 dependencies : [threads,
2408 link_depends : pam_systemd_sym,
2410 install_tag : 'pam',
2411 install_dir : pamlibdir)
2413 if want_tests != 'false'
2414 test('dlopen-pam_systemd',
2416 # path to dlopen must include a slash
2417 args : pam_systemd.full_path(),
2418 depends : pam_systemd)
2423 'systemd-user-runtime-dir',
2424 user_runtime_dir_sources,
2425 include_directories : includes,
2426 link_with : [libshared],
2427 install_rpath : rootlibexecdir,
2429 install_dir : rootlibexecdir)
2432 if conf.get('HAVE_PAM') == 1
2434 'systemd-user-sessions',
2435 'src/user-sessions/user-sessions.c',
2436 include_directories : includes,
2437 link_with : [libshared],
2438 install_rpath : rootlibexecdir,
2440 install_dir : rootlibexecdir)
2443 if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
2444 if get_option('link-boot-shared')
2445 boot_link_with = [libshared]
2447 boot_link_with = [libsystemd_static, libshared_static]
2450 public_programs += executable(
2452 'src/boot/bootctl.c',
2453 include_directories : includes,
2454 link_with : [boot_link_with],
2455 dependencies : [libblkid],
2456 install_rpath : rootlibexecdir,
2459 public_programs += executable(
2460 'systemd-bless-boot',
2461 'src/boot/bless-boot.c',
2462 include_directories : includes,
2463 link_with : [boot_link_with],
2464 dependencies : [libblkid],
2465 install_rpath : rootlibexecdir,
2467 install_dir : rootlibexecdir)
2470 'systemd-bless-boot-generator',
2471 'src/boot/bless-boot-generator.c',
2472 include_directories : includes,
2473 link_with : [boot_link_with],
2474 install_rpath : rootlibexecdir,
2476 install_dir : systemgeneratordir)
2480 'systemd-boot-check-no-failures',
2481 'src/boot/boot-check-no-failures.c',
2482 include_directories : includes,
2483 link_with : [libshared],
2484 dependencies : [libblkid],
2485 install_rpath : rootlibexecdir,
2487 install_dir : rootlibexecdir)
2489 public_programs += executable(
2490 'systemd-socket-activate',
2491 'src/activate/activate.c',
2492 include_directories : includes,
2493 link_with : [libshared],
2494 dependencies : [threads],
2495 install_rpath : rootlibexecdir,
2498 systemctl = executable(
2501 include_directories : includes,
2502 link_with : systemctl_link_with,
2503 dependencies : [threads,
2509 install_rpath : rootlibexecdir,
2511 install_dir : rootbindir)
2512 public_programs += systemctl
2514 if conf.get('ENABLE_PORTABLED') == 1
2515 dbus_programs += executable(
2516 'systemd-portabled',
2517 systemd_portabled_sources,
2518 include_directories : includes,
2519 link_with : [libshared],
2520 dependencies : [threads, libselinux],
2521 install_rpath : rootlibexecdir,
2523 install_dir : rootlibexecdir)
2525 public_programs += executable(
2527 'src/portable/portablectl.c',
2528 include_directories : includes,
2529 link_with : [libshared],
2530 dependencies : [threads],
2531 install_rpath : rootlibexecdir,
2533 install_dir : rootbindir)
2536 if conf.get('ENABLE_SYSEXT') == 1
2537 public_programs += executable(
2539 systemd_sysext_sources,
2540 include_directories : includes,
2541 link_with : [libshared],
2542 install_rpath : rootlibexecdir,
2544 install_dir : rootbindir)
2547 if conf.get('ENABLE_USERDB') == 1
2550 systemd_userwork_sources,
2551 include_directories : includes,
2552 link_with : [libshared],
2553 dependencies : [threads],
2554 install_rpath : rootlibexecdir,
2556 install_dir : rootlibexecdir)
2560 systemd_userdbd_sources,
2561 include_directories : includes,
2562 link_with : [libshared],
2563 dependencies : [threads],
2564 install_rpath : rootlibexecdir,
2566 install_dir : rootlibexecdir)
2568 public_programs += executable(
2571 include_directories : includes,
2572 link_with : [libshared],
2573 dependencies : [threads],
2574 install_rpath : rootlibexecdir,
2578 if conf.get('ENABLE_HOMED') == 1
2581 systemd_homework_sources,
2582 include_directories : includes,
2583 link_with : [libshared],
2584 dependencies : [threads,
2590 install_rpath : rootlibexecdir,
2592 install_dir : rootlibexecdir)
2594 dbus_programs += executable(
2596 systemd_homed_sources,
2597 include_directories : home_includes,
2598 link_with : [libshared],
2599 dependencies : [threads,
2603 install_rpath : rootlibexecdir,
2605 install_dir : rootlibexecdir)
2607 public_programs += executable(
2610 include_directories : includes,
2611 link_with : [libshared],
2612 dependencies : [threads,
2617 install_rpath : rootlibexecdir,
2620 if conf.get('HAVE_PAM') == 1
2621 version_script_arg = project_source_root / pam_systemd_home_sym
2622 pam_systemd_home = shared_library(
2626 include_directories : includes,
2627 link_args : ['-shared',
2628 '-Wl,--version-script=' + version_script_arg],
2629 link_with : [libsystemd_static,
2631 dependencies : [threads,
2635 link_depends : pam_systemd_home_sym,
2637 install_tag : 'pam',
2638 install_dir : pamlibdir)
2640 if want_tests != 'false'
2641 test('dlopen-pam_systemd_home',
2643 # path to dlopen must include a slash
2644 args : pam_systemd_home.full_path(),
2645 depends : pam_systemd_home)
2650 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2651 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2652 meson.add_install_script(meson_make_symlink,
2653 rootbindir / 'systemctl',
2654 rootsbindir / alias)
2657 meson.add_install_script(meson_make_symlink,
2658 rootbindir / 'udevadm',
2659 rootlibexecdir / 'systemd-udevd')
2661 if conf.get('ENABLE_BACKLIGHT') == 1
2663 'systemd-backlight',
2664 'src/backlight/backlight.c',
2665 include_directories : includes,
2666 link_with : [libshared],
2667 install_rpath : rootlibexecdir,
2669 install_dir : rootlibexecdir)
2672 if conf.get('ENABLE_RFKILL') == 1
2675 'src/rfkill/rfkill.c',
2676 include_directories : includes,
2677 link_with : [libshared],
2678 install_rpath : rootlibexecdir,
2680 install_dir : rootlibexecdir)
2684 'systemd-system-update-generator',
2685 'src/system-update-generator/system-update-generator.c',
2686 include_directories : includes,
2687 link_with : [libshared],
2688 install_rpath : rootlibexecdir,
2690 install_dir : systemgeneratordir)
2692 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2694 'systemd-cryptsetup',
2695 systemd_cryptsetup_sources,
2696 include_directories : includes,
2697 link_with : [libshared],
2698 dependencies : [libcryptsetup,
2700 install_rpath : rootlibexecdir,
2702 install_dir : rootlibexecdir)
2705 'systemd-cryptsetup-generator',
2706 'src/cryptsetup/cryptsetup-generator.c',
2707 include_directories : includes,
2708 link_with : [libshared],
2709 install_rpath : rootlibexecdir,
2711 install_dir : systemgeneratordir)
2714 'systemd-veritysetup',
2715 'src/veritysetup/veritysetup.c',
2716 include_directories : includes,
2717 link_with : [libshared],
2718 dependencies : [libcryptsetup],
2719 install_rpath : rootlibexecdir,
2721 install_dir : rootlibexecdir)
2724 'systemd-veritysetup-generator',
2725 'src/veritysetup/veritysetup-generator.c',
2726 include_directories : includes,
2727 link_with : [libshared],
2728 install_rpath : rootlibexecdir,
2730 install_dir : systemgeneratordir)
2732 public_programs += executable(
2733 'systemd-cryptenroll',
2734 systemd_cryptenroll_sources,
2735 include_directories : includes,
2736 link_with : [libshared],
2737 dependencies : [libcryptsetup,
2741 install_rpath : rootlibexecdir,
2745 'systemd-integritysetup',
2746 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
2747 include_directories : includes,
2748 link_with : [libshared],
2749 dependencies : [libcryptsetup],
2750 install_rpath : rootlibexecdir,
2752 install_dir : rootlibexecdir)
2755 'systemd-integritysetup-generator',
2756 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
2757 include_directories : includes,
2758 link_with : [libshared],
2759 install_rpath : rootlibexecdir,
2761 install_dir : systemgeneratordir)
2764 if conf.get('HAVE_SYSV_COMPAT') == 1
2766 'systemd-sysv-generator',
2767 'src/sysv-generator/sysv-generator.c',
2768 include_directories : includes,
2769 link_with : [libshared],
2770 install_rpath : rootlibexecdir,
2772 install_dir : systemgeneratordir)
2774 sysv_generator_test_py = find_program('test/sysv-generator-test.py')
2775 if want_tests != 'false'
2776 test('sysv-generator-test',
2777 sysv_generator_test_py,
2782 'systemd-rc-local-generator',
2783 'src/rc-local-generator/rc-local-generator.c',
2784 include_directories : includes,
2785 link_with : [libshared],
2786 install_rpath : rootlibexecdir,
2788 install_dir : systemgeneratordir)
2791 if conf.get('ENABLE_XDG_AUTOSTART') == 1
2793 'systemd-xdg-autostart-generator',
2794 systemd_xdg_autostart_generator_sources,
2795 include_directories : includes,
2796 link_with : [libshared],
2797 install_rpath : rootlibexecdir,
2799 install_dir : usergeneratordir)
2802 'systemd-xdg-autostart-condition',
2803 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2804 include_directories : includes,
2805 link_with : [libshared],
2806 install_rpath : rootlibexecdir,
2808 install_dir : rootlibexecdir)
2811 if conf.get('ENABLE_HOSTNAMED') == 1
2812 dbus_programs += executable(
2813 'systemd-hostnamed',
2814 'src/hostname/hostnamed.c',
2815 include_directories : includes,
2816 link_with : [libshared],
2817 install_rpath : rootlibexecdir,
2819 install_dir : rootlibexecdir)
2821 public_programs += executable(
2823 'src/hostname/hostnamectl.c',
2824 include_directories : includes,
2825 link_with : [libshared],
2826 install_rpath : rootlibexecdir,
2830 if conf.get('ENABLE_LOCALED') == 1
2831 if conf.get('HAVE_XKBCOMMON') == 1
2832 # logind will load libxkbcommon.so dynamically on its own, but we still
2833 # need to specify where the headers are
2834 deps = [libdl, libxkbcommon.partial_dependency(compile_args: true)]
2839 dbus_programs += executable(
2841 systemd_localed_sources,
2842 include_directories : includes,
2843 link_with : [libshared],
2844 dependencies : deps,
2845 install_rpath : rootlibexecdir,
2847 install_dir : rootlibexecdir)
2849 public_programs += executable(
2852 include_directories : includes,
2853 link_with : [libshared],
2854 install_rpath : rootlibexecdir,
2858 if conf.get('ENABLE_TIMEDATED') == 1
2859 dbus_programs += executable(
2860 'systemd-timedated',
2861 'src/timedate/timedated.c',
2862 include_directories : includes,
2863 link_with : [libshared],
2864 install_rpath : rootlibexecdir,
2866 install_dir : rootlibexecdir)
2869 if conf.get('ENABLE_TIMEDATECTL') == 1
2870 public_programs += executable(
2872 'src/timedate/timedatectl.c',
2873 include_directories : includes,
2874 install_rpath : rootlibexecdir,
2875 link_with : [libshared],
2876 dependencies : [libm],
2880 if conf.get('ENABLE_TIMESYNCD') == 1
2882 'systemd-timesyncd',
2883 systemd_timesyncd_sources,
2884 include_directories : includes,
2885 link_with : [libtimesyncd_core],
2886 dependencies : [threads,
2888 install_rpath : rootlibexecdir,
2890 install_dir : rootlibexecdir)
2893 'systemd-time-wait-sync',
2894 'src/timesync/wait-sync.c',
2895 include_directories : includes,
2896 link_with : [libtimesyncd_core],
2897 install_rpath : rootlibexecdir,
2899 install_dir : rootlibexecdir)
2902 if conf.get('ENABLE_MACHINED') == 1
2903 dbus_programs += executable(
2905 systemd_machined_sources,
2906 include_directories : includes,
2907 link_with : [libmachine_core,
2909 install_rpath : rootlibexecdir,
2911 install_dir : rootlibexecdir)
2913 public_programs += executable(
2915 'src/machine/machinectl.c',
2916 include_directories : includes,
2917 link_with : [libshared],
2918 dependencies : [threads,
2922 install_rpath : rootlibexecdir,
2924 install_dir : rootbindir)
2927 if conf.get('ENABLE_IMPORTD') == 1
2928 dbus_programs += executable(
2930 systemd_importd_sources,
2931 include_directories : includes,
2932 link_with : [libshared],
2933 dependencies : [threads],
2934 install_rpath : rootlibexecdir,
2936 install_dir : rootlibexecdir)
2938 systemd_pull = executable(
2940 systemd_pull_sources,
2941 include_directories : includes,
2942 link_with : [libshared,
2944 dependencies : [versiondep,
2946 lib_openssl_or_gcrypt,
2950 install_rpath : rootlibexecdir,
2952 install_dir : rootlibexecdir)
2954 systemd_import = executable(
2956 systemd_import_sources,
2957 include_directories : includes,
2958 link_with : [libshared,
2960 dependencies : [libcurl,
2964 install_rpath : rootlibexecdir,
2966 install_dir : rootlibexecdir)
2968 systemd_import_fs = executable(
2969 'systemd-import-fs',
2970 systemd_import_fs_sources,
2971 include_directories : includes,
2972 link_with : [libshared,
2974 install_rpath : rootlibexecdir,
2976 install_dir : rootlibexecdir)
2978 systemd_export = executable(
2980 systemd_export_sources,
2981 include_directories : includes,
2982 link_with : [libshared,
2984 dependencies : [libcurl,
2988 install_rpath : rootlibexecdir,
2990 install_dir : rootlibexecdir)
2992 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
2995 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2996 public_programs += executable(
2997 'systemd-journal-upload',
2998 systemd_journal_upload_sources,
2999 include_directories : includes,
3000 link_with : [libshared],
3001 dependencies : [versiondep,
3008 install_rpath : rootlibexecdir,
3010 install_dir : rootlibexecdir)
3013 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
3014 public_programs += executable(
3015 'systemd-journal-remote',
3016 systemd_journal_remote_sources,
3017 include_directories : journal_includes,
3018 link_with : [libshared,
3019 libsystemd_journal_remote],
3020 dependencies : [threads,
3026 install_rpath : rootlibexecdir,
3028 install_dir : rootlibexecdir)
3030 public_programs += executable(
3031 'systemd-journal-gatewayd',
3032 systemd_journal_gatewayd_sources,
3033 include_directories : journal_includes,
3034 link_with : [libshared],
3035 dependencies : [threads,
3041 install_rpath : rootlibexecdir,
3043 install_dir : rootlibexecdir)
3046 if conf.get('ENABLE_COREDUMP') == 1
3049 systemd_coredump_sources,
3050 include_directories : includes,
3051 link_with : [libshared,
3053 dependencies : [threads,
3058 install_rpath : rootlibexecdir,
3060 install_dir : rootlibexecdir)
3062 public_programs += executable(
3064 coredumpctl_sources,
3065 include_directories : includes,
3066 link_with : [libshared,
3068 dependencies : [threads,
3072 install_rpath : rootlibexecdir,
3076 if conf.get('ENABLE_PSTORE') == 1
3079 systemd_pstore_sources,
3080 include_directories : includes,
3081 link_with : [libshared],
3082 dependencies : [threads,
3087 install_rpath : rootlibexecdir,
3089 install_dir : rootlibexecdir)
3092 if conf.get('ENABLE_OOMD') == 1
3093 dbus_programs += executable('systemd-oomd',
3094 systemd_oomd_sources,
3095 include_directories : includes,
3096 link_with : [libshared],
3098 install_rpath : rootlibexecdir,
3100 install_dir : rootlibexecdir)
3102 public_programs += executable(
3105 include_directories : includes,
3106 link_with : [libshared],
3108 install_rpath : rootlibexecdir,
3112 if conf.get('ENABLE_BINFMT') == 1
3113 public_programs += executable(
3115 'src/binfmt/binfmt.c',
3116 include_directories : includes,
3117 link_with : [libshared],
3118 install_rpath : rootlibexecdir,
3120 install_dir : rootlibexecdir)
3122 meson.add_install_script('sh', '-c',
3123 mkdir_p.format(binfmtdir))
3124 if install_sysconfdir
3125 meson.add_install_script('sh', '-c',
3126 mkdir_p.format(sysconfdir / 'binfmt.d'))
3130 if conf.get('ENABLE_SYSUPDATE') == 1
3132 'systemd-sysupdate',
3133 systemd_sysupdate_sources,
3134 include_directories : includes,
3135 link_with : [libshared],
3136 dependencies : [threads,
3140 install_rpath : rootlibexecdir,
3142 install_dir : rootlibexecdir)
3143 public_programs += exe
3146 if conf.get('ENABLE_VCONSOLE') == 1
3148 'systemd-vconsole-setup',
3149 'src/vconsole/vconsole-setup.c',
3150 include_directories : includes,
3151 link_with : [libshared],
3152 install_rpath : rootlibexecdir,
3154 install_dir : rootlibexecdir)
3157 if conf.get('ENABLE_RANDOMSEED') == 1
3159 'systemd-random-seed',
3160 'src/random-seed/random-seed.c',
3161 include_directories : includes,
3162 link_with : [libshared],
3163 install_rpath : rootlibexecdir,
3165 install_dir : rootlibexecdir)
3168 if conf.get('ENABLE_FIRSTBOOT') == 1
3169 public_programs += executable(
3170 'systemd-firstboot',
3171 'src/firstboot/firstboot.c',
3172 include_directories : includes,
3173 link_with : [libshared],
3174 dependencies : [libcrypt],
3175 install_rpath : rootlibexecdir,
3177 install_dir : rootbindir)
3181 'systemd-remount-fs',
3182 'src/remount-fs/remount-fs.c',
3183 include_directories : includes,
3184 link_with : [libshared],
3185 install_rpath : rootlibexecdir,
3187 install_dir : rootlibexecdir)
3190 'systemd-machine-id-setup',
3191 'src/machine-id-setup/machine-id-setup-main.c',
3192 include_directories : includes,
3193 link_with : [libshared],
3194 install_rpath : rootlibexecdir,
3196 install_dir : rootbindir)
3201 include_directories : includes,
3202 link_with : [libshared],
3203 install_rpath : rootlibexecdir,
3205 install_dir : rootlibexecdir)
3207 executable('systemd-growfs',
3208 'src/partition/growfs.c',
3209 include_directories : includes,
3210 link_with : [libshared],
3211 install_rpath : rootlibexecdir,
3213 install_dir : rootlibexecdir)
3217 'src/partition/makefs.c',
3218 include_directories : includes,
3219 link_with : [libshared],
3220 install_rpath : rootlibexecdir,
3222 install_dir : rootlibexecdir)
3226 'src/sleep/sleep.c',
3227 include_directories : includes,
3228 link_with : [libshared],
3229 install_rpath : rootlibexecdir,
3231 install_dir : rootlibexecdir)
3233 if install_sysconfdir_samples
3234 install_data('src/sleep/sleep.conf',
3235 install_dir : pkgsysconfdir)
3238 public_programs += executable(
3240 'src/sysctl/sysctl.c',
3241 include_directories : includes,
3242 link_with : [libshared],
3243 install_rpath : rootlibexecdir,
3245 install_dir : rootlibexecdir)
3249 'src/ac-power/ac-power.c',
3250 include_directories : includes,
3251 link_with : [libshared],
3252 install_rpath : rootlibexecdir,
3254 install_dir : rootlibexecdir)
3256 public_programs += executable(
3257 'systemd-detect-virt',
3258 'src/detect-virt/detect-virt.c',
3259 include_directories : includes,
3260 link_with : [libshared],
3261 install_rpath : rootlibexecdir,
3264 public_programs += executable(
3266 'src/delta/delta.c',
3267 include_directories : includes,
3268 link_with : [libshared],
3269 install_rpath : rootlibexecdir,
3272 public_programs += executable(
3274 'src/escape/escape.c',
3275 include_directories : includes,
3276 link_with : [libshared],
3277 install_rpath : rootlibexecdir,
3279 install_dir : rootbindir)
3281 public_programs += executable(
3283 'src/notify/notify.c',
3284 include_directories : includes,
3285 link_with : [libshared],
3286 install_rpath : rootlibexecdir,
3288 install_dir : rootbindir)
3290 public_programs += executable(
3292 'src/creds/creds.c',
3293 include_directories : includes,
3294 link_with : [libshared],
3295 dependencies : [threads,
3297 install_rpath : rootlibexecdir,
3299 install_dir : rootbindir)
3302 'systemd-volatile-root',
3303 'src/volatile-root/volatile-root.c',
3304 include_directories : includes,
3305 link_with : [libshared],
3306 install_rpath : rootlibexecdir,
3307 install : conf.get('ENABLE_INITRD') == 1,
3308 install_dir : rootlibexecdir)
3311 'systemd-cgroups-agent',
3312 'src/cgroups-agent/cgroups-agent.c',
3313 include_directories : includes,
3314 link_with : [libshared],
3315 install_rpath : rootlibexecdir,
3317 install_dir : rootlibexecdir)
3319 systemd_id128 = executable(
3321 'src/id128/id128.c',
3322 include_directories : includes,
3323 link_with : [libshared],
3324 install_rpath : rootlibexecdir,
3326 public_programs += systemd_id128
3328 if want_tests != 'false'
3329 test('test-systemctl-enable',
3330 test_systemctl_enable_sh,
3331 # https://github.com/mesonbuild/meson/issues/2681
3332 args : [systemctl.full_path(),
3333 systemd_id128.full_path()])
3336 public_programs += executable(
3339 include_directories : includes,
3340 link_with : [libshared],
3341 install_rpath : rootlibexecdir,
3344 public_programs += executable(
3345 'systemd-ask-password',
3346 'src/ask-password/ask-password.c',
3347 include_directories : includes,
3348 link_with : [libshared],
3349 install_rpath : rootlibexecdir,
3351 install_dir : rootbindir)
3354 'systemd-reply-password',
3355 'src/reply-password/reply-password.c',
3356 include_directories : includes,
3357 link_with : [libshared],
3358 install_rpath : rootlibexecdir,
3360 install_dir : rootlibexecdir)
3362 public_programs += executable(
3363 'systemd-tty-ask-password-agent',
3364 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3365 include_directories : includes,
3366 link_with : [libshared],
3367 install_rpath : rootlibexecdir,
3369 install_dir : rootbindir)
3371 public_programs += executable(
3374 include_directories : includes,
3375 link_with : [libshared],
3376 install_rpath : rootlibexecdir,
3379 public_programs += executable(
3381 'src/cgtop/cgtop.c',
3382 include_directories : includes,
3383 link_with : [libshared],
3384 install_rpath : rootlibexecdir,
3389 'src/initctl/initctl.c',
3390 include_directories : includes,
3391 link_with : [libshared],
3392 install_rpath : rootlibexecdir,
3393 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3394 install_dir : rootlibexecdir)
3396 public_programs += executable(
3398 'src/mount/mount-tool.c',
3399 include_directories : includes,
3400 link_with : [libshared],
3401 dependencies: [libmount],
3402 install_rpath : rootlibexecdir,
3405 meson.add_install_script(meson_make_symlink,
3406 'systemd-mount', bindir / 'systemd-umount')
3408 public_programs += executable(
3411 include_directories : includes,
3412 link_with : [libshared],
3413 install_rpath : rootlibexecdir,
3416 public_programs += executable(
3417 'systemd-stdio-bridge',
3418 'src/stdio-bridge/stdio-bridge.c',
3419 include_directories : includes,
3420 link_with : [libshared],
3421 dependencies : [versiondep],
3422 install_rpath : rootlibexecdir,
3425 public_programs += executable(
3428 include_directories : includes,
3429 link_with : [libshared],
3430 dependencies : [versiondep],
3431 install_rpath : rootlibexecdir,
3437 'src/sysusers/sysusers.c',
3438 include_directories : includes,
3439 link_with : [libshared],
3440 install_rpath : rootlibexecdir,
3442 install_dir : rootbindir)
3443 public_programs += exe
3445 if want_tests != 'false'
3446 test('test-sysusers',
3448 # https://github.com/mesonbuild/meson/issues/2681
3449 args : exe.full_path())
3452 if have_standalone_binaries
3454 'systemd-sysusers.standalone',
3455 'src/sysusers/sysusers.c',
3456 include_directories : includes,
3457 c_args : '-DSTANDALONE',
3458 link_with : [libshared_static,
3463 install_dir : rootbindir)
3464 public_programs += exe
3466 if want_tests != 'false'
3467 test('test-sysusers.standalone',
3469 # https://github.com/mesonbuild/meson/issues/2681
3470 args : exe.full_path())
3475 if conf.get('ENABLE_TMPFILES') == 1
3478 systemd_tmpfiles_sources,
3479 include_directories : includes,
3480 link_with : [libshared],
3481 dependencies : [libacl],
3482 install_rpath : rootlibexecdir,
3484 install_dir : rootbindir)
3485 public_programs += exe
3487 if want_tests != 'false'
3488 test('test-systemd-tmpfiles',
3489 test_systemd_tmpfiles_py,
3490 # https://github.com/mesonbuild/meson/issues/2681
3491 args : exe.full_path())
3494 if have_standalone_binaries
3496 'systemd-tmpfiles.standalone',
3497 systemd_tmpfiles_sources,
3498 include_directories : includes,
3499 c_args : '-DSTANDALONE',
3500 link_with : [libshared_static,
3504 dependencies : [libacl],
3506 install_dir : rootbindir)
3507 public_programs += exe
3509 if want_tests != 'false'
3510 test('test-systemd-tmpfiles.standalone',
3511 test_systemd_tmpfiles_py,
3512 # https://github.com/mesonbuild/meson/issues/2681
3513 args : exe.full_path())
3518 if conf.get('ENABLE_HWDB') == 1
3519 systemd_hwdb = executable(
3522 include_directories : includes,
3523 link_with : udev_link_with,
3524 install_rpath : udev_rpath,
3526 install_dir : rootbindir)
3527 public_programs += systemd_hwdb
3529 if want_tests != 'false'
3532 suite : 'dist-check',
3533 args : [systemd_hwdb.full_path()],
3538 if conf.get('ENABLE_QUOTACHECK') == 1
3540 'systemd-quotacheck',
3541 'src/quotacheck/quotacheck.c',
3542 include_directories : includes,
3543 link_with : [libshared],
3544 install_rpath : rootlibexecdir,
3546 install_dir : rootlibexecdir)
3549 public_programs += executable(
3550 'systemd-socket-proxyd',
3551 'src/socket-proxy/socket-proxyd.c',
3552 include_directories : includes,
3553 link_with : [libshared],
3554 dependencies : [threads],
3555 install_rpath : rootlibexecdir,
3557 install_dir : rootlibexecdir)
3559 udevadm = executable(
3562 include_directories : includes,
3563 link_with : [libudevd_core],
3564 dependencies : [versiondep,
3570 install_rpath : udev_rpath,
3572 install_dir : rootbindir)
3573 public_programs += udevadm
3575 if conf.get('ENABLE_REPART') == 1
3578 systemd_repart_sources,
3579 include_directories : includes,
3580 link_with : [libshared],
3581 dependencies : [threads,
3584 install_rpath : rootlibexecdir,
3586 install_dir : rootbindir)
3587 public_programs += exe
3589 if want_tests != 'false'
3592 args : [exe.full_path(), udevadm.full_path()])
3598 systemd_shutdown_sources,
3599 include_directories : includes,
3600 link_with : [libshared],
3601 dependencies : [libmount],
3602 install_rpath : rootlibexecdir,
3604 install_dir : rootlibexecdir)
3607 'systemd-update-done',
3608 'src/update-done/update-done.c',
3609 include_directories : includes,
3610 link_with : [libshared],
3611 install_rpath : rootlibexecdir,
3613 install_dir : rootlibexecdir)
3616 'systemd-update-utmp',
3617 'src/update-utmp/update-utmp.c',
3618 include_directories : includes,
3619 link_with : [libshared],
3620 dependencies : [libaudit],
3621 install_rpath : rootlibexecdir,
3622 install : (conf.get('ENABLE_UTMP') == 1),
3623 install_dir : rootlibexecdir)
3625 if conf.get('HAVE_KMOD') == 1
3627 'systemd-modules-load',
3628 'src/modules-load/modules-load.c',
3629 include_directories : includes,
3630 link_with : [libshared],
3631 dependencies : [libkmod],
3632 install_rpath : rootlibexecdir,
3634 install_dir : rootlibexecdir)
3636 meson.add_install_script('sh', '-c',
3637 mkdir_p.format(modulesloaddir))
3638 if install_sysconfdir
3639 meson.add_install_script('sh', '-c',
3640 mkdir_p.format(sysconfdir / 'modules-load.d'))
3644 public_programs += executable(
3646 systemd_nspawn_sources,
3647 include_directories : includes,
3648 link_with : [libnspawn_core,
3650 dependencies : [libblkid,
3652 install_rpath : rootlibexecdir,
3655 if conf.get('ENABLE_NETWORKD') == 1
3656 dbus_programs += executable(
3658 systemd_networkd_sources,
3659 include_directories : network_includes,
3660 link_with : [libnetworkd_core,
3662 networkd_link_with],
3663 dependencies : [threads],
3664 install_rpath : rootlibexecdir,
3666 install_dir : rootlibexecdir)
3668 public_programs += executable(
3669 'systemd-networkd-wait-online',
3670 systemd_networkd_wait_online_sources,
3671 include_directories : includes,
3672 link_with : [networkd_link_with],
3673 install_rpath : rootlibexecdir,
3675 install_dir : rootlibexecdir)
3677 public_programs += executable(
3680 include_directories : libsystemd_network_includes,
3681 link_with : [libsystemd_network,
3682 networkd_link_with],
3683 install_rpath : rootlibexecdir,
3685 install_dir : rootbindir)
3689 'systemd-network-generator',
3690 network_generator_sources,
3691 include_directories : includes,
3692 link_with : [networkd_link_with],
3693 install_rpath : rootlibexecdir,
3695 install_dir : rootlibexecdir)
3697 if want_tests != 'false'
3698 test('test-network-generator-conversion',
3699 test_network_generator_conversion_sh,
3700 # https://github.com/mesonbuild/meson/issues/2681
3701 args : exe.full_path(),
3706 'systemd-sulogin-shell',
3707 'src/sulogin-shell/sulogin-shell.c',
3708 include_directories : includes,
3709 link_with : [libshared],
3710 install_rpath : rootlibexecdir,
3712 install_dir : rootlibexecdir)
3714 public_programs += custom_target(
3716 input : kernel_install_in,
3717 output : 'kernel-install',
3718 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
3719 install : want_kernel_install,
3720 install_mode : 'rwxr-xr-x',
3721 install_dir : bindir)
3723 ############################################################
3725 runtest_env = custom_target(
3726 'systemd-runtest.env',
3727 output : 'systemd-runtest.env',
3728 command : [sh, '-c',
3729 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
3730 project_source_root / 'test',
3731 project_build_root / 'catalog')],
3733 build_by_default : true)
3735 test_cflags = ['-DTEST_CODE=1']
3736 # We intentionally do not do inline initializations with definitions for a
3737 # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
3738 # use the variable unexpectedly. This triggers a lot of maybe-uninitialized
3739 # false positives when the combination of -O2 and -flto is used. Suppress them.
3740 if '-O2' in c_args and '-flto=auto' in c_args
3741 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
3744 foreach tuple : tests
3746 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3747 dependencies = tuple.length() > 2 ? tuple[2] : []
3748 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3749 condition = tuple.length() > 4 ? tuple[4] : ''
3750 type = tuple.length() > 5 ? tuple[5] : ''
3751 defs = tuple.length() > 6 ? tuple[6] : []
3753 parallel = tuple.length() > 7 ? tuple[7] : true
3756 # FIXME: Use fs.stem() with meson >= 0.54.0
3757 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
3758 if type.startswith('timeout=')
3759 timeout = type.split('=')[1].to_int()
3763 if condition == '' or conf.get(condition) == 1
3767 include_directories : incs,
3768 link_with : link_with,
3769 dependencies : [versiondep,
3772 build_by_default : want_tests != 'false',
3773 install_rpath : rootlibexecdir,
3774 install : install_tests,
3775 install_dir : testsdir / type,
3776 link_depends : runtest_env)
3779 message('@0@ is a manual test'.format(name))
3780 elif type == 'unsafe' and want_tests != 'unsafe'
3781 message('@0@ is an unsafe test'.format(name))
3782 elif want_tests != 'false'
3788 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3793 'test-libsystemd-sym',
3794 test_libsystemd_sym_c,
3795 include_directories : includes,
3796 link_with : [libsystemd],
3797 build_by_default : want_tests != 'false',
3798 install : install_tests,
3799 install_dir : testsdir)
3800 if want_tests != 'false'
3801 test('test-libsystemd-sym', exe)
3805 'test-libsystemd-static-sym',
3806 test_libsystemd_sym_c,
3807 include_directories : includes,
3808 link_with : [install_libsystemd_static],
3809 dependencies : [threads], # threads is already included in dependencies on the library,
3810 # but does not seem to get propagated. Add here as a work-around.
3811 build_by_default : want_tests != 'false' and static_libsystemd_pic,
3812 install : install_tests and static_libsystemd_pic,
3813 install_dir : testsdir)
3814 if want_tests != 'false' and static_libsystemd_pic
3815 test('test-libsystemd-static-sym', exe)
3821 include_directories : libudev_includes,
3822 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3823 link_with : [libudev],
3824 build_by_default : want_tests != 'false',
3825 install : install_tests,
3826 install_dir : testsdir)
3827 if want_tests != 'false'
3828 test('test-libudev-sym', exe)
3832 'test-libudev-static-sym',
3834 include_directories : libudev_includes,
3835 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
3836 link_with : [install_libudev_static],
3837 build_by_default : want_tests != 'false' and static_libudev_pic,
3838 install : install_tests and static_libudev_pic,
3839 install_dir : testsdir)
3840 if want_tests != 'false' and static_libudev_pic
3841 test('test-libudev-static-sym', exe)
3844 ############################################################
3848 foreach tuple : fuzzers
3850 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3851 dependencies = tuple.length() > 2 ? tuple[2] : []
3852 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3853 defs = tuple.length() > 4 ? tuple[4] : []
3857 dependencies += fuzzing_engine
3859 if fuzzing_engine.found()
3860 dependencies += fuzzing_engine
3862 link_args += ['-fsanitize=fuzzer']
3865 sources += 'src/fuzz/fuzz-main.c'
3868 # FIXME: Use fs.stem() with meson >= 0.54.0
3869 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
3874 include_directories : [incs, include_directories('src/fuzz')],
3875 link_with : link_with,
3876 dependencies : dependencies,
3877 c_args : defs + test_cflags,
3878 link_args: link_args,
3880 build_by_default : fuzzer_build)
3883 if want_tests != 'false'
3884 # Run the fuzz regression tests without any sanitizers enabled.
3885 # Additional invocations with sanitizers may be added below.
3886 foreach p : fuzz_regression_tests
3887 b = p.split('/')[-2]
3888 c = p.split('/')[-1]
3891 test('@0@_@1@'.format(b, c),
3894 args : [project_source_root / p])
3900 alias_target('fuzzers', fuzzer_exes)
3902 ############################################################
3904 subdir('modprobe.d')
3906 subdir('sysusers.d')
3907 subdir('tmpfiles.d')
3913 subdir('shell-completion/bash')
3914 subdir('shell-completion/zsh')
3915 subdir('docs/sysvinit')
3916 subdir('docs/var-log')
3918 install_subdir('factory/etc',
3919 install_dir : factorydir)
3920 subdir('factory/templates')
3922 if install_sysconfdir
3923 install_data('xorg/50-systemd-user.sh',
3924 install_dir : xinitrcdir)
3926 install_data('LICENSE.GPL2',
3930 'docs/CODING_STYLE.md',
3931 'docs/DISTRO_PORTING.md',
3932 'docs/ENVIRONMENT.md',
3934 'docs/TRANSIENT-SETTINGS.md',
3935 'docs/TRANSLATORS.md',
3936 'docs/UIDS-GIDS.md',
3937 install_dir : docdir)
3939 install_subdir('LICENSES',
3940 install_dir : docdir)
3942 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3943 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3945 ############################################################
3947 # Ensure that changes to the docs/ directory do not break the
3948 # basic Github pages build. But only run it in developer mode,
3949 # as it might be fragile due to changes in the tooling, and it is
3950 # not generally useful for users.
3951 jekyll = find_program('jekyll', required : false)
3952 if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
3953 test('github-pages',
3955 suite : 'dist-check',
3957 '--source', project_source_root / 'docs',
3958 '--destination', project_build_root / '_site'])
3961 ############################################################
3963 check_help = find_program('tools/check-help.sh')
3964 check_version = find_program('tools/check-version.sh')
3966 foreach exec : public_programs
3967 name = exec.full_path().split('/')[-1]
3968 if want_tests != 'false'
3969 test('check-help-' + name,
3971 suite : 'dist-check',
3972 args : exec.full_path(),
3975 test('check-version-' + name,
3977 suite : 'dist-check',
3978 args : [exec.full_path(),
3979 meson.project_version()],
3984 ############################################################
3986 check_directives_sh = find_program('tools/check-directives.sh')
3988 if want_tests != 'false'
3989 test('check-directives',
3990 check_directives_sh,
3991 suite : 'dist-check',
3992 args : [project_source_root, project_build_root])
3995 ############################################################
3997 # Enable tests for all supported sanitizers
3998 foreach tuple : sanitizers
3999 sanitizer = tuple[0]
4002 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
4004 foreach p : fuzz_regression_tests
4005 b = p.split('/')[-2]
4006 c = p.split('/')[-1]
4008 name = '@0@:@1@'.format(b, sanitizer)
4011 if want_tests == 'false'
4012 message('Not compiling @0@ because tests is set to false'.format(name))
4014 exe = custom_target(
4018 command : [ln, '-fs',
4019 build.full_path() / b,
4021 build_by_default : true)
4023 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
4029 test('@0@_@1@_@2@'.format(b, c, sanitizer),
4032 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
4034 args : [exe.full_path(),
4035 project_source_root / p])
4042 ############################################################
4045 all_files = run_command(
4046 env, '-u', 'GIT_WORK_TREE',
4047 git, '--git-dir=@0@/.git'.format(project_source_root),
4048 'ls-files', ':/*.[ch]',
4050 if all_files.returncode() == 0
4051 all_files = files(all_files.stdout().split())
4056 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
4059 command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files)
4064 git_contrib_sh = find_program('tools/git-contrib.sh')
4067 command : [git_contrib_sh])
4071 git_head = run_command(
4072 git, '--git-dir=@0@/.git'.format(project_source_root),
4073 'rev-parse', 'HEAD',
4074 check : false).stdout().strip()
4075 git_head_short = run_command(
4076 git, '--git-dir=@0@/.git'.format(project_source_root),
4077 'rev-parse', '--short=7', 'HEAD',
4078 check : false).stdout().strip()
4082 command : [git, 'archive',
4083 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
4085 '--prefix', 'systemd-@0@/'.format(git_head),
4089 ############################################################
4091 check_api_docs_sh = find_program('tools/check-api-docs.sh')
4094 depends : [man, libsystemd, libudev],
4095 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
4097 alias_target('update-dbus-docs', update_dbus_docs)
4098 alias_target('update-man-rules', update_man_rules)
4100 if not meson.is_cross_build()
4102 'export-dbus-interfaces',
4103 output : fs.name(dbus_interfaces_dir),
4104 install : dbus_interfaces_dir != 'no',
4105 install_dir : fs.parent(dbus_interfaces_dir),
4106 command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs])
4109 ############################################################
4111 alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
4112 check : true).stdout().strip()
4115 'split /usr' : split_usr,
4116 'split bin-sbin' : split_bin,
4117 'prefix directory' : prefixdir,
4118 'rootprefix directory' : rootprefixdir,
4119 'sysconf directory' : sysconfdir,
4120 'include directory' : includedir,
4121 'lib directory' : libdir,
4122 'rootlib directory' : rootlibdir,
4123 'SysV init scripts' : sysvinit_path,
4124 'SysV rc?.d directories' : sysvrcnd_path,
4125 'PAM modules directory' : pamlibdir,
4126 'PAM configuration directory' : pamconfdir,
4127 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
4128 'RPM macros directory' : rpmmacrosdir,
4129 'modprobe.d directory' : modprobedir,
4130 'D-Bus policy directory' : dbuspolicydir,
4131 'D-Bus session directory' : dbussessionservicedir,
4132 'D-Bus system directory' : dbussystemservicedir,
4133 'D-Bus interfaces directory' : dbus_interfaces_dir,
4134 'bash completions directory' : bashcompletiondir,
4135 'zsh completions directory' : zshcompletiondir,
4136 'private shared lib version tag' : shared_lib_tag,
4137 'extra start script' : get_option('rc-local'),
4138 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
4139 get_option('debug-tty')),
4140 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
4141 conf.get('SYSTEM_ALLOC_UID_MIN')),
4142 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
4143 conf.get('SYSTEM_ALLOC_GID_MIN')),
4144 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
4145 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
4146 'static UID/GID allocations' : ' '.join(static_ugids),
4147 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
4148 'render group access mode' : get_option('group-render-mode'),
4149 'certificate root directory' : get_option('certificate-root'),
4150 'support URL' : support_url,
4151 'nobody user name' : nobody_user,
4152 'nobody group name' : nobody_group,
4153 'fallback hostname' : get_option('fallback-hostname'),
4154 'default compression method' : compression,
4155 'default DNSSEC mode' : default_dnssec,
4156 'default DNS-over-TLS mode' : default_dns_over_tls,
4157 'default mDNS mode' : default_mdns,
4158 'default LLMNR mode' : default_llmnr,
4159 'default DNS servers' : dns_servers.split(' '),
4160 'default NTP servers' : ntp_servers.split(' '),
4161 'default cgroup hierarchy' : default_hierarchy,
4162 'default net.naming-scheme value' : default_net_naming_scheme,
4163 'default KillUserProcesses value' : kill_user_processes,
4164 'default locale' : default_locale,
4165 'default user $PATH' :
4166 default_user_path != '' ? default_user_path : '(same as system services)',
4167 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
4168 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
4171 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
4172 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
4173 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
4194 ['libcryptsetup-plugins'],
4220 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
4250 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
4264 ['legacy-pkla', install_polkit_pkla],
4269 ['man pages', want_man],
4270 ['html pages', want_html],
4271 ['man page indices', want_man and have_lxml],
4273 ['compat-mutable-uid-boundaries'],
4276 ['adm group', get_option('adm-group')],
4277 ['wheel group', get_option('wheel-group')],
4280 ['debug mmap cache'],
4282 ['valgrind', conf.get('VALGRIND') == 1],
4283 ['trace logging', conf.get('LOG_TRACE') == 1],
4284 ['install tests', install_tests],
4285 ['link-udev-shared', get_option('link-udev-shared')],
4286 ['link-systemctl-shared', get_option('link-systemctl-shared')],
4287 ['link-networkd-shared', get_option('link-networkd-shared')],
4288 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
4289 ['link-boot-shared', get_option('link-boot-shared')],
4291 ['standalone-binaries', get_option('standalone-binaries')],
4292 ['coverage', get_option('b_coverage')],
4295 if tuple.length() >= 2
4298 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
4299 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
4300 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
4309 if static_libsystemd == 'false'
4310 missing += 'static-libsystemd'
4312 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
4315 if static_libudev == 'false'
4316 missing += 'static-libudev'
4318 found += 'static-libudev(@0@)'.format(static_libudev)
4321 if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
4322 found += 'cryptolib(openssl)'
4323 elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
4324 found += 'cryptolib(gcrypt)'
4326 missing += 'cryptolib'
4329 if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
4330 found += 'DNS-over-TLS(gnutls)'
4331 elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
4332 found += 'DNS-over-TLS(openssl)'
4334 missing += 'DNS-over-TLS'
4338 'enabled' : ', '.join(found),
4339 'disabled' : ', '.join(missing)},
4340 section : 'Features')
4342 if rootprefixdir != rootprefix_default
4344 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
4345 'systemd used fixed names for unit file directories and other paths, so anything\n' +
4346 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))