blob: c62d2afccd8a0407ccf2133f484557a3238d0f21 [file] [log] [blame]
Zbigniew Jędrzejewski-Szmek3a726fc2017-11-18 18:32:01 +01001# SPDX-License-Identifier: LGPL-2.1+
2#
3# Copyright 2017 Zbigniew Jędrzejewski-Szmek
Zbigniew Jędrzejewski-Szmek3a726fc2017-11-18 18:32:01 +01004
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04005project('systemd', 'c',
Zbigniew Jędrzejewski-Szmekad6a0852018-03-05 17:12:48 +01006 version : '238',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04007 license : 'LGPLv2+',
8 default_options: [
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04009 'c_std=gnu99',
10 'prefix=/usr',
11 'sysconfdir=/etc',
12 'localstatedir=/var',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040013 ],
Yu Watanabe8ea9fad2018-05-10 14:50:52 +090014 meson_version : '>= 0.44',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040015 )
16
Zbigniew Jędrzejewski-Szmekad6a0852018-03-05 17:12:48 +010017libsystemd_version = '0.22.0'
18libudev_version = '1.6.10'
Zbigniew Jędrzejewski-Szmek56d50ab2017-09-28 19:24:16 +020019
Yu Watanabe348b4432018-05-07 18:17:35 +090020# We need the same data in two different formats, ugh!
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040021# Also, for hysterical reasons, we use different variable
22# names, sometimes. Not all variables are included in every
23# set. Ugh, ugh, ugh!
24conf = configuration_data()
25conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
26conf.set_quoted('PACKAGE_VERSION', meson.project_version())
27
28substs = configuration_data()
29substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
30substs.set('PACKAGE_VERSION', meson.project_version())
31
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040032#####################################################################
33
Zbigniew Jędrzejewski-Szmek003c8872017-07-24 04:41:45 -040034# Try to install the git pre-commit hook
35git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
36if git_hook.returncode() == 0
37 message(git_hook.stdout().strip())
38endif
39
40#####################################################################
41
Zbigniew Jędrzejewski-Szmek26754132018-03-01 11:49:42 +010042if get_option('split-usr') == 'auto'
43 split_usr = run_command('test', '-L', '/bin').returncode() != 0
44else
45 split_usr = get_option('split-usr') == 'true'
46endif
Zbigniew Jędrzejewski-Szmek671f0f82018-03-01 21:48:36 +010047conf.set10('HAVE_SPLIT_USR', split_usr,
48 description : '/usr/bin and /bin directories are separate')
Zbigniew Jędrzejewski-Szmek9a8e64b2017-11-28 21:46:53 +010049
Zbigniew Jędrzejewski-Szmek157baa82018-03-01 10:28:29 +010050if get_option('split-bin') == 'auto'
51 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
52else
53 split_bin = get_option('split-bin') == 'true'
54endif
Zbigniew Jędrzejewski-Szmek671f0f82018-03-01 21:48:36 +010055conf.set10('HAVE_SPLIT_BIN', split_bin,
56 description : 'bin and sbin directories are separate')
Zbigniew Jędrzejewski-Szmek157baa82018-03-01 10:28:29 +010057
Zbigniew Jędrzejewski-Szmek74344a12017-11-28 20:00:10 +010058rootprefixdir = get_option('rootprefix')
Zbigniew Jędrzejewski-Szmek74344a12017-11-28 20:00:10 +010059# Unusual rootprefixdir values are used by some distros
60# (see https://github.com/systemd/systemd/pull/7461).
Zbigniew Jędrzejewski-Szmekba7f4ae2018-02-28 10:20:48 +010061rootprefix_default = split_usr ? '/' : '/usr'
Zbigniew Jędrzejewski-Szmek9a8e64b2017-11-28 21:46:53 +010062if rootprefixdir == ''
63 rootprefixdir = rootprefix_default
Zbigniew Jędrzejewski-Szmek74344a12017-11-28 20:00:10 +010064endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040065
66sysvinit_path = get_option('sysvinit-path')
67sysvrcnd_path = get_option('sysvrcnd-path')
Yu Watanabe348b4432018-05-07 18:17:35 +090068conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +020069 description : 'SysV init scripts and rcN.d links are supported')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040070
71# join_paths ignore the preceding arguments if an absolute component is
72# encountered, so this should canonicalize various paths when they are
73# absolute or relative.
74prefixdir = get_option('prefix')
75if not prefixdir.startswith('/')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040076 error('Prefix is not absolute: "@0@"'.format(prefixdir))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040077endif
78bindir = join_paths(prefixdir, get_option('bindir'))
79libdir = join_paths(prefixdir, get_option('libdir'))
80sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
81includedir = join_paths(prefixdir, get_option('includedir'))
82datadir = join_paths(prefixdir, get_option('datadir'))
83localstatedir = join_paths('/', get_option('localstatedir'))
84
85rootbindir = join_paths(rootprefixdir, 'bin')
Zbigniew Jędrzejewski-Szmek157baa82018-03-01 10:28:29 +010086rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040087rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
88
89rootlibdir = get_option('rootlibdir')
90if rootlibdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040091 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040092endif
93
94# Dirs of external packages
Michael Bieble17e5ba2017-04-13 10:30:56 -040095pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
96pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
97polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
98polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
99polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
100varlogdir = join_paths(localstatedir, 'log')
101xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
Yu Watanabe8a38aac2017-11-23 22:20:22 +0900102rpmmacrosdir = get_option('rpmmacrosdir')
103if rpmmacrosdir != 'no'
104 rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
105endif
Michael Biebl02fa0542017-10-21 08:32:50 +0200106modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400107
108# Our own paths
Michael Bieble17e5ba2017-04-13 10:30:56 -0400109pkgdatadir = join_paths(datadir, 'systemd')
110environmentdir = join_paths(prefixdir, 'lib/environment.d')
111pkgsysconfdir = join_paths(sysconfdir, 'systemd')
112userunitdir = join_paths(prefixdir, 'lib/systemd/user')
113userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
114tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
115sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
116sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
117binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
118modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
119networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
120pkgincludedir = join_paths(includedir, 'systemd')
121systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
122usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
123systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
124userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
125systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
126systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
127systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
128systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
129udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
130udevhomedir = udevlibexecdir
131udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
132udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
133catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
134kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
135factorydir = join_paths(datadir, 'factory')
Michael Bieble17e5ba2017-04-13 10:30:56 -0400136bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
137testsdir = join_paths(prefixdir, 'lib/systemd/tests')
138systemdstatedir = join_paths(localstatedir, 'lib/systemd')
139catalogstatedir = join_paths(systemdstatedir, 'catalog')
140randomseeddir = join_paths(localstatedir, 'lib/systemd')
Lennart Poettering61d05782018-04-16 21:41:40 +0200141profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400142
tblume75aaade2018-02-01 22:46:15 +0100143docdir = get_option('docdir')
144if docdir == ''
145 docdir = join_paths(datadir, 'doc/systemd')
146endif
147
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400148dbuspolicydir = get_option('dbuspolicydir')
149if dbuspolicydir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400150 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400151endif
152
153dbussessionservicedir = get_option('dbussessionservicedir')
154if dbussessionservicedir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400155 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400156endif
157
158dbussystemservicedir = get_option('dbussystemservicedir')
159if dbussystemservicedir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400160 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400161endif
162
163pamlibdir = get_option('pamlibdir')
164if pamlibdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400165 pamlibdir = join_paths(rootlibdir, 'security')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400166endif
167
168pamconfdir = get_option('pamconfdir')
169if pamconfdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400170 pamconfdir = join_paths(sysconfdir, 'pam.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400171endif
172
Zbigniew Jędrzejewski-Szmek444d5862018-02-15 11:43:08 +0100173memory_accounting_default = get_option('memory-accounting-default')
174
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400175conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400176conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400177conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
178conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
179conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400180conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
181conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
Alexander F Rødseth96164a32018-03-01 13:12:02 +0100182
Zbigniew Jędrzejewski-Szmekf7c54272018-03-02 09:09:29 +0100183conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
Alexander F Rødseth96164a32018-03-01 13:12:02 +0100184
Michael Bieble17e5ba2017-04-13 10:30:56 -0400185conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400186conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
187conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400188conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
189conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
190conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
191conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
Zbigniew Jędrzejewski-Szmekda495a02017-11-21 23:18:05 +0100192conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
Zbigniew Jędrzejewski-Szmek7f2806d2017-11-29 20:02:11 +0100193conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400194conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
195conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
196conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
197conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
198conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
Zbigniew Jędrzejewski-Szmek74344a12017-11-28 20:00:10 +0100199conf.set_quoted('ROOTPREFIX', rootprefixdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400200conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400201conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
202conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400203conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
204conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
205conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
206conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
207conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
208conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400209conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
210conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400211conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400212conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400213conf.set_quoted('LIBDIR', libdir)
214conf.set_quoted('ROOTLIBDIR', rootlibdir)
215conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
216conf.set_quoted('BOOTLIBDIR', bootlibdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400217conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
218conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
219conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
220conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
221conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
222conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
Zbigniew Jędrzejewski-Szmek444d5862018-02-15 11:43:08 +0100223conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false')
Michal Koutný7f672e82018-03-09 18:27:13 +0100224conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400225
226conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
227conf.set_quoted('ABS_SRC_DIR', meson.source_root())
228
229substs.set('prefix', prefixdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400230substs.set('exec_prefix', prefixdir)
231substs.set('libdir', libdir)
232substs.set('rootlibdir', rootlibdir)
233substs.set('includedir', includedir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400234substs.set('pkgsysconfdir', pkgsysconfdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400235substs.set('bindir', bindir)
236substs.set('rootbindir', rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400237substs.set('rootlibexecdir', rootlibexecdir)
238substs.set('systemunitdir', systemunitdir)
239substs.set('userunitdir', userunitdir)
240substs.set('systempresetdir', systempresetdir)
241substs.set('userpresetdir', userpresetdir)
242substs.set('udevhwdbdir', udevhwdbdir)
243substs.set('udevrulesdir', udevrulesdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400244substs.set('udevlibexecdir', udevlibexecdir)
Zbigniew Jędrzejewski-Szmek424e80b2018-05-19 17:02:37 +0200245substs.set('environmentdir', environmentdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400246substs.set('catalogdir', catalogdir)
247substs.set('tmpfilesdir', tmpfilesdir)
248substs.set('sysusersdir', sysusersdir)
249substs.set('sysctldir', sysctldir)
250substs.set('binfmtdir', binfmtdir)
251substs.set('modulesloaddir', modulesloaddir)
Zbigniew Jędrzejewski-Szmek424e80b2018-05-19 17:02:37 +0200252substs.set('modprobedir', modprobedir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400253substs.set('systemgeneratordir', systemgeneratordir)
254substs.set('usergeneratordir', usergeneratordir)
255substs.set('systemenvgeneratordir', systemenvgeneratordir)
256substs.set('userenvgeneratordir', userenvgeneratordir)
257substs.set('systemshutdowndir', systemshutdowndir)
258substs.set('systemsleepdir', systemsleepdir)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400259substs.set('VARLOGDIR', varlogdir)
260substs.set('CERTIFICATEROOT', get_option('certificate-root'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400261substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
262substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400263substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
264substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
265substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
266substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
Zbigniew Jędrzejewski-Szmek444d5862018-02-15 11:43:08 +0100267substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400268
269#####################################################################
270
271cc = meson.get_compiler('c')
272pkgconfig = import('pkgconfig')
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400273check_compilation_sh = find_program('tools/meson-check-compilation.sh')
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +1100274meson_build_sh = find_program('tools/meson-build.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400275
Adam Duskett08318a22018-01-15 06:25:46 -0500276if get_option('tests') != 'false'
277 cxx = find_program('c++', required : false)
278 if cxx.found()
279 # Used only for tests
280 add_languages('cpp')
281 endif
Zbigniew Jędrzejewski-Szmek94e25232017-05-13 13:23:28 -0400282endif
283
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500284want_ossfuzz = get_option('oss-fuzz')
285want_libfuzzer = get_option('llvm-fuzz')
286fuzzer_build = want_ossfuzz or want_libfuzzer
287if want_ossfuzz and want_libfuzzer
288 error('only one of oss-fuzz and llvm-fuzz can be specified')
289endif
290if want_libfuzzer
291 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
292endif
293if want_ossfuzz
Jonathan Rudenberg7db7d5b2018-01-13 19:51:07 -0500294 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
295endif
296
Yu Watanabe30a4ddf2018-05-10 15:30:42 +0900297possible_cc_flags = [
298 '-Wextra',
299 '-Werror=undef',
300 '-Wlogical-op',
301 '-Wmissing-include-dirs',
302 '-Wold-style-definition',
303 '-Wpointer-arith',
304 '-Winit-self',
Yu Watanabe30a4ddf2018-05-10 15:30:42 +0900305 '-Wfloat-equal',
306 '-Wsuggest-attribute=noreturn',
307 '-Werror=missing-prototypes',
308 '-Werror=implicit-function-declaration',
309 '-Werror=missing-declarations',
310 '-Werror=return-type',
311 '-Werror=incompatible-pointer-types',
312 '-Werror=format=2',
313 '-Wstrict-prototypes',
314 '-Wredundant-decls',
315 '-Wmissing-noreturn',
316 '-Wimplicit-fallthrough=5',
317 '-Wshadow',
318 '-Wendif-labels',
319 '-Wstrict-aliasing=2',
320 '-Wwrite-strings',
321 '-Werror=overflow',
Zbigniew Jędrzejewski-Szmekb05ecb82018-06-09 13:12:52 +0200322 '-Werror=shift-count-overflow',
Zbigniew Jędrzejewski-Szmekd28b67d2018-06-11 13:17:43 +0200323 '-Werror=shift-overflow=2',
Yu Watanabe30a4ddf2018-05-10 15:30:42 +0900324 '-Wdate-time',
325 '-Wnested-externs',
326 '-ffast-math',
327 '-fno-common',
328 '-fdiagnostics-show-option',
329 '-fno-strict-aliasing',
330 '-fvisibility=hidden',
331 '-fstack-protector',
332 '-fstack-protector-strong',
333 '--param=ssp-buffer-size=4',
334]
335
336# --as-needed and --no-undefined are provided by meson by default,
337# run mesonconf to see what is enabled
338possible_link_flags = [
339 '-Wl,-z,relro',
340 '-Wl,-z,now',
341]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400342
Jonathan Rudenberg7db7d5b2018-01-13 19:51:07 -0500343# the oss-fuzz fuzzers are not built with -fPIE, so don't
344# enable it when we are linking against them
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500345if not fuzzer_build
Yu Watanabe30a4ddf2018-05-10 15:30:42 +0900346 possible_cc_flags += '-fPIE'
347 possible_link_flags += '-pie'
Jonathan Rudenberg7db7d5b2018-01-13 19:51:07 -0500348endif
349
Yu Watanabe30a4ddf2018-05-10 15:30:42 +0900350if cc.get_id() == 'clang'
351 possible_cc_flags += [
352 '-Wno-typedef-redefinition',
353 '-Wno-gnu-variable-sized-type-not-at-end',
354 ]
355endif
356
357if get_option('buildtype') != 'debug'
358 possible_cc_flags += [
359 '-ffunction-sections',
360 '-fdata-sections',
361 ]
362
363 possible_link_flags += '-Wl,--gc-sections'
364endif
365
366add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
367
Zbigniew Jędrzejewski-Szmek2c5434a2017-04-27 10:05:41 -0400368# "negative" arguments: gcc on purpose does not return an error for "-Wno-"
Zbigniew Jędrzejewski-Szmekd40f5cc2018-06-07 15:08:02 +0200369# arguments, just emits a warning. So test for the "positive" version instead.
Zbigniew Jędrzejewski-Szmek2c5434a2017-04-27 10:05:41 -0400370foreach arg : ['unused-parameter',
371 'missing-field-initializers',
372 'unused-result',
Zbigniew Jędrzejewski-Szmekfb1b5882017-09-04 19:49:12 +0300373 'format-signedness',
374 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
375 ]
Zbigniew Jędrzejewski-Szmek2c5434a2017-04-27 10:05:41 -0400376 if cc.has_argument('-W' + arg)
377 add_project_arguments('-Wno-' + arg, language : 'c')
378 endif
379endforeach
380
Caio Marcelo de Oliveira Filho9e70f2f2018-02-19 01:37:19 -0800381if cc.compiles('''
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400382 #include <time.h>
383 #include <inttypes.h>
384 typedef uint64_t usec_t;
385 usec_t now(clockid_t clock);
386 int main(void) {
387 struct timespec now;
388 return 0;
389 }
Caio Marcelo de Oliveira Filho9e70f2f2018-02-19 01:37:19 -0800390''', name : '-Werror=shadow with local shadowing')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400391 add_project_arguments('-Werror=shadow', language : 'c')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400392endif
393
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400394link_test_c = files('tools/meson-link-test.c')
395
Yu Watanabe30a4ddf2018-05-10 15:30:42 +0900396foreach arg : possible_link_flags
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400397 have = run_command(check_compilation_sh,
398 cc.cmd_array(), '-x', 'c', arg,
399 '-include', link_test_c).returncode() == 0
400 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
Yu Watanabe30a4ddf2018-05-10 15:30:42 +0900401 if have
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400402 add_project_link_arguments(arg, language : 'c')
403 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400404endforeach
405
Zbigniew Jędrzejewski-Szmek9cc0e6e2017-04-11 10:25:34 -0400406cpp = ' '.join(cc.cmd_array()) + ' -E'
407
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400408#####################################################################
409# compilation result tests
410
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400411conf.set('_GNU_SOURCE', true)
412conf.set('__SANE_USERSPACE_TYPES__', true)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400413
414conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
415conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
416conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
417conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
418conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
419conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
420conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
421
422decl_headers = '''
423#include <uchar.h>
424#include <linux/ethtool.h>
Susant Sahanibce67bb2017-09-14 19:51:39 +0000425#include <linux/fib_rules.h>
Lennart Poettering4c2e1b32018-02-20 12:48:33 +0100426#include <linux/stat.h>
427#include <sys/stat.h>
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400428'''
429# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
430
431foreach decl : ['char16_t',
432 'char32_t',
433 'key_serial_t',
434 'struct ethtool_link_settings',
Susant Sahanibce67bb2017-09-14 19:51:39 +0000435 'struct fib_rule_uid_range',
Lennart Poettering4c2e1b32018-02-20 12:48:33 +0100436 'struct statx',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400437 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400438
439 # We get -1 if the size cannot be determined
440 have = cc.sizeof(decl, prefix : decl_headers) > 0
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200441 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400442endforeach
443
444foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
445 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
446 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
447 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
Susant Sahanid3848262017-12-23 23:25:03 +0530448 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400449 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
450 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
451 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
452 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
453 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
Susant Sahani9dfed8d2017-04-25 20:30:34 +0530454 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400455 # if_tunnel.h is buggy and cannot be included on its own
456 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
457 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
458 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
459 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
460 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
461 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
462 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
Susant Sahanid3848262017-12-23 23:25:03 +0530463 ['IPVLAN_F_PRIVATE', 'linux/if_link.h'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400464 ['NDA_IFINDEX', 'linux/neighbour.h'],
465 ['IFA_FLAGS', 'linux/if_addr.h'],
Susant Sahanibce67bb2017-09-14 19:51:39 +0000466 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400467 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
Susant Sahanid6df5832017-11-22 12:53:22 +0530468 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400469 ]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400470 prefix = decl.length() > 2 ? decl[2] : ''
471 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
Zbigniew Jędrzejewski-Szmek4b9545f2017-10-03 10:32:34 +0200472 conf.set10('HAVE_' + decl[0], have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400473endforeach
474
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400475foreach ident : ['secure_getenv', '__secure_getenv']
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200476 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400477endforeach
478
479foreach ident : [
Lennart Poettering85db59b2017-12-25 12:01:14 +0100480 ['memfd_create', '''#include <sys/mman.h>'''],
Lennart Poettering7b961e42017-12-25 12:35:28 +0100481 ['gettid', '''#include <sys/types.h>
482 #include <unistd.h>'''],
Lennart Poettering3c042ad2017-12-25 12:07:40 +0100483 ['pivot_root', '''#include <stdlib.h>
484 #include <unistd.h>'''], # no known header declares pivot_root
Lennart Poettering85db59b2017-12-25 12:01:14 +0100485 ['name_to_handle_at', '''#include <sys/types.h>
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400486 #include <sys/stat.h>
487 #include <fcntl.h>'''],
Lennart Poettering85db59b2017-12-25 12:01:14 +0100488 ['setns', '''#include <sched.h>'''],
Lennart Poettering2acfd0f2017-12-25 12:35:43 +0100489 ['renameat2', '''#include <stdio.h>
490 #include <fcntl.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400491 ['kcmp', '''#include <linux/kcmp.h>'''],
492 ['keyctl', '''#include <sys/types.h>
493 #include <keyutils.h>'''],
Lennart Poettering85db59b2017-12-25 12:01:14 +0100494 ['copy_file_range', '''#include <sys/syscall.h>
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400495 #include <unistd.h>'''],
Daniel Mack71e52002016-10-18 17:57:10 +0200496 ['bpf', '''#include <sys/syscall.h>
497 #include <unistd.h>'''],
Lennart Poettering4c2e1b32018-02-20 12:48:33 +0100498 ['statx', '''#include <sys/types.h>
499 #include <sys/stat.h>
500 #include <unistd.h>'''],
Zbigniew Jędrzejewski-Szmekaa484f32018-02-26 21:20:00 +0100501 ['explicit_bzero' , '''#include <string.h>'''],
502 ['reallocarray', '''#include <malloc.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400503]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400504
Lennart Poettering85db59b2017-12-25 12:01:14 +0100505 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
Zbigniew Jędrzejewski-Szmek4b9545f2017-10-03 10:32:34 +0200506 conf.set10('HAVE_' + ident[0].to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400507endforeach
508
Lennart Poettering85db59b2017-12-25 12:01:14 +0100509if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200510 conf.set10('USE_SYS_RANDOM_H', true)
Zbigniew Jędrzejewski-Szmek4b9545f2017-10-03 10:32:34 +0200511 conf.set10('HAVE_GETRANDOM', true)
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400512else
513 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200514 conf.set10('USE_SYS_RANDOM_H', false)
Zbigniew Jędrzejewski-Szmek4b9545f2017-10-03 10:32:34 +0200515 conf.set10('HAVE_GETRANDOM', have)
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400516endif
517
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400518#####################################################################
519
520sed = find_program('sed')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400521awk = find_program('awk')
Zbigniew Jędrzejewski-Szmekd730e2d2017-04-25 08:49:58 -0400522m4 = find_program('m4')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400523stat = find_program('stat')
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -0400524git = find_program('git', required : false)
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +1100525env = find_program('env')
Zbigniew Jędrzejewski-Szmekb1ffacb2018-03-22 08:34:21 +0100526perl = find_program('perl', required : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400527
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -0400528meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400529mkdir_p = 'mkdir -p $DESTDIR/@0@'
Zbigniew Jędrzejewski-Szmekd83f4f52017-04-16 12:04:46 -0400530test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
531splash_bmp = files('test/splash.bmp')
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400532
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400533# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
534# /usr/sbin, /sbin, and fall back to the default from middle column.
Mike Gilbert2fa645f2018-01-04 07:14:20 -0500535progs = [['quotaon', '/usr/sbin/quotaon' ],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400536 ['quotacheck', '/usr/sbin/quotacheck' ],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400537 ['kmod', '/usr/bin/kmod' ],
538 ['kexec', '/usr/sbin/kexec' ],
539 ['sulogin', '/usr/sbin/sulogin' ],
540 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
541 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
542 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
543 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
544 ]
545foreach prog : progs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400546 path = get_option(prog[0] + '-path')
547 if path != ''
548 message('Using @1@ for @0@'.format(prog[0], path))
549 else
550 exe = find_program(prog[0],
551 '/usr/sbin/' + prog[0],
552 '/sbin/' + prog[0],
553 required: false)
554 path = exe.found() ? exe.path() : prog[1]
555 endif
556 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
557 conf.set_quoted(name, path)
558 substs.set(name, path)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400559endforeach
560
Mike Gilbert2fa645f2018-01-04 07:14:20 -0500561conf.set_quoted('TELINIT', get_option('telinit-path'))
562
Zbigniew Jędrzejewski-Szmek1276a9f2017-04-18 19:11:54 -0400563if run_command('ln', '--relative', '--help').returncode() != 0
Zbigniew Jędrzejewski-Szmekcd001012018-03-09 08:56:23 +0100564 error('ln does not support --relative (added in coreutils 8.16)')
Zbigniew Jędrzejewski-Szmek1276a9f2017-04-18 19:11:54 -0400565endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400566
567############################################################
568
569gperf = find_program('gperf')
570
571gperf_test_format = '''
572#include <string.h>
573const char * in_word_set(const char *, @0@);
574@1@
575'''
576gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
577gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
578gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
579if cc.compiles(gperf_test)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400580 gperf_len_type = 'size_t'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400581else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400582 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
583 if cc.compiles(gperf_test)
584 gperf_len_type = 'unsigned'
585 else
586 error('unable to determine gperf len type')
587 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400588endif
589message('gperf len type is @0@'.format(gperf_len_type))
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400590conf.set('GPERF_LEN_TYPE', gperf_len_type,
591 description : 'The type of gperf "len" parameter')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400592
593############################################################
594
595if not cc.has_header('sys/capability.h')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400596 error('POSIX caps headers not found')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400597endif
Björn Esser9f555bb2018-01-25 15:30:15 +0100598foreach header : ['crypt.h',
599 'linux/btrfs.h',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400600 'linux/memfd.h',
601 'linux/vm_sockets.h',
Zbigniew Jędrzejewski-Szmekaf8786b2017-10-03 12:09:40 +0200602 'sys/auxv.h',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400603 'valgrind/memcheck.h',
604 'valgrind/valgrind.h',
605 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400606
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200607 conf.set10('HAVE_' + header.underscorify().to_upper(),
608 cc.has_header(header))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400609endforeach
610
611############################################################
612
613conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
Zbigniew Jędrzejewski-Szmek5248e7e2017-07-11 02:15:08 -0400614conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
615gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400616
617default_hierarchy = get_option('default-hierarchy')
618conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
619 description : 'default cgroup hierarchy as string')
620if default_hierarchy == 'legacy'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400621 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400622elif default_hierarchy == 'hybrid'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400623 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400624else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400625 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400626endif
627
628time_epoch = get_option('time-epoch')
629if time_epoch == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400630 NEWS = files('NEWS')
631 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400632endif
633time_epoch = time_epoch.to_int()
634conf.set('TIME_EPOCH', time_epoch)
635
636system_uid_max = get_option('system-uid-max')
637if system_uid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400638 system_uid_max = run_command(
639 awk,
Caio Marcelo de Oliveira Filho2f62cf32018-02-18 18:33:16 -0800640 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
641 '/etc/login.defs').stdout().strip()
642 if system_uid_max == ''
643 system_uid_max = '999'
644 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400645endif
646system_uid_max = system_uid_max.to_int()
647conf.set('SYSTEM_UID_MAX', system_uid_max)
648substs.set('systemuidmax', system_uid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400649message('maximum system UID is @0@'.format(system_uid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400650
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400651system_gid_max = get_option('system-gid-max')
652if system_gid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400653 system_gid_max = run_command(
654 awk,
Caio Marcelo de Oliveira Filho2f62cf32018-02-18 18:33:16 -0800655 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
656 '/etc/login.defs').stdout().strip()
657 if system_gid_max == ''
658 system_gid_max = '999'
659 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400660endif
661system_gid_max = system_gid_max.to_int()
662conf.set('SYSTEM_GID_MAX', system_gid_max)
663substs.set('systemgidmax', system_gid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400664message('maximum system GID is @0@'.format(system_gid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400665
Lennart Poettering87d5e4f2017-12-02 12:48:31 +0100666dynamic_uid_min = get_option('dynamic-uid-min').to_int()
667dynamic_uid_max = get_option('dynamic-uid-max').to_int()
668conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
669conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
670substs.set('dynamicuidmin', dynamic_uid_min)
671substs.set('dynamicuidmax', dynamic_uid_max)
672
673container_uid_base_min = get_option('container-uid-base-min').to_int()
674container_uid_base_max = get_option('container-uid-base-max').to_int()
675conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
676conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
677substs.set('containeruidbasemin', container_uid_base_min)
678substs.set('containeruidbasemax', container_uid_base_max)
679
Lennart Poetteringafde4572017-12-05 11:00:24 +0100680nobody_user = get_option('nobody-user')
681nobody_group = get_option('nobody-group')
682
683getent_result = run_command('getent', 'passwd', '65534')
684if getent_result.returncode() == 0
685 name = getent_result.stdout().split(':')[0]
686 if name != nobody_user
Yu Watanabe8ea9fad2018-05-10 14:50:52 +0900687 warning('\n' +
688 'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
689 'Your build will result in an user table setup that is incompatible with the local system.')
Lennart Poetteringafde4572017-12-05 11:00:24 +0100690 endif
691endif
692id_result = run_command('id', '-u', nobody_user)
693if id_result.returncode() == 0
694 id = id_result.stdout().to_int()
695 if id != 65534
Yu Watanabe8ea9fad2018-05-10 14:50:52 +0900696 warning('\n' +
697 'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
698 'Your build will result in an user table setup that is incompatible with the local system.')
Lennart Poetteringafde4572017-12-05 11:00:24 +0100699 endif
700endif
701
702getent_result = run_command('getent', 'group', '65534')
703if getent_result.returncode() == 0
704 name = getent_result.stdout().split(':')[0]
705 if name != nobody_group
Yu Watanabe8ea9fad2018-05-10 14:50:52 +0900706 warning('\n' +
707 'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
708 'Your build will result in an group table setup that is incompatible with the local system.')
Lennart Poetteringafde4572017-12-05 11:00:24 +0100709 endif
710endif
711id_result = run_command('id', '-g', nobody_group)
712if id_result.returncode() == 0
713 id = id_result.stdout().to_int()
714 if id != 65534
Yu Watanabe8ea9fad2018-05-10 14:50:52 +0900715 warning('\n' +
716 'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
717 'Your build will result in an group table setup that is incompatible with the local system.')
Lennart Poetteringafde4572017-12-05 11:00:24 +0100718 endif
719endif
Yu Watanabe8374cc62017-12-07 17:19:11 +0900720if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
Yu Watanabe8ea9fad2018-05-10 14:50:52 +0900721 warning('\n' +
722 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
723 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
Yu Watanabe8374cc62017-12-07 17:19:11 +0900724endif
Lennart Poetteringafde4572017-12-05 11:00:24 +0100725
726conf.set_quoted('NOBODY_USER_NAME', nobody_user)
727conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
Yu Watanabe60712022017-12-07 15:49:16 +0900728substs.set('NOBODY_USER_NAME', nobody_user)
729substs.set('NOBODY_GROUP_NAME', nobody_group)
Lennart Poettering87d5e4f2017-12-02 12:48:31 +0100730
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400731tty_gid = get_option('tty-gid')
732conf.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400733substs.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400734
Ikey Doherty84786b82017-12-03 12:28:23 +0000735# Ensure provided GID argument is numeric, otherwise fallback to default assignment
736if get_option('users-gid') != ''
Yu Watanabed6806872017-12-05 14:01:39 +0900737 users_gid = get_option('users-gid').to_int()
Ikey Doherty84786b82017-12-03 12:28:23 +0000738else
Yu Watanabed6806872017-12-05 14:01:39 +0900739 users_gid = '-'
Ikey Doherty84786b82017-12-03 12:28:23 +0000740endif
741substs.set('USERS_GID', users_gid)
742
Yu Watanabe348b4432018-05-07 18:17:35 +0900743conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
744conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400745
746substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
Tom Stellard4e15a732017-10-31 08:46:24 -0700747substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400748
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400749kill_user_processes = get_option('default-kill-user-processes')
750conf.set10('KILL_USER_PROCESSES', kill_user_processes)
Michal Koutnýc7f7e852018-03-09 16:40:41 +0100751conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400752substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400753
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400754dns_servers = get_option('dns-servers')
755conf.set_quoted('DNS_SERVERS', dns_servers)
756substs.set('DNS_SERVERS', dns_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400757
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400758ntp_servers = get_option('ntp-servers')
759conf.set_quoted('NTP_SERVERS', ntp_servers)
760substs.set('NTP_SERVERS', ntp_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400761
762conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
763
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400764substs.set('SUSHELL', get_option('debug-shell'))
765substs.set('DEBUGTTY', get_option('debug-tty'))
766
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200767enable_debug_hashmap = false
768enable_debug_mmap_cache = false
Yu Watanabead7aa762018-05-02 13:56:28 +0900769foreach name : get_option('debug')
770 if name == 'hashmap'
771 enable_debug_hashmap = true
772 elif name == 'mmap-cache'
773 enable_debug_mmap_cache = true
774 else
775 message('unknown debug option "@0@", ignoring'.format(name))
776 endif
777endforeach
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200778conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
779conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400780
Zbigniew Jędrzejewski-Szmekd18cb392018-05-13 22:28:24 +0200781conf.set10('VALGRIND', get_option('valgrind'))
782
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400783#####################################################################
784
785threads = dependency('threads')
786librt = cc.find_library('rt')
787libm = cc.find_library('m')
788libdl = cc.find_library('dl')
789libcrypt = cc.find_library('crypt')
790
Zbigniew Jędrzejewski-Szmek1800cc82017-04-27 01:30:30 -0400791libcap = dependency('libcap', required : false)
792if not libcap.found()
793 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
794 libcap = cc.find_library('cap')
795endif
796
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400797libmount = dependency('mount',
Zbigniew Jędrzejewski-Szmekc0b4b0f2018-03-09 14:58:47 +0100798 version : fuzzer_build ? '>= 0' : '>= 2.30')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400799
800want_seccomp = get_option('seccomp')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500801if want_seccomp != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400802 libseccomp = dependency('libseccomp',
Zbigniew Jędrzejewski-Szmek9f0e9c02017-04-27 10:05:18 -0400803 version : '>= 2.3.1',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400804 required : want_seccomp == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200805 have = libseccomp.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400806else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200807 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400808 libseccomp = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400809endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200810conf.set10('HAVE_SECCOMP', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400811
812want_selinux = get_option('selinux')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500813if want_selinux != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400814 libselinux = dependency('libselinux',
815 version : '>= 2.1.9',
816 required : want_selinux == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200817 have = libselinux.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400818else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200819 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400820 libselinux = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400821endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200822conf.set10('HAVE_SELINUX', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400823
824want_apparmor = get_option('apparmor')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500825if want_apparmor != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400826 libapparmor = dependency('libapparmor',
827 required : want_apparmor == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200828 have = libapparmor.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400829else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200830 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400831 libapparmor = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400832endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200833conf.set10('HAVE_APPARMOR', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400834
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400835smack_run_label = get_option('smack-run-label')
836if smack_run_label != ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400837 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400838endif
839
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400840want_polkit = get_option('polkit')
841install_polkit = false
842install_polkit_pkla = false
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500843if want_polkit != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400844 install_polkit = true
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400845
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400846 libpolkit = dependency('polkit-gobject-1',
847 required : false)
848 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
849 message('Old polkit detected, will install pkla files')
850 install_polkit_pkla = true
851 endif
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400852endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200853conf.set10('ENABLE_POLKIT', install_polkit)
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400854
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400855want_acl = get_option('acl')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500856if want_acl != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400857 libacl = cc.find_library('acl', required : want_acl == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200858 have = libacl.found()
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400859else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200860 have = false
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400861 libacl = []
862endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200863conf.set10('HAVE_ACL', have)
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400864
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400865want_audit = get_option('audit')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500866if want_audit != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400867 libaudit = dependency('audit', required : want_audit == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200868 have = libaudit.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400869else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200870 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400871 libaudit = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400872endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200873conf.set10('HAVE_AUDIT', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400874
875want_blkid = get_option('blkid')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500876if want_blkid != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400877 libblkid = dependency('blkid', required : want_blkid == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200878 have = libblkid.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400879else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200880 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400881 libblkid = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400882endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200883conf.set10('HAVE_BLKID', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400884
885want_kmod = get_option('kmod')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500886if want_kmod != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400887 libkmod = dependency('libkmod',
888 version : '>= 15',
889 required : want_kmod == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200890 have = libkmod.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400891else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200892 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400893 libkmod = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400894endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200895conf.set10('HAVE_KMOD', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400896
897want_pam = get_option('pam')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500898if want_pam != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400899 libpam = cc.find_library('pam', required : want_pam == 'true')
900 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200901 have = libpam.found() and libpam_misc.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400902else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200903 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400904 libpam = []
905 libpam_misc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400906endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200907conf.set10('HAVE_PAM', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400908
909want_microhttpd = get_option('microhttpd')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500910if want_microhttpd != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400911 libmicrohttpd = dependency('libmicrohttpd',
912 version : '>= 0.9.33',
913 required : want_microhttpd == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200914 have = libmicrohttpd.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400915else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200916 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400917 libmicrohttpd = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400918endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200919conf.set10('HAVE_MICROHTTPD', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400920
921want_libcryptsetup = get_option('libcryptsetup')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500922if want_libcryptsetup != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400923 libcryptsetup = dependency('libcryptsetup',
924 version : '>= 1.6.0',
925 required : want_libcryptsetup == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200926 have = libcryptsetup.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400927else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200928 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400929 libcryptsetup = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400930endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200931conf.set10('HAVE_LIBCRYPTSETUP', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400932
933want_libcurl = get_option('libcurl')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500934if want_libcurl != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400935 libcurl = dependency('libcurl',
936 version : '>= 7.32.0',
937 required : want_libcurl == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200938 have = libcurl.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400939else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200940 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400941 libcurl = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400942endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200943conf.set10('HAVE_LIBCURL', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400944
945want_libidn = get_option('libidn')
Zbigniew Jędrzejewski-Szmek87057e22017-05-09 21:56:34 -0400946want_libidn2 = get_option('libidn2')
947if want_libidn == 'true' and want_libidn2 == 'true'
948 error('libidn and libidn2 cannot be requested simultaneously')
949endif
950
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500951if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400952 libidn = dependency('libidn',
953 required : want_libidn == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200954 have = libidn.found()
Zbigniew Jędrzejewski-Szmek7f7ab222017-07-12 03:25:59 -0400955else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200956 have = false
Zbigniew Jędrzejewski-Szmek7f7ab222017-07-12 03:25:59 -0400957 libidn = []
958endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200959conf.set10('HAVE_LIBIDN', have)
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500960if not have and want_libidn2 != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek7f7ab222017-07-12 03:25:59 -0400961 # libidn is used for both libidn and libidn2 objects
962 libidn = dependency('libidn2',
963 required : want_libidn2 == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200964 have = libidn.found()
965else
966 have = false
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400967endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200968conf.set10('HAVE_LIBIDN2', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400969
970want_libiptc = get_option('libiptc')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500971if want_libiptc != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400972 libiptc = dependency('libiptc',
973 required : want_libiptc == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200974 have = libiptc.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400975else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200976 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400977 libiptc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400978endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200979conf.set10('HAVE_LIBIPTC', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400980
981want_qrencode = get_option('qrencode')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500982if want_qrencode != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400983 libqrencode = dependency('libqrencode',
984 required : want_qrencode == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200985 have = libqrencode.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400986else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200987 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400988 libqrencode = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400989endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200990conf.set10('HAVE_QRENCODE', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400991
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -0400992want_gcrypt = get_option('gcrypt')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -0500993if want_gcrypt != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -0400994 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
995 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200996 have = libgcrypt.found() and libgpg_error.found()
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -0400997else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +0200998 have = false
999endif
1000if not have
1001 # link to neither of the libs if one is not found
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -04001002 libgcrypt = []
1003 libgpg_error = []
1004endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001005conf.set10('HAVE_GCRYPT', have)
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -04001006
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001007want_gnutls = get_option('gnutls')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001008if want_gnutls != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001009 libgnutls = dependency('gnutls',
1010 version : '>= 3.1.4',
1011 required : want_gnutls == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001012 have = libgnutls.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001013else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001014 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001015 libgnutls = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001016endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001017conf.set10('HAVE_GNUTLS', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001018
1019want_elfutils = get_option('elfutils')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001020if want_elfutils != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001021 libdw = dependency('libdw',
1022 required : want_elfutils == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001023 have = libdw.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001024else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001025 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001026 libdw = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001027endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001028conf.set10('HAVE_ELFUTILS', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001029
1030want_zlib = get_option('zlib')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001031if want_zlib != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001032 libz = dependency('zlib',
1033 required : want_zlib == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001034 have = libz.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001035else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001036 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001037 libz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001038endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001039conf.set10('HAVE_ZLIB', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001040
1041want_bzip2 = get_option('bzip2')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001042if want_bzip2 != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001043 libbzip2 = cc.find_library('bz2',
1044 required : want_bzip2 == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001045 have = libbzip2.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001046else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001047 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001048 libbzip2 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001049endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001050conf.set10('HAVE_BZIP2', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001051
1052want_xz = get_option('xz')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001053if want_xz != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001054 libxz = dependency('liblzma',
1055 required : want_xz == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001056 have = libxz.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001057else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001058 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001059 libxz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001060endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001061conf.set10('HAVE_XZ', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001062
1063want_lz4 = get_option('lz4')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001064if want_lz4 != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001065 liblz4 = dependency('liblz4',
1066 required : want_lz4 == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001067 have = liblz4.found()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001068else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001069 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001070 liblz4 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001071endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001072conf.set10('HAVE_LZ4', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001073
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -04001074want_xkbcommon = get_option('xkbcommon')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001075if want_xkbcommon != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -04001076 libxkbcommon = dependency('xkbcommon',
1077 version : '>= 0.3.0',
1078 required : want_xkbcommon == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001079 have = libxkbcommon.found()
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -04001080else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001081 have = false
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -04001082 libxkbcommon = []
1083endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001084conf.set10('HAVE_XKBCOMMON', have)
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -04001085
Zbigniew Jędrzejewski-Szmekc4c978a2018-01-12 05:47:17 +01001086want_pcre2 = get_option('pcre2')
1087if want_pcre2 != 'false'
1088 libpcre2 = dependency('libpcre2-8',
1089 required : want_pcre2 == 'true')
1090 have = libpcre2.found()
1091else
1092 have = false
1093 libpcre2 = []
1094endif
1095conf.set10('HAVE_PCRE2', have)
1096
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001097want_glib = get_option('glib')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001098if want_glib != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001099 libglib = dependency('glib-2.0',
1100 version : '>= 2.22.0',
1101 required : want_glib == 'true')
1102 libgobject = dependency('gobject-2.0',
1103 version : '>= 2.22.0',
1104 required : want_glib == 'true')
1105 libgio = dependency('gio-2.0',
1106 required : want_glib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001107 have = libglib.found() and libgobject.found() and libgio.found()
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001108else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001109 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001110 libglib = []
1111 libgobject = []
1112 libgio = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001113endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001114conf.set10('HAVE_GLIB', have)
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001115
1116want_dbus = get_option('dbus')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001117if want_dbus != 'false' and not fuzzer_build
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001118 libdbus = dependency('dbus-1',
1119 version : '>= 1.3.2',
1120 required : want_dbus == 'true')
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001121 have = libdbus.found()
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001122else
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001123 have = false
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001124 libdbus = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001125endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001126conf.set10('HAVE_DBUS', have)
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001127
Yu Watanabe42303dc2017-06-18 05:22:32 +09001128default_dnssec = get_option('default-dnssec')
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05001129if fuzzer_build
Jonathan Rudenbergb4081f32018-01-15 18:27:37 -05001130 default_dnssec = 'no'
1131endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001132if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
Yu Watanabe42303dc2017-06-18 05:22:32 +09001133 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1134 default_dnssec = 'no'
1135endif
1136conf.set('DEFAULT_DNSSEC_MODE',
1137 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1138substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1139
Iwan Timmer5d67a7a2018-04-27 17:50:38 +02001140default_private_dns = get_option('default-private-dns')
1141if fuzzer_build
1142 default_private_dns = 'no'
1143endif
1144if default_private_dns != 'no' and conf.get('HAVE_GNUTLS') == 0
1145 message('default-private-dns cannot be set to strict or opportunistic when gnutls is disabled. Setting default-private-dns to no.')
1146 default_private_dns = 'no'
1147endif
1148conf.set('DEFAULT_PRIVATE_DNS_MODE',
1149 'PRIVATE_DNS_' + default_private_dns.underscorify().to_upper())
1150substs.set('DEFAULT_PRIVATE_DNS_MODE', default_private_dns)
1151
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001152want_importd = get_option('importd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -04001153if want_importd != 'false'
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001154 have = (conf.get('HAVE_LIBCURL') == 1 and
1155 conf.get('HAVE_ZLIB') == 1 and
1156 conf.get('HAVE_BZIP2') == 1 and
1157 conf.get('HAVE_XZ') == 1 and
1158 conf.get('HAVE_GCRYPT') == 1)
1159 if want_importd == 'true' and not have
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001160 error('importd support was requested, but dependencies are not available')
1161 endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001162else
1163 have = false
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001164endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001165conf.set10('ENABLE_IMPORTD', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001166
1167want_remote = get_option('remote')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -04001168if want_remote != 'false'
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001169 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1170 conf.get('HAVE_LIBCURL') == 1]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001171 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1172 # it's possible to build one without the other. Complain only if
1173 # support was explictly requested. The auxiliary files like sysusers
1174 # config should be installed when any of the programs are built.
1175 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1176 error('remote support was requested, but dependencies are not available')
1177 endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001178 have = have_deps[0] or have_deps[1]
1179else
1180 have = false
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001181endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001182conf.set10('ENABLE_REMOTE', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001183
Zbigniew Jędrzejewski-Szmeka9149d82017-10-03 13:15:27 +02001184foreach term : ['utmp',
1185 'hibernate',
1186 'environment-d',
1187 'binfmt',
1188 'coredump',
1189 'resolve',
1190 'logind',
1191 'hostnamed',
1192 'localed',
1193 'machined',
Lennart Poettering61d05782018-04-16 21:41:40 +02001194 'portabled',
Zbigniew Jędrzejewski-Szmeka9149d82017-10-03 13:15:27 +02001195 'networkd',
1196 'timedated',
1197 'timesyncd',
1198 'myhostname',
1199 'firstboot',
1200 'randomseed',
1201 'backlight',
1202 'vconsole',
1203 'quotacheck',
1204 'sysusers',
1205 'tmpfiles',
1206 'hwdb',
1207 'rfkill',
1208 'ldconfig',
1209 'efi',
1210 'tpm',
1211 'ima',
1212 'smack',
1213 'gshadow',
1214 'idn',
1215 'nss-systemd']
1216 have = get_option(term)
1217 name = 'ENABLE_' + term.underscorify().to_upper()
1218 conf.set10(name, have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001219endforeach
1220
Yu Watanabe348b4432018-05-07 18:17:35 +09001221conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
Yu Watanabe6129ec82018-05-03 18:07:43 +09001222
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001223want_tests = get_option('tests')
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04001224install_tests = get_option('install-tests')
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +11001225slow_tests = get_option('slow-tests')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001226tests = []
Jonathan Rudenberg7db7d5b2018-01-13 19:51:07 -05001227fuzzers = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001228
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +11001229conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
Zbigniew Jędrzejewski-Szmek00d82c82017-07-12 21:25:17 +00001230
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001231#####################################################################
1232
1233if get_option('efi')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001234 efi_arch = host_machine.cpu_family()
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001235
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001236 if efi_arch == 'x86'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001237 EFI_MACHINE_TYPE_NAME = 'ia32'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001238 gnu_efi_arch = 'ia32'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001239 elif efi_arch == 'x86_64'
1240 EFI_MACHINE_TYPE_NAME = 'x64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001241 gnu_efi_arch = 'x86_64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001242 elif efi_arch == 'arm'
1243 EFI_MACHINE_TYPE_NAME = 'arm'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001244 gnu_efi_arch = 'arm'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001245 elif efi_arch == 'aarch64'
1246 EFI_MACHINE_TYPE_NAME = 'aa64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001247 gnu_efi_arch = 'aarch64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001248 else
1249 EFI_MACHINE_TYPE_NAME = ''
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001250 gnu_efi_arch = ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001251 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001252
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001253 have = true
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001254 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
Zbigniew Jędrzejewski-Szmek80c6fce2017-04-24 19:28:04 -04001255
1256 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001257else
1258 have = false
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001259endif
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001260conf.set10('ENABLE_EFI', have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001261
1262#####################################################################
1263
1264config_h = configure_file(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001265 output : 'config.h',
1266 configuration : conf)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001267
Yu Watanabe348b4432018-05-07 18:17:35 +09001268meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1269
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001270includes = include_directories('src/basic',
1271 'src/shared',
1272 'src/systemd',
1273 'src/journal',
Zbigniew Jędrzejewski-Szmeka38f7fe2018-05-16 12:05:07 +02001274 'src/journal-remote',
Zbigniew Jędrzejewski-Szmek97d90612018-05-28 10:37:11 +02001275 'src/nspawn',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001276 'src/resolve',
1277 'src/timesync',
Peter A. Bigot5c3376e2018-03-21 06:42:04 -05001278 'src/time-wait-sync',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001279 'src/login',
1280 'src/udev',
1281 'src/libudev',
1282 'src/core',
1283 'src/libsystemd/sd-bus',
1284 'src/libsystemd/sd-device',
1285 'src/libsystemd/sd-hwdb',
1286 'src/libsystemd/sd-id128',
1287 'src/libsystemd/sd-netlink',
1288 'src/libsystemd/sd-network',
1289 'src/libsystemd-network',
Zbigniew Jędrzejewski-Szmek2d4ceca2017-12-19 14:19:46 +01001290 '.')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001291
1292add_project_arguments('-include', 'config.h', language : 'c')
1293
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001294subdir('po')
1295subdir('catalog')
1296subdir('src/systemd')
1297subdir('src/basic')
1298subdir('src/libsystemd')
1299subdir('src/libsystemd-network')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001300subdir('src/journal')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001301subdir('src/login')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001302
1303libjournal_core = static_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001304 'journal-core',
1305 libjournal_core_sources,
1306 journald_gperf_c,
1307 include_directories : includes,
1308 install : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001309
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04001310libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001311libsystemd = shared_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001312 'systemd',
Zbigniew Jędrzejewski-Szmek7f1ea2c2017-12-20 09:12:08 +01001313 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
Zbigniew Jędrzejewski-Szmek56d50ab2017-09-28 19:24:16 +02001314 version : libsystemd_version,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001315 include_directories : includes,
1316 link_args : ['-shared',
1317 '-Wl,--version-script=' + libsystemd_sym_path],
Zbigniew Jędrzejewski-Szmek34e221a2017-12-19 19:06:56 +01001318 link_with : [libbasic,
1319 libbasic_gcrypt],
Zbigniew Jędrzejewski-Szmek5e3cec82017-12-19 19:38:43 +01001320 link_whole : [libsystemd_static,
1321 libjournal_client],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001322 dependencies : [threads,
1323 librt,
1324 libxz,
1325 liblz4],
1326 link_depends : libsystemd_sym,
1327 install : true,
1328 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001329
Davide Cavalca70848ec2018-04-09 02:43:35 -07001330static_libsystemd = get_option('static-libsystemd')
1331static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
1332
1333install_libsystemd_static = static_library(
1334 'systemd',
1335 libsystemd_sources,
1336 journal_client_sources,
Zbigniew Jędrzejewski-Szmek975464e2018-04-25 15:29:48 +02001337 basic_sources,
1338 basic_gcrypt_sources,
Davide Cavalca70848ec2018-04-09 02:43:35 -07001339 include_directories : includes,
Davide Cavalca70848ec2018-04-09 02:43:35 -07001340 build_by_default : static_libsystemd != 'false',
1341 install : static_libsystemd != 'false',
1342 install_dir : rootlibdir,
1343 pic : static_libsystemd == 'true' or static_libsystemd == 'pic',
1344 dependencies : [threads,
1345 librt,
1346 libxz,
1347 liblz4,
Zbigniew Jędrzejewski-Szmek975464e2018-04-25 15:29:48 +02001348 libcap,
1349 libblkid,
1350 libmount,
1351 libselinux,
Davide Cavalca70848ec2018-04-09 02:43:35 -07001352 libgcrypt],
1353 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
1354
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001355############################################################
1356
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001357# binaries that have --help and are intended for use by humans,
1358# usually, but not always, installed in /bin.
1359public_programs = []
1360
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001361subdir('src/libudev')
1362subdir('src/shared')
1363subdir('src/core')
1364subdir('src/udev')
1365subdir('src/network')
1366
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001367subdir('src/analyze')
1368subdir('src/journal-remote')
1369subdir('src/coredump')
1370subdir('src/hostname')
1371subdir('src/import')
1372subdir('src/kernel-install')
1373subdir('src/locale')
1374subdir('src/machine')
Lennart Poettering61d05782018-04-16 21:41:40 +02001375subdir('src/portable')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001376subdir('src/nspawn')
1377subdir('src/resolve')
1378subdir('src/timedate')
1379subdir('src/timesync')
1380subdir('src/vconsole')
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001381subdir('src/boot/efi')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001382
1383subdir('src/test')
Jonathan Rudenberg7db7d5b2018-01-13 19:51:07 -05001384subdir('src/fuzz')
Zbigniew Jędrzejewski-Szmek6b97bf22017-11-22 12:42:28 +01001385subdir('rules')
Zbigniew Jędrzejewski-Szmek4ff3f252017-04-13 20:47:20 -04001386subdir('test')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001387
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001388############################################################
1389
1390# only static linking apart from libdl, to make sure that the
1391# module is linked to all libraries that it uses.
1392test_dlopen = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001393 'test-dlopen',
1394 test_dlopen_c,
1395 include_directories : includes,
1396 link_with : [libbasic],
1397 dependencies : [libdl])
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001398
Zbigniew Jędrzejewski-Szmek08cf5b82017-10-03 12:23:55 +02001399foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
Waldemar Brodkorbe7e11bb2017-06-24 19:30:26 +02001400 ['systemd', 'ENABLE_NSS_SYSTEMD'],
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001401 ['mymachines', 'ENABLE_MACHINED'],
Zbigniew Jędrzejewski-Szmek1ec57f32017-10-03 13:12:29 +02001402 ['resolve', 'ENABLE_RESOLVE']]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001403
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001404 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001405 if condition
1406 module = tuple[0]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001407
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001408 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1409 version_script_arg = join_paths(meson.current_source_dir(), sym)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001410
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001411 nss = shared_library(
1412 'nss_' + module,
1413 'src/nss-@0@/nss-@0@.c'.format(module),
1414 version : '2',
1415 include_directories : includes,
Lennart Poetteringb4b36f42017-12-12 20:13:16 +01001416 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1417 link_args : ['-Wl,-z,nodelete',
1418 '-shared',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001419 '-Wl,--version-script=' + version_script_arg,
1420 '-Wl,--undefined'],
Zbigniew Jędrzejewski-Szmek37e4d7a2017-12-19 11:35:01 +01001421 link_with : [libsystemd_static,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001422 libbasic],
1423 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001424 librt],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001425 link_depends : sym,
1426 install : true,
1427 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001428
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001429 # We cannot use shared_module because it does not support version suffix.
1430 # Unfortunately shared_library insists on creating the symlink…
1431 meson.add_install_script('sh', '-c',
1432 'rm $DESTDIR@0@/libnss_@1@.so'
1433 .format(rootlibdir, module))
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001434
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001435 test('dlopen-nss_' + module,
1436 test_dlopen,
1437 args : [nss.full_path()]) # path to dlopen must include a slash
1438 endif
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001439endforeach
1440
1441############################################################
1442
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001443executable('systemd',
1444 systemd_sources,
1445 include_directories : includes,
1446 link_with : [libcore,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001447 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001448 dependencies : [threads,
1449 librt,
1450 libseccomp,
1451 libselinux,
Zbigniew Jędrzejewski-Szmekf4ee10a2017-04-09 14:08:53 -04001452 libmount,
1453 libblkid],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001454 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001455 install : true,
1456 install_dir : rootlibexecdir)
1457
Zbigniew Jędrzejewski-Szmekba7f4ae2018-02-28 10:20:48 +01001458meson.add_install_script(meson_make_symlink,
1459 join_paths(rootlibexecdir, 'systemd'),
1460 join_paths(rootsbindir, 'init'))
1461
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001462exe = executable('systemd-analyze',
1463 systemd_analyze_sources,
1464 include_directories : includes,
1465 link_with : [libcore,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001466 libshared],
1467 dependencies : [threads,
1468 librt,
1469 libseccomp,
1470 libselinux,
1471 libmount,
1472 libblkid],
1473 install_rpath : rootlibexecdir,
1474 install : true)
1475public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001476
1477executable('systemd-journald',
1478 systemd_journald_sources,
1479 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001480 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001481 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001482 dependencies : [threads,
1483 libxz,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001484 liblz4,
1485 libselinux],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001486 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001487 install : true,
1488 install_dir : rootlibexecdir)
1489
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001490exe = executable('systemd-cat',
1491 systemd_cat_sources,
1492 include_directories : includes,
1493 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001494 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001495 dependencies : [threads],
1496 install_rpath : rootlibexecdir,
1497 install : true)
1498public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001499
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001500exe = executable('journalctl',
1501 journalctl_sources,
1502 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001503 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001504 dependencies : [threads,
1505 libqrencode,
1506 libxz,
Zbigniew Jędrzejewski-Szmek6becf482018-01-12 07:55:45 +01001507 liblz4,
1508 libpcre2],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001509 install_rpath : rootlibexecdir,
1510 install : true,
1511 install_dir : rootbindir)
1512public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001513
1514executable('systemd-getty-generator',
1515 'src/getty-generator/getty-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001516 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001517 link_with : [libshared],
1518 install_rpath : rootlibexecdir,
1519 install : true,
1520 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001521
1522executable('systemd-debug-generator',
1523 'src/debug-generator/debug-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001524 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001525 link_with : [libshared],
1526 install_rpath : rootlibexecdir,
1527 install : true,
1528 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001529
1530executable('systemd-fstab-generator',
1531 'src/fstab-generator/fstab-generator.c',
1532 'src/core/mount-setup.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001533 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001534 link_with : [libshared],
1535 install_rpath : rootlibexecdir,
1536 install : true,
1537 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001538
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001539if conf.get('ENABLE_ENVIRONMENT_D') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001540 executable('30-systemd-environment-d-generator',
1541 'src/environment-d-generator/environment-d-generator.c',
1542 include_directories : includes,
1543 link_with : [libshared],
1544 install_rpath : rootlibexecdir,
1545 install : true,
1546 install_dir : userenvgeneratordir)
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001547
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001548 meson.add_install_script(meson_make_symlink,
1549 join_paths(sysconfdir, 'environment'),
1550 join_paths(environmentdir, '99-environment.conf'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001551endif
1552
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001553if conf.get('ENABLE_HIBERNATE') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001554 executable('systemd-hibernate-resume-generator',
1555 'src/hibernate-resume/hibernate-resume-generator.c',
1556 include_directories : includes,
1557 link_with : [libshared],
1558 install_rpath : rootlibexecdir,
1559 install : true,
1560 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001561
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001562 executable('systemd-hibernate-resume',
1563 'src/hibernate-resume/hibernate-resume.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001564 include_directories : includes,
1565 link_with : [libshared],
1566 install_rpath : rootlibexecdir,
1567 install : true,
1568 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001569endif
1570
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001571if conf.get('HAVE_BLKID') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001572 executable('systemd-gpt-auto-generator',
1573 'src/gpt-auto-generator/gpt-auto-generator.c',
1574 'src/basic/blkid-util.h',
1575 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001576 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001577 dependencies : libblkid,
1578 install_rpath : rootlibexecdir,
1579 install : true,
1580 install_dir : systemgeneratordir)
1581
1582 exe = executable('systemd-dissect',
1583 'src/dissect/dissect.c',
1584 include_directories : includes,
1585 link_with : [libshared],
1586 install_rpath : rootlibexecdir,
1587 install : true,
1588 install_dir : rootlibexecdir)
1589 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001590endif
1591
Zbigniew Jędrzejewski-Szmek1ec57f32017-10-03 13:12:29 +02001592if conf.get('ENABLE_RESOLVE') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001593 executable('systemd-resolved',
1594 systemd_resolved_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001595 include_directories : includes,
Zbigniew Jędrzejewski-Szmek34e221a2017-12-19 19:06:56 +01001596 link_with : [libshared,
Zbigniew Jędrzejewski-Szmek568a4ff2017-12-19 22:46:01 +01001597 libbasic_gcrypt,
1598 libsystemd_resolve_core],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001599 dependencies : [threads,
Iwan Timmer5d67a7a2018-04-27 17:50:38 +02001600 libgnutls,
Michael Biebl76c87412017-04-21 23:45:54 +02001601 libgpg_error,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001602 libm,
1603 libidn],
1604 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001605 install : true,
1606 install_dir : rootlibexecdir)
1607
Yu Watanabec2e84ca2018-04-19 03:24:23 +09001608 exe = executable('resolvectl',
1609 resolvectl_sources,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001610 include_directories : includes,
Zbigniew Jędrzejewski-Szmek34e221a2017-12-19 19:06:56 +01001611 link_with : [libshared,
Zbigniew Jędrzejewski-Szmek568a4ff2017-12-19 22:46:01 +01001612 libbasic_gcrypt,
1613 libsystemd_resolve_core],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001614 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001615 libgpg_error,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001616 libm,
1617 libidn],
1618 install_rpath : rootlibexecdir,
1619 install : true)
1620 public_programs += [exe]
Lennart Poettering088c1362018-02-27 17:48:54 +01001621
1622 meson.add_install_script(meson_make_symlink,
Yu Watanabec2e84ca2018-04-19 03:24:23 +09001623 join_paths(bindir, 'resolvectl'),
Lennart Poettering088c1362018-02-27 17:48:54 +01001624 join_paths(rootsbindir, 'resolvconf'))
Yu Watanabec2e84ca2018-04-19 03:24:23 +09001625
1626 meson.add_install_script(meson_make_symlink,
1627 join_paths(bindir, 'resolvectl'),
1628 join_paths(bindir, 'systemd-resolve'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001629endif
1630
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001631if conf.get('ENABLE_LOGIND') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001632 executable('systemd-logind',
1633 systemd_logind_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001634 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001635 link_with : [liblogind_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001636 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001637 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001638 libacl],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001639 install_rpath : rootlibexecdir,
1640 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001641 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001642
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001643 exe = executable('loginctl',
1644 loginctl_sources,
1645 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001646 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001647 dependencies : [threads,
1648 liblz4,
1649 libxz],
1650 install_rpath : rootlibexecdir,
1651 install : true,
1652 install_dir : rootbindir)
1653 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001654
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001655 exe = executable('systemd-inhibit',
1656 'src/login/inhibit.c',
1657 include_directories : includes,
1658 link_with : [libshared],
1659 install_rpath : rootlibexecdir,
1660 install : true,
1661 install_dir : rootbindir)
1662 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001663
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001664 if conf.get('HAVE_PAM') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001665 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1666 pam_systemd = shared_library(
1667 'pam_systemd',
1668 pam_systemd_c,
1669 name_prefix : '',
1670 include_directories : includes,
1671 link_args : ['-shared',
1672 '-Wl,--version-script=' + version_script_arg],
Zbigniew Jędrzejewski-Szmek37e4d7a2017-12-19 11:35:01 +01001673 link_with : [libsystemd_static,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001674 libshared_static],
1675 dependencies : [threads,
1676 libpam,
1677 libpam_misc],
1678 link_depends : pam_systemd_sym,
1679 install : true,
1680 install_dir : pamlibdir)
1681
1682 test('dlopen-pam_systemd',
1683 test_dlopen,
1684 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1685 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001686endif
1687
Zbigniew Jędrzejewski-Szmeka9f0f5e2017-12-09 19:30:17 +01001688executable('systemd-user-runtime-dir',
1689 user_runtime_dir_sources,
1690 include_directories : includes,
1691 link_with : [libshared, liblogind_core],
1692 install_rpath : rootlibexecdir,
1693 install : true,
1694 install_dir : rootlibexecdir)
1695
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001696if conf.get('HAVE_PAM') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001697 executable('systemd-user-sessions',
1698 'src/user-sessions/user-sessions.c',
1699 include_directories : includes,
1700 link_with : [libshared],
1701 install_rpath : rootlibexecdir,
1702 install : true,
1703 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001704endif
1705
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001706if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001707 exe = executable('bootctl',
1708 'src/boot/bootctl.c',
1709 include_directories : includes,
1710 link_with : [libshared],
1711 dependencies : [libblkid],
1712 install_rpath : rootlibexecdir,
1713 install : true)
1714 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001715endif
1716
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001717exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1718 include_directories : includes,
1719 link_with : [libshared],
1720 dependencies : [threads],
1721 install_rpath : rootlibexecdir,
1722 install : true)
1723public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001724
Felipe Satelerf3794362018-05-22 15:08:57 -04001725
1726if get_option('link-systemctl-shared')
1727 systemctl_link_with = [libshared]
1728else
1729 systemctl_link_with = [libsystemd_static,
1730 libshared_static,
1731 libjournal_client,
1732 libbasic_gcrypt]
1733endif
1734
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001735exe = executable('systemctl', 'src/systemctl/systemctl.c',
1736 include_directories : includes,
Felipe Satelerf3794362018-05-22 15:08:57 -04001737 link_with : systemctl_link_with,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001738 dependencies : [threads,
1739 libcap,
1740 libselinux,
1741 libxz,
1742 liblz4],
1743 install_rpath : rootlibexecdir,
1744 install : true,
1745 install_dir : rootbindir)
1746public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001747
Lennart Poettering61d05782018-04-16 21:41:40 +02001748if conf.get('ENABLE_PORTABLED') == 1
1749 executable('systemd-portabled',
1750 systemd_portabled_sources,
1751 include_directories : includes,
1752 link_with : [libshared],
1753 dependencies : [threads],
1754 install_rpath : rootlibexecdir,
1755 install : true,
1756 install_dir : rootlibexecdir)
1757
1758 exe = executable('portablectl', 'src/portable/portablectl.c',
1759 include_directories : includes,
1760 link_with : [libshared],
1761 dependencies : [threads],
1762 install_rpath : rootlibexecdir,
1763 install : true,
1764 install_dir : rootlibexecdir)
1765 public_programs += [exe]
1766endif
1767
Zbigniew Jędrzejewski-Szmekba7f4ae2018-02-28 10:20:48 +01001768foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit']
1769 meson.add_install_script(meson_make_symlink,
1770 join_paths(rootbindir, 'systemctl'),
1771 join_paths(rootsbindir, alias))
1772endforeach
1773
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001774if conf.get('ENABLE_BACKLIGHT') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001775 executable('systemd-backlight',
1776 'src/backlight/backlight.c',
1777 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001778 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001779 install_rpath : rootlibexecdir,
1780 install : true,
1781 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001782endif
1783
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001784if conf.get('ENABLE_RFKILL') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001785 executable('systemd-rfkill',
1786 'src/rfkill/rfkill.c',
1787 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001788 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001789 install_rpath : rootlibexecdir,
1790 install : true,
1791 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001792endif
1793
1794executable('systemd-system-update-generator',
1795 'src/system-update-generator/system-update-generator.c',
1796 include_directories : includes,
1797 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001798 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001799 install : true,
1800 install_dir : systemgeneratordir)
1801
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001802if conf.get('HAVE_LIBCRYPTSETUP') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001803 executable('systemd-cryptsetup',
1804 'src/cryptsetup/cryptsetup.c',
1805 include_directories : includes,
1806 link_with : [libshared],
1807 dependencies : [libcryptsetup],
1808 install_rpath : rootlibexecdir,
1809 install : true,
1810 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001811
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001812 executable('systemd-cryptsetup-generator',
1813 'src/cryptsetup/cryptsetup-generator.c',
1814 include_directories : includes,
1815 link_with : [libshared],
1816 dependencies : [libcryptsetup],
1817 install_rpath : rootlibexecdir,
1818 install : true,
1819 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001820
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001821 executable('systemd-veritysetup',
1822 'src/veritysetup/veritysetup.c',
1823 include_directories : includes,
1824 link_with : [libshared],
1825 dependencies : [libcryptsetup],
1826 install_rpath : rootlibexecdir,
1827 install : true,
1828 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001829
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001830 executable('systemd-veritysetup-generator',
1831 'src/veritysetup/veritysetup-generator.c',
1832 include_directories : includes,
1833 link_with : [libshared],
1834 dependencies : [libcryptsetup],
1835 install_rpath : rootlibexecdir,
1836 install : true,
1837 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001838endif
1839
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001840if conf.get('HAVE_SYSV_COMPAT') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001841 executable('systemd-sysv-generator',
1842 'src/sysv-generator/sysv-generator.c',
1843 include_directories : includes,
1844 link_with : [libshared],
1845 install_rpath : rootlibexecdir,
1846 install : true,
1847 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001848
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001849 executable('systemd-rc-local-generator',
1850 'src/rc-local-generator/rc-local-generator.c',
1851 include_directories : includes,
1852 link_with : [libshared],
1853 install_rpath : rootlibexecdir,
1854 install : true,
1855 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001856endif
1857
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001858if conf.get('ENABLE_HOSTNAMED') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001859 executable('systemd-hostnamed',
1860 'src/hostname/hostnamed.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001861 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001862 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001863 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001864 install : true,
1865 install_dir : rootlibexecdir)
1866
1867 exe = executable('hostnamectl',
1868 'src/hostname/hostnamectl.c',
1869 include_directories : includes,
1870 link_with : [libshared],
1871 install_rpath : rootlibexecdir,
1872 install : true)
1873 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001874endif
1875
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001876if conf.get('ENABLE_LOCALED') == 1
1877 if conf.get('HAVE_XKBCOMMON') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001878 # logind will load libxkbcommon.so dynamically on its own
1879 deps = [libdl]
1880 else
1881 deps = []
1882 endif
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -04001883
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001884 executable('systemd-localed',
1885 systemd_localed_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001886 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001887 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001888 dependencies : deps,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001889 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001890 install : true,
1891 install_dir : rootlibexecdir)
1892
1893 exe = executable('localectl',
1894 localectl_sources,
1895 include_directories : includes,
1896 link_with : [libshared],
1897 install_rpath : rootlibexecdir,
1898 install : true)
1899 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001900endif
1901
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001902if conf.get('ENABLE_TIMEDATED') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001903 executable('systemd-timedated',
1904 'src/timedate/timedated.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001905 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001906 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001907 install_rpath : rootlibexecdir,
1908 install : true,
1909 install_dir : rootlibexecdir)
Yu Watanabe6129ec82018-05-03 18:07:43 +09001910endif
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001911
Yu Watanabe6129ec82018-05-03 18:07:43 +09001912if conf.get('ENABLE_TIMEDATECTL') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001913 exe = executable('timedatectl',
1914 'src/timedate/timedatectl.c',
1915 include_directories : includes,
1916 install_rpath : rootlibexecdir,
1917 link_with : [libshared],
Yu Watanabe6129ec82018-05-03 18:07:43 +09001918 dependencies : [libm],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001919 install : true)
1920 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001921endif
1922
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001923if conf.get('ENABLE_TIMESYNCD') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001924 executable('systemd-timesyncd',
1925 systemd_timesyncd_sources,
1926 include_directories : includes,
1927 link_with : [libshared],
1928 dependencies : [threads,
1929 libm],
1930 install_rpath : rootlibexecdir,
1931 install : true,
1932 install_dir : rootlibexecdir)
Peter A. Bigot5c3376e2018-03-21 06:42:04 -05001933
1934 executable('systemd-time-wait-sync',
1935 'src/time-wait-sync/time-wait-sync.c',
1936 include_directories : includes,
1937 link_with : [libshared],
1938 install_rpath : rootlibexecdir,
1939 install : true,
1940 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001941endif
1942
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001943if conf.get('ENABLE_MACHINED') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001944 executable('systemd-machined',
1945 systemd_machined_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001946 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001947 link_with : [libmachine_core,
1948 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001949 install_rpath : rootlibexecdir,
1950 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001951 install_dir : rootlibexecdir)
1952
1953 exe = executable('machinectl',
1954 'src/machine/machinectl.c',
1955 include_directories : includes,
1956 link_with : [libshared],
1957 dependencies : [threads,
1958 libxz,
1959 liblz4],
1960 install_rpath : rootlibexecdir,
1961 install : true,
1962 install_dir : rootbindir)
1963 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001964endif
1965
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02001966if conf.get('ENABLE_IMPORTD') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001967 executable('systemd-importd',
1968 systemd_importd_sources,
1969 include_directories : includes,
1970 link_with : [libshared],
1971 dependencies : [threads],
1972 install_rpath : rootlibexecdir,
1973 install : true,
1974 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001975
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001976 systemd_pull = executable('systemd-pull',
1977 systemd_pull_sources,
1978 include_directories : includes,
1979 link_with : [libshared],
1980 dependencies : [libcurl,
1981 libz,
1982 libbzip2,
1983 libxz,
1984 libgcrypt],
1985 install_rpath : rootlibexecdir,
1986 install : true,
1987 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001988
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001989 systemd_import = executable('systemd-import',
1990 systemd_import_sources,
1991 include_directories : includes,
1992 link_with : [libshared],
1993 dependencies : [libcurl,
1994 libz,
1995 libbzip2,
1996 libxz],
1997 install_rpath : rootlibexecdir,
1998 install : true,
1999 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002000
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002001 systemd_export = executable('systemd-export',
2002 systemd_export_sources,
2003 include_directories : includes,
2004 link_with : [libshared],
2005 dependencies : [libcurl,
2006 libz,
2007 libbzip2,
2008 libxz],
2009 install_rpath : rootlibexecdir,
2010 install : true,
2011 install_dir : rootlibexecdir)
2012 public_programs += [systemd_pull, systemd_import, systemd_export]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002013endif
2014
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002015if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002016 exe = executable('systemd-journal-upload',
2017 systemd_journal_upload_sources,
2018 include_directories : includes,
2019 link_with : [libshared],
2020 dependencies : [threads,
2021 libcurl,
2022 libgnutls,
2023 libxz,
2024 liblz4],
2025 install_rpath : rootlibexecdir,
2026 install : true,
2027 install_dir : rootlibexecdir)
2028 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002029endif
2030
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002031if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002032 s_j_remote = executable('systemd-journal-remote',
2033 systemd_journal_remote_sources,
2034 include_directories : includes,
Zbigniew Jędrzejewski-Szmekc064d8d2018-05-16 10:21:58 +02002035 link_with : [libshared,
2036 libsystemd_journal_remote],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002037 dependencies : [threads,
2038 libmicrohttpd,
2039 libgnutls,
2040 libxz,
2041 liblz4],
2042 install_rpath : rootlibexecdir,
2043 install : true,
2044 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002045
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002046 s_j_gatewayd = executable('systemd-journal-gatewayd',
2047 systemd_journal_gatewayd_sources,
2048 include_directories : includes,
2049 link_with : [libshared],
2050 dependencies : [threads,
2051 libmicrohttpd,
2052 libgnutls,
2053 libxz,
2054 liblz4],
2055 install_rpath : rootlibexecdir,
2056 install : true,
2057 install_dir : rootlibexecdir)
2058 public_programs += [s_j_remote, s_j_gatewayd]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002059endif
2060
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002061if conf.get('ENABLE_COREDUMP') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002062 executable('systemd-coredump',
2063 systemd_coredump_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002064 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002065 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002066 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002067 libacl,
2068 libdw,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002069 libxz,
2070 liblz4],
2071 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002072 install : true,
2073 install_dir : rootlibexecdir)
2074
2075 exe = executable('coredumpctl',
2076 coredumpctl_sources,
2077 include_directories : includes,
2078 link_with : [libshared],
2079 dependencies : [threads,
2080 libxz,
2081 liblz4],
2082 install_rpath : rootlibexecdir,
2083 install : true)
2084 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002085endif
2086
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002087if conf.get('ENABLE_BINFMT') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002088 exe = executable('systemd-binfmt',
2089 'src/binfmt/binfmt.c',
2090 include_directories : includes,
2091 link_with : [libshared],
2092 install_rpath : rootlibexecdir,
2093 install : true,
2094 install_dir : rootlibexecdir)
2095 public_programs += [exe]
2096
2097 meson.add_install_script('sh', '-c',
2098 mkdir_p.format(binfmtdir))
2099 meson.add_install_script('sh', '-c',
2100 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2101endif
2102
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002103if conf.get('ENABLE_VCONSOLE') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002104 executable('systemd-vconsole-setup',
2105 'src/vconsole/vconsole-setup.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002106 include_directories : includes,
2107 link_with : [libshared],
2108 install_rpath : rootlibexecdir,
2109 install : true,
2110 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002111endif
2112
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002113if conf.get('ENABLE_RANDOMSEED') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002114 executable('systemd-random-seed',
2115 'src/random-seed/random-seed.c',
2116 include_directories : includes,
2117 link_with : [libshared],
2118 install_rpath : rootlibexecdir,
2119 install : true,
2120 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002121endif
2122
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002123if conf.get('ENABLE_FIRSTBOOT') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002124 executable('systemd-firstboot',
2125 'src/firstboot/firstboot.c',
2126 include_directories : includes,
2127 link_with : [libshared],
2128 dependencies : [libcrypt],
2129 install_rpath : rootlibexecdir,
2130 install : true,
2131 install_dir : rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002132endif
2133
2134executable('systemd-remount-fs',
2135 'src/remount-fs/remount-fs.c',
2136 'src/core/mount-setup.c',
2137 'src/core/mount-setup.h',
2138 include_directories : includes,
2139 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04002140 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002141 install : true,
2142 install_dir : rootlibexecdir)
2143
2144executable('systemd-machine-id-setup',
2145 'src/machine-id-setup/machine-id-setup-main.c',
2146 'src/core/machine-id-setup.c',
2147 'src/core/machine-id-setup.h',
2148 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002149 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04002150 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002151 install : true,
2152 install_dir : rootbindir)
2153
2154executable('systemd-fsck',
2155 'src/fsck/fsck.c',
2156 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002157 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002158 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002159 install : true,
2160 install_dir : rootlibexecdir)
2161
Zbigniew Jędrzejewski-Szmek80750ad2017-10-23 13:40:38 +02002162executable('systemd-growfs',
2163 'src/partition/growfs.c',
2164 include_directories : includes,
2165 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekc34b75a2017-11-21 18:56:52 +01002166 dependencies : [libcryptsetup],
Zbigniew Jędrzejewski-Szmek80750ad2017-10-23 13:40:38 +02002167 install_rpath : rootlibexecdir,
2168 install : true,
2169 install_dir : rootlibexecdir)
2170
Zbigniew Jędrzejewski-Szmekb7f28ac2017-11-26 22:51:29 +01002171executable('systemd-makefs',
2172 'src/partition/makefs.c',
2173 include_directories : includes,
2174 link_with : [libshared],
2175 install_rpath : rootlibexecdir,
2176 install : true,
2177 install_dir : rootlibexecdir)
2178
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002179executable('systemd-sleep',
2180 'src/sleep/sleep.c',
2181 include_directories : includes,
2182 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002183 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002184 install : true,
2185 install_dir : rootlibexecdir)
2186
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002187exe = executable('systemd-sysctl',
2188 'src/sysctl/sysctl.c',
2189 include_directories : includes,
2190 link_with : [libshared],
2191 install_rpath : rootlibexecdir,
2192 install : true,
2193 install_dir : rootlibexecdir)
2194public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002195
2196executable('systemd-ac-power',
2197 'src/ac-power/ac-power.c',
2198 include_directories : includes,
2199 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002200 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002201 install : true,
2202 install_dir : rootlibexecdir)
2203
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002204exe = executable('systemd-detect-virt',
2205 'src/detect-virt/detect-virt.c',
2206 include_directories : includes,
2207 link_with : [libshared],
2208 install_rpath : rootlibexecdir,
2209 install : true)
2210public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002211
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002212exe = executable('systemd-delta',
2213 'src/delta/delta.c',
2214 include_directories : includes,
2215 link_with : [libshared],
2216 install_rpath : rootlibexecdir,
2217 install : true)
2218public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002219
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002220exe = executable('systemd-escape',
2221 'src/escape/escape.c',
2222 include_directories : includes,
2223 link_with : [libshared],
2224 install_rpath : rootlibexecdir,
2225 install : true,
2226 install_dir : rootbindir)
2227public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002228
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002229exe = executable('systemd-notify',
2230 'src/notify/notify.c',
2231 include_directories : includes,
2232 link_with : [libshared],
2233 install_rpath : rootlibexecdir,
2234 install : true,
2235 install_dir : rootbindir)
2236public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002237
2238executable('systemd-volatile-root',
2239 'src/volatile-root/volatile-root.c',
2240 include_directories : includes,
2241 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002242 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002243 install : true,
2244 install_dir : rootlibexecdir)
2245
2246executable('systemd-cgroups-agent',
2247 'src/cgroups-agent/cgroups-agent.c',
2248 include_directories : includes,
2249 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002250 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002251 install : true,
2252 install_dir : rootlibexecdir)
2253
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002254exe = executable('systemd-path',
2255 'src/path/path.c',
2256 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002257 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002258 install_rpath : rootlibexecdir,
2259 install : true)
2260public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002261
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002262exe = executable('systemd-ask-password',
2263 'src/ask-password/ask-password.c',
2264 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002265 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002266 install_rpath : rootlibexecdir,
2267 install : true,
2268 install_dir : rootbindir)
2269public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002270
2271executable('systemd-reply-password',
2272 'src/reply-password/reply-password.c',
2273 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002274 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002275 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002276 install : true,
2277 install_dir : rootlibexecdir)
2278
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002279exe = executable('systemd-tty-ask-password-agent',
2280 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2281 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002282 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002283 install_rpath : rootlibexecdir,
2284 install : true,
2285 install_dir : rootbindir)
2286public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002287
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002288exe = executable('systemd-cgls',
2289 'src/cgls/cgls.c',
2290 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002291 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002292 install_rpath : rootlibexecdir,
2293 install : true)
2294public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002295
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002296exe = executable('systemd-cgtop',
2297 'src/cgtop/cgtop.c',
2298 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002299 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002300 install_rpath : rootlibexecdir,
2301 install : true)
2302public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002303
2304executable('systemd-initctl',
2305 'src/initctl/initctl.c',
2306 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002307 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002308 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002309 install : true,
2310 install_dir : rootlibexecdir)
2311
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002312exe = executable('systemd-mount',
2313 'src/mount/mount-tool.c',
2314 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02002315 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002316 install_rpath : rootlibexecdir,
2317 install : true)
2318public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002319
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04002320meson.add_install_script(meson_make_symlink,
Michael Bieble17e5ba2017-04-13 10:30:56 -04002321 'systemd-mount', join_paths(bindir, 'systemd-umount'))
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04002322
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002323exe = executable('systemd-run',
2324 'src/run/run.c',
2325 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002326 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002327 install_rpath : rootlibexecdir,
2328 install : true)
2329public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002330
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002331exe = executable('systemd-stdio-bridge',
2332 'src/stdio-bridge/stdio-bridge.c',
2333 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002334 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002335 install_rpath : rootlibexecdir,
2336 install : true)
2337public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002338
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002339exe = executable('busctl',
2340 'src/busctl/busctl.c',
2341 'src/busctl/busctl-introspect.c',
2342 'src/busctl/busctl-introspect.h',
2343 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002344 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002345 install_rpath : rootlibexecdir,
2346 install : true)
2347public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002348
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002349if conf.get('ENABLE_SYSUSERS') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002350 exe = executable('systemd-sysusers',
2351 'src/sysusers/sysusers.c',
2352 include_directories : includes,
2353 link_with : [libshared],
2354 install_rpath : rootlibexecdir,
2355 install : true,
2356 install_dir : rootbindir)
2357 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002358endif
2359
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002360if conf.get('ENABLE_TMPFILES') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002361 exe = executable('systemd-tmpfiles',
2362 'src/tmpfiles/tmpfiles.c',
2363 include_directories : includes,
2364 link_with : [libshared],
2365 dependencies : [libacl],
2366 install_rpath : rootlibexecdir,
2367 install : true,
2368 install_dir : rootbindir)
2369 public_programs += [exe]
Zbigniew Jędrzejewski-Szmekd9daae52017-11-22 14:13:32 +01002370
2371 test('test-systemd-tmpfiles',
2372 test_systemd_tmpfiles_py,
2373 args : exe.full_path())
2374 # https://github.com/mesonbuild/meson/issues/2681
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002375endif
2376
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002377if conf.get('ENABLE_HWDB') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002378 exe = executable('systemd-hwdb',
2379 'src/hwdb/hwdb.c',
2380 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2381 include_directories : includes,
Zbigniew Jędrzejewski-Szmek0c06b502017-12-19 20:54:46 +01002382 link_with : [libudev_static],
Michael Biebl0da6f392017-04-21 18:32:14 +02002383 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002384 install : true,
2385 install_dir : rootbindir)
2386 public_programs += [exe]
2387endif
2388
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002389if conf.get('ENABLE_QUOTACHECK') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002390 executable('systemd-quotacheck',
2391 'src/quotacheck/quotacheck.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002392 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002393 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002394 install_rpath : rootlibexecdir,
2395 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002396 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002397endif
2398
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002399exe = executable('systemd-socket-proxyd',
2400 'src/socket-proxy/socket-proxyd.c',
2401 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002402 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002403 dependencies : [threads],
2404 install_rpath : rootlibexecdir,
2405 install : true,
2406 install_dir : rootlibexecdir)
2407public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002408
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002409exe = executable('systemd-udevd',
2410 systemd_udevd_sources,
2411 include_directories : includes,
Zbigniew Jędrzejewski-Szmek5c720492017-02-22 23:13:22 -05002412 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002413 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002414 libsystemd_network,
Zbigniew Jędrzejewski-Szmek0c06b502017-12-19 20:54:46 +01002415 libudev_static],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002416 dependencies : [threads,
2417 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002418 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002419 libacl,
2420 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002421 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002422 install : true,
2423 install_dir : rootlibexecdir)
2424public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002425
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002426exe = executable('udevadm',
2427 udevadm_sources,
Franck Bui6671e812017-12-16 09:36:36 +01002428 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002429 include_directories : includes,
2430 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002431 libsystemd_network,
Zbigniew Jędrzejewski-Szmek0c06b502017-12-19 20:54:46 +01002432 libudev_static],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002433 dependencies : [threads,
2434 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002435 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002436 libacl,
2437 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002438 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002439 install : true,
2440 install_dir : rootbindir)
2441public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002442
2443executable('systemd-shutdown',
2444 systemd_shutdown_sources,
2445 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02002446 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek95b862b2018-03-14 11:32:30 +01002447 dependencies : [libmount],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002448 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002449 install : true,
2450 install_dir : rootlibexecdir)
2451
2452executable('systemd-update-done',
2453 'src/update-done/update-done.c',
2454 include_directories : includes,
2455 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002456 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002457 install : true,
2458 install_dir : rootlibexecdir)
2459
2460executable('systemd-update-utmp',
2461 'src/update-utmp/update-utmp.c',
2462 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002463 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002464 dependencies : [libaudit],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002465 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002466 install : true,
2467 install_dir : rootlibexecdir)
2468
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002469if conf.get('HAVE_KMOD') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002470 executable('systemd-modules-load',
2471 'src/modules-load/modules-load.c',
2472 include_directories : includes,
2473 link_with : [libshared],
2474 dependencies : [libkmod],
2475 install_rpath : rootlibexecdir,
2476 install : true,
2477 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002478
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002479 meson.add_install_script('sh', '-c',
2480 mkdir_p.format(modulesloaddir))
2481 meson.add_install_script('sh', '-c',
2482 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002483endif
2484
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002485exe = executable('systemd-nspawn',
2486 systemd_nspawn_sources,
2487 'src/core/mount-setup.c', # FIXME: use a variable?
2488 'src/core/mount-setup.h',
2489 'src/core/loopback-setup.c',
2490 'src/core/loopback-setup.h',
Zbigniew Jędrzejewski-Szmek97d90612018-05-28 10:37:11 +02002491 include_directories : includes,
2492 link_with : [libnspawn_core,
2493 libshared],
2494 dependencies : [libblkid],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002495 install_rpath : rootlibexecdir,
2496 install : true)
2497public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002498
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002499if conf.get('ENABLE_NETWORKD') == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002500 executable('systemd-networkd',
2501 systemd_networkd_sources,
2502 include_directories : includes,
2503 link_with : [libnetworkd_core,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002504 libsystemd_network,
Zbigniew Jędrzejewski-Szmek0c06b502017-12-19 20:54:46 +01002505 libudev_static,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002506 libshared],
Zbigniew Jędrzejewski-Szmek4b57a272017-06-21 06:05:15 -04002507 dependencies : [threads],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002508 install_rpath : rootlibexecdir,
2509 install : true,
2510 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002511
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002512 executable('systemd-networkd-wait-online',
2513 systemd_networkd_wait_online_sources,
2514 include_directories : includes,
2515 link_with : [libnetworkd_core,
2516 libshared],
2517 install_rpath : rootlibexecdir,
2518 install : true,
2519 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002520
Felipe Satelerdcfe0722017-08-21 09:48:41 -03002521 exe = executable('networkctl',
2522 networkctl_sources,
2523 include_directories : includes,
2524 link_with : [libsystemd_network,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002525 libshared],
Felipe Satelerdcfe0722017-08-21 09:48:41 -03002526 install_rpath : rootlibexecdir,
2527 install : true,
2528 install_dir : rootbindir)
2529 public_programs += [exe]
2530endif
Zbigniew Jędrzejewski-Szmeke821f6a2017-12-07 10:44:43 +01002531
2532executable('systemd-sulogin-shell',
2533 ['src/sulogin-shell/sulogin-shell.c'],
2534 include_directories : includes,
2535 link_with : [libshared],
2536 install_rpath : rootlibexecdir,
2537 install : true,
2538 install_dir : rootlibexecdir)
2539
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002540############################################################
2541
2542foreach tuple : tests
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002543 sources = tuple[0]
2544 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2545 dependencies = tuple[2]
2546 condition = tuple.length() >= 4 ? tuple[3] : ''
2547 type = tuple.length() >= 5 ? tuple[4] : ''
2548 defs = tuple.length() >= 6 ? tuple[5] : []
2549 incs = tuple.length() >= 7 ? tuple[6] : includes
2550 timeout = 30
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002551
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002552 name = sources[0].split('/')[-1].split('.')[0]
2553 if type.startswith('timeout=')
2554 timeout = type.split('=')[1].to_int()
2555 type = ''
2556 endif
Adam Duskett08318a22018-01-15 06:25:46 -05002557 if want_tests == 'false'
2558 message('Not compiling @0@ because tests is set to false'.format(name))
2559 elif condition == '' or conf.get(condition) == 1
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002560 exe = executable(
2561 name,
2562 sources,
2563 include_directories : incs,
2564 link_with : link_with,
2565 dependencies : dependencies,
2566 c_args : defs,
2567 install_rpath : rootlibexecdir,
Michael Biebl7cdd9782017-06-23 03:23:30 +02002568 install : install_tests,
2569 install_dir : join_paths(testsdir, type))
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04002570
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002571 if type == 'manual'
2572 message('@0@ is a manual test'.format(name))
2573 elif type == 'unsafe' and want_tests != 'unsafe'
2574 message('@0@ is an unsafe test'.format(name))
2575 else
2576 test(name, exe,
2577 env : test_env,
2578 timeout : timeout)
2579 endif
2580 else
2581 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2582 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002583endforeach
2584
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002585exe = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002586 'test-libsystemd-sym',
2587 test_libsystemd_sym_c,
2588 include_directories : includes,
2589 link_with : [libsystemd],
2590 install : install_tests,
2591 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002592test('test-libsystemd-sym', exe)
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002593
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002594exe = executable(
2595 'test-libsystemd-static-sym',
2596 test_libsystemd_sym_c,
2597 include_directories : includes,
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002598 link_with : [install_libsystemd_static],
2599 dependencies : [threads], # threads is already included in dependencies on the library,
2600 # but does not seem to get propagated. Add here as a work-around.
Davide Cavalca20f3d322018-04-24 13:34:48 -07002601 build_by_default : static_libsystemd_pic,
2602 install : install_tests and static_libsystemd_pic,
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002603 install_dir : testsdir)
Davide Cavalca20f3d322018-04-24 13:34:48 -07002604if static_libsystemd_pic
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002605 test('test-libsystemd-static-sym', exe)
2606endif
2607
2608exe = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002609 'test-libudev-sym',
2610 test_libudev_sym_c,
2611 include_directories : includes,
2612 c_args : ['-Wno-deprecated-declarations'],
2613 link_with : [libudev],
2614 install : install_tests,
2615 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002616test('test-libudev-sym', exe)
2617
2618exe = executable(
2619 'test-libudev-static-sym',
2620 test_libudev_sym_c,
2621 include_directories : includes,
Davide Cavalca20f3d322018-04-24 13:34:48 -07002622 c_args : ['-Wno-deprecated-declarations'],
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002623 link_with : [install_libudev_static],
Davide Cavalca20f3d322018-04-24 13:34:48 -07002624 build_by_default : static_libudev_pic,
2625 install : install_tests and static_libudev_pic,
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002626 install_dir : testsdir)
Davide Cavalca20f3d322018-04-24 13:34:48 -07002627if static_libudev_pic
Zbigniew Jędrzejewski-Szmek0632b4c2018-04-23 13:49:27 +02002628 test('test-libudev-static-sym', exe)
2629endif
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002630
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002631############################################################
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002632
Jonathan Rudenberg7db7d5b2018-01-13 19:51:07 -05002633fuzzer_exes = []
2634
2635foreach tuple : fuzzers
2636 sources = tuple[0]
2637 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2638 dependencies = tuple[2]
2639 defs = tuple.length() >= 4 ? tuple[3] : []
2640 incs = tuple.length() >= 5 ? tuple[4] : includes
2641
Jonathan Rudenberg31e57a32018-01-16 10:25:43 -05002642 if fuzzer_build
Jonathan Rudenberg7db7d5b2018-01-13 19:51:07 -05002643 dependencies += fuzzing_engine
2644 else
2645 sources += 'src/fuzz/fuzz-main.c'
2646 endif
2647
2648 name = sources[0].split('/')[-1].split('.')[0]
2649
2650 fuzzer_exes += executable(
2651 name,
2652 sources,
2653 include_directories : [incs, include_directories('src/fuzz')],
2654 link_with : link_with,
2655 dependencies : dependencies,
2656 c_args : defs,
2657 install : false)
2658endforeach
2659
2660run_target('fuzzers',
2661 depends : fuzzer_exes,
2662 command : ['true'])
2663
2664############################################################
2665
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002666make_directive_index_py = find_program('tools/make-directive-index.py')
2667make_man_index_py = find_program('tools/make-man-index.py')
Zbigniew Jędrzejewski-Szmekb184e8f2017-04-13 19:59:21 -04002668xml_helper_py = find_program('tools/xml_helper.py')
Zbigniew Jędrzejewski-Szmekabba22c2017-04-15 00:40:59 -04002669hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002670
2671subdir('units')
2672subdir('sysctl.d')
2673subdir('sysusers.d')
2674subdir('tmpfiles.d')
Zbigniew Jędrzejewski-Szmeke783f952017-11-23 13:23:42 +01002675subdir('presets')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002676subdir('hwdb')
2677subdir('network')
2678subdir('man')
2679subdir('shell-completion/bash')
2680subdir('shell-completion/zsh')
Lennart Poettering2d684e62018-03-28 16:58:37 +02002681subdir('doc/sysvinit')
2682subdir('doc/var-log')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002683
2684# FIXME: figure out if the warning is true:
2685# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2686install_subdir('factory/etc',
2687 install_dir : factorydir)
2688
2689
2690install_data('xorg/50-systemd-user.sh',
2691 install_dir : xinitrcdir)
Dimitri John Ledkov582faeb2017-08-02 13:41:18 +01002692install_data('modprobe.d/systemd.conf',
2693 install_dir : modprobedir)
Lennart Poetteringf09eb762018-02-26 11:48:46 +01002694install_data('LICENSE.GPL2',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002695 'LICENSE.LGPL2.1',
Lennart Poetteringf09eb762018-02-26 11:48:46 +01002696 'NEWS',
2697 'README',
2698 'doc/CODING_STYLE',
2699 'doc/DISTRO_PORTING',
2700 'doc/ENVIRONMENT.md',
2701 'doc/HACKING',
2702 'doc/TRANSIENT-SETTINGS.md',
2703 'doc/TRANSLATORS',
2704 'doc/UIDS-GIDS.md',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002705 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2706 install_dir : docdir)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002707
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002708meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2709meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2710
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002711############################################################
2712
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002713meson_check_help = find_program('tools/meson-check-help.sh')
2714
2715foreach exec : public_programs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002716 name = exec.full_path().split('/')[-1]
2717 test('check-help-' + name,
2718 meson_check_help,
2719 args : [exec.full_path()])
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002720endforeach
2721
2722############################################################
2723
Zbigniew Jędrzejewski-Szmek52d4d1d2018-03-14 14:27:04 +01002724# Enable tests for all supported sanitizers
2725foreach tuple : sanitizers
2726 sanitizer = tuple[0]
2727 build = tuple[1]
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +11002728
Zbigniew Jędrzejewski-Szmek52d4d1d2018-03-14 14:27:04 +01002729 have = run_command(check_compilation_sh,
2730 cc.cmd_array(), '-x', 'c',
2731 '-fsanitize=@0@'.format(sanitizer),
2732 '-include', link_test_c).returncode() == 0
2733 message('@0@ sanitizer supported: @1@'.format(sanitizer, have ? 'yes' : 'no'))
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +11002734
Zbigniew Jędrzejewski-Szmek52d4d1d2018-03-14 14:27:04 +01002735 if have
2736 prev = ''
2737 foreach p : fuzz_regression_tests
2738 b = p.split('/')[-2]
2739 c = p.split('/')[-1]
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +11002740
Zbigniew Jędrzejewski-Szmek52d4d1d2018-03-14 14:27:04 +01002741 name = '@0@:@1@'.format(b, sanitizer)
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +11002742
Zbigniew Jędrzejewski-Szmek52d4d1d2018-03-14 14:27:04 +01002743 if name != prev
2744 if want_tests == 'false'
2745 message('Not compiling @0@ because tests is set to false'.format(name))
2746 elif slow_tests
2747 exe = custom_target(
2748 name,
2749 output : name,
2750 depends : build,
2751 command : [env, 'ln', '-fs',
2752 join_paths(build.full_path(), b),
2753 '@OUTPUT@'],
2754 build_by_default : true)
2755 else
2756 message('Not compiling @0@ because slow-tests is set to false'.format(name))
2757 endif
2758 endif
2759 prev = name
2760
2761 if want_tests != 'false' and slow_tests
2762 test('@0@:@1@:@2@'.format(b, c, sanitizer),
2763 env,
2764 args : [exe.full_path(),
2765 join_paths(meson.source_root(),
2766 'test/fuzz-regressions',
2767 p)])
2768 endif
2769 endforeach
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +11002770 endif
2771endforeach
2772
Zbigniew Jędrzejewski-Szmek52d4d1d2018-03-14 14:27:04 +01002773
Zbigniew Jędrzejewski-Szmekb68dfb92018-01-19 17:54:30 +11002774############################################################
2775
Zbigniew Jędrzejewski-Szmek0700e8b2017-07-03 12:42:29 -04002776if git.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002777 all_files = run_command(
2778 git,
Davide Cavalca450b60b2017-08-30 08:04:53 -07002779 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002780 'ls-files',
2781 ':/*.[ch]'])
2782 all_files = files(all_files.stdout().split())
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002783
userwithuide85a6902017-08-09 13:41:44 +00002784 custom_target(
Zbigniew Jędrzejewski-Szmek0700e8b2017-07-03 12:42:29 -04002785 'tags',
userwithuide85a6902017-08-09 13:41:44 +00002786 output : 'tags',
Zbigniew Jędrzejewski-Szmek25a82102018-01-26 16:15:17 +01002787 command : [env, 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
Evegeny Vereshchagin2f099742018-05-18 10:52:17 +00002788 run_target(
Zbigniew Jędrzejewski-Szmek0700e8b2017-07-03 12:42:29 -04002789 'ctags',
Zbigniew Jędrzejewski-Szmek25a82102018-01-26 16:15:17 +01002790 command : [env, 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002791endif
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002792
2793if git.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002794 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
Zbigniew Jędrzejewski-Szmeka923e082017-04-17 19:48:20 -04002795 run_target(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002796 'git-contrib',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002797 command : [meson_git_contrib_sh])
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002798endif
Zbigniew Jędrzejewski-Szmekdd6ab3d2017-04-24 19:28:05 -04002799
2800if git.found()
2801 git_head = run_command(
2802 git,
Davide Cavalca450b60b2017-08-30 08:04:53 -07002803 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
Zbigniew Jędrzejewski-Szmekdd6ab3d2017-04-24 19:28:05 -04002804 'rev-parse', 'HEAD']).stdout().strip()
2805 git_head_short = run_command(
2806 git,
Davide Cavalca450b60b2017-08-30 08:04:53 -07002807 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
Zbigniew Jędrzejewski-Szmekdd6ab3d2017-04-24 19:28:05 -04002808 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2809
2810 run_target(
2811 'git-snapshot',
2812 command : ['git', 'archive',
Davide Cavalca450b60b2017-08-30 08:04:53 -07002813 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
Zbigniew Jędrzejewski-Szmekdd6ab3d2017-04-24 19:28:05 -04002814 git_head_short),
2815 '--prefix', 'systemd-@0@/'.format(git_head),
2816 'HEAD'])
2817endif
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002818
2819############################################################
2820
Lennart Poettering51b13862017-12-20 12:51:14 +01002821meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
2822run_target(
2823 'check-api-docs',
2824 depends : [man, libsystemd, libudev],
2825 command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
2826
2827############################################################
2828
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002829status = [
2830 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2831
Zbigniew Jędrzejewski-Szmek26754132018-03-01 11:49:42 +01002832 'split /usr: @0@'.format(split_usr),
Zbigniew Jędrzejewski-Szmek157baa82018-03-01 10:28:29 +01002833 'split bin-sbin: @0@'.format(split_bin),
Yu Watanabe359b4962017-11-25 20:35:24 +09002834 'prefix directory: @0@'.format(prefixdir),
2835 'rootprefix directory: @0@'.format(rootprefixdir),
2836 'sysconf directory: @0@'.format(sysconfdir),
2837 'include directory: @0@'.format(includedir),
2838 'lib directory: @0@'.format(libdir),
2839 'rootlib directory: @0@'.format(rootlibdir),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002840 'SysV init scripts: @0@'.format(sysvinit_path),
2841 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
Yu Watanabe359b4962017-11-25 20:35:24 +09002842 'PAM modules directory: @0@'.format(pamlibdir),
2843 'PAM configuration directory: @0@'.format(pamconfdir),
2844 'RPM macros directory: @0@'.format(rpmmacrosdir),
2845 'modprobe.d directory: @0@'.format(modprobedir),
2846 'D-Bus policy directory: @0@'.format(dbuspolicydir),
2847 'D-Bus session directory: @0@'.format(dbussessionservicedir),
2848 'D-Bus system directory: @0@'.format(dbussystemservicedir),
2849 'bash completions directory: @0@'.format(bashcompletiondir),
2850 'zsh completions directory: @0@'.format(zshcompletiondir),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002851 'extra start script: @0@'.format(get_option('rc-local')),
2852 'extra stop script: @0@'.format(get_option('halt-local')),
2853 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2854 get_option('debug-tty')),
2855 'TTY GID: @0@'.format(tty_gid),
Ikey Doherty84786b82017-12-03 12:28:23 +00002856 'users GID: @0@'.format(users_gid),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002857 'maximum system UID: @0@'.format(system_uid_max),
2858 'maximum system GID: @0@'.format(system_gid_max),
Lennart Poettering87d5e4f2017-12-02 12:48:31 +01002859 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
2860 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
2861 'minimum container UID base: @0@'.format(container_uid_base_min),
2862 'maximum container UID base: @0@'.format(container_uid_base_max),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002863 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
Tom Stellard4e15a732017-10-31 08:46:24 -07002864 'render group access mode: @0@'.format(get_option('group-render-mode')),
Yu Watanabe359b4962017-11-25 20:35:24 +09002865 'certificate root directory: @0@'.format(get_option('certificate-root')),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002866 'support URL: @0@'.format(support_url),
Lennart Poetteringafde4572017-12-05 11:00:24 +01002867 'nobody user name: @0@'.format(nobody_user),
2868 'nobody group name: @0@'.format(nobody_group),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002869 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
Zbigniew Jędrzejewski-Szmek5248e7e2017-07-11 02:15:08 -04002870 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002871
2872 'default DNSSEC mode: @0@'.format(default_dnssec),
Iwan Timmer5d67a7a2018-04-27 17:50:38 +02002873 'default private DNS mode: @0@'.format(default_private_dns),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002874 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2875 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2876
2877alt_dns_servers = '\n '.join(dns_servers.split(' '))
2878alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2879status += [
2880 'default DNS servers: @0@'.format(alt_dns_servers),
2881 'default NTP servers: @0@'.format(alt_ntp_servers)]
2882
2883alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2884 '@@0@'.format(time_epoch)).stdout().strip()
2885status += [
2886 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2887
2888# TODO:
2889# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2890# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2891# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2892
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002893if conf.get('ENABLE_EFI') == 1
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002894 status += [
2895 'efi arch: @0@'.format(efi_arch)]
2896
2897 if have_gnu_efi
2898 status += [
2899 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2900 'EFI CC @0@'.format(efi_cc),
Yu Watanabe359b4962017-11-25 20:35:24 +09002901 'EFI lib directory: @0@'.format(efi_libdir),
2902 'EFI lds directory: @0@'.format(efi_ldsdir),
2903 'EFI include directory: @0@'.format(efi_incdir)]
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002904 endif
2905endif
2906
2907found = []
2908missing = []
2909
2910foreach tuple : [
2911 ['libcryptsetup'],
2912 ['PAM'],
2913 ['AUDIT'],
2914 ['IMA'],
2915 ['AppArmor'],
2916 ['SELinux'],
2917 ['SECCOMP'],
2918 ['SMACK'],
2919 ['zlib'],
2920 ['xz'],
2921 ['lz4'],
2922 ['bzip2'],
2923 ['ACL'],
2924 ['gcrypt'],
2925 ['qrencode'],
2926 ['microhttpd'],
2927 ['gnutls'],
2928 ['libcurl'],
Zbigniew Jędrzejewski-Szmekd1bf5672017-06-16 09:16:28 -04002929 ['idn'],
Zbigniew Jędrzejewski-Szmek87057e22017-05-09 21:56:34 -04002930 ['libidn2'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002931 ['libidn'],
Waldemar Brodkorbe7e11bb2017-06-24 19:30:26 +02002932 ['nss-systemd'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002933 ['libiptc'],
2934 ['elfutils'],
2935 ['binfmt'],
2936 ['vconsole'],
2937 ['quotacheck'],
2938 ['tmpfiles'],
2939 ['environment.d'],
2940 ['sysusers'],
2941 ['firstboot'],
2942 ['randomseed'],
2943 ['backlight'],
2944 ['rfkill'],
2945 ['logind'],
2946 ['machined'],
Lennart Poettering61d05782018-04-16 21:41:40 +02002947 ['portabled'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002948 ['importd'],
2949 ['hostnamed'],
2950 ['timedated'],
2951 ['timesyncd'],
2952 ['localed'],
2953 ['networkd'],
Yu Watanabea7456af2017-10-06 16:33:21 +09002954 ['resolve'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002955 ['coredump'],
2956 ['polkit'],
2957 ['legacy pkla', install_polkit_pkla],
2958 ['efi'],
2959 ['gnu-efi', have_gnu_efi],
2960 ['kmod'],
2961 ['xkbcommon'],
Zbigniew Jędrzejewski-Szmekc4c978a2018-01-12 05:47:17 +01002962 ['pcre2'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002963 ['blkid'],
2964 ['dbus'],
2965 ['glib'],
Zbigniew Jędrzejewski-Szmek08cf5b82017-10-03 12:23:55 +02002966 ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002967 ['hwdb'],
2968 ['tpm'],
2969 ['man pages', want_man],
2970 ['html pages', want_html],
2971 ['man page indices', want_man and have_lxml],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002972 ['SysV compat'],
2973 ['utmp'],
2974 ['ldconfig'],
2975 ['hibernate'],
2976 ['adm group', get_option('adm-group')],
2977 ['wheel group', get_option('wheel-group')],
Franck Buib14e1b42017-05-09 14:02:37 +02002978 ['gshadow'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002979 ['debug hashmap'],
2980 ['debug mmap cache'],
Zbigniew Jędrzejewski-Szmekd18cb392018-05-13 22:28:24 +02002981 ['valgrind', conf.get('VALGRIND') == 1],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002982]
2983
Zbigniew Jędrzejewski-Szmekaf4d7862018-03-09 14:21:08 +01002984 if tuple.length() >= 2
2985 cond = tuple[1]
2986 else
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002987 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2988 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
Zbigniew Jędrzejewski-Szmek349cc4a2017-10-03 10:41:51 +02002989 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002990 endif
2991 if cond
2992 found += [tuple[0]]
2993 else
2994 missing += [tuple[0]]
2995 endif
2996endforeach
2997
2998status += [
Zbigniew Jędrzejewski-Szmek9d39c1b2017-07-26 14:14:44 -04002999 '',
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04003000 'enabled features: @0@'.format(', '.join(found)),
Zbigniew Jędrzejewski-Szmek9d39c1b2017-07-26 14:14:44 -04003001 '',
3002 'disabled features: @0@'.format(', '.join(missing)),
3003 '']
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04003004message('\n '.join(status))
Zbigniew Jędrzejewski-Szmek9a8e64b2017-11-28 21:46:53 +01003005
3006if rootprefixdir != rootprefix_default
Yu Watanabe8ea9fad2018-05-10 14:50:52 +09003007 warning('\n' +
3008 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3009 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3010 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
Zbigniew Jędrzejewski-Szmek9a8e64b2017-11-28 21:46:53 +01003011endif