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