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