]> git.ipfire.org Git - thirdparty/systemd.git/blame - meson.build
meson: include .cc files in tags too
[thirdparty/systemd.git] / meson.build
CommitLineData
db9ecf05 1# SPDX-License-Identifier: LGPL-2.1-or-later
3a726fcd 2
5c23128d 3project('systemd', 'c',
a1429c64 4 version : '253',
5c23128d
ZJS
5 license : 'LGPLv2+',
6 default_options: [
2b2dbcbb 7 'c_std=gnu11',
37efbbd8
ZJS
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
a1429c64
LB
16libsystemd_version = '0.36.0'
17libudev_version = '1.7.6'
56d50ab1 18
5c23128d 19conf = configuration_data()
a8c03388 20conf.set_quoted('PROJECT_URL', 'https://systemd.io/')
e11a25ca 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')
011a03a3
ZJS
36verification = get_option('log-message-verification')
37if verification == 'auto'
38 verification = conf.get('BUILD_MODE_DEVELOPER') == 1
39else
40 verification = verification == 'true'
41endif
42conf.set10('LOG_MESSAGE_VERIFICATION', verification)
839bdf25 43
c09edc79
ZJS
44want_ossfuzz = get_option('oss-fuzz')
45want_libfuzzer = get_option('llvm-fuzz')
c29537f3 46if want_ossfuzz and want_libfuzzer
6b8d32ea 47 error('only one of oss-fuzz or llvm-fuzz can be specified')
c09edc79 48endif
87ac55a1 49
678ba020 50skip_deps = want_ossfuzz or get_option('skip-deps')
6b8d32ea 51fuzzer_build = want_ossfuzz or want_libfuzzer
c09edc79 52
c4f883b7
ZJS
53# If we're building *not* for actual fuzzing, allow input samples of any size
54# (for testing and for reproduction of issues discovered with previously-higher
55# limits).
56conf.set10('FUZZ_USE_SIZE_LIMIT', fuzzer_build)
57
493cd503
ZJS
58# We'll set this to '1' for EFI builds in a different place.
59conf.set10('SD_BOOT', false)
60
3f871f12
ZJS
61# Create a title-less summary section early, so it ends up first in the output.
62# More items are added later after they have been detected.
63summary({'build mode' : get_option('mode')})
64
5c23128d
ZJS
65#####################################################################
66
003c8879 67# Try to install the git pre-commit hook
e2d612a8
ZJS
68add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
69if add_git_hook_sh.found()
e92777d2 70 git_hook = run_command(add_git_hook_sh, check : false)
e2d612a8
ZJS
71 if git_hook.returncode() == 0
72 message(git_hook.stdout().strip())
73 endif
003c8879
ZJS
74endif
75
76#####################################################################
77
4cf8a609 78fs = import('fs')
2675413e 79if get_option('split-usr') == 'auto'
4cf8a609 80 split_usr = not fs.is_symlink('/bin')
2675413e
ZJS
81else
82 split_usr = get_option('split-usr') == 'true'
83endif
9afd5e7b
ZJS
84if split_usr
85 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
86 + ' split-usr mode is going to be removed\n' +
87 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
88endif
671f0f8d
ZJS
89conf.set10('HAVE_SPLIT_USR', split_usr,
90 description : '/usr/bin and /bin directories are separate')
9a8e64b0 91
157baa87 92if get_option('split-bin') == 'auto'
4cf8a609 93 split_bin = not fs.is_symlink('/usr/sbin')
157baa87
ZJS
94else
95 split_bin = get_option('split-bin') == 'true'
96endif
671f0f8d
ZJS
97conf.set10('HAVE_SPLIT_BIN', split_bin,
98 description : 'bin and sbin directories are separate')
157baa87 99
74344a17 100rootprefixdir = get_option('rootprefix')
74344a17
ZJS
101# Unusual rootprefixdir values are used by some distros
102# (see https://github.com/systemd/systemd/pull/7461).
ba7f4ae6 103rootprefix_default = split_usr ? '/' : '/usr'
9a8e64b0
ZJS
104if rootprefixdir == ''
105 rootprefixdir = rootprefix_default
74344a17 106endif
23bdba61 107rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
5c23128d 108
8ef8f3d5
FB
109have_standalone_binaries = get_option('standalone-binaries')
110
5c23128d
ZJS
111sysvinit_path = get_option('sysvinit-path')
112sysvrcnd_path = get_option('sysvrcnd-path')
348b4437 113conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
349cc4a5 114 description : 'SysV init scripts and rcN.d links are supported')
6fe23ff3 115conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
5c23128d 116
cdf7ad38
NL
117if get_option('hibernate') and not get_option('initrd')
118 error('hibernate depends on initrd')
119endif
120
a8b627aa
LP
121conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
122conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
09dad04c 123conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
a8b627aa 124
fce9abb2
ZJS
125# Meson ignores the preceding arguments when joining paths if an absolute
126# component is encountered, so this should canonicalize various paths when they
127# are absolute or relative.
5c23128d
ZJS
128prefixdir = get_option('prefix')
129if not prefixdir.startswith('/')
37efbbd8 130 error('Prefix is not absolute: "@0@"'.format(prefixdir))
5c23128d 131endif
b2d74870 132if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
d895e10a
ZJS
133 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
134 rootprefixdir, prefixdir))
135endif
136
fce9abb2
ZJS
137bindir = prefixdir / get_option('bindir')
138libdir = prefixdir / get_option('libdir')
139sysconfdir = prefixdir / get_option('sysconfdir')
140includedir = prefixdir / get_option('includedir')
141datadir = prefixdir / get_option('datadir')
142localstatedir = '/' / get_option('localstatedir')
5c23128d 143
fce9abb2
ZJS
144rootbindir = rootprefixdir / 'bin'
145rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin')
146rootlibexecdir = rootprefixdir / 'lib/systemd'
5c23128d
ZJS
147
148rootlibdir = get_option('rootlibdir')
149if rootlibdir == ''
e91119c3
MG
150 # This will be a relative path if libdir is in prefix.
151 rootlibdir = get_option('libdir')
152endif
153if not rootlibdir.startswith('/')
154 # If we have a relative path, add rootprefixdir to the front.
155 rootlibdir = rootprefixdir / rootlibdir
5c23128d 156endif
5fb22561 157rootpkglibdir = rootlibdir / 'systemd'
5c23128d 158
225d08b8
JT
159install_sysconfdir = get_option('install-sysconfdir') != 'false'
160install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
5c23128d 161# Dirs of external packages
fce9abb2
ZJS
162pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig'
163pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
164polkitpolicydir = datadir / 'polkit-1/actions'
165polkitrulesdir = datadir / 'polkit-1/rules.d'
166polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
167xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d'
8a38aac3
YW
168rpmmacrosdir = get_option('rpmmacrosdir')
169if rpmmacrosdir != 'no'
fce9abb2 170 rpmmacrosdir = prefixdir / rpmmacrosdir
8a38aac3 171endif
fce9abb2 172modprobedir = rootprefixdir / 'lib/modprobe.d'
5c23128d
ZJS
173
174# Our own paths
fce9abb2
ZJS
175pkgdatadir = datadir / 'systemd'
176environmentdir = prefixdir / 'lib/environment.d'
177pkgsysconfdir = sysconfdir / 'systemd'
178userunitdir = prefixdir / 'lib/systemd/user'
179userpresetdir = prefixdir / 'lib/systemd/user-preset'
180tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
107795a7 181usertmpfilesdir = prefixdir / 'share/user-tmpfiles.d'
fce9abb2
ZJS
182sysusersdir = prefixdir / 'lib/sysusers.d'
183sysctldir = prefixdir / 'lib/sysctl.d'
184binfmtdir = prefixdir / 'lib/binfmt.d'
185modulesloaddir = prefixdir / 'lib/modules-load.d'
186networkdir = rootprefixdir / 'lib/systemd/network'
fce9abb2
ZJS
187systemgeneratordir = rootlibexecdir / 'system-generators'
188usergeneratordir = prefixdir / 'lib/systemd/user-generators'
189systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
190userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
191systemshutdowndir = rootlibexecdir / 'system-shutdown'
192systemsleepdir = rootlibexecdir / 'system-sleep'
193systemunitdir = rootprefixdir / 'lib/systemd/system'
194systempresetdir = rootprefixdir / 'lib/systemd/system-preset'
195udevlibexecdir = rootprefixdir / 'lib/udev'
196udevrulesdir = udevlibexecdir / 'rules.d'
197udevhwdbdir = udevlibexecdir / 'hwdb.d'
198catalogdir = prefixdir / 'lib/systemd/catalog'
641e2124 199kerneldir = prefixdir / 'lib/kernel'
200kernelinstalldir = kerneldir / 'install.d'
fce9abb2
ZJS
201factorydir = datadir / 'factory'
202bootlibdir = prefixdir / 'lib/systemd/boot/efi'
203testsdir = prefixdir / 'lib/systemd/tests'
26c2b302 204unittestsdir = testsdir / 'unit-tests'
539ee7ab 205testdata_dir = testsdir / 'testdata'
fce9abb2
ZJS
206systemdstatedir = localstatedir / 'lib/systemd'
207catalogstatedir = systemdstatedir / 'catalog'
208randomseeddir = localstatedir / 'lib/systemd'
209profiledir = rootlibexecdir / 'portable' / 'profile'
210ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
5c23128d 211
75aaade1
TB
212docdir = get_option('docdir')
213if docdir == ''
fce9abb2 214 docdir = datadir / 'doc/systemd'
75aaade1
TB
215endif
216
5c23128d
ZJS
217pamlibdir = get_option('pamlibdir')
218if pamlibdir == ''
fce9abb2 219 pamlibdir = rootlibdir / 'security'
5c23128d
ZJS
220endif
221
222pamconfdir = get_option('pamconfdir')
223if pamconfdir == ''
fce9abb2 224 pamconfdir = prefixdir / 'lib/pam.d'
5c23128d
ZJS
225endif
226
d1ae38d8
OK
227libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir')
228if libcryptsetup_plugins_dir == ''
fce9abb2 229 libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup'
d1ae38d8
OK
230endif
231
444d5863 232memory_accounting_default = get_option('memory-accounting-default')
36cf4507 233status_unit_format_default = get_option('status-unit-format-default')
819c0dcb
ZJS
234if status_unit_format_default == 'auto'
235 status_unit_format_default = conf.get('BUILD_MODE_DEVELOPER') == 1 ? 'name' : 'description'
236endif
444d5863 237
491bf10c
ZJS
238conf.set_quoted('BINFMT_DIR', binfmtdir)
239conf.set_quoted('BOOTLIBDIR', bootlibdir)
fce9abb2 240conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database')
491bf10c 241conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
6fe23ff3 242conf.set_quoted('DOC_DIR', docdir)
fce9abb2 243conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd')
491bf10c
ZJS
244conf.set_quoted('ENVIRONMENT_DIR', environmentdir)
245conf.set_quoted('INCLUDE_DIR', includedir)
246conf.set_quoted('LIBDIR', libdir)
247conf.set_quoted('MODPROBE_DIR', modprobedir)
248conf.set_quoted('MODULESLOAD_DIR', modulesloaddir)
5c23128d 249conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
fce9abb2 250conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent')
491bf10c 251conf.set_quoted('PREFIX', prefixdir)
fce9abb2 252conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed')
491bf10c 253conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
452d2dfd 254conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
491bf10c
ZJS
255conf.set_quoted('ROOTBINDIR', rootbindir)
256conf.set_quoted('ROOTLIBDIR', rootlibdir)
257conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
258conf.set_quoted('ROOTPREFIX', rootprefixdir)
259conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
260conf.set_quoted('SYSCONF_DIR', sysconfdir)
261conf.set_quoted('SYSCTL_DIR', sysctldir)
fce9abb2
ZJS
262conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl')
263conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd')
491bf10c 264conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
fce9abb2
ZJS
265conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent')
266conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup')
267conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export')
268conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck')
269conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs')
270conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework')
271conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs')
272conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import')
1f1a2243 273conf.set_quoted('SYSTEMD_INTEGRITYSETUP_PATH', rootlibexecdir / 'systemd-integritysetup')
fce9abb2
ZJS
274conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map')
275conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map')
276conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs')
277conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull')
278conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown')
539ee7ab 279conf.set_quoted('SYSTEMD_TEST_DATA', testdata_dir)
fce9abb2
ZJS
280conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent')
281conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper')
282conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork')
283conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup')
284conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system')
491bf10c 285conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir)
96d33e4a 286conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
491bf10c
ZJS
287conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
288conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
5c23128d
ZJS
289conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
290conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
491bf10c
ZJS
291conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
292conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
835cf75a
ZJS
293conf.set_quoted('SYSUSERS_DIR', sysusersdir)
294conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
107795a7 295conf.set_quoted('USER_TMPFILES_DIR', usertmpfilesdir)
5c23128d 296conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
491bf10c
ZJS
297conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
298conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
fce9abb2 299conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user')
491bf10c
ZJS
300conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
301conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
302conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
fce9abb2 303conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg')
491bf10c 304conf.set_quoted('USER_PRESET_DIR', userpresetdir)
fce9abb2 305conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg')
491bf10c
ZJS
306
307conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
e5d86ebe 308conf.set10('ENABLE_URLIFY', get_option('urlify'))
491bf10c 309conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
30538ff1 310conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
36cf4507 311conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
e11a25ca 312conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default)
5c23128d 313
e4c7b5f5
ZJS
314conf.set('DEFAULT_TIMEOUT_SEC', get_option('default-timeout-sec'))
315conf.set('DEFAULT_USER_TIMEOUT_SEC', get_option('default-user-timeout-sec'))
316conf.set('UPDATE_HELPER_USER_TIMEOUT_SEC', get_option('update-helper-user-timeout-sec'))
317
93651582
JL
318conf.set10('FIRST_BOOT_FULL_PRESET', get_option('first-boot-full-preset'))
319
5c23128d
ZJS
320#####################################################################
321
322cc = meson.get_compiler('c')
92148283
JJ
323userspace_c_args = []
324userspace_c_ld_args = []
b68dfb9e 325meson_build_sh = find_program('tools/meson-build.sh')
5c23128d 326
d3da291e
ZJS
327want_tests = get_option('tests')
328slow_tests = want_tests != 'false' and get_option('slow-tests')
c56463fd 329fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
d3da291e
ZJS
330install_tests = get_option('install-tests')
331
46e63a2a 332if add_languages('cpp', required : fuzzer_build)
3b2bdd62 333 # Used only for tests
e9f4f566
ZJS
334 cxx = meson.get_compiler('cpp')
335 cxx_cmd = ' '.join(cxx.cmd_array())
1b2acaa7 336else
9b0ca019 337 cxx_cmd = ''
94e2523b
ZJS
338endif
339
31e57a35 340if want_libfuzzer
9c5c4677
EV
341 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
342 if fuzzing_engine.found()
92148283 343 userspace_c_args += '-fsanitize-coverage=trace-pc-guard,trace-cmp'
9c5c4677 344 elif cc.has_argument('-fsanitize=fuzzer-no-link')
92148283 345 userspace_c_args += '-fsanitize=fuzzer-no-link'
9c5c4677
EV
346 else
347 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
348 endif
c09edc79 349elif want_ossfuzz
7db7d5b7
JR
350 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
351endif
352
e9f4f566
ZJS
353# Those generate many false positives, and we do not want to change the code to
354# avoid them.
355basic_disabled_warnings = [
e9f4f566 356 '-Wno-missing-field-initializers',
505ab9dd 357 '-Wno-unused-parameter',
e9f4f566 358]
e9f4f566 359
65267363 360possible_common_cc_flags = [
fc568837
ZJS
361 '-Warray-bounds', # clang
362 '-Warray-bounds=2',
505ab9dd
YW
363 '-Wdate-time',
364 '-Wendif-labels',
365 '-Werror=format=2',
a4ea5d19 366 '-Werror=format-signedness',
505ab9dd 367 '-Werror=implicit-function-declaration',
a0d613ec 368 '-Werror=implicit-int',
505ab9dd 369 '-Werror=incompatible-pointer-types',
ebbb1e36 370 '-Werror=int-conversion',
0b482b37
JJ
371 '-Werror=missing-declarations',
372 '-Werror=missing-prototypes',
505ab9dd 373 '-Werror=overflow',
48c67fdf 374 '-Werror=override-init',
505ab9dd
YW
375 '-Werror=return-type',
376 '-Werror=shift-count-overflow',
377 '-Werror=shift-overflow=2',
30a4ddff 378 '-Werror=undef',
505ab9dd 379 '-Wfloat-equal',
c0f5d58c
JJ
380 # gperf prevents us from enabling this because it does not emit fallthrough
381 # attribute with clang.
382 #'-Wimplicit-fallthrough',
505ab9dd
YW
383 '-Wimplicit-fallthrough=5',
384 '-Winit-self',
30a4ddff
YW
385 '-Wlogical-op',
386 '-Wmissing-include-dirs',
505ab9dd
YW
387 '-Wmissing-noreturn',
388 '-Wnested-externs',
30a4ddff
YW
389 '-Wold-style-definition',
390 '-Wpointer-arith',
30a4ddff 391 '-Wredundant-decls',
30a4ddff 392 '-Wshadow',
30a4ddff 393 '-Wstrict-aliasing=2',
505ab9dd
YW
394 '-Wstrict-prototypes',
395 '-Wsuggest-attribute=noreturn',
054ed430 396 '-Wunused-function',
30a4ddff 397 '-Wwrite-strings',
31560245 398 '-Wzero-length-bounds',
bf7efeb1
FB
399
400 # negative arguments are correctly detected starting with meson 0.46.
eed33623
ZJS
401 '-Wno-error=#warnings', # clang
402 '-Wno-string-plus-int', # clang
fc568837 403
0b482b37
JJ
404 '-fdiagnostics-show-option',
405 '-fno-common',
48e1b2c2
JJ
406 '-fstack-protector',
407 '-fstack-protector-strong',
fc568837 408 '-fstrict-flex-arrays',
48e1b2c2
JJ
409 '--param=ssp-buffer-size=4',
410]
411
412possible_common_link_flags = [
413 '-fstack-protector',
30a4ddff
YW
414]
415
b528a628
ZJS
416c_args = get_option('c_args')
417
60f97fee 418# Our json library does not support -ffinite-math-only, which is enabled by -Ofast or -ffast-math.
53403091 419if (('-Ofast' in c_args or '-ffast-math' in c_args or '-ffinite-math-only' in c_args) and '-fno-finite-math-only' not in c_args)
60f97fee
YW
420 error('-Ofast, -ffast-math, or -ffinite-math-only is specified in c_args.')
421endif
422
a17e5478 423# Disable -Wmaybe-uninitialized when compiling with -Os/-O1/-O3/etc. There are
68c98a41
ZJS
424# too many false positives with gcc >= 8. Effectively, we only test with -O0
425# and -O2; this should be enough to catch most important cases without too much
426# busywork. See https://github.com/systemd/systemd/pull/19226.
427if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
b528a628
ZJS
428 cc.version().version_compare('<10') or
429 '-Os' in c_args or
430 '-O1' in c_args or
431 '-O3' in c_args or
432 '-Og' in c_args)
65267363 433 possible_common_cc_flags += '-Wno-maybe-uninitialized'
68c98a41
ZJS
434endif
435
bc2a4af2
ZJS
436# Disable -Wno-unused-result with gcc, see
437# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
438if cc.get_id() == 'gcc'
439 possible_common_cc_flags += '-Wno-unused-result'
440endif
441
30a4ddff 442# --as-needed and --no-undefined are provided by meson by default,
9247df5a 443# run 'meson configure' to see what is enabled
30a4ddff 444possible_link_flags = [
42e3bb35 445 '-Wl,--fatal-warnings',
30a4ddff 446 '-Wl,-z,now',
42e3bb35 447 '-Wl,-z,relro',
30a4ddff 448]
5c23128d 449
42e3bb35
JJ
450if get_option('b_sanitize') == 'none'
451 possible_link_flags += '-Wl,--warn-common'
452endif
453
30a4ddff 454if cc.get_id() == 'clang'
65267363 455 possible_common_cc_flags += [
30a4ddff
YW
456 '-Wno-typedef-redefinition',
457 '-Wno-gnu-variable-sized-type-not-at-end',
458 ]
459endif
460
1a4e3927
JJ
461if get_option('mode') == 'release'
462 # We could enable 'pattern' for developer mode, but that can interfere with
463 # valgrind and sanitizer builds. Also, clang does not zero-initialize unions,
464 # breaking some of our code (https://reviews.llvm.org/D68115).
465 possible_common_cc_flags += '-ftrivial-auto-var-init=zero'
466endif
467
92148283 468possible_cc_flags = [
16e09d51 469 '-fno-strict-aliasing',
afd8e1d9 470 '-fstrict-flex-arrays=1',
16e09d51 471 '-fvisibility=hidden',
16e09d51
YW
472]
473
30a4ddff 474if get_option('buildtype') != 'debug'
16e09d51 475 possible_cc_flags += [
30a4ddff
YW
476 '-ffunction-sections',
477 '-fdata-sections',
478 ]
479
480 possible_link_flags += '-Wl,--gc-sections'
481endif
482
82390022
DDM
483if get_option('mode') == 'developer'
484 possible_cc_flags += '-fno-omit-frame-pointer'
485endif
486
92148283
JJ
487add_project_arguments(
488 cc.get_supported_arguments(
489 basic_disabled_warnings,
490 possible_common_cc_flags
491 ),
492 language : 'c')
493
48e1b2c2
JJ
494add_project_link_arguments(
495 cc.get_supported_link_arguments(possible_common_link_flags),
496 language : 'c')
497
92148283
JJ
498userspace_c_args += cc.get_supported_arguments(possible_cc_flags)
499userspace_c_ld_args += cc.get_supported_link_arguments(possible_link_flags)
30a4ddff 500
94c0c5b7
ZJS
501have = cc.has_argument('-Wzero-length-bounds')
502conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
503
9e70f2f8 504if cc.compiles('''
5c23128d
ZJS
505 #include <time.h>
506 #include <inttypes.h>
507 typedef uint64_t usec_t;
508 usec_t now(clockid_t clock);
509 int main(void) {
510 struct timespec now;
511 return 0;
512 }
38c1c96d 513''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
37efbbd8 514 add_project_arguments('-Werror=shadow', language : 'c')
5c23128d
ZJS
515endif
516
e9f4f566
ZJS
517if cxx_cmd != ''
518 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
519endif
520
0e3cc902 521cpp = ' '.join(cc.cmd_array()) + ' -E'
9cc0e6e9 522
6695c200
ZJS
523has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
524
5c23128d
ZJS
525#####################################################################
526# compilation result tests
527
2c201c21
ZJS
528conf.set('_GNU_SOURCE', true)
529conf.set('__SANE_USERSPACE_TYPES__', true)
6695c200 530conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
5c23128d 531
5c23128d
ZJS
532conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
533conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
534conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
535conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
3112d756 536conf.set('SIZEOF_TIMEX_MEMBER', cc.sizeof('typeof(((struct timex *)0)->freq)', prefix : '#include <sys/timex.h>'))
5c23128d 537
2736a0c6 538long_max = cc.compute_int(
539 'LONG_MAX',
540 prefix : '#include <limits.h>',
541 guess : 0x7FFFFFFFFFFFFFFF,
542 high : 0x7FFFFFFFFFFFFFFF)
a5fac1df
ZJS
543assert(long_max > 100000)
544conf.set_quoted('LONG_MAX_STR', '@0@'.format(long_max))
545
5c23128d
ZJS
546decl_headers = '''
547#include <uchar.h>
84e8edec 548#include <sys/mount.h>
4c2e1b39 549#include <sys/stat.h>
5c23128d 550'''
5c23128d
ZJS
551
552foreach decl : ['char16_t',
553 'char32_t',
84e8edec 554 'struct mount_attr',
4c2e1b39 555 'struct statx',
5c23128d 556 ]
2c201c21
ZJS
557
558 # We get -1 if the size cannot be determined
9c869d08
ZJS
559 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
560
3657d3a0
RH
561 if decl == 'struct mount_attr'
562 if have
563 want_linux_fs_h = false
564 else
565 have = cc.sizeof(decl,
566 prefix : decl_headers + '#include <linux/fs.h>',
567 args : '-D_GNU_SOURCE') > 0
568 want_linux_fs_h = have
569 endif
570 endif
571
9c869d08
ZJS
572 if decl == 'struct statx'
573 if have
574 want_linux_stat_h = false
575 else
576 have = cc.sizeof(decl,
577 prefix : decl_headers + '#include <linux/stat.h>',
578 args : '-D_GNU_SOURCE') > 0
579 want_linux_stat_h = have
580 endif
581 endif
582
349cc4a5 583 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
5c23128d
ZJS
584endforeach
585
9c869d08 586conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
3657d3a0 587conf.set10('WANT_LINUX_FS_H', want_linux_fs_h)
75720bff 588
5c23128d 589foreach ident : ['secure_getenv', '__secure_getenv']
349cc4a5 590 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
5c23128d
ZJS
591endforeach
592
593foreach ident : [
85db59b7 594 ['memfd_create', '''#include <sys/mman.h>'''],
7b961e40
LP
595 ['gettid', '''#include <sys/types.h>
596 #include <unistd.h>'''],
3c042add
LP
597 ['pivot_root', '''#include <stdlib.h>
598 #include <unistd.h>'''], # no known header declares pivot_root
51fe206f
ZJS
599 ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get
600 ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set
85db59b7 601 ['name_to_handle_at', '''#include <sys/types.h>
37efbbd8
ZJS
602 #include <sys/stat.h>
603 #include <fcntl.h>'''],
85db59b7 604 ['setns', '''#include <sched.h>'''],
2acfd0ff
LP
605 ['renameat2', '''#include <stdio.h>
606 #include <fcntl.h>'''],
37efbbd8
ZJS
607 ['kcmp', '''#include <linux/kcmp.h>'''],
608 ['keyctl', '''#include <sys/types.h>
609 #include <keyutils.h>'''],
85db59b7 610 ['copy_file_range', '''#include <sys/syscall.h>
37efbbd8 611 #include <unistd.h>'''],
71e5200f
DM
612 ['bpf', '''#include <sys/syscall.h>
613 #include <unistd.h>'''],
4c2e1b39
LP
614 ['statx', '''#include <sys/types.h>
615 #include <sys/stat.h>
616 #include <unistd.h>'''],
aa484f35 617 ['explicit_bzero' , '''#include <string.h>'''],
5bb20fd3 618 ['reallocarray', '''#include <stdlib.h>'''],
b070c7c0
MS
619 ['set_mempolicy', '''#include <stdlib.h>
620 #include <unistd.h>'''],
621 ['get_mempolicy', '''#include <stdlib.h>
622 #include <unistd.h>'''],
5f152f43
LP
623 ['pidfd_send_signal', '''#include <stdlib.h>
624 #include <unistd.h>
625 #include <signal.h>
626 #include <sys/wait.h>'''],
627 ['pidfd_open', '''#include <stdlib.h>
628 #include <unistd.h>
629 #include <signal.h>
630 #include <sys/wait.h>'''],
5ead4e85
LP
631 ['rt_sigqueueinfo', '''#include <stdlib.h>
632 #include <unistd.h>
633 #include <signal.h>
634 #include <sys/wait.h>'''],
a5421953
DDM
635 ['rt_tgsigqueueinfo', '''#include <stdlib.h>
636 #include <unistd.h>
637 #include <signal.h>
638 #include <sys/wait.h>'''],
4b6f74f5 639 ['mallinfo', '''#include <malloc.h>'''],
1885169c 640 ['mallinfo2', '''#include <malloc.h>'''],
8939eeae 641 ['execveat', '''#include <unistd.h>'''],
441e0fdb 642 ['close_range', '''#include <unistd.h>'''],
420297c9 643 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
84e8edec
LP
644 ['mount_setattr', '''#include <sys/mount.h>'''],
645 ['move_mount', '''#include <sys/mount.h>'''],
646 ['open_tree', '''#include <sys/mount.h>'''],
1c265fcd
DDM
647 ['fsopen', '''#include <sys/mount.h>'''],
648 ['fsconfig', '''#include <sys/mount.h>'''],
34a9da0d 649 ['fsmount', '''#include <sys/mount.h>'''],
aab35b1e 650 ['getdents64', '''#include <dirent.h>'''],
37efbbd8
ZJS
651]
652
85db59b7 653 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
4b9545f1 654 conf.set10('HAVE_' + ident[0].to_upper(), have)
5c23128d
ZJS
655endforeach
656
85db59b7 657if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
349cc4a5 658 conf.set10('USE_SYS_RANDOM_H', true)
4b9545f1 659 conf.set10('HAVE_GETRANDOM', true)
4984c8be
ZJS
660else
661 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
349cc4a5 662 conf.set10('USE_SYS_RANDOM_H', false)
4b9545f1 663 conf.set10('HAVE_GETRANDOM', have)
4984c8be
ZJS
664endif
665
5c23128d
ZJS
666#####################################################################
667
064b8e2c
DDM
668version_tag = get_option('version-tag')
669if version_tag != ''
670 vcs_data = configuration_data()
671 vcs_data.set('VCS_TAG', version_tag)
672 version_h = configure_file(configuration : vcs_data,
673 input : 'src/version/version.h.in',
674 output : 'version.h')
675else
676 vcs_tagger = [
677 project_source_root + '/tools/meson-vcs-tag.sh',
678 project_source_root,
679 meson.project_version()]
680
681 version_h = vcs_tag(
682 input : 'src/version/version.h.in',
683 output : 'version.h',
684 command: vcs_tagger)
685endif
d1084aa2 686
92148283
JJ
687versiondep = declare_dependency(
688 sources: version_h,
689 include_directories : include_directories('.'))
d1084aa2 690
a2b0cd3f
ZJS
691shared_lib_tag = get_option('shared-lib-tag')
692if shared_lib_tag == ''
693 shared_lib_tag = meson.project_version()
694endif
695
0f4c4f38
ZJS
696sh = find_program('sh')
697echo = find_program('echo')
5c23128d 698sed = find_program('sed')
5c23128d 699awk = find_program('awk')
5c23128d 700stat = find_program('stat')
0f4c4f38 701ln = find_program('ln')
d68b342b 702git = find_program('git', required : false)
b68dfb9e 703env = find_program('env')
b1ffacb6 704perl = find_program('perl', required : false)
0f4c4f38 705rsync = find_program('rsync', required : false)
4d56d084 706diff = find_program('diff')
d9081eb0 707find = find_program('find')
7c22f07c 708meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
5c23128d 709
94e75a54
ZJS
710mkdir_p = 'mkdir -p $DESTDIR/@0@'
711
9247df5a 712# If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
5c23128d 713# /usr/sbin, /sbin, and fall back to the default from middle column.
2fa645f1 714progs = [['quotaon', '/usr/sbin/quotaon' ],
5c23128d 715 ['quotacheck', '/usr/sbin/quotacheck' ],
5c23128d
ZJS
716 ['kmod', '/usr/bin/kmod' ],
717 ['kexec', '/usr/sbin/kexec' ],
718 ['sulogin', '/usr/sbin/sulogin' ],
719 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
720 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
721 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
722 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
6db90462 723 ['nologin', '/usr/sbin/nologin', ],
5c23128d
ZJS
724 ]
725foreach prog : progs
37efbbd8
ZJS
726 path = get_option(prog[0] + '-path')
727 if path != ''
728 message('Using @1@ for @0@'.format(prog[0], path))
729 else
730 exe = find_program(prog[0],
731 '/usr/sbin/' + prog[0],
732 '/sbin/' + prog[0],
733 required: false)
734 path = exe.found() ? exe.path() : prog[1]
735 endif
736 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
737 conf.set_quoted(name, path)
5c23128d
ZJS
738endforeach
739
2fa645f1
MG
740conf.set_quoted('TELINIT', get_option('telinit-path'))
741
e92777d2 742if run_command(ln, '--relative', '--help', check : false).returncode() != 0
cd001016 743 error('ln does not support --relative (added in coreutils 8.16)')
1276a9f6 744endif
5c23128d
ZJS
745
746############################################################
747
748gperf = find_program('gperf')
749
750gperf_test_format = '''
751#include <string.h>
752const char * in_word_set(const char *, @0@);
753@1@
754'''
ac3eda34 755gperf_snippet = run_command(sh, '-c', 'echo foo,bar | "$1" -L ANSI-C', '_', gperf,
e92777d2 756 check : true)
5c23128d
ZJS
757gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
758if cc.compiles(gperf_test)
37efbbd8 759 gperf_len_type = 'size_t'
5c23128d 760else
37efbbd8
ZJS
761 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
762 if cc.compiles(gperf_test)
763 gperf_len_type = 'unsigned'
764 else
765 error('unable to determine gperf len type')
766 endif
5c23128d
ZJS
767endif
768message('gperf len type is @0@'.format(gperf_len_type))
37efbbd8
ZJS
769conf.set('GPERF_LEN_TYPE', gperf_len_type,
770 description : 'The type of gperf "len" parameter')
5c23128d
ZJS
771
772############################################################
773
774if not cc.has_header('sys/capability.h')
37efbbd8 775 error('POSIX caps headers not found')
5c23128d 776endif
9f555bba 777foreach header : ['crypt.h',
5c23128d
ZJS
778 'linux/memfd.h',
779 'linux/vm_sockets.h',
af8786b1 780 'sys/auxv.h',
5545f336 781 'threads.h',
5c23128d
ZJS
782 'valgrind/memcheck.h',
783 'valgrind/valgrind.h',
420297c9 784 'linux/time_types.h',
b428efa5 785 'sys/sdt.h',
5c23128d 786 ]
2c201c21 787
349cc4a5
ZJS
788 conf.set10('HAVE_' + header.underscorify().to_upper(),
789 cc.has_header(header))
5c23128d
ZJS
790endforeach
791
792############################################################
793
eef4b800
ZJS
794fallback_hostname = get_option('fallback-hostname')
795if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
796 error('Invalid fallback-hostname configuration')
797 # A more extensive test is done in test-hostname-util. Let's catch
798 # the most obvious errors here so we don't fail with an assert later.
799endif
800conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
801
5c23128d
ZJS
802default_hierarchy = get_option('default-hierarchy')
803conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
804 description : 'default cgroup hierarchy as string')
805if default_hierarchy == 'legacy'
37efbbd8 806 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
5c23128d 807elif default_hierarchy == 'hybrid'
37efbbd8 808 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
5c23128d 809else
37efbbd8 810 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
5c23128d
ZJS
811endif
812
681cb84a
ZJS
813extra_net_naming_schemes = []
814extra_net_naming_map = []
815foreach scheme: get_option('extra-net-naming-schemes').split(',')
816 if scheme != ''
817 name = scheme.split('=')[0]
818 value = scheme.split('=')[1]
819 NAME = name.underscorify().to_upper()
820 VALUE = []
821 foreach field: value.split('+')
822 VALUE += 'NAMING_' + field.underscorify().to_upper()
823 endforeach
824 extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE))
825 extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME)
826 endif
827endforeach
828conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes))
829conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map))
830
06da5c63
ZJS
831default_net_naming_scheme = get_option('default-net-naming-scheme')
832conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
77faadfd
ZJS
833if default_net_naming_scheme != 'latest'
834 conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST',
835 'NAMING_' + default_net_naming_scheme.underscorify().to_upper())
836endif
06da5c63 837
5c23128d 838time_epoch = get_option('time-epoch')
a36be3e5 839if time_epoch <= 0
e92777d2 840 time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check : true).stdout().strip()
edd84b8e 841 if time_epoch == '' and git.found() and fs.is_dir('.git')
bd190899 842 # If we're in a git repository, use the creation time of the latest git tag.
e92777d2
ZJS
843 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags',
844 check : false)
845 if latest_tag.returncode() == 0
846 time_epoch = run_command(
847 git, 'log', '--no-show-signature', '-1', '--format=%at',
848 latest_tag.stdout().strip(),
849 check : false).stdout()
850 endif
0390b094
ZJS
851 endif
852 if time_epoch == ''
6dbf352c 853 NEWS = files('NEWS')
e92777d2
ZJS
854 time_epoch = run_command(stat, '-c', '%Y', NEWS,
855 check : true).stdout()
6dbf352c 856 endif
89cdbe1f 857 time_epoch = time_epoch.strip().to_int()
5c23128d 858endif
5c23128d
ZJS
859conf.set('TIME_EPOCH', time_epoch)
860
b10abe4b
EI
861conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max'))
862
53350c7b 863default_user_shell = get_option('default-user-shell')
864conf.set_quoted('DEFAULT_USER_SHELL', default_user_shell)
865conf.set_quoted('DEFAULT_USER_SHELL_NAME', fs.name(default_user_shell))
866
fc1a5d1a
ZJS
867foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
868 ['system-uid-max', 'SYS_UID_MAX', 999],
869 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
870 ['system-gid-max', 'SYS_GID_MAX', 999]]
871 v = get_option(tuple[0])
a36be3e5 872 if v <= 0
fc1a5d1a
ZJS
873 v = run_command(
874 awk,
875 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
e92777d2
ZJS
876 '/etc/login.defs',
877 check : false).stdout().strip()
fc1a5d1a
ZJS
878 if v == ''
879 v = tuple[2]
880 else
881 v = v.to_int()
882 endif
2f62cf35 883 endif
fc1a5d1a 884 conf.set(tuple[0].underscorify().to_upper(), v)
fc1a5d1a
ZJS
885endforeach
886if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
887 error('Invalid uid allocation range')
5c23128d 888endif
fc1a5d1a
ZJS
889if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
890 error('Invalid gid allocation range')
5c23128d 891endif
5c23128d 892
ac09340e
YW
893dynamic_uid_min = get_option('dynamic-uid-min')
894dynamic_uid_max = get_option('dynamic-uid-max')
87d5e4f2
LP
895conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
896conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
87d5e4f2 897
ac09340e
YW
898container_uid_base_min = get_option('container-uid-base-min')
899container_uid_base_max = get_option('container-uid-base-max')
87d5e4f2
LP
900conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
901conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
87d5e4f2 902
afde4574
LP
903nobody_user = get_option('nobody-user')
904nobody_group = get_option('nobody-group')
905
2484bff3 906if not meson.is_cross_build()
e92777d2 907 getent_result = run_command('getent', 'passwd', '65534', check : false)
2484bff3
CQ
908 if getent_result.returncode() == 0
909 name = getent_result.stdout().split(':')[0]
910 if name != nobody_user
911 warning('\n' +
912 '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) +
913 'Your build will result in an user table setup that is incompatible with the local system.')
914 endif
afde4574 915 endif
e92777d2 916 id_result = run_command('id', '-u', nobody_user, check : false)
2484bff3 917 if id_result.returncode() == 0
89cdbe1f 918 id = id_result.stdout().strip().to_int()
2484bff3
CQ
919 if id != 65534
920 warning('\n' +
921 '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) +
922 'Your build will result in an user table setup that is incompatible with the local system.')
923 endif
afde4574 924 endif
afde4574 925
e92777d2 926 getent_result = run_command('getent', 'group', '65534', check : false)
2484bff3
CQ
927 if getent_result.returncode() == 0
928 name = getent_result.stdout().split(':')[0]
929 if name != nobody_group
930 warning('\n' +
931 '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) +
932 'Your build will result in an group table setup that is incompatible with the local system.')
933 endif
afde4574 934 endif
e92777d2 935 id_result = run_command('id', '-g', nobody_group, check : false)
2484bff3 936 if id_result.returncode() == 0
89cdbe1f 937 id = id_result.stdout().strip().to_int()
2484bff3
CQ
938 if id != 65534
939 warning('\n' +
d5b3e510 940 '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
941 'Your build will result in an group table setup that is incompatible with the local system.')
942 endif
afde4574
LP
943 endif
944endif
8374cc62 945if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
8ea9fad7
YW
946 warning('\n' +
947 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
948 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
8374cc62 949endif
afde4574
LP
950
951conf.set_quoted('NOBODY_USER_NAME', nobody_user)
952conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
87d5e4f2 953
9a797ddc
ZJS
954static_ugids = []
955foreach option : ['adm-gid',
956 'audio-gid',
957 'cdrom-gid',
958 'dialout-gid',
959 'disk-gid',
960 'input-gid',
961 'kmem-gid',
962 'kvm-gid',
963 'lp-gid',
964 'render-gid',
965 'sgx-gid',
966 'tape-gid',
967 'tty-gid',
968 'users-gid',
969 'utmp-gid',
970 'video-gid',
971 'wheel-gid',
972 'systemd-journal-gid',
973 'systemd-network-uid',
974 'systemd-resolve-uid',
975 'systemd-timesync-uid']
976 name = option.underscorify().to_upper()
977 val = get_option(option)
978
979 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
a36be3e5
YW
980 conf.set(name, val > 0 ? val : '-')
981 if val > 0
9a797ddc
ZJS
982 static_ugids += '@0@:@1@'.format(option, val)
983 endif
984endforeach
84786b8e 985
348b4437
YW
986conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
987conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
5c23128d 988
ace5e311 989dev_kvm_mode = get_option('dev-kvm-mode')
d924a938 990conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation
ace5e311 991conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
055a083a 992group_render_mode = get_option('group-render-mode')
8feaea5e 993conf.set_quoted('GROUP_RENDER_MODE', group_render_mode)
055a083a 994conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
5c23128d 995
2a4c156d
ZJS
996kill_user_processes = get_option('default-kill-user-processes')
997conf.set10('KILL_USER_PROCESSES', kill_user_processes)
5c23128d 998
829257d1
ZJS
999dns_servers = get_option('dns-servers')
1000conf.set_quoted('DNS_SERVERS', dns_servers)
5c23128d 1001
829257d1
ZJS
1002ntp_servers = get_option('ntp-servers')
1003conf.set_quoted('NTP_SERVERS', ntp_servers)
5c23128d 1004
8ca9e92c
DR
1005default_locale = get_option('default-locale')
1006conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
1007
a22f5186
DDM
1008nspawn_locale = get_option('nspawn-locale')
1009conf.set_quoted('SYSTEMD_NSPAWN_LOCALE', nspawn_locale)
1010
f129d0e7
MY
1011default_keymap = get_option('default-keymap')
1012conf.set_quoted('SYSTEMD_DEFAULT_KEYMAP', default_keymap)
1013
8f20232f 1014localegen_path = get_option('localegen-path')
8f20232f
MK
1015if localegen_path != ''
1016 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
8f20232f 1017endif
71ae5ce5 1018conf.set10('HAVE_LOCALEGEN', localegen_path != '')
8f20232f 1019
5c23128d
ZJS
1020conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
1021
21d0dd5a 1022service_watchdog = get_option('service-watchdog')
7bc9ea51 1023watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
059cc610 1024conf.set_quoted('SERVICE_WATCHDOG', watchdog_value)
21d0dd5a 1025
059cc610 1026conf.set_quoted('SUSHELL', get_option('debug-shell'))
93912e87 1027conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
3131bfe3 1028
349cc4a5
ZJS
1029enable_debug_hashmap = false
1030enable_debug_mmap_cache = false
d6601495 1031enable_debug_siphash = false
8f6b442a 1032foreach name : get_option('debug-extra')
ad7aa760
YW
1033 if name == 'hashmap'
1034 enable_debug_hashmap = true
1035 elif name == 'mmap-cache'
1036 enable_debug_mmap_cache = true
d6601495
YW
1037 elif name == 'siphash'
1038 enable_debug_siphash = true
ad7aa760
YW
1039 else
1040 message('unknown debug option "@0@", ignoring'.format(name))
1041 endif
1042endforeach
349cc4a5
ZJS
1043conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
1044conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
d6601495 1045conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
fd5dec9a 1046conf.set10('LOG_TRACE', get_option('log-trace'))
d18cb393 1047
3602ca6f
ZJS
1048default_user_path = get_option('user-path')
1049if default_user_path != ''
1050 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
1051endif
1052
5bc655cd 1053
5c23128d
ZJS
1054#####################################################################
1055
1056threads = dependency('threads')
1057librt = cc.find_library('rt')
1058libm = cc.find_library('m')
1059libdl = cc.find_library('dl')
1060libcrypt = cc.find_library('crypt')
1061
96f8c636
ZJS
1062# On some architectures, libatomic is required. But on some installations,
1063# it is found, but actual linking fails. So let's try to use it opportunistically.
1064# If it is installed, but not needed, it will be dropped because of --as-needed.
1065if cc.links('''int main(int argc, char **argv) { return 0; }''',
1066 args : '-latomic',
1067 name : 'libatomic')
1068 libatomic = declare_dependency(link_args : '-latomic')
1069else
1070 libatomic = []
1071endif
1072
06ca077b 1073crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
e8644a41 1074foreach ident : [
feee7f62
LB
1075 ['crypt_ra', crypt_header],
1076 ['crypt_preferred_method', crypt_header],
1077 ['crypt_gensalt_ra', crypt_header]]
e8644a41
ZJS
1078
1079 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
1080 dependencies : libcrypt)
1081 conf.set10('HAVE_' + ident[0].to_upper(), have)
1082endforeach
1083
1800cc85
ZJS
1084libcap = dependency('libcap', required : false)
1085if not libcap.found()
1086 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
1087 libcap = cc.find_library('cap')
1088endif
1089
7d861e12 1090want_bpf_framework = get_option('bpf-framework')
b88323e4 1091bpf_compiler = get_option('bpf-compiler')
7d861e12
JK
1092bpf_framework_required = want_bpf_framework == 'true'
1093
87e462f7 1094libbpf_version_requirement = '>= 0.1.0'
b88323e4
JH
1095if bpf_compiler == 'gcc'
1096 libbpf_version_requirement = '>= 1.0.0'
1097endif
1098libbpf = dependency('libbpf', required : bpf_framework_required, version : libbpf_version_requirement)
7d861e12
JK
1099conf.set10('HAVE_LIBBPF', libbpf.found())
1100
b88323e4
JH
1101bpftool_strip_version_requirement = '>= 5.13.0'
1102if bpf_compiler == 'gcc'
1103 bpftool_strip_version_requirement = '>= 7.0.0'
1104endif
1105
3d954ef1 1106if want_bpf_framework == 'false' or not libbpf.found() or skip_deps
cf2dc690 1107 conf.set10('BPF_FRAMEWORK', false)
7d861e12 1108else
76abad4d
JH
1109 clang_found = false
1110 clang_supports_bpf = false
1111 bpf_gcc_found = false
b88323e4 1112 bpftool_strip = false
76abad4d
JH
1113 deps_found = false
1114
1115 if bpf_compiler == 'clang'
1116 # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
1117 # (like clang-10/llvm-strip-10)
1118 if meson.is_cross_build() or cc.get_id() != 'clang' or cc.cmd_array()[0].contains('afl-clang') or cc.cmd_array()[0].contains('hfuzz-clang')
1119 r = find_program('clang', required : bpf_framework_required, version : '>= 10.0.0')
1120 clang_found = r.found()
1121 if clang_found
1122 clang = r.path()
1123 endif
76abad4d
JH
1124 else
1125 clang_found = true
1126 clang = cc.cmd_array()
dc7e9c1b 1127 endif
a6ac8b5a 1128
76abad4d
JH
1129 if clang_found
1130 # Check if 'clang -target bpf' is supported.
1131 clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
1132 endif
1133 elif bpf_compiler == 'gcc'
1134 warning('GCC BPF Compiler support is experimental and not recommended.')
1135 bpf_gcc = find_program('bpf-gcc',
1136 required : true,
1137 version : '>= 12.1.0')
1138 bpf_gcc_found = bpf_gcc.found()
a6ac8b5a
YW
1139 endif
1140
76abad4d
JH
1141 if clang_supports_bpf or bpf_gcc_found
1142 # Debian installs this in /usr/sbin/ which is not in $PATH.
1143 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1144 # We use 'bpftool gen object' subcommand for bpftool strip, it was added by d80b2fcbe0a023619e0fc73112f2a02c2662f6ab (v5.13).
b88323e4 1145 bpftool_strip_required = bpf_framework_required and bpf_compiler == 'gcc'
e3759ac4
JH
1146 bpftool = find_program('bpftool',
1147 '/usr/sbin/bpftool',
b88323e4
JH
1148 required : bpftool_strip_required,
1149 version : bpftool_strip_version_requirement)
e3759ac4 1150
76abad4d
JH
1151 if bpftool.found()
1152 bpftool_strip = true
1153 deps_found = true
b88323e4 1154 elif bpf_compiler == 'clang'
76abad4d
JH
1155 # We require the 'bpftool gen skeleton' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
1156 bpftool = find_program('bpftool',
1157 '/usr/sbin/bpftool',
1158 required : bpf_framework_required,
1159 version : '>= 5.6.0')
e3759ac4 1160 endif
68e101da 1161
76abad4d
JH
1162 # We use `llvm-strip` as a fallback if `bpftool gen object` strip support is not available.
1163 if not bpftool_strip and bpftool.found() and clang_supports_bpf
1164 if not meson.is_cross_build()
1165 llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
1166 check : true).stdout().strip()
1167 else
1168 llvm_strip_bin = 'llvm-strip'
1169 endif
1170 llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
1171 deps_found = llvm_strip.found()
1172 endif
1173 endif
68e101da 1174
7d861e12 1175 # Can build BPF program from source code in restricted C
d40ce018 1176 conf.set10('BPF_FRAMEWORK', deps_found)
7d861e12
JK
1177endif
1178
5c23128d 1179libmount = dependency('mount',
c0b4b0f8 1180 version : fuzzer_build ? '>= 0' : '>= 2.30')
5c23128d 1181
e594a3b1
LP
1182want_libfdisk = get_option('fdisk')
1183if want_libfdisk != 'false' and not skip_deps
1184 libfdisk = dependency('fdisk',
baec7d78 1185 version : '>= 2.32',
e594a3b1
LP
1186 required : want_libfdisk == 'true')
1187 have = libfdisk.found()
1188else
1189 have = false
1190 libfdisk = []
1191endif
1192conf.set10('HAVE_LIBFDISK', have)
1193
70a5db58
LP
1194want_pwquality = get_option('pwquality')
1195if want_pwquality != 'false' and not skip_deps
1196 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1197 have = libpwquality.found()
1198else
1199 have = false
1200 libpwquality = []
1201endif
1202conf.set10('HAVE_PWQUALITY', have)
1203
5c23128d 1204want_seccomp = get_option('seccomp')
87ac55a1 1205if want_seccomp != 'false' and not skip_deps
37efbbd8 1206 libseccomp = dependency('libseccomp',
9f0e9c01 1207 version : '>= 2.3.1',
37efbbd8 1208 required : want_seccomp == 'true')
349cc4a5 1209 have = libseccomp.found()
5c23128d 1210else
349cc4a5 1211 have = false
37efbbd8 1212 libseccomp = []
5c23128d 1213endif
349cc4a5 1214conf.set10('HAVE_SECCOMP', have)
5c23128d
ZJS
1215
1216want_selinux = get_option('selinux')
87ac55a1 1217if want_selinux != 'false' and not skip_deps
37efbbd8
ZJS
1218 libselinux = dependency('libselinux',
1219 version : '>= 2.1.9',
1220 required : want_selinux == 'true')
349cc4a5 1221 have = libselinux.found()
5c23128d 1222else
349cc4a5 1223 have = false
37efbbd8 1224 libselinux = []
5c23128d 1225endif
349cc4a5 1226conf.set10('HAVE_SELINUX', have)
5c23128d
ZJS
1227
1228want_apparmor = get_option('apparmor')
87ac55a1 1229if want_apparmor != 'false' and not skip_deps
37efbbd8 1230 libapparmor = dependency('libapparmor',
2ffadd3c 1231 version : '>= 2.13',
37efbbd8 1232 required : want_apparmor == 'true')
349cc4a5 1233 have = libapparmor.found()
5c23128d 1234else
349cc4a5 1235 have = false
37efbbd8 1236 libapparmor = []
5c23128d 1237endif
349cc4a5 1238conf.set10('HAVE_APPARMOR', have)
5c23128d 1239
07b382cc
ZJS
1240have = get_option('smack') and get_option('smack-run-label') != ''
1241conf.set10('HAVE_SMACK_RUN_LABEL', have)
1242if have
1243 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1244endif
5c23128d 1245
aa5ae971
ŁS
1246have = get_option('smack') and get_option('smack-default-process-label') != ''
1247if have
1248 conf.set_quoted('SMACK_DEFAULT_PROCESS_LABEL', get_option('smack-default-process-label'))
1249endif
1250
3ca0cb73
ZJS
1251want_polkit = get_option('polkit')
1252install_polkit = false
1253install_polkit_pkla = false
87ac55a1 1254if want_polkit != 'false' and not skip_deps
37efbbd8 1255 install_polkit = true
3ca0cb73 1256
37efbbd8
ZJS
1257 libpolkit = dependency('polkit-gobject-1',
1258 required : false)
1259 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1260 message('Old polkit detected, will install pkla files')
1261 install_polkit_pkla = true
1262 endif
3ca0cb73 1263endif
349cc4a5 1264conf.set10('ENABLE_POLKIT', install_polkit)
3ca0cb73 1265
36f0387e 1266want_acl = get_option('acl')
87ac55a1 1267if want_acl != 'false' and not skip_deps
36f0387e 1268 libacl = cc.find_library('acl', required : want_acl == 'true')
349cc4a5 1269 have = libacl.found()
36f0387e 1270else
349cc4a5 1271 have = false
36f0387e
ZJS
1272 libacl = []
1273endif
349cc4a5 1274conf.set10('HAVE_ACL', have)
36f0387e 1275
5c23128d 1276want_audit = get_option('audit')
87ac55a1 1277if want_audit != 'false' and not skip_deps
37efbbd8 1278 libaudit = dependency('audit', required : want_audit == 'true')
349cc4a5 1279 have = libaudit.found()
5c23128d 1280else
349cc4a5 1281 have = false
37efbbd8 1282 libaudit = []
5c23128d 1283endif
349cc4a5 1284conf.set10('HAVE_AUDIT', have)
5c23128d
ZJS
1285
1286want_blkid = get_option('blkid')
87ac55a1 1287if want_blkid != 'false' and not skip_deps
37efbbd8 1288 libblkid = dependency('blkid', required : want_blkid == 'true')
349cc4a5 1289 have = libblkid.found()
4fcc033b
KZ
1290
1291 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1292 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
5c23128d 1293else
349cc4a5 1294 have = false
37efbbd8 1295 libblkid = []
5c23128d 1296endif
349cc4a5 1297conf.set10('HAVE_BLKID', have)
5c23128d
ZJS
1298
1299want_kmod = get_option('kmod')
87ac55a1 1300if want_kmod != 'false' and not skip_deps
37efbbd8
ZJS
1301 libkmod = dependency('libkmod',
1302 version : '>= 15',
1303 required : want_kmod == 'true')
349cc4a5 1304 have = libkmod.found()
5c23128d 1305else
349cc4a5 1306 have = false
37efbbd8 1307 libkmod = []
5c23128d 1308endif
349cc4a5 1309conf.set10('HAVE_KMOD', have)
5c23128d 1310
ede5a78f
ST
1311want_xenctrl = get_option('xenctrl')
1312if want_xenctrl != 'false' and not skip_deps
1313 libxenctrl = dependency('xencontrol',
1314 version : '>= 4.9',
1315 required : want_xenctrl == 'true')
1316 have = libxenctrl.found()
1317else
1318 have = false
1319 libxenctrl = []
1320endif
1321conf.set10('HAVE_XENCTRL', have)
1322
5c23128d 1323want_pam = get_option('pam')
87ac55a1 1324if want_pam != 'false' and not skip_deps
37efbbd8
ZJS
1325 libpam = cc.find_library('pam', required : want_pam == 'true')
1326 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
349cc4a5 1327 have = libpam.found() and libpam_misc.found()
5c23128d 1328else
349cc4a5 1329 have = false
37efbbd8
ZJS
1330 libpam = []
1331 libpam_misc = []
5c23128d 1332endif
349cc4a5 1333conf.set10('HAVE_PAM', have)
5c23128d
ZJS
1334
1335want_microhttpd = get_option('microhttpd')
87ac55a1 1336if want_microhttpd != 'false' and not skip_deps
37efbbd8
ZJS
1337 libmicrohttpd = dependency('libmicrohttpd',
1338 version : '>= 0.9.33',
1339 required : want_microhttpd == 'true')
349cc4a5 1340 have = libmicrohttpd.found()
5c23128d 1341else
349cc4a5 1342 have = false
37efbbd8 1343 libmicrohttpd = []
5c23128d 1344endif
349cc4a5 1345conf.set10('HAVE_MICROHTTPD', have)
5c23128d
ZJS
1346
1347want_libcryptsetup = get_option('libcryptsetup')
d1ae38d8
OK
1348want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1349
1350if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1351 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1352endif
1353
87ac55a1 1354if want_libcryptsetup != 'false' and not skip_deps
37efbbd8 1355 libcryptsetup = dependency('libcryptsetup',
d1ae38d8
OK
1356 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1357 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
349cc4a5 1358 have = libcryptsetup.found()
70a5db58 1359
aac80717
ZJS
1360 foreach ident : ['crypt_set_metadata_size',
1361 'crypt_activate_by_signed_key',
48a09a8f
DDM
1362 'crypt_token_max',
1363 'crypt_reencrypt_init_by_passphrase',
1364 'crypt_reencrypt',
1365 'crypt_set_data_offset']
aac80717
ZJS
1366 have_ident = have and cc.has_function(
1367 ident,
1368 prefix : '#include <libcryptsetup.h>',
1369 dependencies : libcryptsetup)
1370 conf.set10('HAVE_' + ident.to_upper(), have_ident)
1371 endforeach
5c23128d 1372else
349cc4a5 1373 have = false
37efbbd8 1374 libcryptsetup = []
5c23128d 1375endif
349cc4a5 1376conf.set10('HAVE_LIBCRYPTSETUP', have)
5c23128d 1377
d1ae38d8 1378if want_libcryptsetup_plugins != 'false' and not skip_deps
aac80717
ZJS
1379 have = (cc.has_function(
1380 'crypt_activate_by_token_pin',
1381 prefix : '#include <libcryptsetup.h>',
1382 dependencies : libcryptsetup) and
1383 cc.has_function(
1384 'crypt_token_external_path',
1385 prefix : '#include <libcryptsetup.h>',
1386 dependencies : libcryptsetup))
d1ae38d8
OK
1387else
1388 have = false
1389endif
1390conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1391
5c23128d 1392want_libcurl = get_option('libcurl')
87ac55a1 1393if want_libcurl != 'false' and not skip_deps
37efbbd8
ZJS
1394 libcurl = dependency('libcurl',
1395 version : '>= 7.32.0',
1396 required : want_libcurl == 'true')
349cc4a5 1397 have = libcurl.found()
5c23128d 1398else
349cc4a5 1399 have = false
37efbbd8 1400 libcurl = []
5c23128d 1401endif
349cc4a5 1402conf.set10('HAVE_LIBCURL', have)
47350c5f 1403conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
5c23128d
ZJS
1404
1405want_libidn = get_option('libidn')
87057e24
ZJS
1406want_libidn2 = get_option('libidn2')
1407if want_libidn == 'true' and want_libidn2 == 'true'
1408 error('libidn and libidn2 cannot be requested simultaneously')
1409endif
1410
1b931399
YW
1411if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1412 libidn = dependency('libidn2',
1413 required : want_libidn2 == 'true')
349cc4a5 1414 have = libidn.found()
87057e24 1415else
349cc4a5 1416 have = false
87057e24
ZJS
1417 libidn = []
1418endif
1b931399
YW
1419conf.set10('HAVE_LIBIDN2', have)
1420if not have and want_libidn != 'false' and not skip_deps
7f7ab228 1421 # libidn is used for both libidn and libidn2 objects
1b931399
YW
1422 libidn = dependency('libidn',
1423 required : want_libidn == 'true')
349cc4a5
ZJS
1424 have = libidn.found()
1425else
1426 have = false
5c23128d 1427endif
1b931399 1428conf.set10('HAVE_LIBIDN', have)
5c23128d
ZJS
1429
1430want_libiptc = get_option('libiptc')
87ac55a1 1431if want_libiptc != 'false' and not skip_deps
37efbbd8
ZJS
1432 libiptc = dependency('libiptc',
1433 required : want_libiptc == 'true')
349cc4a5 1434 have = libiptc.found()
5c23128d 1435else
349cc4a5 1436 have = false
37efbbd8 1437 libiptc = []
5c23128d 1438endif
349cc4a5 1439conf.set10('HAVE_LIBIPTC', have)
5c23128d
ZJS
1440
1441want_qrencode = get_option('qrencode')
87ac55a1 1442if want_qrencode != 'false' and not skip_deps
37efbbd8 1443 libqrencode = dependency('libqrencode',
3f5225d7 1444 version : '>= 3',
37efbbd8 1445 required : want_qrencode == 'true')
349cc4a5 1446 have = libqrencode.found()
5c23128d 1447else
349cc4a5 1448 have = false
37efbbd8 1449 libqrencode = []
5c23128d 1450endif
349cc4a5 1451conf.set10('HAVE_QRENCODE', have)
5c23128d 1452
a44fb601 1453want_gcrypt = get_option('gcrypt')
87ac55a1 1454if want_gcrypt != 'false' and not skip_deps
a44fb601
ZJS
1455 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1456 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
349cc4a5 1457 have = libgcrypt.found() and libgpg_error.found()
a44fb601 1458else
349cc4a5
ZJS
1459 have = false
1460endif
1461if not have
1462 # link to neither of the libs if one is not found
a44fb601
ZJS
1463 libgcrypt = []
1464 libgpg_error = []
1465endif
349cc4a5 1466conf.set10('HAVE_GCRYPT', have)
a44fb601 1467
5c23128d 1468want_gnutls = get_option('gnutls')
87ac55a1 1469if want_gnutls != 'false' and not skip_deps
37efbbd8
ZJS
1470 libgnutls = dependency('gnutls',
1471 version : '>= 3.1.4',
1472 required : want_gnutls == 'true')
349cc4a5 1473 have = libgnutls.found()
5c23128d 1474else
349cc4a5 1475 have = false
37efbbd8 1476 libgnutls = []
5c23128d 1477endif
349cc4a5 1478conf.set10('HAVE_GNUTLS', have)
5c23128d 1479
096cbdce 1480want_openssl = get_option('openssl')
87ac55a1 1481if want_openssl != 'false' and not skip_deps
096cbdce
IT
1482 libopenssl = dependency('openssl',
1483 version : '>= 1.1.0',
1484 required : want_openssl == 'true')
1485 have = libopenssl.found()
1486else
1487 have = false
1488 libopenssl = []
1489endif
1490conf.set10('HAVE_OPENSSL', have)
1491
839fddbe
LP
1492want_p11kit = get_option('p11kit')
1493if want_p11kit != 'false' and not skip_deps
1494 libp11kit = dependency('p11-kit-1',
6164ec4c
ZJS
1495 version : '>= 0.23.3',
1496 required : want_p11kit == 'true')
839fddbe 1497 have = libp11kit.found()
da035a3a 1498 libp11kit_cflags = libp11kit.partial_dependency(includes: true, compile_args: true)
839fddbe
LP
1499else
1500 have = false
da035a3a 1501 libp11kit_cflags = []
839fddbe
LP
1502 libp11kit = []
1503endif
1504conf.set10('HAVE_P11KIT', have)
1505
af4fbd46
LP
1506want_libfido2 = get_option('libfido2')
1507if want_libfido2 != 'false' and not skip_deps
e0f435f9
YW
1508 if conf.get('HAVE_OPENSSL') == 1
1509 libfido2 = dependency('libfido2',
1510 required : want_libfido2 == 'true')
1511 have = libfido2.found()
1512 elif want_libfido2 == 'true'
1513 error('libfido2=true requires openssl')
1514 else
1515 have = false
1516 libfido2 = []
1517 endif
af4fbd46
LP
1518else
1519 have = false
1520 libfido2 = []
1521endif
1522conf.set10('HAVE_LIBFIDO2', have)
1523
5e521624
LP
1524want_tpm2 = get_option('tpm2')
1525if want_tpm2 != 'false' and not skip_deps
1526 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
ba081955 1527 required : want_tpm2 == 'true')
5e521624 1528 have = tpm2.found()
155c5129 1529 have_esys3 = tpm2.version().version_compare('>= 3.0.0')
5e521624
LP
1530else
1531 have = false
155c5129 1532 have_esys3 = false
5e521624
LP
1533 tpm2 = []
1534endif
1535conf.set10('HAVE_TPM2', have)
155c5129 1536conf.set10('HAVE_TSS2_ESYS3', have_esys3)
5e521624 1537
5c23128d 1538want_elfutils = get_option('elfutils')
87ac55a1 1539if want_elfutils != 'false' and not skip_deps
37efbbd8
ZJS
1540 libdw = dependency('libdw',
1541 required : want_elfutils == 'true')
349cc4a5 1542 have = libdw.found()
d48c2721
LB
1543
1544 # New in elfutils 0.177
1545 conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING',
1546 have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw))
5c23128d 1547else
349cc4a5 1548 have = false
37efbbd8 1549 libdw = []
5c23128d 1550endif
349cc4a5 1551conf.set10('HAVE_ELFUTILS', have)
5c23128d
ZJS
1552
1553want_zlib = get_option('zlib')
87ac55a1 1554if want_zlib != 'false' and not skip_deps
37efbbd8
ZJS
1555 libz = dependency('zlib',
1556 required : want_zlib == 'true')
349cc4a5 1557 have = libz.found()
5c23128d 1558else
349cc4a5 1559 have = false
37efbbd8 1560 libz = []
5c23128d 1561endif
349cc4a5 1562conf.set10('HAVE_ZLIB', have)
5c23128d
ZJS
1563
1564want_bzip2 = get_option('bzip2')
87ac55a1 1565if want_bzip2 != 'false' and not skip_deps
37efbbd8
ZJS
1566 libbzip2 = cc.find_library('bz2',
1567 required : want_bzip2 == 'true')
349cc4a5 1568 have = libbzip2.found()
5c23128d 1569else
349cc4a5 1570 have = false
37efbbd8 1571 libbzip2 = []
5c23128d 1572endif
349cc4a5 1573conf.set10('HAVE_BZIP2', have)
5c23128d
ZJS
1574
1575want_xz = get_option('xz')
87ac55a1 1576if want_xz != 'false' and not skip_deps
37efbbd8
ZJS
1577 libxz = dependency('liblzma',
1578 required : want_xz == 'true')
d80b051c 1579 have_xz = libxz.found()
5c23128d 1580else
d80b051c 1581 have_xz = false
37efbbd8 1582 libxz = []
5c23128d 1583endif
d80b051c 1584conf.set10('HAVE_XZ', have_xz)
5c23128d
ZJS
1585
1586want_lz4 = get_option('lz4')
87ac55a1 1587if want_lz4 != 'false' and not skip_deps
37efbbd8 1588 liblz4 = dependency('liblz4',
e0a1d4b0 1589 version : '>= 1.3.0',
37efbbd8 1590 required : want_lz4 == 'true')
d80b051c 1591 have_lz4 = liblz4.found()
5c23128d 1592else
d80b051c 1593 have_lz4 = false
37efbbd8 1594 liblz4 = []
5c23128d 1595endif
d80b051c 1596conf.set10('HAVE_LZ4', have_lz4)
5c23128d 1597
ef5924aa
NL
1598want_zstd = get_option('zstd')
1599if want_zstd != 'false' and not skip_deps
1600 libzstd = dependency('libzstd',
1601 required : want_zstd == 'true',
1602 version : '>= 1.4.0')
d80b051c 1603 have_zstd = libzstd.found()
ef5924aa 1604else
d80b051c 1605 have_zstd = false
ef5924aa
NL
1606 libzstd = []
1607endif
d80b051c
LP
1608conf.set10('HAVE_ZSTD', have_zstd)
1609
1610conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
ef5924aa 1611
cd3c6322
LB
1612compression = get_option('default-compression')
1613if compression == 'auto'
1614 if have_zstd
1615 compression = 'zstd'
1616 elif have_lz4
1617 compression = 'lz4'
1618 elif have_xz
1619 compression = 'xz'
1620 else
1621 compression = 'none'
1622 endif
1623elif compression == 'zstd' and not have_zstd
1624 error('default-compression=zstd requires zstd')
1625elif compression == 'lz4' and not have_lz4
1626 error('default-compression=lz4 requires lz4')
1627elif compression == 'xz' and not have_xz
1628 error('default-compression=xz requires xz')
1629endif
1788c6f3 1630conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper()))
cd3c6322 1631
a44fb601 1632want_xkbcommon = get_option('xkbcommon')
87ac55a1 1633if want_xkbcommon != 'false' and not skip_deps
a44fb601
ZJS
1634 libxkbcommon = dependency('xkbcommon',
1635 version : '>= 0.3.0',
1636 required : want_xkbcommon == 'true')
349cc4a5 1637 have = libxkbcommon.found()
a44fb601 1638else
349cc4a5 1639 have = false
a44fb601
ZJS
1640 libxkbcommon = []
1641endif
349cc4a5 1642conf.set10('HAVE_XKBCOMMON', have)
a44fb601 1643
c4c978a0 1644want_pcre2 = get_option('pcre2')
8739f309 1645if want_pcre2 != 'false' and not skip_deps
c4c978a0
ZJS
1646 libpcre2 = dependency('libpcre2-8',
1647 required : want_pcre2 == 'true')
1648 have = libpcre2.found()
1649else
1650 have = false
1651 libpcre2 = []
1652endif
1653conf.set10('HAVE_PCRE2', have)
1654
69e96427 1655want_glib = get_option('glib')
87ac55a1 1656if want_glib != 'false' and not skip_deps
37efbbd8
ZJS
1657 libglib = dependency('glib-2.0',
1658 version : '>= 2.22.0',
1659 required : want_glib == 'true')
1660 libgobject = dependency('gobject-2.0',
1661 version : '>= 2.22.0',
1662 required : want_glib == 'true')
1663 libgio = dependency('gio-2.0',
1664 required : want_glib == 'true')
2c201c21 1665 have = libglib.found() and libgobject.found() and libgio.found()
69e96427 1666else
349cc4a5 1667 have = false
37efbbd8
ZJS
1668 libglib = []
1669 libgobject = []
1670 libgio = []
69e96427 1671endif
349cc4a5 1672conf.set10('HAVE_GLIB', have)
69e96427
ZJS
1673
1674want_dbus = get_option('dbus')
87ac55a1 1675if want_dbus != 'false' and not skip_deps
37efbbd8
ZJS
1676 libdbus = dependency('dbus-1',
1677 version : '>= 1.3.2',
1678 required : want_dbus == 'true')
349cc4a5 1679 have = libdbus.found()
69e96427 1680else
349cc4a5 1681 have = false
37efbbd8 1682 libdbus = []
69e96427 1683endif
349cc4a5 1684conf.set10('HAVE_DBUS', have)
69e96427 1685
1bd0cc45
YW
1686dbusdatadir = datadir / 'dbus-1'
1687if conf.get('HAVE_DBUS') == 1
1688 dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
1689endif
1690
1691dbuspolicydir = get_option('dbuspolicydir')
1692if dbuspolicydir == ''
1693 dbuspolicydir = dbusdatadir / 'system.d'
1694endif
1695
1696dbussessionservicedir = get_option('dbussessionservicedir')
1697if dbussessionservicedir == ''
1698 dbussessionservicedir = dbusdatadir / 'services'
1699 if conf.get('HAVE_DBUS') == 1
1700 dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
1701 endif
1702endif
1703
1704dbussystemservicedir = get_option('dbussystemservicedir')
1705if dbussystemservicedir == ''
1706 dbussystemservicedir = dbusdatadir / 'system-services'
1707 if conf.get('HAVE_DBUS') == 1
1708 dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
1709 endif
1710endif
1711
1712dbus_interfaces_dir = get_option('dbus-interfaces-dir')
1713if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
1714 if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
1715 dbus_interfaces_dir = 'no'
1716 warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
1717 else
1718 dbus_interfaces_dir = dbusdatadir / 'interfaces'
1719 if conf.get('HAVE_DBUS') == 1
1720 dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
1721 endif
1722 endif
1723endif
1bd0cc45 1724
e37ad765
ZJS
1725# We support one or the other. If gcrypt is available, we assume it's there to
1726# be used, and use it in preference.
1727opt = get_option('cryptolib')
1728if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1729 error('openssl requested as the default cryptolib, but not available')
1730endif
1731conf.set10('PREFER_OPENSSL',
1732 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1733conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1734 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
9bcf483b 1735lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? [libopenssl] : [libgcrypt, libgpg_error]
42303dcb 1736
56ddbf10
YW
1737dns_over_tls = get_option('dns-over-tls')
1738if dns_over_tls != 'false'
e37ad765
ZJS
1739 if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1
1740 error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib')
1741 endif
1742
1f9aa3d2
LB
1743 if dns_over_tls == 'gnutls'
1744 have_openssl = false
096cbdce 1745 else
1f9aa3d2
LB
1746 have_openssl = conf.get('HAVE_OPENSSL') == 1
1747 if dns_over_tls == 'openssl' and not have_openssl
1748 error('DNS-over-TLS support was requested with openssl, but dependencies are not available')
096cbdce 1749 endif
56ddbf10 1750 endif
1f9aa3d2
LB
1751 if dns_over_tls == 'openssl' or have_openssl
1752 have_gnutls = false
096cbdce 1753 else
1f9aa3d2
LB
1754 have_gnutls = conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0')
1755 if dns_over_tls != 'auto' and not have_gnutls
1756 str = dns_over_tls == 'gnutls' ? ' with gnutls' : ''
b349bc59 1757 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
096cbdce
IT
1758 endif
1759 endif
1760 have = have_gnutls or have_openssl
56ddbf10 1761else
be5536a6
MO
1762 have = false
1763 have_gnutls = false
1764 have_openssl = false
56ddbf10
YW
1765endif
1766conf.set10('ENABLE_DNS_OVER_TLS', have)
096cbdce
IT
1767conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1768conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
56ddbf10 1769
c9299be2 1770default_dns_over_tls = get_option('default-dns-over-tls')
87ac55a1 1771if skip_deps
c9299be2 1772 default_dns_over_tls = 'no'
5d67a7ae 1773endif
56ddbf10 1774if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
4310bfc2 1775 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 1776 default_dns_over_tls = 'no'
5d67a7ae 1777endif
c9299be2
IT
1778conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1779 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
411d1f4c 1780conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
5d67a7ae 1781
3614df05
ZJS
1782default_mdns = get_option('default-mdns')
1783conf.set('DEFAULT_MDNS_MODE',
1784 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
411d1f4c 1785conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
3614df05
ZJS
1786
1787default_llmnr = get_option('default-llmnr')
1788conf.set('DEFAULT_LLMNR_MODE',
1789 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
411d1f4c 1790conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
3614df05 1791
e594a3b1
LP
1792want_repart = get_option('repart')
1793if want_repart != 'false'
6b12086e 1794 have = conf.get('HAVE_LIBFDISK') == 1
e594a3b1
LP
1795 if want_repart == 'true' and not have
1796 error('repart support was requested, but dependencies are not available')
1797 endif
1798else
1799 have = false
1800endif
1801conf.set10('ENABLE_REPART', have)
1802
7e8facb3
ZJS
1803default_dnssec = get_option('default-dnssec')
1804if skip_deps
1805 default_dnssec = 'no'
1806endif
1807if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0
1808 message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.')
1809 default_dnssec = 'no'
1810endif
1811conf.set('DEFAULT_DNSSEC_MODE',
1812 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1813conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1814
43cc7a3e
LP
1815want_sysupdate = get_option('sysupdate')
1816if want_sysupdate != 'false'
1817 have = (conf.get('HAVE_OPENSSL') == 1 and
1818 conf.get('HAVE_LIBFDISK') == 1)
1819 if want_sysupdate == 'true' and not have
1820 error('sysupdate support was requested, but dependencies are not available')
1821 endif
1822else
1823 have = false
1824endif
1825conf.set10('ENABLE_SYSUPDATE', have)
1826
5c23128d 1827want_importd = get_option('importd')
4390be30 1828if want_importd != 'false'
349cc4a5 1829 have = (conf.get('HAVE_LIBCURL') == 1 and
6214d42b 1830 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
349cc4a5 1831 conf.get('HAVE_ZLIB') == 1 and
6214d42b 1832 conf.get('HAVE_XZ') == 1)
349cc4a5 1833 if want_importd == 'true' and not have
37efbbd8
ZJS
1834 error('importd support was requested, but dependencies are not available')
1835 endif
349cc4a5
ZJS
1836else
1837 have = false
5c23128d 1838endif
349cc4a5 1839conf.set10('ENABLE_IMPORTD', have)
5c23128d 1840
f887eab1
FB
1841want_kernel_install = get_option('kernel-install')
1842conf.set10('ENABLE_KERNEL_INSTALL', want_kernel_install)
1843
70a5db58
LP
1844want_homed = get_option('homed')
1845if want_homed != 'false'
1846 have = (conf.get('HAVE_OPENSSL') == 1 and
1847 conf.get('HAVE_LIBFDISK') == 1 and
1848 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1849 if want_homed == 'true' and not have
1850 error('homed support was requested, but dependencies are not available')
1851 endif
1852else
1853 have = false
1854endif
1855conf.set10('ENABLE_HOMED', have)
1856
af06ddf5
YW
1857have = have and conf.get('HAVE_PAM') == 1
1858conf.set10('ENABLE_PAM_HOME', have)
1859
d58c5f0f 1860have = get_option('oomd')
c199dd3f
AZ
1861conf.set10('ENABLE_OOMD', have)
1862
5c23128d 1863want_remote = get_option('remote')
4390be30 1864if want_remote != 'false'
349cc4a5
ZJS
1865 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1866 conf.get('HAVE_LIBCURL') == 1]
37efbbd8
ZJS
1867 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1868 # it's possible to build one without the other. Complain only if
5238e957 1869 # support was explicitly requested. The auxiliary files like sysusers
37efbbd8
ZJS
1870 # config should be installed when any of the programs are built.
1871 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1872 error('remote support was requested, but dependencies are not available')
1873 endif
349cc4a5
ZJS
1874 have = have_deps[0] or have_deps[1]
1875else
1876 have = false
5c23128d 1877endif
349cc4a5 1878conf.set10('ENABLE_REMOTE', have)
5c23128d 1879
b3259a6e
ZJS
1880foreach term : ['analyze',
1881 'backlight',
a9149d87 1882 'binfmt',
dfca5587 1883 'compat-mutable-uid-boundaries',
a9149d87 1884 'coredump',
b3259a6e
ZJS
1885 'efi',
1886 'environment-d',
1887 'firstboot',
1888 'gshadow',
1889 'hibernate',
a9149d87 1890 'hostnamed',
b3259a6e
ZJS
1891 'hwdb',
1892 'idn',
1893 'ima',
1894 'initrd',
1895 'ldconfig',
a9149d87 1896 'localed',
b3259a6e 1897 'logind',
a9149d87
ZJS
1898 'machined',
1899 'networkd',
dfca5587 1900 'nscd',
b3259a6e
ZJS
1901 'nss-myhostname',
1902 'nss-systemd',
1903 'portabled',
1904 'pstore',
a9149d87 1905 'quotacheck',
b3259a6e
ZJS
1906 'randomseed',
1907 'resolve',
1908 'rfkill',
1909 'smack',
dfca5587 1910 'sysext',
a9149d87 1911 'sysusers',
b3259a6e
ZJS
1912 'timedated',
1913 'timesyncd',
a9149d87 1914 'tmpfiles',
a9149d87 1915 'tpm',
b3259a6e
ZJS
1916 'userdb',
1917 'utmp',
1918 'vconsole',
1919 'xdg-autostart']
a9149d87
ZJS
1920 have = get_option(term)
1921 name = 'ENABLE_' + term.underscorify().to_upper()
1922 conf.set10(name, have)
5c23128d
ZJS
1923endforeach
1924
bd7e6aa7
ZJS
1925enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1926
08540a95
YW
1927foreach tuple : [['nss-mymachines', 'machined'],
1928 ['nss-resolve', 'resolve']]
1929 want = get_option(tuple[0])
1930 if want != 'false'
1931 have = get_option(tuple[1])
1932 if want == 'true' and not have
1933 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1934 endif
1935 else
1936 have = false
1937 endif
1938 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1939 conf.set10(name, have)
1940endforeach
1941
1942enable_nss = false
1943foreach term : ['ENABLE_NSS_MYHOSTNAME',
1944 'ENABLE_NSS_MYMACHINES',
1945 'ENABLE_NSS_RESOLVE',
1946 'ENABLE_NSS_SYSTEMD']
1947 if conf.get(term) == 1
1948 enable_nss = true
1949 endif
1950endforeach
1951conf.set10('ENABLE_NSS', enable_nss)
1952
348b4437 1953conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
6129ec85 1954
b68dfb9e 1955conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
00d82c81 1956
db7f5ab6
JJ
1957############################################################
1958
1959tests = []
c12e10d7 1960simple_tests = []
db7f5ab6 1961fuzzers = []
a9a7153c 1962simple_fuzzers = []
e93ada98 1963catalogs = []
db7f5ab6
JJ
1964
1965############################################################
5c23128d 1966
9c45bfb2
FS
1967pymod = import('python')
1968python = pymod.find_installation('python3', required : true, modules : ['jinja2'])
1969python_39 = python.language_version().version_compare('>=3.9')
1970
4d3ef2d1
LP
1971############################################################
1972
1973if conf.get('BPF_FRAMEWORK') == 1
1974 bpf_clang_flags = [
1975 '-std=gnu11',
1976 '-Wno-compare-distinct-pointer-types',
1977 '-fno-stack-protector',
1978 '-O2',
1979 '-target',
1980 'bpf',
1981 '-g',
1982 '-c',
1983 ]
1984
1985 bpf_gcc_flags = [
1986 '-std=gnu11',
1987 '-fno-stack-protector',
1988 '-O2',
1989 '-mkernel=5.2',
1990 '-mcpu=v3',
1991 '-mco-re',
1992 '-gbtf',
1993 '-c',
1994 ]
1995
1996 # Generate defines that are appropriate to tell the compiler what architecture
1997 # we're compiling for. By default we just map meson's cpu_family to __<cpu_family>__.
1998 # This dictionary contains the exceptions where this doesn't work.
1999 #
2000 # C.f. https://mesonbuild.com/Reference-tables.html#cpu-families
2001 # and src/basic/missing_syscall_def.h.
2002 cpu_arch_defines = {
2003 'ppc' : ['-D__powerpc__'],
2004 'ppc64' : ['-D__powerpc64__', '-D_CALL_ELF=2'],
2005 'riscv32' : ['-D__riscv', '-D__riscv_xlen=32'],
2006 'riscv64' : ['-D__riscv', '-D__riscv_xlen=64'],
2007 'x86' : ['-D__i386__'],
2008
2009 # For arm, assume hardware fp is available.
2010 'arm' : ['-D__arm__', '-D__ARM_PCS_VFP'],
2011 }
2012
2013 bpf_arch_flags = cpu_arch_defines.get(host_machine.cpu_family(),
2014 ['-D__@0@__'.format(host_machine.cpu_family())])
2015 if bpf_compiler == 'gcc'
2016 bpf_arch_flags += ['-m' + host_machine.endian() + '-endian']
2017 endif
2018
2019 libbpf_include_dir = libbpf.get_variable(pkgconfig : 'includedir')
2020
2021 bpf_o_unstripped_cmd = []
2022 if bpf_compiler == 'clang'
2023 bpf_o_unstripped_cmd += [
2024 clang,
2025 bpf_clang_flags,
2026 bpf_arch_flags,
2027 ]
2028 elif bpf_compiler == 'gcc'
2029 bpf_o_unstripped_cmd += [
2030 bpf_gcc,
2031 bpf_gcc_flags,
2032 bpf_arch_flags,
2033 ]
2034 endif
2035
2036 bpf_o_unstripped_cmd += ['-I.']
2037
2038 if not meson.is_cross_build() and bpf_compiler == 'clang'
2039 target_triplet_cmd = run_command('gcc', '-dumpmachine', check: false)
2040 if target_triplet_cmd.returncode() == 0
2041 target_triplet = target_triplet_cmd.stdout().strip()
2042 bpf_o_unstripped_cmd += [
2043 '-isystem',
2044 '/usr/include/@0@'.format(target_triplet)
2045 ]
2046 endif
2047 endif
2048
2049 bpf_o_unstripped_cmd += [
2050 '-idirafter',
2051 libbpf_include_dir,
2052 '@INPUT@',
2053 '-o',
2054 '@OUTPUT@'
2055 ]
2056
2057 if bpftool_strip
2058 bpf_o_cmd = [
2059 bpftool,
2060 'gen',
2061 'object',
2062 '@OUTPUT@',
2063 '@INPUT@'
2064 ]
2065 elif bpf_compiler == 'clang'
2066 bpf_o_cmd = [
2067 llvm_strip,
2068 '-g',
2069 '@INPUT@',
2070 '-o',
2071 '@OUTPUT@'
2072 ]
2073 endif
2074
2075 skel_h_cmd = [
2076 bpftool,
2077 'gen',
2078 'skeleton',
2079 '@INPUT@'
2080 ]
2081endif
2082
dfca5587
JJ
2083#####################################################################
2084
2085efi_arch = {
31ffb6b1
JJ
2086 'aarch64' : 'aa64',
2087 'arm' : 'arm',
2088 'loongarch32' : 'loongarch32',
2089 'loongarch64' : 'loongarch64',
2090 'riscv32' : 'riscv32',
2091 'riscv64' : 'riscv64',
2092 'x86_64' : 'x64',
2093 'x86' : 'ia32',
dfca5587
JJ
2094}.get(host_machine.cpu_family(), '')
2095
2096if get_option('bootloader') != 'false' and efi_arch != ''
2097 conf.set_quoted('EFI_MACHINE_TYPE_NAME', efi_arch)
2098elif get_option('bootloader') == 'true' and efi_arch == ''
2099 error('EFI not supported for this arch.')
2100endif
2afeaf16
JJ
2101
2102efi_arch_alt = ''
2103if efi_arch == 'x64' and cc.links('''
2104 #include <limits.h>
2105 int main(int argc, char *argv[]) {
2106 return __builtin_popcount(argc - CHAR_MAX);
2107 }''', args : ['-m32', '-march=i686'], name : '32bit build possible')
2108 efi_arch_alt = 'ia32'
2109endif
2110
2111have_pyelftools = pymod.find_installation('python3', required : false, modules : ['elftools']).found()
2112if get_option('bootloader') == 'true' and (not python_39 or not have_pyelftools)
2113 error('EFI bootloader support requires Python >= 3.9 and pyelftools.')
2114endif
2115
dfca5587
JJ
2116conf.set10(
2117 'ENABLE_BOOTLOADER',
2118 get_option('efi') and
2119 get_option('bootloader') in ['auto', 'true'] and
2afeaf16
JJ
2120 efi_arch != '' and
2121 python_39 and
2122 have_pyelftools,
dfca5587
JJ
2123)
2124
9c45bfb2 2125if get_option('ukify') == 'auto'
dfca5587
JJ
2126 want_ukify = python_39 and conf.get('ENABLE_BOOTLOADER') == 1
2127elif get_option('ukify') == 'true' and (not python_39 or conf.get('ENABLE_BOOTLOADER') != 1)
2128 error('ukify requires Python >= 3.9 and -Dbootloader=true')
9c45bfb2
FS
2129else
2130 want_ukify = get_option('ukify') == 'true'
2131endif
2132conf.set10('ENABLE_UKIFY', want_ukify)
2133
2134############################################################
2135#
2afeaf16
JJ
2136elf2efi_lds = project_source_root / 'tools/elf2efi.lds'
2137elf2efi_py = find_program('tools/elf2efi.py')
2138export_dbus_interfaces_py = find_program('tools/dbus_exporter.py')
d3821a33 2139generate_gperfs = find_program('tools/generate-gperfs.py')
f6fe732f
YW
2140make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
2141make_directive_index_py = find_program('tools/make-directive-index.py')
2142make_man_index_py = find_program('tools/make-man-index.py')
6b1aac3c 2143meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
d3821a33 2144update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
d3821a33 2145update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
2afeaf16
JJ
2146update_hwdb_sh = find_program('tools/update-hwdb.sh')
2147update_man_rules_py = find_program('tools/update-man-rules.py')
d3821a33
ZJS
2148update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
2149xml_helper_py = find_program('tools/xml_helper.py')
f6fe732f 2150
db7f5ab6 2151############################################################
5c23128d 2152
7e43be7d 2153if get_option('b_coverage')
92148283 2154 userspace_c_args += ['-include', 'src/basic/coverage.h']
7e43be7d
FS
2155endif
2156
2157############################################################
2158
5c23128d 2159config_h = configure_file(
37efbbd8
ZJS
2160 output : 'config.h',
2161 configuration : conf)
5c23128d 2162
92148283 2163userspace_c_args += ['-include', 'config.h']
f6fe732f 2164
8f04a1ca
ZJS
2165jinja2_cmdline = [meson_render_jinja2, config_h, version_h]
2166
92148283
JJ
2167userspace = declare_dependency(
2168 compile_args : userspace_c_args,
2169 link_args : userspace_c_ld_args,
2170)
2171
f6fe732f 2172############################################################
348b4437 2173
b61016f2
YW
2174# binaries that have --help and are intended for use by humans,
2175# usually, but not always, installed in /bin.
2176public_programs = []
2177
e3c68924 2178# D-Bus introspection XML export
2179dbus_programs = []
e3c68924 2180
3f80c139
ZJS
2181# A list of boot stubs. Required for testing of ukify.
2182boot_stubs = []
2183
8d40961c
YW
2184basic_includes = include_directories(
2185 'src/basic',
e5bc5f1f 2186 'src/fundamental',
8d40961c
YW
2187 'src/systemd',
2188 '.')
2189
2190libsystemd_includes = [basic_includes, include_directories(
2191 'src/libsystemd/sd-bus',
2192 'src/libsystemd/sd-device',
2193 'src/libsystemd/sd-event',
2194 'src/libsystemd/sd-hwdb',
2195 'src/libsystemd/sd-id128',
2196 'src/libsystemd/sd-journal',
2197 'src/libsystemd/sd-netlink',
2198 'src/libsystemd/sd-network',
2199 'src/libsystemd/sd-resolve')]
2200
2201includes = [libsystemd_includes, include_directories('src/shared')]
5c23128d 2202
5c23128d
ZJS
2203subdir('po')
2204subdir('catalog')
dfca5587 2205subdir('src/fundamental')
5c23128d
ZJS
2206subdir('src/basic')
2207subdir('src/libsystemd')
3976f372
YW
2208subdir('src/shared')
2209subdir('src/udev')
2210subdir('src/libudev')
d1ae38d8 2211subdir('src/cryptsetup/cryptsetup-tokens')
5c23128d 2212
039f1673
LB
2213alias_target('devel', libsystemd_pc, libudev_pc)
2214
5c23128d 2215libsystemd = shared_library(
37efbbd8 2216 'systemd',
56d50ab1 2217 version : libsystemd_version,
8d40961c 2218 include_directories : libsystemd_includes,
37efbbd8
ZJS
2219 link_args : ['-shared',
2220 '-Wl,--version-script=' + libsystemd_sym_path],
34e221a5 2221 link_with : [libbasic,
acc50c92
LP
2222 libbasic_gcrypt,
2223 libbasic_compress],
99b9f8fd 2224 link_whole : [libsystemd_static],
92148283
JJ
2225 dependencies : [librt,
2226 threads,
2227 userspace],
37efbbd8
ZJS
2228 link_depends : libsystemd_sym,
2229 install : true,
0a5e638c 2230 install_tag: 'libsystemd',
37efbbd8 2231 install_dir : rootlibdir)
5c23128d 2232
039f1673
LB
2233alias_target('libsystemd', libsystemd)
2234
70848ecf
DC
2235install_libsystemd_static = static_library(
2236 'systemd',
2237 libsystemd_sources,
975464e0
ZJS
2238 basic_sources,
2239 basic_gcrypt_sources,
acc50c92 2240 basic_compress_sources,
e5bc5f1f 2241 fundamental_sources,
8d40961c 2242 include_directories : libsystemd_includes,
70848ecf
DC
2243 build_by_default : static_libsystemd != 'false',
2244 install : static_libsystemd != 'false',
0a5e638c 2245 install_tag: 'libsystemd',
70848ecf 2246 install_dir : rootlibdir,
40dbce36 2247 pic : static_libsystemd_pic,
92148283 2248 dependencies : [libblkid,
975464e0 2249 libcap,
92148283 2250 libdl,
011d129c 2251 libgcrypt,
92148283
JJ
2252 liblz4,
2253 libmount,
c47511da 2254 libopenssl,
92148283
JJ
2255 librt,
2256 libxz,
2257 libzstd,
2258 threads,
2259 userspace,
c47511da 2260 versiondep],
70848ecf
DC
2261 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
2262
3976f372
YW
2263libudev = shared_library(
2264 'udev',
3976f372
YW
2265 version : libudev_version,
2266 include_directories : includes,
2267 link_args : ['-shared',
2268 '-Wl,--version-script=' + libudev_sym_path],
2269 link_with : [libsystemd_static, libshared_static],
2270 link_whole : libudev_basic,
92148283
JJ
2271 dependencies : [threads,
2272 userspace],
3976f372
YW
2273 link_depends : libudev_sym,
2274 install : true,
0a5e638c 2275 install_tag: 'libudev',
3976f372
YW
2276 install_dir : rootlibdir)
2277
039f1673
LB
2278alias_target('libudev', libudev)
2279
3976f372
YW
2280install_libudev_static = static_library(
2281 'udev',
2282 basic_sources,
e5bc5f1f 2283 fundamental_sources,
3976f372
YW
2284 shared_sources,
2285 libsystemd_sources,
2286 libudev_sources,
3976f372
YW
2287 include_directories : includes,
2288 build_by_default : static_libudev != 'false',
2289 install : static_libudev != 'false',
0a5e638c 2290 install_tag: 'libudev',
3976f372
YW
2291 install_dir : rootlibdir,
2292 link_depends : libudev_sym,
92148283
JJ
2293 dependencies : [libmount,
2294 libshared_deps,
2295 userspace,
c47511da 2296 versiondep],
3976f372
YW
2297 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
2298 pic : static_libudev_pic)
2299
d1ae38d8
OK
2300if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
2301 if conf.get('HAVE_TPM2') == 1
6249face 2302 shared_library(
d1ae38d8 2303 'cryptsetup-token-systemd-tpm2',
c01543fd
ZJS
2304 cryptsetup_token_systemd_tpm2_sources,
2305 include_directories : includes,
d1ae38d8
OK
2306 link_args : ['-shared',
2307 '-Wl,--version-script=' + cryptsetup_token_sym_path],
c01543fd
ZJS
2308 link_with : [lib_cryptsetup_token_common,
2309 libshared],
2310 dependencies : [libcryptsetup,
2311 tpm2,
92148283 2312 userspace,
c01543fd 2313 versiondep],
d1ae38d8 2314 link_depends : cryptsetup_token_sym,
5fb22561 2315 install_rpath : rootpkglibdir,
d1ae38d8
OK
2316 install : true,
2317 install_dir : libcryptsetup_plugins_dir)
2318 endif
351716e1
OK
2319
2320 if conf.get('HAVE_LIBFIDO2') == 1
6249face 2321 shared_library(
351716e1 2322 'cryptsetup-token-systemd-fido2',
c01543fd
ZJS
2323 cryptsetup_token_systemd_fido2_sources,
2324 include_directories : includes,
351716e1
OK
2325 link_args : ['-shared',
2326 '-Wl,--version-script=' + cryptsetup_token_sym_path],
c01543fd
ZJS
2327 link_with : [lib_cryptsetup_token_common,
2328 libshared],
2329 dependencies : [libcryptsetup,
2330 libfido2,
92148283 2331 userspace,
c01543fd 2332 versiondep],
351716e1 2333 link_depends : cryptsetup_token_sym,
5fb22561 2334 install_rpath : rootpkglibdir,
351716e1
OK
2335 install : true,
2336 install_dir : libcryptsetup_plugins_dir)
2337 endif
8186022c
OK
2338
2339 if conf.get('HAVE_P11KIT') == 1
6249face 2340 shared_library(
8186022c 2341 'cryptsetup-token-systemd-pkcs11',
c01543fd
ZJS
2342 cryptsetup_token_systemd_pkcs11_sources,
2343 include_directories : includes,
8186022c
OK
2344 link_args : ['-shared',
2345 '-Wl,--version-script=' + cryptsetup_token_sym_path],
c01543fd
ZJS
2346 link_with : [lib_cryptsetup_token_common,
2347 libshared],
2348 dependencies : [libcryptsetup,
2349 libp11kit,
92148283 2350 userspace,
c01543fd 2351 versiondep],
8186022c 2352 link_depends : cryptsetup_token_sym,
5fb22561 2353 install_rpath : rootpkglibdir,
8186022c
OK
2354 install : true,
2355 install_dir : libcryptsetup_plugins_dir)
2356 endif
d1ae38d8
OK
2357endif
2358
47354b44
ZJS
2359############################################################
2360
b61016f2 2361# systemd-analyze requires 'libcore'
83b6af36 2362subdir('src/core')
b61016f2
YW
2363# systemd-journal-remote requires 'libjournal_core'
2364subdir('src/journal')
2365# systemd-networkd requires 'libsystemd_network'
2366subdir('src/libsystemd-network')
83b6af36
ZJS
2367
2368subdir('src/analyze')
cd4300f3 2369subdir('src/boot')
dfca5587 2370subdir('src/boot/efi')
f98df767 2371subdir('src/busctl')
b61016f2 2372subdir('src/coredump')
2ad279cf 2373subdir('src/cryptenroll')
b4d1892a 2374subdir('src/cryptsetup')
b61016f2 2375subdir('src/home')
83b6af36
ZJS
2376subdir('src/hostname')
2377subdir('src/import')
b61016f2 2378subdir('src/journal-remote')
83b6af36
ZJS
2379subdir('src/kernel-install')
2380subdir('src/locale')
b61016f2 2381subdir('src/login')
83b6af36 2382subdir('src/machine')
b61016f2 2383subdir('src/network')
83b6af36 2384subdir('src/nspawn')
b61016f2
YW
2385subdir('src/oom')
2386subdir('src/partition')
2387subdir('src/portable')
2388subdir('src/pstore')
83b6af36 2389subdir('src/resolve')
2a9b4bbe 2390subdir('src/rpm')
b61016f2 2391subdir('src/shutdown')
9bca4ae4 2392subdir('src/sysext')
c3512573 2393subdir('src/systemctl')
43cc7a3e 2394subdir('src/sysupdate')
83b6af36
ZJS
2395subdir('src/timedate')
2396subdir('src/timesync')
db64ba81 2397subdir('src/tmpfiles')
b61016f2 2398subdir('src/userdb')
0275e918 2399subdir('src/xdg-autostart-generator')
83b6af36 2400
3976f372
YW
2401subdir('src/systemd')
2402
83b6af36 2403subdir('src/test')
7db7d5b7 2404subdir('src/fuzz')
ef2ad30a 2405subdir('rules.d')
83b6af36 2406subdir('test')
a1d6dbb1 2407subdir('src/ukify/test') # needs to be last for test_env variable
83b6af36
ZJS
2408
2409############################################################
2410
2411# only static linking apart from libdl, to make sure that the
2412# module is linked to all libraries that it uses.
2413test_dlopen = executable(
37efbbd8
ZJS
2414 'test-dlopen',
2415 test_dlopen_c,
2416 include_directories : includes,
2417 link_with : [libbasic],
92148283
JJ
2418 dependencies : [libdl,
2419 userspace],
fd1939fb 2420 build_by_default : want_tests != 'false')
83b6af36 2421
08540a95 2422foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
cbaaf7b9 2423 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
08540a95 2424 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
8d40961c 2425 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
5c23128d 2426
349cc4a5 2427 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
37efbbd8
ZJS
2428 if condition
2429 module = tuple[0]
37efbbd8
ZJS
2430
2431 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
fce9abb2 2432 version_script_arg = project_source_root / sym
37efbbd8 2433
1684c56f
LP
2434 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
2435 if tuple.length() > 2
cbaaf7b9
YW
2436 foreach s : tuple[2]
2437 sources += ['src/nss-@0@/@1@'.format(module, s)]
2438 endforeach
1684c56f
LP
2439 endif
2440
8d40961c
YW
2441 incs = tuple.length() > 3 ? tuple[3] : includes
2442
37efbbd8
ZJS
2443 nss = shared_library(
2444 'nss_' + module,
1684c56f 2445 sources,
37efbbd8 2446 version : '2',
8d40961c 2447 include_directories : incs,
b4b36f44
LP
2448 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
2449 link_args : ['-Wl,-z,nodelete',
2450 '-shared',
700805f6 2451 '-Wl,--version-script=' + version_script_arg],
37e4d7a8 2452 link_with : [libsystemd_static,
733cbd00 2453 libshared_static,
37efbbd8 2454 libbasic],
92148283
JJ
2455 dependencies : [librt,
2456 threads,
2457 userspace],
37efbbd8
ZJS
2458 link_depends : sym,
2459 install : true,
35d17e15 2460 install_tag : 'nss',
37efbbd8
ZJS
2461 install_dir : rootlibdir)
2462
2463 # We cannot use shared_module because it does not support version suffix.
2464 # Unfortunately shared_library insists on creating the symlink…
7c22f07c 2465 meson.add_install_script('sh', '-c',
37efbbd8 2466 'rm $DESTDIR@0@/libnss_@1@.so'
35d17e15
MG
2467 .format(rootlibdir, module),
2468 install_tag : 'nss'
2469 )
37efbbd8 2470
938be089
ZJS
2471 if want_tests != 'false'
2472 test('dlopen-nss_' + module,
2473 test_dlopen,
2474 # path to dlopen must include a slash
e93ada98
DDM
2475 args : nss.full_path(),
2476 depends : nss)
938be089 2477 endif
37efbbd8 2478 endif
5c23128d
ZJS
2479endforeach
2480
2481############################################################
2482
3761002e 2483exe = executable(
6164ec4c
ZJS
2484 'systemd',
2485 systemd_sources,
2486 include_directories : includes,
2487 link_with : [libcore,
2488 libshared],
c47511da 2489 dependencies : [libseccomp,
92148283 2490 userspace,
c47511da 2491 versiondep],
5fb22561 2492 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2493 install : true,
2494 install_dir : rootlibexecdir)
3761002e
ZJS
2495dbus_programs += exe
2496public_programs += exe
5c23128d 2497
ba7f4ae6 2498meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
2499 rootlibexecdir / 'systemd',
2500 rootsbindir / 'init')
ba7f4ae6 2501
4e8295f4 2502exe = executable(
6164ec4c
ZJS
2503 'systemd-analyze',
2504 systemd_analyze_sources,
8d40961c 2505 include_directories : core_includes,
6164ec4c
ZJS
2506 link_with : [libcore,
2507 libshared],
c47511da 2508 dependencies : [libseccomp,
92148283 2509 userspace,
c47511da 2510 versiondep],
5fb22561 2511 install_rpath : rootpkglibdir,
9e4a50bc 2512 install : conf.get('ENABLE_ANALYZE') == 1)
9a01fe39
ZJS
2513if conf.get('ENABLE_ANALYZE') == 1
2514 public_programs += exe
2515endif
4e8295f4
ZJS
2516
2517if want_tests != 'false'
2518 test('test-compare-versions',
2519 test_compare_versions_sh,
2520 args : exe.full_path())
2521endif
5c23128d 2522
6164ec4c
ZJS
2523executable(
2524 'systemd-journald',
2525 systemd_journald_sources,
2526 include_directories : includes,
2527 link_with : [libjournal_core,
2528 libshared],
92148283 2529 dependencies : [liblz4,
ef5924aa 2530 libselinux,
92148283 2531 libxz,
c47511da 2532 libzstd,
92148283
JJ
2533 threads,
2534 userspace,
c47511da 2535 versiondep],
5fb22561 2536 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2537 install : true,
2538 install_dir : rootlibexecdir)
5c23128d 2539
6164ec4c
ZJS
2540public_programs += executable(
2541 'systemd-cat',
2542 systemd_cat_sources,
2543 include_directories : includes,
2544 link_with : [libjournal_core,
2545 libshared],
3a21c554 2546 dependencies : [threads,
92148283 2547 userspace,
3a21c554 2548 versiondep],
5fb22561 2549 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2550 install : true)
2551
0a0d4899 2552if get_option('link-journalctl-shared')
46fb302f 2553 journalctl_link_with = [libshared]
0a0d4899
JH
2554else
2555 journalctl_link_with = [libsystemd_static,
2556 libshared_static,
46fb302f 2557 libbasic_gcrypt]
0a0d4899
JH
2558endif
2559
6164ec4c
ZJS
2560public_programs += executable(
2561 'journalctl',
2562 journalctl_sources,
2563 include_directories : includes,
0a0d4899 2564 link_with : [journalctl_link_with],
92148283 2565 dependencies : [libdl,
6164ec4c 2566 liblz4,
92148283 2567 libxz,
9200bb30 2568 libzstd,
92148283
JJ
2569 threads,
2570 userspace,
c47511da 2571 versiondep],
5fb22561 2572 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2573 install : true,
2574 install_dir : rootbindir)
35a1ff4c 2575
6164ec4c
ZJS
2576executable(
2577 'systemd-getty-generator',
2578 'src/getty-generator/getty-generator.c',
2579 include_directories : includes,
2580 link_with : [libshared],
92148283 2581 dependencies : userspace,
5fb22561 2582 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2583 install : true,
2584 install_dir : systemgeneratordir)
5c23128d 2585
6164ec4c
ZJS
2586executable(
2587 'systemd-debug-generator',
2588 'src/debug-generator/debug-generator.c',
2589 include_directories : includes,
2590 link_with : [libshared],
92148283 2591 dependencies : userspace,
5fb22561 2592 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2593 install : true,
2594 install_dir : systemgeneratordir)
2595
2596executable(
2597 'systemd-run-generator',
2598 'src/run-generator/run-generator.c',
2599 include_directories : includes,
2600 link_with : [libshared],
92148283 2601 dependencies : userspace,
5fb22561 2602 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2603 install : true,
2604 install_dir : systemgeneratordir)
2605
8cc8a073 2606exe = executable(
6164ec4c
ZJS
2607 'systemd-fstab-generator',
2608 'src/fstab-generator/fstab-generator.c',
2609 include_directories : includes,
bac11cd6 2610 link_with : [libshared],
92148283 2611 dependencies : userspace,
5fb22561 2612 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2613 install : true,
2614 install_dir : systemgeneratordir)
5c23128d 2615
028a981c
ZJS
2616meson.add_install_script(meson_make_symlink,
2617 systemgeneratordir / 'systemd-fstab-generator',
2618 rootlibexecdir / 'systemd-sysroot-fstab-check')
2619
8cc8a073
YW
2620if want_tests != 'false'
2621 test('test-fstab-generator',
2622 test_fstab_generator_sh,
2623 # https://github.com/mesonbuild/meson/issues/2681
e93ada98
DDM
2624 args : exe.full_path(),
2625 depends : exe)
8cc8a073
YW
2626endif
2627
349cc4a5 2628if conf.get('ENABLE_ENVIRONMENT_D') == 1
6164ec4c
ZJS
2629 executable(
2630 '30-systemd-environment-d-generator',
2631 'src/environment-d-generator/environment-d-generator.c',
2632 include_directories : includes,
2633 link_with : [libshared],
92148283 2634 dependencies : userspace,
5fb22561 2635 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2636 install : true,
2637 install_dir : userenvgeneratordir)
7b76fce1 2638
37efbbd8 2639 meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
2640 sysconfdir / 'environment',
2641 environmentdir / '99-environment.conf')
5c23128d
ZJS
2642endif
2643
349cc4a5 2644if conf.get('ENABLE_HIBERNATE') == 1
6164ec4c
ZJS
2645 executable(
2646 'systemd-hibernate-resume-generator',
2647 'src/hibernate-resume/hibernate-resume-generator.c',
2648 include_directories : includes,
2649 link_with : [libshared],
92148283 2650 dependencies : userspace,
5fb22561 2651 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2652 install : true,
2653 install_dir : systemgeneratordir)
2654
2655 executable(
2656 'systemd-hibernate-resume',
2657 'src/hibernate-resume/hibernate-resume.c',
2658 include_directories : includes,
2659 link_with : [libshared],
92148283 2660 dependencies : userspace,
5fb22561 2661 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2662 install : true,
2663 install_dir : rootlibexecdir)
37efbbd8
ZJS
2664endif
2665
349cc4a5 2666if conf.get('HAVE_BLKID') == 1
6164ec4c
ZJS
2667 executable(
2668 'systemd-gpt-auto-generator',
2669 'src/gpt-auto-generator/gpt-auto-generator.c',
6164ec4c
ZJS
2670 include_directories : includes,
2671 link_with : [libshared],
92148283
JJ
2672 dependencies : [libblkid,
2673 userspace],
5fb22561 2674 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2675 install : true,
2676 install_dir : systemgeneratordir)
2677
2678 public_programs += executable(
2679 'systemd-dissect',
2680 'src/dissect/dissect.c',
2681 include_directories : includes,
2682 link_with : [libshared],
92148283
JJ
2683 dependencies : [userspace,
2684 versiondep],
5fb22561 2685 install_rpath : rootpkglibdir,
5a151082 2686 install : true)
a164d9d5
LP
2687
2688 meson.add_install_script(meson_make_symlink,
2689 bindir / 'systemd-dissect',
2690 rootsbindir / 'mount.ddi')
5c23128d
ZJS
2691endif
2692
1ec57f33 2693if conf.get('ENABLE_RESOLVE') == 1
e3c68924 2694 dbus_programs += executable(
6164ec4c
ZJS
2695 'systemd-resolved',
2696 systemd_resolved_sources,
8d40961c 2697 include_directories : resolve_includes,
6164ec4c
ZJS
2698 link_with : [libshared,
2699 libbasic_gcrypt,
2700 libsystemd_resolve_core],
92148283
JJ
2701 dependencies : [systemd_resolved_dependencies,
2702 userspace],
5fb22561 2703 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2704 install : true,
2705 install_dir : rootlibexecdir)
2706
2707 public_programs += executable(
2708 'resolvectl',
2709 resolvectl_sources,
2710 include_directories : includes,
2711 link_with : [libshared,
2712 libbasic_gcrypt,
2713 libsystemd_resolve_core],
92148283 2714 dependencies : [lib_openssl_or_gcrypt,
c47511da 2715 libidn,
92148283
JJ
2716 libm,
2717 threads,
2718 userspace,
c47511da 2719 versiondep],
5fb22561 2720 install_rpath : rootpkglibdir,
6164ec4c 2721 install : true)
088c1363
LP
2722
2723 meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
2724 bindir / 'resolvectl',
2725 rootsbindir / 'resolvconf')
c2e84cab
YW
2726
2727 meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
2728 bindir / 'resolvectl',
2729 bindir / 'systemd-resolve')
5c23128d
ZJS
2730endif
2731
349cc4a5 2732if conf.get('ENABLE_LOGIND') == 1
e3c68924 2733 dbus_programs += executable(
6164ec4c
ZJS
2734 'systemd-logind',
2735 systemd_logind_sources,
2736 include_directories : includes,
2737 link_with : [liblogind_core,
2738 libshared],
92148283
JJ
2739 dependencies : [libacl,
2740 threads,
2741 userspace,
c47511da 2742 versiondep],
5fb22561 2743 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2744 install : true,
2745 install_dir : rootlibexecdir)
2746
2747 public_programs += executable(
2748 'loginctl',
2749 loginctl_sources,
2750 include_directories : includes,
2751 link_with : [libshared],
92148283 2752 dependencies : [liblz4,
ef5924aa 2753 libxz,
c47511da 2754 libzstd,
92148283
JJ
2755 threads,
2756 userspace,
c47511da 2757 versiondep],
5fb22561 2758 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2759 install : true,
2760 install_dir : rootbindir)
2761
2762 public_programs += executable(
2763 'systemd-inhibit',
2764 'src/login/inhibit.c',
2765 include_directories : includes,
2766 link_with : [libshared],
92148283
JJ
2767 dependencies : [userspace,
2768 versiondep],
5fb22561 2769 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2770 install : true,
2771 install_dir : rootbindir)
37efbbd8 2772
349cc4a5 2773 if conf.get('HAVE_PAM') == 1
fce9abb2 2774 version_script_arg = project_source_root / pam_systemd_sym
37efbbd8
ZJS
2775 pam_systemd = shared_library(
2776 'pam_systemd',
2777 pam_systemd_c,
2778 name_prefix : '',
2779 include_directories : includes,
2780 link_args : ['-shared',
2781 '-Wl,--version-script=' + version_script_arg],
37e4d7a8 2782 link_with : [libsystemd_static,
37efbbd8 2783 libshared_static],
92148283 2784 dependencies : [libpam_misc,
37efbbd8 2785 libpam,
92148283
JJ
2786 threads,
2787 userspace,
c47511da 2788 versiondep],
37efbbd8
ZJS
2789 link_depends : pam_systemd_sym,
2790 install : true,
48139c7c 2791 install_tag : 'pam',
37efbbd8
ZJS
2792 install_dir : pamlibdir)
2793
938be089
ZJS
2794 if want_tests != 'false'
2795 test('dlopen-pam_systemd',
2796 test_dlopen,
2797 # path to dlopen must include a slash
e93ada98
DDM
2798 args : pam_systemd.full_path(),
2799 depends : pam_systemd)
938be089 2800 endif
37efbbd8 2801 endif
005a29f2 2802
6164ec4c
ZJS
2803 executable(
2804 'systemd-user-runtime-dir',
2805 user_runtime_dir_sources,
2806 include_directories : includes,
2807 link_with : [libshared],
92148283 2808 dependencies : userspace,
5fb22561 2809 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2810 install : true,
2811 install_dir : rootlibexecdir)
07ee5adb 2812endif
a9f0f5e5 2813
349cc4a5 2814if conf.get('HAVE_PAM') == 1
6164ec4c
ZJS
2815 executable(
2816 'systemd-user-sessions',
2817 'src/user-sessions/user-sessions.c',
2818 include_directories : includes,
2819 link_with : [libshared],
92148283 2820 dependencies : userspace,
5fb22561 2821 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2822 install : true,
2823 install_dir : rootlibexecdir)
5c23128d
ZJS
2824endif
2825
dfca5587 2826if conf.get('HAVE_BLKID') == 1 and conf.get('ENABLE_BOOTLOADER') == 1
79647020
RS
2827 if get_option('link-boot-shared')
2828 boot_link_with = [libshared]
2829 else
2830 boot_link_with = [libsystemd_static, libshared_static]
2831 endif
2832
50f2c32c 2833 exe = executable(
6164ec4c 2834 'bootctl',
cd4300f3 2835 bootctl_sources,
6164ec4c 2836 include_directories : includes,
79647020 2837 link_with : [boot_link_with],
c47511da 2838 dependencies : [libblkid,
92148283 2839 userspace,
c47511da 2840 versiondep],
5fb22561 2841 install_rpath : rootpkglibdir,
6164ec4c 2842 install : true)
50f2c32c
ZJS
2843 public_programs += exe
2844
2845 if want_tests != 'false'
2846 test('test-bootctl-json',
2847 test_bootctl_json_sh,
2848 args : exe.full_path(),
2849 depends : exe)
2850 endif
6164ec4c
ZJS
2851
2852 public_programs += executable(
2853 'systemd-bless-boot',
2854 'src/boot/bless-boot.c',
2855 include_directories : includes,
79647020 2856 link_with : [boot_link_with],
c47511da 2857 dependencies : [libblkid,
92148283 2858 userspace,
c47511da 2859 versiondep],
5fb22561 2860 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2861 install : true,
2862 install_dir : rootlibexecdir)
2863
2864 executable(
2865 'systemd-bless-boot-generator',
2866 'src/boot/bless-boot-generator.c',
2867 include_directories : includes,
79647020 2868 link_with : [boot_link_with],
92148283 2869 dependencies : userspace,
5fb22561 2870 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2871 install : true,
2872 install_dir : systemgeneratordir)
ca1092dc 2873
3286770d 2874 if conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_TPM2') == 1
ca1092dc
LP
2875 executable(
2876 'systemd-measure',
2877 'src/boot/measure.c',
2878 include_directories : includes,
2879 link_with : [libshared],
c47511da 2880 dependencies : [libopenssl,
92148283 2881 userspace,
c47511da 2882 versiondep],
ca1092dc
LP
2883 install_rpath : rootpkglibdir,
2884 install : true,
2885 install_dir : rootlibexecdir)
708d7524
LP
2886 executable(
2887 'systemd-pcrphase',
2888 'src/boot/pcrphase.c',
2889 include_directories : includes,
2890 link_with : [libshared],
92148283
JJ
2891 dependencies : [libblkid,
2892 libopenssl,
c47511da 2893 tpm2,
92148283 2894 userspace,
c47511da 2895 versiondep],
708d7524
LP
2896 install_rpath : rootpkglibdir,
2897 install : true,
2898 install_dir : rootlibexecdir)
ca1092dc 2899 endif
6164ec4c
ZJS
2900endif
2901
2902executable(
2903 'systemd-boot-check-no-failures',
2904 'src/boot/boot-check-no-failures.c',
2905 include_directories : includes,
2906 link_with : [libshared],
c47511da 2907 dependencies : [libblkid,
92148283 2908 userspace,
c47511da 2909 versiondep],
5fb22561 2910 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2911 install : true,
2912 install_dir : rootlibexecdir)
005a29f2 2913
6164ec4c
ZJS
2914public_programs += executable(
2915 'systemd-socket-activate',
2916 'src/activate/activate.c',
2917 include_directories : includes,
2918 link_with : [libshared],
c47511da 2919 dependencies : [threads,
92148283 2920 userspace,
c47511da 2921 versiondep],
5fb22561 2922 install_rpath : rootpkglibdir,
6164ec4c 2923 install : true)
f3794366 2924
2a2d002f 2925systemctl = executable(
6164ec4c 2926 'systemctl',
c3512573 2927 systemctl_sources,
6164ec4c
ZJS
2928 include_directories : includes,
2929 link_with : systemctl_link_with,
92148283
JJ
2930 dependencies : [libcap,
2931 liblz4,
6164ec4c
ZJS
2932 libselinux,
2933 libxz,
c47511da 2934 libzstd,
92148283
JJ
2935 threads,
2936 userspace,
c47511da 2937 versiondep],
5fb22561 2938 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2939 install : true,
2940 install_dir : rootbindir)
2a2d002f 2941public_programs += systemctl
5c23128d 2942
61d0578b 2943if conf.get('ENABLE_PORTABLED') == 1
e3c68924 2944 dbus_programs += executable(
6164ec4c
ZJS
2945 'systemd-portabled',
2946 systemd_portabled_sources,
2947 include_directories : includes,
2948 link_with : [libshared],
92148283
JJ
2949 dependencies : [libselinux,
2950 threads,
2951 userspace,
c47511da 2952 versiondep],
5fb22561 2953 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2954 install : true,
2955 install_dir : rootlibexecdir)
2956
2957 public_programs += executable(
2958 'portablectl',
2959 'src/portable/portablectl.c',
2960 include_directories : includes,
2961 link_with : [libshared],
c47511da 2962 dependencies : [threads,
92148283 2963 userspace,
c47511da 2964 versiondep],
5fb22561 2965 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2966 install : true,
2967 install_dir : rootbindir)
61d0578b
LP
2968endif
2969
9bca4ae4
LP
2970if conf.get('ENABLE_SYSEXT') == 1
2971 public_programs += executable(
2972 'systemd-sysext',
2973 systemd_sysext_sources,
2974 include_directories : includes,
2975 link_with : [libshared],
92148283
JJ
2976 dependencies : [userspace,
2977 versiondep],
5fb22561 2978 install_rpath : rootpkglibdir,
9bca4ae4 2979 install : true,
aac5fbff 2980 install_dir : rootbindir)
9bca4ae4
LP
2981endif
2982
d093b62c 2983if conf.get('ENABLE_USERDB') == 1
6164ec4c
ZJS
2984 executable(
2985 'systemd-userwork',
2986 systemd_userwork_sources,
2987 include_directories : includes,
2988 link_with : [libshared],
c47511da 2989 dependencies : [threads,
92148283 2990 userspace,
c47511da 2991 versiondep],
5fb22561 2992 install_rpath : rootpkglibdir,
6164ec4c
ZJS
2993 install : true,
2994 install_dir : rootlibexecdir)
2995
2996 executable(
2997 'systemd-userdbd',
2998 systemd_userdbd_sources,
2999 include_directories : includes,
3000 link_with : [libshared],
c47511da 3001 dependencies : [threads,
92148283 3002 userspace,
c47511da 3003 versiondep],
5fb22561 3004 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3005 install : true,
3006 install_dir : rootlibexecdir)
3007
460e5af0 3008 public_programs += executable(
6164ec4c
ZJS
3009 'userdbctl',
3010 userdbctl_sources,
3011 include_directories : includes,
3012 link_with : [libshared],
c47511da 3013 dependencies : [threads,
92148283 3014 userspace,
c47511da 3015 versiondep],
5fb22561 3016 install_rpath : rootpkglibdir,
003a6761 3017 install : true)
d093b62c
LP
3018endif
3019
70a5db58 3020if conf.get('ENABLE_HOMED') == 1
6164ec4c
ZJS
3021 executable(
3022 'systemd-homework',
3023 systemd_homework_sources,
3024 include_directories : includes,
f8cf3d19
LP
3025 link_with : [libshared,
3026 libshared_fdisk],
92148283 3027 dependencies : [libblkid,
6164ec4c 3028 libcrypt,
6164ec4c 3029 libfdisk,
92148283 3030 libopenssl,
c47511da 3031 libp11kit,
92148283
JJ
3032 threads,
3033 userspace,
c47511da 3034 versiondep],
5fb22561 3035 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3036 install : true,
3037 install_dir : rootlibexecdir)
3038
e3c68924 3039 dbus_programs += executable(
6164ec4c
ZJS
3040 'systemd-homed',
3041 systemd_homed_sources,
8d40961c 3042 include_directories : home_includes,
6164ec4c 3043 link_with : [libshared],
92148283 3044 dependencies : [libcrypt,
c47511da 3045 libm,
92148283
JJ
3046 libopenssl,
3047 threads,
3048 userspace,
c47511da 3049 versiondep],
5fb22561 3050 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3051 install : true,
3052 install_dir : rootlibexecdir)
3053
460e5af0 3054 public_programs += executable(
6164ec4c
ZJS
3055 'homectl',
3056 homectl_sources,
3057 include_directories : includes,
3058 link_with : [libshared],
92148283
JJ
3059 dependencies : [libcrypt,
3060 libdl,
6164ec4c
ZJS
3061 libopenssl,
3062 libp11kit,
92148283
JJ
3063 threads,
3064 userspace,
c47511da 3065 versiondep],
5fb22561 3066 install_rpath : rootpkglibdir,
003a6761 3067 install : true)
26cf9fb7
LP
3068
3069 if conf.get('HAVE_PAM') == 1
fce9abb2 3070 version_script_arg = project_source_root / pam_systemd_home_sym
a7127884 3071 pam_systemd_home = shared_library(
26cf9fb7
LP
3072 'pam_systemd_home',
3073 pam_systemd_home_c,
3074 name_prefix : '',
3075 include_directories : includes,
3076 link_args : ['-shared',
3077 '-Wl,--version-script=' + version_script_arg],
3078 link_with : [libsystemd_static,
3079 libshared_static],
92148283 3080 dependencies : [libcrypt,
26cf9fb7 3081 libpam_misc,
92148283
JJ
3082 libpam,
3083 threads,
3084 userspace,
c47511da 3085 versiondep],
26cf9fb7
LP
3086 link_depends : pam_systemd_home_sym,
3087 install : true,
48139c7c 3088 install_tag : 'pam',
26cf9fb7 3089 install_dir : pamlibdir)
a7127884
YW
3090
3091 if want_tests != 'false'
3092 test('dlopen-pam_systemd_home',
3093 test_dlopen,
3094 # path to dlopen must include a slash
3095 args : pam_systemd_home.full_path(),
3096 depends : pam_systemd_home)
3097 endif
26cf9fb7 3098 endif
70a5db58
LP
3099endif
3100
6589a569 3101foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
ba081955 3102 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
ba7f4ae6 3103 meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
3104 rootbindir / 'systemctl',
3105 rootsbindir / alias)
ba7f4ae6
ZJS
3106endforeach
3107
63e2d171 3108meson.add_install_script(meson_make_symlink,
fce9abb2
ZJS
3109 rootbindir / 'udevadm',
3110 rootlibexecdir / 'systemd-udevd')
63e2d171 3111
349cc4a5 3112if conf.get('ENABLE_BACKLIGHT') == 1
6164ec4c
ZJS
3113 executable(
3114 'systemd-backlight',
3115 'src/backlight/backlight.c',
3116 include_directories : includes,
3117 link_with : [libshared],
92148283 3118 dependencies : userspace,
5fb22561 3119 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3120 install : true,
3121 install_dir : rootlibexecdir)
5c23128d
ZJS
3122endif
3123
349cc4a5 3124if conf.get('ENABLE_RFKILL') == 1
6164ec4c
ZJS
3125 executable(
3126 'systemd-rfkill',
3127 'src/rfkill/rfkill.c',
3128 include_directories : includes,
3129 link_with : [libshared],
92148283 3130 dependencies : userspace,
5fb22561 3131 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3132 install : true,
3133 install_dir : rootlibexecdir)
3134endif
3135
3136executable(
3137 'systemd-system-update-generator',
3138 'src/system-update-generator/system-update-generator.c',
3139 include_directories : includes,
3140 link_with : [libshared],
92148283 3141 dependencies : userspace,
5fb22561 3142 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3143 install : true,
3144 install_dir : systemgeneratordir)
5c23128d 3145
349cc4a5 3146if conf.get('HAVE_LIBCRYPTSETUP') == 1
6164ec4c
ZJS
3147 executable(
3148 'systemd-cryptsetup',
3149 systemd_cryptsetup_sources,
3150 include_directories : includes,
3151 link_with : [libshared],
3152 dependencies : [libcryptsetup,
92148283 3153 libopenssl,
c47511da 3154 libp11kit,
92148283
JJ
3155 userspace,
3156 versiondep],
5fb22561 3157 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3158 install : true,
3159 install_dir : rootlibexecdir)
3160
3161 executable(
3162 'systemd-cryptsetup-generator',
3163 'src/cryptsetup/cryptsetup-generator.c',
3164 include_directories : includes,
3165 link_with : [libshared],
92148283 3166 dependencies : userspace,
5fb22561 3167 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3168 install : true,
3169 install_dir : systemgeneratordir)
3170
3171 executable(
3172 'systemd-veritysetup',
3173 'src/veritysetup/veritysetup.c',
3174 include_directories : includes,
3175 link_with : [libshared],
c47511da 3176 dependencies : [libcryptsetup,
92148283 3177 userspace,
c47511da 3178 versiondep],
5fb22561 3179 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3180 install : true,
3181 install_dir : rootlibexecdir)
3182
3183 executable(
3184 'systemd-veritysetup-generator',
3185 'src/veritysetup/veritysetup-generator.c',
3186 include_directories : includes,
3187 link_with : [libshared],
92148283
JJ
3188 dependencies : [userspace,
3189 versiondep],
5fb22561 3190 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3191 install : true,
3192 install_dir : systemgeneratordir)
8710a681 3193
3761002e 3194 public_programs += executable(
8710a681
LP
3195 'systemd-cryptenroll',
3196 systemd_cryptenroll_sources,
3197 include_directories : includes,
3198 link_with : [libshared],
3199 dependencies : [libcryptsetup,
5e521624 3200 libdl,
8710a681 3201 libopenssl,
c47511da 3202 libp11kit,
92148283 3203 userspace,
c47511da 3204 versiondep],
5fb22561 3205 install_rpath : rootpkglibdir,
a1fd722b 3206 install : true)
1f1a2243
TA
3207
3208 executable(
3209 'systemd-integritysetup',
3210 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
3211 include_directories : includes,
3212 link_with : [libshared],
c47511da 3213 dependencies : [libcryptsetup,
92148283 3214 userspace,
c47511da 3215 versiondep],
5fb22561 3216 install_rpath : rootpkglibdir,
1f1a2243
TA
3217 install : true,
3218 install_dir : rootlibexecdir)
3219
3220 executable(
3221 'systemd-integritysetup-generator',
3222 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
3223 include_directories : includes,
3224 link_with : [libshared],
92148283 3225 dependencies : userspace,
5fb22561 3226 install_rpath : rootpkglibdir,
1f1a2243
TA
3227 install : true,
3228 install_dir : systemgeneratordir)
5c23128d
ZJS
3229endif
3230
349cc4a5 3231if conf.get('HAVE_SYSV_COMPAT') == 1
e93ada98 3232 exe = executable(
6164ec4c
ZJS
3233 'systemd-sysv-generator',
3234 'src/sysv-generator/sysv-generator.c',
3235 include_directories : includes,
3236 link_with : [libshared],
92148283 3237 dependencies : userspace,
5fb22561 3238 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3239 install : true,
3240 install_dir : systemgeneratordir)
3241
e93ada98
DDM
3242 sysv_generator_test_py = find_program('test/sysv-generator-test.py')
3243 if want_tests != 'false'
3244 test('sysv-generator-test',
3245 sysv_generator_test_py,
3246 depends : exe)
3247 endif
3248
6164ec4c
ZJS
3249 executable(
3250 'systemd-rc-local-generator',
3251 'src/rc-local-generator/rc-local-generator.c',
3252 include_directories : includes,
3253 link_with : [libshared],
92148283 3254 dependencies : userspace,
5fb22561 3255 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3256 install : true,
3257 install_dir : systemgeneratordir)
5c23128d
ZJS
3258endif
3259
8feca247
BB
3260if conf.get('ENABLE_XDG_AUTOSTART') == 1
3261 executable(
3262 'systemd-xdg-autostart-generator',
0275e918 3263 systemd_xdg_autostart_generator_sources,
8feca247
BB
3264 include_directories : includes,
3265 link_with : [libshared],
92148283 3266 dependencies : userspace,
5fb22561 3267 install_rpath : rootpkglibdir,
8feca247
BB
3268 install : true,
3269 install_dir : usergeneratordir)
3270
3271 executable(
3272 'systemd-xdg-autostart-condition',
3273 'src/xdg-autostart-generator/xdg-autostart-condition.c',
3274 include_directories : includes,
3275 link_with : [libshared],
92148283 3276 dependencies : userspace,
5fb22561 3277 install_rpath : rootpkglibdir,
8feca247
BB
3278 install : true,
3279 install_dir : rootlibexecdir)
3280endif
3281
349cc4a5 3282if conf.get('ENABLE_HOSTNAMED') == 1
e3c68924 3283 dbus_programs += executable(
6164ec4c
ZJS
3284 'systemd-hostnamed',
3285 'src/hostname/hostnamed.c',
3286 include_directories : includes,
3287 link_with : [libshared],
92148283 3288 dependencies : userspace,
5fb22561 3289 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3290 install : true,
3291 install_dir : rootlibexecdir)
3292
3293 public_programs += executable(
3294 'hostnamectl',
3295 'src/hostname/hostnamectl.c',
3296 include_directories : includes,
3297 link_with : [libshared],
92148283
JJ
3298 dependencies : [userspace,
3299 versiondep],
5fb22561 3300 install_rpath : rootpkglibdir,
6164ec4c 3301 install : true)
5c23128d
ZJS
3302endif
3303
349cc4a5 3304if conf.get('ENABLE_LOCALED') == 1
e3c68924 3305 dbus_programs += executable(
6164ec4c
ZJS
3306 'systemd-localed',
3307 systemd_localed_sources,
bfa0ade9 3308 include_directories : includes,
6164ec4c 3309 link_with : [libshared],
d45cbc07
YW
3310 dependencies : libxkbcommon_deps +
3311 [userspace,
3312 versiondep],
5fb22561 3313 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3314 install : true,
3315 install_dir : rootlibexecdir)
3316
3317 public_programs += executable(
3318 'localectl',
3319 localectl_sources,
3320 include_directories : includes,
3321 link_with : [libshared],
92148283
JJ
3322 dependencies : [userspace,
3323 versiondep],
5fb22561 3324 install_rpath : rootpkglibdir,
6164ec4c 3325 install : true)
5c23128d
ZJS
3326endif
3327
349cc4a5 3328if conf.get('ENABLE_TIMEDATED') == 1
e3c68924 3329 dbus_programs += executable(
6164ec4c
ZJS
3330 'systemd-timedated',
3331 'src/timedate/timedated.c',
3332 include_directories : includes,
3333 link_with : [libshared],
92148283 3334 dependencies : userspace,
5fb22561 3335 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3336 install : true,
3337 install_dir : rootlibexecdir)
6129ec85 3338endif
5c23128d 3339
6129ec85 3340if conf.get('ENABLE_TIMEDATECTL') == 1
6164ec4c
ZJS
3341 public_programs += executable(
3342 'timedatectl',
3343 'src/timedate/timedatectl.c',
3344 include_directories : includes,
5fb22561 3345 install_rpath : rootpkglibdir,
6164ec4c 3346 link_with : [libshared],
c47511da 3347 dependencies : [libm,
92148283 3348 userspace,
c47511da 3349 versiondep],
6164ec4c 3350 install : true)
5c23128d
ZJS
3351endif
3352
349cc4a5 3353if conf.get('ENABLE_TIMESYNCD') == 1
6164ec4c
ZJS
3354 executable(
3355 'systemd-timesyncd',
3356 systemd_timesyncd_sources,
3357 include_directories : includes,
f5a5284e 3358 link_with : [libtimesyncd_core],
92148283
JJ
3359 dependencies : [libm,
3360 threads,
3361 userspace,
c47511da 3362 versiondep],
5fb22561 3363 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3364 install : true,
3365 install_dir : rootlibexecdir)
3366
3367 executable(
3368 'systemd-time-wait-sync',
cf242350 3369 'src/timesync/wait-sync.c',
6164ec4c 3370 include_directories : includes,
f5a5284e 3371 link_with : [libtimesyncd_core],
92148283 3372 dependencies : userspace,
5fb22561 3373 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3374 install : true,
3375 install_dir : rootlibexecdir)
5c23128d
ZJS
3376endif
3377
349cc4a5 3378if conf.get('ENABLE_MACHINED') == 1
e3c68924 3379 dbus_programs += executable(
6164ec4c
ZJS
3380 'systemd-machined',
3381 systemd_machined_sources,
3382 include_directories : includes,
3383 link_with : [libmachine_core,
3384 libshared],
92148283 3385 dependencies : userspace,
5fb22561 3386 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3387 install : true,
3388 install_dir : rootlibexecdir)
3389
3390 public_programs += executable(
3391 'machinectl',
3392 'src/machine/machinectl.c',
3393 include_directories : includes,
3394 link_with : [libshared],
92148283 3395 dependencies : [liblz4,
6164ec4c 3396 libxz,
c47511da 3397 libzstd,
92148283
JJ
3398 threads,
3399 userspace,
c47511da 3400 versiondep],
5fb22561 3401 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3402 install : true,
3403 install_dir : rootbindir)
5c23128d
ZJS
3404endif
3405
349cc4a5 3406if conf.get('ENABLE_IMPORTD') == 1
e3c68924 3407 dbus_programs += executable(
6164ec4c
ZJS
3408 'systemd-importd',
3409 systemd_importd_sources,
3410 include_directories : includes,
3411 link_with : [libshared],
c47511da 3412 dependencies : [threads,
92148283 3413 userspace,
c47511da 3414 versiondep],
5fb22561 3415 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3416 install : true,
3417 install_dir : rootlibexecdir)
3418
3419 systemd_pull = executable(
3420 'systemd-pull',
3421 systemd_pull_sources,
3422 include_directories : includes,
b93f018f
ZJS
3423 link_with : [libshared,
3424 lib_import_common],
92148283 3425 dependencies : [lib_openssl_or_gcrypt,
6164ec4c 3426 libbzip2,
92148283 3427 libcurl,
c47511da 3428 libxz,
92148283
JJ
3429 libz,
3430 userspace,
c47511da 3431 versiondep],
5fb22561 3432 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3433 install : true,
3434 install_dir : rootlibexecdir)
3435
3436 systemd_import = executable(
3437 'systemd-import',
3438 systemd_import_sources,
3439 include_directories : includes,
b93f018f
ZJS
3440 link_with : [libshared,
3441 lib_import_common],
92148283
JJ
3442 dependencies : [libbzip2,
3443 libcurl,
c47511da 3444 libxz,
92148283
JJ
3445 libz,
3446 userspace,
c47511da 3447 versiondep],
5fb22561 3448 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3449 install : true,
3450 install_dir : rootlibexecdir)
3451
3452 systemd_import_fs = executable(
3453 'systemd-import-fs',
3454 systemd_import_fs_sources,
3455 include_directories : includes,
b93f018f
ZJS
3456 link_with : [libshared,
3457 lib_import_common],
92148283
JJ
3458 dependencies : [userspace,
3459 versiondep],
5fb22561 3460 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3461 install : true,
3462 install_dir : rootlibexecdir)
3463
3464 systemd_export = executable(
3465 'systemd-export',
3466 systemd_export_sources,
3467 include_directories : includes,
b93f018f
ZJS
3468 link_with : [libshared,
3469 lib_import_common],
92148283
JJ
3470 dependencies : [libbzip2,
3471 libcurl,
c47511da 3472 libxz,
92148283
JJ
3473 libz,
3474 userspace,
c47511da 3475 versiondep],
5fb22561 3476 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3477 install : true,
3478 install_dir : rootlibexecdir)
1d7579c4
LP
3479
3480 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
37efbbd8
ZJS
3481endif
3482
349cc4a5 3483if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
6164ec4c
ZJS
3484 public_programs += executable(
3485 'systemd-journal-upload',
3486 systemd_journal_upload_sources,
3487 include_directories : includes,
3488 link_with : [libshared],
92148283 3489 dependencies : [libcurl,
6164ec4c 3490 libgnutls,
ef5924aa 3491 liblz4,
92148283 3492 libxz,
c47511da 3493 libzstd,
92148283
JJ
3494 threads,
3495 userspace,
c47511da 3496 versiondep],
5fb22561 3497 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3498 install : true,
3499 install_dir : rootlibexecdir)
5c23128d
ZJS
3500endif
3501
349cc4a5 3502if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
6164ec4c
ZJS
3503 public_programs += executable(
3504 'systemd-journal-remote',
3505 systemd_journal_remote_sources,
035b0f8f 3506 include_directories : journal_includes,
6164ec4c
ZJS
3507 link_with : [libshared,
3508 libsystemd_journal_remote],
92148283
JJ
3509 dependencies : [libgnutls,
3510 liblz4,
6164ec4c 3511 libmicrohttpd,
6164ec4c 3512 libxz,
c47511da 3513 libzstd,
92148283
JJ
3514 threads,
3515 userspace,
c47511da 3516 versiondep],
5fb22561 3517 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3518 install : true,
3519 install_dir : rootlibexecdir)
3520
3521 public_programs += executable(
3522 'systemd-journal-gatewayd',
3523 systemd_journal_gatewayd_sources,
035b0f8f 3524 include_directories : journal_includes,
6164ec4c 3525 link_with : [libshared],
92148283
JJ
3526 dependencies : [libgnutls,
3527 liblz4,
6164ec4c 3528 libmicrohttpd,
6164ec4c 3529 libxz,
c47511da 3530 libzstd,
92148283
JJ
3531 threads,
3532 userspace,
c47511da 3533 versiondep],
5fb22561 3534 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3535 install : true,
3536 install_dir : rootlibexecdir)
5c23128d
ZJS
3537endif
3538
349cc4a5 3539if conf.get('ENABLE_COREDUMP') == 1
6164ec4c
ZJS
3540 executable(
3541 'systemd-coredump',
3542 systemd_coredump_sources,
3543 include_directories : includes,
acc50c92
LP
3544 link_with : [libshared,
3545 libbasic_compress],
92148283 3546 dependencies : [libacl,
ef5924aa 3547 liblz4,
92148283 3548 libxz,
c47511da 3549 libzstd,
92148283
JJ
3550 threads,
3551 userspace,
c47511da 3552 versiondep],
5fb22561 3553 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3554 install : true,
3555 install_dir : rootlibexecdir)
3556
3557 public_programs += executable(
3558 'coredumpctl',
3559 coredumpctl_sources,
3560 include_directories : includes,
acc50c92
LP
3561 link_with : [libshared,
3562 libbasic_compress],
92148283 3563 dependencies : [liblz4,
6164ec4c 3564 libxz,
c47511da 3565 libzstd,
92148283
JJ
3566 threads,
3567 userspace,
c47511da 3568 versiondep],
5fb22561 3569 install_rpath : rootpkglibdir,
6164ec4c 3570 install : true)
5c23128d
ZJS
3571endif
3572
9b4abc69 3573if conf.get('ENABLE_PSTORE') == 1
6164ec4c
ZJS
3574 executable(
3575 'systemd-pstore',
3576 systemd_pstore_sources,
3577 include_directories : includes,
3578 link_with : [libshared],
92148283 3579 dependencies : [libacl,
ef5924aa 3580 liblz4,
92148283 3581 libxz,
c47511da 3582 libzstd,
92148283
JJ
3583 threads,
3584 userspace,
c47511da 3585 versiondep],
5fb22561 3586 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3587 install : true,
3588 install_dir : rootlibexecdir)
9b4abc69
ED
3589endif
3590
9de5e321 3591if conf.get('ENABLE_OOMD') == 1
e3c68924 3592 dbus_programs += executable('systemd-oomd',
9de5e321
AZ
3593 systemd_oomd_sources,
3594 include_directories : includes,
3595 link_with : [libshared],
c47511da 3596 dependencies : [libatomic,
92148283 3597 userspace,
c47511da 3598 versiondep],
5fb22561 3599 install_rpath : rootpkglibdir,
9de5e321
AZ
3600 install : true,
3601 install_dir : rootlibexecdir)
5c616ecf
AZ
3602
3603 public_programs += executable(
ba081955
ZJS
3604 'oomctl',
3605 oomctl_sources,
3606 include_directories : includes,
3607 link_with : [libshared],
92148283
JJ
3608 dependencies : [userspace,
3609 versiondep],
5fb22561 3610 install_rpath : rootpkglibdir,
cfd4c84a 3611 install : true)
9de5e321
AZ
3612endif
3613
349cc4a5 3614if conf.get('ENABLE_BINFMT') == 1
6164ec4c
ZJS
3615 public_programs += executable(
3616 'systemd-binfmt',
3617 'src/binfmt/binfmt.c',
3618 include_directories : includes,
3619 link_with : [libshared],
92148283
JJ
3620 dependencies : [userspace,
3621 versiondep],
5fb22561 3622 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3623 install : true,
3624 install_dir : rootlibexecdir)
37efbbd8 3625
7c22f07c
ZJS
3626 meson.add_install_script('sh', '-c',
3627 mkdir_p.format(binfmtdir))
d7aa78c3 3628 if install_sysconfdir
7c22f07c 3629 meson.add_install_script('sh', '-c',
fce9abb2 3630 mkdir_p.format(sysconfdir / 'binfmt.d'))
d7aa78c3 3631 endif
37efbbd8
ZJS
3632endif
3633
43cc7a3e
LP
3634if conf.get('ENABLE_SYSUPDATE') == 1
3635 exe = executable(
3636 'systemd-sysupdate',
3637 systemd_sysupdate_sources,
3638 include_directories : includes,
f8cf3d19
LP
3639 link_with : [libshared,
3640 libshared_fdisk],
92148283 3641 dependencies : [libblkid,
43cc7a3e 3642 libfdisk,
c47511da 3643 libopenssl,
92148283
JJ
3644 threads,
3645 userspace,
c47511da 3646 versiondep],
5fb22561 3647 install_rpath : rootpkglibdir,
43cc7a3e
LP
3648 install : true,
3649 install_dir : rootlibexecdir)
3650 public_programs += exe
3651endif
3652
349cc4a5 3653if conf.get('ENABLE_VCONSOLE') == 1
6164ec4c
ZJS
3654 executable(
3655 'systemd-vconsole-setup',
3656 'src/vconsole/vconsole-setup.c',
3657 include_directories : includes,
3658 link_with : [libshared],
92148283 3659 dependencies : userspace,
5fb22561 3660 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3661 install : true,
3662 install_dir : rootlibexecdir)
5c23128d
ZJS
3663endif
3664
349cc4a5 3665if conf.get('ENABLE_RANDOMSEED') == 1
6164ec4c
ZJS
3666 executable(
3667 'systemd-random-seed',
3668 'src/random-seed/random-seed.c',
3669 include_directories : includes,
3670 link_with : [libshared],
92148283
JJ
3671 dependencies : [userspace,
3672 versiondep],
5fb22561 3673 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3674 install : true,
3675 install_dir : rootlibexecdir)
5c23128d
ZJS
3676endif
3677
349cc4a5 3678if conf.get('ENABLE_FIRSTBOOT') == 1
3761002e 3679 public_programs += executable(
6164ec4c
ZJS
3680 'systemd-firstboot',
3681 'src/firstboot/firstboot.c',
3682 include_directories : includes,
3683 link_with : [libshared],
c47511da 3684 dependencies : [libcrypt,
92148283 3685 userspace,
c47511da 3686 versiondep],
5fb22561 3687 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3688 install : true,
3689 install_dir : rootbindir)
3690endif
3691
3692executable(
3693 'systemd-remount-fs',
3694 'src/remount-fs/remount-fs.c',
3695 include_directories : includes,
bac11cd6 3696 link_with : [libshared],
92148283
JJ
3697 dependencies : [userspace,
3698 versiondep],
5fb22561 3699 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3700 install : true,
3701 install_dir : rootlibexecdir)
5c23128d 3702
6164ec4c
ZJS
3703executable(
3704 'systemd-machine-id-setup',
3705 'src/machine-id-setup/machine-id-setup-main.c',
3706 include_directories : includes,
bac11cd6 3707 link_with : [libshared],
92148283
JJ
3708 dependencies : [userspace,
3709 versiondep],
5fb22561 3710 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3711 install : true,
3712 install_dir : rootbindir)
5c23128d 3713
6164ec4c
ZJS
3714executable(
3715 'systemd-fsck',
3716 'src/fsck/fsck.c',
3717 include_directories : includes,
3718 link_with : [libshared],
92148283
JJ
3719 dependencies : [userspace,
3720 versiondep],
5fb22561 3721 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3722 install : true,
3723 install_dir : rootlibexecdir)
5c23128d 3724
c47511da
ZJS
3725executable(
3726 'systemd-growfs',
3727 'src/partition/growfs.c',
3728 include_directories : includes,
3729 link_with : [libshared],
92148283
JJ
3730 dependencies : [userspace,
3731 versiondep],
c47511da
ZJS
3732 install_rpath : rootpkglibdir,
3733 install : true,
3734 install_dir : rootlibexecdir)
80750adb 3735
6164ec4c
ZJS
3736executable(
3737 'systemd-makefs',
3738 'src/partition/makefs.c',
3739 include_directories : includes,
3740 link_with : [libshared],
92148283
JJ
3741 dependencies : [userspace,
3742 versiondep],
5fb22561 3743 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3744 install : true,
3745 install_dir : rootlibexecdir)
b7f28ac5 3746
6164ec4c
ZJS
3747executable(
3748 'systemd-sleep',
3749 'src/sleep/sleep.c',
3750 include_directories : includes,
3751 link_with : [libshared],
92148283
JJ
3752 dependencies : [userspace,
3753 versiondep],
5fb22561 3754 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3755 install : true,
3756 install_dir : rootlibexecdir)
5c23128d 3757
225d08b8 3758if install_sysconfdir_samples
d7aa78c3
JT
3759 install_data('src/sleep/sleep.conf',
3760 install_dir : pkgsysconfdir)
3761endif
d25e127d 3762
6164ec4c
ZJS
3763public_programs += executable(
3764 'systemd-sysctl',
3765 'src/sysctl/sysctl.c',
3766 include_directories : includes,
3767 link_with : [libshared],
92148283
JJ
3768 dependencies : [userspace,
3769 versiondep],
5fb22561 3770 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3771 install : true,
3772 install_dir : rootlibexecdir)
5c23128d 3773
251dc2f1 3774public_programs += executable(
6164ec4c
ZJS
3775 'systemd-ac-power',
3776 'src/ac-power/ac-power.c',
3777 include_directories : includes,
3778 link_with : [libshared],
92148283
JJ
3779 dependencies : [userspace,
3780 versiondep],
5fb22561 3781 install_rpath : rootpkglibdir,
251dc2f1 3782 install : true)
5c23128d 3783
6164ec4c
ZJS
3784public_programs += executable(
3785 'systemd-detect-virt',
3786 'src/detect-virt/detect-virt.c',
3787 include_directories : includes,
3788 link_with : [libshared],
92148283
JJ
3789 dependencies : [userspace,
3790 versiondep],
5fb22561 3791 install_rpath : rootpkglibdir,
6164ec4c 3792 install : true)
5c23128d 3793
6164ec4c
ZJS
3794public_programs += executable(
3795 'systemd-delta',
3796 'src/delta/delta.c',
3797 include_directories : includes,
3798 link_with : [libshared],
92148283
JJ
3799 dependencies : [userspace,
3800 versiondep],
5fb22561 3801 install_rpath : rootpkglibdir,
6164ec4c 3802 install : true)
5c23128d 3803
6164ec4c
ZJS
3804public_programs += executable(
3805 'systemd-escape',
3806 'src/escape/escape.c',
3807 include_directories : includes,
3808 link_with : [libshared],
92148283
JJ
3809 dependencies : [userspace,
3810 versiondep],
5fb22561 3811 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3812 install : true,
3813 install_dir : rootbindir)
3814
3815public_programs += executable(
3816 'systemd-notify',
3817 'src/notify/notify.c',
3818 include_directories : includes,
3819 link_with : [libshared],
92148283
JJ
3820 dependencies : [userspace,
3821 versiondep],
5fb22561 3822 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3823 install : true,
3824 install_dir : rootbindir)
3825
5945640e
LP
3826public_programs += executable(
3827 'systemd-creds',
3828 'src/creds/creds.c',
3829 include_directories : includes,
3830 link_with : [libshared],
3831 dependencies : [threads,
c47511da 3832 libopenssl,
92148283 3833 userspace,
c47511da 3834 versiondep],
5fb22561 3835 install_rpath : rootpkglibdir,
5945640e
LP
3836 install : true,
3837 install_dir : rootbindir)
3838
6164ec4c
ZJS
3839executable(
3840 'systemd-volatile-root',
3841 'src/volatile-root/volatile-root.c',
3842 include_directories : includes,
3843 link_with : [libshared],
92148283 3844 dependencies : userspace,
5fb22561 3845 install_rpath : rootpkglibdir,
cdf7ad38 3846 install : conf.get('ENABLE_INITRD') == 1,
6164ec4c
ZJS
3847 install_dir : rootlibexecdir)
3848
3849executable(
3850 'systemd-cgroups-agent',
3851 'src/cgroups-agent/cgroups-agent.c',
3852 include_directories : includes,
3853 link_with : [libshared],
92148283 3854 dependencies : userspace,
5fb22561 3855 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3856 install : true,
3857 install_dir : rootlibexecdir)
3858
2a2d002f 3859systemd_id128 = executable(
6164ec4c
ZJS
3860 'systemd-id128',
3861 'src/id128/id128.c',
3862 include_directories : includes,
3863 link_with : [libshared],
92148283
JJ
3864 dependencies : [userspace,
3865 versiondep],
5fb22561 3866 install_rpath : rootpkglibdir,
6164ec4c 3867 install : true)
2a2d002f
ZJS
3868public_programs += systemd_id128
3869
3870if want_tests != 'false'
3871 test('test-systemctl-enable',
3872 test_systemctl_enable_sh,
3873 # https://github.com/mesonbuild/meson/issues/2681
3874 args : [systemctl.full_path(),
3875 systemd_id128.full_path()])
3876endif
6164ec4c
ZJS
3877
3878public_programs += executable(
3879 'systemd-path',
3880 'src/path/path.c',
3881 include_directories : includes,
3882 link_with : [libshared],
92148283
JJ
3883 dependencies : [userspace,
3884 versiondep],
5fb22561 3885 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3886 install : true)
3887
3888public_programs += executable(
3889 'systemd-ask-password',
3890 'src/ask-password/ask-password.c',
3891 include_directories : includes,
3892 link_with : [libshared],
92148283
JJ
3893 dependencies : [userspace,
3894 versiondep],
5fb22561 3895 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3896 install : true,
3897 install_dir : rootbindir)
3898
3899executable(
3900 'systemd-reply-password',
3901 'src/reply-password/reply-password.c',
3902 include_directories : includes,
3903 link_with : [libshared],
92148283 3904 dependencies : userspace,
5fb22561 3905 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3906 install : true,
3907 install_dir : rootlibexecdir)
3908
3909public_programs += executable(
3910 'systemd-tty-ask-password-agent',
3911 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3912 include_directories : includes,
3913 link_with : [libshared],
92148283
JJ
3914 dependencies : [userspace,
3915 versiondep],
5fb22561 3916 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3917 install : true,
3918 install_dir : rootbindir)
3919
3920public_programs += executable(
3921 'systemd-cgls',
3922 'src/cgls/cgls.c',
3923 include_directories : includes,
3924 link_with : [libshared],
92148283
JJ
3925 dependencies : [userspace,
3926 versiondep],
5fb22561 3927 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3928 install : true)
3929
3930public_programs += executable(
3931 'systemd-cgtop',
3932 'src/cgtop/cgtop.c',
3933 include_directories : includes,
3934 link_with : [libshared],
92148283
JJ
3935 dependencies : [userspace,
3936 versiondep],
5fb22561 3937 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3938 install : true)
3939
3940executable(
3941 'systemd-initctl',
3942 'src/initctl/initctl.c',
3943 include_directories : includes,
3944 link_with : [libshared],
92148283 3945 dependencies : userspace,
5fb22561 3946 install_rpath : rootpkglibdir,
6589a569 3947 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
6164ec4c 3948 install_dir : rootlibexecdir)
5c23128d 3949
6164ec4c
ZJS
3950public_programs += executable(
3951 'systemd-mount',
3952 'src/mount/mount-tool.c',
3953 include_directories : includes,
3954 link_with : [libshared],
c47511da 3955 dependencies: [libmount,
92148283 3956 userspace,
c47511da 3957 versiondep],
5fb22561 3958 install_rpath : rootpkglibdir,
6164ec4c 3959 install : true)
5c23128d 3960
7b76fce1 3961meson.add_install_script(meson_make_symlink,
fce9abb2 3962 'systemd-mount', bindir / 'systemd-umount')
7b76fce1 3963
6164ec4c
ZJS
3964public_programs += executable(
3965 'systemd-run',
3966 'src/run/run.c',
3967 include_directories : includes,
3968 link_with : [libshared],
92148283
JJ
3969 dependencies : [userspace,
3970 versiondep],
5fb22561 3971 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3972 install : true)
3973
3974public_programs += executable(
3975 'systemd-stdio-bridge',
3976 'src/stdio-bridge/stdio-bridge.c',
3977 include_directories : includes,
3978 link_with : [libshared],
92148283 3979 dependencies : [userspace,
c47511da 3980 versiondep],
5fb22561 3981 install_rpath : rootpkglibdir,
6164ec4c
ZJS
3982 install : true)
3983
3984public_programs += executable(
3985 'busctl',
f98df767 3986 busctl_sources,
6164ec4c
ZJS
3987 include_directories : includes,
3988 link_with : [libshared],
92148283
JJ
3989 dependencies : [userspace,
3990 versiondep],
5fb22561 3991 install_rpath : rootpkglibdir,
6164ec4c 3992 install : true)
5c23128d 3993
bd7e6aa7
ZJS
3994if enable_sysusers
3995 exe = executable(
6164ec4c
ZJS
3996 'systemd-sysusers',
3997 'src/sysusers/sysusers.c',
3998 include_directories : includes,
3999 link_with : [libshared],
92148283
JJ
4000 dependencies : [userspace,
4001 versiondep],
5fb22561 4002 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4003 install : true,
4004 install_dir : rootbindir)
bd7e6aa7
ZJS
4005 public_programs += exe
4006
4007 if want_tests != 'false'
4008 test('test-sysusers',
4009 test_sysusers_sh,
4010 # https://github.com/mesonbuild/meson/issues/2681
4011 args : exe.full_path())
4012 endif
8ef8f3d5 4013
b62ee354
ZJS
4014 exe = executable(
4015 'systemd-sysusers.standalone',
4016 'src/sysusers/sysusers.c',
4017 include_directories : includes,
4018 c_args : '-DSTANDALONE',
4019 link_with : [libshared_static,
4020 libbasic,
4021 libbasic_gcrypt,
4022 libsystemd_static],
4023 dependencies : [userspace,
4024 versiondep],
4025 build_by_default: have_standalone_binaries,
4026 install : have_standalone_binaries,
4027 install_dir : rootbindir)
8ef8f3d5 4028 if have_standalone_binaries
bd7e6aa7
ZJS
4029 public_programs += exe
4030
4031 if want_tests != 'false'
4032 test('test-sysusers.standalone',
4033 test_sysusers_sh,
4034 # https://github.com/mesonbuild/meson/issues/2681
4035 args : exe.full_path())
4036 endif
8ef8f3d5 4037 endif
5c23128d
ZJS
4038endif
4039
349cc4a5 4040if conf.get('ENABLE_TMPFILES') == 1
6164ec4c
ZJS
4041 exe = executable(
4042 'systemd-tmpfiles',
db64ba81 4043 systemd_tmpfiles_sources,
6164ec4c
ZJS
4044 include_directories : includes,
4045 link_with : [libshared],
c47511da 4046 dependencies : [libacl,
92148283 4047 userspace,
c47511da 4048 versiondep],
5fb22561 4049 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4050 install : true,
4051 install_dir : rootbindir)
5a8b1640 4052 public_programs += exe
d9daae55 4053
938be089
ZJS
4054 if want_tests != 'false'
4055 test('test-systemd-tmpfiles',
4056 test_systemd_tmpfiles_py,
4057 # https://github.com/mesonbuild/meson/issues/2681
4058 args : exe.full_path())
4059 endif
db64ba81 4060
b62ee354
ZJS
4061 exe = executable(
4062 'systemd-tmpfiles.standalone',
4063 systemd_tmpfiles_sources,
4064 include_directories : includes,
4065 c_args : '-DSTANDALONE',
4066 link_with : [libshared_static,
4067 libbasic,
4068 libbasic_gcrypt,
4069 libsystemd_static],
4070 dependencies : [libacl,
4071 userspace,
4072 versiondep],
4073 build_by_default: have_standalone_binaries,
4074 install : have_standalone_binaries,
4075 install_dir : rootbindir)
db64ba81 4076 if have_standalone_binaries
bf93f24a
MG
4077 public_programs += exe
4078
4079 if want_tests != 'false'
4080 test('test-systemd-tmpfiles.standalone',
4081 test_systemd_tmpfiles_py,
4082 # https://github.com/mesonbuild/meson/issues/2681
4083 args : exe.full_path())
4084 endif
db64ba81 4085 endif
5c23128d
ZJS
4086endif
4087
349cc4a5 4088if conf.get('ENABLE_HWDB') == 1
ecd1bfdd 4089 systemd_hwdb = executable(
6164ec4c
ZJS
4090 'systemd-hwdb',
4091 'src/hwdb/hwdb.c',
6164ec4c 4092 include_directories : includes,
e4b127e2 4093 link_with : udev_link_with,
92148283
JJ
4094 dependencies : [userspace,
4095 versiondep],
6164ec4c
ZJS
4096 install_rpath : udev_rpath,
4097 install : true,
4098 install_dir : rootbindir)
ecd1bfdd
ZJS
4099 public_programs += systemd_hwdb
4100
4101 if want_tests != 'false'
4102 test('hwdb-test',
4103 hwdb_test_sh,
14056a52 4104 suite : 'dist-check',
ecd1bfdd
ZJS
4105 args : [systemd_hwdb.full_path()],
4106 timeout : 90)
4107 endif
37efbbd8
ZJS
4108endif
4109
349cc4a5 4110if conf.get('ENABLE_QUOTACHECK') == 1
6164ec4c
ZJS
4111 executable(
4112 'systemd-quotacheck',
4113 'src/quotacheck/quotacheck.c',
4114 include_directories : includes,
4115 link_with : [libshared],
92148283 4116 dependencies : userspace,
5fb22561 4117 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4118 install : true,
4119 install_dir : rootlibexecdir)
4120endif
4121
4122public_programs += executable(
4123 'systemd-socket-proxyd',
4124 'src/socket-proxy/socket-proxyd.c',
4125 include_directories : includes,
4126 link_with : [libshared],
c47511da 4127 dependencies : [threads,
92148283 4128 userspace,
c47511da 4129 versiondep],
5fb22561 4130 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4131 install : true,
4132 install_dir : rootlibexecdir)
5c23128d 4133
9b264c1d 4134udevadm = executable(
6164ec4c
ZJS
4135 'udevadm',
4136 udevadm_sources,
6164ec4c 4137 include_directories : includes,
e4b127e2 4138 link_with : [libudevd_core],
92148283 4139 dependencies : [libacl,
c47511da 4140 libblkid,
92148283
JJ
4141 libidn,
4142 libkmod,
4143 threads,
4144 userspace,
c47511da 4145 versiondep],
6164ec4c
ZJS
4146 install_rpath : udev_rpath,
4147 install : true,
4148 install_dir : rootbindir)
9b264c1d
FS
4149public_programs += udevadm
4150
9382642c
DL
4151if want_tests != 'false'
4152 test('udev-rules-check',
4153 udevadm,
4154 suite : 'dist-check',
4155 args : ['verify', '--resolve-names=never', all_rules])
4156endif
4157
9b264c1d
FS
4158if conf.get('ENABLE_REPART') == 1
4159 exe = executable(
4160 'systemd-repart',
4161 systemd_repart_sources,
4162 include_directories : includes,
f8cf3d19
LP
4163 link_with : [libshared,
4164 libshared_fdisk],
92148283 4165 dependencies : [libblkid,
b456191d 4166 libfdisk,
c47511da 4167 libopenssl,
92148283
JJ
4168 threads,
4169 userspace,
c47511da 4170 versiondep],
5fb22561 4171 install_rpath : rootpkglibdir,
9b264c1d
FS
4172 install : true,
4173 install_dir : rootbindir)
4174 public_programs += exe
3c3e14a7 4175
b62ee354
ZJS
4176 exe = executable(
4177 'systemd-repart.standalone',
4178 systemd_repart_sources,
4179 include_directories : includes,
4180 c_args : '-DSTANDALONE',
4181 link_with : [libshared_static,
4182 libbasic,
4183 libbasic_gcrypt,
4184 libsystemd_static,
4185 libshared_fdisk],
4186 dependencies : [libblkid,
4187 libfdisk,
4188 libopenssl,
4189 threads,
4190 userspace,
4191 versiondep],
4192 build_by_default: have_standalone_binaries,
4193 install_rpath : rootpkglibdir,
4194 install : have_standalone_binaries,
4195 install_dir : rootbindir)
3c3e14a7 4196 if have_standalone_binaries
9702d824 4197 public_programs += exe
3c3e14a7 4198 endif
9b264c1d 4199endif
6164ec4c
ZJS
4200
4201executable(
4202 'systemd-shutdown',
4203 systemd_shutdown_sources,
4204 include_directories : includes,
bac11cd6 4205 link_with : [libshared],
c47511da 4206 dependencies : [libmount,
92148283 4207 userspace,
c47511da 4208 versiondep],
5fb22561 4209 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4210 install : true,
4211 install_dir : rootlibexecdir)
4212
b62ee354
ZJS
4213executable(
4214 'systemd-shutdown.standalone',
4215 systemd_shutdown_sources,
4216 include_directories : includes,
4217 c_args : '-DSTANDALONE',
4218 link_with : [libshared_static,
4219 libbasic,
4220 libsystemd_static],
4221 dependencies : [libmount,
4222 userspace,
4223 versiondep],
4224 build_by_default: have_standalone_binaries,
4225 install_rpath : rootpkglibdir,
4226 install : have_standalone_binaries,
4227 install_dir : rootlibexecdir)
6ed3aca5 4228if have_standalone_binaries
b62ee354 4229 public_programs += exe
6ed3aca5
ZJS
4230endif
4231
6164ec4c
ZJS
4232executable(
4233 'systemd-update-done',
4234 'src/update-done/update-done.c',
4235 include_directories : includes,
4236 link_with : [libshared],
92148283
JJ
4237 dependencies : [userspace,
4238 versiondep],
5fb22561 4239 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4240 install : true,
4241 install_dir : rootlibexecdir)
4242
4243executable(
4244 'systemd-update-utmp',
4245 'src/update-utmp/update-utmp.c',
4246 include_directories : includes,
4247 link_with : [libshared],
c47511da 4248 dependencies : [libaudit,
92148283 4249 userspace,
c47511da 4250 versiondep],
5fb22561 4251 install_rpath : rootpkglibdir,
55678b9e 4252 install : (conf.get('ENABLE_UTMP') == 1),
6164ec4c 4253 install_dir : rootlibexecdir)
5c23128d 4254
349cc4a5 4255if conf.get('HAVE_KMOD') == 1
6164ec4c
ZJS
4256 executable(
4257 'systemd-modules-load',
4258 'src/modules-load/modules-load.c',
4259 include_directories : includes,
4260 link_with : [libshared],
c47511da 4261 dependencies : [libkmod,
92148283 4262 userspace,
c47511da 4263 versiondep],
5fb22561 4264 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4265 install : true,
4266 install_dir : rootlibexecdir)
94e75a54 4267
7c22f07c
ZJS
4268 meson.add_install_script('sh', '-c',
4269 mkdir_p.format(modulesloaddir))
d7aa78c3 4270 if install_sysconfdir
7c22f07c 4271 meson.add_install_script('sh', '-c',
fce9abb2 4272 mkdir_p.format(sysconfdir / 'modules-load.d'))
d7aa78c3 4273 endif
5c23128d
ZJS
4274endif
4275
6164ec4c
ZJS
4276public_programs += executable(
4277 'systemd-nspawn',
4278 systemd_nspawn_sources,
4279 include_directories : includes,
bac11cd6 4280 link_with : [libnspawn_core,
6164ec4c
ZJS
4281 libshared],
4282 dependencies : [libblkid,
c47511da 4283 libseccomp,
92148283 4284 userspace,
c47511da 4285 versiondep],
5fb22561 4286 install_rpath : rootpkglibdir,
6164ec4c 4287 install : true)
5c23128d 4288
349cc4a5 4289if conf.get('ENABLE_NETWORKD') == 1
9ff2b35f 4290 dbus_programs += executable(
6164ec4c
ZJS
4291 'systemd-networkd',
4292 systemd_networkd_sources,
8d40961c 4293 include_directories : network_includes,
6164ec4c
ZJS
4294 link_with : [libnetworkd_core,
4295 libsystemd_network,
6164ec4c 4296 networkd_link_with],
c47511da 4297 dependencies : [threads,
92148283 4298 userspace,
c47511da 4299 versiondep],
5fb22561 4300 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4301 install : true,
4302 install_dir : rootlibexecdir)
4303
3761002e 4304 public_programs += executable(
6164ec4c
ZJS
4305 'systemd-networkd-wait-online',
4306 systemd_networkd_wait_online_sources,
4307 include_directories : includes,
8d40961c 4308 link_with : [networkd_link_with],
92148283
JJ
4309 dependencies : [userspace,
4310 versiondep],
5fb22561 4311 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4312 install : true,
4313 install_dir : rootlibexecdir)
4314
4315 public_programs += executable(
4316 'networkctl',
4317 networkctl_sources,
8d40961c 4318 include_directories : libsystemd_network_includes,
6164ec4c
ZJS
4319 link_with : [libsystemd_network,
4320 networkd_link_with],
92148283
JJ
4321 dependencies : [userspace,
4322 versiondep],
5fb22561 4323 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4324 install : true,
4325 install_dir : rootbindir)
987dd89c 4326endif
6164ec4c 4327
987dd89c
YW
4328exe = executable(
4329 'systemd-network-generator',
4330 network_generator_sources,
4331 include_directories : includes,
4332 link_with : [networkd_link_with],
92148283
JJ
4333 dependencies : [userspace,
4334 versiondep],
5fb22561 4335 install_rpath : rootpkglibdir,
987dd89c
YW
4336 install : true,
4337 install_dir : rootlibexecdir)
fbaa1137 4338
987dd89c
YW
4339if want_tests != 'false'
4340 test('test-network-generator-conversion',
4341 test_network_generator_conversion_sh,
4342 # https://github.com/mesonbuild/meson/issues/2681
e93ada98
DDM
4343 args : exe.full_path(),
4344 depends : exe)
dcfe072a 4345endif
e821f6a9 4346
6164ec4c
ZJS
4347executable(
4348 'systemd-sulogin-shell',
73e994f2 4349 'src/sulogin-shell/sulogin-shell.c',
6164ec4c
ZJS
4350 include_directories : includes,
4351 link_with : [libshared],
92148283
JJ
4352 dependencies : [userspace,
4353 versiondep],
5fb22561 4354 install_rpath : rootpkglibdir,
6164ec4c
ZJS
4355 install : true,
4356 install_dir : rootlibexecdir)
e821f6a9 4357
f9a6cb0e 4358kernel_install = custom_target(
99d8cbce
ZJS
4359 'kernel-install',
4360 input : kernel_install_in,
4361 output : 'kernel-install',
4362 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
4363 install : want_kernel_install,
4364 install_mode : 'rwxr-xr-x',
4365 install_dir : bindir)
9a01fe39
ZJS
4366if want_kernel_install
4367 public_programs += exe
4368endif
f875e6bc 4369
f9a6cb0e 4370ukify = custom_target(
30ec2eae
ZJS
4371 'ukify',
4372 input : 'src/ukify/ukify.py',
4373 output : 'ukify',
4374 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
9a01fe39 4375 install : want_ukify,
30ec2eae
ZJS
4376 install_mode : 'rwxr-xr-x',
4377 install_dir : rootlibexecdir)
9a01fe39 4378if want_ukify
f9a6cb0e
ZJS
4379 public_programs += ukify
4380endif
4381
4382if want_tests != 'false' and want_kernel_install
4383 args = [kernel_install.full_path(), loaderentry_install, uki_copy_install]
3f80c139
ZJS
4384 if want_ukify and boot_stubs.length() > 0
4385 args += [ukify.full_path(), ukify_install, boot_stubs[0]]
f9a6cb0e
ZJS
4386 endif
4387
4388 test('test-kernel-install',
4389 test_kernel_install_sh,
4390 env : test_env,
4391 args : args)
30ec2eae
ZJS
4392endif
4393
69e96427
ZJS
4394############################################################
4395
e93ada98 4396runtest_env = custom_target(
e2d41370
FB
4397 'systemd-runtest.env',
4398 output : 'systemd-runtest.env',
0f4c4f38
ZJS
4399 command : [sh, '-c',
4400 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
fce9abb2
ZJS
4401 project_source_root / 'test',
4402 project_build_root / 'catalog')],
e93ada98 4403 depends : catalogs,
e2d41370
FB
4404 build_by_default : true)
4405
a626cb15
ZJS
4406test_cflags = ['-DTEST_CODE=1']
4407# We intentionally do not do inline initializations with definitions for a
4408# bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
4409# use the variable unexpectedly. This triggers a lot of maybe-uninitialized
4410# false positives when the combination of -O2 and -flto is used. Suppress them.
b528a628 4411if '-O2' in c_args and '-flto=auto' in c_args
a626cb15
ZJS
4412 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
4413endif
4414
c12e10d7 4415foreach test : simple_tests
822cd3ff 4416 tests += { 'sources' : [test] }
c12e10d7
JJ
4417endforeach
4418
822cd3ff
JJ
4419foreach test : tests
4420 sources = test.get('sources')
4421 condition = test.get('condition', '')
4422 type = test.get('type', '')
4423 base = test.get('base', {})
92148283
JJ
4424 deps = [
4425 base.get('dependencies', []),
4426 test.get('dependencies', []),
4427 versiondep,
4428 ]
37efbbd8 4429
e1eeebbb 4430 # FIXME: Use fs.stem() with meson >= 0.54.0
92148283
JJ
4431 name = '@0@'.format(sources[0]).split('/')[-1]
4432 if not name.endswith('.cc')
4433 deps += [userspace]
4434 endif
4435 name = name.split('.')[0]
3b2bdd62 4436
c3191c6d
DDM
4437 suite = fs.name(fs.parent('@0@'.format(sources[0])))
4438 # FIXME: Use str.replace() with meson >= 0.58.0
4439 suite = suite.split('sd-')[-1]
4440
822cd3ff 4441 if condition != '' and conf.get(condition) == 0
37efbbd8 4442 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
822cd3ff
JJ
4443 continue
4444 endif
4445
4446 exe = executable(
4447 name,
4448 sources,
4449 include_directories : [base.get('includes', []), test.get('includes', includes)],
4450 link_with : [base.get('link_with', []), test.get('link_with', libshared)],
92148283 4451 dependencies : deps,
822cd3ff
JJ
4452 c_args : [test_cflags, test.get('c_args', [])],
4453 build_by_default : want_tests != 'false',
4454 install_rpath : rootpkglibdir,
4455 install : install_tests,
26c2b302 4456 install_dir : unittestsdir / type,
822cd3ff
JJ
4457 link_depends : runtest_env)
4458
4459 if type == 'manual'
4460 message('@0@ is a manual test'.format(name))
4461 elif type == 'unsafe' and want_tests != 'unsafe'
4462 message('@0@ is an unsafe test'.format(name))
4463 elif want_tests != 'false'
4464 test(name, exe,
4465 env : test_env,
4466 timeout : test.get('timeout', 30),
4467 suite : suite,
4468 is_parallel : test.get('parallel', true))
37efbbd8 4469 endif
69e96427
ZJS
4470endforeach
4471
0632b4cd 4472exe = executable(
37efbbd8
ZJS
4473 'test-libsystemd-sym',
4474 test_libsystemd_sym_c,
4475 include_directories : includes,
4476 link_with : [libsystemd],
92148283 4477 dependencies : userspace,
fd1939fb 4478 build_by_default : want_tests != 'false',
37efbbd8 4479 install : install_tests,
26c2b302 4480 install_dir : unittestsdir)
938be089
ZJS
4481if want_tests != 'false'
4482 test('test-libsystemd-sym', exe)
4483endif
37ab1a25 4484
0632b4cd
ZJS
4485exe = executable(
4486 'test-libsystemd-static-sym',
4487 test_libsystemd_sym_c,
4488 include_directories : includes,
0632b4cd 4489 link_with : [install_libsystemd_static],
92148283
JJ
4490 dependencies : [
4491 # threads is already included in dependencies on the library,
4492 # but does not seem to get propagated. Add here as a work-around.
4493 threads,
4494 userspace,
4495 ],
fd1939fb 4496 build_by_default : want_tests != 'false' and static_libsystemd_pic,
20f3d32d 4497 install : install_tests and static_libsystemd_pic,
26c2b302 4498 install_dir : unittestsdir)
938be089 4499if want_tests != 'false' and static_libsystemd_pic
0632b4cd
ZJS
4500 test('test-libsystemd-static-sym', exe)
4501endif
37ab1a25 4502
0632b4cd 4503exe = executable(
37efbbd8
ZJS
4504 'test-libudev-sym',
4505 test_libudev_sym_c,
e4b127e2 4506 include_directories : libudev_includes,
a626cb15 4507 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
37efbbd8 4508 link_with : [libudev],
92148283 4509 dependencies : userspace,
fd1939fb 4510 build_by_default : want_tests != 'false',
37efbbd8 4511 install : install_tests,
26c2b302 4512 install_dir : unittestsdir)
938be089
ZJS
4513if want_tests != 'false'
4514 test('test-libudev-sym', exe)
4515endif
0632b4cd
ZJS
4516
4517exe = executable(
4518 'test-libudev-static-sym',
4519 test_libudev_sym_c,
e4b127e2 4520 include_directories : libudev_includes,
a626cb15 4521 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
0632b4cd 4522 link_with : [install_libudev_static],
92148283 4523 dependencies : userspace,
fd1939fb 4524 build_by_default : want_tests != 'false' and static_libudev_pic,
20f3d32d 4525 install : install_tests and static_libudev_pic,
26c2b302 4526 install_dir : unittestsdir)
938be089 4527if want_tests != 'false' and static_libudev_pic
0632b4cd
ZJS
4528 test('test-libudev-static-sym', exe)
4529endif
e0bec52f 4530
69e96427 4531############################################################
5c23128d 4532
a9a7153c 4533foreach fuzzer : simple_fuzzers
2ed35b2f 4534 fuzzers += { 'sources' : [fuzzer] }
a9a7153c
JJ
4535endforeach
4536
7db7d5b7
JR
4537fuzzer_exes = []
4538
2ed35b2f
JJ
4539foreach fuzzer : fuzzers
4540 sources = fuzzer.get('sources')
4541 base = fuzzer.get('base', {})
4542 dependencies = [base.get('dependencies', []), fuzzer.get('dependencies', [])]
7e299ffe
ZJS
4543 link_args = []
4544
4545 if want_ossfuzz
4546 dependencies += fuzzing_engine
4547 elif want_libfuzzer
4548 if fuzzing_engine.found()
9c5c4677
EV
4549 dependencies += fuzzing_engine
4550 else
7e299ffe 4551 link_args += ['-fsanitize=fuzzer']
9c5c4677 4552 endif
7e299ffe 4553 else
2ed35b2f 4554 sources += files('src/fuzz/fuzz-main.c')
7e299ffe 4555 endif
7e343b53 4556 sources += fuzz_generated_directives
7db7d5b7 4557
bbec46c8
JJ
4558 # FIXME: Use fs.stem() with meson >= 0.54.0
4559 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
7db7d5b7 4560
f78ad5f0 4561 exe = executable(
7e299ffe
ZJS
4562 name,
4563 sources,
2ed35b2f
JJ
4564 include_directories : [
4565 base.get('includes', []),
4566 fuzzer.get('includes', includes),
4567 include_directories('src/fuzz'),
4568 ],
4569 link_with : [base.get('link_with', []), fuzzer.get('link_with', libshared)],
92148283
JJ
4570 dependencies : [
4571 dependencies,
4572 userspace,
4573 versiondep,
4574 ],
2ed35b2f 4575 c_args : [test_cflags, fuzzer.get('c_args', [])],
7e299ffe
ZJS
4576 link_args: link_args,
4577 install : false,
f78ad5f0
ZJS
4578 build_by_default : fuzzer_build)
4579 fuzzer_exes += exe
4580
7db5761d 4581 if want_tests != 'false' and name in fuzz_regression_tests
f78ad5f0
ZJS
4582 # Run the fuzz regression tests without any sanitizers enabled.
4583 # Additional invocations with sanitizers may be added below.
7e343b53
MK
4584 foreach tuple : fuzz_regression_tests[name]
4585 fuzz_dir = tuple[0]
4586 fuzz_in = tuple[1]
7db5761d
MK
4587 test('@0@_@1@'.format(name, fuzz_in),
4588 exe,
4589 suite : 'fuzzers',
7e343b53
MK
4590 args : [fuzz_dir != '' ? project_source_root / fuzz_dir / name / fuzz_in
4591 : fuzz_generated_in_dir / '@0@_@1@'.format(name, fuzz_in)])
f78ad5f0
ZJS
4592 endforeach
4593 endif
7e299ffe 4594endforeach
7db7d5b7 4595
6839ce33 4596alias_target('fuzzers', fuzzer_exes)
7db7d5b7
JR
4597
4598############################################################
4599
10783aef
ZJS
4600subdir('docs/sysvinit')
4601subdir('docs/var-log')
4602subdir('hwdb.d')
4603subdir('man')
378e9d2b 4604subdir('modprobe.d')
10783aef
ZJS
4605subdir('network')
4606subdir('presets')
4607subdir('shell-completion/bash')
4608subdir('shell-completion/zsh')
5c23128d
ZJS
4609subdir('sysctl.d')
4610subdir('sysusers.d')
4611subdir('tmpfiles.d')
4f10b807 4612subdir('units')
5c23128d 4613
5c23128d
ZJS
4614install_subdir('factory/etc',
4615 install_dir : factorydir)
623370e6 4616subdir('factory/templates')
5c23128d 4617
d7aa78c3
JT
4618if install_sysconfdir
4619 install_data('xorg/50-systemd-user.sh',
4620 install_dir : xinitrcdir)
4621endif
f09eb768 4622install_data('LICENSE.GPL2',
5c23128d 4623 'LICENSE.LGPL2.1',
f09eb768
LP
4624 'NEWS',
4625 'README',
eea98402 4626 'docs/CODING_STYLE.md',
1d1cb168 4627 'docs/DISTRO_PORTING.md',
9e825ebf 4628 'docs/ENVIRONMENT.md',
5425f8a5 4629 'docs/HACKING.md',
9e825ebf 4630 'docs/TRANSIENT-SETTINGS.md',
b6dc0d7d 4631 'docs/TRANSLATORS.md',
9e825ebf 4632 'docs/UIDS-GIDS.md',
5c23128d 4633 install_dir : docdir)
d68b342b 4634
9c6e32a2
LB
4635install_subdir('LICENSES',
4636 install_dir : docdir)
4637
7c22f07c
ZJS
4638meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
4639meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
94e75a54 4640
d68b342b
ZJS
4641############################################################
4642
2d4efd1d
LB
4643# Ensure that changes to the docs/ directory do not break the
4644# basic Github pages build. But only run it in developer mode,
4645# as it might be fragile due to changes in the tooling, and it is
4646# not generally useful for users.
4647jekyll = find_program('jekyll', required : false)
4648if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
4649 test('github-pages',
4650 jekyll,
14056a52 4651 suite : 'dist-check',
2d4efd1d 4652 args : ['build',
fce9abb2
ZJS
4653 '--source', project_source_root / 'docs',
4654 '--destination', project_build_root / '_site'])
2d4efd1d
LB
4655endif
4656
4657############################################################
4658
dd1e33c8 4659check_help = find_program('tools/check-help.sh')
ffb7406b 4660check_version = find_program('tools/check-version.sh')
005a29f2
ZJS
4661
4662foreach exec : public_programs
37efbbd8 4663 name = exec.full_path().split('/')[-1]
938be089
ZJS
4664 if want_tests != 'false'
4665 test('check-help-' + name,
dd1e33c8 4666 check_help,
14056a52 4667 suite : 'dist-check',
e93ada98
DDM
4668 args : exec.full_path(),
4669 depends: exec)
ffb7406b
ZJS
4670
4671 test('check-version-' + name,
4672 check_version,
14056a52 4673 suite : 'dist-check',
ffb7406b
ZJS
4674 args : [exec.full_path(),
4675 meson.project_version()],
4676 depends: exec)
938be089 4677 endif
005a29f2
ZJS
4678endforeach
4679
52d4d1d3 4680# Enable tests for all supported sanitizers
7db5761d 4681foreach tuple : fuzz_sanitizers
52d4d1d3
ZJS
4682 sanitizer = tuple[0]
4683 build = tuple[1]
b68dfb9e 4684
7a6397d2 4685 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
7db5761d
MK
4686 foreach fuzzer, fuzz_ins : fuzz_regression_tests
4687 name = '@0@:@1@'.format(fuzzer, sanitizer)
4688 if want_tests == 'false'
4689 message('Not compiling @0@ because tests is set to false'.format(name))
4690 continue
52d4d1d3 4691 endif
7db5761d
MK
4692 if not fuzz_tests
4693 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
4694 continue
4695 endif
4696 exe = custom_target(
4697 name,
4698 output : name,
7e343b53 4699 depends : [build] + fuzz_generated_directives,
7db5761d
MK
4700 command : [ln, '-fs',
4701 build.full_path() / fuzzer,
4702 '@OUTPUT@'],
4703 build_by_default : true)
4704
7e343b53
MK
4705 foreach tuple : fuzz_ins
4706 fuzz_dir = tuple[0]
4707 fuzz_in = tuple[1]
4708
7db5761d 4709 test('@0@_@1@_@2@'.format(fuzzer, fuzz_in, sanitizer),
52d4d1d3 4710 env,
14056a52 4711 suite : 'fuzz+san',
89767158
EV
4712 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
4713 timeout : 60,
52d4d1d3 4714 args : [exe.full_path(),
7e343b53
MK
4715 fuzz_dir != '' ? project_source_root / fuzz_dir / fuzzer / fuzz_in
4716 : fuzz_generated_in_dir / '@0@_@1@'.format(fuzzer, fuzz_in)])
7db5761d 4717 endforeach
52d4d1d3 4718 endforeach
b68dfb9e
ZJS
4719 endif
4720endforeach
4721
52d4d1d3 4722
b68dfb9e
ZJS
4723############################################################
4724
0700e8ba 4725if git.found()
37efbbd8 4726 all_files = run_command(
0f4c4f38
ZJS
4727 env, '-u', 'GIT_WORK_TREE',
4728 git, '--git-dir=@0@/.git'.format(project_source_root),
ba9ca60a 4729 'ls-files', ':/*.[ch]', ':/*.cc',
e92777d2
ZJS
4730 check : false)
4731 if all_files.returncode() == 0
4732 all_files = files(all_files.stdout().split())
4733
4734 custom_target(
4735 'tags',
4736 output : 'tags',
4737 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
4738 run_target(
4739 'ctags',
691db9a7 4740 command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files)
e92777d2 4741 endif
d68b342b 4742endif
177929c2
ZJS
4743
4744if git.found()
dd1e33c8 4745 git_contrib_sh = find_program('tools/git-contrib.sh')
a923e085 4746 run_target(
37efbbd8 4747 'git-contrib',
dd1e33c8 4748 command : [git_contrib_sh])
177929c2 4749endif
dd6ab3df
ZJS
4750
4751if git.found()
4752 git_head = run_command(
e92777d2
ZJS
4753 git, '--git-dir=@0@/.git'.format(project_source_root),
4754 'rev-parse', 'HEAD',
4755 check : false).stdout().strip()
dd6ab3df 4756 git_head_short = run_command(
e92777d2
ZJS
4757 git, '--git-dir=@0@/.git'.format(project_source_root),
4758 'rev-parse', '--short=7', 'HEAD',
4759 check : false).stdout().strip()
dd6ab3df
ZJS
4760
4761 run_target(
4762 'git-snapshot',
0f4c4f38 4763 command : [git, 'archive',
1485aacb 4764 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
dd6ab3df
ZJS
4765 git_head_short),
4766 '--prefix', 'systemd-@0@/'.format(git_head),
4767 'HEAD'])
4768endif
829257d1
ZJS
4769
4770############################################################
4771
dd1e33c8 4772check_api_docs_sh = find_program('tools/check-api-docs.sh')
51b13863
LP
4773run_target(
4774 'check-api-docs',
4775 depends : [man, libsystemd, libudev],
dd1e33c8 4776 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
51b13863 4777
f12c5d36
ZJS
4778alias_target('update-dbus-docs', update_dbus_docs)
4779alias_target('update-man-rules', update_man_rules)
e3c368f6 4780
0628d48e
LB
4781if not meson.is_cross_build()
4782 custom_target(
4783 'export-dbus-interfaces',
4645074e 4784 output : fs.name(dbus_interfaces_dir),
0628d48e 4785 install : dbus_interfaces_dir != 'no',
4645074e 4786 install_dir : fs.parent(dbus_interfaces_dir),
0628d48e
LB
4787 command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs])
4788endif
e3c68924 4789
51b13863 4790############################################################
829257d1 4791
e92777d2
ZJS
4792alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
4793 check : true).stdout().strip()
12085ebb
ZJS
4794
4795summary({
12085ebb
ZJS
4796 'split /usr' : split_usr,
4797 'split bin-sbin' : split_bin,
4798 'prefix directory' : prefixdir,
4799 'rootprefix directory' : rootprefixdir,
4800 'sysconf directory' : sysconfdir,
4801 'include directory' : includedir,
4802 'lib directory' : libdir,
4803 'rootlib directory' : rootlibdir,
4804 'SysV init scripts' : sysvinit_path,
4805 'SysV rc?.d directories' : sysvrcnd_path,
4806 'PAM modules directory' : pamlibdir,
4807 'PAM configuration directory' : pamconfdir,
4808 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
4809 'RPM macros directory' : rpmmacrosdir,
4810 'modprobe.d directory' : modprobedir,
4811 'D-Bus policy directory' : dbuspolicydir,
4812 'D-Bus session directory' : dbussessionservicedir,
4813 'D-Bus system directory' : dbussystemservicedir,
7e560e79 4814 'D-Bus interfaces directory' : dbus_interfaces_dir,
12085ebb
ZJS
4815 'bash completions directory' : bashcompletiondir,
4816 'zsh completions directory' : zshcompletiondir,
a2b0cd3f 4817 'private shared lib version tag' : shared_lib_tag,
12085ebb
ZJS
4818 'extra start script' : get_option('rc-local'),
4819 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
4820 get_option('debug-tty')),
4821 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
4822 conf.get('SYSTEM_ALLOC_UID_MIN')),
4823 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
4824 conf.get('SYSTEM_ALLOC_GID_MIN')),
4825 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
4826 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
4827 'static UID/GID allocations' : ' '.join(static_ugids),
4828 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
4829 'render group access mode' : get_option('group-render-mode'),
4830 'certificate root directory' : get_option('certificate-root'),
4831 'support URL' : support_url,
4832 'nobody user name' : nobody_user,
4833 'nobody group name' : nobody_group,
4834 'fallback hostname' : get_option('fallback-hostname'),
9798deaf 4835 'default compression method' : compression,
12085ebb
ZJS
4836 'default DNSSEC mode' : default_dnssec,
4837 'default DNS-over-TLS mode' : default_dns_over_tls,
4838 'default mDNS mode' : default_mdns,
4839 'default LLMNR mode' : default_llmnr,
4840 'default DNS servers' : dns_servers.split(' '),
4841 'default NTP servers' : ntp_servers.split(' '),
4842 'default cgroup hierarchy' : default_hierarchy,
4843 'default net.naming-scheme value' : default_net_naming_scheme,
4844 'default KillUserProcesses value' : kill_user_processes,
4845 'default locale' : default_locale,
88b6f0de 4846 'default nspawn locale' : nspawn_locale,
79dec86a 4847 'default status unit format' : status_unit_format_default,
12085ebb
ZJS
4848 'default user $PATH' :
4849 default_user_path != '' ? default_user_path : '(same as system services)',
4850 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
4851 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
829257d1
ZJS
4852
4853# TODO:
4854# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
4855# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
4856# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
4857
829257d1
ZJS
4858found = []
4859missing = []
4860
4861foreach tuple : [
56d68e71
ZJS
4862 # dependencies
4863 ['ACL'],
829257d1 4864 ['AUDIT'],
829257d1 4865 ['AppArmor'],
56d68e71
ZJS
4866 ['IMA'],
4867 ['PAM'],
829257d1 4868 ['SECCOMP'],
56d68e71 4869 ['SELinux'],
829257d1 4870 ['SMACK'],
56d68e71
ZJS
4871 ['blkid'],
4872 ['elfutils'],
829257d1 4873 ['gcrypt'],
829257d1 4874 ['gnutls'],
7d861e12 4875 ['libbpf'],
56d68e71 4876 ['libcryptsetup'],
d1ae38d8 4877 ['libcryptsetup-plugins'],
829257d1 4878 ['libcurl'],
56d68e71
ZJS
4879 ['libfdisk'],
4880 ['libfido2'],
829257d1 4881 ['libidn'],
56d68e71 4882 ['libidn2'],
829257d1 4883 ['libiptc'],
56d68e71
ZJS
4884 ['microhttpd'],
4885 ['openssl'],
4886 ['p11kit'],
4887 ['pcre2'],
4888 ['pwquality'],
4889 ['qrencode'],
4890 ['tpm2'],
4891 ['xkbcommon'],
4892
4893 # compression libs
4894 ['zstd'],
4895 ['lz4'],
4896 ['xz'],
4897 ['zlib'],
4898 ['bzip2'],
4899
4900 # components
4901 ['backlight'],
829257d1 4902 ['binfmt'],
dfca5587 4903 ['bootloader'],
0a0d4899 4904 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
56d68e71 4905 ['coredump'],
56d68e71 4906 ['efi'],
dfca5587 4907 ['environment.d'],
829257d1 4908 ['firstboot'],
56d68e71
ZJS
4909 ['hibernate'],
4910 ['homed'],
4911 ['hostnamed'],
4912 ['hwdb'],
4913 ['importd'],
4914 ['initrd'],
f887eab1 4915 ['kernel-install'],
56d68e71 4916 ['localed'],
829257d1
ZJS
4917 ['logind'],
4918 ['machined'],
56d68e71
ZJS
4919 ['networkd'],
4920 ['nss-myhostname'],
4921 ['nss-mymachines'],
4922 ['nss-resolve'],
4923 ['nss-systemd'],
4924 ['oomd'],
61d0578b 4925 ['portabled'],
56d68e71
ZJS
4926 ['pstore'],
4927 ['quotacheck'],
4928 ['randomseed'],
4929 ['repart'],
4930 ['resolve'],
4931 ['rfkill'],
9bca4ae4 4932 ['sysext'],
0a0d4899 4933 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
43cc7a3e 4934 ['sysupdate'],
56d68e71 4935 ['sysusers'],
829257d1
ZJS
4936 ['timedated'],
4937 ['timesyncd'],
56d68e71
ZJS
4938 ['tmpfiles'],
4939 ['userdb'],
4940 ['vconsole'],
4941 ['xdg-autostart'],
4942
4943 # optional features
56d68e71 4944 ['idn'],
829257d1 4945 ['polkit'],
56d68e71 4946 ['nscd'],
0a0d4899 4947 ['legacy-pkla', install_polkit_pkla],
829257d1 4948 ['kmod'],
ede5a78f 4949 ['xenctrl'],
829257d1
ZJS
4950 ['dbus'],
4951 ['glib'],
829257d1 4952 ['tpm'],
0a0d4899
JH
4953 ['man pages', want_man],
4954 ['html pages', want_html],
4955 ['man page indices', want_man and have_lxml],
829257d1 4956 ['SysV compat'],
56d68e71 4957 ['compat-mutable-uid-boundaries'],
829257d1
ZJS
4958 ['utmp'],
4959 ['ldconfig'],
0a0d4899
JH
4960 ['adm group', get_option('adm-group')],
4961 ['wheel group', get_option('wheel-group')],
b14e1b43 4962 ['gshadow'],
829257d1
ZJS
4963 ['debug hashmap'],
4964 ['debug mmap cache'],
d6601495 4965 ['debug siphash'],
0a0d4899 4966 ['trace logging', conf.get('LOG_TRACE') == 1],
69525346
YW
4967 ['slow tests', slow_tests],
4968 ['fuzz tests', fuzz_tests],
0a0d4899
JH
4969 ['install tests', install_tests],
4970 ['link-udev-shared', get_option('link-udev-shared')],
4971 ['link-systemctl-shared', get_option('link-systemctl-shared')],
4972 ['link-networkd-shared', get_option('link-networkd-shared')],
4973 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
4974 ['link-journalctl-shared', get_option('link-journalctl-shared')],
4975 ['link-boot-shared', get_option('link-boot-shared')],
93651582 4976 ['first-boot-full-preset'],
ceedbf81 4977 ['fexecve'],
0a0d4899
JH
4978 ['standalone-binaries', get_option('standalone-binaries')],
4979 ['coverage', get_option('b_coverage')],
829257d1
ZJS
4980]
4981
af4d7860
ZJS
4982 if tuple.length() >= 2
4983 cond = tuple[1]
4984 else
829257d1
ZJS
4985 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
4986 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
349cc4a5 4987 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
829257d1
ZJS
4988 endif
4989 if cond
5a8b1640 4990 found += tuple[0]
829257d1 4991 else
5a8b1640 4992 missing += tuple[0]
829257d1
ZJS
4993 endif
4994endforeach
4995
c716c253
ZJS
4996if static_libsystemd == 'false'
4997 missing += 'static-libsystemd'
4998else
4999 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
5000endif
5001
5002if static_libudev == 'false'
5003 missing += 'static-libudev'
5004else
5005 found += 'static-libudev(@0@)'.format(static_libudev)
5006endif
5007
57633d23
ZJS
5008if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
5009 found += 'cryptolib(openssl)'
5010elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
5011 found += 'cryptolib(gcrypt)'
5012else
5013 missing += 'cryptolib'
5014endif
5015
237f2da9
ZJS
5016if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
5017 found += 'DNS-over-TLS(gnutls)'
5018elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
5019 found += 'DNS-over-TLS(openssl)'
5020else
5021 missing += 'DNS-over-TLS'
5022endif
5023
12085ebb
ZJS
5024summary({
5025 'enabled' : ', '.join(found),
5026 'disabled' : ', '.join(missing)},
5027 section : 'Features')
9a8e64b0
ZJS
5028
5029if rootprefixdir != rootprefix_default
8ea9fad7
YW
5030 warning('\n' +
5031 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
5032 'systemd used fixed names for unit file directories and other paths, so anything\n' +
5033 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
9a8e64b0 5034endif