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