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