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