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