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