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