blob: 2be88c5ea1022e9e9e3323ee4139ea745344b9d4 [file] [log] [blame]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001project('systemd', 'c',
Lennart Poettering43091722017-06-27 23:11:26 +02002 version : '234',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04003 license : 'LGPLv2+',
4 default_options: [
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04005 'c_std=gnu99',
6 'prefix=/usr',
7 'sysconfdir=/etc',
8 'localstatedir=/var',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04009 ],
Zbigniew Jędrzejewski-Szmekd730e2d2017-04-25 08:49:58 -040010 meson_version : '>= 0.40',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040011 )
12
13# We need the same data in three different formats, ugh!
14# Also, for hysterical reasons, we use different variable
15# names, sometimes. Not all variables are included in every
16# set. Ugh, ugh, ugh!
17conf = configuration_data()
18conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
19conf.set_quoted('PACKAGE_VERSION', meson.project_version())
20
21substs = configuration_data()
22substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
23substs.set('PACKAGE_VERSION', meson.project_version())
24
25m4_defines = []
26
27#####################################################################
28
Zbigniew Jędrzejewski-Szmekab916f22017-04-13 22:15:01 -040029rootprefixdir = get_option('rootprefix')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040030if get_option('split-usr')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -040031 conf.set('HAVE_SPLIT_USR', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040032 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040033else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040034 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040035endif
36
37sysvinit_path = get_option('sysvinit-path')
38sysvrcnd_path = get_option('sysvrcnd-path')
39if sysvinit_path != '' or sysvrcnd_path != ''
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -040040 conf.set('HAVE_SYSV_COMPAT', true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040041 description : 'SysV init scripts and rcN.d links are supported')
42 m4_defines += ['-DHAVE_SYSV_COMPAT']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040043endif
44
45# join_paths ignore the preceding arguments if an absolute component is
46# encountered, so this should canonicalize various paths when they are
47# absolute or relative.
48prefixdir = get_option('prefix')
49if not prefixdir.startswith('/')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040050 error('Prefix is not absolute: "@0@"'.format(prefixdir))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040051endif
52bindir = join_paths(prefixdir, get_option('bindir'))
53libdir = join_paths(prefixdir, get_option('libdir'))
54sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
55includedir = join_paths(prefixdir, get_option('includedir'))
56datadir = join_paths(prefixdir, get_option('datadir'))
57localstatedir = join_paths('/', get_option('localstatedir'))
58
59rootbindir = join_paths(rootprefixdir, 'bin')
60rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
61
62rootlibdir = get_option('rootlibdir')
63if rootlibdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040064 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040065endif
66
67# Dirs of external packages
Michael Bieble17e5ba2017-04-13 10:30:56 -040068pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
69pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
70polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
71polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
72polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
73varlogdir = join_paths(localstatedir, 'log')
74xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040075rpmmacrosdir = get_option('rpmmacrosdir')
76
77# Our own paths
Michael Bieble17e5ba2017-04-13 10:30:56 -040078pkgdatadir = join_paths(datadir, 'systemd')
79environmentdir = join_paths(prefixdir, 'lib/environment.d')
80pkgsysconfdir = join_paths(sysconfdir, 'systemd')
81userunitdir = join_paths(prefixdir, 'lib/systemd/user')
82userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
83tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
84sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
85sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
86binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
87modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
88networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
89pkgincludedir = join_paths(includedir, 'systemd')
90systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
91usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
92systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
93userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
94systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
95systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
96systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
97systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
98udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
99udevhomedir = udevlibexecdir
100udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
101udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
102catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
103kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
104factorydir = join_paths(datadir, 'factory')
105docdir = join_paths(datadir, 'doc/systemd')
106bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
107testsdir = join_paths(prefixdir, 'lib/systemd/tests')
108systemdstatedir = join_paths(localstatedir, 'lib/systemd')
109catalogstatedir = join_paths(systemdstatedir, 'catalog')
110randomseeddir = join_paths(localstatedir, 'lib/systemd')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400111
112dbuspolicydir = get_option('dbuspolicydir')
113if dbuspolicydir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400114 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400115endif
116
117dbussessionservicedir = get_option('dbussessionservicedir')
118if dbussessionservicedir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400119 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400120endif
121
122dbussystemservicedir = get_option('dbussystemservicedir')
123if dbussystemservicedir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400124 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400125endif
126
127pamlibdir = get_option('pamlibdir')
128if pamlibdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400129 pamlibdir = join_paths(rootlibdir, 'security')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400130endif
131
132pamconfdir = get_option('pamconfdir')
133if pamconfdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400134 pamconfdir = join_paths(sysconfdir, 'pam.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400135endif
136
137conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400138conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400139conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
140conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
141conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400142conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
143conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400144conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400145conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
146conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400147conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
148conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
149conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
150conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
151conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
152conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
153conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
154conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
155conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400156conf.set_quoted('ROOTPREFIX', rootprefixdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400157conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400158conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
159conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400160conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
161conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
162conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
163conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
164conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
165conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400166conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
167conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400168conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400169conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400170conf.set_quoted('LIBDIR', libdir)
171conf.set_quoted('ROOTLIBDIR', rootlibdir)
172conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
173conf.set_quoted('BOOTLIBDIR', bootlibdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400174conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
175conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
176conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
177conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
178conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
179conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400180
181conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
182conf.set_quoted('ABS_SRC_DIR', meson.source_root())
183
184substs.set('prefix', prefixdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400185substs.set('exec_prefix', prefixdir)
186substs.set('libdir', libdir)
187substs.set('rootlibdir', rootlibdir)
188substs.set('includedir', includedir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400189substs.set('pkgsysconfdir', pkgsysconfdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400190substs.set('bindir', bindir)
191substs.set('rootbindir', rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400192substs.set('rootlibexecdir', rootlibexecdir)
193substs.set('systemunitdir', systemunitdir)
194substs.set('userunitdir', userunitdir)
195substs.set('systempresetdir', systempresetdir)
196substs.set('userpresetdir', userpresetdir)
197substs.set('udevhwdbdir', udevhwdbdir)
198substs.set('udevrulesdir', udevrulesdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400199substs.set('udevlibexecdir', udevlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400200substs.set('catalogdir', catalogdir)
201substs.set('tmpfilesdir', tmpfilesdir)
202substs.set('sysusersdir', sysusersdir)
203substs.set('sysctldir', sysctldir)
204substs.set('binfmtdir', binfmtdir)
205substs.set('modulesloaddir', modulesloaddir)
206substs.set('systemgeneratordir', systemgeneratordir)
207substs.set('usergeneratordir', usergeneratordir)
208substs.set('systemenvgeneratordir', systemenvgeneratordir)
209substs.set('userenvgeneratordir', userenvgeneratordir)
210substs.set('systemshutdowndir', systemshutdowndir)
211substs.set('systemsleepdir', systemsleepdir)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400212substs.set('VARLOGDIR', varlogdir)
213substs.set('CERTIFICATEROOT', get_option('certificate-root'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400214substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
215substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400216substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
217substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
218substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
219substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400220
221#####################################################################
222
223cc = meson.get_compiler('c')
224pkgconfig = import('pkgconfig')
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400225check_compilation_sh = find_program('tools/meson-check-compilation.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400226
Zbigniew Jędrzejewski-Szmek94e25232017-05-13 13:23:28 -0400227cxx = find_program('c++', required : false)
228if cxx.found()
229 # Used only for tests
230 add_languages('cpp')
231endif
232
Zbigniew Jędrzejewski-Szmek75cf1d62017-07-04 17:59:15 -0400233foreach arg : ['-Wextra',
234 '-Wundef',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400235 '-Wlogical-op',
236 '-Wmissing-include-dirs',
237 '-Wold-style-definition',
238 '-Wpointer-arith',
239 '-Winit-self',
240 '-Wdeclaration-after-statement',
241 '-Wfloat-equal',
242 '-Wsuggest-attribute=noreturn',
243 '-Werror=missing-prototypes',
244 '-Werror=implicit-function-declaration',
245 '-Werror=missing-declarations',
246 '-Werror=return-type',
247 '-Werror=incompatible-pointer-types',
248 '-Werror=format=2',
249 '-Wstrict-prototypes',
250 '-Wredundant-decls',
251 '-Wmissing-noreturn',
252 '-Wshadow',
253 '-Wendif-labels',
254 '-Wstrict-aliasing=2',
255 '-Wwrite-strings',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400256 '-Werror=overflow',
257 '-Wdate-time',
258 '-Wnested-externs',
259 '-ffast-math',
260 '-fno-common',
261 '-fdiagnostics-show-option',
262 '-fno-strict-aliasing',
263 '-fvisibility=hidden',
264 '-fstack-protector',
265 '-fstack-protector-strong',
266 '-fPIE',
267 '--param=ssp-buffer-size=4',
268 ]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400269 if cc.has_argument(arg)
270 add_project_arguments(arg, language : 'c')
271 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400272endforeach
273
Zbigniew Jędrzejewski-Szmek2c5434a2017-04-27 10:05:41 -0400274# "negative" arguments: gcc on purpose does not return an error for "-Wno-"
275# arguments, just emits a warnings. So test for the "positive" version instead.
276foreach arg : ['unused-parameter',
277 'missing-field-initializers',
278 'unused-result',
279 'format-signedness']
280 if cc.has_argument('-W' + arg)
281 add_project_arguments('-Wno-' + arg, language : 'c')
282 endif
283endforeach
284
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400285if cc.compiles('
286 #include <time.h>
287 #include <inttypes.h>
288 typedef uint64_t usec_t;
289 usec_t now(clockid_t clock);
290 int main(void) {
291 struct timespec now;
292 return 0;
293 }
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400294', name : '-Werror=shadow with local shadowing')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400295 add_project_arguments('-Werror=shadow', language : 'c')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400296endif
297
298if cc.get_id() == 'clang'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400299 foreach arg : ['-Wno-typedef-redefinition',
300 '-Wno-gnu-variable-sized-type-not-at-end',
301 ]
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400302 if cc.has_argument(arg,
303 name : '@0@ is supported'.format(arg))
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400304 add_project_arguments(arg, language : 'c')
305 endif
306 endforeach
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400307endif
308
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400309link_test_c = files('tools/meson-link-test.c')
310
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400311# --as-needed and --no-undefined are provided by meson by default,
312# run mesonconf to see what is enabled
313foreach arg : ['-Wl,-z,relro',
314 '-Wl,-z,now',
315 '-pie',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400316 ]
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400317
318 have = run_command(check_compilation_sh,
319 cc.cmd_array(), '-x', 'c', arg,
320 '-include', link_test_c).returncode() == 0
321 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
322 if have
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400323 add_project_link_arguments(arg, language : 'c')
324 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400325endforeach
326
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400327if get_option('buildtype') != 'debug'
328 foreach arg : ['-ffunction-sections',
329 '-fdata-sections']
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400330 if cc.has_argument(arg,
331 name : '@0@ is supported'.format(arg))
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400332 add_project_arguments(arg, language : 'c')
333 endif
334 endforeach
335
336 foreach arg : ['-Wl,--gc-sections']
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400337 have = run_command(check_compilation_sh,
338 cc.cmd_array(), '-x', 'c', arg,
339 '-include', link_test_c).returncode() == 0
340 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
341 if have
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400342 add_project_link_arguments(arg, language : 'c')
343 endif
344 endforeach
345endif
346
Zbigniew Jędrzejewski-Szmek9cc0e6e2017-04-11 10:25:34 -0400347cpp = ' '.join(cc.cmd_array()) + ' -E'
348
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400349#####################################################################
350# compilation result tests
351
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400352conf.set('_GNU_SOURCE', true)
353conf.set('__SANE_USERSPACE_TYPES__', true)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400354
355conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
356conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
357conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
358conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
359conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
360conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
361conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
362
363decl_headers = '''
364#include <uchar.h>
365#include <linux/ethtool.h>
366'''
367# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
368
369foreach decl : ['char16_t',
370 'char32_t',
371 'key_serial_t',
372 'struct ethtool_link_settings',
373 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400374
375 # We get -1 if the size cannot be determined
376 have = cc.sizeof(decl, prefix : decl_headers) > 0
377 conf.set('HAVE_' + decl.underscorify().to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400378endforeach
379
380foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
381 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
382 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
383 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
384 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
385 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
386 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
387 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
388 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
389 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
Susant Sahani9dfed8d2017-04-25 20:30:34 +0530390 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400391 # if_tunnel.h is buggy and cannot be included on its own
392 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
393 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
394 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
395 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
396 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
397 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
398 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
399 ['NDA_IFINDEX', 'linux/neighbour.h'],
400 ['IFA_FLAGS', 'linux/if_addr.h'],
401 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
402 ]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400403 prefix = decl.length() > 2 ? decl[2] : ''
404 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
405 conf.set10('HAVE_DECL_' + decl[0], have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400406endforeach
407
408skip = false
409foreach ident : ['secure_getenv', '__secure_getenv']
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400410 if not skip and cc.has_function(ident)
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400411 conf.set('HAVE_' + ident.to_upper(), true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400412 skip = true
413 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400414endforeach
415
416foreach ident : [
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400417 ['memfd_create', '''#include <sys/memfd.h>'''],
418 ['gettid', '''#include <sys/types.h>'''],
419 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
420 ['name_to_handle_at', '''#define _GNU_SOURCE
421 #include <sys/types.h>
422 #include <sys/stat.h>
423 #include <fcntl.h>'''],
424 ['setns', '''#define _GNU_SOURCE
425 #include <sched.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400426 ['renameat2', '''#include <stdio.h>'''],
427 ['kcmp', '''#include <linux/kcmp.h>'''],
428 ['keyctl', '''#include <sys/types.h>
429 #include <keyutils.h>'''],
430 ['copy_file_range', '''#include <sys/syscall.h>
431 #include <unistd.h>'''],
Zbigniew Jędrzejewski-Szmek38f1ae02017-04-19 16:14:16 -0400432 ['explicit_bzero' , '''#include <string.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400433]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400434
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400435 have = cc.has_function(ident[0], prefix : ident[1])
436 conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400437endforeach
438
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400439if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400440 conf.set('USE_SYS_RANDOM_H', true)
441 conf.set10('HAVE_DECL_GETRANDOM', true)
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400442else
443 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
444 conf.set10('HAVE_DECL_GETRANDOM', have)
445endif
446
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400447#####################################################################
448
449sed = find_program('sed')
450grep = find_program('grep')
451awk = find_program('awk')
Zbigniew Jędrzejewski-Szmekd730e2d2017-04-25 08:49:58 -0400452m4 = find_program('m4')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400453stat = find_program('stat')
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -0400454git = find_program('git', required : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400455
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -0400456meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400457mkdir_p = 'mkdir -p $DESTDIR/@0@'
Zbigniew Jędrzejewski-Szmekd83f4f52017-04-16 12:04:46 -0400458test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
459splash_bmp = files('test/splash.bmp')
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400460
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400461# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
462# /usr/sbin, /sbin, and fall back to the default from middle column.
463progs = [['telinit', '/lib/sysvinit/telinit'],
464 ['quotaon', '/usr/sbin/quotaon' ],
465 ['quotacheck', '/usr/sbin/quotacheck' ],
466 ['kill', '/usr/bin/kill' ],
467 ['kmod', '/usr/bin/kmod' ],
468 ['kexec', '/usr/sbin/kexec' ],
469 ['sulogin', '/usr/sbin/sulogin' ],
470 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
471 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
472 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
473 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
474 ]
475foreach prog : progs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400476 path = get_option(prog[0] + '-path')
477 if path != ''
478 message('Using @1@ for @0@'.format(prog[0], path))
479 else
480 exe = find_program(prog[0],
481 '/usr/sbin/' + prog[0],
482 '/sbin/' + prog[0],
483 required: false)
484 path = exe.found() ? exe.path() : prog[1]
485 endif
486 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
487 conf.set_quoted(name, path)
488 substs.set(name, path)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400489endforeach
490
Zbigniew Jędrzejewski-Szmek1276a9f2017-04-18 19:11:54 -0400491if run_command('ln', '--relative', '--help').returncode() != 0
492 error('ln does not support --relative')
493endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400494
495############################################################
496
497gperf = find_program('gperf')
498
499gperf_test_format = '''
500#include <string.h>
501const char * in_word_set(const char *, @0@);
502@1@
503'''
504gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
505gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
506gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
507if cc.compiles(gperf_test)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400508 gperf_len_type = 'size_t'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400509else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400510 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
511 if cc.compiles(gperf_test)
512 gperf_len_type = 'unsigned'
513 else
514 error('unable to determine gperf len type')
515 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400516endif
517message('gperf len type is @0@'.format(gperf_len_type))
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400518conf.set('GPERF_LEN_TYPE', gperf_len_type,
519 description : 'The type of gperf "len" parameter')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400520
521############################################################
522
523if not cc.has_header('sys/capability.h')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400524 error('POSIX caps headers not found')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400525endif
526foreach header : ['linux/btrfs.h',
527 'linux/memfd.h',
528 'linux/vm_sockets.h',
529 'valgrind/memcheck.h',
530 'valgrind/valgrind.h',
531 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400532
533 conf.set('HAVE_' + header.underscorify().to_upper(),
534 cc.has_header(header))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400535endforeach
536
537############################################################
538
539conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
Zbigniew Jędrzejewski-Szmek5248e7e2017-07-11 02:15:08 -0400540conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
541gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400542
543default_hierarchy = get_option('default-hierarchy')
544conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
545 description : 'default cgroup hierarchy as string')
546if default_hierarchy == 'legacy'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400547 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400548elif default_hierarchy == 'hybrid'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400549 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400550else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400551 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400552endif
553
554time_epoch = get_option('time-epoch')
555if time_epoch == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400556 NEWS = files('NEWS')
557 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400558endif
559time_epoch = time_epoch.to_int()
560conf.set('TIME_EPOCH', time_epoch)
561
562system_uid_max = get_option('system-uid-max')
563if system_uid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400564 system_uid_max = run_command(
565 awk,
566 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
567 '/etc/login.defs').stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400568endif
569system_uid_max = system_uid_max.to_int()
570conf.set('SYSTEM_UID_MAX', system_uid_max)
571substs.set('systemuidmax', system_uid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400572message('maximum system UID is @0@'.format(system_uid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400573
574conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
575conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
576
577system_gid_max = get_option('system-gid-max')
578if system_gid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400579 system_gid_max = run_command(
580 awk,
581 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
582 '/etc/login.defs').stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400583endif
584system_gid_max = system_gid_max.to_int()
585conf.set('SYSTEM_GID_MAX', system_gid_max)
586substs.set('systemgidmax', system_gid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400587message('maximum system GID is @0@'.format(system_gid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400588
589tty_gid = get_option('tty-gid')
590conf.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400591substs.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400592
593if get_option('adm-group')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400594 m4_defines += ['-DENABLE_ADM_GROUP']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400595endif
596
597if get_option('wheel-group')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400598 m4_defines += ['-DENABLE_WHEEL_GROUP']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400599endif
600
601substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
602
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400603kill_user_processes = get_option('default-kill-user-processes')
604conf.set10('KILL_USER_PROCESSES', kill_user_processes)
605substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400606
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400607dns_servers = get_option('dns-servers')
608conf.set_quoted('DNS_SERVERS', dns_servers)
609substs.set('DNS_SERVERS', dns_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400610
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400611ntp_servers = get_option('ntp-servers')
612conf.set_quoted('NTP_SERVERS', ntp_servers)
613substs.set('NTP_SERVERS', ntp_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400614
615conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
616
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400617substs.set('SUSHELL', get_option('debug-shell'))
618substs.set('DEBUGTTY', get_option('debug-tty'))
619
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400620debug = get_option('debug')
621if debug != ''
622 foreach name : debug.split(',')
623 if name == 'hashmap'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400624 conf.set('ENABLE_DEBUG_HASHMAP', true)
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400625 elif name == 'mmap-cache'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400626 conf.set('ENABLE_DEBUG_MMAP_CACHE', true)
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400627 else
628 message('unknown debug option "@0@", ignoring'.format(name))
629 endif
630 endforeach
631endif
632
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400633#####################################################################
634
635threads = dependency('threads')
636librt = cc.find_library('rt')
637libm = cc.find_library('m')
638libdl = cc.find_library('dl')
639libcrypt = cc.find_library('crypt')
640
Zbigniew Jędrzejewski-Szmek1800cc82017-04-27 01:30:30 -0400641libcap = dependency('libcap', required : false)
642if not libcap.found()
643 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
644 libcap = cc.find_library('cap')
645endif
646
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400647libmount = dependency('mount',
648 version : '>= 2.27')
649
650want_seccomp = get_option('seccomp')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400651if want_seccomp != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400652 libseccomp = dependency('libseccomp',
Zbigniew Jędrzejewski-Szmek9f0e9c02017-04-27 10:05:18 -0400653 version : '>= 2.3.1',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400654 required : want_seccomp == 'true')
655 if libseccomp.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400656 conf.set('HAVE_SECCOMP', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400657 m4_defines += ['-DHAVE_SECCOMP']
658 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400659else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400660 libseccomp = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400661endif
662
663want_selinux = get_option('selinux')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400664if want_selinux != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400665 libselinux = dependency('libselinux',
666 version : '>= 2.1.9',
667 required : want_selinux == 'true')
668 if libselinux.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400669 conf.set('HAVE_SELINUX', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400670 m4_defines += ['-DHAVE_SELINUX']
671 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400672else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400673 libselinux = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400674endif
675
676want_apparmor = get_option('apparmor')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400677if want_apparmor != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400678 libapparmor = dependency('libapparmor',
679 required : want_apparmor == 'true')
680 if libapparmor.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400681 conf.set('HAVE_APPARMOR', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400682 m4_defines += ['-DHAVE_APPARMOR']
683 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400684else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400685 libapparmor = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400686endif
687
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400688smack_run_label = get_option('smack-run-label')
689if smack_run_label != ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400690 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
691 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400692endif
693
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400694want_polkit = get_option('polkit')
695install_polkit = false
696install_polkit_pkla = false
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400697if want_polkit != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400698 conf.set('ENABLE_POLKIT', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400699 install_polkit = true
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400700
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400701 libpolkit = dependency('polkit-gobject-1',
702 required : false)
703 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
704 message('Old polkit detected, will install pkla files')
705 install_polkit_pkla = true
706 endif
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400707endif
708
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400709want_acl = get_option('acl')
710if want_acl != 'false'
711 libacl = cc.find_library('acl', required : want_acl == 'true')
712 if libacl.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400713 conf.set('HAVE_ACL', true)
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400714 m4_defines += ['-DHAVE_ACL']
715 endif
716else
717 libacl = []
718endif
719
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400720want_audit = get_option('audit')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400721if want_audit != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400722 libaudit = dependency('audit', required : want_audit == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400723 conf.set('HAVE_AUDIT', libaudit.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400724else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400725 libaudit = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400726endif
727
728want_blkid = get_option('blkid')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400729if want_blkid != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400730 libblkid = dependency('blkid', required : want_blkid == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400731 conf.set('HAVE_BLKID', libblkid.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400732else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400733 libblkid = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400734endif
735
736want_kmod = get_option('kmod')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400737if want_kmod != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400738 libkmod = dependency('libkmod',
739 version : '>= 15',
740 required : want_kmod == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400741 conf.set('HAVE_KMOD', libkmod.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400742else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400743 libkmod = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400744endif
745
746want_pam = get_option('pam')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400747if want_pam != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400748 libpam = cc.find_library('pam', required : want_pam == 'true')
749 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
750 if libpam.found() and libpam_misc.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400751 conf.set('HAVE_PAM', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400752 m4_defines += ['-DHAVE_PAM']
753 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400754else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400755 libpam = []
756 libpam_misc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400757endif
758
759want_microhttpd = get_option('microhttpd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400760if want_microhttpd != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400761 libmicrohttpd = dependency('libmicrohttpd',
762 version : '>= 0.9.33',
763 required : want_microhttpd == 'true')
764 if libmicrohttpd.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400765 conf.set('HAVE_MICROHTTPD', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400766 m4_defines += ['-DHAVE_MICROHTTPD']
767 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400768else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400769 libmicrohttpd = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400770endif
771
772want_libcryptsetup = get_option('libcryptsetup')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400773if want_libcryptsetup != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400774 libcryptsetup = dependency('libcryptsetup',
775 version : '>= 1.6.0',
776 required : want_libcryptsetup == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400777 conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400778else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400779 libcryptsetup = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400780endif
781
782want_libcurl = get_option('libcurl')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400783if want_libcurl != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400784 libcurl = dependency('libcurl',
785 version : '>= 7.32.0',
786 required : want_libcurl == 'true')
787 if libcurl.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400788 conf.set('HAVE_LIBCURL', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400789 m4_defines += ['-DHAVE_LIBCURL']
790 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400791else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400792 libcurl = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400793endif
794
795want_libidn = get_option('libidn')
Zbigniew Jędrzejewski-Szmek87057e22017-05-09 21:56:34 -0400796want_libidn2 = get_option('libidn2')
797if want_libidn == 'true' and want_libidn2 == 'true'
798 error('libidn and libidn2 cannot be requested simultaneously')
799endif
800
Zbigniew Jędrzejewski-Szmek7f7ab222017-07-12 03:25:59 -0400801if want_libidn != 'false' and want_libidn2 != 'true'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400802 libidn = dependency('libidn',
803 required : want_libidn == 'true')
804 if libidn.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400805 conf.set('HAVE_LIBIDN', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400806 m4_defines += ['-DHAVE_LIBIDN']
807 endif
Zbigniew Jędrzejewski-Szmek7f7ab222017-07-12 03:25:59 -0400808else
809 libidn = []
810endif
811if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false'
812 # libidn is used for both libidn and libidn2 objects
813 libidn = dependency('libidn2',
814 required : want_libidn2 == 'true')
815 if libidn.found()
816 conf.set('HAVE_LIBIDN2', true)
817 m4_defines += ['-DHAVE_LIBIDN2']
818 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400819endif
820
821want_libiptc = get_option('libiptc')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400822if want_libiptc != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400823 libiptc = dependency('libiptc',
824 required : want_libiptc == 'true')
825 if libiptc.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400826 conf.set('HAVE_LIBIPTC', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400827 m4_defines += ['-DHAVE_LIBIPTC']
828 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400829else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400830 libiptc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400831endif
832
833want_qrencode = get_option('qrencode')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400834if want_qrencode != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400835 libqrencode = dependency('libqrencode',
836 required : want_qrencode == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400837 conf.set('HAVE_QRENCODE', libqrencode.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400838else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400839 libqrencode = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400840endif
841
842want_gnutls = get_option('gnutls')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400843if want_gnutls != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400844 libgnutls = dependency('gnutls',
845 version : '>= 3.1.4',
846 required : want_gnutls == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400847 conf.set('HAVE_GNUTLS', libgnutls.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400848else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400849 libgnutls = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400850endif
851
852want_elfutils = get_option('elfutils')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400853if want_elfutils != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400854 libdw = dependency('libdw',
855 required : want_elfutils == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400856 conf.set('HAVE_ELFUTILS', libdw.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400857else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400858 libdw = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400859endif
860
861want_zlib = get_option('zlib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400862if want_zlib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400863 libz = dependency('zlib',
864 required : want_zlib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400865 conf.set('HAVE_ZLIB', libz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400866else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400867 libz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400868endif
869
870want_bzip2 = get_option('bzip2')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400871if want_bzip2 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400872 libbzip2 = cc.find_library('bz2',
873 required : want_bzip2 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400874 conf.set('HAVE_BZIP2', libbzip2.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400875else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400876 libbzip2 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400877endif
878
879want_xz = get_option('xz')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400880if want_xz != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400881 libxz = dependency('liblzma',
882 required : want_xz == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400883 conf.set('HAVE_XZ', libxz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400884else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400885 libxz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400886endif
887
888want_lz4 = get_option('lz4')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400889if want_lz4 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400890 liblz4 = dependency('liblz4',
891 required : want_lz4 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400892 conf.set('HAVE_LZ4', liblz4.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400893else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400894 liblz4 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400895endif
896
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400897want_glib = get_option('glib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400898if want_glib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400899 libglib = dependency('glib-2.0',
900 version : '>= 2.22.0',
901 required : want_glib == 'true')
902 libgobject = dependency('gobject-2.0',
903 version : '>= 2.22.0',
904 required : want_glib == 'true')
905 libgio = dependency('gio-2.0',
906 required : want_glib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400907 have = libglib.found() and libgobject.found() and libgio.found()
908 conf.set('HAVE_GLIB', have)
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400909else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400910 libglib = []
911 libgobject = []
912 libgio = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400913endif
914
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400915want_xkbcommon = get_option('xkbcommon')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400916if want_xkbcommon != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400917 libxkbcommon = dependency('xkbcommon',
918 version : '>= 0.3.0',
919 required : want_xkbcommon == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400920 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400921else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400922 libxkbcommon = []
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400923endif
924
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400925want_dbus = get_option('dbus')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400926if want_dbus != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400927 libdbus = dependency('dbus-1',
928 version : '>= 1.3.2',
929 required : want_dbus == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400930 conf.set('HAVE_DBUS', libdbus.found())
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400931else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400932 libdbus = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400933endif
934
Michael Biebl76c87412017-04-21 23:45:54 +0200935want_gcrypt = get_option('gcrypt')
936if want_gcrypt != 'false'
937 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
938 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
939
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400940 have_deps = libgcrypt.found() and libgpg_error.found()
941 conf.set('HAVE_GCRYPT', have_deps)
942 if not have_deps
Michael Biebl76c87412017-04-21 23:45:54 +0200943 # link to neither of the libs if one is not found
944 libgcrypt = []
945 libgpg_error = []
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400946 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400947else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400948 libgcrypt = []
Michael Biebl76c87412017-04-21 23:45:54 +0200949 libgpg_error = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400950endif
951
Yu Watanabe42303dc2017-06-18 05:22:32 +0900952default_dnssec = get_option('default-dnssec')
953if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false)
954 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
955 default_dnssec = 'no'
956endif
957conf.set('DEFAULT_DNSSEC_MODE',
958 'DNSSEC_' + default_dnssec.underscorify().to_upper())
959substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
960
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400961want_importd = get_option('importd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400962if want_importd != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400963 have_deps = (conf.get('HAVE_LIBCURL', false) and
964 conf.get('HAVE_ZLIB', false) and
965 conf.get('HAVE_BZIP2', false) and
966 conf.get('HAVE_XZ', false) and
967 conf.get('HAVE_GCRYPT', false))
968 conf.set('ENABLE_IMPORTD', have_deps)
969 if want_importd == 'true' and not have_deps
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400970 error('importd support was requested, but dependencies are not available')
971 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400972endif
973
974want_remote = get_option('remote')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400975if want_remote != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400976 have_deps = [conf.get('HAVE_MICROHTTPD', false),
977 conf.get('HAVE_LIBCURL', false)]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400978 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
979 # it's possible to build one without the other. Complain only if
980 # support was explictly requested. The auxiliary files like sysusers
981 # config should be installed when any of the programs are built.
982 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
983 error('remote support was requested, but dependencies are not available')
984 endif
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400985 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400986endif
987
988foreach pair : [['utmp', 'HAVE_UTMP'],
989 ['hibernate', 'ENABLE_HIBERNATE'],
990 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
991 ['binfmt', 'ENABLE_BINFMT'],
992 ['coredump', 'ENABLE_COREDUMP'],
993 ['resolve', 'ENABLE_RESOLVED'],
994 ['logind', 'ENABLE_LOGIND'],
995 ['hostnamed', 'ENABLE_HOSTNAMED'],
996 ['localed', 'ENABLE_LOCALED'],
997 ['machined', 'ENABLE_MACHINED'],
998 ['networkd', 'ENABLE_NETWORKD'],
999 ['timedated', 'ENABLE_TIMEDATED'],
1000 ['timesyncd', 'ENABLE_TIMESYNCD'],
1001 ['myhostname', 'HAVE_MYHOSTNAME'],
1002 ['firstboot', 'ENABLE_FIRSTBOOT'],
1003 ['randomseed', 'ENABLE_RANDOMSEED'],
1004 ['backlight', 'ENABLE_BACKLIGHT'],
1005 ['vconsole', 'ENABLE_VCONSOLE'],
1006 ['quotacheck', 'ENABLE_QUOTACHECK'],
1007 ['sysusers', 'ENABLE_SYSUSERS'],
1008 ['tmpfiles', 'ENABLE_TMPFILES'],
1009 ['hwdb', 'ENABLE_HWDB'],
1010 ['rfkill', 'ENABLE_RFKILL'],
1011 ['ldconfig', 'ENABLE_LDCONFIG'],
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001012 ['efi', 'ENABLE_EFI'],
Zbigniew Jędrzejewski-Szmek18b9ad12017-07-13 09:31:47 -04001013 ['tpm', 'ENABLE_TPM'],
Zbigniew Jędrzejewski-Szmek2895c8e2017-04-13 19:45:05 -04001014 ['ima', 'HAVE_IMA'],
Zbigniew Jędrzejewski-Szmek5464ec82017-04-24 19:28:04 -04001015 ['smack', 'HAVE_SMACK'],
Franck Buib14e1b42017-05-09 14:02:37 +02001016 ['gshadow', 'ENABLE_GSHADOW'],
Zbigniew Jędrzejewski-Szmekd1bf5672017-06-16 09:16:28 -04001017 ['idn', 'ENABLE_IDN'],
Waldemar Brodkorbe7e11bb2017-06-24 19:30:26 +02001018 ['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001019 ]
1020
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001021 if get_option(pair[0])
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001022 conf.set(pair[1], true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001023 m4_defines += ['-D' + pair[1]]
1024 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001025endforeach
1026
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001027want_tests = get_option('tests')
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04001028install_tests = get_option('install-tests')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001029tests = []
1030
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001031#####################################################################
1032
1033if get_option('efi')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001034 efi_arch = host_machine.cpu_family()
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001035
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001036 if efi_arch == 'x86'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001037 EFI_MACHINE_TYPE_NAME = 'ia32'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001038 gnu_efi_arch = 'ia32'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001039 elif efi_arch == 'x86_64'
1040 EFI_MACHINE_TYPE_NAME = 'x64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001041 gnu_efi_arch = 'x86_64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001042 elif efi_arch == 'arm'
1043 EFI_MACHINE_TYPE_NAME = 'arm'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001044 gnu_efi_arch = 'arm'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001045 elif efi_arch == 'aarch64'
1046 EFI_MACHINE_TYPE_NAME = 'aa64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001047 gnu_efi_arch = 'aarch64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001048 else
1049 EFI_MACHINE_TYPE_NAME = ''
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001050 gnu_efi_arch = ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001051 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001052
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001053 conf.set('ENABLE_EFI', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001054 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
Zbigniew Jędrzejewski-Szmek80c6fce2017-04-24 19:28:04 -04001055
1056 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001057endif
1058
1059#####################################################################
1060
1061config_h = configure_file(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001062 output : 'config.h',
1063 configuration : conf)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001064
1065includes = include_directories('src/basic',
1066 'src/shared',
1067 'src/systemd',
1068 'src/journal',
1069 'src/resolve',
1070 'src/timesync',
1071 'src/login',
1072 'src/udev',
1073 'src/libudev',
1074 'src/core',
1075 'src/libsystemd/sd-bus',
1076 'src/libsystemd/sd-device',
1077 'src/libsystemd/sd-hwdb',
1078 'src/libsystemd/sd-id128',
1079 'src/libsystemd/sd-netlink',
1080 'src/libsystemd/sd-network',
1081 'src/libsystemd-network',
1082 )
1083
1084add_project_arguments('-include', 'config.h', language : 'c')
1085
1086gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1087 'src/shared/gcrypt-util.c')
1088
1089subdir('po')
1090subdir('catalog')
1091subdir('src/systemd')
1092subdir('src/basic')
1093subdir('src/libsystemd')
1094subdir('src/libsystemd-network')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001095subdir('src/journal')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001096subdir('src/login')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001097
1098libjournal_core = static_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001099 'journal-core',
1100 libjournal_core_sources,
1101 journald_gperf_c,
1102 include_directories : includes,
1103 install : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001104
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04001105libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001106libsystemd = shared_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001107 'systemd',
1108 libsystemd_internal_sources,
1109 journal_internal_sources,
Lennart Poettering43091722017-06-27 23:11:26 +02001110 version : '0.19.0',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001111 include_directories : includes,
1112 link_args : ['-shared',
1113 '-Wl,--version-script=' + libsystemd_sym_path],
1114 link_with : [libbasic],
1115 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001116 libgcrypt,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001117 librt,
1118 libxz,
1119 liblz4],
1120 link_depends : libsystemd_sym,
1121 install : true,
1122 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001123
1124############################################################
1125
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001126# binaries that have --help and are intended for use by humans,
1127# usually, but not always, installed in /bin.
1128public_programs = []
1129
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001130subdir('src/libudev')
1131subdir('src/shared')
1132subdir('src/core')
1133subdir('src/udev')
1134subdir('src/network')
1135
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001136subdir('src/analyze')
1137subdir('src/journal-remote')
1138subdir('src/coredump')
1139subdir('src/hostname')
1140subdir('src/import')
1141subdir('src/kernel-install')
1142subdir('src/locale')
1143subdir('src/machine')
1144subdir('src/nspawn')
1145subdir('src/resolve')
1146subdir('src/timedate')
1147subdir('src/timesync')
1148subdir('src/vconsole')
Zbigniew Jędrzejewski-Szmek4e4ab1c2017-04-10 12:37:52 -04001149subdir('src/sulogin-shell')
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001150subdir('src/boot/efi')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001151
1152subdir('src/test')
Zbigniew Jędrzejewski-Szmek4ff3f252017-04-13 20:47:20 -04001153subdir('test')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001154
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001155############################################################
1156
1157# only static linking apart from libdl, to make sure that the
1158# module is linked to all libraries that it uses.
1159test_dlopen = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001160 'test-dlopen',
1161 test_dlopen_c,
1162 include_directories : includes,
1163 link_with : [libbasic],
1164 dependencies : [libdl])
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001165
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001166foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
Waldemar Brodkorbe7e11bb2017-06-24 19:30:26 +02001167 ['systemd', 'ENABLE_NSS_SYSTEMD'],
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001168 ['mymachines', 'ENABLE_MACHINED'],
1169 ['resolve', 'ENABLE_RESOLVED']]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001170
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001171 condition = tuple[1] == '' or conf.get(tuple[1], false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001172 if condition
1173 module = tuple[0]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001174
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001175 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1176 version_script_arg = join_paths(meson.current_source_dir(), sym)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001177
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001178 nss = shared_library(
1179 'nss_' + module,
1180 'src/nss-@0@/nss-@0@.c'.format(module),
1181 version : '2',
1182 include_directories : includes,
1183 link_args : ['-shared',
1184 '-Wl,--version-script=' + version_script_arg,
1185 '-Wl,--undefined'],
1186 link_with : [libsystemd_internal,
1187 libbasic],
1188 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001189 librt],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001190 link_depends : sym,
1191 install : true,
1192 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001193
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001194 # We cannot use shared_module because it does not support version suffix.
1195 # Unfortunately shared_library insists on creating the symlink…
1196 meson.add_install_script('sh', '-c',
1197 'rm $DESTDIR@0@/libnss_@1@.so'
1198 .format(rootlibdir, module))
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001199
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001200 test('dlopen-nss_' + module,
1201 test_dlopen,
1202 args : [nss.full_path()]) # path to dlopen must include a slash
1203 endif
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001204endforeach
1205
1206############################################################
1207
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001208executable('systemd',
1209 systemd_sources,
1210 include_directories : includes,
1211 link_with : [libcore,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001212 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001213 dependencies : [threads,
1214 librt,
1215 libseccomp,
1216 libselinux,
Zbigniew Jędrzejewski-Szmekf4ee10a2017-04-09 14:08:53 -04001217 libmount,
1218 libblkid],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001219 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001220 install : true,
1221 install_dir : rootlibexecdir)
1222
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001223exe = executable('systemd-analyze',
1224 systemd_analyze_sources,
1225 include_directories : includes,
1226 link_with : [libcore,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001227 libshared],
1228 dependencies : [threads,
1229 librt,
1230 libseccomp,
1231 libselinux,
1232 libmount,
1233 libblkid],
1234 install_rpath : rootlibexecdir,
1235 install : true)
1236public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001237
1238executable('systemd-journald',
1239 systemd_journald_sources,
1240 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001241 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001242 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001243 dependencies : [threads,
1244 libxz,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001245 liblz4,
1246 libselinux],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001247 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001248 install : true,
1249 install_dir : rootlibexecdir)
1250
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001251exe = executable('systemd-cat',
1252 systemd_cat_sources,
1253 include_directories : includes,
1254 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001255 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001256 dependencies : [threads],
1257 install_rpath : rootlibexecdir,
1258 install : true)
1259public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001260
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001261exe = executable('journalctl',
1262 journalctl_sources,
1263 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001264 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001265 dependencies : [threads,
1266 libqrencode,
1267 libxz,
1268 liblz4],
1269 install_rpath : rootlibexecdir,
1270 install : true,
1271 install_dir : rootbindir)
1272public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001273
1274executable('systemd-getty-generator',
1275 'src/getty-generator/getty-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001276 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001277 link_with : [libshared],
1278 install_rpath : rootlibexecdir,
1279 install : true,
1280 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001281
1282executable('systemd-debug-generator',
1283 'src/debug-generator/debug-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001284 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001285 link_with : [libshared],
1286 install_rpath : rootlibexecdir,
1287 install : true,
1288 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001289
1290executable('systemd-fstab-generator',
1291 'src/fstab-generator/fstab-generator.c',
1292 'src/core/mount-setup.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001293 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001294 link_with : [libshared],
1295 install_rpath : rootlibexecdir,
1296 install : true,
1297 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001298
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001299if conf.get('ENABLE_ENVIRONMENT_D', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001300 executable('30-systemd-environment-d-generator',
1301 'src/environment-d-generator/environment-d-generator.c',
1302 include_directories : includes,
1303 link_with : [libshared],
1304 install_rpath : rootlibexecdir,
1305 install : true,
1306 install_dir : userenvgeneratordir)
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001307
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001308 meson.add_install_script(meson_make_symlink,
1309 join_paths(sysconfdir, 'environment'),
1310 join_paths(environmentdir, '99-environment.conf'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001311endif
1312
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001313if conf.get('ENABLE_HIBERNATE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001314 executable('systemd-hibernate-resume-generator',
1315 'src/hibernate-resume/hibernate-resume-generator.c',
1316 include_directories : includes,
1317 link_with : [libshared],
1318 install_rpath : rootlibexecdir,
1319 install : true,
1320 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001321
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001322 executable('systemd-hibernate-resume',
1323 'src/hibernate-resume/hibernate-resume.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001324 include_directories : includes,
1325 link_with : [libshared],
1326 install_rpath : rootlibexecdir,
1327 install : true,
1328 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001329endif
1330
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001331if conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001332 executable('systemd-gpt-auto-generator',
1333 'src/gpt-auto-generator/gpt-auto-generator.c',
1334 'src/basic/blkid-util.h',
1335 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001336 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001337 dependencies : libblkid,
1338 install_rpath : rootlibexecdir,
1339 install : true,
1340 install_dir : systemgeneratordir)
1341
1342 exe = executable('systemd-dissect',
1343 'src/dissect/dissect.c',
1344 include_directories : includes,
1345 link_with : [libshared],
1346 install_rpath : rootlibexecdir,
1347 install : true,
1348 install_dir : rootlibexecdir)
1349 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001350endif
1351
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001352if conf.get('ENABLE_RESOLVED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001353 executable('systemd-resolved',
1354 systemd_resolved_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001355 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001356 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001357 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001358 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001359 libgcrypt,
1360 libgpg_error,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001361 libm,
1362 libidn],
1363 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001364 install : true,
1365 install_dir : rootlibexecdir)
1366
1367 exe = executable('systemd-resolve',
1368 systemd_resolve_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001369 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001370 include_directories : includes,
1371 link_with : [libshared],
1372 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001373 libgcrypt,
1374 libgpg_error,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001375 libm,
1376 libidn],
1377 install_rpath : rootlibexecdir,
1378 install : true)
1379 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001380endif
1381
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001382if conf.get('ENABLE_LOGIND', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001383 executable('systemd-logind',
1384 systemd_logind_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001385 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001386 link_with : [liblogind_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001387 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001388 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001389 libacl],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001390 install_rpath : rootlibexecdir,
1391 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001392 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001393
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001394 exe = executable('loginctl',
1395 loginctl_sources,
1396 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001397 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001398 dependencies : [threads,
1399 liblz4,
1400 libxz],
1401 install_rpath : rootlibexecdir,
1402 install : true,
1403 install_dir : rootbindir)
1404 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001405
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001406 exe = executable('systemd-inhibit',
1407 'src/login/inhibit.c',
1408 include_directories : includes,
1409 link_with : [libshared],
1410 install_rpath : rootlibexecdir,
1411 install : true,
1412 install_dir : rootbindir)
1413 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001414
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001415 if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001416 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1417 pam_systemd = shared_library(
1418 'pam_systemd',
1419 pam_systemd_c,
1420 name_prefix : '',
1421 include_directories : includes,
1422 link_args : ['-shared',
1423 '-Wl,--version-script=' + version_script_arg],
1424 link_with : [libsystemd_internal,
1425 libshared_static],
1426 dependencies : [threads,
1427 libpam,
1428 libpam_misc],
1429 link_depends : pam_systemd_sym,
1430 install : true,
1431 install_dir : pamlibdir)
1432
1433 test('dlopen-pam_systemd',
1434 test_dlopen,
1435 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1436 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001437endif
1438
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001439if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001440 executable('systemd-user-sessions',
1441 'src/user-sessions/user-sessions.c',
1442 include_directories : includes,
1443 link_with : [libshared],
1444 install_rpath : rootlibexecdir,
1445 install : true,
1446 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001447endif
1448
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001449if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001450 exe = executable('bootctl',
1451 'src/boot/bootctl.c',
1452 include_directories : includes,
1453 link_with : [libshared],
1454 dependencies : [libblkid],
1455 install_rpath : rootlibexecdir,
1456 install : true)
1457 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001458endif
1459
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001460exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1461 include_directories : includes,
1462 link_with : [libshared],
1463 dependencies : [threads],
1464 install_rpath : rootlibexecdir,
1465 install : true)
1466public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001467
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001468exe = executable('systemctl', 'src/systemctl/systemctl.c',
1469 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001470 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001471 dependencies : [threads,
1472 libcap,
1473 libselinux,
1474 libxz,
1475 liblz4],
1476 install_rpath : rootlibexecdir,
1477 install : true,
1478 install_dir : rootbindir)
1479public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001480
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001481if conf.get('ENABLE_BACKLIGHT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001482 executable('systemd-backlight',
1483 'src/backlight/backlight.c',
1484 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001485 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001486 install_rpath : rootlibexecdir,
1487 install : true,
1488 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001489endif
1490
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001491if conf.get('ENABLE_RFKILL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001492 executable('systemd-rfkill',
1493 'src/rfkill/rfkill.c',
1494 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001495 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001496 install_rpath : rootlibexecdir,
1497 install : true,
1498 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001499endif
1500
1501executable('systemd-system-update-generator',
1502 'src/system-update-generator/system-update-generator.c',
1503 include_directories : includes,
1504 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001505 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001506 install : true,
1507 install_dir : systemgeneratordir)
1508
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001509if conf.get('HAVE_LIBCRYPTSETUP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001510 executable('systemd-cryptsetup',
1511 'src/cryptsetup/cryptsetup.c',
1512 include_directories : includes,
1513 link_with : [libshared],
1514 dependencies : [libcryptsetup],
1515 install_rpath : rootlibexecdir,
1516 install : true,
1517 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001518
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001519 executable('systemd-cryptsetup-generator',
1520 'src/cryptsetup/cryptsetup-generator.c',
1521 include_directories : includes,
1522 link_with : [libshared],
1523 dependencies : [libcryptsetup],
1524 install_rpath : rootlibexecdir,
1525 install : true,
1526 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001527
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001528 executable('systemd-veritysetup',
1529 'src/veritysetup/veritysetup.c',
1530 include_directories : includes,
1531 link_with : [libshared],
1532 dependencies : [libcryptsetup],
1533 install_rpath : rootlibexecdir,
1534 install : true,
1535 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001536
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001537 executable('systemd-veritysetup-generator',
1538 'src/veritysetup/veritysetup-generator.c',
1539 include_directories : includes,
1540 link_with : [libshared],
1541 dependencies : [libcryptsetup],
1542 install_rpath : rootlibexecdir,
1543 install : true,
1544 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001545endif
1546
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001547if conf.get('HAVE_SYSV_COMPAT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001548 executable('systemd-sysv-generator',
1549 'src/sysv-generator/sysv-generator.c',
1550 include_directories : includes,
1551 link_with : [libshared],
1552 install_rpath : rootlibexecdir,
1553 install : true,
1554 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001555
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001556 executable('systemd-rc-local-generator',
1557 'src/rc-local-generator/rc-local-generator.c',
1558 include_directories : includes,
1559 link_with : [libshared],
1560 install_rpath : rootlibexecdir,
1561 install : true,
1562 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001563endif
1564
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001565if conf.get('ENABLE_HOSTNAMED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001566 executable('systemd-hostnamed',
1567 'src/hostname/hostnamed.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001568 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001569 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001570 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001571 install : true,
1572 install_dir : rootlibexecdir)
1573
1574 exe = executable('hostnamectl',
1575 'src/hostname/hostnamectl.c',
1576 include_directories : includes,
1577 link_with : [libshared],
1578 install_rpath : rootlibexecdir,
1579 install : true)
1580 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001581endif
1582
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001583if conf.get('ENABLE_LOCALED', false)
1584 if conf.get('HAVE_XKBCOMMON', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001585 # logind will load libxkbcommon.so dynamically on its own
1586 deps = [libdl]
1587 else
1588 deps = []
1589 endif
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -04001590
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001591 executable('systemd-localed',
1592 systemd_localed_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001593 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001594 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001595 dependencies : deps,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001596 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001597 install : true,
1598 install_dir : rootlibexecdir)
1599
1600 exe = executable('localectl',
1601 localectl_sources,
1602 include_directories : includes,
1603 link_with : [libshared],
1604 install_rpath : rootlibexecdir,
1605 install : true)
1606 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001607endif
1608
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001609if conf.get('ENABLE_TIMEDATED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001610 executable('systemd-timedated',
1611 'src/timedate/timedated.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001612 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001613 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001614 install_rpath : rootlibexecdir,
1615 install : true,
1616 install_dir : rootlibexecdir)
1617
1618 exe = executable('timedatectl',
1619 'src/timedate/timedatectl.c',
1620 include_directories : includes,
1621 install_rpath : rootlibexecdir,
1622 link_with : [libshared],
1623 install : true)
1624 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001625endif
1626
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001627if conf.get('ENABLE_TIMESYNCD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001628 executable('systemd-timesyncd',
1629 systemd_timesyncd_sources,
1630 include_directories : includes,
1631 link_with : [libshared],
1632 dependencies : [threads,
1633 libm],
1634 install_rpath : rootlibexecdir,
1635 install : true,
1636 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001637endif
1638
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001639if conf.get('ENABLE_MACHINED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001640 executable('systemd-machined',
1641 systemd_machined_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001642 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001643 link_with : [libmachine_core,
1644 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001645 install_rpath : rootlibexecdir,
1646 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001647 install_dir : rootlibexecdir)
1648
1649 exe = executable('machinectl',
1650 'src/machine/machinectl.c',
1651 include_directories : includes,
1652 link_with : [libshared],
1653 dependencies : [threads,
1654 libxz,
1655 liblz4],
1656 install_rpath : rootlibexecdir,
1657 install : true,
1658 install_dir : rootbindir)
1659 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001660endif
1661
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001662if conf.get('ENABLE_IMPORTD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001663 executable('systemd-importd',
1664 systemd_importd_sources,
1665 include_directories : includes,
1666 link_with : [libshared],
1667 dependencies : [threads],
1668 install_rpath : rootlibexecdir,
1669 install : true,
1670 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001671
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001672 systemd_pull = executable('systemd-pull',
1673 systemd_pull_sources,
1674 include_directories : includes,
1675 link_with : [libshared],
1676 dependencies : [libcurl,
1677 libz,
1678 libbzip2,
1679 libxz,
1680 libgcrypt],
1681 install_rpath : rootlibexecdir,
1682 install : true,
1683 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001684
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001685 systemd_import = executable('systemd-import',
1686 systemd_import_sources,
1687 include_directories : includes,
1688 link_with : [libshared],
1689 dependencies : [libcurl,
1690 libz,
1691 libbzip2,
1692 libxz],
1693 install_rpath : rootlibexecdir,
1694 install : true,
1695 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001696
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001697 systemd_export = executable('systemd-export',
1698 systemd_export_sources,
1699 include_directories : includes,
1700 link_with : [libshared],
1701 dependencies : [libcurl,
1702 libz,
1703 libbzip2,
1704 libxz],
1705 install_rpath : rootlibexecdir,
1706 install : true,
1707 install_dir : rootlibexecdir)
1708 public_programs += [systemd_pull, systemd_import, systemd_export]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001709endif
1710
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001711if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001712 exe = executable('systemd-journal-upload',
1713 systemd_journal_upload_sources,
1714 include_directories : includes,
1715 link_with : [libshared],
1716 dependencies : [threads,
1717 libcurl,
1718 libgnutls,
1719 libxz,
1720 liblz4],
1721 install_rpath : rootlibexecdir,
1722 install : true,
1723 install_dir : rootlibexecdir)
1724 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001725endif
1726
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001727if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001728 s_j_remote = executable('systemd-journal-remote',
1729 systemd_journal_remote_sources,
1730 include_directories : includes,
1731 link_with : [libshared],
1732 dependencies : [threads,
1733 libmicrohttpd,
1734 libgnutls,
1735 libxz,
1736 liblz4],
1737 install_rpath : rootlibexecdir,
1738 install : true,
1739 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001740
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001741 s_j_gatewayd = executable('systemd-journal-gatewayd',
1742 systemd_journal_gatewayd_sources,
1743 include_directories : includes,
1744 link_with : [libshared],
1745 dependencies : [threads,
1746 libmicrohttpd,
1747 libgnutls,
1748 libxz,
1749 liblz4],
1750 install_rpath : rootlibexecdir,
1751 install : true,
1752 install_dir : rootlibexecdir)
1753 public_programs += [s_j_remote, s_j_gatewayd]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001754endif
1755
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001756if conf.get('ENABLE_COREDUMP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001757 executable('systemd-coredump',
1758 systemd_coredump_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001759 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001760 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001761 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001762 libacl,
1763 libdw,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001764 libxz,
1765 liblz4],
1766 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001767 install : true,
1768 install_dir : rootlibexecdir)
1769
1770 exe = executable('coredumpctl',
1771 coredumpctl_sources,
1772 include_directories : includes,
1773 link_with : [libshared],
1774 dependencies : [threads,
1775 libxz,
1776 liblz4],
1777 install_rpath : rootlibexecdir,
1778 install : true)
1779 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001780endif
1781
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001782if conf.get('ENABLE_BINFMT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001783 exe = executable('systemd-binfmt',
1784 'src/binfmt/binfmt.c',
1785 include_directories : includes,
1786 link_with : [libshared],
1787 install_rpath : rootlibexecdir,
1788 install : true,
1789 install_dir : rootlibexecdir)
1790 public_programs += [exe]
1791
1792 meson.add_install_script('sh', '-c',
1793 mkdir_p.format(binfmtdir))
1794 meson.add_install_script('sh', '-c',
1795 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1796endif
1797
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001798if conf.get('ENABLE_VCONSOLE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001799 executable('systemd-vconsole-setup',
1800 'src/vconsole/vconsole-setup.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001801 include_directories : includes,
1802 link_with : [libshared],
1803 install_rpath : rootlibexecdir,
1804 install : true,
1805 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001806endif
1807
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001808if conf.get('ENABLE_RANDOMSEED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001809 executable('systemd-random-seed',
1810 'src/random-seed/random-seed.c',
1811 include_directories : includes,
1812 link_with : [libshared],
1813 install_rpath : rootlibexecdir,
1814 install : true,
1815 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001816endif
1817
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001818if conf.get('ENABLE_FIRSTBOOT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001819 executable('systemd-firstboot',
1820 'src/firstboot/firstboot.c',
1821 include_directories : includes,
1822 link_with : [libshared],
1823 dependencies : [libcrypt],
1824 install_rpath : rootlibexecdir,
1825 install : true,
1826 install_dir : rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001827endif
1828
1829executable('systemd-remount-fs',
1830 'src/remount-fs/remount-fs.c',
1831 'src/core/mount-setup.c',
1832 'src/core/mount-setup.h',
1833 include_directories : includes,
1834 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001835 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001836 install : true,
1837 install_dir : rootlibexecdir)
1838
1839executable('systemd-machine-id-setup',
1840 'src/machine-id-setup/machine-id-setup-main.c',
1841 'src/core/machine-id-setup.c',
1842 'src/core/machine-id-setup.h',
1843 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001844 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001845 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001846 install : true,
1847 install_dir : rootbindir)
1848
1849executable('systemd-fsck',
1850 'src/fsck/fsck.c',
1851 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001852 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001853 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001854 install : true,
1855 install_dir : rootlibexecdir)
1856
1857executable('systemd-sleep',
1858 'src/sleep/sleep.c',
1859 include_directories : includes,
1860 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001861 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001862 install : true,
1863 install_dir : rootlibexecdir)
1864
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001865exe = executable('systemd-sysctl',
1866 'src/sysctl/sysctl.c',
1867 include_directories : includes,
1868 link_with : [libshared],
1869 install_rpath : rootlibexecdir,
1870 install : true,
1871 install_dir : rootlibexecdir)
1872public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001873
1874executable('systemd-ac-power',
1875 'src/ac-power/ac-power.c',
1876 include_directories : includes,
1877 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001878 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001879 install : true,
1880 install_dir : rootlibexecdir)
1881
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001882exe = executable('systemd-detect-virt',
1883 'src/detect-virt/detect-virt.c',
1884 include_directories : includes,
1885 link_with : [libshared],
1886 install_rpath : rootlibexecdir,
1887 install : true)
1888public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001889
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001890exe = executable('systemd-delta',
1891 'src/delta/delta.c',
1892 include_directories : includes,
1893 link_with : [libshared],
1894 install_rpath : rootlibexecdir,
1895 install : true)
1896public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001897
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001898exe = executable('systemd-escape',
1899 'src/escape/escape.c',
1900 include_directories : includes,
1901 link_with : [libshared],
1902 install_rpath : rootlibexecdir,
1903 install : true,
1904 install_dir : rootbindir)
1905public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001906
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001907exe = executable('systemd-notify',
1908 'src/notify/notify.c',
1909 include_directories : includes,
1910 link_with : [libshared],
1911 install_rpath : rootlibexecdir,
1912 install : true,
1913 install_dir : rootbindir)
1914public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001915
1916executable('systemd-volatile-root',
1917 'src/volatile-root/volatile-root.c',
1918 include_directories : includes,
1919 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001920 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001921 install : true,
1922 install_dir : rootlibexecdir)
1923
1924executable('systemd-cgroups-agent',
1925 'src/cgroups-agent/cgroups-agent.c',
1926 include_directories : includes,
1927 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001928 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001929 install : true,
1930 install_dir : rootlibexecdir)
1931
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001932exe = executable('systemd-path',
1933 'src/path/path.c',
1934 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001935 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001936 install_rpath : rootlibexecdir,
1937 install : true)
1938public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001939
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001940exe = executable('systemd-ask-password',
1941 'src/ask-password/ask-password.c',
1942 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001943 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001944 install_rpath : rootlibexecdir,
1945 install : true,
1946 install_dir : rootbindir)
1947public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001948
1949executable('systemd-reply-password',
1950 'src/reply-password/reply-password.c',
1951 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001952 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001953 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001954 install : true,
1955 install_dir : rootlibexecdir)
1956
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001957exe = executable('systemd-tty-ask-password-agent',
1958 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1959 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001960 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001961 install_rpath : rootlibexecdir,
1962 install : true,
1963 install_dir : rootbindir)
1964public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001965
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001966exe = executable('systemd-cgls',
1967 'src/cgls/cgls.c',
1968 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001969 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001970 install_rpath : rootlibexecdir,
1971 install : true)
1972public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001973
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001974exe = executable('systemd-cgtop',
1975 'src/cgtop/cgtop.c',
1976 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001977 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001978 install_rpath : rootlibexecdir,
1979 install : true)
1980public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001981
1982executable('systemd-initctl',
1983 'src/initctl/initctl.c',
1984 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001985 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001986 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001987 install : true,
1988 install_dir : rootlibexecdir)
1989
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001990exe = executable('systemd-mount',
1991 'src/mount/mount-tool.c',
1992 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001993 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001994 install_rpath : rootlibexecdir,
1995 install : true)
1996public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001997
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001998meson.add_install_script(meson_make_symlink,
Michael Bieble17e5ba2017-04-13 10:30:56 -04001999 'systemd-mount', join_paths(bindir, 'systemd-umount'))
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04002000
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002001exe = executable('systemd-run',
2002 'src/run/run.c',
2003 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002004 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002005 install_rpath : rootlibexecdir,
2006 install : true)
2007public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002008
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002009exe = executable('systemd-stdio-bridge',
2010 'src/stdio-bridge/stdio-bridge.c',
2011 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002012 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002013 install_rpath : rootlibexecdir,
2014 install : true)
2015public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002016
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002017exe = executable('busctl',
2018 'src/busctl/busctl.c',
2019 'src/busctl/busctl-introspect.c',
2020 'src/busctl/busctl-introspect.h',
2021 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002022 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002023 install_rpath : rootlibexecdir,
2024 install : true)
2025public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002026
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002027if conf.get('ENABLE_SYSUSERS', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002028 exe = executable('systemd-sysusers',
2029 'src/sysusers/sysusers.c',
2030 include_directories : includes,
2031 link_with : [libshared],
2032 install_rpath : rootlibexecdir,
2033 install : true,
2034 install_dir : rootbindir)
2035 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002036endif
2037
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002038if conf.get('ENABLE_TMPFILES', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002039 exe = executable('systemd-tmpfiles',
2040 'src/tmpfiles/tmpfiles.c',
2041 include_directories : includes,
2042 link_with : [libshared],
2043 dependencies : [libacl],
2044 install_rpath : rootlibexecdir,
2045 install : true,
2046 install_dir : rootbindir)
2047 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002048endif
2049
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002050if conf.get('ENABLE_HWDB', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002051 exe = executable('systemd-hwdb',
2052 'src/hwdb/hwdb.c',
2053 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2054 include_directories : includes,
Michael Biebl0da6f392017-04-21 18:32:14 +02002055 link_with : [libudev_internal],
2056 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002057 install : true,
2058 install_dir : rootbindir)
2059 public_programs += [exe]
2060endif
2061
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002062if conf.get('ENABLE_QUOTACHECK', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002063 executable('systemd-quotacheck',
2064 'src/quotacheck/quotacheck.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002065 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002066 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002067 install_rpath : rootlibexecdir,
2068 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002069 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002070endif
2071
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002072exe = executable('systemd-socket-proxyd',
2073 'src/socket-proxy/socket-proxyd.c',
2074 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002075 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002076 dependencies : [threads],
2077 install_rpath : rootlibexecdir,
2078 install : true,
2079 install_dir : rootlibexecdir)
2080public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002081
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002082exe = executable('systemd-udevd',
2083 systemd_udevd_sources,
2084 include_directories : includes,
Zbigniew Jędrzejewski-Szmek5c720492017-02-22 23:13:22 -05002085 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002086 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002087 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002088 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002089 dependencies : [threads,
2090 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002091 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002092 libacl,
2093 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002094 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002095 install : true,
2096 install_dir : rootlibexecdir)
2097public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002098
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002099exe = executable('udevadm',
2100 udevadm_sources,
2101 include_directories : includes,
2102 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002103 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002104 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002105 dependencies : [threads,
2106 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002107 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002108 libacl,
2109 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002110 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002111 install : true,
2112 install_dir : rootbindir)
2113public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002114
2115executable('systemd-shutdown',
2116 systemd_shutdown_sources,
2117 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02002118 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002119 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002120 install : true,
2121 install_dir : rootlibexecdir)
2122
2123executable('systemd-update-done',
2124 'src/update-done/update-done.c',
2125 include_directories : includes,
2126 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002127 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002128 install : true,
2129 install_dir : rootlibexecdir)
2130
2131executable('systemd-update-utmp',
2132 'src/update-utmp/update-utmp.c',
2133 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002134 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002135 dependencies : [libaudit],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002136 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002137 install : true,
2138 install_dir : rootlibexecdir)
2139
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002140if conf.get('HAVE_KMOD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002141 executable('systemd-modules-load',
2142 'src/modules-load/modules-load.c',
2143 include_directories : includes,
2144 link_with : [libshared],
2145 dependencies : [libkmod],
2146 install_rpath : rootlibexecdir,
2147 install : true,
2148 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002149
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002150 meson.add_install_script('sh', '-c',
2151 mkdir_p.format(modulesloaddir))
2152 meson.add_install_script('sh', '-c',
2153 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002154endif
2155
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002156exe = executable('systemd-nspawn',
2157 systemd_nspawn_sources,
2158 'src/core/mount-setup.c', # FIXME: use a variable?
2159 'src/core/mount-setup.h',
2160 'src/core/loopback-setup.c',
2161 'src/core/loopback-setup.h',
2162 include_directories : [includes, include_directories('src/nspawn')],
Zbigniew Jędrzejewski-Szmek0bc91152017-04-27 13:39:54 -04002163 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002164 dependencies : [libacl,
2165 libblkid,
2166 libseccomp,
2167 libselinux],
2168 install_rpath : rootlibexecdir,
2169 install : true)
2170public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002171
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002172if conf.get('ENABLE_NETWORKD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002173 executable('systemd-networkd',
2174 systemd_networkd_sources,
2175 include_directories : includes,
2176 link_with : [libnetworkd_core,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002177 libsystemd_network,
2178 libudev_internal,
2179 libshared],
Zbigniew Jędrzejewski-Szmek4b57a272017-06-21 06:05:15 -04002180 dependencies : [threads],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002181 install_rpath : rootlibexecdir,
2182 install : true,
2183 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002184
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002185 executable('systemd-networkd-wait-online',
2186 systemd_networkd_wait_online_sources,
2187 include_directories : includes,
2188 link_with : [libnetworkd_core,
2189 libshared],
2190 install_rpath : rootlibexecdir,
2191 install : true,
2192 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmekf0bd7cc2017-04-12 12:14:30 -04002193endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002194
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002195exe = executable('networkctl',
2196 networkctl_sources,
2197 include_directories : includes,
2198 link_with : [libsystemd_network,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002199 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002200 install_rpath : rootlibexecdir,
2201 install : true,
2202 install_dir : rootbindir)
2203public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002204
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002205############################################################
2206
2207foreach tuple : tests
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002208 sources = tuple[0]
2209 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2210 dependencies = tuple[2]
2211 condition = tuple.length() >= 4 ? tuple[3] : ''
2212 type = tuple.length() >= 5 ? tuple[4] : ''
2213 defs = tuple.length() >= 6 ? tuple[5] : []
2214 incs = tuple.length() >= 7 ? tuple[6] : includes
2215 timeout = 30
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002216
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002217 name = sources[0].split('/')[-1].split('.')[0]
2218 if type.startswith('timeout=')
2219 timeout = type.split('=')[1].to_int()
2220 type = ''
2221 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002222
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002223 if condition == '' or conf.get(condition, false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002224 exe = executable(
2225 name,
2226 sources,
2227 include_directories : incs,
2228 link_with : link_with,
2229 dependencies : dependencies,
2230 c_args : defs,
2231 install_rpath : rootlibexecdir,
Michael Biebl7cdd9782017-06-23 03:23:30 +02002232 install : install_tests,
2233 install_dir : join_paths(testsdir, type))
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04002234
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002235 if type == 'manual'
2236 message('@0@ is a manual test'.format(name))
2237 elif type == 'unsafe' and want_tests != 'unsafe'
2238 message('@0@ is an unsafe test'.format(name))
2239 else
2240 test(name, exe,
2241 env : test_env,
2242 timeout : timeout)
2243 endif
2244 else
2245 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2246 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002247endforeach
2248
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002249test_libsystemd_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002250 'test-libsystemd-sym',
2251 test_libsystemd_sym_c,
2252 include_directories : includes,
2253 link_with : [libsystemd],
2254 install : install_tests,
2255 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002256test('test-libsystemd-sym',
2257 test_libsystemd_sym)
2258
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002259test_libudev_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002260 'test-libudev-sym',
2261 test_libudev_sym_c,
2262 include_directories : includes,
2263 c_args : ['-Wno-deprecated-declarations'],
2264 link_with : [libudev],
2265 install : install_tests,
2266 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002267test('test-libudev-sym',
2268 test_libudev_sym)
2269
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002270############################################################
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002271
2272make_directive_index_py = find_program('tools/make-directive-index.py')
2273make_man_index_py = find_program('tools/make-man-index.py')
Zbigniew Jędrzejewski-Szmekb184e8f2017-04-13 19:59:21 -04002274xml_helper_py = find_program('tools/xml_helper.py')
Zbigniew Jędrzejewski-Szmekabba22c2017-04-15 00:40:59 -04002275hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002276
2277subdir('units')
2278subdir('sysctl.d')
2279subdir('sysusers.d')
2280subdir('tmpfiles.d')
2281subdir('rules')
2282subdir('hwdb')
2283subdir('network')
2284subdir('man')
2285subdir('shell-completion/bash')
2286subdir('shell-completion/zsh')
2287subdir('docs/sysvinit')
2288subdir('docs/var-log')
2289
2290# FIXME: figure out if the warning is true:
2291# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2292install_subdir('factory/etc',
2293 install_dir : factorydir)
2294
2295
2296install_data('xorg/50-systemd-user.sh',
2297 install_dir : xinitrcdir)
2298install_data('system-preset/90-systemd.preset',
2299 install_dir : systempresetdir)
2300install_data('README',
2301 'NEWS',
2302 'CODING_STYLE',
2303 'DISTRO_PORTING',
2304 'ENVIRONMENT.md',
2305 'LICENSE.GPL2',
2306 'LICENSE.LGPL2.1',
2307 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2308 install_dir : docdir)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002309
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002310meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2311meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2312
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002313############################################################
2314
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002315meson_check_help = find_program('tools/meson-check-help.sh')
2316
2317foreach exec : public_programs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002318 name = exec.full_path().split('/')[-1]
2319 test('check-help-' + name,
2320 meson_check_help,
2321 args : [exec.full_path()])
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002322endforeach
2323
2324############################################################
2325
Zbigniew Jędrzejewski-Szmek0700e8b2017-07-03 12:42:29 -04002326if git.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002327 all_files = run_command(
2328 git,
2329 ['--git-dir=@0@/.git'.format(meson.source_root()),
2330 'ls-files',
2331 ':/*.[ch]'])
2332 all_files = files(all_files.stdout().split())
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002333
Zbigniew Jędrzejewski-Szmek341b8922017-05-30 19:56:12 -04002334 run_target(
Zbigniew Jędrzejewski-Szmek0700e8b2017-07-03 12:42:29 -04002335 'tags',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002336 input : all_files,
Zbigniew Jędrzejewski-Szmek0700e8b2017-07-03 12:42:29 -04002337 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.source_root())] + all_files)
2338 run_target(
2339 'ctags',
2340 input : all_files,
2341 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.source_root())] + all_files)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002342endif
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002343
2344if git.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002345 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
Zbigniew Jędrzejewski-Szmeka923e082017-04-17 19:48:20 -04002346 run_target(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002347 'git-contrib',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002348 command : [meson_git_contrib_sh])
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002349endif
Zbigniew Jędrzejewski-Szmekdd6ab3d2017-04-24 19:28:05 -04002350
2351if git.found()
2352 git_head = run_command(
2353 git,
2354 ['--git-dir=@0@/.git'.format(meson.source_root()),
2355 'rev-parse', 'HEAD']).stdout().strip()
2356 git_head_short = run_command(
2357 git,
2358 ['--git-dir=@0@/.git'.format(meson.source_root()),
2359 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2360
2361 run_target(
2362 'git-snapshot',
2363 command : ['git', 'archive',
2364 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.source_root(),
2365 git_head_short),
2366 '--prefix', 'systemd-@0@/'.format(git_head),
2367 'HEAD'])
2368endif
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002369
2370############################################################
2371
2372status = [
2373 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2374
2375 'prefix: @0@'.format(prefixdir),
2376 'rootprefix: @0@'.format(rootprefixdir),
2377 'sysconf dir: @0@'.format(sysconfdir),
2378 'includedir: @0@'.format(includedir),
2379 'lib dir: @0@'.format(libdir),
2380 'rootlib dir: @0@'.format(rootlibdir),
2381 'SysV init scripts: @0@'.format(sysvinit_path),
2382 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2383 'PAM modules dir: @0@'.format(pamlibdir),
2384 'PAM configuration dir: @0@'.format(pamconfdir),
2385 'RPM macros dir: @0@'.format(rpmmacrosdir),
2386 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2387 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2388 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2389 'bash completions dir: @0@'.format(bashcompletiondir),
2390 'zsh completions dir: @0@'.format(zshcompletiondir),
2391 'extra start script: @0@'.format(get_option('rc-local')),
2392 'extra stop script: @0@'.format(get_option('halt-local')),
2393 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2394 get_option('debug-tty')),
2395 'TTY GID: @0@'.format(tty_gid),
2396 'maximum system UID: @0@'.format(system_uid_max),
2397 'maximum system GID: @0@'.format(system_gid_max),
2398 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2399 'certificate root: @0@'.format(get_option('certificate-root')),
2400 'support URL: @0@'.format(support_url),
2401 'nobody user name: @0@'.format(get_option('nobody-user')),
2402 'nobody group name: @0@'.format(get_option('nobody-group')),
2403 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
Zbigniew Jędrzejewski-Szmek5248e7e2017-07-11 02:15:08 -04002404 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002405
2406 'default DNSSEC mode: @0@'.format(default_dnssec),
2407 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2408 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2409
2410alt_dns_servers = '\n '.join(dns_servers.split(' '))
2411alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2412status += [
2413 'default DNS servers: @0@'.format(alt_dns_servers),
2414 'default NTP servers: @0@'.format(alt_ntp_servers)]
2415
2416alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2417 '@@0@'.format(time_epoch)).stdout().strip()
2418status += [
2419 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2420
2421# TODO:
2422# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2423# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2424# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2425
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002426if conf.get('ENABLE_EFI', false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002427 status += [
2428 'efi arch: @0@'.format(efi_arch)]
2429
2430 if have_gnu_efi
2431 status += [
2432 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2433 'EFI CC @0@'.format(efi_cc),
2434 'EFI libdir: @0@'.format(efi_libdir),
2435 'EFI ldsdir: @0@'.format(efi_ldsdir),
2436 'EFI includedir: @0@'.format(efi_incdir)]
2437 endif
2438endif
2439
2440found = []
2441missing = []
2442
2443foreach tuple : [
2444 ['libcryptsetup'],
2445 ['PAM'],
2446 ['AUDIT'],
2447 ['IMA'],
2448 ['AppArmor'],
2449 ['SELinux'],
2450 ['SECCOMP'],
2451 ['SMACK'],
2452 ['zlib'],
2453 ['xz'],
2454 ['lz4'],
2455 ['bzip2'],
2456 ['ACL'],
2457 ['gcrypt'],
2458 ['qrencode'],
2459 ['microhttpd'],
2460 ['gnutls'],
2461 ['libcurl'],
Zbigniew Jędrzejewski-Szmekd1bf5672017-06-16 09:16:28 -04002462 ['idn'],
Zbigniew Jędrzejewski-Szmek87057e22017-05-09 21:56:34 -04002463 ['libidn2'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002464 ['libidn'],
Waldemar Brodkorbe7e11bb2017-06-24 19:30:26 +02002465 ['nss-systemd'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002466 ['libiptc'],
2467 ['elfutils'],
2468 ['binfmt'],
2469 ['vconsole'],
2470 ['quotacheck'],
2471 ['tmpfiles'],
2472 ['environment.d'],
2473 ['sysusers'],
2474 ['firstboot'],
2475 ['randomseed'],
2476 ['backlight'],
2477 ['rfkill'],
2478 ['logind'],
2479 ['machined'],
2480 ['importd'],
2481 ['hostnamed'],
2482 ['timedated'],
2483 ['timesyncd'],
2484 ['localed'],
2485 ['networkd'],
2486 ['resolved'],
2487 ['coredump'],
2488 ['polkit'],
2489 ['legacy pkla', install_polkit_pkla],
2490 ['efi'],
2491 ['gnu-efi', have_gnu_efi],
2492 ['kmod'],
2493 ['xkbcommon'],
2494 ['blkid'],
2495 ['dbus'],
2496 ['glib'],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002497 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002498 ['hwdb'],
2499 ['tpm'],
2500 ['man pages', want_man],
2501 ['html pages', want_html],
2502 ['man page indices', want_man and have_lxml],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002503 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002504 ['SysV compat'],
2505 ['utmp'],
2506 ['ldconfig'],
2507 ['hibernate'],
2508 ['adm group', get_option('adm-group')],
2509 ['wheel group', get_option('wheel-group')],
Franck Buib14e1b42017-05-09 14:02:37 +02002510 ['gshadow'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002511 ['debug hashmap'],
2512 ['debug mmap cache'],
2513]
2514
2515 cond = tuple.get(1, '')
2516 if cond == ''
2517 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2518 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002519 cond = conf.get(ident1, false) or conf.get(ident2, false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002520 endif
2521 if cond
2522 found += [tuple[0]]
2523 else
2524 missing += [tuple[0]]
2525 endif
2526endforeach
2527
2528status += [
2529 'enabled features: @0@'.format(', '.join(found)),
2530 'disabled features: @0@'.format(', '.join(missing))]
2531message('\n '.join(status))