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