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