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