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