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