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