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