]> git.ipfire.org Git - thirdparty/systemd.git/blame - meson.build
Merge pull request #5928 from keszybz/libidn2
[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')
87057e24
ZJS
794want_libidn2 = get_option('libidn2')
795if want_libidn == 'true' and want_libidn2 == 'true'
796 error('libidn and libidn2 cannot be requested simultaneously')
797endif
798
799if want_libidn2 != 'false' and want_libidn != 'true'
800 libidn = dependency('libidn2',
801 required : want_libidn2 == 'true')
802 # libidn is used for both libidn and libidn2 objects
803 if libidn.found()
804 conf.set('HAVE_LIBIDN2', true)
805 m4_defines += ['-DHAVE_LIBIDN2']
806 endif
807else
808 libidn = []
809endif
810if not conf.get('HAVE_LIBIDN2', false) and want_libidn != 'false'
37efbbd8
ZJS
811 libidn = dependency('libidn',
812 required : want_libidn == 'true')
813 if libidn.found()
2c201c21 814 conf.set('HAVE_LIBIDN', true)
37efbbd8
ZJS
815 m4_defines += ['-DHAVE_LIBIDN']
816 endif
5c23128d
ZJS
817endif
818
819want_libiptc = get_option('libiptc')
4390be30 820if want_libiptc != 'false'
37efbbd8
ZJS
821 libiptc = dependency('libiptc',
822 required : want_libiptc == 'true')
823 if libiptc.found()
2c201c21 824 conf.set('HAVE_LIBIPTC', true)
37efbbd8
ZJS
825 m4_defines += ['-DHAVE_LIBIPTC']
826 endif
5c23128d 827else
37efbbd8 828 libiptc = []
5c23128d
ZJS
829endif
830
831want_qrencode = get_option('qrencode')
4390be30 832if want_qrencode != 'false'
37efbbd8
ZJS
833 libqrencode = dependency('libqrencode',
834 required : want_qrencode == 'true')
2c201c21 835 conf.set('HAVE_QRENCODE', libqrencode.found())
5c23128d 836else
37efbbd8 837 libqrencode = []
5c23128d
ZJS
838endif
839
840want_gnutls = get_option('gnutls')
4390be30 841if want_gnutls != 'false'
37efbbd8
ZJS
842 libgnutls = dependency('gnutls',
843 version : '>= 3.1.4',
844 required : want_gnutls == 'true')
2c201c21 845 conf.set('HAVE_GNUTLS', libgnutls.found())
5c23128d 846else
37efbbd8 847 libgnutls = []
5c23128d
ZJS
848endif
849
850want_elfutils = get_option('elfutils')
4390be30 851if want_elfutils != 'false'
37efbbd8
ZJS
852 libdw = dependency('libdw',
853 required : want_elfutils == 'true')
2c201c21 854 conf.set('HAVE_ELFUTILS', libdw.found())
5c23128d 855else
37efbbd8 856 libdw = []
5c23128d
ZJS
857endif
858
859want_zlib = get_option('zlib')
4390be30 860if want_zlib != 'false'
37efbbd8
ZJS
861 libz = dependency('zlib',
862 required : want_zlib == 'true')
2c201c21 863 conf.set('HAVE_ZLIB', libz.found())
5c23128d 864else
37efbbd8 865 libz = []
5c23128d
ZJS
866endif
867
868want_bzip2 = get_option('bzip2')
4390be30 869if want_bzip2 != 'false'
37efbbd8
ZJS
870 libbzip2 = cc.find_library('bz2',
871 required : want_bzip2 == 'true')
2c201c21 872 conf.set('HAVE_BZIP2', libbzip2.found())
5c23128d 873else
37efbbd8 874 libbzip2 = []
5c23128d
ZJS
875endif
876
877want_xz = get_option('xz')
4390be30 878if want_xz != 'false'
37efbbd8
ZJS
879 libxz = dependency('liblzma',
880 required : want_xz == 'true')
2c201c21 881 conf.set('HAVE_XZ', libxz.found())
5c23128d 882else
37efbbd8 883 libxz = []
5c23128d
ZJS
884endif
885
886want_lz4 = get_option('lz4')
4390be30 887if want_lz4 != 'false'
37efbbd8
ZJS
888 liblz4 = dependency('liblz4',
889 required : want_lz4 == 'true')
2c201c21 890 conf.set('HAVE_LZ4', liblz4.found())
5c23128d 891else
37efbbd8 892 liblz4 = []
5c23128d
ZJS
893endif
894
69e96427 895want_glib = get_option('glib')
4390be30 896if want_glib != 'false'
37efbbd8
ZJS
897 libglib = dependency('glib-2.0',
898 version : '>= 2.22.0',
899 required : want_glib == 'true')
900 libgobject = dependency('gobject-2.0',
901 version : '>= 2.22.0',
902 required : want_glib == 'true')
903 libgio = dependency('gio-2.0',
904 required : want_glib == 'true')
2c201c21
ZJS
905 have = libglib.found() and libgobject.found() and libgio.found()
906 conf.set('HAVE_GLIB', have)
69e96427 907else
37efbbd8
ZJS
908 libglib = []
909 libgobject = []
910 libgio = []
69e96427
ZJS
911endif
912
1eeb43f5 913want_xkbcommon = get_option('xkbcommon')
4390be30 914if want_xkbcommon != 'false'
37efbbd8
ZJS
915 libxkbcommon = dependency('xkbcommon',
916 version : '>= 0.3.0',
917 required : want_xkbcommon == 'true')
2c201c21 918 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
1eeb43f5 919else
37efbbd8 920 libxkbcommon = []
1eeb43f5
ZJS
921endif
922
69e96427 923want_dbus = get_option('dbus')
4390be30 924if want_dbus != 'false'
37efbbd8
ZJS
925 libdbus = dependency('dbus-1',
926 version : '>= 1.3.2',
927 required : want_dbus == 'true')
2c201c21 928 conf.set('HAVE_DBUS', libdbus.found())
69e96427 929else
37efbbd8 930 libdbus = []
69e96427
ZJS
931endif
932
76c87410
MB
933want_gcrypt = get_option('gcrypt')
934if want_gcrypt != 'false'
935 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
936 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
937
2c201c21
ZJS
938 have_deps = libgcrypt.found() and libgpg_error.found()
939 conf.set('HAVE_GCRYPT', have_deps)
940 if not have_deps
76c87410
MB
941 # link to neither of the libs if one is not found
942 libgcrypt = []
943 libgpg_error = []
37efbbd8 944 endif
5c23128d 945else
37efbbd8 946 libgcrypt = []
76c87410 947 libgpg_error = []
5c23128d
ZJS
948endif
949
950want_importd = get_option('importd')
4390be30 951if want_importd != 'false'
2c201c21
ZJS
952 have_deps = (conf.get('HAVE_LIBCURL', false) and
953 conf.get('HAVE_ZLIB', false) and
954 conf.get('HAVE_BZIP2', false) and
955 conf.get('HAVE_XZ', false) and
956 conf.get('HAVE_GCRYPT', false))
957 conf.set('ENABLE_IMPORTD', have_deps)
958 if want_importd == 'true' and not have_deps
37efbbd8
ZJS
959 error('importd support was requested, but dependencies are not available')
960 endif
5c23128d
ZJS
961endif
962
963want_remote = get_option('remote')
4390be30 964if want_remote != 'false'
2c201c21
ZJS
965 have_deps = [conf.get('HAVE_MICROHTTPD', false),
966 conf.get('HAVE_LIBCURL', false)]
37efbbd8
ZJS
967 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
968 # it's possible to build one without the other. Complain only if
969 # support was explictly requested. The auxiliary files like sysusers
970 # config should be installed when any of the programs are built.
971 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
972 error('remote support was requested, but dependencies are not available')
973 endif
2c201c21 974 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
5c23128d
ZJS
975endif
976
977foreach pair : [['utmp', 'HAVE_UTMP'],
978 ['hibernate', 'ENABLE_HIBERNATE'],
979 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
980 ['binfmt', 'ENABLE_BINFMT'],
981 ['coredump', 'ENABLE_COREDUMP'],
982 ['resolve', 'ENABLE_RESOLVED'],
983 ['logind', 'ENABLE_LOGIND'],
984 ['hostnamed', 'ENABLE_HOSTNAMED'],
985 ['localed', 'ENABLE_LOCALED'],
986 ['machined', 'ENABLE_MACHINED'],
987 ['networkd', 'ENABLE_NETWORKD'],
988 ['timedated', 'ENABLE_TIMEDATED'],
989 ['timesyncd', 'ENABLE_TIMESYNCD'],
990 ['myhostname', 'HAVE_MYHOSTNAME'],
991 ['firstboot', 'ENABLE_FIRSTBOOT'],
992 ['randomseed', 'ENABLE_RANDOMSEED'],
993 ['backlight', 'ENABLE_BACKLIGHT'],
994 ['vconsole', 'ENABLE_VCONSOLE'],
995 ['quotacheck', 'ENABLE_QUOTACHECK'],
996 ['sysusers', 'ENABLE_SYSUSERS'],
997 ['tmpfiles', 'ENABLE_TMPFILES'],
998 ['hwdb', 'ENABLE_HWDB'],
999 ['rfkill', 'ENABLE_RFKILL'],
1000 ['ldconfig', 'ENABLE_LDCONFIG'],
b710072d 1001 ['efi', 'ENABLE_EFI'],
80c6fce8 1002 ['tpm', 'SD_BOOT_LOG_TPM'],
2895c8ee 1003 ['ima', 'HAVE_IMA'],
5464ec8a 1004 ['smack', 'HAVE_SMACK'],
b14e1b43 1005 ['gshadow', 'ENABLE_GSHADOW'],
5c23128d
ZJS
1006 ]
1007
37efbbd8 1008 if get_option(pair[0])
2c201c21 1009 conf.set(pair[1], true)
37efbbd8
ZJS
1010 m4_defines += ['-D' + pair[1]]
1011 endif
5c23128d
ZJS
1012endforeach
1013
69e96427 1014want_tests = get_option('tests')
572baca1 1015install_tests = get_option('install-tests')
69e96427
ZJS
1016tests = []
1017
5c23128d
ZJS
1018#####################################################################
1019
1020if get_option('efi')
37efbbd8 1021 efi_arch = host_machine.cpu_family()
b710072d 1022
6800fe7f 1023 if efi_arch == 'x86'
37efbbd8 1024 EFI_MACHINE_TYPE_NAME = 'ia32'
6800fe7f 1025 gnu_efi_arch = 'ia32'
37efbbd8
ZJS
1026 elif efi_arch == 'x86_64'
1027 EFI_MACHINE_TYPE_NAME = 'x64'
6800fe7f 1028 gnu_efi_arch = 'x86_64'
37efbbd8
ZJS
1029 elif efi_arch == 'arm'
1030 EFI_MACHINE_TYPE_NAME = 'arm'
6800fe7f 1031 gnu_efi_arch = 'arm'
37efbbd8
ZJS
1032 elif efi_arch == 'aarch64'
1033 EFI_MACHINE_TYPE_NAME = 'aa64'
6800fe7f 1034 gnu_efi_arch = 'aarch64'
37efbbd8
ZJS
1035 else
1036 EFI_MACHINE_TYPE_NAME = ''
6800fe7f 1037 gnu_efi_arch = ''
37efbbd8 1038 endif
5c23128d 1039
2c201c21 1040 conf.set('ENABLE_EFI', true)
37efbbd8 1041 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
80c6fce8
ZJS
1042
1043 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
5c23128d
ZJS
1044endif
1045
1046#####################################################################
1047
1048config_h = configure_file(
37efbbd8
ZJS
1049 output : 'config.h',
1050 configuration : conf)
5c23128d
ZJS
1051
1052includes = include_directories('src/basic',
1053 'src/shared',
1054 'src/systemd',
1055 'src/journal',
1056 'src/resolve',
1057 'src/timesync',
1058 'src/login',
1059 'src/udev',
1060 'src/libudev',
1061 'src/core',
1062 'src/libsystemd/sd-bus',
1063 'src/libsystemd/sd-device',
1064 'src/libsystemd/sd-hwdb',
1065 'src/libsystemd/sd-id128',
1066 'src/libsystemd/sd-netlink',
1067 'src/libsystemd/sd-network',
1068 'src/libsystemd-network',
1069 )
1070
1071add_project_arguments('-include', 'config.h', language : 'c')
1072
1073gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1074 'src/shared/gcrypt-util.c')
1075
1076subdir('po')
1077subdir('catalog')
1078subdir('src/systemd')
1079subdir('src/basic')
1080subdir('src/libsystemd')
1081subdir('src/libsystemd-network')
5c23128d 1082subdir('src/journal')
5c23128d 1083subdir('src/login')
5c23128d
ZJS
1084
1085libjournal_core = static_library(
37efbbd8
ZJS
1086 'journal-core',
1087 libjournal_core_sources,
1088 journald_gperf_c,
1089 include_directories : includes,
1090 install : false)
5c23128d 1091
37ab1a25 1092libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
5c23128d 1093libsystemd = shared_library(
37efbbd8
ZJS
1094 'systemd',
1095 libsystemd_internal_sources,
1096 journal_internal_sources,
1097 version : '0.18.0',
1098 include_directories : includes,
1099 link_args : ['-shared',
1100 '-Wl,--version-script=' + libsystemd_sym_path],
1101 link_with : [libbasic],
1102 dependencies : [threads,
76c87410 1103 libgcrypt,
37efbbd8
ZJS
1104 librt,
1105 libxz,
1106 liblz4],
1107 link_depends : libsystemd_sym,
1108 install : true,
1109 install_dir : rootlibdir)
5c23128d
ZJS
1110
1111############################################################
1112
83b6af36
ZJS
1113# binaries that have --help and are intended for use by humans,
1114# usually, but not always, installed in /bin.
1115public_programs = []
1116
1117subdir('src/libudev')
1118subdir('src/shared')
1119subdir('src/core')
1120subdir('src/udev')
1121subdir('src/network')
1122
1123subdir('src/analyze')
1124subdir('src/journal-remote')
1125subdir('src/coredump')
1126subdir('src/hostname')
1127subdir('src/import')
1128subdir('src/kernel-install')
1129subdir('src/locale')
1130subdir('src/machine')
1131subdir('src/nspawn')
1132subdir('src/resolve')
1133subdir('src/timedate')
1134subdir('src/timesync')
1135subdir('src/vconsole')
1136subdir('src/sulogin-shell')
1137subdir('src/boot/efi')
1138
1139subdir('src/test')
1140subdir('test')
1141
1142############################################################
1143
1144# only static linking apart from libdl, to make sure that the
1145# module is linked to all libraries that it uses.
1146test_dlopen = executable(
37efbbd8
ZJS
1147 'test-dlopen',
1148 test_dlopen_c,
1149 include_directories : includes,
1150 link_with : [libbasic],
1151 dependencies : [libdl])
83b6af36 1152
5c23128d
ZJS
1153foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME', []],
1154 ['systemd', '', []],
1155 ['mymachines', 'ENABLE_MACHINED', []],
1156 ['resolve', 'ENABLE_RESOLVED', [libdl]]]
1157
2c201c21 1158 condition = tuple[1] == '' or conf.get(tuple[1], false)
37efbbd8
ZJS
1159 if condition
1160 module = tuple[0]
1161 extra_deps = tuple[2]
1162
1163 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1164 version_script_arg = join_paths(meson.current_source_dir(), sym)
1165
1166 nss = shared_library(
1167 'nss_' + module,
1168 'src/nss-@0@/nss-@0@.c'.format(module),
1169 version : '2',
1170 include_directories : includes,
1171 link_args : ['-shared',
1172 '-Wl,--version-script=' + version_script_arg,
1173 '-Wl,--undefined'],
1174 link_with : [libsystemd_internal,
1175 libbasic],
1176 dependencies : [threads,
1177 librt] + extra_deps,
1178 link_depends : sym,
1179 install : true,
1180 install_dir : rootlibdir)
1181
1182 # We cannot use shared_module because it does not support version suffix.
1183 # Unfortunately shared_library insists on creating the symlink…
1184 meson.add_install_script('sh', '-c',
1185 'rm $DESTDIR@0@/libnss_@1@.so'
1186 .format(rootlibdir, module))
1187
1188 test('dlopen-nss_' + module,
1189 test_dlopen,
1190 args : [nss.full_path()]) # path to dlopen must include a slash
1191 endif
5c23128d
ZJS
1192endforeach
1193
1194############################################################
1195
5c23128d
ZJS
1196executable('systemd',
1197 systemd_sources,
1198 include_directories : includes,
1199 link_with : [libcore,
34ce0a52 1200 libshared],
5c23128d
ZJS
1201 dependencies : [threads,
1202 librt,
1203 libseccomp,
1204 libselinux,
f4ee10a2
ZJS
1205 libmount,
1206 libblkid],
421f0012 1207 install_rpath : rootlibexecdir,
5c23128d
ZJS
1208 install : true,
1209 install_dir : rootlibexecdir)
1210
005a29f2
ZJS
1211exe = executable('systemd-analyze',
1212 systemd_analyze_sources,
1213 include_directories : includes,
1214 link_with : [libcore,
005a29f2
ZJS
1215 libshared],
1216 dependencies : [threads,
1217 librt,
1218 libseccomp,
1219 libselinux,
1220 libmount,
1221 libblkid],
1222 install_rpath : rootlibexecdir,
1223 install : true)
1224public_programs += [exe]
5c23128d
ZJS
1225
1226executable('systemd-journald',
1227 systemd_journald_sources,
1228 include_directories : includes,
aac26058 1229 link_with : [libjournal_core,
34ce0a52 1230 libshared],
5c23128d
ZJS
1231 dependencies : [threads,
1232 libxz,
aac26058
ZJS
1233 liblz4,
1234 libselinux],
421f0012 1235 install_rpath : rootlibexecdir,
5c23128d
ZJS
1236 install : true,
1237 install_dir : rootlibexecdir)
1238
005a29f2
ZJS
1239exe = executable('systemd-cat',
1240 systemd_cat_sources,
1241 include_directories : includes,
1242 link_with : [libjournal_core,
34ce0a52 1243 libshared],
005a29f2
ZJS
1244 dependencies : [threads],
1245 install_rpath : rootlibexecdir,
1246 install : true)
1247public_programs += [exe]
1248
1249exe = executable('journalctl',
1250 journalctl_sources,
1251 include_directories : includes,
34ce0a52 1252 link_with : [libshared],
005a29f2
ZJS
1253 dependencies : [threads,
1254 libqrencode,
1255 libxz,
1256 liblz4],
1257 install_rpath : rootlibexecdir,
1258 install : true,
1259 install_dir : rootbindir)
1260public_programs += [exe]
5c23128d
ZJS
1261
1262executable('systemd-getty-generator',
1263 'src/getty-generator/getty-generator.c',
5c23128d 1264 include_directories : includes,
b2fc5836
ZJS
1265 link_with : [libshared],
1266 install_rpath : rootlibexecdir,
1267 install : true,
1268 install_dir : systemgeneratordir)
5c23128d
ZJS
1269
1270executable('systemd-debug-generator',
1271 'src/debug-generator/debug-generator.c',
5c23128d 1272 include_directories : includes,
b2fc5836
ZJS
1273 link_with : [libshared],
1274 install_rpath : rootlibexecdir,
1275 install : true,
1276 install_dir : systemgeneratordir)
5c23128d
ZJS
1277
1278executable('systemd-fstab-generator',
1279 'src/fstab-generator/fstab-generator.c',
1280 'src/core/mount-setup.c',
5c23128d 1281 include_directories : includes,
b2fc5836
ZJS
1282 link_with : [libshared],
1283 install_rpath : rootlibexecdir,
1284 install : true,
1285 install_dir : systemgeneratordir)
5c23128d 1286
2c201c21 1287if conf.get('ENABLE_ENVIRONMENT_D', false)
37efbbd8
ZJS
1288 executable('30-systemd-environment-d-generator',
1289 'src/environment-d-generator/environment-d-generator.c',
1290 include_directories : includes,
1291 link_with : [libshared],
1292 install_rpath : rootlibexecdir,
1293 install : true,
1294 install_dir : userenvgeneratordir)
7b76fce1 1295
37efbbd8
ZJS
1296 meson.add_install_script(meson_make_symlink,
1297 join_paths(sysconfdir, 'environment'),
1298 join_paths(environmentdir, '99-environment.conf'))
5c23128d
ZJS
1299endif
1300
2c201c21 1301if conf.get('ENABLE_HIBERNATE', false)
37efbbd8
ZJS
1302 executable('systemd-hibernate-resume-generator',
1303 'src/hibernate-resume/hibernate-resume-generator.c',
1304 include_directories : includes,
1305 link_with : [libshared],
1306 install_rpath : rootlibexecdir,
1307 install : true,
1308 install_dir : systemgeneratordir)
5c23128d 1309
37efbbd8
ZJS
1310 executable('systemd-hibernate-resume',
1311 'src/hibernate-resume/hibernate-resume.c',
005a29f2
ZJS
1312 include_directories : includes,
1313 link_with : [libshared],
1314 install_rpath : rootlibexecdir,
1315 install : true,
1316 install_dir : rootlibexecdir)
37efbbd8
ZJS
1317endif
1318
2c201c21 1319if conf.get('HAVE_BLKID', false)
37efbbd8
ZJS
1320 executable('systemd-gpt-auto-generator',
1321 'src/gpt-auto-generator/gpt-auto-generator.c',
1322 'src/basic/blkid-util.h',
1323 include_directories : includes,
34ce0a52 1324 link_with : [libshared],
37efbbd8
ZJS
1325 dependencies : libblkid,
1326 install_rpath : rootlibexecdir,
1327 install : true,
1328 install_dir : systemgeneratordir)
1329
1330 exe = executable('systemd-dissect',
1331 'src/dissect/dissect.c',
1332 include_directories : includes,
1333 link_with : [libshared],
1334 install_rpath : rootlibexecdir,
1335 install : true,
1336 install_dir : rootlibexecdir)
1337 public_programs += [exe]
5c23128d
ZJS
1338endif
1339
2c201c21 1340if conf.get('ENABLE_RESOLVED', false)
37efbbd8
ZJS
1341 executable('systemd-resolved',
1342 systemd_resolved_sources,
76c87410 1343 gcrypt_util_sources,
005a29f2 1344 include_directories : includes,
aac26058 1345 link_with : [libshared],
005a29f2 1346 dependencies : [threads,
76c87410
MB
1347 libgcrypt,
1348 libgpg_error,
005a29f2
ZJS
1349 libm,
1350 libidn],
1351 install_rpath : rootlibexecdir,
37efbbd8
ZJS
1352 install : true,
1353 install_dir : rootlibexecdir)
1354
1355 exe = executable('systemd-resolve',
1356 systemd_resolve_sources,
76c87410 1357 gcrypt_util_sources,
37efbbd8
ZJS
1358 include_directories : includes,
1359 link_with : [libshared],
1360 dependencies : [threads,
76c87410
MB
1361 libgcrypt,
1362 libgpg_error,
37efbbd8
ZJS
1363 libm,
1364 libidn],
1365 install_rpath : rootlibexecdir,
1366 install : true)
1367 public_programs += [exe]
5c23128d
ZJS
1368endif
1369
2c201c21 1370if conf.get('ENABLE_LOGIND', false)
37efbbd8
ZJS
1371 executable('systemd-logind',
1372 systemd_logind_sources,
005a29f2 1373 include_directories : includes,
37efbbd8 1374 link_with : [liblogind_core,
34ce0a52 1375 libshared],
005a29f2 1376 dependencies : [threads,
37efbbd8 1377 libacl],
005a29f2
ZJS
1378 install_rpath : rootlibexecdir,
1379 install : true,
37efbbd8
ZJS
1380 install_dir : rootlibexecdir)
1381
1382 exe = executable('loginctl',
1383 loginctl_sources,
1384 include_directories : includes,
34ce0a52 1385 link_with : [libshared],
37efbbd8
ZJS
1386 dependencies : [threads,
1387 liblz4,
1388 libxz],
1389 install_rpath : rootlibexecdir,
1390 install : true,
1391 install_dir : rootbindir)
1392 public_programs += [exe]
1393
1394 exe = executable('systemd-inhibit',
1395 'src/login/inhibit.c',
1396 include_directories : includes,
1397 link_with : [libshared],
1398 install_rpath : rootlibexecdir,
1399 install : true,
1400 install_dir : rootbindir)
1401 public_programs += [exe]
1402
2c201c21 1403 if conf.get('HAVE_PAM', false)
37efbbd8
ZJS
1404 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1405 pam_systemd = shared_library(
1406 'pam_systemd',
1407 pam_systemd_c,
1408 name_prefix : '',
1409 include_directories : includes,
1410 link_args : ['-shared',
1411 '-Wl,--version-script=' + version_script_arg],
1412 link_with : [libsystemd_internal,
1413 libshared_static],
1414 dependencies : [threads,
1415 libpam,
1416 libpam_misc],
1417 link_depends : pam_systemd_sym,
1418 install : true,
1419 install_dir : pamlibdir)
1420
1421 test('dlopen-pam_systemd',
1422 test_dlopen,
1423 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1424 endif
1425endif
005a29f2 1426
2c201c21 1427if conf.get('HAVE_PAM', false)
37efbbd8
ZJS
1428 executable('systemd-user-sessions',
1429 'src/user-sessions/user-sessions.c',
005a29f2 1430 include_directories : includes,
aac26058 1431 link_with : [libshared],
005a29f2
ZJS
1432 install_rpath : rootlibexecdir,
1433 install : true,
37efbbd8 1434 install_dir : rootlibexecdir)
5c23128d
ZJS
1435endif
1436
2c201c21 1437if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
37efbbd8
ZJS
1438 exe = executable('bootctl',
1439 'src/boot/bootctl.c',
1440 include_directories : includes,
1441 link_with : [libshared],
1442 dependencies : [libblkid],
1443 install_rpath : rootlibexecdir,
1444 install : true)
1445 public_programs += [exe]
005a29f2
ZJS
1446endif
1447
1448exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1449 include_directories : includes,
1450 link_with : [libshared],
1451 dependencies : [threads],
1452 install_rpath : rootlibexecdir,
1453 install : true)
1454public_programs += [exe]
1455
1456exe = executable('systemctl', 'src/systemctl/systemctl.c',
1457 include_directories : includes,
aac26058 1458 link_with : [libshared],
005a29f2
ZJS
1459 dependencies : [threads,
1460 libcap,
1461 libselinux,
1462 libxz,
1463 liblz4],
1464 install_rpath : rootlibexecdir,
1465 install : true,
1466 install_dir : rootbindir)
1467public_programs += [exe]
5c23128d 1468
2c201c21 1469if conf.get('ENABLE_BACKLIGHT', false)
37efbbd8
ZJS
1470 executable('systemd-backlight',
1471 'src/backlight/backlight.c',
1472 include_directories : includes,
34ce0a52 1473 link_with : [libshared],
37efbbd8
ZJS
1474 install_rpath : rootlibexecdir,
1475 install : true,
1476 install_dir : rootlibexecdir)
5c23128d
ZJS
1477endif
1478
2c201c21 1479if conf.get('ENABLE_RFKILL', false)
37efbbd8
ZJS
1480 executable('systemd-rfkill',
1481 'src/rfkill/rfkill.c',
1482 include_directories : includes,
34ce0a52 1483 link_with : [libshared],
37efbbd8
ZJS
1484 install_rpath : rootlibexecdir,
1485 install : true,
1486 install_dir : rootlibexecdir)
5c23128d
ZJS
1487endif
1488
1489executable('systemd-system-update-generator',
1490 'src/system-update-generator/system-update-generator.c',
1491 include_directories : includes,
1492 link_with : [libshared],
b2fc5836 1493 install_rpath : rootlibexecdir,
5c23128d
ZJS
1494 install : true,
1495 install_dir : systemgeneratordir)
1496
2c201c21 1497if conf.get('HAVE_LIBCRYPTSETUP', false)
37efbbd8
ZJS
1498 executable('systemd-cryptsetup',
1499 'src/cryptsetup/cryptsetup.c',
1500 include_directories : includes,
1501 link_with : [libshared],
1502 dependencies : [libcryptsetup],
1503 install_rpath : rootlibexecdir,
1504 install : true,
1505 install_dir : rootlibexecdir)
1506
1507 executable('systemd-cryptsetup-generator',
1508 'src/cryptsetup/cryptsetup-generator.c',
1509 include_directories : includes,
1510 link_with : [libshared],
1511 dependencies : [libcryptsetup],
1512 install_rpath : rootlibexecdir,
1513 install : true,
1514 install_dir : systemgeneratordir)
1515
1516 executable('systemd-veritysetup',
1517 'src/veritysetup/veritysetup.c',
1518 include_directories : includes,
1519 link_with : [libshared],
1520 dependencies : [libcryptsetup],
1521 install_rpath : rootlibexecdir,
1522 install : true,
1523 install_dir : rootlibexecdir)
1524
1525 executable('systemd-veritysetup-generator',
1526 'src/veritysetup/veritysetup-generator.c',
1527 include_directories : includes,
1528 link_with : [libshared],
1529 dependencies : [libcryptsetup],
1530 install_rpath : rootlibexecdir,
1531 install : true,
1532 install_dir : systemgeneratordir)
5c23128d
ZJS
1533endif
1534
2c201c21 1535if conf.get('HAVE_SYSV_COMPAT', false)
37efbbd8
ZJS
1536 executable('systemd-sysv-generator',
1537 'src/sysv-generator/sysv-generator.c',
1538 include_directories : includes,
1539 link_with : [libshared],
1540 install_rpath : rootlibexecdir,
1541 install : true,
1542 install_dir : systemgeneratordir)
1543
1544 executable('systemd-rc-local-generator',
1545 'src/rc-local-generator/rc-local-generator.c',
1546 include_directories : includes,
1547 link_with : [libshared],
1548 install_rpath : rootlibexecdir,
1549 install : true,
1550 install_dir : systemgeneratordir)
5c23128d
ZJS
1551endif
1552
2c201c21 1553if conf.get('ENABLE_HOSTNAMED', false)
37efbbd8
ZJS
1554 executable('systemd-hostnamed',
1555 'src/hostname/hostnamed.c',
005a29f2 1556 include_directories : includes,
aac26058 1557 link_with : [libshared],
005a29f2 1558 install_rpath : rootlibexecdir,
37efbbd8
ZJS
1559 install : true,
1560 install_dir : rootlibexecdir)
1561
1562 exe = executable('hostnamectl',
1563 'src/hostname/hostnamectl.c',
1564 include_directories : includes,
1565 link_with : [libshared],
1566 install_rpath : rootlibexecdir,
1567 install : true)
1568 public_programs += [exe]
5c23128d
ZJS
1569endif
1570
2c201c21
ZJS
1571if conf.get('ENABLE_LOCALED', false)
1572 if conf.get('HAVE_XKBCOMMON', false)
37efbbd8
ZJS
1573 # logind will load libxkbcommon.so dynamically on its own
1574 deps = [libdl]
1575 else
1576 deps = []
1577 endif
1578
1579 executable('systemd-localed',
1580 systemd_localed_sources,
005a29f2 1581 include_directories : includes,
aac26058 1582 link_with : [libshared],
37efbbd8 1583 dependencies : deps,
005a29f2 1584 install_rpath : rootlibexecdir,
37efbbd8
ZJS
1585 install : true,
1586 install_dir : rootlibexecdir)
1587
1588 exe = executable('localectl',
1589 localectl_sources,
1590 include_directories : includes,
1591 link_with : [libshared],
1592 install_rpath : rootlibexecdir,
1593 install : true)
1594 public_programs += [exe]
5c23128d
ZJS
1595endif
1596
2c201c21 1597if conf.get('ENABLE_TIMEDATED', false)
37efbbd8
ZJS
1598 executable('systemd-timedated',
1599 'src/timedate/timedated.c',
005a29f2 1600 include_directories : includes,
aac26058 1601 link_with : [libshared],
37efbbd8
ZJS
1602 install_rpath : rootlibexecdir,
1603 install : true,
1604 install_dir : rootlibexecdir)
5c23128d 1605
37efbbd8
ZJS
1606 exe = executable('timedatectl',
1607 'src/timedate/timedatectl.c',
1608 include_directories : includes,
1609 install_rpath : rootlibexecdir,
1610 link_with : [libshared],
1611 install : true)
1612 public_programs += [exe]
5c23128d
ZJS
1613endif
1614
2c201c21 1615if conf.get('ENABLE_TIMESYNCD', false)
37efbbd8
ZJS
1616 executable('systemd-timesyncd',
1617 systemd_timesyncd_sources,
005a29f2 1618 include_directories : includes,
aac26058 1619 link_with : [libshared],
005a29f2 1620 dependencies : [threads,
37efbbd8 1621 libm],
005a29f2
ZJS
1622 install_rpath : rootlibexecdir,
1623 install : true,
37efbbd8 1624 install_dir : rootlibexecdir)
5c23128d
ZJS
1625endif
1626
2c201c21 1627if conf.get('ENABLE_MACHINED', false)
37efbbd8
ZJS
1628 executable('systemd-machined',
1629 systemd_machined_sources,
1630 include_directories : includes,
1631 link_with : [libmachine_core,
1632 libshared],
1633 install_rpath : rootlibexecdir,
1634 install : true,
1635 install_dir : rootlibexecdir)
1636
1637 exe = executable('machinectl',
1638 'src/machine/machinectl.c',
1639 include_directories : includes,
1640 link_with : [libshared],
1641 dependencies : [threads,
1642 libxz,
1643 liblz4],
1644 install_rpath : rootlibexecdir,
1645 install : true,
1646 install_dir : rootbindir)
1647 public_programs += [exe]
5c23128d
ZJS
1648endif
1649
2c201c21 1650if conf.get('ENABLE_IMPORTD', false)
37efbbd8
ZJS
1651 executable('systemd-importd',
1652 systemd_importd_sources,
005a29f2 1653 include_directories : includes,
aac26058 1654 link_with : [libshared],
37efbbd8 1655 dependencies : [threads],
005a29f2
ZJS
1656 install_rpath : rootlibexecdir,
1657 install : true,
1658 install_dir : rootlibexecdir)
37efbbd8
ZJS
1659
1660 systemd_pull = executable('systemd-pull',
1661 systemd_pull_sources,
1662 include_directories : includes,
1663 link_with : [libshared],
1664 dependencies : [libcurl,
1665 libz,
1666 libbzip2,
1667 libxz,
1668 libgcrypt],
1669 install_rpath : rootlibexecdir,
1670 install : true,
1671 install_dir : rootlibexecdir)
1672
1673 systemd_import = executable('systemd-import',
1674 systemd_import_sources,
1675 include_directories : includes,
1676 link_with : [libshared],
1677 dependencies : [libcurl,
1678 libz,
1679 libbzip2,
1680 libxz],
1681 install_rpath : rootlibexecdir,
1682 install : true,
1683 install_dir : rootlibexecdir)
1684
1685 systemd_export = executable('systemd-export',
1686 systemd_export_sources,
1687 include_directories : includes,
1688 link_with : [libshared],
1689 dependencies : [libcurl,
1690 libz,
1691 libbzip2,
1692 libxz],
1693 install_rpath : rootlibexecdir,
1694 install : true,
1695 install_dir : rootlibexecdir)
1696 public_programs += [systemd_pull, systemd_import, systemd_export]
1697endif
1698
2c201c21 1699if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
37efbbd8
ZJS
1700 exe = executable('systemd-journal-upload',
1701 systemd_journal_upload_sources,
1702 include_directories : includes,
1703 link_with : [libshared],
1704 dependencies : [threads,
1705 libcurl,
1706 libgnutls,
1707 libxz,
1708 liblz4],
1709 install_rpath : rootlibexecdir,
1710 install : true,
1711 install_dir : rootlibexecdir)
1712 public_programs += [exe]
5c23128d
ZJS
1713endif
1714
2c201c21 1715if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
37efbbd8
ZJS
1716 s_j_remote = executable('systemd-journal-remote',
1717 systemd_journal_remote_sources,
1718 include_directories : includes,
1719 link_with : [libshared],
1720 dependencies : [threads,
1721 libmicrohttpd,
1722 libgnutls,
1723 libxz,
1724 liblz4],
1725 install_rpath : rootlibexecdir,
1726 install : true,
1727 install_dir : rootlibexecdir)
1728
1729 s_j_gatewayd = executable('systemd-journal-gatewayd',
1730 systemd_journal_gatewayd_sources,
1731 include_directories : includes,
1732 link_with : [libshared],
1733 dependencies : [threads,
1734 libmicrohttpd,
1735 libgnutls,
1736 libxz,
1737 liblz4],
1738 install_rpath : rootlibexecdir,
1739 install : true,
1740 install_dir : rootlibexecdir)
1741 public_programs += [s_j_remote, s_j_gatewayd]
5c23128d
ZJS
1742endif
1743
2c201c21 1744if conf.get('ENABLE_COREDUMP', false)
37efbbd8
ZJS
1745 executable('systemd-coredump',
1746 systemd_coredump_sources,
005a29f2 1747 include_directories : includes,
aac26058 1748 link_with : [libshared],
005a29f2 1749 dependencies : [threads,
37efbbd8
ZJS
1750 libacl,
1751 libdw,
005a29f2
ZJS
1752 libxz,
1753 liblz4],
1754 install_rpath : rootlibexecdir,
37efbbd8
ZJS
1755 install : true,
1756 install_dir : rootlibexecdir)
1757
1758 exe = executable('coredumpctl',
1759 coredumpctl_sources,
1760 include_directories : includes,
1761 link_with : [libshared],
1762 dependencies : [threads,
1763 libxz,
1764 liblz4],
1765 install_rpath : rootlibexecdir,
1766 install : true)
1767 public_programs += [exe]
5c23128d
ZJS
1768endif
1769
2c201c21 1770if conf.get('ENABLE_BINFMT', false)
37efbbd8
ZJS
1771 exe = executable('systemd-binfmt',
1772 'src/binfmt/binfmt.c',
1773 include_directories : includes,
1774 link_with : [libshared],
1775 install_rpath : rootlibexecdir,
1776 install : true,
1777 install_dir : rootlibexecdir)
1778 public_programs += [exe]
1779
1780 meson.add_install_script('sh', '-c',
1781 mkdir_p.format(binfmtdir))
1782 meson.add_install_script('sh', '-c',
1783 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1784endif
1785
2c201c21 1786if conf.get('ENABLE_VCONSOLE', false)
37efbbd8
ZJS
1787 executable('systemd-vconsole-setup',
1788 'src/vconsole/vconsole-setup.c',
005a29f2
ZJS
1789 include_directories : includes,
1790 link_with : [libshared],
1791 install_rpath : rootlibexecdir,
1792 install : true,
1793 install_dir : rootlibexecdir)
5c23128d
ZJS
1794endif
1795
2c201c21 1796if conf.get('ENABLE_RANDOMSEED', false)
37efbbd8
ZJS
1797 executable('systemd-random-seed',
1798 'src/random-seed/random-seed.c',
1799 include_directories : includes,
1800 link_with : [libshared],
1801 install_rpath : rootlibexecdir,
1802 install : true,
1803 install_dir : rootlibexecdir)
5c23128d
ZJS
1804endif
1805
2c201c21 1806if conf.get('ENABLE_FIRSTBOOT', false)
37efbbd8
ZJS
1807 executable('systemd-firstboot',
1808 'src/firstboot/firstboot.c',
1809 include_directories : includes,
1810 link_with : [libshared],
1811 dependencies : [libcrypt],
1812 install_rpath : rootlibexecdir,
1813 install : true,
1814 install_dir : rootbindir)
5c23128d
ZJS
1815endif
1816
1817executable('systemd-remount-fs',
1818 'src/remount-fs/remount-fs.c',
1819 'src/core/mount-setup.c',
1820 'src/core/mount-setup.h',
1821 include_directories : includes,
1822 link_with : [libshared],
b2fc5836 1823 install_rpath : rootlibexecdir,
5c23128d
ZJS
1824 install : true,
1825 install_dir : rootlibexecdir)
1826
1827executable('systemd-machine-id-setup',
1828 'src/machine-id-setup/machine-id-setup-main.c',
1829 'src/core/machine-id-setup.c',
1830 'src/core/machine-id-setup.h',
1831 include_directories : includes,
aac26058 1832 link_with : [libshared],
b2fc5836 1833 install_rpath : rootlibexecdir,
5c23128d
ZJS
1834 install : true,
1835 install_dir : rootbindir)
1836
1837executable('systemd-fsck',
1838 'src/fsck/fsck.c',
1839 include_directories : includes,
aac26058 1840 link_with : [libshared],
421f0012 1841 install_rpath : rootlibexecdir,
5c23128d
ZJS
1842 install : true,
1843 install_dir : rootlibexecdir)
1844
1845executable('systemd-sleep',
1846 'src/sleep/sleep.c',
1847 include_directories : includes,
1848 link_with : [libshared],
421f0012 1849 install_rpath : rootlibexecdir,
5c23128d
ZJS
1850 install : true,
1851 install_dir : rootlibexecdir)
1852
005a29f2
ZJS
1853exe = executable('systemd-sysctl',
1854 'src/sysctl/sysctl.c',
1855 include_directories : includes,
1856 link_with : [libshared],
1857 install_rpath : rootlibexecdir,
1858 install : true,
1859 install_dir : rootlibexecdir)
1860public_programs += [exe]
5c23128d
ZJS
1861
1862executable('systemd-ac-power',
1863 'src/ac-power/ac-power.c',
1864 include_directories : includes,
1865 link_with : [libshared],
421f0012 1866 install_rpath : rootlibexecdir,
5c23128d
ZJS
1867 install : true,
1868 install_dir : rootlibexecdir)
1869
005a29f2
ZJS
1870exe = executable('systemd-detect-virt',
1871 'src/detect-virt/detect-virt.c',
1872 include_directories : includes,
1873 link_with : [libshared],
1874 install_rpath : rootlibexecdir,
1875 install : true)
1876public_programs += [exe]
1877
1878exe = executable('systemd-delta',
1879 'src/delta/delta.c',
1880 include_directories : includes,
1881 link_with : [libshared],
1882 install_rpath : rootlibexecdir,
1883 install : true)
1884public_programs += [exe]
1885
1886exe = executable('systemd-escape',
1887 'src/escape/escape.c',
1888 include_directories : includes,
1889 link_with : [libshared],
1890 install_rpath : rootlibexecdir,
1891 install : true,
1892 install_dir : rootbindir)
1893public_programs += [exe]
1894
1895exe = executable('systemd-notify',
1896 'src/notify/notify.c',
1897 include_directories : includes,
1898 link_with : [libshared],
1899 install_rpath : rootlibexecdir,
1900 install : true,
1901 install_dir : rootbindir)
1902public_programs += [exe]
5c23128d
ZJS
1903
1904executable('systemd-volatile-root',
1905 'src/volatile-root/volatile-root.c',
1906 include_directories : includes,
1907 link_with : [libshared],
421f0012 1908 install_rpath : rootlibexecdir,
5c23128d
ZJS
1909 install : true,
1910 install_dir : rootlibexecdir)
1911
1912executable('systemd-cgroups-agent',
1913 'src/cgroups-agent/cgroups-agent.c',
1914 include_directories : includes,
1915 link_with : [libshared],
421f0012 1916 install_rpath : rootlibexecdir,
5c23128d
ZJS
1917 install : true,
1918 install_dir : rootlibexecdir)
1919
005a29f2
ZJS
1920exe = executable('systemd-path',
1921 'src/path/path.c',
1922 include_directories : includes,
aac26058 1923 link_with : [libshared],
005a29f2
ZJS
1924 install_rpath : rootlibexecdir,
1925 install : true)
1926public_programs += [exe]
1927
1928exe = executable('systemd-ask-password',
1929 'src/ask-password/ask-password.c',
1930 include_directories : includes,
aac26058 1931 link_with : [libshared],
005a29f2
ZJS
1932 install_rpath : rootlibexecdir,
1933 install : true,
1934 install_dir : rootbindir)
1935public_programs += [exe]
5c23128d
ZJS
1936
1937executable('systemd-reply-password',
1938 'src/reply-password/reply-password.c',
1939 include_directories : includes,
aac26058 1940 link_with : [libshared],
421f0012 1941 install_rpath : rootlibexecdir,
5c23128d
ZJS
1942 install : true,
1943 install_dir : rootlibexecdir)
1944
005a29f2
ZJS
1945exe = executable('systemd-tty-ask-password-agent',
1946 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1947 include_directories : includes,
aac26058 1948 link_with : [libshared],
005a29f2
ZJS
1949 install_rpath : rootlibexecdir,
1950 install : true,
1951 install_dir : rootbindir)
1952public_programs += [exe]
1953
1954exe = executable('systemd-cgls',
1955 'src/cgls/cgls.c',
1956 include_directories : includes,
aac26058 1957 link_with : [libshared],
005a29f2
ZJS
1958 install_rpath : rootlibexecdir,
1959 install : true)
1960public_programs += [exe]
1961
1962exe = executable('systemd-cgtop',
1963 'src/cgtop/cgtop.c',
1964 include_directories : includes,
aac26058 1965 link_with : [libshared],
005a29f2
ZJS
1966 install_rpath : rootlibexecdir,
1967 install : true)
1968public_programs += [exe]
5c23128d
ZJS
1969
1970executable('systemd-initctl',
1971 'src/initctl/initctl.c',
1972 include_directories : includes,
aac26058 1973 link_with : [libshared],
421f0012 1974 install_rpath : rootlibexecdir,
5c23128d
ZJS
1975 install : true,
1976 install_dir : rootlibexecdir)
1977
005a29f2
ZJS
1978exe = executable('systemd-mount',
1979 'src/mount/mount-tool.c',
1980 include_directories : includes,
34ce0a52 1981 link_with : [libshared],
005a29f2
ZJS
1982 install_rpath : rootlibexecdir,
1983 install : true)
1984public_programs += [exe]
5c23128d 1985
7b76fce1 1986meson.add_install_script(meson_make_symlink,
e17e5ba9 1987 'systemd-mount', join_paths(bindir, 'systemd-umount'))
7b76fce1 1988
005a29f2
ZJS
1989exe = executable('systemd-run',
1990 'src/run/run.c',
1991 include_directories : includes,
aac26058 1992 link_with : [libshared],
005a29f2
ZJS
1993 install_rpath : rootlibexecdir,
1994 install : true)
1995public_programs += [exe]
1996
1997exe = executable('systemd-stdio-bridge',
1998 'src/stdio-bridge/stdio-bridge.c',
1999 include_directories : includes,
aac26058 2000 link_with : [libshared],
005a29f2
ZJS
2001 install_rpath : rootlibexecdir,
2002 install : true)
2003public_programs += [exe]
2004
2005exe = executable('busctl',
2006 'src/busctl/busctl.c',
2007 'src/busctl/busctl-introspect.c',
2008 'src/busctl/busctl-introspect.h',
2009 include_directories : includes,
aac26058 2010 link_with : [libshared],
005a29f2
ZJS
2011 install_rpath : rootlibexecdir,
2012 install : true)
2013public_programs += [exe]
5c23128d 2014
2c201c21 2015if conf.get('ENABLE_SYSUSERS', false)
37efbbd8
ZJS
2016 exe = executable('systemd-sysusers',
2017 'src/sysusers/sysusers.c',
2018 include_directories : includes,
2019 link_with : [libshared],
2020 install_rpath : rootlibexecdir,
2021 install : true,
2022 install_dir : rootbindir)
2023 public_programs += [exe]
5c23128d
ZJS
2024endif
2025
2c201c21 2026if conf.get('ENABLE_TMPFILES', false)
37efbbd8
ZJS
2027 exe = executable('systemd-tmpfiles',
2028 'src/tmpfiles/tmpfiles.c',
2029 include_directories : includes,
2030 link_with : [libshared],
2031 dependencies : [libacl],
2032 install_rpath : rootlibexecdir,
2033 install : true,
2034 install_dir : rootbindir)
2035 public_programs += [exe]
5c23128d
ZJS
2036endif
2037
2c201c21 2038if conf.get('ENABLE_HWDB', false)
37efbbd8
ZJS
2039 exe = executable('systemd-hwdb',
2040 'src/hwdb/hwdb.c',
2041 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2042 include_directories : includes,
0da6f396
MB
2043 link_with : [libudev_internal],
2044 install_rpath : udev_rpath,
37efbbd8
ZJS
2045 install : true,
2046 install_dir : rootbindir)
2047 public_programs += [exe]
2048endif
2049
2c201c21 2050if conf.get('ENABLE_QUOTACHECK', false)
37efbbd8
ZJS
2051 executable('systemd-quotacheck',
2052 'src/quotacheck/quotacheck.c',
005a29f2 2053 include_directories : includes,
aac26058 2054 link_with : [libshared],
005a29f2
ZJS
2055 install_rpath : rootlibexecdir,
2056 install : true,
37efbbd8 2057 install_dir : rootlibexecdir)
5c23128d
ZJS
2058endif
2059
005a29f2
ZJS
2060exe = executable('systemd-socket-proxyd',
2061 'src/socket-proxy/socket-proxyd.c',
2062 include_directories : includes,
aac26058 2063 link_with : [libshared],
005a29f2
ZJS
2064 dependencies : [threads],
2065 install_rpath : rootlibexecdir,
2066 install : true,
2067 install_dir : rootlibexecdir)
2068public_programs += [exe]
2069
2070exe = executable('systemd-udevd',
2071 systemd_udevd_sources,
2072 include_directories : includes,
2073 link_with : [libudev_core,
005a29f2 2074 libsystemd_network,
1aec3ed9 2075 libudev_internal],
3a30f21f
ZJS
2076 dependencies : [threads,
2077 libkmod,
005a29f2 2078 libidn,
aac26058
ZJS
2079 libacl,
2080 libblkid],
1aec3ed9 2081 install_rpath : udev_rpath,
005a29f2
ZJS
2082 install : true,
2083 install_dir : rootlibexecdir)
2084public_programs += [exe]
2085
2086exe = executable('udevadm',
2087 udevadm_sources,
2088 include_directories : includes,
2089 link_with : [libudev_core,
005a29f2 2090 libsystemd_network,
1aec3ed9 2091 libudev_internal],
3a30f21f
ZJS
2092 dependencies : [threads,
2093 libkmod,
005a29f2 2094 libidn,
aac26058
ZJS
2095 libacl,
2096 libblkid],
1aec3ed9 2097 install_rpath : udev_rpath,
005a29f2
ZJS
2098 install : true,
2099 install_dir : rootbindir)
2100public_programs += [exe]
5c23128d
ZJS
2101
2102executable('systemd-shutdown',
2103 systemd_shutdown_sources,
2104 include_directories : includes,
34ce0a52 2105 link_with : [libshared],
421f0012 2106 install_rpath : rootlibexecdir,
5c23128d
ZJS
2107 install : true,
2108 install_dir : rootlibexecdir)
2109
2110executable('systemd-update-done',
2111 'src/update-done/update-done.c',
2112 include_directories : includes,
2113 link_with : [libshared],
421f0012 2114 install_rpath : rootlibexecdir,
5c23128d
ZJS
2115 install : true,
2116 install_dir : rootlibexecdir)
2117
2118executable('systemd-update-utmp',
2119 'src/update-utmp/update-utmp.c',
2120 include_directories : includes,
aac26058 2121 link_with : [libshared],
5c23128d 2122 dependencies : [libaudit],
421f0012 2123 install_rpath : rootlibexecdir,
5c23128d
ZJS
2124 install : true,
2125 install_dir : rootlibexecdir)
2126
2c201c21 2127if conf.get('HAVE_KMOD', false)
37efbbd8
ZJS
2128 executable('systemd-modules-load',
2129 'src/modules-load/modules-load.c',
2130 include_directories : includes,
2131 link_with : [libshared],
2132 dependencies : [libkmod],
2133 install_rpath : rootlibexecdir,
2134 install : true,
2135 install_dir : rootlibexecdir)
94e75a54 2136
37efbbd8
ZJS
2137 meson.add_install_script('sh', '-c',
2138 mkdir_p.format(modulesloaddir))
2139 meson.add_install_script('sh', '-c',
2140 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
5c23128d
ZJS
2141endif
2142
005a29f2
ZJS
2143exe = executable('systemd-nspawn',
2144 systemd_nspawn_sources,
2145 'src/core/mount-setup.c', # FIXME: use a variable?
2146 'src/core/mount-setup.h',
2147 'src/core/loopback-setup.c',
2148 'src/core/loopback-setup.h',
2149 include_directories : [includes, include_directories('src/nspawn')],
0bc91152 2150 link_with : [libshared],
005a29f2
ZJS
2151 dependencies : [libacl,
2152 libblkid,
2153 libseccomp,
2154 libselinux],
2155 install_rpath : rootlibexecdir,
2156 install : true)
2157public_programs += [exe]
5c23128d 2158
2c201c21 2159if conf.get('ENABLE_NETWORKD', false)
37efbbd8
ZJS
2160 executable('systemd-networkd',
2161 systemd_networkd_sources,
2162 include_directories : includes,
2163 link_with : [libnetworkd_core,
37efbbd8
ZJS
2164 libsystemd_network,
2165 libudev_internal,
2166 libshared],
2167 install_rpath : rootlibexecdir,
2168 install : true,
2169 install_dir : rootlibexecdir)
2170
2171 executable('systemd-networkd-wait-online',
2172 systemd_networkd_wait_online_sources,
2173 include_directories : includes,
2174 link_with : [libnetworkd_core,
2175 libshared],
2176 install_rpath : rootlibexecdir,
2177 install : true,
2178 install_dir : rootlibexecdir)
f0bd7cc7 2179endif
5c23128d 2180
005a29f2
ZJS
2181exe = executable('networkctl',
2182 networkctl_sources,
2183 include_directories : includes,
2184 link_with : [libsystemd_network,
aac26058 2185 libshared],
005a29f2
ZJS
2186 install_rpath : rootlibexecdir,
2187 install : true,
2188 install_dir : rootbindir)
2189public_programs += [exe]
5c23128d 2190
69e96427
ZJS
2191############################################################
2192
2193foreach tuple : tests
37efbbd8
ZJS
2194 sources = tuple[0]
2195 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2196 dependencies = tuple[2]
2197 condition = tuple.length() >= 4 ? tuple[3] : ''
2198 type = tuple.length() >= 5 ? tuple[4] : ''
2199 defs = tuple.length() >= 6 ? tuple[5] : []
2200 incs = tuple.length() >= 7 ? tuple[6] : includes
2201 timeout = 30
2202
2203 name = sources[0].split('/')[-1].split('.')[0]
2204 if type.startswith('timeout=')
2205 timeout = type.split('=')[1].to_int()
2206 type = ''
2207 endif
2208
2c201c21 2209 if condition == '' or conf.get(condition, false)
37efbbd8
ZJS
2210 install = install_tests and type == ''
2211
2212 exe = executable(
2213 name,
2214 sources,
2215 include_directories : incs,
2216 link_with : link_with,
2217 dependencies : dependencies,
2218 c_args : defs,
2219 install_rpath : rootlibexecdir,
2220 install : install,
2221 install_dir : testsdir)
2222
2223 if type == 'manual'
2224 message('@0@ is a manual test'.format(name))
2225 elif type == 'unsafe' and want_tests != 'unsafe'
2226 message('@0@ is an unsafe test'.format(name))
2227 else
2228 test(name, exe,
2229 env : test_env,
2230 timeout : timeout)
2231 endif
2232 else
2233 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2234 endif
69e96427
ZJS
2235endforeach
2236
37ab1a25 2237test_libsystemd_sym = executable(
37efbbd8
ZJS
2238 'test-libsystemd-sym',
2239 test_libsystemd_sym_c,
2240 include_directories : includes,
2241 link_with : [libsystemd],
2242 install : install_tests,
2243 install_dir : testsdir)
37ab1a25
ZJS
2244test('test-libsystemd-sym',
2245 test_libsystemd_sym)
2246
e0bec52f 2247test_libudev_sym = executable(
37efbbd8
ZJS
2248 'test-libudev-sym',
2249 test_libudev_sym_c,
2250 include_directories : includes,
2251 c_args : ['-Wno-deprecated-declarations'],
2252 link_with : [libudev],
2253 install : install_tests,
2254 install_dir : testsdir)
e0bec52f
ZJS
2255test('test-libudev-sym',
2256 test_libudev_sym)
2257
69e96427 2258############################################################
5c23128d
ZJS
2259
2260make_directive_index_py = find_program('tools/make-directive-index.py')
2261make_man_index_py = find_program('tools/make-man-index.py')
b184e8fe 2262xml_helper_py = find_program('tools/xml_helper.py')
abba22c5 2263hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
5c23128d
ZJS
2264
2265subdir('units')
2266subdir('sysctl.d')
2267subdir('sysusers.d')
2268subdir('tmpfiles.d')
2269subdir('rules')
2270subdir('hwdb')
2271subdir('network')
2272subdir('man')
2273subdir('shell-completion/bash')
2274subdir('shell-completion/zsh')
2275subdir('docs/sysvinit')
2276subdir('docs/var-log')
2277
2278# FIXME: figure out if the warning is true:
2279# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2280install_subdir('factory/etc',
2281 install_dir : factorydir)
2282
2283
2284install_data('xorg/50-systemd-user.sh',
2285 install_dir : xinitrcdir)
2286install_data('system-preset/90-systemd.preset',
2287 install_dir : systempresetdir)
2288install_data('README',
2289 'NEWS',
2290 'CODING_STYLE',
2291 'DISTRO_PORTING',
2292 'ENVIRONMENT.md',
2293 'LICENSE.GPL2',
2294 'LICENSE.LGPL2.1',
2295 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2296 install_dir : docdir)
d68b342b 2297
94e75a54
ZJS
2298meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2299meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2300
d68b342b
ZJS
2301############################################################
2302
005a29f2
ZJS
2303meson_check_help = find_program('tools/meson-check-help.sh')
2304
2305foreach exec : public_programs
37efbbd8
ZJS
2306 name = exec.full_path().split('/')[-1]
2307 test('check-help-' + name,
2308 meson_check_help,
2309 args : [exec.full_path()])
005a29f2
ZJS
2310endforeach
2311
2312############################################################
2313
d68b342b 2314if git.found() and etags.found()
37efbbd8
ZJS
2315 all_files = run_command(
2316 git,
2317 ['--git-dir=@0@/.git'.format(meson.source_root()),
2318 'ls-files',
2319 ':/*.[ch]'])
2320 all_files = files(all_files.stdout().split())
d68b342b 2321
37efbbd8
ZJS
2322 custom_target(
2323 'TAGS',
2324 output : 'TAGS',
2325 input : all_files,
2326 command : [etags, '-o', '@OUTPUT@'] + all_files)
d68b342b 2327endif
177929c2
ZJS
2328
2329if git.found()
37efbbd8 2330 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
a923e085 2331 run_target(
37efbbd8 2332 'git-contrib',
37efbbd8 2333 command : [meson_git_contrib_sh])
177929c2 2334endif
dd6ab3df
ZJS
2335
2336if git.found()
2337 git_head = run_command(
2338 git,
2339 ['--git-dir=@0@/.git'.format(meson.source_root()),
2340 'rev-parse', 'HEAD']).stdout().strip()
2341 git_head_short = run_command(
2342 git,
2343 ['--git-dir=@0@/.git'.format(meson.source_root()),
2344 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2345
2346 run_target(
2347 'git-snapshot',
2348 command : ['git', 'archive',
2349 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.source_root(),
2350 git_head_short),
2351 '--prefix', 'systemd-@0@/'.format(git_head),
2352 'HEAD'])
2353endif
829257d1
ZJS
2354
2355############################################################
2356
2357status = [
2358 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2359
2360 'prefix: @0@'.format(prefixdir),
2361 'rootprefix: @0@'.format(rootprefixdir),
2362 'sysconf dir: @0@'.format(sysconfdir),
2363 'includedir: @0@'.format(includedir),
2364 'lib dir: @0@'.format(libdir),
2365 'rootlib dir: @0@'.format(rootlibdir),
2366 'SysV init scripts: @0@'.format(sysvinit_path),
2367 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2368 'PAM modules dir: @0@'.format(pamlibdir),
2369 'PAM configuration dir: @0@'.format(pamconfdir),
2370 'RPM macros dir: @0@'.format(rpmmacrosdir),
2371 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2372 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2373 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2374 'bash completions dir: @0@'.format(bashcompletiondir),
2375 'zsh completions dir: @0@'.format(zshcompletiondir),
2376 'extra start script: @0@'.format(get_option('rc-local')),
2377 'extra stop script: @0@'.format(get_option('halt-local')),
2378 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2379 get_option('debug-tty')),
2380 'TTY GID: @0@'.format(tty_gid),
2381 'maximum system UID: @0@'.format(system_uid_max),
2382 'maximum system GID: @0@'.format(system_gid_max),
2383 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2384 'certificate root: @0@'.format(get_option('certificate-root')),
2385 'support URL: @0@'.format(support_url),
2386 'nobody user name: @0@'.format(get_option('nobody-user')),
2387 'nobody group name: @0@'.format(get_option('nobody-group')),
2388 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2389
2390 'default DNSSEC mode: @0@'.format(default_dnssec),
2391 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2392 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2393
2394alt_dns_servers = '\n '.join(dns_servers.split(' '))
2395alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2396status += [
2397 'default DNS servers: @0@'.format(alt_dns_servers),
2398 'default NTP servers: @0@'.format(alt_ntp_servers)]
2399
2400alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2401 '@@0@'.format(time_epoch)).stdout().strip()
2402status += [
2403 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2404
2405# TODO:
2406# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2407# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2408# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2409
2c201c21 2410if conf.get('ENABLE_EFI', false)
829257d1
ZJS
2411 status += [
2412 'efi arch: @0@'.format(efi_arch)]
2413
2414 if have_gnu_efi
2415 status += [
2416 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2417 'EFI CC @0@'.format(efi_cc),
2418 'EFI libdir: @0@'.format(efi_libdir),
2419 'EFI ldsdir: @0@'.format(efi_ldsdir),
2420 'EFI includedir: @0@'.format(efi_incdir)]
2421 endif
2422endif
2423
2424found = []
2425missing = []
2426
2427foreach tuple : [
2428 ['libcryptsetup'],
2429 ['PAM'],
2430 ['AUDIT'],
2431 ['IMA'],
2432 ['AppArmor'],
2433 ['SELinux'],
2434 ['SECCOMP'],
2435 ['SMACK'],
2436 ['zlib'],
2437 ['xz'],
2438 ['lz4'],
2439 ['bzip2'],
2440 ['ACL'],
2441 ['gcrypt'],
2442 ['qrencode'],
2443 ['microhttpd'],
2444 ['gnutls'],
2445 ['libcurl'],
87057e24 2446 ['libidn2'],
829257d1
ZJS
2447 ['libidn'],
2448 ['libiptc'],
2449 ['elfutils'],
2450 ['binfmt'],
2451 ['vconsole'],
2452 ['quotacheck'],
2453 ['tmpfiles'],
2454 ['environment.d'],
2455 ['sysusers'],
2456 ['firstboot'],
2457 ['randomseed'],
2458 ['backlight'],
2459 ['rfkill'],
2460 ['logind'],
2461 ['machined'],
2462 ['importd'],
2463 ['hostnamed'],
2464 ['timedated'],
2465 ['timesyncd'],
2466 ['localed'],
2467 ['networkd'],
2468 ['resolved'],
2469 ['coredump'],
2470 ['polkit'],
2471 ['legacy pkla', install_polkit_pkla],
2472 ['efi'],
2473 ['gnu-efi', have_gnu_efi],
2474 ['kmod'],
2475 ['xkbcommon'],
2476 ['blkid'],
2477 ['dbus'],
2478 ['glib'],
2c201c21 2479 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
829257d1
ZJS
2480 ['hwdb'],
2481 ['tpm'],
2482 ['man pages', want_man],
2483 ['html pages', want_html],
2484 ['man page indices', want_man and have_lxml],
2c201c21 2485 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
829257d1
ZJS
2486 ['SysV compat'],
2487 ['utmp'],
2488 ['ldconfig'],
2489 ['hibernate'],
2490 ['adm group', get_option('adm-group')],
2491 ['wheel group', get_option('wheel-group')],
b14e1b43 2492 ['gshadow'],
829257d1
ZJS
2493 ['debug hashmap'],
2494 ['debug mmap cache'],
2495]
2496
2497 cond = tuple.get(1, '')
2498 if cond == ''
2499 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2500 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2c201c21 2501 cond = conf.get(ident1, false) or conf.get(ident2, false)
829257d1
ZJS
2502 endif
2503 if cond
2504 found += [tuple[0]]
2505 else
2506 missing += [tuple[0]]
2507 endif
2508endforeach
2509
2510status += [
2511 'enabled features: @0@'.format(', '.join(found)),
2512 'disabled features: @0@'.format(', '.join(missing))]
2513message('\n '.join(status))