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