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