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