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