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