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