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