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