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