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