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