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