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