]> git.ipfire.org Git - thirdparty/systemd.git/blame - meson.build
fuzz: add initial fuzzing infrastructure
[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',
d6e80966 782 version : '>= 2.30')
5c23128d
ZJS
783
784want_seccomp = get_option('seccomp')
4390be30 785if want_seccomp != 'false'
37efbbd8 786 libseccomp = dependency('libseccomp',
9f0e9c01 787 version : '>= 2.3.1',
37efbbd8 788 required : want_seccomp == 'true')
349cc4a5 789 have = libseccomp.found()
5c23128d 790else
349cc4a5 791 have = false
37efbbd8 792 libseccomp = []
5c23128d 793endif
349cc4a5
ZJS
794conf.set10('HAVE_SECCOMP', have)
795m4_defines += have ? ['-DHAVE_SECCOMP'] : []
5c23128d
ZJS
796
797want_selinux = get_option('selinux')
4390be30 798if want_selinux != 'false'
37efbbd8
ZJS
799 libselinux = dependency('libselinux',
800 version : '>= 2.1.9',
801 required : want_selinux == 'true')
349cc4a5 802 have = libselinux.found()
5c23128d 803else
349cc4a5 804 have = false
37efbbd8 805 libselinux = []
5c23128d 806endif
349cc4a5
ZJS
807conf.set10('HAVE_SELINUX', have)
808m4_defines += have ? ['-DHAVE_SELINUX'] : []
5c23128d
ZJS
809
810want_apparmor = get_option('apparmor')
4390be30 811if want_apparmor != 'false'
37efbbd8
ZJS
812 libapparmor = dependency('libapparmor',
813 required : want_apparmor == 'true')
349cc4a5 814 have = libapparmor.found()
5c23128d 815else
349cc4a5 816 have = false
37efbbd8 817 libapparmor = []
5c23128d 818endif
349cc4a5
ZJS
819conf.set10('HAVE_APPARMOR', have)
820m4_defines += have ? ['-DHAVE_APPARMOR'] : []
5c23128d 821
5c23128d
ZJS
822smack_run_label = get_option('smack-run-label')
823if smack_run_label != ''
37efbbd8
ZJS
824 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
825 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
5c23128d
ZJS
826endif
827
3ca0cb73
ZJS
828want_polkit = get_option('polkit')
829install_polkit = false
830install_polkit_pkla = false
4390be30 831if want_polkit != 'false'
37efbbd8 832 install_polkit = true
3ca0cb73 833
37efbbd8
ZJS
834 libpolkit = dependency('polkit-gobject-1',
835 required : false)
836 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
837 message('Old polkit detected, will install pkla files')
838 install_polkit_pkla = true
839 endif
3ca0cb73 840endif
349cc4a5 841conf.set10('ENABLE_POLKIT', install_polkit)
3ca0cb73 842
36f0387e
ZJS
843want_acl = get_option('acl')
844if want_acl != 'false'
845 libacl = cc.find_library('acl', required : want_acl == 'true')
349cc4a5 846 have = libacl.found()
36f0387e 847else
349cc4a5 848 have = false
36f0387e
ZJS
849 libacl = []
850endif
349cc4a5
ZJS
851conf.set10('HAVE_ACL', have)
852m4_defines += have ? ['-DHAVE_ACL'] : []
36f0387e 853
5c23128d 854want_audit = get_option('audit')
4390be30 855if want_audit != 'false'
37efbbd8 856 libaudit = dependency('audit', required : want_audit == 'true')
349cc4a5 857 have = libaudit.found()
5c23128d 858else
349cc4a5 859 have = false
37efbbd8 860 libaudit = []
5c23128d 861endif
349cc4a5 862conf.set10('HAVE_AUDIT', have)
5c23128d
ZJS
863
864want_blkid = get_option('blkid')
4390be30 865if want_blkid != 'false'
37efbbd8 866 libblkid = dependency('blkid', required : want_blkid == 'true')
349cc4a5 867 have = libblkid.found()
5c23128d 868else
349cc4a5 869 have = false
37efbbd8 870 libblkid = []
5c23128d 871endif
349cc4a5 872conf.set10('HAVE_BLKID', have)
5c23128d
ZJS
873
874want_kmod = get_option('kmod')
4390be30 875if want_kmod != 'false'
37efbbd8
ZJS
876 libkmod = dependency('libkmod',
877 version : '>= 15',
878 required : want_kmod == 'true')
349cc4a5 879 have = libkmod.found()
5c23128d 880else
349cc4a5 881 have = false
37efbbd8 882 libkmod = []
5c23128d 883endif
349cc4a5 884conf.set10('HAVE_KMOD', have)
5c23128d
ZJS
885
886want_pam = get_option('pam')
4390be30 887if want_pam != 'false'
37efbbd8
ZJS
888 libpam = cc.find_library('pam', required : want_pam == 'true')
889 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
349cc4a5 890 have = libpam.found() and libpam_misc.found()
5c23128d 891else
349cc4a5 892 have = false
37efbbd8
ZJS
893 libpam = []
894 libpam_misc = []
5c23128d 895endif
349cc4a5
ZJS
896conf.set10('HAVE_PAM', have)
897m4_defines += have ? ['-DHAVE_PAM'] : []
5c23128d
ZJS
898
899want_microhttpd = get_option('microhttpd')
4390be30 900if want_microhttpd != 'false'
37efbbd8
ZJS
901 libmicrohttpd = dependency('libmicrohttpd',
902 version : '>= 0.9.33',
903 required : want_microhttpd == 'true')
349cc4a5 904 have = libmicrohttpd.found()
5c23128d 905else
349cc4a5 906 have = false
37efbbd8 907 libmicrohttpd = []
5c23128d 908endif
349cc4a5
ZJS
909conf.set10('HAVE_MICROHTTPD', have)
910m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
5c23128d
ZJS
911
912want_libcryptsetup = get_option('libcryptsetup')
4390be30 913if want_libcryptsetup != 'false'
37efbbd8
ZJS
914 libcryptsetup = dependency('libcryptsetup',
915 version : '>= 1.6.0',
916 required : want_libcryptsetup == 'true')
349cc4a5 917 have = libcryptsetup.found()
5c23128d 918else
349cc4a5 919 have = false
37efbbd8 920 libcryptsetup = []
5c23128d 921endif
349cc4a5 922conf.set10('HAVE_LIBCRYPTSETUP', have)
5c23128d
ZJS
923
924want_libcurl = get_option('libcurl')
4390be30 925if want_libcurl != 'false'
37efbbd8
ZJS
926 libcurl = dependency('libcurl',
927 version : '>= 7.32.0',
928 required : want_libcurl == 'true')
349cc4a5 929 have = libcurl.found()
5c23128d 930else
349cc4a5 931 have = false
37efbbd8 932 libcurl = []
5c23128d 933endif
349cc4a5
ZJS
934conf.set10('HAVE_LIBCURL', have)
935m4_defines += have ? ['-DHAVE_LIBCURL'] : []
5c23128d
ZJS
936
937want_libidn = get_option('libidn')
87057e24
ZJS
938want_libidn2 = get_option('libidn2')
939if want_libidn == 'true' and want_libidn2 == 'true'
940 error('libidn and libidn2 cannot be requested simultaneously')
941endif
942
7f7ab228
ZJS
943if want_libidn != 'false' and want_libidn2 != 'true'
944 libidn = dependency('libidn',
945 required : want_libidn == 'true')
349cc4a5 946 have = libidn.found()
87057e24 947else
349cc4a5 948 have = false
87057e24
ZJS
949 libidn = []
950endif
349cc4a5
ZJS
951conf.set10('HAVE_LIBIDN', have)
952m4_defines += have ? ['-DHAVE_LIBIDN'] : []
953if not have and want_libidn2 != 'false'
7f7ab228
ZJS
954 # libidn is used for both libidn and libidn2 objects
955 libidn = dependency('libidn2',
956 required : want_libidn2 == 'true')
349cc4a5
ZJS
957 have = libidn.found()
958else
959 have = false
5c23128d 960endif
349cc4a5
ZJS
961conf.set10('HAVE_LIBIDN2', have)
962m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
5c23128d
ZJS
963
964want_libiptc = get_option('libiptc')
4390be30 965if want_libiptc != 'false'
37efbbd8
ZJS
966 libiptc = dependency('libiptc',
967 required : want_libiptc == 'true')
349cc4a5 968 have = libiptc.found()
5c23128d 969else
349cc4a5 970 have = false
37efbbd8 971 libiptc = []
5c23128d 972endif
349cc4a5
ZJS
973conf.set10('HAVE_LIBIPTC', have)
974m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
5c23128d
ZJS
975
976want_qrencode = get_option('qrencode')
4390be30 977if want_qrencode != 'false'
37efbbd8
ZJS
978 libqrencode = dependency('libqrencode',
979 required : want_qrencode == 'true')
349cc4a5 980 have = libqrencode.found()
5c23128d 981else
349cc4a5 982 have = false
37efbbd8 983 libqrencode = []
5c23128d 984endif
349cc4a5 985conf.set10('HAVE_QRENCODE', have)
5c23128d 986
a44fb601
ZJS
987want_gcrypt = get_option('gcrypt')
988if want_gcrypt != 'false'
989 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
990 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
349cc4a5 991 have = libgcrypt.found() and libgpg_error.found()
a44fb601 992else
349cc4a5
ZJS
993 have = false
994endif
995if not have
996 # link to neither of the libs if one is not found
a44fb601
ZJS
997 libgcrypt = []
998 libgpg_error = []
999endif
349cc4a5 1000conf.set10('HAVE_GCRYPT', have)
a44fb601 1001
5c23128d 1002want_gnutls = get_option('gnutls')
4390be30 1003if want_gnutls != 'false'
37efbbd8
ZJS
1004 libgnutls = dependency('gnutls',
1005 version : '>= 3.1.4',
1006 required : want_gnutls == 'true')
349cc4a5 1007 have = libgnutls.found()
5c23128d 1008else
349cc4a5 1009 have = false
37efbbd8 1010 libgnutls = []
5c23128d 1011endif
349cc4a5 1012conf.set10('HAVE_GNUTLS', have)
5c23128d
ZJS
1013
1014want_elfutils = get_option('elfutils')
4390be30 1015if want_elfutils != 'false'
37efbbd8
ZJS
1016 libdw = dependency('libdw',
1017 required : want_elfutils == 'true')
349cc4a5 1018 have = libdw.found()
5c23128d 1019else
349cc4a5 1020 have = false
37efbbd8 1021 libdw = []
5c23128d 1022endif
349cc4a5 1023conf.set10('HAVE_ELFUTILS', have)
5c23128d
ZJS
1024
1025want_zlib = get_option('zlib')
4390be30 1026if want_zlib != 'false'
37efbbd8
ZJS
1027 libz = dependency('zlib',
1028 required : want_zlib == 'true')
349cc4a5 1029 have = libz.found()
5c23128d 1030else
349cc4a5 1031 have = false
37efbbd8 1032 libz = []
5c23128d 1033endif
349cc4a5 1034conf.set10('HAVE_ZLIB', have)
5c23128d
ZJS
1035
1036want_bzip2 = get_option('bzip2')
4390be30 1037if want_bzip2 != 'false'
37efbbd8
ZJS
1038 libbzip2 = cc.find_library('bz2',
1039 required : want_bzip2 == 'true')
349cc4a5 1040 have = libbzip2.found()
5c23128d 1041else
349cc4a5 1042 have = false
37efbbd8 1043 libbzip2 = []
5c23128d 1044endif
349cc4a5 1045conf.set10('HAVE_BZIP2', have)
5c23128d
ZJS
1046
1047want_xz = get_option('xz')
4390be30 1048if want_xz != 'false'
37efbbd8
ZJS
1049 libxz = dependency('liblzma',
1050 required : want_xz == 'true')
349cc4a5 1051 have = libxz.found()
5c23128d 1052else
349cc4a5 1053 have = false
37efbbd8 1054 libxz = []
5c23128d 1055endif
349cc4a5 1056conf.set10('HAVE_XZ', have)
5c23128d
ZJS
1057
1058want_lz4 = get_option('lz4')
4390be30 1059if want_lz4 != 'false'
37efbbd8
ZJS
1060 liblz4 = dependency('liblz4',
1061 required : want_lz4 == 'true')
349cc4a5 1062 have = liblz4.found()
5c23128d 1063else
349cc4a5 1064 have = false
37efbbd8 1065 liblz4 = []
5c23128d 1066endif
349cc4a5 1067conf.set10('HAVE_LZ4', have)
5c23128d 1068
a44fb601
ZJS
1069want_xkbcommon = get_option('xkbcommon')
1070if want_xkbcommon != 'false'
1071 libxkbcommon = dependency('xkbcommon',
1072 version : '>= 0.3.0',
1073 required : want_xkbcommon == 'true')
349cc4a5 1074 have = libxkbcommon.found()
a44fb601 1075else
349cc4a5 1076 have = false
a44fb601
ZJS
1077 libxkbcommon = []
1078endif
349cc4a5 1079conf.set10('HAVE_XKBCOMMON', have)
a44fb601 1080
69e96427 1081want_glib = get_option('glib')
4390be30 1082if want_glib != 'false'
37efbbd8
ZJS
1083 libglib = dependency('glib-2.0',
1084 version : '>= 2.22.0',
1085 required : want_glib == 'true')
1086 libgobject = dependency('gobject-2.0',
1087 version : '>= 2.22.0',
1088 required : want_glib == 'true')
1089 libgio = dependency('gio-2.0',
1090 required : want_glib == 'true')
2c201c21 1091 have = libglib.found() and libgobject.found() and libgio.found()
69e96427 1092else
349cc4a5 1093 have = false
37efbbd8
ZJS
1094 libglib = []
1095 libgobject = []
1096 libgio = []
69e96427 1097endif
349cc4a5 1098conf.set10('HAVE_GLIB', have)
69e96427
ZJS
1099
1100want_dbus = get_option('dbus')
4390be30 1101if want_dbus != 'false'
37efbbd8
ZJS
1102 libdbus = dependency('dbus-1',
1103 version : '>= 1.3.2',
1104 required : want_dbus == 'true')
349cc4a5 1105 have = libdbus.found()
69e96427 1106else
349cc4a5 1107 have = false
37efbbd8 1108 libdbus = []
69e96427 1109endif
349cc4a5 1110conf.set10('HAVE_DBUS', have)
69e96427 1111
42303dcb 1112default_dnssec = get_option('default-dnssec')
349cc4a5 1113if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
42303dcb
YW
1114 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1115 default_dnssec = 'no'
1116endif
1117conf.set('DEFAULT_DNSSEC_MODE',
1118 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1119substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1120
5c23128d 1121want_importd = get_option('importd')
4390be30 1122if want_importd != 'false'
349cc4a5
ZJS
1123 have = (conf.get('HAVE_LIBCURL') == 1 and
1124 conf.get('HAVE_ZLIB') == 1 and
1125 conf.get('HAVE_BZIP2') == 1 and
1126 conf.get('HAVE_XZ') == 1 and
1127 conf.get('HAVE_GCRYPT') == 1)
1128 if want_importd == 'true' and not have
37efbbd8
ZJS
1129 error('importd support was requested, but dependencies are not available')
1130 endif
349cc4a5
ZJS
1131else
1132 have = false
5c23128d 1133endif
349cc4a5 1134conf.set10('ENABLE_IMPORTD', have)
5c23128d
ZJS
1135
1136want_remote = get_option('remote')
4390be30 1137if want_remote != 'false'
349cc4a5
ZJS
1138 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1139 conf.get('HAVE_LIBCURL') == 1]
37efbbd8
ZJS
1140 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1141 # it's possible to build one without the other. Complain only if
1142 # support was explictly requested. The auxiliary files like sysusers
1143 # config should be installed when any of the programs are built.
1144 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1145 error('remote support was requested, but dependencies are not available')
1146 endif
349cc4a5
ZJS
1147 have = have_deps[0] or have_deps[1]
1148else
1149 have = false
5c23128d 1150endif
349cc4a5 1151conf.set10('ENABLE_REMOTE', have)
5c23128d 1152
a9149d87
ZJS
1153foreach term : ['utmp',
1154 'hibernate',
1155 'environment-d',
1156 'binfmt',
1157 'coredump',
1158 'resolve',
1159 'logind',
1160 'hostnamed',
1161 'localed',
1162 'machined',
1163 'networkd',
1164 'timedated',
1165 'timesyncd',
1166 'myhostname',
1167 'firstboot',
1168 'randomseed',
1169 'backlight',
1170 'vconsole',
1171 'quotacheck',
1172 'sysusers',
1173 'tmpfiles',
1174 'hwdb',
1175 'rfkill',
1176 'ldconfig',
1177 'efi',
1178 'tpm',
1179 'ima',
1180 'smack',
1181 'gshadow',
1182 'idn',
1183 'nss-systemd']
1184 have = get_option(term)
1185 name = 'ENABLE_' + term.underscorify().to_upper()
1186 conf.set10(name, have)
1187 m4_defines += have ? ['-D' + name] : []
5c23128d
ZJS
1188endforeach
1189
69e96427 1190want_tests = get_option('tests')
572baca1 1191install_tests = get_option('install-tests')
69e96427 1192tests = []
7db7d5b7 1193fuzzers = []
69e96427 1194
00d82c81
ZJS
1195conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1196
5c23128d
ZJS
1197#####################################################################
1198
1199if get_option('efi')
37efbbd8 1200 efi_arch = host_machine.cpu_family()
b710072d 1201
6800fe7f 1202 if efi_arch == 'x86'
37efbbd8 1203 EFI_MACHINE_TYPE_NAME = 'ia32'
6800fe7f 1204 gnu_efi_arch = 'ia32'
37efbbd8
ZJS
1205 elif efi_arch == 'x86_64'
1206 EFI_MACHINE_TYPE_NAME = 'x64'
6800fe7f 1207 gnu_efi_arch = 'x86_64'
37efbbd8
ZJS
1208 elif efi_arch == 'arm'
1209 EFI_MACHINE_TYPE_NAME = 'arm'
6800fe7f 1210 gnu_efi_arch = 'arm'
37efbbd8
ZJS
1211 elif efi_arch == 'aarch64'
1212 EFI_MACHINE_TYPE_NAME = 'aa64'
6800fe7f 1213 gnu_efi_arch = 'aarch64'
37efbbd8
ZJS
1214 else
1215 EFI_MACHINE_TYPE_NAME = ''
6800fe7f 1216 gnu_efi_arch = ''
37efbbd8 1217 endif
5c23128d 1218
349cc4a5 1219 have = true
37efbbd8 1220 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
80c6fce8
ZJS
1221
1222 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
349cc4a5
ZJS
1223else
1224 have = false
5c23128d 1225endif
349cc4a5 1226conf.set10('ENABLE_EFI', have)
5c23128d
ZJS
1227
1228#####################################################################
1229
1230config_h = configure_file(
37efbbd8
ZJS
1231 output : 'config.h',
1232 configuration : conf)
5c23128d
ZJS
1233
1234includes = include_directories('src/basic',
1235 'src/shared',
1236 'src/systemd',
1237 'src/journal',
1238 'src/resolve',
1239 'src/timesync',
1240 'src/login',
1241 'src/udev',
1242 'src/libudev',
1243 'src/core',
1244 'src/libsystemd/sd-bus',
1245 'src/libsystemd/sd-device',
1246 'src/libsystemd/sd-hwdb',
1247 'src/libsystemd/sd-id128',
1248 'src/libsystemd/sd-netlink',
1249 'src/libsystemd/sd-network',
1250 'src/libsystemd-network',
2d4ceca8 1251 '.')
5c23128d
ZJS
1252
1253add_project_arguments('-include', 'config.h', language : 'c')
1254
5c23128d
ZJS
1255subdir('po')
1256subdir('catalog')
1257subdir('src/systemd')
1258subdir('src/basic')
1259subdir('src/libsystemd')
1260subdir('src/libsystemd-network')
5c23128d 1261subdir('src/journal')
5c23128d 1262subdir('src/login')
5c23128d
ZJS
1263
1264libjournal_core = static_library(
37efbbd8
ZJS
1265 'journal-core',
1266 libjournal_core_sources,
1267 journald_gperf_c,
1268 include_directories : includes,
1269 install : false)
5c23128d 1270
37ab1a25 1271libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
5c23128d 1272libsystemd = shared_library(
37efbbd8 1273 'systemd',
7f1ea2cc 1274 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
56d50ab1 1275 version : libsystemd_version,
37efbbd8
ZJS
1276 include_directories : includes,
1277 link_args : ['-shared',
1278 '-Wl,--version-script=' + libsystemd_sym_path],
34e221a5
ZJS
1279 link_with : [libbasic,
1280 libbasic_gcrypt],
5e3cec87
ZJS
1281 link_whole : [libsystemd_static,
1282 libjournal_client],
37efbbd8
ZJS
1283 dependencies : [threads,
1284 librt,
1285 libxz,
1286 liblz4],
1287 link_depends : libsystemd_sym,
1288 install : true,
1289 install_dir : rootlibdir)
5c23128d
ZJS
1290
1291############################################################
1292
83b6af36
ZJS
1293# binaries that have --help and are intended for use by humans,
1294# usually, but not always, installed in /bin.
1295public_programs = []
1296
1297subdir('src/libudev')
1298subdir('src/shared')
1299subdir('src/core')
1300subdir('src/udev')
1301subdir('src/network')
1302
1303subdir('src/analyze')
1304subdir('src/journal-remote')
1305subdir('src/coredump')
1306subdir('src/hostname')
1307subdir('src/import')
1308subdir('src/kernel-install')
1309subdir('src/locale')
1310subdir('src/machine')
1311subdir('src/nspawn')
1312subdir('src/resolve')
1313subdir('src/timedate')
1314subdir('src/timesync')
1315subdir('src/vconsole')
83b6af36
ZJS
1316subdir('src/boot/efi')
1317
1318subdir('src/test')
7db7d5b7 1319subdir('src/fuzz')
6b97bf22 1320subdir('rules')
83b6af36
ZJS
1321subdir('test')
1322
1323############################################################
1324
1325# only static linking apart from libdl, to make sure that the
1326# module is linked to all libraries that it uses.
1327test_dlopen = executable(
37efbbd8
ZJS
1328 'test-dlopen',
1329 test_dlopen_c,
1330 include_directories : includes,
1331 link_with : [libbasic],
1332 dependencies : [libdl])
83b6af36 1333
08cf5b8d 1334foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
e7e11bbf 1335 ['systemd', 'ENABLE_NSS_SYSTEMD'],
5486a31d 1336 ['mymachines', 'ENABLE_MACHINED'],
1ec57f33 1337 ['resolve', 'ENABLE_RESOLVE']]
5c23128d 1338
349cc4a5 1339 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
37efbbd8
ZJS
1340 if condition
1341 module = tuple[0]
37efbbd8
ZJS
1342
1343 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1344 version_script_arg = join_paths(meson.current_source_dir(), sym)
1345
1346 nss = shared_library(
1347 'nss_' + module,
1348 'src/nss-@0@/nss-@0@.c'.format(module),
1349 version : '2',
1350 include_directories : includes,
b4b36f44
LP
1351 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1352 link_args : ['-Wl,-z,nodelete',
1353 '-shared',
37efbbd8
ZJS
1354 '-Wl,--version-script=' + version_script_arg,
1355 '-Wl,--undefined'],
37e4d7a8 1356 link_with : [libsystemd_static,
37efbbd8
ZJS
1357 libbasic],
1358 dependencies : [threads,
5486a31d 1359 librt],
37efbbd8
ZJS
1360 link_depends : sym,
1361 install : true,
1362 install_dir : rootlibdir)
1363
1364 # We cannot use shared_module because it does not support version suffix.
1365 # Unfortunately shared_library insists on creating the symlink…
1366 meson.add_install_script('sh', '-c',
1367 'rm $DESTDIR@0@/libnss_@1@.so'
1368 .format(rootlibdir, module))
1369
1370 test('dlopen-nss_' + module,
1371 test_dlopen,
1372 args : [nss.full_path()]) # path to dlopen must include a slash
1373 endif
5c23128d
ZJS
1374endforeach
1375
1376############################################################
1377
5c23128d
ZJS
1378executable('systemd',
1379 systemd_sources,
1380 include_directories : includes,
1381 link_with : [libcore,
34ce0a52 1382 libshared],
5c23128d
ZJS
1383 dependencies : [threads,
1384 librt,
1385 libseccomp,
1386 libselinux,
f4ee10a2
ZJS
1387 libmount,
1388 libblkid],
421f0012 1389 install_rpath : rootlibexecdir,
5c23128d
ZJS
1390 install : true,
1391 install_dir : rootlibexecdir)
1392
005a29f2
ZJS
1393exe = executable('systemd-analyze',
1394 systemd_analyze_sources,
1395 include_directories : includes,
1396 link_with : [libcore,
005a29f2
ZJS
1397 libshared],
1398 dependencies : [threads,
1399 librt,
1400 libseccomp,
1401 libselinux,
1402 libmount,
1403 libblkid],
1404 install_rpath : rootlibexecdir,
1405 install : true)
1406public_programs += [exe]
5c23128d
ZJS
1407
1408executable('systemd-journald',
1409 systemd_journald_sources,
1410 include_directories : includes,
aac26058 1411 link_with : [libjournal_core,
34ce0a52 1412 libshared],
5c23128d
ZJS
1413 dependencies : [threads,
1414 libxz,
aac26058
ZJS
1415 liblz4,
1416 libselinux],
421f0012 1417 install_rpath : rootlibexecdir,
5c23128d
ZJS
1418 install : true,
1419 install_dir : rootlibexecdir)
1420
005a29f2
ZJS
1421exe = executable('systemd-cat',
1422 systemd_cat_sources,
1423 include_directories : includes,
1424 link_with : [libjournal_core,
34ce0a52 1425 libshared],
005a29f2
ZJS
1426 dependencies : [threads],
1427 install_rpath : rootlibexecdir,
1428 install : true)
1429public_programs += [exe]
1430
1431exe = executable('journalctl',
1432 journalctl_sources,
1433 include_directories : includes,
34ce0a52 1434 link_with : [libshared],
005a29f2
ZJS
1435 dependencies : [threads,
1436 libqrencode,
1437 libxz,
1438 liblz4],
1439 install_rpath : rootlibexecdir,
1440 install : true,
1441 install_dir : rootbindir)
1442public_programs += [exe]
5c23128d
ZJS
1443
1444executable('systemd-getty-generator',
1445 'src/getty-generator/getty-generator.c',
5c23128d 1446 include_directories : includes,
b2fc5836
ZJS
1447 link_with : [libshared],
1448 install_rpath : rootlibexecdir,
1449 install : true,
1450 install_dir : systemgeneratordir)
5c23128d
ZJS
1451
1452executable('systemd-debug-generator',
1453 'src/debug-generator/debug-generator.c',
5c23128d 1454 include_directories : includes,
b2fc5836
ZJS
1455 link_with : [libshared],
1456 install_rpath : rootlibexecdir,
1457 install : true,
1458 install_dir : systemgeneratordir)
5c23128d
ZJS
1459
1460executable('systemd-fstab-generator',
1461 'src/fstab-generator/fstab-generator.c',
1462 'src/core/mount-setup.c',
5c23128d 1463 include_directories : includes,
b2fc5836
ZJS
1464 link_with : [libshared],
1465 install_rpath : rootlibexecdir,
1466 install : true,
1467 install_dir : systemgeneratordir)
5c23128d 1468
349cc4a5 1469if conf.get('ENABLE_ENVIRONMENT_D') == 1
37efbbd8
ZJS
1470 executable('30-systemd-environment-d-generator',
1471 'src/environment-d-generator/environment-d-generator.c',
1472 include_directories : includes,
1473 link_with : [libshared],
1474 install_rpath : rootlibexecdir,
1475 install : true,
1476 install_dir : userenvgeneratordir)
7b76fce1 1477
37efbbd8
ZJS
1478 meson.add_install_script(meson_make_symlink,
1479 join_paths(sysconfdir, 'environment'),
1480 join_paths(environmentdir, '99-environment.conf'))
5c23128d
ZJS
1481endif
1482
349cc4a5 1483if conf.get('ENABLE_HIBERNATE') == 1
37efbbd8
ZJS
1484 executable('systemd-hibernate-resume-generator',
1485 'src/hibernate-resume/hibernate-resume-generator.c',
1486 include_directories : includes,
1487 link_with : [libshared],
1488 install_rpath : rootlibexecdir,
1489 install : true,
1490 install_dir : systemgeneratordir)
5c23128d 1491
37efbbd8
ZJS
1492 executable('systemd-hibernate-resume',
1493 'src/hibernate-resume/hibernate-resume.c',
005a29f2
ZJS
1494 include_directories : includes,
1495 link_with : [libshared],
1496 install_rpath : rootlibexecdir,
1497 install : true,
1498 install_dir : rootlibexecdir)
37efbbd8
ZJS
1499endif
1500
349cc4a5 1501if conf.get('HAVE_BLKID') == 1
37efbbd8
ZJS
1502 executable('systemd-gpt-auto-generator',
1503 'src/gpt-auto-generator/gpt-auto-generator.c',
1504 'src/basic/blkid-util.h',
1505 include_directories : includes,
34ce0a52 1506 link_with : [libshared],
37efbbd8
ZJS
1507 dependencies : libblkid,
1508 install_rpath : rootlibexecdir,
1509 install : true,
1510 install_dir : systemgeneratordir)
1511
1512 exe = executable('systemd-dissect',
1513 'src/dissect/dissect.c',
1514 include_directories : includes,
1515 link_with : [libshared],
1516 install_rpath : rootlibexecdir,
1517 install : true,
1518 install_dir : rootlibexecdir)
1519 public_programs += [exe]
5c23128d
ZJS
1520endif
1521
1ec57f33 1522if conf.get('ENABLE_RESOLVE') == 1
37efbbd8
ZJS
1523 executable('systemd-resolved',
1524 systemd_resolved_sources,
005a29f2 1525 include_directories : includes,
34e221a5 1526 link_with : [libshared,
568a4ff8
ZJS
1527 libbasic_gcrypt,
1528 libsystemd_resolve_core],
005a29f2 1529 dependencies : [threads,
76c87410 1530 libgpg_error,
005a29f2
ZJS
1531 libm,
1532 libidn],
1533 install_rpath : rootlibexecdir,
37efbbd8
ZJS
1534 install : true,
1535 install_dir : rootlibexecdir)
1536
1537 exe = executable('systemd-resolve',
1538 systemd_resolve_sources,
1539 include_directories : includes,
34e221a5 1540 link_with : [libshared,
568a4ff8
ZJS
1541 libbasic_gcrypt,
1542 libsystemd_resolve_core],
37efbbd8 1543 dependencies : [threads,
76c87410 1544 libgpg_error,
37efbbd8
ZJS
1545 libm,
1546 libidn],
1547 install_rpath : rootlibexecdir,
1548 install : true)
1549 public_programs += [exe]
5c23128d
ZJS
1550endif
1551
349cc4a5 1552if conf.get('ENABLE_LOGIND') == 1
37efbbd8
ZJS
1553 executable('systemd-logind',
1554 systemd_logind_sources,
005a29f2 1555 include_directories : includes,
37efbbd8 1556 link_with : [liblogind_core,
34ce0a52 1557 libshared],
005a29f2 1558 dependencies : [threads,
37efbbd8 1559 libacl],
005a29f2
ZJS
1560 install_rpath : rootlibexecdir,
1561 install : true,
37efbbd8
ZJS
1562 install_dir : rootlibexecdir)
1563
1564 exe = executable('loginctl',
1565 loginctl_sources,
1566 include_directories : includes,
34ce0a52 1567 link_with : [libshared],
37efbbd8
ZJS
1568 dependencies : [threads,
1569 liblz4,
1570 libxz],
1571 install_rpath : rootlibexecdir,
1572 install : true,
1573 install_dir : rootbindir)
1574 public_programs += [exe]
1575
1576 exe = executable('systemd-inhibit',
1577 'src/login/inhibit.c',
1578 include_directories : includes,
1579 link_with : [libshared],
1580 install_rpath : rootlibexecdir,
1581 install : true,
1582 install_dir : rootbindir)
1583 public_programs += [exe]
1584
349cc4a5 1585 if conf.get('HAVE_PAM') == 1
37efbbd8
ZJS
1586 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1587 pam_systemd = shared_library(
1588 'pam_systemd',
1589 pam_systemd_c,
1590 name_prefix : '',
1591 include_directories : includes,
1592 link_args : ['-shared',
1593 '-Wl,--version-script=' + version_script_arg],
37e4d7a8 1594 link_with : [libsystemd_static,
37efbbd8
ZJS
1595 libshared_static],
1596 dependencies : [threads,
1597 libpam,
1598 libpam_misc],
1599 link_depends : pam_systemd_sym,
1600 install : true,
1601 install_dir : pamlibdir)
1602
1603 test('dlopen-pam_systemd',
1604 test_dlopen,
1605 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1606 endif
1607endif
005a29f2 1608
349cc4a5 1609if conf.get('HAVE_PAM') == 1
37efbbd8
ZJS
1610 executable('systemd-user-sessions',
1611 'src/user-sessions/user-sessions.c',
005a29f2 1612 include_directories : includes,
aac26058 1613 link_with : [libshared],
005a29f2
ZJS
1614 install_rpath : rootlibexecdir,
1615 install : true,
37efbbd8 1616 install_dir : rootlibexecdir)
5c23128d
ZJS
1617endif
1618
349cc4a5 1619if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
37efbbd8
ZJS
1620 exe = executable('bootctl',
1621 'src/boot/bootctl.c',
1622 include_directories : includes,
1623 link_with : [libshared],
1624 dependencies : [libblkid],
1625 install_rpath : rootlibexecdir,
1626 install : true)
1627 public_programs += [exe]
005a29f2
ZJS
1628endif
1629
1630exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1631 include_directories : includes,
1632 link_with : [libshared],
1633 dependencies : [threads],
1634 install_rpath : rootlibexecdir,
1635 install : true)
1636public_programs += [exe]
1637
1638exe = executable('systemctl', 'src/systemctl/systemctl.c',
1639 include_directories : includes,
aac26058 1640 link_with : [libshared],
005a29f2
ZJS
1641 dependencies : [threads,
1642 libcap,
1643 libselinux,
1644 libxz,
1645 liblz4],
1646 install_rpath : rootlibexecdir,
1647 install : true,
1648 install_dir : rootbindir)
1649public_programs += [exe]
5c23128d 1650
349cc4a5 1651if conf.get('ENABLE_BACKLIGHT') == 1
37efbbd8
ZJS
1652 executable('systemd-backlight',
1653 'src/backlight/backlight.c',
1654 include_directories : includes,
34ce0a52 1655 link_with : [libshared],
37efbbd8
ZJS
1656 install_rpath : rootlibexecdir,
1657 install : true,
1658 install_dir : rootlibexecdir)
5c23128d
ZJS
1659endif
1660
349cc4a5 1661if conf.get('ENABLE_RFKILL') == 1
37efbbd8
ZJS
1662 executable('systemd-rfkill',
1663 'src/rfkill/rfkill.c',
1664 include_directories : includes,
34ce0a52 1665 link_with : [libshared],
37efbbd8
ZJS
1666 install_rpath : rootlibexecdir,
1667 install : true,
1668 install_dir : rootlibexecdir)
5c23128d
ZJS
1669endif
1670
1671executable('systemd-system-update-generator',
1672 'src/system-update-generator/system-update-generator.c',
1673 include_directories : includes,
1674 link_with : [libshared],
b2fc5836 1675 install_rpath : rootlibexecdir,
5c23128d
ZJS
1676 install : true,
1677 install_dir : systemgeneratordir)
1678
349cc4a5 1679if conf.get('HAVE_LIBCRYPTSETUP') == 1
37efbbd8
ZJS
1680 executable('systemd-cryptsetup',
1681 'src/cryptsetup/cryptsetup.c',
1682 include_directories : includes,
1683 link_with : [libshared],
1684 dependencies : [libcryptsetup],
1685 install_rpath : rootlibexecdir,
1686 install : true,
1687 install_dir : rootlibexecdir)
1688
1689 executable('systemd-cryptsetup-generator',
1690 'src/cryptsetup/cryptsetup-generator.c',
1691 include_directories : includes,
1692 link_with : [libshared],
1693 dependencies : [libcryptsetup],
1694 install_rpath : rootlibexecdir,
1695 install : true,
1696 install_dir : systemgeneratordir)
1697
1698 executable('systemd-veritysetup',
1699 'src/veritysetup/veritysetup.c',
1700 include_directories : includes,
1701 link_with : [libshared],
1702 dependencies : [libcryptsetup],
1703 install_rpath : rootlibexecdir,
1704 install : true,
1705 install_dir : rootlibexecdir)
1706
1707 executable('systemd-veritysetup-generator',
1708 'src/veritysetup/veritysetup-generator.c',
1709 include_directories : includes,
1710 link_with : [libshared],
1711 dependencies : [libcryptsetup],
1712 install_rpath : rootlibexecdir,
1713 install : true,
1714 install_dir : systemgeneratordir)
5c23128d
ZJS
1715endif
1716
349cc4a5 1717if conf.get('HAVE_SYSV_COMPAT') == 1
37efbbd8
ZJS
1718 executable('systemd-sysv-generator',
1719 'src/sysv-generator/sysv-generator.c',
1720 include_directories : includes,
1721 link_with : [libshared],
1722 install_rpath : rootlibexecdir,
1723 install : true,
1724 install_dir : systemgeneratordir)
1725
1726 executable('systemd-rc-local-generator',
1727 'src/rc-local-generator/rc-local-generator.c',
1728 include_directories : includes,
1729 link_with : [libshared],
1730 install_rpath : rootlibexecdir,
1731 install : true,
1732 install_dir : systemgeneratordir)
5c23128d
ZJS
1733endif
1734
349cc4a5 1735if conf.get('ENABLE_HOSTNAMED') == 1
37efbbd8
ZJS
1736 executable('systemd-hostnamed',
1737 'src/hostname/hostnamed.c',
005a29f2 1738 include_directories : includes,
aac26058 1739 link_with : [libshared],
005a29f2 1740 install_rpath : rootlibexecdir,
37efbbd8
ZJS
1741 install : true,
1742 install_dir : rootlibexecdir)
1743
1744 exe = executable('hostnamectl',
1745 'src/hostname/hostnamectl.c',
1746 include_directories : includes,
1747 link_with : [libshared],
1748 install_rpath : rootlibexecdir,
1749 install : true)
1750 public_programs += [exe]
5c23128d
ZJS
1751endif
1752
349cc4a5
ZJS
1753if conf.get('ENABLE_LOCALED') == 1
1754 if conf.get('HAVE_XKBCOMMON') == 1
37efbbd8
ZJS
1755 # logind will load libxkbcommon.so dynamically on its own
1756 deps = [libdl]
1757 else
1758 deps = []
1759 endif
1760
1761 executable('systemd-localed',
1762 systemd_localed_sources,
005a29f2 1763 include_directories : includes,
aac26058 1764 link_with : [libshared],
37efbbd8 1765 dependencies : deps,
005a29f2 1766 install_rpath : rootlibexecdir,
37efbbd8
ZJS
1767 install : true,
1768 install_dir : rootlibexecdir)
1769
1770 exe = executable('localectl',
1771 localectl_sources,
1772 include_directories : includes,
1773 link_with : [libshared],
1774 install_rpath : rootlibexecdir,
1775 install : true)
1776 public_programs += [exe]
5c23128d
ZJS
1777endif
1778
349cc4a5 1779if conf.get('ENABLE_TIMEDATED') == 1
37efbbd8
ZJS
1780 executable('systemd-timedated',
1781 'src/timedate/timedated.c',
005a29f2 1782 include_directories : includes,
aac26058 1783 link_with : [libshared],
37efbbd8
ZJS
1784 install_rpath : rootlibexecdir,
1785 install : true,
1786 install_dir : rootlibexecdir)
5c23128d 1787
37efbbd8
ZJS
1788 exe = executable('timedatectl',
1789 'src/timedate/timedatectl.c',
1790 include_directories : includes,
1791 install_rpath : rootlibexecdir,
1792 link_with : [libshared],
1793 install : true)
1794 public_programs += [exe]
5c23128d
ZJS
1795endif
1796
349cc4a5 1797if conf.get('ENABLE_TIMESYNCD') == 1
37efbbd8
ZJS
1798 executable('systemd-timesyncd',
1799 systemd_timesyncd_sources,
005a29f2 1800 include_directories : includes,
aac26058 1801 link_with : [libshared],
005a29f2 1802 dependencies : [threads,
37efbbd8 1803 libm],
005a29f2
ZJS
1804 install_rpath : rootlibexecdir,
1805 install : true,
37efbbd8 1806 install_dir : rootlibexecdir)
5c23128d
ZJS
1807endif
1808
349cc4a5 1809if conf.get('ENABLE_MACHINED') == 1
37efbbd8
ZJS
1810 executable('systemd-machined',
1811 systemd_machined_sources,
1812 include_directories : includes,
1813 link_with : [libmachine_core,
1814 libshared],
1815 install_rpath : rootlibexecdir,
1816 install : true,
1817 install_dir : rootlibexecdir)
1818
1819 exe = executable('machinectl',
1820 'src/machine/machinectl.c',
1821 include_directories : includes,
1822 link_with : [libshared],
1823 dependencies : [threads,
1824 libxz,
1825 liblz4],
1826 install_rpath : rootlibexecdir,
1827 install : true,
1828 install_dir : rootbindir)
1829 public_programs += [exe]
5c23128d
ZJS
1830endif
1831
349cc4a5 1832if conf.get('ENABLE_IMPORTD') == 1
37efbbd8
ZJS
1833 executable('systemd-importd',
1834 systemd_importd_sources,
005a29f2 1835 include_directories : includes,
aac26058 1836 link_with : [libshared],
37efbbd8 1837 dependencies : [threads],
005a29f2
ZJS
1838 install_rpath : rootlibexecdir,
1839 install : true,
1840 install_dir : rootlibexecdir)
37efbbd8
ZJS
1841
1842 systemd_pull = executable('systemd-pull',
1843 systemd_pull_sources,
1844 include_directories : includes,
1845 link_with : [libshared],
1846 dependencies : [libcurl,
1847 libz,
1848 libbzip2,
1849 libxz,
1850 libgcrypt],
1851 install_rpath : rootlibexecdir,
1852 install : true,
1853 install_dir : rootlibexecdir)
1854
1855 systemd_import = executable('systemd-import',
1856 systemd_import_sources,
1857 include_directories : includes,
1858 link_with : [libshared],
1859 dependencies : [libcurl,
1860 libz,
1861 libbzip2,
1862 libxz],
1863 install_rpath : rootlibexecdir,
1864 install : true,
1865 install_dir : rootlibexecdir)
1866
1867 systemd_export = executable('systemd-export',
1868 systemd_export_sources,
1869 include_directories : includes,
1870 link_with : [libshared],
1871 dependencies : [libcurl,
1872 libz,
1873 libbzip2,
1874 libxz],
1875 install_rpath : rootlibexecdir,
1876 install : true,
1877 install_dir : rootlibexecdir)
1878 public_programs += [systemd_pull, systemd_import, systemd_export]
1879endif
1880
349cc4a5 1881if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
37efbbd8
ZJS
1882 exe = executable('systemd-journal-upload',
1883 systemd_journal_upload_sources,
1884 include_directories : includes,
1885 link_with : [libshared],
1886 dependencies : [threads,
1887 libcurl,
1888 libgnutls,
1889 libxz,
1890 liblz4],
1891 install_rpath : rootlibexecdir,
1892 install : true,
1893 install_dir : rootlibexecdir)
1894 public_programs += [exe]
5c23128d
ZJS
1895endif
1896
349cc4a5 1897if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
37efbbd8
ZJS
1898 s_j_remote = executable('systemd-journal-remote',
1899 systemd_journal_remote_sources,
1900 include_directories : includes,
1901 link_with : [libshared],
1902 dependencies : [threads,
1903 libmicrohttpd,
1904 libgnutls,
1905 libxz,
1906 liblz4],
1907 install_rpath : rootlibexecdir,
1908 install : true,
1909 install_dir : rootlibexecdir)
1910
1911 s_j_gatewayd = executable('systemd-journal-gatewayd',
1912 systemd_journal_gatewayd_sources,
1913 include_directories : includes,
1914 link_with : [libshared],
1915 dependencies : [threads,
1916 libmicrohttpd,
1917 libgnutls,
1918 libxz,
1919 liblz4],
1920 install_rpath : rootlibexecdir,
1921 install : true,
1922 install_dir : rootlibexecdir)
1923 public_programs += [s_j_remote, s_j_gatewayd]
5c23128d
ZJS
1924endif
1925
349cc4a5 1926if conf.get('ENABLE_COREDUMP') == 1
37efbbd8
ZJS
1927 executable('systemd-coredump',
1928 systemd_coredump_sources,
005a29f2 1929 include_directories : includes,
aac26058 1930 link_with : [libshared],
005a29f2 1931 dependencies : [threads,
37efbbd8
ZJS
1932 libacl,
1933 libdw,
005a29f2
ZJS
1934 libxz,
1935 liblz4],
1936 install_rpath : rootlibexecdir,
37efbbd8
ZJS
1937 install : true,
1938 install_dir : rootlibexecdir)
1939
1940 exe = executable('coredumpctl',
1941 coredumpctl_sources,
1942 include_directories : includes,
1943 link_with : [libshared],
1944 dependencies : [threads,
1945 libxz,
1946 liblz4],
1947 install_rpath : rootlibexecdir,
1948 install : true)
1949 public_programs += [exe]
5c23128d
ZJS
1950endif
1951
349cc4a5 1952if conf.get('ENABLE_BINFMT') == 1
37efbbd8
ZJS
1953 exe = executable('systemd-binfmt',
1954 'src/binfmt/binfmt.c',
1955 include_directories : includes,
1956 link_with : [libshared],
1957 install_rpath : rootlibexecdir,
1958 install : true,
1959 install_dir : rootlibexecdir)
1960 public_programs += [exe]
1961
1962 meson.add_install_script('sh', '-c',
1963 mkdir_p.format(binfmtdir))
1964 meson.add_install_script('sh', '-c',
1965 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1966endif
1967
349cc4a5 1968if conf.get('ENABLE_VCONSOLE') == 1
37efbbd8
ZJS
1969 executable('systemd-vconsole-setup',
1970 'src/vconsole/vconsole-setup.c',
005a29f2
ZJS
1971 include_directories : includes,
1972 link_with : [libshared],
1973 install_rpath : rootlibexecdir,
1974 install : true,
1975 install_dir : rootlibexecdir)
5c23128d
ZJS
1976endif
1977
349cc4a5 1978if conf.get('ENABLE_RANDOMSEED') == 1
37efbbd8
ZJS
1979 executable('systemd-random-seed',
1980 'src/random-seed/random-seed.c',
1981 include_directories : includes,
1982 link_with : [libshared],
1983 install_rpath : rootlibexecdir,
1984 install : true,
1985 install_dir : rootlibexecdir)
5c23128d
ZJS
1986endif
1987
349cc4a5 1988if conf.get('ENABLE_FIRSTBOOT') == 1
37efbbd8
ZJS
1989 executable('systemd-firstboot',
1990 'src/firstboot/firstboot.c',
1991 include_directories : includes,
1992 link_with : [libshared],
1993 dependencies : [libcrypt],
1994 install_rpath : rootlibexecdir,
1995 install : true,
1996 install_dir : rootbindir)
5c23128d
ZJS
1997endif
1998
1999executable('systemd-remount-fs',
2000 'src/remount-fs/remount-fs.c',
2001 'src/core/mount-setup.c',
2002 'src/core/mount-setup.h',
2003 include_directories : includes,
2004 link_with : [libshared],
b2fc5836 2005 install_rpath : rootlibexecdir,
5c23128d
ZJS
2006 install : true,
2007 install_dir : rootlibexecdir)
2008
2009executable('systemd-machine-id-setup',
2010 'src/machine-id-setup/machine-id-setup-main.c',
2011 'src/core/machine-id-setup.c',
2012 'src/core/machine-id-setup.h',
2013 include_directories : includes,
aac26058 2014 link_with : [libshared],
b2fc5836 2015 install_rpath : rootlibexecdir,
5c23128d
ZJS
2016 install : true,
2017 install_dir : rootbindir)
2018
2019executable('systemd-fsck',
2020 'src/fsck/fsck.c',
2021 include_directories : includes,
aac26058 2022 link_with : [libshared],
421f0012 2023 install_rpath : rootlibexecdir,
5c23128d
ZJS
2024 install : true,
2025 install_dir : rootlibexecdir)
2026
80750adb
ZJS
2027executable('systemd-growfs',
2028 'src/partition/growfs.c',
2029 include_directories : includes,
2030 link_with : [libshared],
c34b75a1 2031 dependencies : [libcryptsetup],
80750adb
ZJS
2032 install_rpath : rootlibexecdir,
2033 install : true,
2034 install_dir : rootlibexecdir)
2035
b7f28ac5
ZJS
2036executable('systemd-makefs',
2037 'src/partition/makefs.c',
2038 include_directories : includes,
2039 link_with : [libshared],
2040 install_rpath : rootlibexecdir,
2041 install : true,
2042 install_dir : rootlibexecdir)
2043
5c23128d
ZJS
2044executable('systemd-sleep',
2045 'src/sleep/sleep.c',
2046 include_directories : includes,
2047 link_with : [libshared],
421f0012 2048 install_rpath : rootlibexecdir,
5c23128d
ZJS
2049 install : true,
2050 install_dir : rootlibexecdir)
2051
005a29f2
ZJS
2052exe = executable('systemd-sysctl',
2053 'src/sysctl/sysctl.c',
2054 include_directories : includes,
2055 link_with : [libshared],
2056 install_rpath : rootlibexecdir,
2057 install : true,
2058 install_dir : rootlibexecdir)
2059public_programs += [exe]
5c23128d
ZJS
2060
2061executable('systemd-ac-power',
2062 'src/ac-power/ac-power.c',
2063 include_directories : includes,
2064 link_with : [libshared],
421f0012 2065 install_rpath : rootlibexecdir,
5c23128d
ZJS
2066 install : true,
2067 install_dir : rootlibexecdir)
2068
005a29f2
ZJS
2069exe = executable('systemd-detect-virt',
2070 'src/detect-virt/detect-virt.c',
2071 include_directories : includes,
2072 link_with : [libshared],
2073 install_rpath : rootlibexecdir,
2074 install : true)
2075public_programs += [exe]
2076
2077exe = executable('systemd-delta',
2078 'src/delta/delta.c',
2079 include_directories : includes,
2080 link_with : [libshared],
2081 install_rpath : rootlibexecdir,
2082 install : true)
2083public_programs += [exe]
2084
2085exe = executable('systemd-escape',
2086 'src/escape/escape.c',
2087 include_directories : includes,
2088 link_with : [libshared],
2089 install_rpath : rootlibexecdir,
2090 install : true,
2091 install_dir : rootbindir)
2092public_programs += [exe]
2093
2094exe = executable('systemd-notify',
2095 'src/notify/notify.c',
2096 include_directories : includes,
2097 link_with : [libshared],
2098 install_rpath : rootlibexecdir,
2099 install : true,
2100 install_dir : rootbindir)
2101public_programs += [exe]
5c23128d
ZJS
2102
2103executable('systemd-volatile-root',
2104 'src/volatile-root/volatile-root.c',
2105 include_directories : includes,
2106 link_with : [libshared],
421f0012 2107 install_rpath : rootlibexecdir,
5c23128d
ZJS
2108 install : true,
2109 install_dir : rootlibexecdir)
2110
2111executable('systemd-cgroups-agent',
2112 'src/cgroups-agent/cgroups-agent.c',
2113 include_directories : includes,
2114 link_with : [libshared],
421f0012 2115 install_rpath : rootlibexecdir,
5c23128d
ZJS
2116 install : true,
2117 install_dir : rootlibexecdir)
2118
005a29f2
ZJS
2119exe = executable('systemd-path',
2120 'src/path/path.c',
2121 include_directories : includes,
aac26058 2122 link_with : [libshared],
005a29f2
ZJS
2123 install_rpath : rootlibexecdir,
2124 install : true)
2125public_programs += [exe]
2126
2127exe = executable('systemd-ask-password',
2128 'src/ask-password/ask-password.c',
2129 include_directories : includes,
aac26058 2130 link_with : [libshared],
005a29f2
ZJS
2131 install_rpath : rootlibexecdir,
2132 install : true,
2133 install_dir : rootbindir)
2134public_programs += [exe]
5c23128d
ZJS
2135
2136executable('systemd-reply-password',
2137 'src/reply-password/reply-password.c',
2138 include_directories : includes,
aac26058 2139 link_with : [libshared],
421f0012 2140 install_rpath : rootlibexecdir,
5c23128d
ZJS
2141 install : true,
2142 install_dir : rootlibexecdir)
2143
005a29f2
ZJS
2144exe = executable('systemd-tty-ask-password-agent',
2145 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2146 include_directories : includes,
aac26058 2147 link_with : [libshared],
005a29f2
ZJS
2148 install_rpath : rootlibexecdir,
2149 install : true,
2150 install_dir : rootbindir)
2151public_programs += [exe]
2152
2153exe = executable('systemd-cgls',
2154 'src/cgls/cgls.c',
2155 include_directories : includes,
aac26058 2156 link_with : [libshared],
005a29f2
ZJS
2157 install_rpath : rootlibexecdir,
2158 install : true)
2159public_programs += [exe]
2160
2161exe = executable('systemd-cgtop',
2162 'src/cgtop/cgtop.c',
2163 include_directories : includes,
aac26058 2164 link_with : [libshared],
005a29f2
ZJS
2165 install_rpath : rootlibexecdir,
2166 install : true)
2167public_programs += [exe]
5c23128d
ZJS
2168
2169executable('systemd-initctl',
2170 'src/initctl/initctl.c',
2171 include_directories : includes,
aac26058 2172 link_with : [libshared],
421f0012 2173 install_rpath : rootlibexecdir,
5c23128d
ZJS
2174 install : true,
2175 install_dir : rootlibexecdir)
2176
005a29f2
ZJS
2177exe = executable('systemd-mount',
2178 'src/mount/mount-tool.c',
2179 include_directories : includes,
34ce0a52 2180 link_with : [libshared],
005a29f2
ZJS
2181 install_rpath : rootlibexecdir,
2182 install : true)
2183public_programs += [exe]
5c23128d 2184
7b76fce1 2185meson.add_install_script(meson_make_symlink,
e17e5ba9 2186 'systemd-mount', join_paths(bindir, 'systemd-umount'))
7b76fce1 2187
005a29f2
ZJS
2188exe = executable('systemd-run',
2189 'src/run/run.c',
2190 include_directories : includes,
aac26058 2191 link_with : [libshared],
005a29f2
ZJS
2192 install_rpath : rootlibexecdir,
2193 install : true)
2194public_programs += [exe]
2195
2196exe = executable('systemd-stdio-bridge',
2197 'src/stdio-bridge/stdio-bridge.c',
2198 include_directories : includes,
aac26058 2199 link_with : [libshared],
005a29f2
ZJS
2200 install_rpath : rootlibexecdir,
2201 install : true)
2202public_programs += [exe]
2203
2204exe = executable('busctl',
2205 'src/busctl/busctl.c',
2206 'src/busctl/busctl-introspect.c',
2207 'src/busctl/busctl-introspect.h',
2208 include_directories : includes,
aac26058 2209 link_with : [libshared],
005a29f2
ZJS
2210 install_rpath : rootlibexecdir,
2211 install : true)
2212public_programs += [exe]
5c23128d 2213
349cc4a5 2214if conf.get('ENABLE_SYSUSERS') == 1
37efbbd8
ZJS
2215 exe = executable('systemd-sysusers',
2216 'src/sysusers/sysusers.c',
2217 include_directories : includes,
2218 link_with : [libshared],
2219 install_rpath : rootlibexecdir,
2220 install : true,
2221 install_dir : rootbindir)
2222 public_programs += [exe]
5c23128d
ZJS
2223endif
2224
349cc4a5 2225if conf.get('ENABLE_TMPFILES') == 1
37efbbd8
ZJS
2226 exe = executable('systemd-tmpfiles',
2227 'src/tmpfiles/tmpfiles.c',
2228 include_directories : includes,
2229 link_with : [libshared],
2230 dependencies : [libacl],
2231 install_rpath : rootlibexecdir,
2232 install : true,
2233 install_dir : rootbindir)
2234 public_programs += [exe]
d9daae55
ZJS
2235
2236 test('test-systemd-tmpfiles',
2237 test_systemd_tmpfiles_py,
2238 args : exe.full_path())
2239 # https://github.com/mesonbuild/meson/issues/2681
5c23128d
ZJS
2240endif
2241
349cc4a5 2242if conf.get('ENABLE_HWDB') == 1
37efbbd8
ZJS
2243 exe = executable('systemd-hwdb',
2244 'src/hwdb/hwdb.c',
2245 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2246 include_directories : includes,
0c06b506 2247 link_with : [libudev_static],
0da6f396 2248 install_rpath : udev_rpath,
37efbbd8
ZJS
2249 install : true,
2250 install_dir : rootbindir)
2251 public_programs += [exe]
2252endif
2253
349cc4a5 2254if conf.get('ENABLE_QUOTACHECK') == 1
37efbbd8
ZJS
2255 executable('systemd-quotacheck',
2256 'src/quotacheck/quotacheck.c',
005a29f2 2257 include_directories : includes,
aac26058 2258 link_with : [libshared],
005a29f2
ZJS
2259 install_rpath : rootlibexecdir,
2260 install : true,
37efbbd8 2261 install_dir : rootlibexecdir)
5c23128d
ZJS
2262endif
2263
005a29f2
ZJS
2264exe = executable('systemd-socket-proxyd',
2265 'src/socket-proxy/socket-proxyd.c',
2266 include_directories : includes,
aac26058 2267 link_with : [libshared],
005a29f2
ZJS
2268 dependencies : [threads],
2269 install_rpath : rootlibexecdir,
2270 install : true,
2271 install_dir : rootlibexecdir)
2272public_programs += [exe]
2273
2274exe = executable('systemd-udevd',
2275 systemd_udevd_sources,
2276 include_directories : includes,
5c72049f 2277 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
005a29f2 2278 link_with : [libudev_core,
005a29f2 2279 libsystemd_network,
0c06b506 2280 libudev_static],
3a30f21f
ZJS
2281 dependencies : [threads,
2282 libkmod,
005a29f2 2283 libidn,
aac26058
ZJS
2284 libacl,
2285 libblkid],
1aec3ed9 2286 install_rpath : udev_rpath,
005a29f2
ZJS
2287 install : true,
2288 install_dir : rootlibexecdir)
2289public_programs += [exe]
2290
2291exe = executable('udevadm',
2292 udevadm_sources,
6671e818 2293 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
005a29f2
ZJS
2294 include_directories : includes,
2295 link_with : [libudev_core,
005a29f2 2296 libsystemd_network,
0c06b506 2297 libudev_static],
3a30f21f
ZJS
2298 dependencies : [threads,
2299 libkmod,
005a29f2 2300 libidn,
aac26058
ZJS
2301 libacl,
2302 libblkid],
1aec3ed9 2303 install_rpath : udev_rpath,
005a29f2
ZJS
2304 install : true,
2305 install_dir : rootbindir)
2306public_programs += [exe]
5c23128d
ZJS
2307
2308executable('systemd-shutdown',
2309 systemd_shutdown_sources,
2310 include_directories : includes,
34ce0a52 2311 link_with : [libshared],
421f0012 2312 install_rpath : rootlibexecdir,
5c23128d
ZJS
2313 install : true,
2314 install_dir : rootlibexecdir)
2315
2316executable('systemd-update-done',
2317 'src/update-done/update-done.c',
2318 include_directories : includes,
2319 link_with : [libshared],
421f0012 2320 install_rpath : rootlibexecdir,
5c23128d
ZJS
2321 install : true,
2322 install_dir : rootlibexecdir)
2323
2324executable('systemd-update-utmp',
2325 'src/update-utmp/update-utmp.c',
2326 include_directories : includes,
aac26058 2327 link_with : [libshared],
5c23128d 2328 dependencies : [libaudit],
421f0012 2329 install_rpath : rootlibexecdir,
5c23128d
ZJS
2330 install : true,
2331 install_dir : rootlibexecdir)
2332
349cc4a5 2333if conf.get('HAVE_KMOD') == 1
37efbbd8
ZJS
2334 executable('systemd-modules-load',
2335 'src/modules-load/modules-load.c',
2336 include_directories : includes,
2337 link_with : [libshared],
2338 dependencies : [libkmod],
2339 install_rpath : rootlibexecdir,
2340 install : true,
2341 install_dir : rootlibexecdir)
94e75a54 2342
37efbbd8
ZJS
2343 meson.add_install_script('sh', '-c',
2344 mkdir_p.format(modulesloaddir))
2345 meson.add_install_script('sh', '-c',
2346 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
5c23128d
ZJS
2347endif
2348
005a29f2
ZJS
2349exe = executable('systemd-nspawn',
2350 systemd_nspawn_sources,
2351 'src/core/mount-setup.c', # FIXME: use a variable?
2352 'src/core/mount-setup.h',
2353 'src/core/loopback-setup.c',
2354 'src/core/loopback-setup.h',
2355 include_directories : [includes, include_directories('src/nspawn')],
0bc91152 2356 link_with : [libshared],
005a29f2
ZJS
2357 dependencies : [libacl,
2358 libblkid,
2359 libseccomp,
2360 libselinux],
2361 install_rpath : rootlibexecdir,
2362 install : true)
2363public_programs += [exe]
5c23128d 2364
349cc4a5 2365if conf.get('ENABLE_NETWORKD') == 1
37efbbd8
ZJS
2366 executable('systemd-networkd',
2367 systemd_networkd_sources,
2368 include_directories : includes,
2369 link_with : [libnetworkd_core,
37efbbd8 2370 libsystemd_network,
0c06b506 2371 libudev_static,
37efbbd8 2372 libshared],
4b57a272 2373 dependencies : [threads],
37efbbd8
ZJS
2374 install_rpath : rootlibexecdir,
2375 install : true,
2376 install_dir : rootlibexecdir)
2377
2378 executable('systemd-networkd-wait-online',
2379 systemd_networkd_wait_online_sources,
2380 include_directories : includes,
2381 link_with : [libnetworkd_core,
2382 libshared],
2383 install_rpath : rootlibexecdir,
2384 install : true,
2385 install_dir : rootlibexecdir)
5c23128d 2386
dcfe072a
FS
2387 exe = executable('networkctl',
2388 networkctl_sources,
2389 include_directories : includes,
2390 link_with : [libsystemd_network,
aac26058 2391 libshared],
dcfe072a
FS
2392 install_rpath : rootlibexecdir,
2393 install : true,
2394 install_dir : rootbindir)
2395 public_programs += [exe]
2396endif
e821f6a9
ZJS
2397
2398executable('systemd-sulogin-shell',
2399 ['src/sulogin-shell/sulogin-shell.c'],
2400 include_directories : includes,
2401 link_with : [libshared],
2402 install_rpath : rootlibexecdir,
2403 install : true,
2404 install_dir : rootlibexecdir)
2405
69e96427
ZJS
2406############################################################
2407
2408foreach tuple : tests
37efbbd8
ZJS
2409 sources = tuple[0]
2410 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2411 dependencies = tuple[2]
2412 condition = tuple.length() >= 4 ? tuple[3] : ''
2413 type = tuple.length() >= 5 ? tuple[4] : ''
2414 defs = tuple.length() >= 6 ? tuple[5] : []
2415 incs = tuple.length() >= 7 ? tuple[6] : includes
2416 timeout = 30
2417
2418 name = sources[0].split('/')[-1].split('.')[0]
2419 if type.startswith('timeout=')
2420 timeout = type.split('=')[1].to_int()
2421 type = ''
2422 endif
08318a2c
AD
2423 if want_tests == 'false'
2424 message('Not compiling @0@ because tests is set to false'.format(name))
2425 elif condition == '' or conf.get(condition) == 1
37efbbd8
ZJS
2426 exe = executable(
2427 name,
2428 sources,
2429 include_directories : incs,
2430 link_with : link_with,
2431 dependencies : dependencies,
2432 c_args : defs,
2433 install_rpath : rootlibexecdir,
7cdd9783
MB
2434 install : install_tests,
2435 install_dir : join_paths(testsdir, type))
37efbbd8
ZJS
2436
2437 if type == 'manual'
2438 message('@0@ is a manual test'.format(name))
2439 elif type == 'unsafe' and want_tests != 'unsafe'
2440 message('@0@ is an unsafe test'.format(name))
2441 else
2442 test(name, exe,
2443 env : test_env,
2444 timeout : timeout)
2445 endif
2446 else
2447 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2448 endif
69e96427
ZJS
2449endforeach
2450
37ab1a25 2451test_libsystemd_sym = executable(
37efbbd8
ZJS
2452 'test-libsystemd-sym',
2453 test_libsystemd_sym_c,
2454 include_directories : includes,
2455 link_with : [libsystemd],
2456 install : install_tests,
2457 install_dir : testsdir)
37ab1a25
ZJS
2458test('test-libsystemd-sym',
2459 test_libsystemd_sym)
2460
e0bec52f 2461test_libudev_sym = executable(
37efbbd8
ZJS
2462 'test-libudev-sym',
2463 test_libudev_sym_c,
2464 include_directories : includes,
2465 c_args : ['-Wno-deprecated-declarations'],
2466 link_with : [libudev],
2467 install : install_tests,
2468 install_dir : testsdir)
e0bec52f
ZJS
2469test('test-libudev-sym',
2470 test_libudev_sym)
2471
69e96427 2472############################################################
5c23128d 2473
7db7d5b7
JR
2474fuzzer_exes = []
2475
2476foreach tuple : fuzzers
2477 sources = tuple[0]
2478 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2479 dependencies = tuple[2]
2480 defs = tuple.length() >= 4 ? tuple[3] : []
2481 incs = tuple.length() >= 5 ? tuple[4] : includes
2482
2483 if ossfuzz
2484 dependencies += fuzzing_engine
2485 else
2486 sources += 'src/fuzz/fuzz-main.c'
2487 endif
2488
2489 name = sources[0].split('/')[-1].split('.')[0]
2490
2491 fuzzer_exes += executable(
2492 name,
2493 sources,
2494 include_directories : [incs, include_directories('src/fuzz')],
2495 link_with : link_with,
2496 dependencies : dependencies,
2497 c_args : defs,
2498 install : false)
2499endforeach
2500
2501run_target('fuzzers',
2502 depends : fuzzer_exes,
2503 command : ['true'])
2504
2505############################################################
2506
5c23128d
ZJS
2507make_directive_index_py = find_program('tools/make-directive-index.py')
2508make_man_index_py = find_program('tools/make-man-index.py')
b184e8fe 2509xml_helper_py = find_program('tools/xml_helper.py')
abba22c5 2510hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
5c23128d
ZJS
2511
2512subdir('units')
2513subdir('sysctl.d')
2514subdir('sysusers.d')
2515subdir('tmpfiles.d')
e783f957 2516subdir('presets')
5c23128d
ZJS
2517subdir('hwdb')
2518subdir('network')
2519subdir('man')
2520subdir('shell-completion/bash')
2521subdir('shell-completion/zsh')
2522subdir('docs/sysvinit')
2523subdir('docs/var-log')
2524
2525# FIXME: figure out if the warning is true:
2526# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2527install_subdir('factory/etc',
2528 install_dir : factorydir)
2529
2530
2531install_data('xorg/50-systemd-user.sh',
2532 install_dir : xinitrcdir)
582faeb4
DJL
2533install_data('modprobe.d/systemd.conf',
2534 install_dir : modprobedir)
5c23128d
ZJS
2535install_data('README',
2536 'NEWS',
2537 'CODING_STYLE',
2538 'DISTRO_PORTING',
2539 'ENVIRONMENT.md',
2540 'LICENSE.GPL2',
2541 'LICENSE.LGPL2.1',
f9f54413
FS
2542 'TRANSIENT-SETTINGS.md',
2543 'UIDS-GIDS.md',
5c23128d
ZJS
2544 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2545 install_dir : docdir)
d68b342b 2546
94e75a54
ZJS
2547meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2548meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2549
d68b342b
ZJS
2550############################################################
2551
005a29f2
ZJS
2552meson_check_help = find_program('tools/meson-check-help.sh')
2553
2554foreach exec : public_programs
37efbbd8
ZJS
2555 name = exec.full_path().split('/')[-1]
2556 test('check-help-' + name,
2557 meson_check_help,
2558 args : [exec.full_path()])
005a29f2
ZJS
2559endforeach
2560
2561############################################################
2562
0700e8ba 2563if git.found()
37efbbd8
ZJS
2564 all_files = run_command(
2565 git,
450b60ba 2566 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
37efbbd8
ZJS
2567 'ls-files',
2568 ':/*.[ch]'])
2569 all_files = files(all_files.stdout().split())
d68b342b 2570
e85a690b 2571 custom_target(
0700e8ba 2572 'tags',
e85a690b 2573 output : 'tags',
450b60ba 2574 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
e85a690b 2575 custom_target(
0700e8ba 2576 'ctags',
e85a690b 2577 output : 'ctags',
450b60ba 2578 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
d68b342b 2579endif
177929c2
ZJS
2580
2581if git.found()
37efbbd8 2582 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
a923e085 2583 run_target(
37efbbd8 2584 'git-contrib',
37efbbd8 2585 command : [meson_git_contrib_sh])
177929c2 2586endif
dd6ab3df
ZJS
2587
2588if git.found()
2589 git_head = run_command(
2590 git,
450b60ba 2591 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
dd6ab3df
ZJS
2592 'rev-parse', 'HEAD']).stdout().strip()
2593 git_head_short = run_command(
2594 git,
450b60ba 2595 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
dd6ab3df
ZJS
2596 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2597
2598 run_target(
2599 'git-snapshot',
2600 command : ['git', 'archive',
450b60ba 2601 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
dd6ab3df
ZJS
2602 git_head_short),
2603 '--prefix', 'systemd-@0@/'.format(git_head),
2604 'HEAD'])
2605endif
829257d1
ZJS
2606
2607############################################################
2608
51b13863
LP
2609meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
2610run_target(
2611 'check-api-docs',
2612 depends : [man, libsystemd, libudev],
2613 command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
2614
2615############################################################
2616
829257d1
ZJS
2617status = [
2618 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2619
359b496f
YW
2620 'prefix directory: @0@'.format(prefixdir),
2621 'rootprefix directory: @0@'.format(rootprefixdir),
2622 'sysconf directory: @0@'.format(sysconfdir),
2623 'include directory: @0@'.format(includedir),
2624 'lib directory: @0@'.format(libdir),
2625 'rootlib directory: @0@'.format(rootlibdir),
829257d1
ZJS
2626 'SysV init scripts: @0@'.format(sysvinit_path),
2627 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
359b496f
YW
2628 'PAM modules directory: @0@'.format(pamlibdir),
2629 'PAM configuration directory: @0@'.format(pamconfdir),
2630 'RPM macros directory: @0@'.format(rpmmacrosdir),
2631 'modprobe.d directory: @0@'.format(modprobedir),
2632 'D-Bus policy directory: @0@'.format(dbuspolicydir),
2633 'D-Bus session directory: @0@'.format(dbussessionservicedir),
2634 'D-Bus system directory: @0@'.format(dbussystemservicedir),
2635 'bash completions directory: @0@'.format(bashcompletiondir),
2636 'zsh completions directory: @0@'.format(zshcompletiondir),
829257d1
ZJS
2637 'extra start script: @0@'.format(get_option('rc-local')),
2638 'extra stop script: @0@'.format(get_option('halt-local')),
2639 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2640 get_option('debug-tty')),
2641 'TTY GID: @0@'.format(tty_gid),
84786b8e 2642 'users GID: @0@'.format(users_gid),
829257d1
ZJS
2643 'maximum system UID: @0@'.format(system_uid_max),
2644 'maximum system GID: @0@'.format(system_gid_max),
87d5e4f2
LP
2645 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
2646 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
2647 'minimum container UID base: @0@'.format(container_uid_base_min),
2648 'maximum container UID base: @0@'.format(container_uid_base_max),
829257d1 2649 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
4e15a734 2650 'render group access mode: @0@'.format(get_option('group-render-mode')),
359b496f 2651 'certificate root directory: @0@'.format(get_option('certificate-root')),
829257d1 2652 'support URL: @0@'.format(support_url),
afde4574
LP
2653 'nobody user name: @0@'.format(nobody_user),
2654 'nobody group name: @0@'.format(nobody_group),
829257d1 2655 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
5248e7e1 2656 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
829257d1
ZJS
2657
2658 'default DNSSEC mode: @0@'.format(default_dnssec),
2659 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2660 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2661
2662alt_dns_servers = '\n '.join(dns_servers.split(' '))
2663alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2664status += [
2665 'default DNS servers: @0@'.format(alt_dns_servers),
2666 'default NTP servers: @0@'.format(alt_ntp_servers)]
2667
2668alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2669 '@@0@'.format(time_epoch)).stdout().strip()
2670status += [
2671 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2672
2673# TODO:
2674# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2675# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2676# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2677
349cc4a5 2678if conf.get('ENABLE_EFI') == 1
829257d1
ZJS
2679 status += [
2680 'efi arch: @0@'.format(efi_arch)]
2681
2682 if have_gnu_efi
2683 status += [
2684 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2685 'EFI CC @0@'.format(efi_cc),
359b496f
YW
2686 'EFI lib directory: @0@'.format(efi_libdir),
2687 'EFI lds directory: @0@'.format(efi_ldsdir),
2688 'EFI include directory: @0@'.format(efi_incdir)]
829257d1
ZJS
2689 endif
2690endif
2691
2692found = []
2693missing = []
2694
2695foreach tuple : [
2696 ['libcryptsetup'],
2697 ['PAM'],
2698 ['AUDIT'],
2699 ['IMA'],
2700 ['AppArmor'],
2701 ['SELinux'],
2702 ['SECCOMP'],
2703 ['SMACK'],
2704 ['zlib'],
2705 ['xz'],
2706 ['lz4'],
2707 ['bzip2'],
2708 ['ACL'],
2709 ['gcrypt'],
2710 ['qrencode'],
2711 ['microhttpd'],
2712 ['gnutls'],
2713 ['libcurl'],
d1bf5675 2714 ['idn'],
87057e24 2715 ['libidn2'],
829257d1 2716 ['libidn'],
e7e11bbf 2717 ['nss-systemd'],
829257d1
ZJS
2718 ['libiptc'],
2719 ['elfutils'],
2720 ['binfmt'],
2721 ['vconsole'],
2722 ['quotacheck'],
2723 ['tmpfiles'],
2724 ['environment.d'],
2725 ['sysusers'],
2726 ['firstboot'],
2727 ['randomseed'],
2728 ['backlight'],
2729 ['rfkill'],
2730 ['logind'],
2731 ['machined'],
2732 ['importd'],
2733 ['hostnamed'],
2734 ['timedated'],
2735 ['timesyncd'],
2736 ['localed'],
2737 ['networkd'],
a7456af5 2738 ['resolve'],
829257d1
ZJS
2739 ['coredump'],
2740 ['polkit'],
2741 ['legacy pkla', install_polkit_pkla],
2742 ['efi'],
2743 ['gnu-efi', have_gnu_efi],
2744 ['kmod'],
2745 ['xkbcommon'],
2746 ['blkid'],
2747 ['dbus'],
2748 ['glib'],
08cf5b8d 2749 ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
829257d1
ZJS
2750 ['hwdb'],
2751 ['tpm'],
2752 ['man pages', want_man],
2753 ['html pages', want_html],
2754 ['man page indices', want_man and have_lxml],
349cc4a5 2755 ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
829257d1
ZJS
2756 ['SysV compat'],
2757 ['utmp'],
2758 ['ldconfig'],
2759 ['hibernate'],
2760 ['adm group', get_option('adm-group')],
2761 ['wheel group', get_option('wheel-group')],
b14e1b43 2762 ['gshadow'],
829257d1
ZJS
2763 ['debug hashmap'],
2764 ['debug mmap cache'],
2765]
2766
2767 cond = tuple.get(1, '')
2768 if cond == ''
2769 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2770 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
349cc4a5 2771 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
829257d1
ZJS
2772 endif
2773 if cond
2774 found += [tuple[0]]
2775 else
2776 missing += [tuple[0]]
2777 endif
2778endforeach
2779
2780status += [
9d39c1bf 2781 '',
829257d1 2782 'enabled features: @0@'.format(', '.join(found)),
9d39c1bf
ZJS
2783 '',
2784 'disabled features: @0@'.format(', '.join(missing)),
2785 '']
829257d1 2786message('\n '.join(status))
9a8e64b0
ZJS
2787
2788if rootprefixdir != rootprefix_default
2789 message('WARNING:\n' +
2790 ' Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
2791 ' systemd used fixed names for unit file directories and other paths, so anything\n' +
2792 ' except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
2793endif