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