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