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