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