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