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