]> git.ipfire.org Git - thirdparty/systemd.git/blame - meson.build
test: don't install /etc/securetty
[thirdparty/systemd.git] / meson.build
CommitLineData
3a726fcd 1# SPDX-License-Identifier: LGPL-2.1+
3a726fcd 2
5c23128d 3project('systemd', 'c',
78af8a79 4 version : '244',
5c23128d
ZJS
5 license : 'LGPLv2+',
6 default_options: [
37efbbd8
ZJS
7 'c_std=gnu99',
8 'prefix=/usr',
9 'sysconfdir=/etc',
10 'localstatedir=/var',
827ca909 11 'warning_level=2',
5c23128d 12 ],
7a6397d2 13 meson_version : '>= 0.46',
5c23128d
ZJS
14 )
15
78af8a79
ZJS
16libsystemd_version = '0.27.1'
17libudev_version = '1.6.16'
56d50ab1 18
348b4437 19# We need the same data in two different formats, ugh!
5c23128d
ZJS
20# Also, for hysterical reasons, we use different variable
21# names, sometimes. Not all variables are included in every
22# set. Ugh, ugh, ugh!
23conf = configuration_data()
a67c318d 24conf.set('PROJECT_VERSION', meson.project_version())
5c23128d
ZJS
25
26substs = configuration_data()
a67c318d
ZJS
27substs.set('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
28substs.set('PROJECT_VERSION', meson.project_version())
5c23128d 29
1485aacb
DC
30# This is to be used instead of meson.source_root(), as the latter will return
31# the wrong result when systemd is being built as a meson subproject
32project_source_root = meson.current_source_dir()
a0b15b41
ZJS
33relative_source_path = run_command('realpath',
34 '--relative-to=@0@'.format(meson.current_build_dir()),
35 project_source_root).stdout().strip()
36conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
1485aacb 37
c09edc79
ZJS
38want_ossfuzz = get_option('oss-fuzz')
39want_libfuzzer = get_option('llvm-fuzz')
87ac55a1
EV
40want_fuzzbuzz = get_option('fuzzbuzz')
41if want_ossfuzz + want_libfuzzer + want_fuzzbuzz > 1
42 error('only one of oss-fuzz, llvm-fuzz or fuzzbuzz can be specified')
c09edc79 43endif
87ac55a1
EV
44
45skip_deps = want_ossfuzz or want_libfuzzer
46fuzzer_build = want_ossfuzz or want_libfuzzer or want_fuzzbuzz
c09edc79 47
5c23128d
ZJS
48#####################################################################
49
003c8879 50# Try to install the git pre-commit hook
1485aacb 51git_hook = run_command(join_paths(project_source_root, 'tools/add-git-hook.sh'))
003c8879
ZJS
52if git_hook.returncode() == 0
53 message(git_hook.stdout().strip())
54endif
55
56#####################################################################
57
2675413e
ZJS
58if get_option('split-usr') == 'auto'
59 split_usr = run_command('test', '-L', '/bin').returncode() != 0
60else
61 split_usr = get_option('split-usr') == 'true'
62endif
671f0f8d
ZJS
63conf.set10('HAVE_SPLIT_USR', split_usr,
64 description : '/usr/bin and /bin directories are separate')
9a8e64b0 65
157baa87
ZJS
66if get_option('split-bin') == 'auto'
67 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
68else
69 split_bin = get_option('split-bin') == 'true'
70endif
671f0f8d
ZJS
71conf.set10('HAVE_SPLIT_BIN', split_bin,
72 description : 'bin and sbin directories are separate')
157baa87 73
74344a17 74rootprefixdir = get_option('rootprefix')
74344a17
ZJS
75# Unusual rootprefixdir values are used by some distros
76# (see https://github.com/systemd/systemd/pull/7461).
ba7f4ae6 77rootprefix_default = split_usr ? '/' : '/usr'
9a8e64b0
ZJS
78if rootprefixdir == ''
79 rootprefixdir = rootprefix_default
74344a17 80endif
23bdba61 81rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
5c23128d
ZJS
82
83sysvinit_path = get_option('sysvinit-path')
84sysvrcnd_path = get_option('sysvrcnd-path')
348b4437 85conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
349cc4a5 86 description : 'SysV init scripts and rcN.d links are supported')
5c23128d 87
a8b627aa
LP
88conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
89conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
09dad04c 90conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
a8b627aa 91
23bdba61 92# join_paths ignores the preceding arguments if an absolute component is
5c23128d
ZJS
93# encountered, so this should canonicalize various paths when they are
94# absolute or relative.
95prefixdir = get_option('prefix')
96if not prefixdir.startswith('/')
37efbbd8 97 error('Prefix is not absolute: "@0@"'.format(prefixdir))
5c23128d
ZJS
98endif
99bindir = join_paths(prefixdir, get_option('bindir'))
100libdir = join_paths(prefixdir, get_option('libdir'))
101sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
102includedir = join_paths(prefixdir, get_option('includedir'))
103datadir = join_paths(prefixdir, get_option('datadir'))
104localstatedir = join_paths('/', get_option('localstatedir'))
105
106rootbindir = join_paths(rootprefixdir, 'bin')
157baa87 107rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
5c23128d
ZJS
108rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
109
110rootlibdir = get_option('rootlibdir')
111if rootlibdir == ''
37efbbd8 112 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
5c23128d
ZJS
113endif
114
115# Dirs of external packages
a95696e3
BM
116pkgconfigdatadir = get_option('pkgconfigdatadir') == '' ? join_paths(datadir, 'pkgconfig') : get_option('pkgconfigdatadir')
117pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgconfig') : get_option('pkgconfiglibdir')
e17e5ba9
MB
118polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
119polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
120polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
e17e5ba9 121xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
8a38aac3
YW
122rpmmacrosdir = get_option('rpmmacrosdir')
123if rpmmacrosdir != 'no'
124 rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
125endif
02fa054d 126modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
5c23128d
ZJS
127
128# Our own paths
e17e5ba9
MB
129pkgdatadir = join_paths(datadir, 'systemd')
130environmentdir = join_paths(prefixdir, 'lib/environment.d')
131pkgsysconfdir = join_paths(sysconfdir, 'systemd')
132userunitdir = join_paths(prefixdir, 'lib/systemd/user')
133userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
134tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
135sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
136sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
137binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
138modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
139networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
140pkgincludedir = join_paths(includedir, 'systemd')
141systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
142usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
143systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
144userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
145systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
146systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
147systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
148systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
149udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
e17e5ba9
MB
150udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
151udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
152catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
153kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
154factorydir = join_paths(datadir, 'factory')
e17e5ba9
MB
155bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
156testsdir = join_paths(prefixdir, 'lib/systemd/tests')
157systemdstatedir = join_paths(localstatedir, 'lib/systemd')
158catalogstatedir = join_paths(systemdstatedir, 'catalog')
159randomseeddir = join_paths(localstatedir, 'lib/systemd')
61d0578b 160profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
e5ea741c 161ntpservicelistdir = join_paths(rootprefixdir, 'lib/systemd/ntp-units.d')
5c23128d 162
75aaade1
TB
163docdir = get_option('docdir')
164if docdir == ''
165 docdir = join_paths(datadir, 'doc/systemd')
166endif
167
5c23128d
ZJS
168dbuspolicydir = get_option('dbuspolicydir')
169if dbuspolicydir == ''
37efbbd8 170 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
5c23128d
ZJS
171endif
172
173dbussessionservicedir = get_option('dbussessionservicedir')
174if dbussessionservicedir == ''
37efbbd8 175 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
5c23128d
ZJS
176endif
177
178dbussystemservicedir = get_option('dbussystemservicedir')
179if dbussystemservicedir == ''
37efbbd8 180 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
5c23128d
ZJS
181endif
182
183pamlibdir = get_option('pamlibdir')
184if pamlibdir == ''
37efbbd8 185 pamlibdir = join_paths(rootlibdir, 'security')
5c23128d
ZJS
186endif
187
188pamconfdir = get_option('pamconfdir')
189if pamconfdir == ''
37efbbd8 190 pamconfdir = join_paths(sysconfdir, 'pam.d')
5c23128d
ZJS
191endif
192
444d5863 193memory_accounting_default = get_option('memory-accounting-default')
36cf4507 194status_unit_format_default = get_option('status-unit-format-default')
444d5863 195
5c23128d 196conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
e17e5ba9 197conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
5c23128d
ZJS
198conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
199conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
200conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
2a4c156d 201conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
96164a39 202
f7c5427c 203conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
96164a39 204
e17e5ba9 205conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
5c23128d
ZJS
206conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
207conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
e17e5ba9
MB
208conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
209conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
210conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
211conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
da495a03 212conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
7f2806d5 213conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
e17e5ba9
MB
214conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
215conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
216conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
217conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
218conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
74344a17 219conf.set_quoted('ROOTPREFIX', rootprefixdir)
3131bfe3 220conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
e17e5ba9
MB
221conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
222conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
5c23128d
ZJS
223conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
224conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
225conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
226conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
227conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
228conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
e17e5ba9
MB
229conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
230conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
e2d41370 231conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata'))
49cdae63 232conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
5c23128d 233conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
e17e5ba9 234conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
5c23128d
ZJS
235conf.set_quoted('LIBDIR', libdir)
236conf.set_quoted('ROOTLIBDIR', rootlibdir)
237conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
238conf.set_quoted('BOOTLIBDIR', bootlibdir)
e17e5ba9
MB
239conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
240conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
1d7579c4 241conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', join_paths(rootlibexecdir, 'systemd-import-fs'))
e17e5ba9
MB
242conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
243conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
244conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
245conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
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
ZJS
451
452conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
453conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
454conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
455conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
456conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
457conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
458conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
459
460decl_headers = '''
461#include <uchar.h>
4c2e1b39 462#include <sys/stat.h>
5c23128d 463'''
5c23128d
ZJS
464
465foreach decl : ['char16_t',
466 'char32_t',
4c2e1b39 467 'struct statx',
5c23128d 468 ]
2c201c21
ZJS
469
470 # We get -1 if the size cannot be determined
9c869d08
ZJS
471 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
472
473 if decl == 'struct statx'
474 if have
475 want_linux_stat_h = false
476 else
477 have = cc.sizeof(decl,
478 prefix : decl_headers + '#include <linux/stat.h>',
479 args : '-D_GNU_SOURCE') > 0
480 want_linux_stat_h = have
481 endif
482 endif
483
349cc4a5 484 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
5c23128d
ZJS
485endforeach
486
9c869d08 487conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
75720bff 488
5c23128d 489foreach ident : ['secure_getenv', '__secure_getenv']
349cc4a5 490 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
5c23128d
ZJS
491endforeach
492
493foreach ident : [
85db59b7 494 ['memfd_create', '''#include <sys/mman.h>'''],
7b961e40
LP
495 ['gettid', '''#include <sys/types.h>
496 #include <unistd.h>'''],
3c042add
LP
497 ['pivot_root', '''#include <stdlib.h>
498 #include <unistd.h>'''], # no known header declares pivot_root
85db59b7 499 ['name_to_handle_at', '''#include <sys/types.h>
37efbbd8
ZJS
500 #include <sys/stat.h>
501 #include <fcntl.h>'''],
85db59b7 502 ['setns', '''#include <sched.h>'''],
2acfd0ff
LP
503 ['renameat2', '''#include <stdio.h>
504 #include <fcntl.h>'''],
37efbbd8
ZJS
505 ['kcmp', '''#include <linux/kcmp.h>'''],
506 ['keyctl', '''#include <sys/types.h>
507 #include <keyutils.h>'''],
85db59b7 508 ['copy_file_range', '''#include <sys/syscall.h>
37efbbd8 509 #include <unistd.h>'''],
71e5200f
DM
510 ['bpf', '''#include <sys/syscall.h>
511 #include <unistd.h>'''],
4c2e1b39
LP
512 ['statx', '''#include <sys/types.h>
513 #include <sys/stat.h>
514 #include <unistd.h>'''],
aa484f35
ZJS
515 ['explicit_bzero' , '''#include <string.h>'''],
516 ['reallocarray', '''#include <malloc.h>'''],
b070c7c0
MS
517 ['set_mempolicy', '''#include <stdlib.h>
518 #include <unistd.h>'''],
519 ['get_mempolicy', '''#include <stdlib.h>
520 #include <unistd.h>'''],
5f152f43
LP
521 ['pidfd_send_signal', '''#include <stdlib.h>
522 #include <unistd.h>
523 #include <signal.h>
524 #include <sys/wait.h>'''],
525 ['pidfd_open', '''#include <stdlib.h>
526 #include <unistd.h>
527 #include <signal.h>
528 #include <sys/wait.h>'''],
5ead4e85
LP
529 ['rt_sigqueueinfo', '''#include <stdlib.h>
530 #include <unistd.h>
531 #include <signal.h>
532 #include <sys/wait.h>'''],
37efbbd8
ZJS
533]
534
85db59b7 535 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
4b9545f1 536 conf.set10('HAVE_' + ident[0].to_upper(), have)
5c23128d
ZJS
537endforeach
538
85db59b7 539if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
349cc4a5 540 conf.set10('USE_SYS_RANDOM_H', true)
4b9545f1 541 conf.set10('HAVE_GETRANDOM', true)
4984c8be
ZJS
542else
543 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
349cc4a5 544 conf.set10('USE_SYS_RANDOM_H', false)
4b9545f1 545 conf.set10('HAVE_GETRANDOM', have)
4984c8be
ZJS
546endif
547
5c23128d
ZJS
548#####################################################################
549
1485aacb
DC
550vcs_tagger = [project_source_root + '/tools/meson-vcs-tag.sh',
551 project_source_root,
e1ca734e 552 get_option('version-tag'),
681bd2c5
ZJS
553 meson.project_version()]
554
d1084aa2
LT
555version_h = vcs_tag(
556 input : 'src/version/version.h.in',
557 output : 'version.h',
558 command: vcs_tagger)
559
560versiondep = declare_dependency(sources: version_h)
561
5c23128d 562sed = find_program('sed')
5c23128d 563awk = find_program('awk')
d730e2d1 564m4 = find_program('m4')
5c23128d 565stat = find_program('stat')
d68b342b 566git = find_program('git', required : false)
b68dfb9e 567env = find_program('env')
b1ffacb6 568perl = find_program('perl', required : false)
5c23128d 569
1485aacb 570meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
94e75a54 571mkdir_p = 'mkdir -p $DESTDIR/@0@'
d83f4f50
ZJS
572test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
573splash_bmp = files('test/splash.bmp')
94e75a54 574
5c23128d
ZJS
575# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
576# /usr/sbin, /sbin, and fall back to the default from middle column.
2fa645f1 577progs = [['quotaon', '/usr/sbin/quotaon' ],
5c23128d 578 ['quotacheck', '/usr/sbin/quotacheck' ],
5c23128d
ZJS
579 ['kmod', '/usr/bin/kmod' ],
580 ['kexec', '/usr/sbin/kexec' ],
581 ['sulogin', '/usr/sbin/sulogin' ],
582 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
583 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
584 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
585 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
6db90462 586 ['nologin', '/usr/sbin/nologin', ],
5c23128d
ZJS
587 ]
588foreach prog : progs
37efbbd8
ZJS
589 path = get_option(prog[0] + '-path')
590 if path != ''
591 message('Using @1@ for @0@'.format(prog[0], path))
592 else
593 exe = find_program(prog[0],
594 '/usr/sbin/' + prog[0],
595 '/sbin/' + prog[0],
596 required: false)
597 path = exe.found() ? exe.path() : prog[1]
598 endif
599 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
600 conf.set_quoted(name, path)
601 substs.set(name, path)
5c23128d
ZJS
602endforeach
603
2fa645f1
MG
604conf.set_quoted('TELINIT', get_option('telinit-path'))
605
1276a9f6 606if run_command('ln', '--relative', '--help').returncode() != 0
cd001016 607 error('ln does not support --relative (added in coreutils 8.16)')
1276a9f6 608endif
5c23128d
ZJS
609
610############################################################
611
612gperf = find_program('gperf')
613
614gperf_test_format = '''
615#include <string.h>
616const char * in_word_set(const char *, @0@);
617@1@
618'''
619gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
620gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
621gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
622if cc.compiles(gperf_test)
37efbbd8 623 gperf_len_type = 'size_t'
5c23128d 624else
37efbbd8
ZJS
625 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
626 if cc.compiles(gperf_test)
627 gperf_len_type = 'unsigned'
628 else
629 error('unable to determine gperf len type')
630 endif
5c23128d
ZJS
631endif
632message('gperf len type is @0@'.format(gperf_len_type))
37efbbd8
ZJS
633conf.set('GPERF_LEN_TYPE', gperf_len_type,
634 description : 'The type of gperf "len" parameter')
5c23128d
ZJS
635
636############################################################
637
638if not cc.has_header('sys/capability.h')
37efbbd8 639 error('POSIX caps headers not found')
5c23128d 640endif
9f555bba 641foreach header : ['crypt.h',
5c23128d
ZJS
642 'linux/memfd.h',
643 'linux/vm_sockets.h',
af8786b1 644 'sys/auxv.h',
5c23128d
ZJS
645 'valgrind/memcheck.h',
646 'valgrind/valgrind.h',
647 ]
2c201c21 648
349cc4a5
ZJS
649 conf.set10('HAVE_' + header.underscorify().to_upper(),
650 cc.has_header(header))
5c23128d
ZJS
651endforeach
652
653############################################################
654
655conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
5248e7e1
ZJS
656conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
657gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
5c23128d
ZJS
658
659default_hierarchy = get_option('default-hierarchy')
660conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
661 description : 'default cgroup hierarchy as string')
662if default_hierarchy == 'legacy'
37efbbd8 663 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
5c23128d 664elif default_hierarchy == 'hybrid'
37efbbd8 665 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
5c23128d 666else
37efbbd8 667 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
5c23128d
ZJS
668endif
669
06da5c63
ZJS
670default_net_naming_scheme = get_option('default-net-naming-scheme')
671conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
672
5c23128d 673time_epoch = get_option('time-epoch')
ac09340e 674if time_epoch == -1
37efbbd8 675 NEWS = files('NEWS')
ac09340e 676 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout().to_int()
5c23128d 677endif
5c23128d
ZJS
678conf.set('TIME_EPOCH', time_epoch)
679
680system_uid_max = get_option('system-uid-max')
ac09340e 681if system_uid_max == -1
37efbbd8
ZJS
682 system_uid_max = run_command(
683 awk,
2f62cf35
CMOF
684 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
685 '/etc/login.defs').stdout().strip()
686 if system_uid_max == ''
ac09340e
YW
687 system_uid_max = 999
688 else
689 system_uid_max = system_uid_max.to_int()
2f62cf35 690 endif
5c23128d 691endif
5c23128d
ZJS
692conf.set('SYSTEM_UID_MAX', system_uid_max)
693substs.set('systemuidmax', system_uid_max)
5c23128d 694
5c23128d 695system_gid_max = get_option('system-gid-max')
ac09340e 696if system_gid_max == -1
37efbbd8
ZJS
697 system_gid_max = run_command(
698 awk,
2f62cf35
CMOF
699 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
700 '/etc/login.defs').stdout().strip()
701 if system_gid_max == ''
ac09340e
YW
702 system_gid_max = 999
703 else
704 system_gid_max = system_gid_max.to_int()
2f62cf35 705 endif
5c23128d 706endif
5c23128d
ZJS
707conf.set('SYSTEM_GID_MAX', system_gid_max)
708substs.set('systemgidmax', system_gid_max)
5c23128d 709
ac09340e
YW
710dynamic_uid_min = get_option('dynamic-uid-min')
711dynamic_uid_max = get_option('dynamic-uid-max')
87d5e4f2
LP
712conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
713conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
714substs.set('dynamicuidmin', dynamic_uid_min)
715substs.set('dynamicuidmax', dynamic_uid_max)
716
ac09340e
YW
717container_uid_base_min = get_option('container-uid-base-min')
718container_uid_base_max = get_option('container-uid-base-max')
87d5e4f2
LP
719conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
720conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
721substs.set('containeruidbasemin', container_uid_base_min)
722substs.set('containeruidbasemax', container_uid_base_max)
723
afde4574
LP
724nobody_user = get_option('nobody-user')
725nobody_group = get_option('nobody-group')
726
2484bff3
CQ
727if not meson.is_cross_build()
728 getent_result = run_command('getent', 'passwd', '65534')
729 if getent_result.returncode() == 0
730 name = getent_result.stdout().split(':')[0]
731 if name != nobody_user
732 warning('\n' +
733 '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) +
734 'Your build will result in an user table setup that is incompatible with the local system.')
735 endif
afde4574 736 endif
2484bff3
CQ
737 id_result = run_command('id', '-u', nobody_user)
738 if id_result.returncode() == 0
739 id = id_result.stdout().to_int()
740 if id != 65534
741 warning('\n' +
742 '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) +
743 'Your build will result in an user table setup that is incompatible with the local system.')
744 endif
afde4574 745 endif
afde4574 746
2484bff3
CQ
747 getent_result = run_command('getent', 'group', '65534')
748 if getent_result.returncode() == 0
749 name = getent_result.stdout().split(':')[0]
750 if name != nobody_group
751 warning('\n' +
752 '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) +
753 'Your build will result in an group table setup that is incompatible with the local system.')
754 endif
afde4574 755 endif
2484bff3
CQ
756 id_result = run_command('id', '-g', nobody_group)
757 if id_result.returncode() == 0
758 id = id_result.stdout().to_int()
759 if id != 65534
760 warning('\n' +
761 '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) +
762 'Your build will result in an group table setup that is incompatible with the local system.')
763 endif
afde4574
LP
764 endif
765endif
8374cc62 766if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
8ea9fad7
YW
767 warning('\n' +
768 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
769 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
8374cc62 770endif
afde4574
LP
771
772conf.set_quoted('NOBODY_USER_NAME', nobody_user)
773conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
60712021
YW
774substs.set('NOBODY_USER_NAME', nobody_user)
775substs.set('NOBODY_GROUP_NAME', nobody_group)
87d5e4f2 776
5c23128d
ZJS
777tty_gid = get_option('tty-gid')
778conf.set('TTY_GID', tty_gid)
2a4c156d 779substs.set('TTY_GID', tty_gid)
5c23128d 780
84786b8e 781# Ensure provided GID argument is numeric, otherwise fallback to default assignment
ac09340e
YW
782users_gid = get_option('users-gid')
783substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid)
84786b8e 784
348b4437
YW
785conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
786conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
5c23128d 787
ace5e311
MB
788dev_kvm_mode = get_option('dev-kvm-mode')
789substs.set('DEV_KVM_MODE', dev_kvm_mode)
790conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
055a083a
MB
791group_render_mode = get_option('group-render-mode')
792substs.set('GROUP_RENDER_MODE', group_render_mode)
793conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
5c23128d 794
2a4c156d
ZJS
795kill_user_processes = get_option('default-kill-user-processes')
796conf.set10('KILL_USER_PROCESSES', kill_user_processes)
c7f7e859 797conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
2a4c156d 798substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
5c23128d 799
829257d1
ZJS
800dns_servers = get_option('dns-servers')
801conf.set_quoted('DNS_SERVERS', dns_servers)
802substs.set('DNS_SERVERS', dns_servers)
5c23128d 803
829257d1
ZJS
804ntp_servers = get_option('ntp-servers')
805conf.set_quoted('NTP_SERVERS', ntp_servers)
806substs.set('NTP_SERVERS', ntp_servers)
5c23128d 807
8ca9e92c 808default_locale = get_option('default-locale')
03475e22 809if default_locale == ''
50f2fc77
JH
810 if not meson.is_cross_build()
811 choose_default_locale_sh = find_program('tools/choose-default-locale.sh')
812 default_locale = run_command(choose_default_locale_sh).stdout().strip()
813 else
814 default_locale = 'C.UTF-8'
815 endif
03475e22 816endif
8ca9e92c
DR
817conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
818
5c23128d
ZJS
819conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
820
21d0dd5a 821service_watchdog = get_option('service-watchdog')
7bc9ea51
AZ
822watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
823substs.set('SERVICE_WATCHDOG', watchdog_value)
21d0dd5a 824
3131bfe3
ZJS
825substs.set('SUSHELL', get_option('debug-shell'))
826substs.set('DEBUGTTY', get_option('debug-tty'))
93912e87 827conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
3131bfe3 828
349cc4a5
ZJS
829enable_debug_hashmap = false
830enable_debug_mmap_cache = false
d6601495 831enable_debug_siphash = false
8f6b442a 832foreach name : get_option('debug-extra')
ad7aa760
YW
833 if name == 'hashmap'
834 enable_debug_hashmap = true
835 elif name == 'mmap-cache'
836 enable_debug_mmap_cache = true
d6601495
YW
837 elif name == 'siphash'
838 enable_debug_siphash = true
ad7aa760
YW
839 else
840 message('unknown debug option "@0@", ignoring'.format(name))
841 endif
842endforeach
349cc4a5
ZJS
843conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
844conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
d6601495 845conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
671677da 846
d18cb393 847conf.set10('VALGRIND', get_option('valgrind'))
fd5dec9a 848conf.set10('LOG_TRACE', get_option('log-trace'))
d18cb393 849
3602ca6f
ZJS
850default_user_path = get_option('user-path')
851if default_user_path != ''
852 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
5bc655cd
ZJS
853 default_user_path_display = default_user_path
854else
855 # meson 0.49 fails when ?: is used in .format()
856 default_user_path_display = '(same as system services)'
3602ca6f
ZJS
857endif
858
5bc655cd 859
5c23128d
ZJS
860#####################################################################
861
862threads = dependency('threads')
863librt = cc.find_library('rt')
864libm = cc.find_library('m')
865libdl = cc.find_library('dl')
866libcrypt = cc.find_library('crypt')
867
1800cc85
ZJS
868libcap = dependency('libcap', required : false)
869if not libcap.found()
870 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
871 libcap = cc.find_library('cap')
872endif
873
5c23128d 874libmount = dependency('mount',
c0b4b0f8 875 version : fuzzer_build ? '>= 0' : '>= 2.30')
5c23128d 876
e594a3b1
LP
877want_libfdisk = get_option('fdisk')
878if want_libfdisk != 'false' and not skip_deps
879 libfdisk = dependency('fdisk',
880 required : want_libfdisk == 'true')
881 have = libfdisk.found()
882else
883 have = false
884 libfdisk = []
885endif
886conf.set10('HAVE_LIBFDISK', have)
887
70a5db58
LP
888want_pwquality = get_option('pwquality')
889if want_pwquality != 'false' and not skip_deps
890 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
891 have = libpwquality.found()
892else
893 have = false
894 libpwquality = []
895endif
896conf.set10('HAVE_PWQUALITY', have)
897
5c23128d 898want_seccomp = get_option('seccomp')
87ac55a1 899if want_seccomp != 'false' and not skip_deps
37efbbd8 900 libseccomp = dependency('libseccomp',
9f0e9c01 901 version : '>= 2.3.1',
37efbbd8 902 required : want_seccomp == 'true')
349cc4a5 903 have = libseccomp.found()
5c23128d 904else
349cc4a5 905 have = false
37efbbd8 906 libseccomp = []
5c23128d 907endif
349cc4a5 908conf.set10('HAVE_SECCOMP', have)
5c23128d
ZJS
909
910want_selinux = get_option('selinux')
87ac55a1 911if want_selinux != 'false' and not skip_deps
37efbbd8
ZJS
912 libselinux = dependency('libselinux',
913 version : '>= 2.1.9',
914 required : want_selinux == 'true')
349cc4a5 915 have = libselinux.found()
5c23128d 916else
349cc4a5 917 have = false
37efbbd8 918 libselinux = []
5c23128d 919endif
349cc4a5 920conf.set10('HAVE_SELINUX', have)
5c23128d
ZJS
921
922want_apparmor = get_option('apparmor')
87ac55a1 923if want_apparmor != 'false' and not skip_deps
37efbbd8
ZJS
924 libapparmor = dependency('libapparmor',
925 required : want_apparmor == 'true')
349cc4a5 926 have = libapparmor.found()
5c23128d 927else
349cc4a5 928 have = false
37efbbd8 929 libapparmor = []
5c23128d 930endif
349cc4a5 931conf.set10('HAVE_APPARMOR', have)
5c23128d 932
5c23128d
ZJS
933smack_run_label = get_option('smack-run-label')
934if smack_run_label != ''
37efbbd8 935 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
5c23128d
ZJS
936endif
937
3ca0cb73
ZJS
938want_polkit = get_option('polkit')
939install_polkit = false
940install_polkit_pkla = false
87ac55a1 941if want_polkit != 'false' and not skip_deps
37efbbd8 942 install_polkit = true
3ca0cb73 943
37efbbd8
ZJS
944 libpolkit = dependency('polkit-gobject-1',
945 required : false)
946 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
947 message('Old polkit detected, will install pkla files')
948 install_polkit_pkla = true
949 endif
3ca0cb73 950endif
349cc4a5 951conf.set10('ENABLE_POLKIT', install_polkit)
3ca0cb73 952
36f0387e 953want_acl = get_option('acl')
87ac55a1 954if want_acl != 'false' and not skip_deps
36f0387e 955 libacl = cc.find_library('acl', required : want_acl == 'true')
349cc4a5 956 have = libacl.found()
36f0387e 957else
349cc4a5 958 have = false
36f0387e
ZJS
959 libacl = []
960endif
349cc4a5 961conf.set10('HAVE_ACL', have)
36f0387e 962
5c23128d 963want_audit = get_option('audit')
87ac55a1 964if want_audit != 'false' and not skip_deps
37efbbd8 965 libaudit = dependency('audit', required : want_audit == 'true')
349cc4a5 966 have = libaudit.found()
5c23128d 967else
349cc4a5 968 have = false
37efbbd8 969 libaudit = []
5c23128d 970endif
349cc4a5 971conf.set10('HAVE_AUDIT', have)
5c23128d
ZJS
972
973want_blkid = get_option('blkid')
87ac55a1 974if want_blkid != 'false' and not skip_deps
37efbbd8 975 libblkid = dependency('blkid', required : want_blkid == 'true')
349cc4a5 976 have = libblkid.found()
5c23128d 977else
349cc4a5 978 have = false
37efbbd8 979 libblkid = []
5c23128d 980endif
349cc4a5 981conf.set10('HAVE_BLKID', have)
5c23128d
ZJS
982
983want_kmod = get_option('kmod')
87ac55a1 984if want_kmod != 'false' and not skip_deps
37efbbd8
ZJS
985 libkmod = dependency('libkmod',
986 version : '>= 15',
987 required : want_kmod == 'true')
349cc4a5 988 have = libkmod.found()
5c23128d 989else
349cc4a5 990 have = false
37efbbd8 991 libkmod = []
5c23128d 992endif
349cc4a5 993conf.set10('HAVE_KMOD', have)
5c23128d
ZJS
994
995want_pam = get_option('pam')
87ac55a1 996if want_pam != 'false' and not skip_deps
37efbbd8
ZJS
997 libpam = cc.find_library('pam', required : want_pam == 'true')
998 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
349cc4a5 999 have = libpam.found() and libpam_misc.found()
5c23128d 1000else
349cc4a5 1001 have = false
37efbbd8
ZJS
1002 libpam = []
1003 libpam_misc = []
5c23128d 1004endif
349cc4a5 1005conf.set10('HAVE_PAM', have)
5c23128d
ZJS
1006
1007want_microhttpd = get_option('microhttpd')
87ac55a1 1008if want_microhttpd != 'false' and not skip_deps
37efbbd8
ZJS
1009 libmicrohttpd = dependency('libmicrohttpd',
1010 version : '>= 0.9.33',
1011 required : want_microhttpd == 'true')
349cc4a5 1012 have = libmicrohttpd.found()
5c23128d 1013else
349cc4a5 1014 have = false
37efbbd8 1015 libmicrohttpd = []
5c23128d 1016endif
349cc4a5 1017conf.set10('HAVE_MICROHTTPD', have)
5c23128d
ZJS
1018
1019want_libcryptsetup = get_option('libcryptsetup')
87ac55a1 1020if want_libcryptsetup != 'false' and not skip_deps
37efbbd8 1021 libcryptsetup = dependency('libcryptsetup',
d90874b4 1022 version : '>= 2.0.1',
37efbbd8 1023 required : want_libcryptsetup == 'true')
349cc4a5 1024 have = libcryptsetup.found()
70a5db58
LP
1025
1026 conf.set10('HAVE_CRYPT_SET_METADATA_SIZE',
1027 have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup))
5c23128d 1028else
349cc4a5 1029 have = false
37efbbd8 1030 libcryptsetup = []
5c23128d 1031endif
349cc4a5 1032conf.set10('HAVE_LIBCRYPTSETUP', have)
5c23128d
ZJS
1033
1034want_libcurl = get_option('libcurl')
87ac55a1 1035if want_libcurl != 'false' and not skip_deps
37efbbd8
ZJS
1036 libcurl = dependency('libcurl',
1037 version : '>= 7.32.0',
1038 required : want_libcurl == 'true')
349cc4a5 1039 have = libcurl.found()
5c23128d 1040else
349cc4a5 1041 have = false
37efbbd8 1042 libcurl = []
5c23128d 1043endif
349cc4a5 1044conf.set10('HAVE_LIBCURL', have)
5c23128d
ZJS
1045
1046want_libidn = get_option('libidn')
87057e24
ZJS
1047want_libidn2 = get_option('libidn2')
1048if want_libidn == 'true' and want_libidn2 == 'true'
1049 error('libidn and libidn2 cannot be requested simultaneously')
1050endif
1051
1b931399
YW
1052if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1053 libidn = dependency('libidn2',
1054 required : want_libidn2 == 'true')
349cc4a5 1055 have = libidn.found()
87057e24 1056else
349cc4a5 1057 have = false
87057e24
ZJS
1058 libidn = []
1059endif
1b931399
YW
1060conf.set10('HAVE_LIBIDN2', have)
1061if not have and want_libidn != 'false' and not skip_deps
7f7ab228 1062 # libidn is used for both libidn and libidn2 objects
1b931399
YW
1063 libidn = dependency('libidn',
1064 required : want_libidn == 'true')
349cc4a5
ZJS
1065 have = libidn.found()
1066else
1067 have = false
5c23128d 1068endif
1b931399 1069conf.set10('HAVE_LIBIDN', have)
5c23128d
ZJS
1070
1071want_libiptc = get_option('libiptc')
87ac55a1 1072if want_libiptc != 'false' and not skip_deps
37efbbd8
ZJS
1073 libiptc = dependency('libiptc',
1074 required : want_libiptc == 'true')
349cc4a5 1075 have = libiptc.found()
5c23128d 1076else
349cc4a5 1077 have = false
37efbbd8 1078 libiptc = []
5c23128d 1079endif
349cc4a5 1080conf.set10('HAVE_LIBIPTC', have)
5c23128d
ZJS
1081
1082want_qrencode = get_option('qrencode')
87ac55a1 1083if want_qrencode != 'false' and not skip_deps
37efbbd8
ZJS
1084 libqrencode = dependency('libqrencode',
1085 required : want_qrencode == 'true')
349cc4a5 1086 have = libqrencode.found()
5c23128d 1087else
349cc4a5 1088 have = false
37efbbd8 1089 libqrencode = []
5c23128d 1090endif
349cc4a5 1091conf.set10('HAVE_QRENCODE', have)
5c23128d 1092
a44fb601 1093want_gcrypt = get_option('gcrypt')
87ac55a1 1094if want_gcrypt != 'false' and not skip_deps
a44fb601
ZJS
1095 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1096 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
349cc4a5 1097 have = libgcrypt.found() and libgpg_error.found()
a44fb601 1098else
349cc4a5
ZJS
1099 have = false
1100endif
1101if not have
1102 # link to neither of the libs if one is not found
a44fb601
ZJS
1103 libgcrypt = []
1104 libgpg_error = []
1105endif
349cc4a5 1106conf.set10('HAVE_GCRYPT', have)
a44fb601 1107
5c23128d 1108want_gnutls = get_option('gnutls')
87ac55a1 1109if want_gnutls != 'false' and not skip_deps
37efbbd8
ZJS
1110 libgnutls = dependency('gnutls',
1111 version : '>= 3.1.4',
1112 required : want_gnutls == 'true')
349cc4a5 1113 have = libgnutls.found()
5c23128d 1114else
349cc4a5 1115 have = false
37efbbd8 1116 libgnutls = []
5c23128d 1117endif
349cc4a5 1118conf.set10('HAVE_GNUTLS', have)
5c23128d 1119
096cbdce 1120want_openssl = get_option('openssl')
87ac55a1 1121if want_openssl != 'false' and not skip_deps
096cbdce
IT
1122 libopenssl = dependency('openssl',
1123 version : '>= 1.1.0',
1124 required : want_openssl == 'true')
1125 have = libopenssl.found()
1126else
1127 have = false
1128 libopenssl = []
1129endif
1130conf.set10('HAVE_OPENSSL', have)
1131
839fddbe
LP
1132want_p11kit = get_option('p11kit')
1133if want_p11kit != 'false' and not skip_deps
1134 libp11kit = dependency('p11-kit-1',
1135 version : '>= 0.23.3',
1136 required : want_p11kit == 'true')
1137 have = libp11kit.found()
1138else
1139 have = false
1140 libp11kit = []
1141endif
1142conf.set10('HAVE_P11KIT', have)
1143
5c23128d 1144want_elfutils = get_option('elfutils')
87ac55a1 1145if want_elfutils != 'false' and not skip_deps
37efbbd8
ZJS
1146 libdw = dependency('libdw',
1147 required : want_elfutils == 'true')
349cc4a5 1148 have = libdw.found()
5c23128d 1149else
349cc4a5 1150 have = false
37efbbd8 1151 libdw = []
5c23128d 1152endif
349cc4a5 1153conf.set10('HAVE_ELFUTILS', have)
5c23128d
ZJS
1154
1155want_zlib = get_option('zlib')
87ac55a1 1156if want_zlib != 'false' and not skip_deps
37efbbd8
ZJS
1157 libz = dependency('zlib',
1158 required : want_zlib == 'true')
349cc4a5 1159 have = libz.found()
5c23128d 1160else
349cc4a5 1161 have = false
37efbbd8 1162 libz = []
5c23128d 1163endif
349cc4a5 1164conf.set10('HAVE_ZLIB', have)
5c23128d
ZJS
1165
1166want_bzip2 = get_option('bzip2')
87ac55a1 1167if want_bzip2 != 'false' and not skip_deps
37efbbd8
ZJS
1168 libbzip2 = cc.find_library('bz2',
1169 required : want_bzip2 == 'true')
349cc4a5 1170 have = libbzip2.found()
5c23128d 1171else
349cc4a5 1172 have = false
37efbbd8 1173 libbzip2 = []
5c23128d 1174endif
349cc4a5 1175conf.set10('HAVE_BZIP2', have)
5c23128d
ZJS
1176
1177want_xz = get_option('xz')
87ac55a1 1178if want_xz != 'false' and not skip_deps
37efbbd8
ZJS
1179 libxz = dependency('liblzma',
1180 required : want_xz == 'true')
349cc4a5 1181 have = libxz.found()
5c23128d 1182else
349cc4a5 1183 have = false
37efbbd8 1184 libxz = []
5c23128d 1185endif
349cc4a5 1186conf.set10('HAVE_XZ', have)
5c23128d
ZJS
1187
1188want_lz4 = get_option('lz4')
87ac55a1 1189if want_lz4 != 'false' and not skip_deps
37efbbd8 1190 liblz4 = dependency('liblz4',
e0a1d4b0 1191 version : '>= 1.3.0',
37efbbd8 1192 required : want_lz4 == 'true')
349cc4a5 1193 have = liblz4.found()
5c23128d 1194else
349cc4a5 1195 have = false
37efbbd8 1196 liblz4 = []
5c23128d 1197endif
349cc4a5 1198conf.set10('HAVE_LZ4', have)
5c23128d 1199
a44fb601 1200want_xkbcommon = get_option('xkbcommon')
87ac55a1 1201if want_xkbcommon != 'false' and not skip_deps
a44fb601
ZJS
1202 libxkbcommon = dependency('xkbcommon',
1203 version : '>= 0.3.0',
1204 required : want_xkbcommon == 'true')
349cc4a5 1205 have = libxkbcommon.found()
a44fb601 1206else
349cc4a5 1207 have = false
a44fb601
ZJS
1208 libxkbcommon = []
1209endif
349cc4a5 1210conf.set10('HAVE_XKBCOMMON', have)
a44fb601 1211
c4c978a0
ZJS
1212want_pcre2 = get_option('pcre2')
1213if want_pcre2 != 'false'
1214 libpcre2 = dependency('libpcre2-8',
1215 required : want_pcre2 == 'true')
1216 have = libpcre2.found()
1217else
1218 have = false
1219 libpcre2 = []
1220endif
1221conf.set10('HAVE_PCRE2', have)
1222
69e96427 1223want_glib = get_option('glib')
87ac55a1 1224if want_glib != 'false' and not skip_deps
37efbbd8
ZJS
1225 libglib = dependency('glib-2.0',
1226 version : '>= 2.22.0',
1227 required : want_glib == 'true')
1228 libgobject = dependency('gobject-2.0',
1229 version : '>= 2.22.0',
1230 required : want_glib == 'true')
1231 libgio = dependency('gio-2.0',
1232 required : want_glib == 'true')
2c201c21 1233 have = libglib.found() and libgobject.found() and libgio.found()
69e96427 1234else
349cc4a5 1235 have = false
37efbbd8
ZJS
1236 libglib = []
1237 libgobject = []
1238 libgio = []
69e96427 1239endif
349cc4a5 1240conf.set10('HAVE_GLIB', have)
69e96427
ZJS
1241
1242want_dbus = get_option('dbus')
87ac55a1 1243if want_dbus != 'false' and not skip_deps
37efbbd8
ZJS
1244 libdbus = dependency('dbus-1',
1245 version : '>= 1.3.2',
1246 required : want_dbus == 'true')
349cc4a5 1247 have = libdbus.found()
69e96427 1248else
349cc4a5 1249 have = false
37efbbd8 1250 libdbus = []
69e96427 1251endif
349cc4a5 1252conf.set10('HAVE_DBUS', have)
69e96427 1253
42303dcb 1254default_dnssec = get_option('default-dnssec')
87ac55a1 1255if skip_deps
b4081f3e
JR
1256 default_dnssec = 'no'
1257endif
349cc4a5 1258if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
42303dcb
YW
1259 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1260 default_dnssec = 'no'
1261endif
1262conf.set('DEFAULT_DNSSEC_MODE',
1263 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1264substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1265
56ddbf10
YW
1266dns_over_tls = get_option('dns-over-tls')
1267if dns_over_tls != 'false'
096cbdce
IT
1268 if dns_over_tls == 'openssl'
1269 have_gnutls = false
1270 else
38e053c5 1271 have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0'))
096cbdce
IT
1272 if dns_over_tls == 'gnutls' and not have_gnutls
1273 error('DNS-over-TLS support was requested with gnutls, but dependencies are not available')
1274 endif
56ddbf10 1275 endif
096cbdce
IT
1276 if dns_over_tls == 'gnutls' or have_gnutls
1277 have_openssl = false
1278 else
1279 have_openssl = conf.get('HAVE_OPENSSL') == 1
1280 if dns_over_tls != 'auto' and not have_openssl
1281 str = dns_over_tls == 'openssl' ? ' with openssl' : ''
b349bc59 1282 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
096cbdce
IT
1283 endif
1284 endif
1285 have = have_gnutls or have_openssl
56ddbf10 1286else
be5536a6
MO
1287 have = false
1288 have_gnutls = false
1289 have_openssl = false
56ddbf10
YW
1290endif
1291conf.set10('ENABLE_DNS_OVER_TLS', have)
096cbdce
IT
1292conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1293conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
56ddbf10 1294
c9299be2 1295default_dns_over_tls = get_option('default-dns-over-tls')
87ac55a1 1296if skip_deps
c9299be2 1297 default_dns_over_tls = 'no'
5d67a7ae 1298endif
56ddbf10 1299if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
4310bfc2 1300 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 1301 default_dns_over_tls = 'no'
5d67a7ae 1302endif
c9299be2
IT
1303conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1304 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1305substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls)
5d67a7ae 1306
e594a3b1
LP
1307want_repart = get_option('repart')
1308if want_repart != 'false'
1309 have = (conf.get('HAVE_OPENSSL') == 1 and
1310 conf.get('HAVE_LIBFDISK') == 1)
1311 if want_repart == 'true' and not have
1312 error('repart support was requested, but dependencies are not available')
1313 endif
1314else
1315 have = false
1316endif
1317conf.set10('ENABLE_REPART', have)
1318
5c23128d 1319want_importd = get_option('importd')
4390be30 1320if want_importd != 'false'
349cc4a5
ZJS
1321 have = (conf.get('HAVE_LIBCURL') == 1 and
1322 conf.get('HAVE_ZLIB') == 1 and
349cc4a5
ZJS
1323 conf.get('HAVE_XZ') == 1 and
1324 conf.get('HAVE_GCRYPT') == 1)
1325 if want_importd == 'true' and not have
37efbbd8
ZJS
1326 error('importd support was requested, but dependencies are not available')
1327 endif
349cc4a5
ZJS
1328else
1329 have = false
5c23128d 1330endif
349cc4a5 1331conf.set10('ENABLE_IMPORTD', have)
5c23128d 1332
70a5db58
LP
1333want_homed = get_option('homed')
1334if want_homed != 'false'
1335 have = (conf.get('HAVE_OPENSSL') == 1 and
1336 conf.get('HAVE_LIBFDISK') == 1 and
1337 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1338 if want_homed == 'true' and not have
1339 error('homed support was requested, but dependencies are not available')
1340 endif
1341else
1342 have = false
1343endif
1344conf.set10('ENABLE_HOMED', 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)),
359b496f
YW
3372 'EFI lib directory: @0@'.format(efi_libdir),
3373 'EFI lds directory: @0@'.format(efi_ldsdir),
3374 'EFI include directory: @0@'.format(efi_incdir)]
829257d1
ZJS
3375 endif
3376endif
3377
3378found = []
3379missing = []
3380
3381foreach tuple : [
3382 ['libcryptsetup'],
3383 ['PAM'],
70a5db58
LP
3384 ['pwquality'],
3385 ['fdisk'],
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