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