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