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