]> git.ipfire.org Git - thirdparty/systemd.git/blame - meson.build
dm-verity: Remove usage of integrity
[thirdparty/systemd.git] / meson.build
CommitLineData
db9ecf05 1# SPDX-License-Identifier: LGPL-2.1-or-later
3a726fcd 2
5c23128d 3project('systemd', 'c',
ca1e8584 4 version : '249',
5c23128d
ZJS
5 license : 'LGPLv2+',
6 default_options: [
37efbbd8
ZJS
7 'c_std=gnu99',
8 'prefix=/usr',
9 'sysconfdir=/etc',
10 'localstatedir=/var',
827ca909 11 'warning_level=2',
5c23128d 12 ],
9247df5a 13 meson_version : '>= 0.53.2',
5c23128d
ZJS
14 )
15
ca1e8584
LP
16libsystemd_version = '0.32.0'
17libudev_version = '1.7.2'
56d50ab1 18
5c23128d 19conf = configuration_data()
e11a25ca
ZJS
20conf.set_quoted('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
21conf.set('PROJECT_VERSION', meson.project_version(),
6ffeca8c 22 description : 'Numerical project version (used where a simple number is expected)')
5c23128d 23
1485aacb
DC
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
26project_source_root = meson.current_source_dir()
81e06775 27project_build_root = meson.current_build_dir()
a0b15b41 28relative_source_path = run_command('realpath',
81e06775 29 '--relative-to=@0@'.format(project_build_root),
a0b15b41
ZJS
30 project_source_root).stdout().strip()
31conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
1485aacb 32
47350c5f
ZJS
33conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer',
34 description : 'tailor build to development or release builds')
839bdf25 35
c09edc79
ZJS
36want_ossfuzz = get_option('oss-fuzz')
37want_libfuzzer = get_option('llvm-fuzz')
c29537f3 38if want_ossfuzz and want_libfuzzer
6b8d32ea 39 error('only one of oss-fuzz or llvm-fuzz can be specified')
c09edc79 40endif
87ac55a1
EV
41
42skip_deps = want_ossfuzz or want_libfuzzer
6b8d32ea 43fuzzer_build = want_ossfuzz or want_libfuzzer
c09edc79 44
5c23128d
ZJS
45#####################################################################
46
003c8879 47# Try to install the git pre-commit hook
e2d612a8
ZJS
48add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
49if add_git_hook_sh.found()
50 git_hook = run_command(add_git_hook_sh)
51 if git_hook.returncode() == 0
52 message(git_hook.stdout().strip())
53 endif
003c8879
ZJS
54endif
55
56#####################################################################
57
2675413e
ZJS
58if get_option('split-usr') == 'auto'
59 split_usr = run_command('test', '-L', '/bin').returncode() != 0
60else
61 split_usr = get_option('split-usr') == 'true'
62endif
9afd5e7b
ZJS
63if split_usr
64 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
65 + ' split-usr mode is going to be removed\n' +
66 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
67endif
671f0f8d
ZJS
68conf.set10('HAVE_SPLIT_USR', split_usr,
69 description : '/usr/bin and /bin directories are separate')
9a8e64b0 70
157baa87
ZJS
71if get_option('split-bin') == 'auto'
72 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
73else
74 split_bin = get_option('split-bin') == 'true'
75endif
671f0f8d
ZJS
76conf.set10('HAVE_SPLIT_BIN', split_bin,
77 description : 'bin and sbin directories are separate')
157baa87 78
74344a17 79rootprefixdir = get_option('rootprefix')
74344a17
ZJS
80# Unusual rootprefixdir values are used by some distros
81# (see https://github.com/systemd/systemd/pull/7461).
ba7f4ae6 82rootprefix_default = split_usr ? '/' : '/usr'
9a8e64b0
ZJS
83if rootprefixdir == ''
84 rootprefixdir = rootprefix_default
74344a17 85endif
23bdba61 86rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
5c23128d 87
8ef8f3d5
FB
88have_standalone_binaries = get_option('standalone-binaries')
89
5c23128d
ZJS
90sysvinit_path = get_option('sysvinit-path')
91sysvrcnd_path = get_option('sysvrcnd-path')
348b4437 92conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
349cc4a5 93 description : 'SysV init scripts and rcN.d links are supported')
6fe23ff3 94conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
5c23128d 95
cdf7ad38
NL
96if get_option('hibernate') and not get_option('initrd')
97 error('hibernate depends on initrd')
98endif
99
a8b627aa
LP
100conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
101conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
09dad04c 102conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
a8b627aa 103
fce9abb2
ZJS
104# Meson ignores the preceding arguments when joining paths if an absolute
105# component is encountered, so this should canonicalize various paths when they
106# are absolute or relative.
5c23128d
ZJS
107prefixdir = get_option('prefix')
108if not prefixdir.startswith('/')
37efbbd8 109 error('Prefix is not absolute: "@0@"'.format(prefixdir))
5c23128d 110endif
b2d74870 111if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
d895e10a
ZJS
112 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
113 rootprefixdir, prefixdir))
114endif
115
fce9abb2
ZJS
116bindir = prefixdir / get_option('bindir')
117libdir = prefixdir / get_option('libdir')
118sysconfdir = prefixdir / get_option('sysconfdir')
119includedir = prefixdir / get_option('includedir')
120datadir = prefixdir / get_option('datadir')
121localstatedir = '/' / get_option('localstatedir')
5c23128d 122
fce9abb2
ZJS
123rootbindir = rootprefixdir / 'bin'
124rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin')
125rootlibexecdir = rootprefixdir / 'lib/systemd'
5c23128d
ZJS
126
127rootlibdir = get_option('rootlibdir')
128if rootlibdir == ''
fce9abb2 129 rootlibdir = rootprefixdir / libdir.split('/')[-1]
5c23128d
ZJS
130endif
131
225d08b8
JT
132install_sysconfdir = get_option('install-sysconfdir') != 'false'
133install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
5c23128d 134# Dirs of external packages
fce9abb2
ZJS
135pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig'
136pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
137polkitpolicydir = datadir / 'polkit-1/actions'
138polkitrulesdir = datadir / 'polkit-1/rules.d'
139polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
140xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d'
8a38aac3
YW
141rpmmacrosdir = get_option('rpmmacrosdir')
142if rpmmacrosdir != 'no'
fce9abb2 143 rpmmacrosdir = prefixdir / rpmmacrosdir
8a38aac3 144endif
fce9abb2 145modprobedir = rootprefixdir / 'lib/modprobe.d'
5c23128d
ZJS
146
147# Our own paths
fce9abb2
ZJS
148pkgdatadir = datadir / 'systemd'
149environmentdir = prefixdir / 'lib/environment.d'
150pkgsysconfdir = sysconfdir / 'systemd'
151userunitdir = prefixdir / 'lib/systemd/user'
152userpresetdir = prefixdir / 'lib/systemd/user-preset'
153tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
154sysusersdir = prefixdir / 'lib/sysusers.d'
155sysctldir = prefixdir / 'lib/sysctl.d'
156binfmtdir = prefixdir / 'lib/binfmt.d'
157modulesloaddir = prefixdir / 'lib/modules-load.d'
158networkdir = rootprefixdir / 'lib/systemd/network'
159pkgincludedir = includedir / 'systemd'
160systemgeneratordir = rootlibexecdir / 'system-generators'
161usergeneratordir = prefixdir / 'lib/systemd/user-generators'
162systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
163userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
164systemshutdowndir = rootlibexecdir / 'system-shutdown'
165systemsleepdir = rootlibexecdir / 'system-sleep'
166systemunitdir = rootprefixdir / 'lib/systemd/system'
167systempresetdir = rootprefixdir / 'lib/systemd/system-preset'
168udevlibexecdir = rootprefixdir / 'lib/udev'
169udevrulesdir = udevlibexecdir / 'rules.d'
170udevhwdbdir = udevlibexecdir / 'hwdb.d'
171catalogdir = prefixdir / 'lib/systemd/catalog'
172kernelinstalldir = prefixdir / 'lib/kernel/install.d'
173factorydir = datadir / 'factory'
174bootlibdir = prefixdir / 'lib/systemd/boot/efi'
175testsdir = prefixdir / 'lib/systemd/tests'
176systemdstatedir = localstatedir / 'lib/systemd'
177catalogstatedir = systemdstatedir / 'catalog'
178randomseeddir = localstatedir / 'lib/systemd'
179profiledir = rootlibexecdir / 'portable' / 'profile'
180ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
5c23128d 181
75aaade1
TB
182docdir = get_option('docdir')
183if docdir == ''
fce9abb2 184 docdir = datadir / 'doc/systemd'
75aaade1
TB
185endif
186
5c23128d
ZJS
187dbuspolicydir = get_option('dbuspolicydir')
188if dbuspolicydir == ''
fce9abb2 189 dbuspolicydir = datadir / 'dbus-1/system.d'
5c23128d
ZJS
190endif
191
192dbussessionservicedir = get_option('dbussessionservicedir')
193if dbussessionservicedir == ''
fce9abb2 194 dbussessionservicedir = datadir / 'dbus-1/services'
5c23128d
ZJS
195endif
196
197dbussystemservicedir = get_option('dbussystemservicedir')
198if dbussystemservicedir == ''
fce9abb2 199 dbussystemservicedir = datadir / 'dbus-1/system-services'
5c23128d
ZJS
200endif
201
202pamlibdir = get_option('pamlibdir')
203if pamlibdir == ''
fce9abb2 204 pamlibdir = rootlibdir / 'security'
5c23128d
ZJS
205endif
206
207pamconfdir = get_option('pamconfdir')
208if pamconfdir == ''
fce9abb2 209 pamconfdir = prefixdir / 'lib/pam.d'
5c23128d
ZJS
210endif
211
d1ae38d8
OK
212libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir')
213if libcryptsetup_plugins_dir == ''
fce9abb2 214 libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup'
d1ae38d8
OK
215endif
216
444d5863 217memory_accounting_default = get_option('memory-accounting-default')
36cf4507 218status_unit_format_default = get_option('status-unit-format-default')
444d5863 219
491bf10c
ZJS
220conf.set_quoted('BINFMT_DIR', binfmtdir)
221conf.set_quoted('BOOTLIBDIR', bootlibdir)
fce9abb2 222conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database')
491bf10c 223conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
6fe23ff3 224conf.set_quoted('DOC_DIR', docdir)
fce9abb2 225conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd')
491bf10c
ZJS
226conf.set_quoted('ENVIRONMENT_DIR', environmentdir)
227conf.set_quoted('INCLUDE_DIR', includedir)
228conf.set_quoted('LIBDIR', libdir)
229conf.set_quoted('MODPROBE_DIR', modprobedir)
230conf.set_quoted('MODULESLOAD_DIR', modulesloaddir)
5c23128d 231conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
fce9abb2 232conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent')
491bf10c 233conf.set_quoted('PREFIX', prefixdir)
fce9abb2 234conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed')
491bf10c 235conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
452d2dfd 236conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
491bf10c
ZJS
237conf.set_quoted('ROOTBINDIR', rootbindir)
238conf.set_quoted('ROOTLIBDIR', rootlibdir)
239conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
240conf.set_quoted('ROOTPREFIX', rootprefixdir)
241conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
242conf.set_quoted('SYSCONF_DIR', sysconfdir)
243conf.set_quoted('SYSCTL_DIR', sysctldir)
fce9abb2
ZJS
244conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl')
245conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd')
491bf10c 246conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
fce9abb2
ZJS
247conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent')
248conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup')
249conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export')
250conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck')
251conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs')
252conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework')
253conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs')
254conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import')
255conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map')
256conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map')
257conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs')
258conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull')
259conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown')
260conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', bindir / 'systemd-stdio-bridge')
261conf.set_quoted('SYSTEMD_TEST_DATA', testsdir / 'testdata')
262conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent')
263conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper')
264conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork')
265conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup')
266conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system')
491bf10c 267conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir)
96d33e4a 268conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
491bf10c
ZJS
269conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
270conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
5c23128d
ZJS
271conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
272conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
491bf10c
ZJS
273conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
274conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
835cf75a
ZJS
275conf.set_quoted('SYSUSERS_DIR', sysusersdir)
276conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
5c23128d 277conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
491bf10c
ZJS
278conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
279conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
36d55958 280conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout'))
fce9abb2 281conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user')
491bf10c
ZJS
282conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
283conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
284conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
fce9abb2 285conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg')
491bf10c 286conf.set_quoted('USER_PRESET_DIR', userpresetdir)
fce9abb2 287conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg')
491bf10c
ZJS
288
289conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
e5d86ebe 290conf.set10('ENABLE_URLIFY', get_option('urlify'))
491bf10c 291conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
30538ff1 292conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
36cf4507 293conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
e11a25ca 294conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default)
5c23128d 295
5c23128d
ZJS
296#####################################################################
297
298cc = meson.get_compiler('c')
299pkgconfig = import('pkgconfig')
dd1e33c8 300check_compilation_sh = find_program('tools/check-compilation.sh')
b68dfb9e 301meson_build_sh = find_program('tools/meson-build.sh')
5c23128d 302
d3da291e
ZJS
303want_tests = get_option('tests')
304slow_tests = want_tests != 'false' and get_option('slow-tests')
c56463fd 305fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
d3da291e
ZJS
306install_tests = get_option('install-tests')
307
46e63a2a 308if add_languages('cpp', required : fuzzer_build)
3b2bdd62 309 # Used only for tests
e9f4f566
ZJS
310 cxx = meson.get_compiler('cpp')
311 cxx_cmd = ' '.join(cxx.cmd_array())
1b2acaa7 312else
9b0ca019 313 cxx_cmd = ''
94e2523b
ZJS
314endif
315
31e57a35 316if want_libfuzzer
9c5c4677
EV
317 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
318 if fuzzing_engine.found()
319 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
320 elif cc.has_argument('-fsanitize=fuzzer-no-link')
321 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
322 else
323 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
324 endif
c09edc79 325elif want_ossfuzz
7db7d5b7
JR
326 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
327endif
328
e9f4f566
ZJS
329# Those generate many false positives, and we do not want to change the code to
330# avoid them.
331basic_disabled_warnings = [
505ab9dd 332 '-Wno-format-signedness',
e9f4f566 333 '-Wno-missing-field-initializers',
505ab9dd 334 '-Wno-unused-parameter',
e9f4f566 335]
e9f4f566 336
65267363 337possible_common_cc_flags = [
505ab9dd
YW
338 '-Wdate-time',
339 '-Wendif-labels',
340 '-Werror=format=2',
341 '-Werror=implicit-function-declaration',
342 '-Werror=incompatible-pointer-types',
ebbb1e36 343 '-Werror=int-conversion',
505ab9dd
YW
344 '-Werror=overflow',
345 '-Werror=return-type',
346 '-Werror=shift-count-overflow',
347 '-Werror=shift-overflow=2',
30a4ddff 348 '-Werror=undef',
702d4027 349 '-Werror=unused-function',
505ab9dd
YW
350 '-Wfloat-equal',
351 '-Wimplicit-fallthrough=5',
352 '-Winit-self',
30a4ddff
YW
353 '-Wlogical-op',
354 '-Wmissing-include-dirs',
505ab9dd
YW
355 '-Wmissing-noreturn',
356 '-Wnested-externs',
30a4ddff
YW
357 '-Wold-style-definition',
358 '-Wpointer-arith',
30a4ddff 359 '-Wredundant-decls',
30a4ddff 360 '-Wshadow',
30a4ddff 361 '-Wstrict-aliasing=2',
505ab9dd
YW
362 '-Wstrict-prototypes',
363 '-Wsuggest-attribute=noreturn',
30a4ddff 364 '-Wwrite-strings',
bf7efeb1
FB
365
366 # negative arguments are correctly detected starting with meson 0.46.
eed33623
ZJS
367 '-Wno-error=#warnings', # clang
368 '-Wno-string-plus-int', # clang
30a4ddff
YW
369]
370
68c98a41
ZJS
371# Disable -Wmaybe-unitialized when compiling with -Os/-O1/-O3/etc. There are
372# too many false positives with gcc >= 8. Effectively, we only test with -O0
373# and -O2; this should be enough to catch most important cases without too much
374# busywork. See https://github.com/systemd/systemd/pull/19226.
375if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
376 cc.version().version_compare('<10'))
65267363 377 possible_common_cc_flags += '-Wno-maybe-uninitialized'
68c98a41
ZJS
378endif
379
bc2a4af2
ZJS
380# Disable -Wno-unused-result with gcc, see
381# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
382if cc.get_id() == 'gcc'
383 possible_common_cc_flags += '-Wno-unused-result'
384endif
385
30a4ddff 386# --as-needed and --no-undefined are provided by meson by default,
9247df5a 387# run 'meson configure' to see what is enabled
30a4ddff
YW
388possible_link_flags = [
389 '-Wl,-z,relro',
390 '-Wl,-z,now',
68e70ac2 391 '-fstack-protector',
30a4ddff 392]
5c23128d 393
30a4ddff 394if cc.get_id() == 'clang'
65267363 395 possible_common_cc_flags += [
30a4ddff
YW
396 '-Wno-typedef-redefinition',
397 '-Wno-gnu-variable-sized-type-not-at-end',
398 ]
399endif
400
16e09d51
YW
401possible_cc_flags = possible_common_cc_flags + [
402 '-Werror=missing-declarations',
403 '-Werror=missing-prototypes',
404 '-fdiagnostics-show-option',
405 '-ffast-math',
406 '-fno-common',
407 '-fno-strict-aliasing',
408 '-fstack-protector',
409 '-fstack-protector-strong',
410 '-fvisibility=hidden',
411 '--param=ssp-buffer-size=4',
412]
413
30a4ddff 414if get_option('buildtype') != 'debug'
16e09d51 415 possible_cc_flags += [
30a4ddff
YW
416 '-ffunction-sections',
417 '-fdata-sections',
418 ]
419
420 possible_link_flags += '-Wl,--gc-sections'
421endif
422
e9f4f566 423add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
30a4ddff 424add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
7a6397d2 425add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
30a4ddff 426
94c0c5b7
ZJS
427have = cc.has_argument('-Wzero-length-bounds')
428conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
429
9e70f2f8 430if cc.compiles('''
5c23128d
ZJS
431 #include <time.h>
432 #include <inttypes.h>
433 typedef uint64_t usec_t;
434 usec_t now(clockid_t clock);
435 int main(void) {
436 struct timespec now;
437 return 0;
438 }
38c1c96d 439''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
37efbbd8 440 add_project_arguments('-Werror=shadow', language : 'c')
5c23128d
ZJS
441endif
442
e9f4f566
ZJS
443if cxx_cmd != ''
444 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
445endif
446
0e3cc902 447cpp = ' '.join(cc.cmd_array()) + ' -E'
9cc0e6e9 448
6695c200
ZJS
449has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
450
5c23128d
ZJS
451#####################################################################
452# compilation result tests
453
2c201c21
ZJS
454conf.set('_GNU_SOURCE', true)
455conf.set('__SANE_USERSPACE_TYPES__', true)
6695c200 456conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
5c23128d 457
5c23128d
ZJS
458conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
459conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
460conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
461conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
462
463decl_headers = '''
464#include <uchar.h>
84e8edec 465#include <sys/mount.h>
4c2e1b39 466#include <sys/stat.h>
84e8edec 467#include <linux/fs.h>
5c23128d 468'''
5c23128d
ZJS
469
470foreach decl : ['char16_t',
471 'char32_t',
84e8edec 472 'struct mount_attr',
4c2e1b39 473 'struct statx',
5c23128d 474 ]
2c201c21
ZJS
475
476 # We get -1 if the size cannot be determined
9c869d08
ZJS
477 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
478
479 if decl == 'struct statx'
480 if have
481 want_linux_stat_h = false
482 else
483 have = cc.sizeof(decl,
484 prefix : decl_headers + '#include <linux/stat.h>',
485 args : '-D_GNU_SOURCE') > 0
486 want_linux_stat_h = have
487 endif
488 endif
489
349cc4a5 490 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
5c23128d
ZJS
491endforeach
492
9c869d08 493conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
75720bff 494
5c23128d 495foreach ident : ['secure_getenv', '__secure_getenv']
349cc4a5 496 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
5c23128d
ZJS
497endforeach
498
499foreach ident : [
85db59b7 500 ['memfd_create', '''#include <sys/mman.h>'''],
7b961e40
LP
501 ['gettid', '''#include <sys/types.h>
502 #include <unistd.h>'''],
3c042add
LP
503 ['pivot_root', '''#include <stdlib.h>
504 #include <unistd.h>'''], # no known header declares pivot_root
51fe206f
ZJS
505 ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get
506 ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set
85db59b7 507 ['name_to_handle_at', '''#include <sys/types.h>
37efbbd8
ZJS
508 #include <sys/stat.h>
509 #include <fcntl.h>'''],
85db59b7 510 ['setns', '''#include <sched.h>'''],
2acfd0ff
LP
511 ['renameat2', '''#include <stdio.h>
512 #include <fcntl.h>'''],
37efbbd8
ZJS
513 ['kcmp', '''#include <linux/kcmp.h>'''],
514 ['keyctl', '''#include <sys/types.h>
515 #include <keyutils.h>'''],
85db59b7 516 ['copy_file_range', '''#include <sys/syscall.h>
37efbbd8 517 #include <unistd.h>'''],
71e5200f
DM
518 ['bpf', '''#include <sys/syscall.h>
519 #include <unistd.h>'''],
4c2e1b39
LP
520 ['statx', '''#include <sys/types.h>
521 #include <sys/stat.h>
522 #include <unistd.h>'''],
aa484f35 523 ['explicit_bzero' , '''#include <string.h>'''],
5bb20fd3 524 ['reallocarray', '''#include <stdlib.h>'''],
b070c7c0
MS
525 ['set_mempolicy', '''#include <stdlib.h>
526 #include <unistd.h>'''],
527 ['get_mempolicy', '''#include <stdlib.h>
528 #include <unistd.h>'''],
5f152f43
LP
529 ['pidfd_send_signal', '''#include <stdlib.h>
530 #include <unistd.h>
531 #include <signal.h>
532 #include <sys/wait.h>'''],
533 ['pidfd_open', '''#include <stdlib.h>
534 #include <unistd.h>
535 #include <signal.h>
536 #include <sys/wait.h>'''],
5ead4e85
LP
537 ['rt_sigqueueinfo', '''#include <stdlib.h>
538 #include <unistd.h>
539 #include <signal.h>
540 #include <sys/wait.h>'''],
4b6f74f5 541 ['mallinfo', '''#include <malloc.h>'''],
1885169c 542 ['mallinfo2', '''#include <malloc.h>'''],
8939eeae 543 ['execveat', '''#include <unistd.h>'''],
441e0fdb 544 ['close_range', '''#include <unistd.h>'''],
420297c9 545 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
84e8edec
LP
546 ['mount_setattr', '''#include <sys/mount.h>'''],
547 ['move_mount', '''#include <sys/mount.h>'''],
548 ['open_tree', '''#include <sys/mount.h>'''],
aab35b1e 549 ['getdents64', '''#include <dirent.h>'''],
37efbbd8
ZJS
550]
551
85db59b7 552 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
4b9545f1 553 conf.set10('HAVE_' + ident[0].to_upper(), have)
5c23128d
ZJS
554endforeach
555
85db59b7 556if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
349cc4a5 557 conf.set10('USE_SYS_RANDOM_H', true)
4b9545f1 558 conf.set10('HAVE_GETRANDOM', true)
4984c8be
ZJS
559else
560 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
349cc4a5 561 conf.set10('USE_SYS_RANDOM_H', false)
4b9545f1 562 conf.set10('HAVE_GETRANDOM', have)
4984c8be
ZJS
563endif
564
5c23128d
ZJS
565#####################################################################
566
064b8e2c
DDM
567version_tag = get_option('version-tag')
568if version_tag != ''
569 vcs_data = configuration_data()
570 vcs_data.set('VCS_TAG', version_tag)
571 version_h = configure_file(configuration : vcs_data,
572 input : 'src/version/version.h.in',
573 output : 'version.h')
574else
575 vcs_tagger = [
576 project_source_root + '/tools/meson-vcs-tag.sh',
577 project_source_root,
578 meson.project_version()]
579
580 version_h = vcs_tag(
581 input : 'src/version/version.h.in',
582 output : 'version.h',
583 command: vcs_tagger)
584endif
d1084aa2
LT
585
586versiondep = declare_dependency(sources: version_h)
587
0f4c4f38
ZJS
588sh = find_program('sh')
589echo = find_program('echo')
590test = find_program('test')
5c23128d 591sed = find_program('sed')
5c23128d 592awk = find_program('awk')
5c23128d 593stat = find_program('stat')
0f4c4f38 594ln = find_program('ln')
d68b342b 595git = find_program('git', required : false)
b68dfb9e 596env = find_program('env')
b1ffacb6 597perl = find_program('perl', required : false)
0f4c4f38 598rsync = find_program('rsync', required : false)
7c22f07c 599meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
0f4c4f38 600test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
5c23128d 601
94e75a54 602mkdir_p = 'mkdir -p $DESTDIR/@0@'
d83f4f50 603splash_bmp = files('test/splash.bmp')
94e75a54 604
9247df5a 605# If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
5c23128d 606# /usr/sbin, /sbin, and fall back to the default from middle column.
2fa645f1 607progs = [['quotaon', '/usr/sbin/quotaon' ],
5c23128d 608 ['quotacheck', '/usr/sbin/quotacheck' ],
5c23128d
ZJS
609 ['kmod', '/usr/bin/kmod' ],
610 ['kexec', '/usr/sbin/kexec' ],
611 ['sulogin', '/usr/sbin/sulogin' ],
612 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
613 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
614 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
615 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
6db90462 616 ['nologin', '/usr/sbin/nologin', ],
5c23128d
ZJS
617 ]
618foreach prog : progs
37efbbd8
ZJS
619 path = get_option(prog[0] + '-path')
620 if path != ''
621 message('Using @1@ for @0@'.format(prog[0], path))
622 else
623 exe = find_program(prog[0],
624 '/usr/sbin/' + prog[0],
625 '/sbin/' + prog[0],
626 required: false)
627 path = exe.found() ? exe.path() : prog[1]
628 endif
629 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
630 conf.set_quoted(name, path)
5c23128d
ZJS
631endforeach
632
2fa645f1
MG
633conf.set_quoted('TELINIT', get_option('telinit-path'))
634
0f4c4f38 635if run_command(ln, '--relative', '--help').returncode() != 0
cd001016 636 error('ln does not support --relative (added in coreutils 8.16)')
1276a9f6 637endif
5c23128d
ZJS
638
639############################################################
640
e0698c66
ZJS
641if run_command('python3', '-c', 'import jinja2').returncode() != 0
642 error('python3 jinja2 missing')
643endif
644
645############################################################
646
5c23128d
ZJS
647gperf = find_program('gperf')
648
649gperf_test_format = '''
650#include <string.h>
651const char * in_word_set(const char *, @0@);
652@1@
653'''
654gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
0f4c4f38 655gperf_snippet = run_command(sh, '-c', gperf_snippet_format.format(gperf.path()))
5c23128d
ZJS
656gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
657if cc.compiles(gperf_test)
37efbbd8 658 gperf_len_type = 'size_t'
5c23128d 659else
37efbbd8
ZJS
660 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
661 if cc.compiles(gperf_test)
662 gperf_len_type = 'unsigned'
663 else
664 error('unable to determine gperf len type')
665 endif
5c23128d
ZJS
666endif
667message('gperf len type is @0@'.format(gperf_len_type))
37efbbd8
ZJS
668conf.set('GPERF_LEN_TYPE', gperf_len_type,
669 description : 'The type of gperf "len" parameter')
5c23128d
ZJS
670
671############################################################
672
673if not cc.has_header('sys/capability.h')
37efbbd8 674 error('POSIX caps headers not found')
5c23128d 675endif
9f555bba 676foreach header : ['crypt.h',
5c23128d
ZJS
677 'linux/memfd.h',
678 'linux/vm_sockets.h',
af8786b1 679 'sys/auxv.h',
5c23128d
ZJS
680 'valgrind/memcheck.h',
681 'valgrind/valgrind.h',
420297c9 682 'linux/time_types.h',
b428efa5 683 'sys/sdt.h',
5c23128d 684 ]
2c201c21 685
349cc4a5
ZJS
686 conf.set10('HAVE_' + header.underscorify().to_upper(),
687 cc.has_header(header))
5c23128d
ZJS
688endforeach
689
690############################################################
691
eef4b800
ZJS
692fallback_hostname = get_option('fallback-hostname')
693if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
694 error('Invalid fallback-hostname configuration')
695 # A more extensive test is done in test-hostname-util. Let's catch
696 # the most obvious errors here so we don't fail with an assert later.
697endif
698conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
699
5c23128d
ZJS
700default_hierarchy = get_option('default-hierarchy')
701conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
702 description : 'default cgroup hierarchy as string')
703if default_hierarchy == 'legacy'
37efbbd8 704 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
5c23128d 705elif default_hierarchy == 'hybrid'
37efbbd8 706 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
5c23128d 707else
37efbbd8 708 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
5c23128d
ZJS
709endif
710
681cb84a
ZJS
711extra_net_naming_schemes = []
712extra_net_naming_map = []
713foreach scheme: get_option('extra-net-naming-schemes').split(',')
714 if scheme != ''
715 name = scheme.split('=')[0]
716 value = scheme.split('=')[1]
717 NAME = name.underscorify().to_upper()
718 VALUE = []
719 foreach field: value.split('+')
720 VALUE += 'NAMING_' + field.underscorify().to_upper()
721 endforeach
722 extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE))
723 extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME)
724 endif
725endforeach
726conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes))
727conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map))
728
06da5c63
ZJS
729default_net_naming_scheme = get_option('default-net-naming-scheme')
730conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
77faadfd
ZJS
731if default_net_naming_scheme != 'latest'
732 conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST',
733 'NAMING_' + default_net_naming_scheme.underscorify().to_upper())
734endif
06da5c63 735
5c23128d 736time_epoch = get_option('time-epoch')
ac09340e 737if time_epoch == -1
0f4c4f38 738 time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"').stdout().strip()
0390b094 739 if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
bd190899 740 # If we're in a git repository, use the creation time of the latest git tag.
0f4c4f38
ZJS
741 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags').stdout().strip()
742 time_epoch = run_command(git, 'log', '--no-show-signature', '-1', '--format=%at', latest_tag).stdout()
0390b094
ZJS
743 endif
744 if time_epoch == ''
6dbf352c 745 NEWS = files('NEWS')
0390b094 746 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
6dbf352c 747 endif
0390b094 748 time_epoch = time_epoch.to_int()
5c23128d 749endif
5c23128d
ZJS
750conf.set('TIME_EPOCH', time_epoch)
751
b10abe4b
EI
752conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max'))
753
fc1a5d1a
ZJS
754foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
755 ['system-uid-max', 'SYS_UID_MAX', 999],
756 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
757 ['system-gid-max', 'SYS_GID_MAX', 999]]
758 v = get_option(tuple[0])
759 if v == -1
760 v = run_command(
761 awk,
762 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
763 '/etc/login.defs').stdout().strip()
764 if v == ''
765 v = tuple[2]
766 else
767 v = v.to_int()
768 endif
2f62cf35 769 endif
fc1a5d1a 770 conf.set(tuple[0].underscorify().to_upper(), v)
fc1a5d1a
ZJS
771endforeach
772if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
773 error('Invalid uid allocation range')
5c23128d 774endif
fc1a5d1a
ZJS
775if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
776 error('Invalid gid allocation range')
5c23128d 777endif
5c23128d 778
ac09340e
YW
779dynamic_uid_min = get_option('dynamic-uid-min')
780dynamic_uid_max = get_option('dynamic-uid-max')
87d5e4f2
LP
781conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
782conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
87d5e4f2 783
ac09340e
YW
784container_uid_base_min = get_option('container-uid-base-min')
785container_uid_base_max = get_option('container-uid-base-max')
87d5e4f2
LP
786conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
787conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
87d5e4f2 788
afde4574
LP
789nobody_user = get_option('nobody-user')
790nobody_group = get_option('nobody-group')
791
2484bff3
CQ
792if not meson.is_cross_build()
793 getent_result = run_command('getent', 'passwd', '65534')
794 if getent_result.returncode() == 0
795 name = getent_result.stdout().split(':')[0]
796 if name != nobody_user
797 warning('\n' +
798 '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) +
799 'Your build will result in an user table setup that is incompatible with the local system.')
800 endif
afde4574 801 endif
2484bff3
CQ
802 id_result = run_command('id', '-u', nobody_user)
803 if id_result.returncode() == 0
804 id = id_result.stdout().to_int()
805 if id != 65534
806 warning('\n' +
807 '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) +
808 'Your build will result in an user table setup that is incompatible with the local system.')
809 endif
afde4574 810 endif
afde4574 811
2484bff3
CQ
812 getent_result = run_command('getent', 'group', '65534')
813 if getent_result.returncode() == 0
814 name = getent_result.stdout().split(':')[0]
815 if name != nobody_group
816 warning('\n' +
817 '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) +
818 'Your build will result in an group table setup that is incompatible with the local system.')
819 endif
afde4574 820 endif
2484bff3
CQ
821 id_result = run_command('id', '-g', nobody_group)
822 if id_result.returncode() == 0
823 id = id_result.stdout().to_int()
824 if id != 65534
825 warning('\n' +
d5b3e510 826 '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) +
2484bff3
CQ
827 'Your build will result in an group table setup that is incompatible with the local system.')
828 endif
afde4574
LP
829 endif
830endif
8374cc62 831if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
8ea9fad7
YW
832 warning('\n' +
833 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
834 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
8374cc62 835endif
afde4574
LP
836
837conf.set_quoted('NOBODY_USER_NAME', nobody_user)
838conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
87d5e4f2 839
9a797ddc
ZJS
840static_ugids = []
841foreach option : ['adm-gid',
842 'audio-gid',
843 'cdrom-gid',
844 'dialout-gid',
845 'disk-gid',
846 'input-gid',
847 'kmem-gid',
848 'kvm-gid',
849 'lp-gid',
850 'render-gid',
851 'sgx-gid',
852 'tape-gid',
853 'tty-gid',
854 'users-gid',
855 'utmp-gid',
856 'video-gid',
857 'wheel-gid',
858 'systemd-journal-gid',
859 'systemd-network-uid',
860 'systemd-resolve-uid',
861 'systemd-timesync-uid']
862 name = option.underscorify().to_upper()
863 val = get_option(option)
864
865 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
866 conf.set(name, val >= 0 ? val : '-')
867 if val >= 0
868 static_ugids += '@0@:@1@'.format(option, val)
869 endif
870endforeach
84786b8e 871
348b4437
YW
872conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
873conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
5c23128d 874
ace5e311 875dev_kvm_mode = get_option('dev-kvm-mode')
d924a938 876conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation
ace5e311 877conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
055a083a 878group_render_mode = get_option('group-render-mode')
8feaea5e 879conf.set_quoted('GROUP_RENDER_MODE', group_render_mode)
055a083a 880conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
5c23128d 881
2a4c156d
ZJS
882kill_user_processes = get_option('default-kill-user-processes')
883conf.set10('KILL_USER_PROCESSES', kill_user_processes)
5c23128d 884
829257d1
ZJS
885dns_servers = get_option('dns-servers')
886conf.set_quoted('DNS_SERVERS', dns_servers)
5c23128d 887
829257d1
ZJS
888ntp_servers = get_option('ntp-servers')
889conf.set_quoted('NTP_SERVERS', ntp_servers)
5c23128d 890
8ca9e92c 891default_locale = get_option('default-locale')
03475e22 892if default_locale == ''
50f2fc77
JH
893 if not meson.is_cross_build()
894 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
895 default_locale = run_command(choose_default_locale_sh).stdout().strip()
896 else
897 default_locale = 'C.UTF-8'
898 endif
03475e22 899endif
8ca9e92c
DR
900conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
901
8f20232f 902localegen_path = get_option('localegen-path')
8f20232f
MK
903if localegen_path != ''
904 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
8f20232f 905endif
71ae5ce5 906conf.set10('HAVE_LOCALEGEN', localegen_path != '')
8f20232f 907
5c23128d
ZJS
908conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
909
21d0dd5a 910service_watchdog = get_option('service-watchdog')
7bc9ea51 911watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
059cc610 912conf.set_quoted('SERVICE_WATCHDOG', watchdog_value)
21d0dd5a 913
059cc610 914conf.set_quoted('SUSHELL', get_option('debug-shell'))
93912e87 915conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
3131bfe3 916
349cc4a5
ZJS
917enable_debug_hashmap = false
918enable_debug_mmap_cache = false
d6601495 919enable_debug_siphash = false
8f6b442a 920foreach name : get_option('debug-extra')
ad7aa760
YW
921 if name == 'hashmap'
922 enable_debug_hashmap = true
923 elif name == 'mmap-cache'
924 enable_debug_mmap_cache = true
d6601495
YW
925 elif name == 'siphash'
926 enable_debug_siphash = true
ad7aa760
YW
927 else
928 message('unknown debug option "@0@", ignoring'.format(name))
929 endif
930endforeach
349cc4a5
ZJS
931conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
932conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
d6601495 933conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
671677da 934
d18cb393 935conf.set10('VALGRIND', get_option('valgrind'))
fd5dec9a 936conf.set10('LOG_TRACE', get_option('log-trace'))
d18cb393 937
3602ca6f
ZJS
938default_user_path = get_option('user-path')
939if default_user_path != ''
940 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
941endif
942
5bc655cd 943
5c23128d
ZJS
944#####################################################################
945
946threads = dependency('threads')
947librt = cc.find_library('rt')
948libm = cc.find_library('m')
949libdl = cc.find_library('dl')
950libcrypt = cc.find_library('crypt')
951
06ca077b 952crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
e8644a41 953foreach ident : [
feee7f62
LB
954 ['crypt_ra', crypt_header],
955 ['crypt_preferred_method', crypt_header],
956 ['crypt_gensalt_ra', crypt_header]]
e8644a41
ZJS
957
958 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
959 dependencies : libcrypt)
960 conf.set10('HAVE_' + ident[0].to_upper(), have)
961endforeach
962
1800cc85
ZJS
963libcap = dependency('libcap', required : false)
964if not libcap.found()
965 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
966 libcap = cc.find_library('cap')
967endif
968
7d861e12
JK
969want_bpf_framework = get_option('bpf-framework')
970bpf_framework_required = want_bpf_framework == 'true'
971
972libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2')
973conf.set10('HAVE_LIBBPF', libbpf.found())
974
975if want_bpf_framework == 'false'
976 conf.set10('BPF_FRAMEWORK', 0)
977else
978 clang = find_program('clang', required : bpf_framework_required)
979 llvm_strip = find_program('llvm-strip', required : bpf_framework_required)
68e101da
ZJS
980
981 # Debian installs this in /usr/sbin/ which is not in $PATH.
982 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
936cfad7 983 bpftool = find_program('bpftool', '/usr/sbin/bpftool', required : bpf_framework_required)
68e101da 984
7d861e12
JK
985 bpf_arches = ['x86_64']
986 deps_found = libbpf.found() and clang.found() and llvm_strip.found() and bpftool.found()
987 # Can build BPF program from source code in restricted C
988 conf.set10('BPF_FRAMEWORK',
989 bpf_arches.contains(host_machine.cpu_family()) and deps_found)
990endif
991
5c23128d 992libmount = dependency('mount',
c0b4b0f8 993 version : fuzzer_build ? '>= 0' : '>= 2.30')
5c23128d 994
e594a3b1
LP
995want_libfdisk = get_option('fdisk')
996if want_libfdisk != 'false' and not skip_deps
997 libfdisk = dependency('fdisk',
e71f5585 998 version : '>= 2.33',
e594a3b1
LP
999 required : want_libfdisk == 'true')
1000 have = libfdisk.found()
1001else
1002 have = false
1003 libfdisk = []
1004endif
1005conf.set10('HAVE_LIBFDISK', have)
1006
70a5db58
LP
1007want_pwquality = get_option('pwquality')
1008if want_pwquality != 'false' and not skip_deps
1009 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1010 have = libpwquality.found()
1011else
1012 have = false
1013 libpwquality = []
1014endif
1015conf.set10('HAVE_PWQUALITY', have)
1016
5c23128d 1017want_seccomp = get_option('seccomp')
87ac55a1 1018if want_seccomp != 'false' and not skip_deps
37efbbd8 1019 libseccomp = dependency('libseccomp',
9f0e9c01 1020 version : '>= 2.3.1',
37efbbd8 1021 required : want_seccomp == 'true')
349cc4a5 1022 have = libseccomp.found()
5c23128d 1023else
349cc4a5 1024 have = false
37efbbd8 1025 libseccomp = []
5c23128d 1026endif
349cc4a5 1027conf.set10('HAVE_SECCOMP', have)
5c23128d
ZJS
1028
1029want_selinux = get_option('selinux')
87ac55a1 1030if want_selinux != 'false' and not skip_deps
37efbbd8
ZJS
1031 libselinux = dependency('libselinux',
1032 version : '>= 2.1.9',
1033 required : want_selinux == 'true')
349cc4a5 1034 have = libselinux.found()
5c23128d 1035else
349cc4a5 1036 have = false
37efbbd8 1037 libselinux = []
5c23128d 1038endif
349cc4a5 1039conf.set10('HAVE_SELINUX', have)
5c23128d
ZJS
1040
1041want_apparmor = get_option('apparmor')
87ac55a1 1042if want_apparmor != 'false' and not skip_deps
37efbbd8 1043 libapparmor = dependency('libapparmor',
2ffadd3c 1044 version : '>= 2.13',
37efbbd8 1045 required : want_apparmor == 'true')
349cc4a5 1046 have = libapparmor.found()
5c23128d 1047else
349cc4a5 1048 have = false
37efbbd8 1049 libapparmor = []
5c23128d 1050endif
349cc4a5 1051conf.set10('HAVE_APPARMOR', have)
5c23128d 1052
07b382cc
ZJS
1053have = get_option('smack') and get_option('smack-run-label') != ''
1054conf.set10('HAVE_SMACK_RUN_LABEL', have)
1055if have
1056 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1057endif
5c23128d 1058
3ca0cb73
ZJS
1059want_polkit = get_option('polkit')
1060install_polkit = false
1061install_polkit_pkla = false
87ac55a1 1062if want_polkit != 'false' and not skip_deps
37efbbd8 1063 install_polkit = true
3ca0cb73 1064
37efbbd8
ZJS
1065 libpolkit = dependency('polkit-gobject-1',
1066 required : false)
1067 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1068 message('Old polkit detected, will install pkla files')
1069 install_polkit_pkla = true
1070 endif
3ca0cb73 1071endif
349cc4a5 1072conf.set10('ENABLE_POLKIT', install_polkit)
3ca0cb73 1073
36f0387e 1074want_acl = get_option('acl')
87ac55a1 1075if want_acl != 'false' and not skip_deps
36f0387e 1076 libacl = cc.find_library('acl', required : want_acl == 'true')
349cc4a5 1077 have = libacl.found()
36f0387e 1078else
349cc4a5 1079 have = false
36f0387e
ZJS
1080 libacl = []
1081endif
349cc4a5 1082conf.set10('HAVE_ACL', have)
36f0387e 1083
5c23128d 1084want_audit = get_option('audit')
87ac55a1 1085if want_audit != 'false' and not skip_deps
37efbbd8 1086 libaudit = dependency('audit', required : want_audit == 'true')
349cc4a5 1087 have = libaudit.found()
5c23128d 1088else
349cc4a5 1089 have = false
37efbbd8 1090 libaudit = []
5c23128d 1091endif
349cc4a5 1092conf.set10('HAVE_AUDIT', have)
5c23128d
ZJS
1093
1094want_blkid = get_option('blkid')
87ac55a1 1095if want_blkid != 'false' and not skip_deps
37efbbd8 1096 libblkid = dependency('blkid', required : want_blkid == 'true')
349cc4a5 1097 have = libblkid.found()
4fcc033b
KZ
1098
1099 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1100 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
5c23128d 1101else
349cc4a5 1102 have = false
37efbbd8 1103 libblkid = []
5c23128d 1104endif
349cc4a5 1105conf.set10('HAVE_BLKID', have)
5c23128d
ZJS
1106
1107want_kmod = get_option('kmod')
87ac55a1 1108if want_kmod != 'false' and not skip_deps
37efbbd8
ZJS
1109 libkmod = dependency('libkmod',
1110 version : '>= 15',
1111 required : want_kmod == 'true')
349cc4a5 1112 have = libkmod.found()
5c23128d 1113else
349cc4a5 1114 have = false
37efbbd8 1115 libkmod = []
5c23128d 1116endif
349cc4a5 1117conf.set10('HAVE_KMOD', have)
5c23128d
ZJS
1118
1119want_pam = get_option('pam')
87ac55a1 1120if want_pam != 'false' and not skip_deps
37efbbd8
ZJS
1121 libpam = cc.find_library('pam', required : want_pam == 'true')
1122 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
349cc4a5 1123 have = libpam.found() and libpam_misc.found()
5c23128d 1124else
349cc4a5 1125 have = false
37efbbd8
ZJS
1126 libpam = []
1127 libpam_misc = []
5c23128d 1128endif
349cc4a5 1129conf.set10('HAVE_PAM', have)
5c23128d
ZJS
1130
1131want_microhttpd = get_option('microhttpd')
87ac55a1 1132if want_microhttpd != 'false' and not skip_deps
37efbbd8
ZJS
1133 libmicrohttpd = dependency('libmicrohttpd',
1134 version : '>= 0.9.33',
1135 required : want_microhttpd == 'true')
349cc4a5 1136 have = libmicrohttpd.found()
5c23128d 1137else
349cc4a5 1138 have = false
37efbbd8 1139 libmicrohttpd = []
5c23128d 1140endif
349cc4a5 1141conf.set10('HAVE_MICROHTTPD', have)
5c23128d
ZJS
1142
1143want_libcryptsetup = get_option('libcryptsetup')
d1ae38d8
OK
1144want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1145
1146if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1147 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1148endif
1149
87ac55a1 1150if want_libcryptsetup != 'false' and not skip_deps
37efbbd8 1151 libcryptsetup = dependency('libcryptsetup',
d1ae38d8
OK
1152 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1153 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
349cc4a5 1154 have = libcryptsetup.found()
70a5db58
LP
1155
1156 conf.set10('HAVE_CRYPT_SET_METADATA_SIZE',
1157 have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup))
c2923fdc
LB
1158 conf.set10('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY',
1159 have and cc.has_function('crypt_activate_by_signed_key', dependencies : libcryptsetup))
3c2c8e62
LB
1160 conf.set10('HAVE_CRYPT_TOKEN_MAX',
1161 have and cc.has_function('crypt_token_max', dependencies : libcryptsetup))
5c23128d 1162else
349cc4a5 1163 have = false
37efbbd8 1164 libcryptsetup = []
5c23128d 1165endif
349cc4a5 1166conf.set10('HAVE_LIBCRYPTSETUP', have)
5c23128d 1167
d1ae38d8
OK
1168if want_libcryptsetup_plugins != 'false' and not skip_deps
1169 have = (cc.has_function('crypt_activate_by_token_pin', dependencies : libcryptsetup) and
1170 cc.has_function('crypt_token_external_path', dependencies : libcryptsetup))
1171else
1172 have = false
1173endif
1174conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1175
5c23128d 1176want_libcurl = get_option('libcurl')
87ac55a1 1177if want_libcurl != 'false' and not skip_deps
37efbbd8
ZJS
1178 libcurl = dependency('libcurl',
1179 version : '>= 7.32.0',
1180 required : want_libcurl == 'true')
349cc4a5 1181 have = libcurl.found()
5c23128d 1182else
349cc4a5 1183 have = false
37efbbd8 1184 libcurl = []
5c23128d 1185endif
349cc4a5 1186conf.set10('HAVE_LIBCURL', have)
47350c5f 1187conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
5c23128d
ZJS
1188
1189want_libidn = get_option('libidn')
87057e24
ZJS
1190want_libidn2 = get_option('libidn2')
1191if want_libidn == 'true' and want_libidn2 == 'true'
1192 error('libidn and libidn2 cannot be requested simultaneously')
1193endif
1194
1b931399
YW
1195if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1196 libidn = dependency('libidn2',
1197 required : want_libidn2 == 'true')
349cc4a5 1198 have = libidn.found()
87057e24 1199else
349cc4a5 1200 have = false
87057e24
ZJS
1201 libidn = []
1202endif
1b931399
YW
1203conf.set10('HAVE_LIBIDN2', have)
1204if not have and want_libidn != 'false' and not skip_deps
7f7ab228 1205 # libidn is used for both libidn and libidn2 objects
1b931399
YW
1206 libidn = dependency('libidn',
1207 required : want_libidn == 'true')
349cc4a5
ZJS
1208 have = libidn.found()
1209else
1210 have = false
5c23128d 1211endif
1b931399 1212conf.set10('HAVE_LIBIDN', have)
5c23128d
ZJS
1213
1214want_libiptc = get_option('libiptc')
87ac55a1 1215if want_libiptc != 'false' and not skip_deps
37efbbd8
ZJS
1216 libiptc = dependency('libiptc',
1217 required : want_libiptc == 'true')
349cc4a5 1218 have = libiptc.found()
5c23128d 1219else
349cc4a5 1220 have = false
37efbbd8 1221 libiptc = []
5c23128d 1222endif
349cc4a5 1223conf.set10('HAVE_LIBIPTC', have)
5c23128d
ZJS
1224
1225want_qrencode = get_option('qrencode')
87ac55a1 1226if want_qrencode != 'false' and not skip_deps
37efbbd8 1227 libqrencode = dependency('libqrencode',
a6c7811f 1228 version : '>= 4',
37efbbd8 1229 required : want_qrencode == 'true')
349cc4a5 1230 have = libqrencode.found()
5c23128d 1231else
349cc4a5 1232 have = false
37efbbd8 1233 libqrencode = []
5c23128d 1234endif
349cc4a5 1235conf.set10('HAVE_QRENCODE', have)
5c23128d 1236
a44fb601 1237want_gcrypt = get_option('gcrypt')
87ac55a1 1238if want_gcrypt != 'false' and not skip_deps
a44fb601
ZJS
1239 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1240 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
349cc4a5 1241 have = libgcrypt.found() and libgpg_error.found()
a44fb601 1242else
349cc4a5
ZJS
1243 have = false
1244endif
1245if not have
1246 # link to neither of the libs if one is not found
a44fb601
ZJS
1247 libgcrypt = []
1248 libgpg_error = []
1249endif
349cc4a5 1250conf.set10('HAVE_GCRYPT', have)
a44fb601 1251
5c23128d 1252want_gnutls = get_option('gnutls')
87ac55a1 1253if want_gnutls != 'false' and not skip_deps
37efbbd8
ZJS
1254 libgnutls = dependency('gnutls',
1255 version : '>= 3.1.4',
1256 required : want_gnutls == 'true')
349cc4a5 1257 have = libgnutls.found()
5c23128d 1258else
349cc4a5 1259 have = false
37efbbd8 1260 libgnutls = []
5c23128d 1261endif
349cc4a5 1262conf.set10('HAVE_GNUTLS', have)
5c23128d 1263
096cbdce 1264want_openssl = get_option('openssl')
87ac55a1 1265if want_openssl != 'false' and not skip_deps
096cbdce
IT
1266 libopenssl = dependency('openssl',
1267 version : '>= 1.1.0',
1268 required : want_openssl == 'true')
1269 have = libopenssl.found()
1270else
1271 have = false
1272 libopenssl = []
1273endif
1274conf.set10('HAVE_OPENSSL', have)
1275
839fddbe
LP
1276want_p11kit = get_option('p11kit')
1277if want_p11kit != 'false' and not skip_deps
1278 libp11kit = dependency('p11-kit-1',
6164ec4c
ZJS
1279 version : '>= 0.23.3',
1280 required : want_p11kit == 'true')
839fddbe
LP
1281 have = libp11kit.found()
1282else
1283 have = false
1284 libp11kit = []
1285endif
1286conf.set10('HAVE_P11KIT', have)
1287
af4fbd46
LP
1288want_libfido2 = get_option('libfido2')
1289if want_libfido2 != 'false' and not skip_deps
1290 libfido2 = dependency('libfido2',
1291 required : want_libfido2 == 'true')
1292 have = libfido2.found()
1293else
1294 have = false
1295 libfido2 = []
1296endif
1297conf.set10('HAVE_LIBFIDO2', have)
1298
5e521624
LP
1299want_tpm2 = get_option('tpm2')
1300if want_tpm2 != 'false' and not skip_deps
1301 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
ba081955 1302 required : want_tpm2 == 'true')
5e521624
LP
1303 have = tpm2.found()
1304else
1305 have = false
1306 tpm2 = []
1307endif
1308conf.set10('HAVE_TPM2', have)
1309
5c23128d 1310want_elfutils = get_option('elfutils')
87ac55a1 1311if want_elfutils != 'false' and not skip_deps
37efbbd8
ZJS
1312 libdw = dependency('libdw',
1313 required : want_elfutils == 'true')
349cc4a5 1314 have = libdw.found()
5c23128d 1315else
349cc4a5 1316 have = false
37efbbd8 1317 libdw = []
5c23128d 1318endif
349cc4a5 1319conf.set10('HAVE_ELFUTILS', have)
5c23128d
ZJS
1320
1321want_zlib = get_option('zlib')
87ac55a1 1322if want_zlib != 'false' and not skip_deps
37efbbd8
ZJS
1323 libz = dependency('zlib',
1324 required : want_zlib == 'true')
349cc4a5 1325 have = libz.found()
5c23128d 1326else
349cc4a5 1327 have = false
37efbbd8 1328 libz = []
5c23128d 1329endif
349cc4a5 1330conf.set10('HAVE_ZLIB', have)
5c23128d
ZJS
1331
1332want_bzip2 = get_option('bzip2')
87ac55a1 1333if want_bzip2 != 'false' and not skip_deps
37efbbd8
ZJS
1334 libbzip2 = cc.find_library('bz2',
1335 required : want_bzip2 == 'true')
349cc4a5 1336 have = libbzip2.found()
5c23128d 1337else
349cc4a5 1338 have = false
37efbbd8 1339 libbzip2 = []
5c23128d 1340endif
349cc4a5 1341conf.set10('HAVE_BZIP2', have)
5c23128d
ZJS
1342
1343want_xz = get_option('xz')
87ac55a1 1344if want_xz != 'false' and not skip_deps
37efbbd8
ZJS
1345 libxz = dependency('liblzma',
1346 required : want_xz == 'true')
d80b051c 1347 have_xz = libxz.found()
5c23128d 1348else
d80b051c 1349 have_xz = false
37efbbd8 1350 libxz = []
5c23128d 1351endif
d80b051c 1352conf.set10('HAVE_XZ', have_xz)
5c23128d
ZJS
1353
1354want_lz4 = get_option('lz4')
87ac55a1 1355if want_lz4 != 'false' and not skip_deps
37efbbd8 1356 liblz4 = dependency('liblz4',
e0a1d4b0 1357 version : '>= 1.3.0',
37efbbd8 1358 required : want_lz4 == 'true')
d80b051c 1359 have_lz4 = liblz4.found()
5c23128d 1360else
d80b051c 1361 have_lz4 = false
37efbbd8 1362 liblz4 = []
5c23128d 1363endif
d80b051c 1364conf.set10('HAVE_LZ4', have_lz4)
5c23128d 1365
ef5924aa
NL
1366want_zstd = get_option('zstd')
1367if want_zstd != 'false' and not skip_deps
1368 libzstd = dependency('libzstd',
1369 required : want_zstd == 'true',
1370 version : '>= 1.4.0')
d80b051c 1371 have_zstd = libzstd.found()
ef5924aa 1372else
d80b051c 1373 have_zstd = false
ef5924aa
NL
1374 libzstd = []
1375endif
d80b051c
LP
1376conf.set10('HAVE_ZSTD', have_zstd)
1377
1378conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
ef5924aa 1379
a44fb601 1380want_xkbcommon = get_option('xkbcommon')
87ac55a1 1381if want_xkbcommon != 'false' and not skip_deps
a44fb601
ZJS
1382 libxkbcommon = dependency('xkbcommon',
1383 version : '>= 0.3.0',
1384 required : want_xkbcommon == 'true')
349cc4a5 1385 have = libxkbcommon.found()
a44fb601 1386else
349cc4a5 1387 have = false
a44fb601
ZJS
1388 libxkbcommon = []
1389endif
349cc4a5 1390conf.set10('HAVE_XKBCOMMON', have)
a44fb601 1391
c4c978a0
ZJS
1392want_pcre2 = get_option('pcre2')
1393if want_pcre2 != 'false'
1394 libpcre2 = dependency('libpcre2-8',
1395 required : want_pcre2 == 'true')
1396 have = libpcre2.found()
1397else
1398 have = false
1399 libpcre2 = []
1400endif
1401conf.set10('HAVE_PCRE2', have)
1402
69e96427 1403want_glib = get_option('glib')
87ac55a1 1404if want_glib != 'false' and not skip_deps
37efbbd8
ZJS
1405 libglib = dependency('glib-2.0',
1406 version : '>= 2.22.0',
1407 required : want_glib == 'true')
1408 libgobject = dependency('gobject-2.0',
1409 version : '>= 2.22.0',
1410 required : want_glib == 'true')
1411 libgio = dependency('gio-2.0',
1412 required : want_glib == 'true')
2c201c21 1413 have = libglib.found() and libgobject.found() and libgio.found()
69e96427 1414else
349cc4a5 1415 have = false
37efbbd8
ZJS
1416 libglib = []
1417 libgobject = []
1418 libgio = []
69e96427 1419endif
349cc4a5 1420conf.set10('HAVE_GLIB', have)
69e96427
ZJS
1421
1422want_dbus = get_option('dbus')
87ac55a1 1423if want_dbus != 'false' and not skip_deps
37efbbd8
ZJS
1424 libdbus = dependency('dbus-1',
1425 version : '>= 1.3.2',
1426 required : want_dbus == 'true')
349cc4a5 1427 have = libdbus.found()
69e96427 1428else
349cc4a5 1429 have = false
37efbbd8 1430 libdbus = []
69e96427 1431endif
349cc4a5 1432conf.set10('HAVE_DBUS', have)
69e96427 1433
42303dcb 1434default_dnssec = get_option('default-dnssec')
87ac55a1 1435if skip_deps
b4081f3e
JR
1436 default_dnssec = 'no'
1437endif
349cc4a5 1438if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
42303dcb
YW
1439 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1440 default_dnssec = 'no'
1441endif
1442conf.set('DEFAULT_DNSSEC_MODE',
1443 'DNSSEC_' + default_dnssec.underscorify().to_upper())
411d1f4c 1444conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
42303dcb 1445
56ddbf10
YW
1446dns_over_tls = get_option('dns-over-tls')
1447if dns_over_tls != 'false'
096cbdce
IT
1448 if dns_over_tls == 'openssl'
1449 have_gnutls = false
1450 else
38e053c5 1451 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
096cbdce
IT
1452 if dns_over_tls == 'gnutls' and not have_gnutls
1453 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1454 endif
56ddbf10 1455 endif
096cbdce
IT
1456 if dns_over_tls == 'gnutls' or have_gnutls
1457 have_openssl = false
1458 else
1459 have_openssl = conf.get('HAVE_OPENSSL') == 1
1460 if dns_over_tls != 'auto' and not have_openssl
1461 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
b349bc59 1462 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
096cbdce
IT
1463 endif
1464 endif
1465 have = have_gnutls or have_openssl
56ddbf10 1466else
be5536a6
MO
1467 have = false
1468 have_gnutls = false
1469 have_openssl = false
56ddbf10
YW
1470endif
1471conf.set10('ENABLE_DNS_OVER_TLS', have)
096cbdce
IT
1472conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1473conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
56ddbf10 1474
c9299be2 1475default_dns_over_tls = get_option('default-dns-over-tls')
87ac55a1 1476if skip_deps
c9299be2 1477 default_dns_over_tls = 'no'
5d67a7ae 1478endif
56ddbf10 1479if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
4310bfc2 1480 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.')
c9299be2 1481 default_dns_over_tls = 'no'
5d67a7ae 1482endif
c9299be2
IT
1483conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1484 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
411d1f4c 1485conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
5d67a7ae 1486
3614df05
ZJS
1487default_mdns = get_option('default-mdns')
1488conf.set('DEFAULT_MDNS_MODE',
1489 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
411d1f4c 1490conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
3614df05
ZJS
1491
1492default_llmnr = get_option('default-llmnr')
1493conf.set('DEFAULT_LLMNR_MODE',
1494 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
411d1f4c 1495conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
3614df05 1496
e594a3b1
LP
1497want_repart = get_option('repart')
1498if want_repart != 'false'
1499 have = (conf.get('HAVE_OPENSSL') == 1 and
1500 conf.get('HAVE_LIBFDISK') == 1)
1501 if want_repart == 'true' and not have
1502 error('repart support was requested, but dependencies are not available')
1503 endif
1504else
1505 have = false
1506endif
1507conf.set10('ENABLE_REPART', have)
1508
5c23128d 1509want_importd = get_option('importd')
4390be30 1510if want_importd != 'false'
349cc4a5
ZJS
1511 have = (conf.get('HAVE_LIBCURL') == 1 and
1512 conf.get('HAVE_ZLIB') == 1 and
349cc4a5
ZJS
1513 conf.get('HAVE_XZ') == 1 and
1514 conf.get('HAVE_GCRYPT') == 1)
1515 if want_importd == 'true' and not have
37efbbd8
ZJS
1516 error('importd support was requested, but dependencies are not available')
1517 endif
349cc4a5
ZJS
1518else
1519 have = false
5c23128d 1520endif
349cc4a5 1521conf.set10('ENABLE_IMPORTD', have)
5c23128d 1522
70a5db58
LP
1523want_homed = get_option('homed')
1524if want_homed != 'false'
1525 have = (conf.get('HAVE_OPENSSL') == 1 and
1526 conf.get('HAVE_LIBFDISK') == 1 and
1527 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1528 if want_homed == 'true' and not have
1529 error('homed support was requested, but dependencies are not available')
1530 endif
1531else
1532 have = false
1533endif
1534conf.set10('ENABLE_HOMED', have)
1535
af06ddf5
YW
1536have = have and conf.get('HAVE_PAM') == 1
1537conf.set10('ENABLE_PAM_HOME', have)
1538
d58c5f0f 1539have = get_option('oomd')
c199dd3f
AZ
1540conf.set10('ENABLE_OOMD', have)
1541
5c23128d 1542want_remote = get_option('remote')
4390be30 1543if want_remote != 'false'
349cc4a5
ZJS
1544 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1545 conf.get('HAVE_LIBCURL') == 1]
37efbbd8
ZJS
1546 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1547 # it's possible to build one without the other. Complain only if
5238e957 1548 # support was explicitly requested. The auxiliary files like sysusers
37efbbd8
ZJS
1549 # config should be installed when any of the programs are built.
1550 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1551 error('remote support was requested, but dependencies are not available')
1552 endif
349cc4a5
ZJS
1553 have = have_deps[0] or have_deps[1]
1554else
1555 have = false
5c23128d 1556endif
349cc4a5 1557conf.set10('ENABLE_REMOTE', have)
5c23128d 1558
b3259a6e
ZJS
1559foreach term : ['analyze',
1560 'backlight',
a9149d87
ZJS
1561 'binfmt',
1562 'coredump',
b3259a6e
ZJS
1563 'efi',
1564 'environment-d',
1565 'firstboot',
1566 'gshadow',
1567 'hibernate',
a9149d87 1568 'hostnamed',
b3259a6e
ZJS
1569 'hwdb',
1570 'idn',
1571 'ima',
1572 'initrd',
53393c89 1573 'compat-mutable-uid-boundaries',
7e0079f9 1574 'nscd',
b3259a6e 1575 'ldconfig',
a9149d87 1576 'localed',
b3259a6e 1577 'logind',
a9149d87
ZJS
1578 'machined',
1579 'networkd',
b3259a6e
ZJS
1580 'nss-myhostname',
1581 'nss-systemd',
1582 'portabled',
9bca4ae4 1583 'sysext',
b3259a6e 1584 'pstore',
a9149d87 1585 'quotacheck',
b3259a6e
ZJS
1586 'randomseed',
1587 'resolve',
1588 'rfkill',
1589 'smack',
a9149d87 1590 'sysusers',
b3259a6e
ZJS
1591 'timedated',
1592 'timesyncd',
a9149d87 1593 'tmpfiles',
a9149d87 1594 'tpm',
b3259a6e
ZJS
1595 'userdb',
1596 'utmp',
1597 'vconsole',
1598 'xdg-autostart']
a9149d87
ZJS
1599 have = get_option(term)
1600 name = 'ENABLE_' + term.underscorify().to_upper()
1601 conf.set10(name, have)
5c23128d
ZJS
1602endforeach
1603
bd7e6aa7
ZJS
1604enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1605
08540a95
YW
1606foreach tuple : [['nss-mymachines', 'machined'],
1607 ['nss-resolve', 'resolve']]
1608 want = get_option(tuple[0])
1609 if want != 'false'
1610 have = get_option(tuple[1])
1611 if want == 'true' and not have
1612 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1613 endif
1614 else
1615 have = false
1616 endif
1617 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1618 conf.set10(name, have)
1619endforeach
1620
1621enable_nss = false
1622foreach term : ['ENABLE_NSS_MYHOSTNAME',
1623 'ENABLE_NSS_MYMACHINES',
1624 'ENABLE_NSS_RESOLVE',
1625 'ENABLE_NSS_SYSTEMD']
1626 if conf.get(term) == 1
1627 enable_nss = true
1628 endif
1629endforeach
1630conf.set10('ENABLE_NSS', enable_nss)
1631
348b4437 1632conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
6129ec85 1633
b68dfb9e 1634conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
00d82c81 1635
5c23128d
ZJS
1636#####################################################################
1637
1638if get_option('efi')
37efbbd8 1639 efi_arch = host_machine.cpu_family()
b710072d 1640
6800fe7f 1641 if efi_arch == 'x86'
37efbbd8 1642 EFI_MACHINE_TYPE_NAME = 'ia32'
6800fe7f 1643 gnu_efi_arch = 'ia32'
37efbbd8
ZJS
1644 elif efi_arch == 'x86_64'
1645 EFI_MACHINE_TYPE_NAME = 'x64'
6800fe7f 1646 gnu_efi_arch = 'x86_64'
37efbbd8
ZJS
1647 elif efi_arch == 'arm'
1648 EFI_MACHINE_TYPE_NAME = 'arm'
6800fe7f 1649 gnu_efi_arch = 'arm'
37efbbd8
ZJS
1650 elif efi_arch == 'aarch64'
1651 EFI_MACHINE_TYPE_NAME = 'aa64'
6800fe7f 1652 gnu_efi_arch = 'aarch64'
a00ff2e1
ERB
1653 elif efi_arch == 'riscv64'
1654 EFI_MACHINE_TYPE_NAME = 'riscv64'
1655 gnu_efi_arch = 'riscv64'
37efbbd8
ZJS
1656 else
1657 EFI_MACHINE_TYPE_NAME = ''
6800fe7f 1658 gnu_efi_arch = ''
37efbbd8 1659 endif
5c23128d 1660
349cc4a5 1661 have = true
37efbbd8 1662 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
349cc4a5
ZJS
1663else
1664 have = false
5c23128d 1665endif
349cc4a5 1666conf.set10('ENABLE_EFI', have)
5c23128d 1667
34357545
MS
1668subdir('src/fundamental')
1669subdir('src/boot/efi')
1670conf.set10('HAVE_GNU_EFI', have_gnu_efi)
1671
f6fe732f
YW
1672############################################################
1673
7d861e12 1674build_bpf_skel_py = find_program('tools/build-bpf-skel.py')
d3821a33 1675generate_gperfs = find_program('tools/generate-gperfs.py')
f6fe732f
YW
1676make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1677make_directive_index_py = find_program('tools/make-directive-index.py')
1678make_man_index_py = find_program('tools/make-man-index.py')
6b1aac3c 1679meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
d3821a33
ZJS
1680update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1681update_hwdb_sh = find_program('tools/update-hwdb.sh')
1682update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1683update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1684xml_helper_py = find_program('tools/xml_helper.py')
f6fe732f 1685
5c23128d
ZJS
1686#####################################################################
1687
1688config_h = configure_file(
37efbbd8
ZJS
1689 output : 'config.h',
1690 configuration : conf)
5c23128d 1691
f6fe732f
YW
1692add_project_arguments('-include', 'config.h', language : 'c')
1693
1694############################################################
348b4437 1695
b61016f2
YW
1696# binaries that have --help and are intended for use by humans,
1697# usually, but not always, installed in /bin.
1698public_programs = []
1699
1700tests = []
1701fuzzers = []
1702
8d40961c
YW
1703basic_includes = include_directories(
1704 'src/basic',
e5bc5f1f 1705 'src/fundamental',
8d40961c
YW
1706 'src/systemd',
1707 '.')
1708
1709libsystemd_includes = [basic_includes, include_directories(
1710 'src/libsystemd/sd-bus',
1711 'src/libsystemd/sd-device',
1712 'src/libsystemd/sd-event',
1713 'src/libsystemd/sd-hwdb',
1714 'src/libsystemd/sd-id128',
1715 'src/libsystemd/sd-journal',
1716 'src/libsystemd/sd-netlink',
1717 'src/libsystemd/sd-network',
1718 'src/libsystemd/sd-resolve')]
1719
1720includes = [libsystemd_includes, include_directories('src/shared')]
5c23128d 1721
5c23128d
ZJS
1722subdir('po')
1723subdir('catalog')
5c23128d
ZJS
1724subdir('src/basic')
1725subdir('src/libsystemd')
3976f372
YW
1726subdir('src/shared')
1727subdir('src/udev')
1728subdir('src/libudev')
d1ae38d8 1729subdir('src/cryptsetup/cryptsetup-tokens')
5c23128d 1730
5c23128d 1731libsystemd = shared_library(
37efbbd8 1732 'systemd',
a5d8835c 1733 disable_mempool_c,
56d50ab1 1734 version : libsystemd_version,
8d40961c 1735 include_directories : libsystemd_includes,
37efbbd8
ZJS
1736 link_args : ['-shared',
1737 '-Wl,--version-script=' + libsystemd_sym_path],
34e221a5
ZJS
1738 link_with : [libbasic,
1739 libbasic_gcrypt],
99b9f8fd 1740 link_whole : [libsystemd_static],
37efbbd8
ZJS
1741 dependencies : [threads,
1742 librt,
1743 libxz,
ef5924aa 1744 libzstd,
37efbbd8
ZJS
1745 liblz4],
1746 link_depends : libsystemd_sym,
1747 install : true,
1748 install_dir : rootlibdir)
5c23128d 1749
70848ecf
DC
1750install_libsystemd_static = static_library(
1751 'systemd',
1752 libsystemd_sources,
975464e0
ZJS
1753 basic_sources,
1754 basic_gcrypt_sources,
e5bc5f1f 1755 fundamental_sources,
be44b572 1756 disable_mempool_c,
8d40961c 1757 include_directories : libsystemd_includes,
70848ecf
DC
1758 build_by_default : static_libsystemd != 'false',
1759 install : static_libsystemd != 'false',
1760 install_dir : rootlibdir,
40dbce36 1761 pic : static_libsystemd_pic,
70848ecf
DC
1762 dependencies : [threads,
1763 librt,
1764 libxz,
ef5924aa 1765 libzstd,
70848ecf 1766 liblz4,
c5fd89ad 1767 libdl,
975464e0
ZJS
1768 libcap,
1769 libblkid,
1770 libmount,
011d129c
LP
1771 libgcrypt,
1772 libopenssl],
70848ecf
DC
1773 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1774
3976f372
YW
1775libudev = shared_library(
1776 'udev',
1777 disable_mempool_c,
1778 version : libudev_version,
1779 include_directories : includes,
1780 link_args : ['-shared',
1781 '-Wl,--version-script=' + libudev_sym_path],
1782 link_with : [libsystemd_static, libshared_static],
1783 link_whole : libudev_basic,
1784 dependencies : [threads],
1785 link_depends : libudev_sym,
1786 install : true,
1787 install_dir : rootlibdir)
1788
1789install_libudev_static = static_library(
1790 'udev',
1791 basic_sources,
e5bc5f1f 1792 fundamental_sources,
3976f372
YW
1793 shared_sources,
1794 libsystemd_sources,
1795 libudev_sources,
1796 disable_mempool_c,
1797 include_directories : includes,
1798 build_by_default : static_libudev != 'false',
1799 install : static_libudev != 'false',
1800 install_dir : rootlibdir,
1801 link_depends : libudev_sym,
1802 dependencies : libshared_deps + [libmount],
1803 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
1804 pic : static_libudev_pic)
1805
d1ae38d8
OK
1806if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
1807 if conf.get('HAVE_TPM2') == 1
1808 cryptsetup_token_systemd_tpm2 = shared_library(
1809 'cryptsetup-token-systemd-tpm2',
1810 link_args : ['-shared',
1811 '-Wl,--version-script=' + cryptsetup_token_sym_path],
99c645b8 1812 dependencies : libshared_deps + [libcryptsetup, versiondep],
d1ae38d8
OK
1813 link_with : [libshared],
1814 link_whole : [cryptsetup_token_systemd_tpm2_static],
1815 link_depends : cryptsetup_token_sym,
1816 install_rpath : rootlibexecdir,
1817 install : true,
1818 install_dir : libcryptsetup_plugins_dir)
1819 endif
351716e1
OK
1820
1821 if conf.get('HAVE_LIBFIDO2') == 1
1822 cryptsetup_token_systemd_fido2 = shared_library(
1823 'cryptsetup-token-systemd-fido2',
1824 link_args : ['-shared',
1825 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1826 dependencies : libshared_deps + [libcryptsetup, versiondep],
1827 link_with : [libshared],
1828 link_whole : [cryptsetup_token_systemd_fido2_static],
1829 link_depends : cryptsetup_token_sym,
1830 install_rpath : rootlibexecdir,
1831 install : true,
1832 install_dir : libcryptsetup_plugins_dir)
1833 endif
8186022c
OK
1834
1835 if conf.get('HAVE_P11KIT') == 1
1836 cryptsetup_token_systemd_pkcs11 = shared_library(
1837 'cryptsetup-token-systemd-pkcs11',
1838 link_args : ['-shared',
1839 '-Wl,--version-script=' + cryptsetup_token_sym_path],
1840 dependencies : libshared_deps + [libcryptsetup, versiondep],
1841 link_with : [libshared],
1842 link_whole : [cryptsetup_token_systemd_pkcs11_static],
1843 link_depends : cryptsetup_token_sym,
1844 install_rpath : rootlibexecdir,
1845 install : true,
1846 install_dir : libcryptsetup_plugins_dir)
1847 endif
d1ae38d8
OK
1848endif
1849
47354b44
ZJS
1850############################################################
1851
b61016f2 1852# systemd-analyze requires 'libcore'
83b6af36 1853subdir('src/core')
b61016f2
YW
1854# systemd-journal-remote requires 'libjournal_core'
1855subdir('src/journal')
1856# systemd-networkd requires 'libsystemd_network'
1857subdir('src/libsystemd-network')
83b6af36
ZJS
1858
1859subdir('src/analyze')
f98df767 1860subdir('src/busctl')
b61016f2 1861subdir('src/coredump')
2ad279cf 1862subdir('src/cryptenroll')
b4d1892a 1863subdir('src/cryptsetup')
b61016f2 1864subdir('src/home')
83b6af36
ZJS
1865subdir('src/hostname')
1866subdir('src/import')
b61016f2 1867subdir('src/journal-remote')
83b6af36
ZJS
1868subdir('src/kernel-install')
1869subdir('src/locale')
b61016f2 1870subdir('src/login')
83b6af36 1871subdir('src/machine')
b61016f2 1872subdir('src/network')
83b6af36 1873subdir('src/nspawn')
b61016f2
YW
1874subdir('src/oom')
1875subdir('src/partition')
1876subdir('src/portable')
1877subdir('src/pstore')
83b6af36 1878subdir('src/resolve')
2a9b4bbe 1879subdir('src/rpm')
b61016f2 1880subdir('src/shutdown')
9bca4ae4 1881subdir('src/sysext')
c3512573 1882subdir('src/systemctl')
83b6af36
ZJS
1883subdir('src/timedate')
1884subdir('src/timesync')
db64ba81 1885subdir('src/tmpfiles')
b61016f2 1886subdir('src/userdb')
83b6af36 1887subdir('src/vconsole')
0275e918 1888subdir('src/xdg-autostart-generator')
83b6af36 1889
3976f372
YW
1890subdir('src/systemd')
1891
83b6af36 1892subdir('src/test')
7db7d5b7 1893subdir('src/fuzz')
ef2ad30a 1894subdir('rules.d')
83b6af36
ZJS
1895subdir('test')
1896
1897############################################################
1898
1899# only static linking apart from libdl, to make sure that the
1900# module is linked to all libraries that it uses.
1901test_dlopen = executable(
37efbbd8
ZJS
1902 'test-dlopen',
1903 test_dlopen_c,
a5d8835c 1904 disable_mempool_c,
37efbbd8
ZJS
1905 include_directories : includes,
1906 link_with : [libbasic],
fd1939fb
YW
1907 dependencies : [libdl],
1908 build_by_default : want_tests != 'false')
83b6af36 1909
08540a95 1910foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
cbaaf7b9 1911 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
08540a95 1912 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
8d40961c 1913 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
5c23128d 1914
349cc4a5 1915 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
37efbbd8
ZJS
1916 if condition
1917 module = tuple[0]
37efbbd8
ZJS
1918
1919 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
fce9abb2 1920 version_script_arg = project_source_root / sym
37efbbd8 1921
1684c56f
LP
1922 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
1923 if tuple.length() > 2
cbaaf7b9
YW
1924 foreach s : tuple[2]
1925 sources += ['src/nss-@0@/@1@'.format(module, s)]
1926 endforeach
1684c56f
LP
1927 endif
1928
8d40961c
YW
1929 incs = tuple.length() > 3 ? tuple[3] : includes
1930
37efbbd8
ZJS
1931 nss = shared_library(
1932 'nss_' + module,
1684c56f 1933 sources,
a5d8835c 1934 disable_mempool_c,
37efbbd8 1935 version : '2',
8d40961c 1936 include_directories : incs,
b4b36f44
LP
1937 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1938 link_args : ['-Wl,-z,nodelete',
1939 '-shared',
700805f6 1940 '-Wl,--version-script=' + version_script_arg],
37e4d7a8 1941 link_with : [libsystemd_static,
733cbd00 1942 libshared_static,
37efbbd8
ZJS
1943 libbasic],
1944 dependencies : [threads,
5486a31d 1945 librt],
37efbbd8
ZJS
1946 link_depends : sym,
1947 install : true,
1948 install_dir : rootlibdir)
1949
1950 # We cannot use shared_module because it does not support version suffix.
1951 # Unfortunately shared_library insists on creating the symlink…
7c22f07c 1952 meson.add_install_script('sh', '-c',
37efbbd8
ZJS
1953 'rm $DESTDIR@0@/libnss_@1@.so'
1954 .format(rootlibdir, module))
1955
938be089
ZJS
1956 if want_tests != 'false'
1957 test('dlopen-nss_' + module,
1958 test_dlopen,
1959 # path to dlopen must include a slash
1960 args : nss.full_path())
1961 endif
37efbbd8 1962 endif
5c23128d
ZJS
1963endforeach
1964
1965############################################################
1966
6164ec4c
ZJS
1967executable(
1968 'systemd',
1969 systemd_sources,
1970 include_directories : includes,
1971 link_with : [libcore,
1972 libshared],
1973 dependencies : [versiondep,
1974 threads,
1975 librt,
1976 libseccomp,
1977 libselinux,
1978 libmount,
1979 libblkid],
1980 install_rpath : rootlibexecdir,
1981 install : true,
1982 install_dir : rootlibexecdir)
5c23128d 1983
ba7f4ae6 1984meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
1985 rootlibexecdir / 'systemd',
1986 rootsbindir / 'init')
ba7f4ae6 1987
6164ec4c
ZJS
1988public_programs += executable(
1989 'systemd-analyze',
1990 systemd_analyze_sources,
8d40961c 1991 include_directories : core_includes,
6164ec4c
ZJS
1992 link_with : [libcore,
1993 libshared],
1994 dependencies : [versiondep,
1995 threads,
1996 librt,
1997 libseccomp,
1998 libselinux,
1999 libmount,
2000 libblkid],
2001 install_rpath : rootlibexecdir,
b3259a6e 2002 install : conf.get('ENABLE_ANALYZE'))
5c23128d 2003
6164ec4c
ZJS
2004executable(
2005 'systemd-journald',
2006 systemd_journald_sources,
2007 include_directories : includes,
2008 link_with : [libjournal_core,
2009 libshared],
2010 dependencies : [threads,
2011 libxz,
2012 liblz4,
ef5924aa
NL
2013 libselinux,
2014 libzstd],
6164ec4c
ZJS
2015 install_rpath : rootlibexecdir,
2016 install : true,
2017 install_dir : rootlibexecdir)
5c23128d 2018
6164ec4c
ZJS
2019public_programs += executable(
2020 'systemd-cat',
2021 systemd_cat_sources,
2022 include_directories : includes,
2023 link_with : [libjournal_core,
2024 libshared],
2025 dependencies : [threads],
2026 install_rpath : rootlibexecdir,
2027 install : true)
2028
2029public_programs += executable(
2030 'journalctl',
2031 journalctl_sources,
2032 include_directories : includes,
2033 link_with : [libshared],
2034 dependencies : [threads,
e44b5004 2035 libdl,
6164ec4c
ZJS
2036 libxz,
2037 liblz4,
9200bb30
LP
2038 libzstd,
2039 libdl],
6164ec4c
ZJS
2040 install_rpath : rootlibexecdir,
2041 install : true,
2042 install_dir : rootbindir)
35a1ff4c 2043
6164ec4c
ZJS
2044executable(
2045 'systemd-getty-generator',
2046 'src/getty-generator/getty-generator.c',
2047 include_directories : includes,
2048 link_with : [libshared],
2049 install_rpath : rootlibexecdir,
2050 install : true,
2051 install_dir : systemgeneratordir)
5c23128d 2052
6164ec4c
ZJS
2053executable(
2054 'systemd-debug-generator',
2055 'src/debug-generator/debug-generator.c',
2056 include_directories : includes,
2057 link_with : [libshared],
2058 install_rpath : rootlibexecdir,
2059 install : true,
2060 install_dir : systemgeneratordir)
2061
2062executable(
2063 'systemd-run-generator',
2064 'src/run-generator/run-generator.c',
2065 include_directories : includes,
2066 link_with : [libshared],
2067 install_rpath : rootlibexecdir,
2068 install : true,
2069 install_dir : systemgeneratordir)
2070
2071executable(
2072 'systemd-fstab-generator',
2073 'src/fstab-generator/fstab-generator.c',
2074 include_directories : includes,
bac11cd6 2075 link_with : [libshared],
6164ec4c
ZJS
2076 install_rpath : rootlibexecdir,
2077 install : true,
2078 install_dir : systemgeneratordir)
5c23128d 2079
349cc4a5 2080if conf.get('ENABLE_ENVIRONMENT_D') == 1
6164ec4c
ZJS
2081 executable(
2082 '30-systemd-environment-d-generator',
2083 'src/environment-d-generator/environment-d-generator.c',
2084 include_directories : includes,
2085 link_with : [libshared],
2086 install_rpath : rootlibexecdir,
2087 install : true,
2088 install_dir : userenvgeneratordir)
7b76fce1 2089
37efbbd8 2090 meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
2091 sysconfdir / 'environment',
2092 environmentdir / '99-environment.conf')
5c23128d
ZJS
2093endif
2094
349cc4a5 2095if conf.get('ENABLE_HIBERNATE') == 1
6164ec4c
ZJS
2096 executable(
2097 'systemd-hibernate-resume-generator',
2098 'src/hibernate-resume/hibernate-resume-generator.c',
2099 include_directories : includes,
2100 link_with : [libshared],
2101 install_rpath : rootlibexecdir,
2102 install : true,
2103 install_dir : systemgeneratordir)
2104
2105 executable(
2106 'systemd-hibernate-resume',
2107 'src/hibernate-resume/hibernate-resume.c',
2108 include_directories : includes,
2109 link_with : [libshared],
2110 install_rpath : rootlibexecdir,
2111 install : true,
2112 install_dir : rootlibexecdir)
37efbbd8
ZJS
2113endif
2114
349cc4a5 2115if conf.get('HAVE_BLKID') == 1
6164ec4c
ZJS
2116 executable(
2117 'systemd-gpt-auto-generator',
2118 'src/gpt-auto-generator/gpt-auto-generator.c',
6164ec4c
ZJS
2119 include_directories : includes,
2120 link_with : [libshared],
2121 dependencies : libblkid,
2122 install_rpath : rootlibexecdir,
2123 install : true,
2124 install_dir : systemgeneratordir)
2125
2126 public_programs += executable(
2127 'systemd-dissect',
2128 'src/dissect/dissect.c',
2129 include_directories : includes,
2130 link_with : [libshared],
2131 install_rpath : rootlibexecdir,
5a151082 2132 install : true)
5c23128d
ZJS
2133endif
2134
1ec57f33 2135if conf.get('ENABLE_RESOLVE') == 1
6164ec4c
ZJS
2136 executable(
2137 'systemd-resolved',
2138 systemd_resolved_sources,
8d40961c 2139 include_directories : resolve_includes,
6164ec4c
ZJS
2140 link_with : [libshared,
2141 libbasic_gcrypt,
2142 libsystemd_resolve_core],
2143 dependencies : systemd_resolved_dependencies,
2144 install_rpath : rootlibexecdir,
2145 install : true,
2146 install_dir : rootlibexecdir)
2147
2148 public_programs += executable(
2149 'resolvectl',
2150 resolvectl_sources,
2151 include_directories : includes,
2152 link_with : [libshared,
2153 libbasic_gcrypt,
2154 libsystemd_resolve_core],
2155 dependencies : [threads,
2156 libgpg_error,
2157 libm,
2158 libidn],
2159 install_rpath : rootlibexecdir,
2160 install : true)
088c1363
LP
2161
2162 meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
2163 bindir / 'resolvectl',
2164 rootsbindir / 'resolvconf')
c2e84cab
YW
2165
2166 meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
2167 bindir / 'resolvectl',
2168 bindir / 'systemd-resolve')
5c23128d
ZJS
2169endif
2170
349cc4a5 2171if conf.get('ENABLE_LOGIND') == 1
6164ec4c
ZJS
2172 executable(
2173 'systemd-logind',
2174 systemd_logind_sources,
2175 include_directories : includes,
2176 link_with : [liblogind_core,
2177 libshared],
2178 dependencies : [threads,
2179 libacl],
2180 install_rpath : rootlibexecdir,
2181 install : true,
2182 install_dir : rootlibexecdir)
2183
2184 public_programs += executable(
2185 'loginctl',
2186 loginctl_sources,
2187 include_directories : includes,
2188 link_with : [libshared],
2189 dependencies : [threads,
2190 liblz4,
ef5924aa
NL
2191 libxz,
2192 libzstd],
6164ec4c
ZJS
2193 install_rpath : rootlibexecdir,
2194 install : true,
2195 install_dir : rootbindir)
2196
2197 public_programs += executable(
2198 'systemd-inhibit',
2199 'src/login/inhibit.c',
2200 include_directories : includes,
2201 link_with : [libshared],
2202 install_rpath : rootlibexecdir,
2203 install : true,
2204 install_dir : rootbindir)
37efbbd8 2205
349cc4a5 2206 if conf.get('HAVE_PAM') == 1
fce9abb2 2207 version_script_arg = project_source_root / pam_systemd_sym
37efbbd8
ZJS
2208 pam_systemd = shared_library(
2209 'pam_systemd',
2210 pam_systemd_c,
2211 name_prefix : '',
2212 include_directories : includes,
2213 link_args : ['-shared',
2214 '-Wl,--version-script=' + version_script_arg],
37e4d7a8 2215 link_with : [libsystemd_static,
37efbbd8
ZJS
2216 libshared_static],
2217 dependencies : [threads,
2218 libpam,
2219 libpam_misc],
2220 link_depends : pam_systemd_sym,
2221 install : true,
2222 install_dir : pamlibdir)
2223
938be089
ZJS
2224 if want_tests != 'false'
2225 test('dlopen-pam_systemd',
2226 test_dlopen,
2227 # path to dlopen must include a slash
c1cd6743 2228 args : pam_systemd.full_path())
938be089 2229 endif
37efbbd8 2230 endif
005a29f2 2231
6164ec4c
ZJS
2232 executable(
2233 'systemd-user-runtime-dir',
2234 user_runtime_dir_sources,
2235 include_directories : includes,
2236 link_with : [libshared],
2237 install_rpath : rootlibexecdir,
2238 install : true,
2239 install_dir : rootlibexecdir)
07ee5adb 2240endif
a9f0f5e5 2241
349cc4a5 2242if conf.get('HAVE_PAM') == 1
6164ec4c
ZJS
2243 executable(
2244 'systemd-user-sessions',
2245 'src/user-sessions/user-sessions.c',
2246 include_directories : includes,
2247 link_with : [libshared],
2248 install_rpath : rootlibexecdir,
2249 install : true,
2250 install_dir : rootlibexecdir)
5c23128d
ZJS
2251endif
2252
34357545 2253if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
6164ec4c
ZJS
2254 public_programs += executable(
2255 'bootctl',
2256 'src/boot/bootctl.c',
2257 include_directories : includes,
2258 link_with : [libshared],
2259 dependencies : [libblkid],
2260 install_rpath : rootlibexecdir,
2261 install : true)
2262
2263 public_programs += executable(
2264 'systemd-bless-boot',
2265 'src/boot/bless-boot.c',
2266 include_directories : includes,
2267 link_with : [libshared],
2268 dependencies : [libblkid],
2269 install_rpath : rootlibexecdir,
2270 install : true,
2271 install_dir : rootlibexecdir)
2272
2273 executable(
2274 'systemd-bless-boot-generator',
2275 'src/boot/bless-boot-generator.c',
2276 include_directories : includes,
2277 link_with : [libshared],
2278 install_rpath : rootlibexecdir,
2279 install : true,
2280 install_dir : systemgeneratordir)
2281endif
2282
2283executable(
2284 'systemd-boot-check-no-failures',
2285 'src/boot/boot-check-no-failures.c',
2286 include_directories : includes,
2287 link_with : [libshared],
2288 dependencies : [libblkid],
2289 install_rpath : rootlibexecdir,
2290 install : true,
2291 install_dir : rootlibexecdir)
005a29f2 2292
6164ec4c
ZJS
2293public_programs += executable(
2294 'systemd-socket-activate',
2295 'src/activate/activate.c',
2296 include_directories : includes,
2297 link_with : [libshared],
2298 dependencies : [threads],
2299 install_rpath : rootlibexecdir,
2300 install : true)
f3794366 2301
6164ec4c
ZJS
2302public_programs += executable(
2303 'systemctl',
c3512573 2304 systemctl_sources,
6164ec4c
ZJS
2305 include_directories : includes,
2306 link_with : systemctl_link_with,
2307 dependencies : [threads,
2308 libcap,
2309 libselinux,
2310 libxz,
ef5924aa
NL
2311 liblz4,
2312 libzstd],
6164ec4c
ZJS
2313 install_rpath : rootlibexecdir,
2314 install : true,
2315 install_dir : rootbindir)
5c23128d 2316
61d0578b 2317if conf.get('ENABLE_PORTABLED') == 1
6164ec4c
ZJS
2318 executable(
2319 'systemd-portabled',
2320 systemd_portabled_sources,
2321 include_directories : includes,
2322 link_with : [libshared],
409f4cf1 2323 dependencies : [threads, libselinux],
6164ec4c
ZJS
2324 install_rpath : rootlibexecdir,
2325 install : true,
2326 install_dir : rootlibexecdir)
2327
2328 public_programs += executable(
2329 'portablectl',
2330 'src/portable/portablectl.c',
2331 include_directories : includes,
2332 link_with : [libshared],
2333 dependencies : [threads],
2334 install_rpath : rootlibexecdir,
2335 install : true,
2336 install_dir : rootbindir)
61d0578b
LP
2337endif
2338
9bca4ae4
LP
2339if conf.get('ENABLE_SYSEXT') == 1
2340 public_programs += executable(
2341 'systemd-sysext',
2342 systemd_sysext_sources,
2343 include_directories : includes,
2344 link_with : [libshared],
2345 install_rpath : rootlibexecdir,
2346 install : true,
aac5fbff 2347 install_dir : rootbindir)
9bca4ae4
LP
2348endif
2349
d093b62c 2350if conf.get('ENABLE_USERDB') == 1
6164ec4c
ZJS
2351 executable(
2352 'systemd-userwork',
2353 systemd_userwork_sources,
2354 include_directories : includes,
2355 link_with : [libshared],
2356 dependencies : [threads],
2357 install_rpath : rootlibexecdir,
2358 install : true,
2359 install_dir : rootlibexecdir)
2360
2361 executable(
2362 'systemd-userdbd',
2363 systemd_userdbd_sources,
2364 include_directories : includes,
2365 link_with : [libshared],
2366 dependencies : [threads],
2367 install_rpath : rootlibexecdir,
2368 install : true,
2369 install_dir : rootlibexecdir)
2370
460e5af0 2371 public_programs += executable(
6164ec4c
ZJS
2372 'userdbctl',
2373 userdbctl_sources,
2374 include_directories : includes,
2375 link_with : [libshared],
2376 dependencies : [threads],
2377 install_rpath : rootlibexecdir,
2378 install : true,
2379 install_dir : rootbindir)
d093b62c
LP
2380endif
2381
70a5db58 2382if conf.get('ENABLE_HOMED') == 1
6164ec4c
ZJS
2383 executable(
2384 'systemd-homework',
2385 systemd_homework_sources,
2386 include_directories : includes,
2387 link_with : [libshared],
2388 dependencies : [threads,
6164ec4c
ZJS
2389 libblkid,
2390 libcrypt,
2391 libopenssl,
2392 libfdisk,
69cb2896 2393 libp11kit],
6164ec4c
ZJS
2394 install_rpath : rootlibexecdir,
2395 install : true,
2396 install_dir : rootlibexecdir)
2397
2398 executable(
2399 'systemd-homed',
2400 systemd_homed_sources,
8d40961c 2401 include_directories : home_includes,
6164ec4c
ZJS
2402 link_with : [libshared],
2403 dependencies : [threads,
2404 libcrypt,
679badd7 2405 libopenssl],
6164ec4c
ZJS
2406 install_rpath : rootlibexecdir,
2407 install : true,
2408 install_dir : rootlibexecdir)
2409
460e5af0 2410 public_programs += executable(
6164ec4c
ZJS
2411 'homectl',
2412 homectl_sources,
2413 include_directories : includes,
2414 link_with : [libshared],
2415 dependencies : [threads,
2416 libcrypt,
2417 libopenssl,
2418 libp11kit,
da3920c3 2419 libdl],
6164ec4c
ZJS
2420 install_rpath : rootlibexecdir,
2421 install : true,
2422 install_dir : rootbindir)
26cf9fb7
LP
2423
2424 if conf.get('HAVE_PAM') == 1
fce9abb2 2425 version_script_arg = project_source_root / pam_systemd_home_sym
26cf9fb7
LP
2426 pam_systemd = shared_library(
2427 'pam_systemd_home',
2428 pam_systemd_home_c,
2429 name_prefix : '',
2430 include_directories : includes,
2431 link_args : ['-shared',
2432 '-Wl,--version-script=' + version_script_arg],
2433 link_with : [libsystemd_static,
2434 libshared_static],
2435 dependencies : [threads,
2436 libpam,
2437 libpam_misc,
2438 libcrypt],
2439 link_depends : pam_systemd_home_sym,
2440 install : true,
2441 install_dir : pamlibdir)
2442 endif
70a5db58
LP
2443endif
2444
6589a569 2445foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
ba081955 2446 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
ba7f4ae6 2447 meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
2448 rootbindir / 'systemctl',
2449 rootsbindir / alias)
ba7f4ae6
ZJS
2450endforeach
2451
63e2d171 2452meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
2453 rootbindir / 'udevadm',
2454 rootlibexecdir / 'systemd-udevd')
63e2d171 2455
349cc4a5 2456if conf.get('ENABLE_BACKLIGHT') == 1
6164ec4c
ZJS
2457 executable(
2458 'systemd-backlight',
2459 'src/backlight/backlight.c',
2460 include_directories : includes,
2461 link_with : [libshared],
2462 install_rpath : rootlibexecdir,
2463 install : true,
2464 install_dir : rootlibexecdir)
5c23128d
ZJS
2465endif
2466
349cc4a5 2467if conf.get('ENABLE_RFKILL') == 1
6164ec4c
ZJS
2468 executable(
2469 'systemd-rfkill',
2470 'src/rfkill/rfkill.c',
2471 include_directories : includes,
2472 link_with : [libshared],
2473 install_rpath : rootlibexecdir,
2474 install : true,
2475 install_dir : rootlibexecdir)
2476endif
2477
2478executable(
2479 'systemd-system-update-generator',
2480 'src/system-update-generator/system-update-generator.c',
2481 include_directories : includes,
2482 link_with : [libshared],
2483 install_rpath : rootlibexecdir,
2484 install : true,
2485 install_dir : systemgeneratordir)
5c23128d 2486
349cc4a5 2487if conf.get('HAVE_LIBCRYPTSETUP') == 1
6164ec4c
ZJS
2488 executable(
2489 'systemd-cryptsetup',
2490 systemd_cryptsetup_sources,
2491 include_directories : includes,
2492 link_with : [libshared],
2493 dependencies : [libcryptsetup,
2494 libp11kit],
2495 install_rpath : rootlibexecdir,
2496 install : true,
2497 install_dir : rootlibexecdir)
2498
2499 executable(
2500 'systemd-cryptsetup-generator',
2501 'src/cryptsetup/cryptsetup-generator.c',
2502 include_directories : includes,
2503 link_with : [libshared],
6164ec4c
ZJS
2504 install_rpath : rootlibexecdir,
2505 install : true,
2506 install_dir : systemgeneratordir)
2507
2508 executable(
2509 'systemd-veritysetup',
2510 'src/veritysetup/veritysetup.c',
2511 include_directories : includes,
2512 link_with : [libshared],
2513 dependencies : [libcryptsetup],
2514 install_rpath : rootlibexecdir,
2515 install : true,
2516 install_dir : rootlibexecdir)
2517
2518 executable(
2519 'systemd-veritysetup-generator',
2520 'src/veritysetup/veritysetup-generator.c',
2521 include_directories : includes,
2522 link_with : [libshared],
6164ec4c
ZJS
2523 install_rpath : rootlibexecdir,
2524 install : true,
2525 install_dir : systemgeneratordir)
8710a681 2526
8710a681
LP
2527 executable(
2528 'systemd-cryptenroll',
2529 systemd_cryptenroll_sources,
2530 include_directories : includes,
2531 link_with : [libshared],
2532 dependencies : [libcryptsetup,
5e521624 2533 libdl,
8710a681
LP
2534 libopenssl,
2535 libp11kit],
2536 install_rpath : rootlibexecdir,
a1fd722b 2537 install : true)
5c23128d
ZJS
2538endif
2539
349cc4a5 2540if conf.get('HAVE_SYSV_COMPAT') == 1
6164ec4c
ZJS
2541 executable(
2542 'systemd-sysv-generator',
2543 'src/sysv-generator/sysv-generator.c',
2544 include_directories : includes,
2545 link_with : [libshared],
2546 install_rpath : rootlibexecdir,
2547 install : true,
2548 install_dir : systemgeneratordir)
2549
2550 executable(
2551 'systemd-rc-local-generator',
2552 'src/rc-local-generator/rc-local-generator.c',
2553 include_directories : includes,
2554 link_with : [libshared],
2555 install_rpath : rootlibexecdir,
2556 install : true,
2557 install_dir : systemgeneratordir)
5c23128d
ZJS
2558endif
2559
8feca247
BB
2560if conf.get('ENABLE_XDG_AUTOSTART') == 1
2561 executable(
2562 'systemd-xdg-autostart-generator',
0275e918 2563 systemd_xdg_autostart_generator_sources,
8feca247
BB
2564 include_directories : includes,
2565 link_with : [libshared],
2566 install_rpath : rootlibexecdir,
2567 install : true,
2568 install_dir : usergeneratordir)
2569
2570 executable(
2571 'systemd-xdg-autostart-condition',
2572 'src/xdg-autostart-generator/xdg-autostart-condition.c',
2573 include_directories : includes,
2574 link_with : [libshared],
2575 install_rpath : rootlibexecdir,
2576 install : true,
2577 install_dir : rootlibexecdir)
2578endif
2579
349cc4a5 2580if conf.get('ENABLE_HOSTNAMED') == 1
6164ec4c
ZJS
2581 executable(
2582 'systemd-hostnamed',
2583 'src/hostname/hostnamed.c',
2584 include_directories : includes,
2585 link_with : [libshared],
2586 install_rpath : rootlibexecdir,
2587 install : true,
2588 install_dir : rootlibexecdir)
2589
2590 public_programs += executable(
2591 'hostnamectl',
2592 'src/hostname/hostnamectl.c',
2593 include_directories : includes,
2594 link_with : [libshared],
2595 install_rpath : rootlibexecdir,
2596 install : true)
5c23128d
ZJS
2597endif
2598
349cc4a5
ZJS
2599if conf.get('ENABLE_LOCALED') == 1
2600 if conf.get('HAVE_XKBCOMMON') == 1
37efbbd8
ZJS
2601 # logind will load libxkbcommon.so dynamically on its own
2602 deps = [libdl]
aff870ef 2603 extra_includes = [libxkbcommon.get_pkgconfig_variable('includedir')]
37efbbd8
ZJS
2604 else
2605 deps = []
aff870ef 2606 extra_includes = []
37efbbd8
ZJS
2607 endif
2608
6164ec4c
ZJS
2609 executable(
2610 'systemd-localed',
2611 systemd_localed_sources,
aff870ef 2612 include_directories : includes + extra_includes,
6164ec4c
ZJS
2613 link_with : [libshared],
2614 dependencies : deps,
2615 install_rpath : rootlibexecdir,
2616 install : true,
2617 install_dir : rootlibexecdir)
2618
2619 public_programs += executable(
2620 'localectl',
2621 localectl_sources,
2622 include_directories : includes,
2623 link_with : [libshared],
2624 install_rpath : rootlibexecdir,
2625 install : true)
5c23128d
ZJS
2626endif
2627
349cc4a5 2628if conf.get('ENABLE_TIMEDATED') == 1
6164ec4c
ZJS
2629 executable(
2630 'systemd-timedated',
2631 'src/timedate/timedated.c',
2632 include_directories : includes,
2633 link_with : [libshared],
2634 install_rpath : rootlibexecdir,
2635 install : true,
2636 install_dir : rootlibexecdir)
6129ec85 2637endif
5c23128d 2638
6129ec85 2639if conf.get('ENABLE_TIMEDATECTL') == 1
6164ec4c
ZJS
2640 public_programs += executable(
2641 'timedatectl',
2642 'src/timedate/timedatectl.c',
2643 include_directories : includes,
2644 install_rpath : rootlibexecdir,
2645 link_with : [libshared],
2646 dependencies : [libm],
2647 install : true)
5c23128d
ZJS
2648endif
2649
349cc4a5 2650if conf.get('ENABLE_TIMESYNCD') == 1
6164ec4c
ZJS
2651 executable(
2652 'systemd-timesyncd',
2653 systemd_timesyncd_sources,
2654 include_directories : includes,
f5a5284e 2655 link_with : [libtimesyncd_core],
6164ec4c
ZJS
2656 dependencies : [threads,
2657 libm],
2658 install_rpath : rootlibexecdir,
2659 install : true,
2660 install_dir : rootlibexecdir)
2661
2662 executable(
2663 'systemd-time-wait-sync',
cf242350 2664 'src/timesync/wait-sync.c',
6164ec4c 2665 include_directories : includes,
f5a5284e 2666 link_with : [libtimesyncd_core],
6164ec4c
ZJS
2667 install_rpath : rootlibexecdir,
2668 install : true,
2669 install_dir : rootlibexecdir)
5c23128d
ZJS
2670endif
2671
349cc4a5 2672if conf.get('ENABLE_MACHINED') == 1
6164ec4c
ZJS
2673 executable(
2674 'systemd-machined',
2675 systemd_machined_sources,
2676 include_directories : includes,
2677 link_with : [libmachine_core,
2678 libshared],
2679 install_rpath : rootlibexecdir,
2680 install : true,
2681 install_dir : rootlibexecdir)
2682
2683 public_programs += executable(
2684 'machinectl',
2685 'src/machine/machinectl.c',
2686 include_directories : includes,
2687 link_with : [libshared],
2688 dependencies : [threads,
2689 libxz,
ef5924aa
NL
2690 liblz4,
2691 libzstd],
6164ec4c
ZJS
2692 install_rpath : rootlibexecdir,
2693 install : true,
2694 install_dir : rootbindir)
5c23128d
ZJS
2695endif
2696
349cc4a5 2697if conf.get('ENABLE_IMPORTD') == 1
6164ec4c
ZJS
2698 executable(
2699 'systemd-importd',
2700 systemd_importd_sources,
2701 include_directories : includes,
2702 link_with : [libshared],
2703 dependencies : [threads],
2704 install_rpath : rootlibexecdir,
2705 install : true,
2706 install_dir : rootlibexecdir)
2707
2708 systemd_pull = executable(
2709 'systemd-pull',
2710 systemd_pull_sources,
2711 include_directories : includes,
2712 link_with : [libshared],
2713 dependencies : [versiondep,
2714 libcurl,
2715 libz,
2716 libbzip2,
2717 libxz,
2718 libgcrypt],
2719 install_rpath : rootlibexecdir,
2720 install : true,
2721 install_dir : rootlibexecdir)
2722
2723 systemd_import = executable(
2724 'systemd-import',
2725 systemd_import_sources,
2726 include_directories : includes,
2727 link_with : [libshared],
2728 dependencies : [libcurl,
2729 libz,
2730 libbzip2,
2731 libxz],
2732 install_rpath : rootlibexecdir,
2733 install : true,
2734 install_dir : rootlibexecdir)
2735
2736 systemd_import_fs = executable(
2737 'systemd-import-fs',
2738 systemd_import_fs_sources,
2739 include_directories : includes,
2740 link_with : [libshared],
2741 install_rpath : rootlibexecdir,
2742 install : true,
2743 install_dir : rootlibexecdir)
2744
2745 systemd_export = executable(
2746 'systemd-export',
2747 systemd_export_sources,
2748 include_directories : includes,
2749 link_with : [libshared],
2750 dependencies : [libcurl,
2751 libz,
2752 libbzip2,
2753 libxz],
2754 install_rpath : rootlibexecdir,
2755 install : true,
2756 install_dir : rootlibexecdir)
1d7579c4
LP
2757
2758 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
37efbbd8
ZJS
2759endif
2760
349cc4a5 2761if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
6164ec4c
ZJS
2762 public_programs += executable(
2763 'systemd-journal-upload',
2764 systemd_journal_upload_sources,
2765 include_directories : includes,
2766 link_with : [libshared],
2767 dependencies : [versiondep,
2768 threads,
2769 libcurl,
2770 libgnutls,
2771 libxz,
ef5924aa
NL
2772 liblz4,
2773 libzstd],
6164ec4c
ZJS
2774 install_rpath : rootlibexecdir,
2775 install : true,
2776 install_dir : rootlibexecdir)
5c23128d
ZJS
2777endif
2778
349cc4a5 2779if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
6164ec4c
ZJS
2780 public_programs += executable(
2781 'systemd-journal-remote',
2782 systemd_journal_remote_sources,
2783 include_directories : includes,
2784 link_with : [libshared,
2785 libsystemd_journal_remote],
2786 dependencies : [threads,
2787 libmicrohttpd,
2788 libgnutls,
2789 libxz,
ef5924aa
NL
2790 liblz4,
2791 libzstd],
6164ec4c
ZJS
2792 install_rpath : rootlibexecdir,
2793 install : true,
2794 install_dir : rootlibexecdir)
2795
2796 public_programs += executable(
2797 'systemd-journal-gatewayd',
2798 systemd_journal_gatewayd_sources,
2799 include_directories : includes,
2800 link_with : [libshared],
2801 dependencies : [threads,
2802 libmicrohttpd,
2803 libgnutls,
2804 libxz,
ef5924aa
NL
2805 liblz4,
2806 libzstd],
6164ec4c
ZJS
2807 install_rpath : rootlibexecdir,
2808 install : true,
2809 install_dir : rootlibexecdir)
5c23128d
ZJS
2810endif
2811
349cc4a5 2812if conf.get('ENABLE_COREDUMP') == 1
6164ec4c
ZJS
2813 executable(
2814 'systemd-coredump',
2815 systemd_coredump_sources,
2816 include_directories : includes,
2817 link_with : [libshared],
2818 dependencies : [threads,
2819 libacl,
2820 libdw,
2821 libxz,
ef5924aa
NL
2822 liblz4,
2823 libzstd],
6164ec4c
ZJS
2824 install_rpath : rootlibexecdir,
2825 install : true,
2826 install_dir : rootlibexecdir)
2827
2828 public_programs += executable(
2829 'coredumpctl',
2830 coredumpctl_sources,
2831 include_directories : includes,
2832 link_with : [libshared],
2833 dependencies : [threads,
2834 libxz,
ef5924aa
NL
2835 liblz4,
2836 libzstd],
6164ec4c
ZJS
2837 install_rpath : rootlibexecdir,
2838 install : true)
5c23128d
ZJS
2839endif
2840
9b4abc69 2841if conf.get('ENABLE_PSTORE') == 1
6164ec4c
ZJS
2842 executable(
2843 'systemd-pstore',
2844 systemd_pstore_sources,
2845 include_directories : includes,
2846 link_with : [libshared],
2847 dependencies : [threads,
2848 libacl,
2849 libdw,
2850 libxz,
ef5924aa
NL
2851 liblz4,
2852 libzstd],
6164ec4c
ZJS
2853 install_rpath : rootlibexecdir,
2854 install : true,
2855 install_dir : rootlibexecdir)
9b4abc69
ED
2856endif
2857
9de5e321
AZ
2858if conf.get('ENABLE_OOMD') == 1
2859 executable('systemd-oomd',
2860 systemd_oomd_sources,
2861 include_directories : includes,
2862 link_with : [libshared],
2863 dependencies : [],
2864 install_rpath : rootlibexecdir,
2865 install : true,
2866 install_dir : rootlibexecdir)
5c616ecf
AZ
2867
2868 public_programs += executable(
ba081955
ZJS
2869 'oomctl',
2870 oomctl_sources,
2871 include_directories : includes,
2872 link_with : [libshared],
2873 dependencies : [],
2874 install_rpath : rootlibexecdir,
2875 install : true,
2876 install_dir : rootbindir)
9de5e321
AZ
2877endif
2878
349cc4a5 2879if conf.get('ENABLE_BINFMT') == 1
6164ec4c
ZJS
2880 public_programs += executable(
2881 'systemd-binfmt',
2882 'src/binfmt/binfmt.c',
2883 include_directories : includes,
2884 link_with : [libshared],
2885 install_rpath : rootlibexecdir,
2886 install : true,
2887 install_dir : rootlibexecdir)
37efbbd8 2888
7c22f07c
ZJS
2889 meson.add_install_script('sh', '-c',
2890 mkdir_p.format(binfmtdir))
d7aa78c3 2891 if install_sysconfdir
7c22f07c 2892 meson.add_install_script('sh', '-c',
fce9abb2 2893 mkdir_p.format(sysconfdir / 'binfmt.d'))
d7aa78c3 2894 endif
37efbbd8
ZJS
2895endif
2896
e594a3b1 2897if conf.get('ENABLE_REPART') == 1
6164ec4c
ZJS
2898 exe = executable(
2899 'systemd-repart',
2900 systemd_repart_sources,
2901 include_directories : includes,
2902 link_with : [libshared],
2903 dependencies : [threads,
6164ec4c
ZJS
2904 libblkid,
2905 libfdisk,
2906 libopenssl],
2907 install_rpath : rootlibexecdir,
2908 install : true,
2909 install_dir : rootbindir)
2d2d0a57 2910 public_programs += exe
e29e4d57
ZJS
2911
2912 if want_tests != 'false'
2913 test('test-repart',
2914 test_repart_sh,
2915 args : exe.full_path())
2916 endif
e594a3b1
LP
2917endif
2918
349cc4a5 2919if conf.get('ENABLE_VCONSOLE') == 1
6164ec4c
ZJS
2920 executable(
2921 'systemd-vconsole-setup',
2922 'src/vconsole/vconsole-setup.c',
2923 include_directories : includes,
2924 link_with : [libshared],
2925 install_rpath : rootlibexecdir,
2926 install : true,
2927 install_dir : rootlibexecdir)
5c23128d
ZJS
2928endif
2929
349cc4a5 2930if conf.get('ENABLE_RANDOMSEED') == 1
6164ec4c
ZJS
2931 executable(
2932 'systemd-random-seed',
2933 'src/random-seed/random-seed.c',
2934 include_directories : includes,
2935 link_with : [libshared],
2936 install_rpath : rootlibexecdir,
2937 install : true,
2938 install_dir : rootlibexecdir)
5c23128d
ZJS
2939endif
2940
349cc4a5 2941if conf.get('ENABLE_FIRSTBOOT') == 1
6164ec4c
ZJS
2942 executable(
2943 'systemd-firstboot',
2944 'src/firstboot/firstboot.c',
2945 include_directories : includes,
2946 link_with : [libshared],
2947 dependencies : [libcrypt],
2948 install_rpath : rootlibexecdir,
2949 install : true,
2950 install_dir : rootbindir)
2951endif
2952
2953executable(
2954 'systemd-remount-fs',
2955 'src/remount-fs/remount-fs.c',
2956 include_directories : includes,
bac11cd6 2957 link_with : [libshared],
6164ec4c
ZJS
2958 install_rpath : rootlibexecdir,
2959 install : true,
2960 install_dir : rootlibexecdir)
5c23128d 2961
6164ec4c
ZJS
2962executable(
2963 'systemd-machine-id-setup',
2964 'src/machine-id-setup/machine-id-setup-main.c',
2965 include_directories : includes,
bac11cd6 2966 link_with : [libshared],
6164ec4c
ZJS
2967 install_rpath : rootlibexecdir,
2968 install : true,
2969 install_dir : rootbindir)
5c23128d 2970
6164ec4c
ZJS
2971executable(
2972 'systemd-fsck',
2973 'src/fsck/fsck.c',
2974 include_directories : includes,
2975 link_with : [libshared],
2976 install_rpath : rootlibexecdir,
2977 install : true,
2978 install_dir : rootlibexecdir)
5c23128d 2979
80750adb
ZJS
2980executable('systemd-growfs',
2981 'src/partition/growfs.c',
2982 include_directories : includes,
2983 link_with : [libshared],
2984 install_rpath : rootlibexecdir,
2985 install : true,
2986 install_dir : rootlibexecdir)
2987
6164ec4c
ZJS
2988executable(
2989 'systemd-makefs',
2990 'src/partition/makefs.c',
2991 include_directories : includes,
2992 link_with : [libshared],
2993 install_rpath : rootlibexecdir,
2994 install : true,
2995 install_dir : rootlibexecdir)
b7f28ac5 2996
6164ec4c
ZJS
2997executable(
2998 'systemd-sleep',
2999 'src/sleep/sleep.c',
3000 include_directories : includes,
3001 link_with : [libshared],
3002 install_rpath : rootlibexecdir,
3003 install : true,
3004 install_dir : rootlibexecdir)
5c23128d 3005
225d08b8 3006if install_sysconfdir_samples
d7aa78c3
JT
3007 install_data('src/sleep/sleep.conf',
3008 install_dir : pkgsysconfdir)
3009endif
d25e127d 3010
6164ec4c
ZJS
3011public_programs += executable(
3012 'systemd-sysctl',
3013 'src/sysctl/sysctl.c',
3014 include_directories : includes,
3015 link_with : [libshared],
3016 install_rpath : rootlibexecdir,
3017 install : true,
3018 install_dir : rootlibexecdir)
5c23128d 3019
6164ec4c
ZJS
3020executable(
3021 'systemd-ac-power',
3022 'src/ac-power/ac-power.c',
3023 include_directories : includes,
3024 link_with : [libshared],
3025 install_rpath : rootlibexecdir,
3026 install : true,
3027 install_dir : rootlibexecdir)
5c23128d 3028
6164ec4c
ZJS
3029public_programs += executable(
3030 'systemd-detect-virt',
3031 'src/detect-virt/detect-virt.c',
3032 include_directories : includes,
3033 link_with : [libshared],
3034 install_rpath : rootlibexecdir,
3035 install : true)
5c23128d 3036
6164ec4c
ZJS
3037public_programs += executable(
3038 'systemd-delta',
3039 'src/delta/delta.c',
3040 include_directories : includes,
3041 link_with : [libshared],
3042 install_rpath : rootlibexecdir,
3043 install : true)
5c23128d 3044
6164ec4c
ZJS
3045public_programs += executable(
3046 'systemd-escape',
3047 'src/escape/escape.c',
3048 include_directories : includes,
3049 link_with : [libshared],
3050 install_rpath : rootlibexecdir,
3051 install : true,
3052 install_dir : rootbindir)
3053
3054public_programs += executable(
3055 'systemd-notify',
3056 'src/notify/notify.c',
3057 include_directories : includes,
3058 link_with : [libshared],
3059 install_rpath : rootlibexecdir,
3060 install : true,
3061 install_dir : rootbindir)
3062
5945640e
LP
3063public_programs += executable(
3064 'systemd-creds',
3065 'src/creds/creds.c',
3066 include_directories : includes,
3067 link_with : [libshared],
3068 dependencies : [threads,
3069 libopenssl],
3070 install_rpath : rootlibexecdir,
3071 install : true,
3072 install_dir : rootbindir)
3073
6164ec4c
ZJS
3074executable(
3075 'systemd-volatile-root',
3076 'src/volatile-root/volatile-root.c',
3077 include_directories : includes,
3078 link_with : [libshared],
3079 install_rpath : rootlibexecdir,
cdf7ad38 3080 install : conf.get('ENABLE_INITRD') == 1,
6164ec4c
ZJS
3081 install_dir : rootlibexecdir)
3082
3083executable(
3084 'systemd-cgroups-agent',
3085 'src/cgroups-agent/cgroups-agent.c',
3086 include_directories : includes,
3087 link_with : [libshared],
3088 install_rpath : rootlibexecdir,
3089 install : true,
3090 install_dir : rootlibexecdir)
3091
3092public_programs += executable(
3093 'systemd-id128',
3094 'src/id128/id128.c',
3095 include_directories : includes,
3096 link_with : [libshared],
3097 install_rpath : rootlibexecdir,
3098 install : true)
3099
3100public_programs += executable(
3101 'systemd-path',
3102 'src/path/path.c',
3103 include_directories : includes,
3104 link_with : [libshared],
3105 install_rpath : rootlibexecdir,
3106 install : true)
3107
3108public_programs += executable(
3109 'systemd-ask-password',
3110 'src/ask-password/ask-password.c',
3111 include_directories : includes,
3112 link_with : [libshared],
3113 install_rpath : rootlibexecdir,
3114 install : true,
3115 install_dir : rootbindir)
3116
3117executable(
3118 'systemd-reply-password',
3119 'src/reply-password/reply-password.c',
3120 include_directories : includes,
3121 link_with : [libshared],
3122 install_rpath : rootlibexecdir,
3123 install : true,
3124 install_dir : rootlibexecdir)
3125
3126public_programs += executable(
3127 'systemd-tty-ask-password-agent',
3128 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3129 include_directories : includes,
3130 link_with : [libshared],
3131 install_rpath : rootlibexecdir,
3132 install : true,
3133 install_dir : rootbindir)
3134
3135public_programs += executable(
3136 'systemd-cgls',
3137 'src/cgls/cgls.c',
3138 include_directories : includes,
3139 link_with : [libshared],
3140 install_rpath : rootlibexecdir,
3141 install : true)
3142
3143public_programs += executable(
3144 'systemd-cgtop',
3145 'src/cgtop/cgtop.c',
3146 include_directories : includes,
3147 link_with : [libshared],
3148 install_rpath : rootlibexecdir,
3149 install : true)
3150
3151executable(
3152 'systemd-initctl',
3153 'src/initctl/initctl.c',
3154 include_directories : includes,
3155 link_with : [libshared],
3156 install_rpath : rootlibexecdir,
6589a569 3157 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
6164ec4c 3158 install_dir : rootlibexecdir)
5c23128d 3159
6164ec4c
ZJS
3160public_programs += executable(
3161 'systemd-mount',
3162 'src/mount/mount-tool.c',
3163 include_directories : includes,
3164 link_with : [libshared],
3165 dependencies: [libmount],
3166 install_rpath : rootlibexecdir,
3167 install : true)
5c23128d 3168
7b76fce1 3169meson.add_install_script(meson_make_symlink,
fce9abb2 3170 'systemd-mount', bindir / 'systemd-umount')
7b76fce1 3171
6164ec4c
ZJS
3172public_programs += executable(
3173 'systemd-run',
3174 'src/run/run.c',
3175 include_directories : includes,
3176 link_with : [libshared],
3177 install_rpath : rootlibexecdir,
3178 install : true)
3179
3180public_programs += executable(
3181 'systemd-stdio-bridge',
3182 'src/stdio-bridge/stdio-bridge.c',
3183 include_directories : includes,
3184 link_with : [libshared],
3185 dependencies : [versiondep],
3186 install_rpath : rootlibexecdir,
3187 install : true)
3188
3189public_programs += executable(
3190 'busctl',
f98df767 3191 busctl_sources,
6164ec4c
ZJS
3192 include_directories : includes,
3193 link_with : [libshared],
3194 install_rpath : rootlibexecdir,
3195 install : true)
5c23128d 3196
bd7e6aa7
ZJS
3197if enable_sysusers
3198 exe = executable(
6164ec4c
ZJS
3199 'systemd-sysusers',
3200 'src/sysusers/sysusers.c',
3201 include_directories : includes,
3202 link_with : [libshared],
3203 install_rpath : rootlibexecdir,
3204 install : true,
3205 install_dir : rootbindir)
bd7e6aa7
ZJS
3206 public_programs += exe
3207
3208 if want_tests != 'false'
3209 test('test-sysusers',
3210 test_sysusers_sh,
3211 # https://github.com/mesonbuild/meson/issues/2681
3212 args : exe.full_path())
3213 endif
8ef8f3d5
FB
3214
3215 if have_standalone_binaries
bd7e6aa7 3216 exe = executable(
8ef8f3d5
FB
3217 'systemd-sysusers.standalone',
3218 'src/sysusers/sysusers.c',
3219 include_directories : includes,
3537577c 3220 c_args : '-DSTANDALONE',
8ef8f3d5
FB
3221 link_with : [libshared_static,
3222 libbasic,
3223 libbasic_gcrypt,
99b9f8fd 3224 libsystemd_static],
8ef8f3d5
FB
3225 install : true,
3226 install_dir : rootbindir)
bd7e6aa7
ZJS
3227 public_programs += exe
3228
3229 if want_tests != 'false'
3230 test('test-sysusers.standalone',
3231 test_sysusers_sh,
3232 # https://github.com/mesonbuild/meson/issues/2681
3233 args : exe.full_path())
3234 endif
8ef8f3d5 3235 endif
5c23128d
ZJS
3236endif
3237
349cc4a5 3238if conf.get('ENABLE_TMPFILES') == 1
6164ec4c
ZJS
3239 exe = executable(
3240 'systemd-tmpfiles',
db64ba81 3241 systemd_tmpfiles_sources,
6164ec4c
ZJS
3242 include_directories : includes,
3243 link_with : [libshared],
3244 dependencies : [libacl],
3245 install_rpath : rootlibexecdir,
3246 install : true,
3247 install_dir : rootbindir)
5a8b1640 3248 public_programs += exe
d9daae55 3249
938be089
ZJS
3250 if want_tests != 'false'
3251 test('test-systemd-tmpfiles',
3252 test_systemd_tmpfiles_py,
3253 # https://github.com/mesonbuild/meson/issues/2681
3254 args : exe.full_path())
3255 endif
db64ba81
FB
3256
3257 if have_standalone_binaries
3258 public_programs += executable(
3259 'systemd-tmpfiles.standalone',
3260 systemd_tmpfiles_sources,
3261 include_directories : includes,
3537577c 3262 c_args : '-DSTANDALONE',
db64ba81
FB
3263 link_with : [libshared_static,
3264 libbasic,
3265 libbasic_gcrypt,
99b9f8fd 3266 libsystemd_static],
db64ba81
FB
3267 dependencies : [libacl],
3268 install : true,
3269 install_dir : rootbindir)
3270 endif
5c23128d
ZJS
3271endif
3272
349cc4a5 3273if conf.get('ENABLE_HWDB') == 1
ecd1bfdd 3274 systemd_hwdb = executable(
6164ec4c
ZJS
3275 'systemd-hwdb',
3276 'src/hwdb/hwdb.c',
6164ec4c 3277 include_directories : includes,
e4b127e2 3278 link_with : udev_link_with,
6164ec4c
ZJS
3279 install_rpath : udev_rpath,
3280 install : true,
3281 install_dir : rootbindir)
ecd1bfdd
ZJS
3282 public_programs += systemd_hwdb
3283
3284 if want_tests != 'false'
3285 test('hwdb-test',
3286 hwdb_test_sh,
3287 args : [systemd_hwdb.full_path()],
3288 timeout : 90)
3289 endif
37efbbd8
ZJS
3290endif
3291
349cc4a5 3292if conf.get('ENABLE_QUOTACHECK') == 1
6164ec4c
ZJS
3293 executable(
3294 'systemd-quotacheck',
3295 'src/quotacheck/quotacheck.c',
3296 include_directories : includes,
3297 link_with : [libshared],
3298 install_rpath : rootlibexecdir,
3299 install : true,
3300 install_dir : rootlibexecdir)
3301endif
3302
3303public_programs += executable(
3304 'systemd-socket-proxyd',
3305 'src/socket-proxy/socket-proxyd.c',
3306 include_directories : includes,
3307 link_with : [libshared],
3308 dependencies : [threads],
3309 install_rpath : rootlibexecdir,
3310 install : true,
3311 install_dir : rootlibexecdir)
5c23128d 3312
6164ec4c
ZJS
3313public_programs += executable(
3314 'udevadm',
3315 udevadm_sources,
6164ec4c 3316 include_directories : includes,
e4b127e2 3317 link_with : [libudevd_core],
6164ec4c
ZJS
3318 dependencies : [versiondep,
3319 threads,
3320 libkmod,
3321 libidn,
3322 libacl,
3323 libblkid],
3324 install_rpath : udev_rpath,
3325 install : true,
3326 install_dir : rootbindir)
3327
3328executable(
3329 'systemd-shutdown',
3330 systemd_shutdown_sources,
3331 include_directories : includes,
bac11cd6 3332 link_with : [libshared],
6164ec4c
ZJS
3333 dependencies : [libmount],
3334 install_rpath : rootlibexecdir,
3335 install : true,
3336 install_dir : rootlibexecdir)
3337
3338executable(
3339 'systemd-update-done',
3340 'src/update-done/update-done.c',
3341 include_directories : includes,
3342 link_with : [libshared],
3343 install_rpath : rootlibexecdir,
3344 install : true,
3345 install_dir : rootlibexecdir)
3346
3347executable(
3348 'systemd-update-utmp',
3349 'src/update-utmp/update-utmp.c',
3350 include_directories : includes,
3351 link_with : [libshared],
3352 dependencies : [libaudit],
3353 install_rpath : rootlibexecdir,
55678b9e 3354 install : (conf.get('ENABLE_UTMP') == 1),
6164ec4c 3355 install_dir : rootlibexecdir)
5c23128d 3356
349cc4a5 3357if conf.get('HAVE_KMOD') == 1
6164ec4c
ZJS
3358 executable(
3359 'systemd-modules-load',
3360 'src/modules-load/modules-load.c',
3361 include_directories : includes,
3362 link_with : [libshared],
3363 dependencies : [libkmod],
3364 install_rpath : rootlibexecdir,
3365 install : true,
3366 install_dir : rootlibexecdir)
94e75a54 3367
7c22f07c
ZJS
3368 meson.add_install_script('sh', '-c',
3369 mkdir_p.format(modulesloaddir))
d7aa78c3 3370 if install_sysconfdir
7c22f07c 3371 meson.add_install_script('sh', '-c',
fce9abb2 3372 mkdir_p.format(sysconfdir / 'modules-load.d'))
d7aa78c3 3373 endif
5c23128d
ZJS
3374endif
3375
6164ec4c
ZJS
3376public_programs += executable(
3377 'systemd-nspawn',
3378 systemd_nspawn_sources,
3379 include_directories : includes,
bac11cd6 3380 link_with : [libnspawn_core,
6164ec4c
ZJS
3381 libshared],
3382 dependencies : [libblkid,
3383 libseccomp],
3384 install_rpath : rootlibexecdir,
3385 install : true)
5c23128d 3386
349cc4a5 3387if conf.get('ENABLE_NETWORKD') == 1
6164ec4c
ZJS
3388 executable(
3389 'systemd-networkd',
3390 systemd_networkd_sources,
8d40961c 3391 include_directories : network_includes,
6164ec4c
ZJS
3392 link_with : [libnetworkd_core,
3393 libsystemd_network,
6164ec4c
ZJS
3394 networkd_link_with],
3395 dependencies : [threads],
3396 install_rpath : rootlibexecdir,
3397 install : true,
3398 install_dir : rootlibexecdir)
3399
3400 executable(
3401 'systemd-networkd-wait-online',
3402 systemd_networkd_wait_online_sources,
3403 include_directories : includes,
8d40961c 3404 link_with : [networkd_link_with],
6164ec4c
ZJS
3405 install_rpath : rootlibexecdir,
3406 install : true,
3407 install_dir : rootlibexecdir)
3408
3409 public_programs += executable(
3410 'networkctl',
3411 networkctl_sources,
8d40961c 3412 include_directories : libsystemd_network_includes,
6164ec4c
ZJS
3413 link_with : [libsystemd_network,
3414 networkd_link_with],
3415 install_rpath : rootlibexecdir,
3416 install : true,
3417 install_dir : rootbindir)
3418
3419 exe = executable(
3420 'systemd-network-generator',
3421 network_generator_sources,
3422 include_directories : includes,
3423 link_with : [networkd_link_with],
3424 install_rpath : rootlibexecdir,
3425 install : true,
3426 install_dir : rootlibexecdir)
fbaa1137
ZJS
3427
3428 if want_tests != 'false'
3429 test('test-network-generator-conversion',
3430 test_network_generator_conversion_sh,
3431 # https://github.com/mesonbuild/meson/issues/2681
3432 args : exe.full_path())
3433 endif
dcfe072a 3434endif
e821f6a9 3435
6164ec4c
ZJS
3436executable(
3437 'systemd-sulogin-shell',
73e994f2 3438 'src/sulogin-shell/sulogin-shell.c',
6164ec4c
ZJS
3439 include_directories : includes,
3440 link_with : [libshared],
3441 install_rpath : rootlibexecdir,
3442 install : true,
3443 install_dir : rootlibexecdir)
e821f6a9 3444
69e96427
ZJS
3445############################################################
3446
e2d41370
FB
3447custom_target(
3448 'systemd-runtest.env',
3449 output : 'systemd-runtest.env',
0f4c4f38
ZJS
3450 command : [sh, '-c',
3451 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
fce9abb2
ZJS
3452 project_source_root / 'test',
3453 project_build_root / 'catalog')],
e2d41370
FB
3454 build_by_default : true)
3455
a626cb15
ZJS
3456test_cflags = ['-DTEST_CODE=1']
3457# We intentionally do not do inline initializations with definitions for a
3458# bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
3459# use the variable unexpectedly. This triggers a lot of maybe-uninitialized
3460# false positives when the combination of -O2 and -flto is used. Suppress them.
3461if '-O2' in get_option('c_args') and '-flto=auto' in get_option('c_args')
3462 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
3463endif
3464
69e96427 3465foreach tuple : tests
37efbbd8 3466 sources = tuple[0]
5acb3cab
YW
3467 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3468 dependencies = tuple.length() > 2 ? tuple[2] : []
3469 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3470 condition = tuple.length() > 4 ? tuple[4] : ''
3471 type = tuple.length() > 5 ? tuple[5] : ''
3472 defs = tuple.length() > 6 ? tuple[6] : []
a626cb15 3473 defs += test_cflags
5acb3cab 3474 parallel = tuple.length() > 7 ? tuple[7] : true
37efbbd8
ZJS
3475 timeout = 30
3476
3477 name = sources[0].split('/')[-1].split('.')[0]
3478 if type.startswith('timeout=')
3479 timeout = type.split('=')[1].to_int()
3480 type = ''
3481 endif
3b2bdd62
ZJS
3482
3483 if condition == '' or conf.get(condition) == 1
37efbbd8
ZJS
3484 exe = executable(
3485 name,
3486 sources,
3487 include_directories : incs,
3488 link_with : link_with,
60722ad7
ZJS
3489 dependencies : [versiondep,
3490 dependencies],
37efbbd8 3491 c_args : defs,
3b2bdd62 3492 build_by_default : want_tests != 'false',
37efbbd8 3493 install_rpath : rootlibexecdir,
7cdd9783 3494 install : install_tests,
fce9abb2 3495 install_dir : testsdir / type)
37efbbd8
ZJS
3496
3497 if type == 'manual'
3498 message('@0@ is a manual test'.format(name))
3499 elif type == 'unsafe' and want_tests != 'unsafe'
3500 message('@0@ is an unsafe test'.format(name))
3b2bdd62 3501 elif want_tests != 'false'
37efbbd8
ZJS
3502 test(name, exe,
3503 env : test_env,
3504 timeout : timeout)
3505 endif
3506 else
3507 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
3508 endif
69e96427
ZJS
3509endforeach
3510
0632b4cd 3511exe = executable(
37efbbd8
ZJS
3512 'test-libsystemd-sym',
3513 test_libsystemd_sym_c,
3514 include_directories : includes,
3515 link_with : [libsystemd],
fd1939fb 3516 build_by_default : want_tests != 'false',
37efbbd8
ZJS
3517 install : install_tests,
3518 install_dir : testsdir)
938be089
ZJS
3519if want_tests != 'false'
3520 test('test-libsystemd-sym', exe)
3521endif
37ab1a25 3522
0632b4cd
ZJS
3523exe = executable(
3524 'test-libsystemd-static-sym',
3525 test_libsystemd_sym_c,
3526 include_directories : includes,
0632b4cd
ZJS
3527 link_with : [install_libsystemd_static],
3528 dependencies : [threads], # threads is already included in dependencies on the library,
3529 # but does not seem to get propagated. Add here as a work-around.
fd1939fb 3530 build_by_default : want_tests != 'false' and static_libsystemd_pic,
20f3d32d 3531 install : install_tests and static_libsystemd_pic,
0632b4cd 3532 install_dir : testsdir)
938be089 3533if want_tests != 'false' and static_libsystemd_pic
0632b4cd
ZJS
3534 test('test-libsystemd-static-sym', exe)
3535endif
37ab1a25 3536
0632b4cd 3537exe = executable(
37efbbd8
ZJS
3538 'test-libudev-sym',
3539 test_libudev_sym_c,
e4b127e2 3540 include_directories : libudev_includes,
a626cb15 3541 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
37efbbd8 3542 link_with : [libudev],
fd1939fb 3543 build_by_default : want_tests != 'false',
37efbbd8
ZJS
3544 install : install_tests,
3545 install_dir : testsdir)
938be089
ZJS
3546if want_tests != 'false'
3547 test('test-libudev-sym', exe)
3548endif
0632b4cd
ZJS
3549
3550exe = executable(
3551 'test-libudev-static-sym',
3552 test_libudev_sym_c,
e4b127e2 3553 include_directories : libudev_includes,
a626cb15 3554 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
0632b4cd 3555 link_with : [install_libudev_static],
fd1939fb 3556 build_by_default : want_tests != 'false' and static_libudev_pic,
20f3d32d 3557 install : install_tests and static_libudev_pic,
0632b4cd 3558 install_dir : testsdir)
938be089 3559if want_tests != 'false' and static_libudev_pic
0632b4cd
ZJS
3560 test('test-libudev-static-sym', exe)
3561endif
e0bec52f 3562
69e96427 3563############################################################
5c23128d 3564
7db7d5b7
JR
3565fuzzer_exes = []
3566
7e299ffe
ZJS
3567foreach tuple : fuzzers
3568 sources = tuple[0]
5acb3cab
YW
3569 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
3570 dependencies = tuple.length() > 2 ? tuple[2] : []
3571 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
3572 defs = tuple.length() > 4 ? tuple[4] : []
7e299ffe
ZJS
3573 link_args = []
3574
3575 if want_ossfuzz
3576 dependencies += fuzzing_engine
3577 elif want_libfuzzer
3578 if fuzzing_engine.found()
9c5c4677
EV
3579 dependencies += fuzzing_engine
3580 else
7e299ffe 3581 link_args += ['-fsanitize=fuzzer']
9c5c4677 3582 endif
7e299ffe
ZJS
3583 else
3584 sources += 'src/fuzz/fuzz-main.c'
3585 endif
7db7d5b7 3586
7e299ffe 3587 name = sources[0].split('/')[-1].split('.')[0]
7db7d5b7 3588
f78ad5f0 3589 exe = executable(
7e299ffe
ZJS
3590 name,
3591 sources,
3592 include_directories : [incs, include_directories('src/fuzz')],
3593 link_with : link_with,
3594 dependencies : dependencies,
a626cb15 3595 c_args : defs + test_cflags,
7e299ffe
ZJS
3596 link_args: link_args,
3597 install : false,
f78ad5f0
ZJS
3598 build_by_default : fuzzer_build)
3599 fuzzer_exes += exe
3600
3601 if want_tests != 'false'
3602 # Run the fuzz regression tests without any sanitizers enabled.
3603 # Additional invocations with sanitizers may be added below.
3604 foreach p : fuzz_regression_tests
3605 b = p.split('/')[-2]
3606 c = p.split('/')[-1]
3607
3608 if b == name
3609 test('@0@_@1@'.format(b, c),
3610 exe,
fce9abb2 3611 args : [project_source_root / p])
f78ad5f0
ZJS
3612 endif
3613 endforeach
3614 endif
7e299ffe 3615endforeach
7db7d5b7 3616
6839ce33 3617alias_target('fuzzers', fuzzer_exes)
7db7d5b7
JR
3618
3619############################################################
3620
378e9d2b 3621subdir('modprobe.d')
5c23128d
ZJS
3622subdir('sysctl.d')
3623subdir('sysusers.d')
3624subdir('tmpfiles.d')
4f10b807
ZJS
3625subdir('hwdb.d')
3626subdir('units')
e783f957 3627subdir('presets')
5c23128d
ZJS
3628subdir('network')
3629subdir('man')
3630subdir('shell-completion/bash')
3631subdir('shell-completion/zsh')
9e825ebf
FB
3632subdir('docs/sysvinit')
3633subdir('docs/var-log')
5c23128d 3634
5c23128d
ZJS
3635install_subdir('factory/etc',
3636 install_dir : factorydir)
3637
d7aa78c3
JT
3638if install_sysconfdir
3639 install_data('xorg/50-systemd-user.sh',
3640 install_dir : xinitrcdir)
3641endif
f09eb768 3642install_data('LICENSE.GPL2',
5c23128d 3643 'LICENSE.LGPL2.1',
f09eb768
LP
3644 'NEWS',
3645 'README',
eea98402 3646 'docs/CODING_STYLE.md',
1d1cb168 3647 'docs/DISTRO_PORTING.md',
9e825ebf 3648 'docs/ENVIRONMENT.md',
5425f8a5 3649 'docs/HACKING.md',
9e825ebf 3650 'docs/TRANSIENT-SETTINGS.md',
b6dc0d7d 3651 'docs/TRANSLATORS.md',
9e825ebf 3652 'docs/UIDS-GIDS.md',
2bc48bbd 3653 'docs/GVARIANT-SERIALIZATION.md',
5c23128d 3654 install_dir : docdir)
d68b342b 3655
9c6e32a2
LB
3656install_subdir('LICENSES',
3657 install_dir : docdir)
3658
7c22f07c
ZJS
3659meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3660meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
94e75a54 3661
d68b342b
ZJS
3662############################################################
3663
2d4efd1d
LB
3664# Ensure that changes to the docs/ directory do not break the
3665# basic Github pages build. But only run it in developer mode,
3666# as it might be fragile due to changes in the tooling, and it is
3667# not generally useful for users.
3668jekyll = find_program('jekyll', required : false)
3669if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
3670 test('github-pages',
3671 jekyll,
3672 args : ['build',
fce9abb2
ZJS
3673 '--source', project_source_root / 'docs',
3674 '--destination', project_build_root / '_site'])
2d4efd1d
LB
3675endif
3676
3677############################################################
3678
dd1e33c8 3679check_help = find_program('tools/check-help.sh')
005a29f2
ZJS
3680
3681foreach exec : public_programs
37efbbd8 3682 name = exec.full_path().split('/')[-1]
938be089
ZJS
3683 if want_tests != 'false'
3684 test('check-help-' + name,
dd1e33c8 3685 check_help,
c1cd6743 3686 args : exec.full_path())
938be089 3687 endif
005a29f2
ZJS
3688endforeach
3689
3690############################################################
3691
c6448ee3
ZJS
3692check_directives_sh = find_program('tools/check-directives.sh')
3693
3694if want_tests != 'false'
3695 test('check-directives',
3696 check_directives_sh,
34fde9f8 3697 args : [project_source_root, project_build_root])
c6448ee3
ZJS
3698endif
3699
3700############################################################
3701
52d4d1d3
ZJS
3702# Enable tests for all supported sanitizers
3703foreach tuple : sanitizers
3704 sanitizer = tuple[0]
3705 build = tuple[1]
b68dfb9e 3706
7a6397d2 3707 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
52d4d1d3
ZJS
3708 prev = ''
3709 foreach p : fuzz_regression_tests
3710 b = p.split('/')[-2]
3711 c = p.split('/')[-1]
3712
3713 name = '@0@:@1@'.format(b, sanitizer)
3714
3715 if name != prev
3716 if want_tests == 'false'
3717 message('Not compiling @0@ because tests is set to false'.format(name))
1763ef1d 3718 elif fuzz_tests
52d4d1d3
ZJS
3719 exe = custom_target(
3720 name,
3721 output : name,
3722 depends : build,
0f4c4f38 3723 command : [ln, '-fs',
fce9abb2 3724 build.full_path() / b,
52d4d1d3
ZJS
3725 '@OUTPUT@'],
3726 build_by_default : true)
3727 else
1763ef1d 3728 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
52d4d1d3
ZJS
3729 endif
3730 endif
3731 prev = name
3732
1763ef1d 3733 if fuzz_tests
0f82a2ab 3734 test('@0@_@1@_@2@'.format(b, c, sanitizer),
52d4d1d3 3735 env,
89767158
EV
3736 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
3737 timeout : 60,
52d4d1d3 3738 args : [exe.full_path(),
fce9abb2 3739 project_source_root / p])
52d4d1d3
ZJS
3740 endif
3741 endforeach
b68dfb9e
ZJS
3742 endif
3743endforeach
3744
52d4d1d3 3745
b68dfb9e
ZJS
3746############################################################
3747
0700e8ba 3748if git.found()
37efbbd8 3749 all_files = run_command(
0f4c4f38
ZJS
3750 env, '-u', 'GIT_WORK_TREE',
3751 git, '--git-dir=@0@/.git'.format(project_source_root),
a412ec57
ZJS
3752 'ls-files', ':/*.[ch]')
3753
37efbbd8 3754 all_files = files(all_files.stdout().split())
d68b342b 3755
e85a690b 3756 custom_target(
0700e8ba 3757 'tags',
e85a690b 3758 output : 'tags',
1485aacb 3759 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
2f09974f 3760 run_target(
0700e8ba 3761 'ctags',
1485aacb 3762 command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files)
d68b342b 3763endif
177929c2
ZJS
3764
3765if git.found()
dd1e33c8 3766 git_contrib_sh = find_program('tools/git-contrib.sh')
a923e085 3767 run_target(
37efbbd8 3768 'git-contrib',
dd1e33c8 3769 command : [git_contrib_sh])
177929c2 3770endif
dd6ab3df
ZJS
3771
3772if git.found()
3773 git_head = run_command(
3774 git,
0f4c4f38
ZJS
3775 '--git-dir=@0@/.git'.format(project_source_root),
3776 'rev-parse', 'HEAD').stdout().strip()
dd6ab3df
ZJS
3777 git_head_short = run_command(
3778 git,
0f4c4f38
ZJS
3779 '--git-dir=@0@/.git'.format(project_source_root),
3780 'rev-parse', '--short=7', 'HEAD').stdout().strip()
dd6ab3df
ZJS
3781
3782 run_target(
3783 'git-snapshot',
0f4c4f38 3784 command : [git, 'archive',
1485aacb 3785 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
dd6ab3df
ZJS
3786 git_head_short),
3787 '--prefix', 'systemd-@0@/'.format(git_head),
3788 'HEAD'])
3789endif
829257d1
ZJS
3790
3791############################################################
3792
dd1e33c8 3793check_api_docs_sh = find_program('tools/check-api-docs.sh')
51b13863
LP
3794run_target(
3795 'check-api-docs',
3796 depends : [man, libsystemd, libudev],
dd1e33c8 3797 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
51b13863 3798
f12c5d36
ZJS
3799alias_target('update-dbus-docs', update_dbus_docs)
3800alias_target('update-man-rules', update_man_rules)
e3c368f6 3801
51b13863 3802############################################################
829257d1
ZJS
3803
3804alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3805 '@@0@'.format(time_epoch)).stdout().strip()
12085ebb
ZJS
3806
3807summary({
3808 'build mode' : get_option('mode'),
3809 'split /usr' : split_usr,
3810 'split bin-sbin' : split_bin,
3811 'prefix directory' : prefixdir,
3812 'rootprefix directory' : rootprefixdir,
3813 'sysconf directory' : sysconfdir,
3814 'include directory' : includedir,
3815 'lib directory' : libdir,
3816 'rootlib directory' : rootlibdir,
3817 'SysV init scripts' : sysvinit_path,
3818 'SysV rc?.d directories' : sysvrcnd_path,
3819 'PAM modules directory' : pamlibdir,
3820 'PAM configuration directory' : pamconfdir,
3821 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
3822 'RPM macros directory' : rpmmacrosdir,
3823 'modprobe.d directory' : modprobedir,
3824 'D-Bus policy directory' : dbuspolicydir,
3825 'D-Bus session directory' : dbussessionservicedir,
3826 'D-Bus system directory' : dbussystemservicedir,
3827 'bash completions directory' : bashcompletiondir,
3828 'zsh completions directory' : zshcompletiondir,
3829 'extra start script' : get_option('rc-local'),
3830 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
3831 get_option('debug-tty')),
3832 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
3833 conf.get('SYSTEM_ALLOC_UID_MIN')),
3834 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
3835 conf.get('SYSTEM_ALLOC_GID_MIN')),
3836 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
3837 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
3838 'static UID/GID allocations' : ' '.join(static_ugids),
3839 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
3840 'render group access mode' : get_option('group-render-mode'),
3841 'certificate root directory' : get_option('certificate-root'),
3842 'support URL' : support_url,
3843 'nobody user name' : nobody_user,
3844 'nobody group name' : nobody_group,
3845 'fallback hostname' : get_option('fallback-hostname'),
3846 'default DNSSEC mode' : default_dnssec,
3847 'default DNS-over-TLS mode' : default_dns_over_tls,
3848 'default mDNS mode' : default_mdns,
3849 'default LLMNR mode' : default_llmnr,
3850 'default DNS servers' : dns_servers.split(' '),
3851 'default NTP servers' : ntp_servers.split(' '),
3852 'default cgroup hierarchy' : default_hierarchy,
3853 'default net.naming-scheme value' : default_net_naming_scheme,
3854 'default KillUserProcesses value' : kill_user_processes,
3855 'default locale' : default_locale,
3856 'default user $PATH' :
3857 default_user_path != '' ? default_user_path : '(same as system services)',
3858 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
3859 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
829257d1
ZJS
3860
3861# TODO:
3862# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3863# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3864# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3865
349cc4a5 3866if conf.get('ENABLE_EFI') == 1
f064b40e 3867 summary({'EFI arch' : efi_arch},
12085ebb 3868 section : 'Extensible Firmware Interface')
829257d1
ZJS
3869
3870 if have_gnu_efi
12085ebb
ZJS
3871 summary({
3872 'EFI machine type' : EFI_MACHINE_TYPE_NAME,
3873 'EFI CC' : '@0@'.format(' '.join(efi_cc)),
3874 'EFI lds' : efi_lds,
3875 'EFI crt0' : efi_crt0,
3876 'EFI include directory' : efi_incdir},
3877 section : 'Extensible Firmware Interface')
829257d1
ZJS
3878 endif
3879endif
3880
3881found = []
3882missing = []
3883
3884foreach tuple : [
56d68e71
ZJS
3885 # dependencies
3886 ['ACL'],
829257d1 3887 ['AUDIT'],
829257d1 3888 ['AppArmor'],
56d68e71
ZJS
3889 ['IMA'],
3890 ['PAM'],
829257d1 3891 ['SECCOMP'],
56d68e71 3892 ['SELinux'],
829257d1 3893 ['SMACK'],
56d68e71
ZJS
3894 ['blkid'],
3895 ['elfutils'],
829257d1 3896 ['gcrypt'],
829257d1 3897 ['gnutls'],
7d861e12 3898 ['libbpf'],
56d68e71 3899 ['libcryptsetup'],
d1ae38d8 3900 ['libcryptsetup-plugins'],
829257d1 3901 ['libcurl'],
56d68e71
ZJS
3902 ['libfdisk'],
3903 ['libfido2'],
829257d1 3904 ['libidn'],
56d68e71 3905 ['libidn2'],
829257d1 3906 ['libiptc'],
56d68e71
ZJS
3907 ['microhttpd'],
3908 ['openssl'],
3909 ['p11kit'],
3910 ['pcre2'],
3911 ['pwquality'],
3912 ['qrencode'],
3913 ['tpm2'],
3914 ['xkbcommon'],
3915
3916 # compression libs
3917 ['zstd'],
3918 ['lz4'],
3919 ['xz'],
3920 ['zlib'],
3921 ['bzip2'],
3922
3923 # components
3924 ['backlight'],
829257d1 3925 ['binfmt'],
7d861e12 3926 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
56d68e71 3927 ['coredump'],
829257d1 3928 ['environment.d'],
56d68e71
ZJS
3929 ['efi'],
3930 ['gnu-efi', have_gnu_efi],
829257d1 3931 ['firstboot'],
56d68e71
ZJS
3932 ['hibernate'],
3933 ['homed'],
3934 ['hostnamed'],
3935 ['hwdb'],
3936 ['importd'],
3937 ['initrd'],
3938 ['kernel-install', get_option('kernel-install')],
3939 ['localed'],
829257d1
ZJS
3940 ['logind'],
3941 ['machined'],
56d68e71
ZJS
3942 ['networkd'],
3943 ['nss-myhostname'],
3944 ['nss-mymachines'],
3945 ['nss-resolve'],
3946 ['nss-systemd'],
3947 ['oomd'],
61d0578b 3948 ['portabled'],
56d68e71
ZJS
3949 ['pstore'],
3950 ['quotacheck'],
3951 ['randomseed'],
3952 ['repart'],
3953 ['resolve'],
3954 ['rfkill'],
9bca4ae4 3955 ['sysext'],
56d68e71
ZJS
3956 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
3957 ['sysusers'],
829257d1
ZJS
3958 ['timedated'],
3959 ['timesyncd'],
56d68e71
ZJS
3960 ['tmpfiles'],
3961 ['userdb'],
3962 ['vconsole'],
3963 ['xdg-autostart'],
3964
3965 # optional features
56d68e71 3966 ['idn'],
829257d1 3967 ['polkit'],
56d68e71
ZJS
3968 ['nscd'],
3969 ['legacy-pkla', install_polkit_pkla],
829257d1 3970 ['kmod'],
829257d1
ZJS
3971 ['dbus'],
3972 ['glib'],
829257d1 3973 ['tpm'],
ba081955
ZJS
3974 ['man pages', want_man],
3975 ['html pages', want_html],
3976 ['man page indices', want_man and have_lxml],
829257d1 3977 ['SysV compat'],
56d68e71 3978 ['compat-mutable-uid-boundaries'],
829257d1
ZJS
3979 ['utmp'],
3980 ['ldconfig'],
ba081955
ZJS
3981 ['adm group', get_option('adm-group')],
3982 ['wheel group', get_option('wheel-group')],
b14e1b43 3983 ['gshadow'],
829257d1
ZJS
3984 ['debug hashmap'],
3985 ['debug mmap cache'],
d6601495 3986 ['debug siphash'],
ba081955
ZJS
3987 ['valgrind', conf.get('VALGRIND') == 1],
3988 ['trace logging', conf.get('LOG_TRACE') == 1],
3989 ['install tests', install_tests],
19d8c9c9
LP
3990 ['link-udev-shared', get_option('link-udev-shared')],
3991 ['link-systemctl-shared', get_option('link-systemctl-shared')],
5ac8b50d 3992 ['link-networkd-shared', get_option('link-networkd-shared')],
fd74a13e 3993 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
ceedbf81 3994 ['fexecve'],
18b49798 3995 ['standalone-binaries', get_option('standalone-binaries')],
829257d1
ZJS
3996]
3997
af4d7860
ZJS
3998 if tuple.length() >= 2
3999 cond = tuple[1]
4000 else
829257d1
ZJS
4001 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
4002 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
349cc4a5 4003 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
829257d1
ZJS
4004 endif
4005 if cond
5a8b1640 4006 found += tuple[0]
829257d1 4007 else
5a8b1640 4008 missing += tuple[0]
829257d1
ZJS
4009 endif
4010endforeach
4011
c716c253
ZJS
4012if static_libsystemd == 'false'
4013 missing += 'static-libsystemd'
4014else
4015 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
4016endif
4017
4018if static_libudev == 'false'
4019 missing += 'static-libudev'
4020else
4021 found += 'static-libudev(@0@)'.format(static_libudev)
4022endif
4023
237f2da9
ZJS
4024if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
4025 found += 'DNS-over-TLS(gnutls)'
4026elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
4027 found += 'DNS-over-TLS(openssl)'
4028else
4029 missing += 'DNS-over-TLS'
4030endif
4031
12085ebb
ZJS
4032summary({
4033 'enabled' : ', '.join(found),
4034 'disabled' : ', '.join(missing)},
4035 section : 'Features')
9a8e64b0
ZJS
4036
4037if rootprefixdir != rootprefix_default
8ea9fad7
YW
4038 warning('\n' +
4039 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
4040 'systemd used fixed names for unit file directories and other paths, so anything\n' +
4041 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
9a8e64b0 4042endif