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