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