blob: f73729d39278198480c9d994e2e2f7ba6bba33f1 [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-Szmek003c8872017-07-24 04:41:45 -040029# Try to install the git pre-commit hook
30git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
31if git_hook.returncode() == 0
32 message(git_hook.stdout().strip())
33endif
34
35#####################################################################
36
Zbigniew Jędrzejewski-Szmekab916f22017-04-13 22:15:01 -040037rootprefixdir = get_option('rootprefix')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040038if get_option('split-usr')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -040039 conf.set('HAVE_SPLIT_USR', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040040 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040041else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040042 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040043endif
44
45sysvinit_path = get_option('sysvinit-path')
46sysvrcnd_path = get_option('sysvrcnd-path')
47if sysvinit_path != '' or sysvrcnd_path != ''
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -040048 conf.set('HAVE_SYSV_COMPAT', true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040049 description : 'SysV init scripts and rcN.d links are supported')
50 m4_defines += ['-DHAVE_SYSV_COMPAT']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040051endif
52
53# join_paths ignore the preceding arguments if an absolute component is
54# encountered, so this should canonicalize various paths when they are
55# absolute or relative.
56prefixdir = get_option('prefix')
57if not prefixdir.startswith('/')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040058 error('Prefix is not absolute: "@0@"'.format(prefixdir))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040059endif
60bindir = join_paths(prefixdir, get_option('bindir'))
61libdir = join_paths(prefixdir, get_option('libdir'))
62sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
63includedir = join_paths(prefixdir, get_option('includedir'))
64datadir = join_paths(prefixdir, get_option('datadir'))
65localstatedir = join_paths('/', get_option('localstatedir'))
66
67rootbindir = join_paths(rootprefixdir, 'bin')
68rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
69
70rootlibdir = get_option('rootlibdir')
71if rootlibdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040072 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040073endif
74
75# Dirs of external packages
Michael Bieble17e5ba2017-04-13 10:30:56 -040076pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
77pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
78polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
79polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
80polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
81varlogdir = join_paths(localstatedir, 'log')
82xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040083rpmmacrosdir = get_option('rpmmacrosdir')
84
85# Our own paths
Michael Bieble17e5ba2017-04-13 10:30:56 -040086pkgdatadir = join_paths(datadir, 'systemd')
87environmentdir = join_paths(prefixdir, 'lib/environment.d')
88pkgsysconfdir = join_paths(sysconfdir, 'systemd')
89userunitdir = join_paths(prefixdir, 'lib/systemd/user')
90userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
91tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
92sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
93sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
94binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
95modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
96networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
97pkgincludedir = join_paths(includedir, 'systemd')
98systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
99usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
100systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
101userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
102systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
103systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
104systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
105systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
106udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
107udevhomedir = udevlibexecdir
108udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
109udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
110catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
111kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
112factorydir = join_paths(datadir, 'factory')
113docdir = join_paths(datadir, 'doc/systemd')
114bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
115testsdir = join_paths(prefixdir, 'lib/systemd/tests')
116systemdstatedir = join_paths(localstatedir, 'lib/systemd')
117catalogstatedir = join_paths(systemdstatedir, 'catalog')
118randomseeddir = join_paths(localstatedir, 'lib/systemd')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400119
120dbuspolicydir = get_option('dbuspolicydir')
121if dbuspolicydir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400122 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400123endif
124
125dbussessionservicedir = get_option('dbussessionservicedir')
126if dbussessionservicedir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400127 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400128endif
129
130dbussystemservicedir = get_option('dbussystemservicedir')
131if dbussystemservicedir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400132 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400133endif
134
135pamlibdir = get_option('pamlibdir')
136if pamlibdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400137 pamlibdir = join_paths(rootlibdir, 'security')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400138endif
139
140pamconfdir = get_option('pamconfdir')
141if pamconfdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400142 pamconfdir = join_paths(sysconfdir, 'pam.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400143endif
144
145conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400146conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400147conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
148conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
149conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400150conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
151conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400152conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400153conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
154conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400155conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
156conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
157conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
158conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
159conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
160conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
161conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
162conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
163conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400164conf.set_quoted('ROOTPREFIX', rootprefixdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400165conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400166conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
167conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400168conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
169conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
170conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
171conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
172conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
173conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400174conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
175conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400176conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400177conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400178conf.set_quoted('LIBDIR', libdir)
179conf.set_quoted('ROOTLIBDIR', rootlibdir)
180conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
181conf.set_quoted('BOOTLIBDIR', bootlibdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400182conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
183conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
184conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
185conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
186conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
187conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400188
189conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
190conf.set_quoted('ABS_SRC_DIR', meson.source_root())
191
192substs.set('prefix', prefixdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400193substs.set('exec_prefix', prefixdir)
194substs.set('libdir', libdir)
195substs.set('rootlibdir', rootlibdir)
196substs.set('includedir', includedir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400197substs.set('pkgsysconfdir', pkgsysconfdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400198substs.set('bindir', bindir)
199substs.set('rootbindir', rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400200substs.set('rootlibexecdir', rootlibexecdir)
201substs.set('systemunitdir', systemunitdir)
202substs.set('userunitdir', userunitdir)
203substs.set('systempresetdir', systempresetdir)
204substs.set('userpresetdir', userpresetdir)
205substs.set('udevhwdbdir', udevhwdbdir)
206substs.set('udevrulesdir', udevrulesdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400207substs.set('udevlibexecdir', udevlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400208substs.set('catalogdir', catalogdir)
209substs.set('tmpfilesdir', tmpfilesdir)
210substs.set('sysusersdir', sysusersdir)
211substs.set('sysctldir', sysctldir)
212substs.set('binfmtdir', binfmtdir)
213substs.set('modulesloaddir', modulesloaddir)
214substs.set('systemgeneratordir', systemgeneratordir)
215substs.set('usergeneratordir', usergeneratordir)
216substs.set('systemenvgeneratordir', systemenvgeneratordir)
217substs.set('userenvgeneratordir', userenvgeneratordir)
218substs.set('systemshutdowndir', systemshutdowndir)
219substs.set('systemsleepdir', systemsleepdir)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400220substs.set('VARLOGDIR', varlogdir)
221substs.set('CERTIFICATEROOT', get_option('certificate-root'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400222substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
223substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400224substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
225substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
226substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
227substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400228
229#####################################################################
230
231cc = meson.get_compiler('c')
232pkgconfig = import('pkgconfig')
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400233check_compilation_sh = find_program('tools/meson-check-compilation.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400234
Zbigniew Jędrzejewski-Szmek94e25232017-05-13 13:23:28 -0400235cxx = find_program('c++', required : false)
236if cxx.found()
237 # Used only for tests
238 add_languages('cpp')
239endif
240
Zbigniew Jędrzejewski-Szmek75cf1d62017-07-04 17:59:15 -0400241foreach arg : ['-Wextra',
242 '-Wundef',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400243 '-Wlogical-op',
244 '-Wmissing-include-dirs',
245 '-Wold-style-definition',
246 '-Wpointer-arith',
247 '-Winit-self',
248 '-Wdeclaration-after-statement',
249 '-Wfloat-equal',
250 '-Wsuggest-attribute=noreturn',
251 '-Werror=missing-prototypes',
252 '-Werror=implicit-function-declaration',
253 '-Werror=missing-declarations',
254 '-Werror=return-type',
255 '-Werror=incompatible-pointer-types',
256 '-Werror=format=2',
257 '-Wstrict-prototypes',
258 '-Wredundant-decls',
259 '-Wmissing-noreturn',
260 '-Wshadow',
261 '-Wendif-labels',
262 '-Wstrict-aliasing=2',
263 '-Wwrite-strings',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400264 '-Werror=overflow',
265 '-Wdate-time',
266 '-Wnested-externs',
267 '-ffast-math',
268 '-fno-common',
269 '-fdiagnostics-show-option',
270 '-fno-strict-aliasing',
271 '-fvisibility=hidden',
272 '-fstack-protector',
273 '-fstack-protector-strong',
274 '-fPIE',
275 '--param=ssp-buffer-size=4',
276 ]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400277 if cc.has_argument(arg)
278 add_project_arguments(arg, language : 'c')
279 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400280endforeach
281
Zbigniew Jędrzejewski-Szmek2c5434a2017-04-27 10:05:41 -0400282# "negative" arguments: gcc on purpose does not return an error for "-Wno-"
283# arguments, just emits a warnings. So test for the "positive" version instead.
284foreach arg : ['unused-parameter',
285 'missing-field-initializers',
286 'unused-result',
287 'format-signedness']
288 if cc.has_argument('-W' + arg)
289 add_project_arguments('-Wno-' + arg, language : 'c')
290 endif
291endforeach
292
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400293if cc.compiles('
294 #include <time.h>
295 #include <inttypes.h>
296 typedef uint64_t usec_t;
297 usec_t now(clockid_t clock);
298 int main(void) {
299 struct timespec now;
300 return 0;
301 }
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400302', name : '-Werror=shadow with local shadowing')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400303 add_project_arguments('-Werror=shadow', language : 'c')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400304endif
305
306if cc.get_id() == 'clang'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400307 foreach arg : ['-Wno-typedef-redefinition',
308 '-Wno-gnu-variable-sized-type-not-at-end',
309 ]
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400310 if cc.has_argument(arg,
311 name : '@0@ is supported'.format(arg))
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400312 add_project_arguments(arg, language : 'c')
313 endif
314 endforeach
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400315endif
316
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400317link_test_c = files('tools/meson-link-test.c')
318
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400319# --as-needed and --no-undefined are provided by meson by default,
320# run mesonconf to see what is enabled
321foreach arg : ['-Wl,-z,relro',
322 '-Wl,-z,now',
323 '-pie',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400324 ]
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400325
326 have = run_command(check_compilation_sh,
327 cc.cmd_array(), '-x', 'c', arg,
328 '-include', link_test_c).returncode() == 0
329 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
330 if have
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400331 add_project_link_arguments(arg, language : 'c')
332 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400333endforeach
334
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400335if get_option('buildtype') != 'debug'
336 foreach arg : ['-ffunction-sections',
337 '-fdata-sections']
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400338 if cc.has_argument(arg,
339 name : '@0@ is supported'.format(arg))
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400340 add_project_arguments(arg, language : 'c')
341 endif
342 endforeach
343
344 foreach arg : ['-Wl,--gc-sections']
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400345 have = run_command(check_compilation_sh,
346 cc.cmd_array(), '-x', 'c', arg,
347 '-include', link_test_c).returncode() == 0
348 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
349 if have
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400350 add_project_link_arguments(arg, language : 'c')
351 endif
352 endforeach
353endif
354
Zbigniew Jędrzejewski-Szmek9cc0e6e2017-04-11 10:25:34 -0400355cpp = ' '.join(cc.cmd_array()) + ' -E'
356
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400357#####################################################################
358# compilation result tests
359
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400360conf.set('_GNU_SOURCE', true)
361conf.set('__SANE_USERSPACE_TYPES__', true)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400362
363conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
364conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
365conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
366conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
367conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
368conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
369conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
370
371decl_headers = '''
372#include <uchar.h>
373#include <linux/ethtool.h>
374'''
375# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
376
377foreach decl : ['char16_t',
378 'char32_t',
379 'key_serial_t',
380 'struct ethtool_link_settings',
381 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400382
383 # We get -1 if the size cannot be determined
384 have = cc.sizeof(decl, prefix : decl_headers) > 0
385 conf.set('HAVE_' + decl.underscorify().to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400386endforeach
387
388foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
389 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
390 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
391 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
392 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
393 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
394 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
395 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
396 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
397 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
Susant Sahani9dfed8d2017-04-25 20:30:34 +0530398 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400399 # if_tunnel.h is buggy and cannot be included on its own
400 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
401 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
402 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
403 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
404 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
405 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
406 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
407 ['NDA_IFINDEX', 'linux/neighbour.h'],
408 ['IFA_FLAGS', 'linux/if_addr.h'],
409 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
410 ]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400411 prefix = decl.length() > 2 ? decl[2] : ''
412 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
413 conf.set10('HAVE_DECL_' + decl[0], have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400414endforeach
415
416skip = false
417foreach ident : ['secure_getenv', '__secure_getenv']
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400418 if not skip and cc.has_function(ident)
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400419 conf.set('HAVE_' + ident.to_upper(), true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400420 skip = true
421 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400422endforeach
423
424foreach ident : [
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400425 ['memfd_create', '''#include <sys/memfd.h>'''],
426 ['gettid', '''#include <sys/types.h>'''],
427 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
428 ['name_to_handle_at', '''#define _GNU_SOURCE
429 #include <sys/types.h>
430 #include <sys/stat.h>
431 #include <fcntl.h>'''],
432 ['setns', '''#define _GNU_SOURCE
433 #include <sched.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400434 ['renameat2', '''#include <stdio.h>'''],
435 ['kcmp', '''#include <linux/kcmp.h>'''],
436 ['keyctl', '''#include <sys/types.h>
437 #include <keyutils.h>'''],
438 ['copy_file_range', '''#include <sys/syscall.h>
439 #include <unistd.h>'''],
Zbigniew Jędrzejewski-Szmek38f1ae02017-04-19 16:14:16 -0400440 ['explicit_bzero' , '''#include <string.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400441]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400442
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400443 have = cc.has_function(ident[0], prefix : ident[1])
444 conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400445endforeach
446
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400447if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400448 conf.set('USE_SYS_RANDOM_H', true)
449 conf.set10('HAVE_DECL_GETRANDOM', true)
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400450else
451 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
452 conf.set10('HAVE_DECL_GETRANDOM', have)
453endif
454
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400455#####################################################################
456
457sed = find_program('sed')
458grep = find_program('grep')
459awk = find_program('awk')
Zbigniew Jędrzejewski-Szmekd730e2d2017-04-25 08:49:58 -0400460m4 = find_program('m4')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400461stat = find_program('stat')
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -0400462git = find_program('git', required : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400463
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -0400464meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400465mkdir_p = 'mkdir -p $DESTDIR/@0@'
Zbigniew Jędrzejewski-Szmekd83f4f52017-04-16 12:04:46 -0400466test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
467splash_bmp = files('test/splash.bmp')
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400468
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400469# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
470# /usr/sbin, /sbin, and fall back to the default from middle column.
471progs = [['telinit', '/lib/sysvinit/telinit'],
472 ['quotaon', '/usr/sbin/quotaon' ],
473 ['quotacheck', '/usr/sbin/quotacheck' ],
474 ['kill', '/usr/bin/kill' ],
475 ['kmod', '/usr/bin/kmod' ],
476 ['kexec', '/usr/sbin/kexec' ],
477 ['sulogin', '/usr/sbin/sulogin' ],
478 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
479 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
480 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
481 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
482 ]
483foreach prog : progs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400484 path = get_option(prog[0] + '-path')
485 if path != ''
486 message('Using @1@ for @0@'.format(prog[0], path))
487 else
488 exe = find_program(prog[0],
489 '/usr/sbin/' + prog[0],
490 '/sbin/' + prog[0],
491 required: false)
492 path = exe.found() ? exe.path() : prog[1]
493 endif
494 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
495 conf.set_quoted(name, path)
496 substs.set(name, path)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400497endforeach
498
Zbigniew Jędrzejewski-Szmek1276a9f2017-04-18 19:11:54 -0400499if run_command('ln', '--relative', '--help').returncode() != 0
500 error('ln does not support --relative')
501endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400502
503############################################################
504
505gperf = find_program('gperf')
506
507gperf_test_format = '''
508#include <string.h>
509const char * in_word_set(const char *, @0@);
510@1@
511'''
512gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
513gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
514gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
515if cc.compiles(gperf_test)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400516 gperf_len_type = 'size_t'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400517else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400518 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
519 if cc.compiles(gperf_test)
520 gperf_len_type = 'unsigned'
521 else
522 error('unable to determine gperf len type')
523 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400524endif
525message('gperf len type is @0@'.format(gperf_len_type))
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400526conf.set('GPERF_LEN_TYPE', gperf_len_type,
527 description : 'The type of gperf "len" parameter')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400528
529############################################################
530
531if not cc.has_header('sys/capability.h')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400532 error('POSIX caps headers not found')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400533endif
534foreach header : ['linux/btrfs.h',
535 'linux/memfd.h',
536 'linux/vm_sockets.h',
537 'valgrind/memcheck.h',
538 'valgrind/valgrind.h',
539 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400540
541 conf.set('HAVE_' + header.underscorify().to_upper(),
542 cc.has_header(header))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400543endforeach
544
545############################################################
546
547conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
Zbigniew Jędrzejewski-Szmek5248e7e2017-07-11 02:15:08 -0400548conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
549gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400550
551default_hierarchy = get_option('default-hierarchy')
552conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
553 description : 'default cgroup hierarchy as string')
554if default_hierarchy == 'legacy'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400555 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400556elif default_hierarchy == 'hybrid'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400557 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400558else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400559 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400560endif
561
562time_epoch = get_option('time-epoch')
563if time_epoch == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400564 NEWS = files('NEWS')
565 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400566endif
567time_epoch = time_epoch.to_int()
568conf.set('TIME_EPOCH', time_epoch)
569
570system_uid_max = get_option('system-uid-max')
571if system_uid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400572 system_uid_max = run_command(
573 awk,
574 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
575 '/etc/login.defs').stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400576endif
577system_uid_max = system_uid_max.to_int()
578conf.set('SYSTEM_UID_MAX', system_uid_max)
579substs.set('systemuidmax', system_uid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400580message('maximum system UID is @0@'.format(system_uid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400581
582conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
583conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
584
585system_gid_max = get_option('system-gid-max')
586if system_gid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400587 system_gid_max = run_command(
588 awk,
589 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
590 '/etc/login.defs').stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400591endif
592system_gid_max = system_gid_max.to_int()
593conf.set('SYSTEM_GID_MAX', system_gid_max)
594substs.set('systemgidmax', system_gid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400595message('maximum system GID is @0@'.format(system_gid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400596
597tty_gid = get_option('tty-gid')
598conf.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400599substs.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400600
601if get_option('adm-group')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400602 m4_defines += ['-DENABLE_ADM_GROUP']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400603endif
604
605if get_option('wheel-group')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400606 m4_defines += ['-DENABLE_WHEEL_GROUP']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400607endif
608
609substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
610
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400611kill_user_processes = get_option('default-kill-user-processes')
612conf.set10('KILL_USER_PROCESSES', kill_user_processes)
613substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400614
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400615dns_servers = get_option('dns-servers')
616conf.set_quoted('DNS_SERVERS', dns_servers)
617substs.set('DNS_SERVERS', dns_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400618
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400619ntp_servers = get_option('ntp-servers')
620conf.set_quoted('NTP_SERVERS', ntp_servers)
621substs.set('NTP_SERVERS', ntp_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400622
623conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
624
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400625substs.set('SUSHELL', get_option('debug-shell'))
626substs.set('DEBUGTTY', get_option('debug-tty'))
627
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400628debug = get_option('debug')
629if debug != ''
630 foreach name : debug.split(',')
631 if name == 'hashmap'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400632 conf.set('ENABLE_DEBUG_HASHMAP', true)
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400633 elif name == 'mmap-cache'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400634 conf.set('ENABLE_DEBUG_MMAP_CACHE', true)
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400635 else
636 message('unknown debug option "@0@", ignoring'.format(name))
637 endif
638 endforeach
639endif
640
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400641#####################################################################
642
643threads = dependency('threads')
644librt = cc.find_library('rt')
645libm = cc.find_library('m')
646libdl = cc.find_library('dl')
647libcrypt = cc.find_library('crypt')
648
Zbigniew Jędrzejewski-Szmek1800cc82017-04-27 01:30:30 -0400649libcap = dependency('libcap', required : false)
650if not libcap.found()
651 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
652 libcap = cc.find_library('cap')
653endif
654
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400655libmount = dependency('mount',
656 version : '>= 2.27')
657
658want_seccomp = get_option('seccomp')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400659if want_seccomp != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400660 libseccomp = dependency('libseccomp',
Zbigniew Jędrzejewski-Szmek9f0e9c02017-04-27 10:05:18 -0400661 version : '>= 2.3.1',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400662 required : want_seccomp == 'true')
663 if libseccomp.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400664 conf.set('HAVE_SECCOMP', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400665 m4_defines += ['-DHAVE_SECCOMP']
666 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400667else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400668 libseccomp = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400669endif
670
671want_selinux = get_option('selinux')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400672if want_selinux != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400673 libselinux = dependency('libselinux',
674 version : '>= 2.1.9',
675 required : want_selinux == 'true')
676 if libselinux.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400677 conf.set('HAVE_SELINUX', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400678 m4_defines += ['-DHAVE_SELINUX']
679 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400680else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400681 libselinux = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400682endif
683
684want_apparmor = get_option('apparmor')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400685if want_apparmor != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400686 libapparmor = dependency('libapparmor',
687 required : want_apparmor == 'true')
688 if libapparmor.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400689 conf.set('HAVE_APPARMOR', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400690 m4_defines += ['-DHAVE_APPARMOR']
691 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400692else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400693 libapparmor = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400694endif
695
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400696smack_run_label = get_option('smack-run-label')
697if smack_run_label != ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400698 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
699 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400700endif
701
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400702want_polkit = get_option('polkit')
703install_polkit = false
704install_polkit_pkla = false
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400705if want_polkit != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400706 conf.set('ENABLE_POLKIT', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400707 install_polkit = true
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400708
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400709 libpolkit = dependency('polkit-gobject-1',
710 required : false)
711 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
712 message('Old polkit detected, will install pkla files')
713 install_polkit_pkla = true
714 endif
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400715endif
716
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400717want_acl = get_option('acl')
718if want_acl != 'false'
719 libacl = cc.find_library('acl', required : want_acl == 'true')
720 if libacl.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400721 conf.set('HAVE_ACL', true)
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400722 m4_defines += ['-DHAVE_ACL']
723 endif
724else
725 libacl = []
726endif
727
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400728want_audit = get_option('audit')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400729if want_audit != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400730 libaudit = dependency('audit', required : want_audit == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400731 conf.set('HAVE_AUDIT', libaudit.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400732else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400733 libaudit = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400734endif
735
736want_blkid = get_option('blkid')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400737if want_blkid != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400738 libblkid = dependency('blkid', required : want_blkid == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400739 conf.set('HAVE_BLKID', libblkid.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400740else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400741 libblkid = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400742endif
743
744want_kmod = get_option('kmod')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400745if want_kmod != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400746 libkmod = dependency('libkmod',
747 version : '>= 15',
748 required : want_kmod == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400749 conf.set('HAVE_KMOD', libkmod.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400750else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400751 libkmod = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400752endif
753
754want_pam = get_option('pam')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400755if want_pam != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400756 libpam = cc.find_library('pam', required : want_pam == 'true')
757 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
758 if libpam.found() and libpam_misc.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400759 conf.set('HAVE_PAM', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400760 m4_defines += ['-DHAVE_PAM']
761 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400762else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400763 libpam = []
764 libpam_misc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400765endif
766
767want_microhttpd = get_option('microhttpd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400768if want_microhttpd != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400769 libmicrohttpd = dependency('libmicrohttpd',
770 version : '>= 0.9.33',
771 required : want_microhttpd == 'true')
772 if libmicrohttpd.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400773 conf.set('HAVE_MICROHTTPD', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400774 m4_defines += ['-DHAVE_MICROHTTPD']
775 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400776else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400777 libmicrohttpd = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400778endif
779
780want_libcryptsetup = get_option('libcryptsetup')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400781if want_libcryptsetup != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400782 libcryptsetup = dependency('libcryptsetup',
783 version : '>= 1.6.0',
784 required : want_libcryptsetup == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400785 conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400786else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400787 libcryptsetup = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400788endif
789
790want_libcurl = get_option('libcurl')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400791if want_libcurl != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400792 libcurl = dependency('libcurl',
793 version : '>= 7.32.0',
794 required : want_libcurl == 'true')
795 if libcurl.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400796 conf.set('HAVE_LIBCURL', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400797 m4_defines += ['-DHAVE_LIBCURL']
798 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400799else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400800 libcurl = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400801endif
802
803want_libidn = get_option('libidn')
Zbigniew Jędrzejewski-Szmek87057e22017-05-09 21:56:34 -0400804want_libidn2 = get_option('libidn2')
805if want_libidn == 'true' and want_libidn2 == 'true'
806 error('libidn and libidn2 cannot be requested simultaneously')
807endif
808
Zbigniew Jędrzejewski-Szmek7f7ab222017-07-12 03:25:59 -0400809if want_libidn != 'false' and want_libidn2 != 'true'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400810 libidn = dependency('libidn',
811 required : want_libidn == 'true')
812 if libidn.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400813 conf.set('HAVE_LIBIDN', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400814 m4_defines += ['-DHAVE_LIBIDN']
815 endif
Zbigniew Jędrzejewski-Szmek7f7ab222017-07-12 03:25:59 -0400816else
817 libidn = []
818endif
819if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false'
820 # libidn is used for both libidn and libidn2 objects
821 libidn = dependency('libidn2',
822 required : want_libidn2 == 'true')
823 if libidn.found()
824 conf.set('HAVE_LIBIDN2', true)
825 m4_defines += ['-DHAVE_LIBIDN2']
826 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400827endif
828
829want_libiptc = get_option('libiptc')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400830if want_libiptc != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400831 libiptc = dependency('libiptc',
832 required : want_libiptc == 'true')
833 if libiptc.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400834 conf.set('HAVE_LIBIPTC', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400835 m4_defines += ['-DHAVE_LIBIPTC']
836 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400837else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400838 libiptc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400839endif
840
841want_qrencode = get_option('qrencode')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400842if want_qrencode != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400843 libqrencode = dependency('libqrencode',
844 required : want_qrencode == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400845 conf.set('HAVE_QRENCODE', libqrencode.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400846else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400847 libqrencode = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400848endif
849
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -0400850want_gcrypt = get_option('gcrypt')
851if want_gcrypt != 'false'
852 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
853 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
854
855 have_deps = libgcrypt.found() and libgpg_error.found()
856 conf.set('HAVE_GCRYPT', have_deps)
857 if not have_deps
858 # link to neither of the libs if one is not found
859 libgcrypt = []
860 libgpg_error = []
861 endif
862else
863 libgcrypt = []
864 libgpg_error = []
865endif
866
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400867want_gnutls = get_option('gnutls')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400868if want_gnutls != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400869 libgnutls = dependency('gnutls',
870 version : '>= 3.1.4',
871 required : want_gnutls == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400872 conf.set('HAVE_GNUTLS', libgnutls.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400873else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400874 libgnutls = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400875endif
876
877want_elfutils = get_option('elfutils')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400878if want_elfutils != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400879 libdw = dependency('libdw',
880 required : want_elfutils == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400881 conf.set('HAVE_ELFUTILS', libdw.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400882else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400883 libdw = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400884endif
885
886want_zlib = get_option('zlib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400887if want_zlib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400888 libz = dependency('zlib',
889 required : want_zlib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400890 conf.set('HAVE_ZLIB', libz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400891else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400892 libz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400893endif
894
895want_bzip2 = get_option('bzip2')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400896if want_bzip2 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400897 libbzip2 = cc.find_library('bz2',
898 required : want_bzip2 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400899 conf.set('HAVE_BZIP2', libbzip2.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400900else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400901 libbzip2 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400902endif
903
904want_xz = get_option('xz')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400905if want_xz != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400906 libxz = dependency('liblzma',
907 required : want_xz == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400908 conf.set('HAVE_XZ', libxz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400909else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400910 libxz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400911endif
912
913want_lz4 = get_option('lz4')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400914if want_lz4 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400915 liblz4 = dependency('liblz4',
916 required : want_lz4 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400917 conf.set('HAVE_LZ4', liblz4.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400918else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400919 liblz4 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400920endif
921
Zbigniew Jędrzejewski-Szmeka44fb602017-07-26 14:08:46 -0400922want_xkbcommon = get_option('xkbcommon')
923if want_xkbcommon != 'false'
924 libxkbcommon = dependency('xkbcommon',
925 version : '>= 0.3.0',
926 required : want_xkbcommon == 'true')
927 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
928else
929 libxkbcommon = []
930endif
931
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400932want_glib = get_option('glib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400933if want_glib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400934 libglib = dependency('glib-2.0',
935 version : '>= 2.22.0',
936 required : want_glib == 'true')
937 libgobject = dependency('gobject-2.0',
938 version : '>= 2.22.0',
939 required : want_glib == 'true')
940 libgio = dependency('gio-2.0',
941 required : want_glib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400942 have = libglib.found() and libgobject.found() and libgio.found()
943 conf.set('HAVE_GLIB', have)
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400944else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400945 libglib = []
946 libgobject = []
947 libgio = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400948endif
949
950want_dbus = get_option('dbus')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400951if want_dbus != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400952 libdbus = dependency('dbus-1',
953 version : '>= 1.3.2',
954 required : want_dbus == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400955 conf.set('HAVE_DBUS', libdbus.found())
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400956else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400957 libdbus = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400958endif
959
Yu Watanabe42303dc2017-06-18 05:22:32 +0900960default_dnssec = get_option('default-dnssec')
961if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false)
962 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
963 default_dnssec = 'no'
964endif
965conf.set('DEFAULT_DNSSEC_MODE',
966 'DNSSEC_' + default_dnssec.underscorify().to_upper())
967substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
968
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400969want_importd = get_option('importd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400970if want_importd != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400971 have_deps = (conf.get('HAVE_LIBCURL', false) and
972 conf.get('HAVE_ZLIB', false) and
973 conf.get('HAVE_BZIP2', false) and
974 conf.get('HAVE_XZ', false) and
975 conf.get('HAVE_GCRYPT', false))
976 conf.set('ENABLE_IMPORTD', have_deps)
977 if want_importd == 'true' and not have_deps
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400978 error('importd support was requested, but dependencies are not available')
979 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400980endif
981
982want_remote = get_option('remote')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400983if want_remote != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400984 have_deps = [conf.get('HAVE_MICROHTTPD', false),
985 conf.get('HAVE_LIBCURL', false)]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400986 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
987 # it's possible to build one without the other. Complain only if
988 # support was explictly requested. The auxiliary files like sysusers
989 # config should be installed when any of the programs are built.
990 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
991 error('remote support was requested, but dependencies are not available')
992 endif
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400993 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400994endif
995
996foreach pair : [['utmp', 'HAVE_UTMP'],
997 ['hibernate', 'ENABLE_HIBERNATE'],
998 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
999 ['binfmt', 'ENABLE_BINFMT'],
1000 ['coredump', 'ENABLE_COREDUMP'],
1001 ['resolve', 'ENABLE_RESOLVED'],
1002 ['logind', 'ENABLE_LOGIND'],
1003 ['hostnamed', 'ENABLE_HOSTNAMED'],
1004 ['localed', 'ENABLE_LOCALED'],
1005 ['machined', 'ENABLE_MACHINED'],
1006 ['networkd', 'ENABLE_NETWORKD'],
1007 ['timedated', 'ENABLE_TIMEDATED'],
1008 ['timesyncd', 'ENABLE_TIMESYNCD'],
1009 ['myhostname', 'HAVE_MYHOSTNAME'],
1010 ['firstboot', 'ENABLE_FIRSTBOOT'],
1011 ['randomseed', 'ENABLE_RANDOMSEED'],
1012 ['backlight', 'ENABLE_BACKLIGHT'],
1013 ['vconsole', 'ENABLE_VCONSOLE'],
1014 ['quotacheck', 'ENABLE_QUOTACHECK'],
1015 ['sysusers', 'ENABLE_SYSUSERS'],
1016 ['tmpfiles', 'ENABLE_TMPFILES'],
1017 ['hwdb', 'ENABLE_HWDB'],
1018 ['rfkill', 'ENABLE_RFKILL'],
1019 ['ldconfig', 'ENABLE_LDCONFIG'],
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001020 ['efi', 'ENABLE_EFI'],
Zbigniew Jędrzejewski-Szmek18b9ad12017-07-13 09:31:47 -04001021 ['tpm', 'ENABLE_TPM'],
Zbigniew Jędrzejewski-Szmek2895c8e2017-04-13 19:45:05 -04001022 ['ima', 'HAVE_IMA'],
Zbigniew Jędrzejewski-Szmek5464ec82017-04-24 19:28:04 -04001023 ['smack', 'HAVE_SMACK'],
Franck Buib14e1b42017-05-09 14:02:37 +02001024 ['gshadow', 'ENABLE_GSHADOW'],
Zbigniew Jędrzejewski-Szmekd1bf5672017-06-16 09:16:28 -04001025 ['idn', 'ENABLE_IDN'],
Waldemar Brodkorbe7e11bb2017-06-24 19:30:26 +02001026 ['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001027 ]
1028
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001029 if get_option(pair[0])
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001030 conf.set(pair[1], true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001031 m4_defines += ['-D' + pair[1]]
1032 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001033endforeach
1034
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001035want_tests = get_option('tests')
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04001036install_tests = get_option('install-tests')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001037tests = []
1038
Zbigniew Jędrzejewski-Szmek00d82c82017-07-12 21:25:17 +00001039conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1040
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001041#####################################################################
1042
1043if get_option('efi')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001044 efi_arch = host_machine.cpu_family()
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001045
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001046 if efi_arch == 'x86'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001047 EFI_MACHINE_TYPE_NAME = 'ia32'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001048 gnu_efi_arch = 'ia32'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001049 elif efi_arch == 'x86_64'
1050 EFI_MACHINE_TYPE_NAME = 'x64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001051 gnu_efi_arch = 'x86_64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001052 elif efi_arch == 'arm'
1053 EFI_MACHINE_TYPE_NAME = 'arm'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001054 gnu_efi_arch = 'arm'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001055 elif efi_arch == 'aarch64'
1056 EFI_MACHINE_TYPE_NAME = 'aa64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001057 gnu_efi_arch = 'aarch64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001058 else
1059 EFI_MACHINE_TYPE_NAME = ''
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001060 gnu_efi_arch = ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001061 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001062
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001063 conf.set('ENABLE_EFI', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001064 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
Zbigniew Jędrzejewski-Szmek80c6fce2017-04-24 19:28:04 -04001065
1066 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001067endif
1068
1069#####################################################################
1070
1071config_h = configure_file(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001072 output : 'config.h',
1073 configuration : conf)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001074
1075includes = include_directories('src/basic',
1076 'src/shared',
1077 'src/systemd',
1078 'src/journal',
1079 'src/resolve',
1080 'src/timesync',
1081 'src/login',
1082 'src/udev',
1083 'src/libudev',
1084 'src/core',
1085 'src/libsystemd/sd-bus',
1086 'src/libsystemd/sd-device',
1087 'src/libsystemd/sd-hwdb',
1088 'src/libsystemd/sd-id128',
1089 'src/libsystemd/sd-netlink',
1090 'src/libsystemd/sd-network',
1091 'src/libsystemd-network',
1092 )
1093
1094add_project_arguments('-include', 'config.h', language : 'c')
1095
1096gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1097 'src/shared/gcrypt-util.c')
1098
1099subdir('po')
1100subdir('catalog')
1101subdir('src/systemd')
1102subdir('src/basic')
1103subdir('src/libsystemd')
1104subdir('src/libsystemd-network')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001105subdir('src/journal')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001106subdir('src/login')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001107
1108libjournal_core = static_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001109 'journal-core',
1110 libjournal_core_sources,
1111 journald_gperf_c,
1112 include_directories : includes,
1113 install : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001114
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04001115libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001116libsystemd = shared_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001117 'systemd',
1118 libsystemd_internal_sources,
1119 journal_internal_sources,
Lennart Poettering43091722017-06-27 23:11:26 +02001120 version : '0.19.0',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001121 include_directories : includes,
1122 link_args : ['-shared',
1123 '-Wl,--version-script=' + libsystemd_sym_path],
1124 link_with : [libbasic],
1125 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001126 libgcrypt,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001127 librt,
1128 libxz,
1129 liblz4],
1130 link_depends : libsystemd_sym,
1131 install : true,
1132 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001133
1134############################################################
1135
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001136# binaries that have --help and are intended for use by humans,
1137# usually, but not always, installed in /bin.
1138public_programs = []
1139
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001140subdir('src/libudev')
1141subdir('src/shared')
1142subdir('src/core')
1143subdir('src/udev')
1144subdir('src/network')
1145
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001146subdir('src/analyze')
1147subdir('src/journal-remote')
1148subdir('src/coredump')
1149subdir('src/hostname')
1150subdir('src/import')
1151subdir('src/kernel-install')
1152subdir('src/locale')
1153subdir('src/machine')
1154subdir('src/nspawn')
1155subdir('src/resolve')
1156subdir('src/timedate')
1157subdir('src/timesync')
1158subdir('src/vconsole')
Zbigniew Jędrzejewski-Szmek4e4ab1c2017-04-10 12:37:52 -04001159subdir('src/sulogin-shell')
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001160subdir('src/boot/efi')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001161
1162subdir('src/test')
Zbigniew Jędrzejewski-Szmek4ff3f252017-04-13 20:47:20 -04001163subdir('test')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001164
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001165############################################################
1166
1167# only static linking apart from libdl, to make sure that the
1168# module is linked to all libraries that it uses.
1169test_dlopen = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001170 'test-dlopen',
1171 test_dlopen_c,
1172 include_directories : includes,
1173 link_with : [libbasic],
1174 dependencies : [libdl])
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001175
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001176foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
Waldemar Brodkorbe7e11bb2017-06-24 19:30:26 +02001177 ['systemd', 'ENABLE_NSS_SYSTEMD'],
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001178 ['mymachines', 'ENABLE_MACHINED'],
1179 ['resolve', 'ENABLE_RESOLVED']]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001180
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001181 condition = tuple[1] == '' or conf.get(tuple[1], false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001182 if condition
1183 module = tuple[0]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001184
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001185 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1186 version_script_arg = join_paths(meson.current_source_dir(), sym)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001187
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001188 nss = shared_library(
1189 'nss_' + module,
1190 'src/nss-@0@/nss-@0@.c'.format(module),
1191 version : '2',
1192 include_directories : includes,
1193 link_args : ['-shared',
1194 '-Wl,--version-script=' + version_script_arg,
1195 '-Wl,--undefined'],
1196 link_with : [libsystemd_internal,
1197 libbasic],
1198 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001199 librt],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001200 link_depends : sym,
1201 install : true,
1202 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001203
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001204 # We cannot use shared_module because it does not support version suffix.
1205 # Unfortunately shared_library insists on creating the symlink…
1206 meson.add_install_script('sh', '-c',
1207 'rm $DESTDIR@0@/libnss_@1@.so'
1208 .format(rootlibdir, module))
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001209
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001210 test('dlopen-nss_' + module,
1211 test_dlopen,
1212 args : [nss.full_path()]) # path to dlopen must include a slash
1213 endif
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001214endforeach
1215
1216############################################################
1217
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001218executable('systemd',
1219 systemd_sources,
1220 include_directories : includes,
1221 link_with : [libcore,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001222 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001223 dependencies : [threads,
1224 librt,
1225 libseccomp,
1226 libselinux,
Zbigniew Jędrzejewski-Szmekf4ee10a2017-04-09 14:08:53 -04001227 libmount,
1228 libblkid],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001229 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001230 install : true,
1231 install_dir : rootlibexecdir)
1232
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001233exe = executable('systemd-analyze',
1234 systemd_analyze_sources,
1235 include_directories : includes,
1236 link_with : [libcore,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001237 libshared],
1238 dependencies : [threads,
1239 librt,
1240 libseccomp,
1241 libselinux,
1242 libmount,
1243 libblkid],
1244 install_rpath : rootlibexecdir,
1245 install : true)
1246public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001247
1248executable('systemd-journald',
1249 systemd_journald_sources,
1250 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001251 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001252 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001253 dependencies : [threads,
1254 libxz,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001255 liblz4,
1256 libselinux],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001257 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001258 install : true,
1259 install_dir : rootlibexecdir)
1260
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001261exe = executable('systemd-cat',
1262 systemd_cat_sources,
1263 include_directories : includes,
1264 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001265 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001266 dependencies : [threads],
1267 install_rpath : rootlibexecdir,
1268 install : true)
1269public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001270
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001271exe = executable('journalctl',
1272 journalctl_sources,
1273 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001274 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001275 dependencies : [threads,
1276 libqrencode,
1277 libxz,
1278 liblz4],
1279 install_rpath : rootlibexecdir,
1280 install : true,
1281 install_dir : rootbindir)
1282public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001283
1284executable('systemd-getty-generator',
1285 'src/getty-generator/getty-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001286 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001287 link_with : [libshared],
1288 install_rpath : rootlibexecdir,
1289 install : true,
1290 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001291
1292executable('systemd-debug-generator',
1293 'src/debug-generator/debug-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001294 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001295 link_with : [libshared],
1296 install_rpath : rootlibexecdir,
1297 install : true,
1298 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001299
1300executable('systemd-fstab-generator',
1301 'src/fstab-generator/fstab-generator.c',
1302 'src/core/mount-setup.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001303 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001304 link_with : [libshared],
1305 install_rpath : rootlibexecdir,
1306 install : true,
1307 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001308
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001309if conf.get('ENABLE_ENVIRONMENT_D', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001310 executable('30-systemd-environment-d-generator',
1311 'src/environment-d-generator/environment-d-generator.c',
1312 include_directories : includes,
1313 link_with : [libshared],
1314 install_rpath : rootlibexecdir,
1315 install : true,
1316 install_dir : userenvgeneratordir)
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001317
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001318 meson.add_install_script(meson_make_symlink,
1319 join_paths(sysconfdir, 'environment'),
1320 join_paths(environmentdir, '99-environment.conf'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001321endif
1322
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001323if conf.get('ENABLE_HIBERNATE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001324 executable('systemd-hibernate-resume-generator',
1325 'src/hibernate-resume/hibernate-resume-generator.c',
1326 include_directories : includes,
1327 link_with : [libshared],
1328 install_rpath : rootlibexecdir,
1329 install : true,
1330 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001331
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001332 executable('systemd-hibernate-resume',
1333 'src/hibernate-resume/hibernate-resume.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001334 include_directories : includes,
1335 link_with : [libshared],
1336 install_rpath : rootlibexecdir,
1337 install : true,
1338 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001339endif
1340
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001341if conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001342 executable('systemd-gpt-auto-generator',
1343 'src/gpt-auto-generator/gpt-auto-generator.c',
1344 'src/basic/blkid-util.h',
1345 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001346 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001347 dependencies : libblkid,
1348 install_rpath : rootlibexecdir,
1349 install : true,
1350 install_dir : systemgeneratordir)
1351
1352 exe = executable('systemd-dissect',
1353 'src/dissect/dissect.c',
1354 include_directories : includes,
1355 link_with : [libshared],
1356 install_rpath : rootlibexecdir,
1357 install : true,
1358 install_dir : rootlibexecdir)
1359 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001360endif
1361
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001362if conf.get('ENABLE_RESOLVED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001363 executable('systemd-resolved',
1364 systemd_resolved_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001365 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001366 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001367 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001368 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001369 libgcrypt,
1370 libgpg_error,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001371 libm,
1372 libidn],
1373 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001374 install : true,
1375 install_dir : rootlibexecdir)
1376
1377 exe = executable('systemd-resolve',
1378 systemd_resolve_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001379 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001380 include_directories : includes,
1381 link_with : [libshared],
1382 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001383 libgcrypt,
1384 libgpg_error,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001385 libm,
1386 libidn],
1387 install_rpath : rootlibexecdir,
1388 install : true)
1389 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001390endif
1391
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001392if conf.get('ENABLE_LOGIND', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001393 executable('systemd-logind',
1394 systemd_logind_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001395 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001396 link_with : [liblogind_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001397 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001398 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001399 libacl],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001400 install_rpath : rootlibexecdir,
1401 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001402 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001403
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001404 exe = executable('loginctl',
1405 loginctl_sources,
1406 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001407 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001408 dependencies : [threads,
1409 liblz4,
1410 libxz],
1411 install_rpath : rootlibexecdir,
1412 install : true,
1413 install_dir : rootbindir)
1414 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001415
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001416 exe = executable('systemd-inhibit',
1417 'src/login/inhibit.c',
1418 include_directories : includes,
1419 link_with : [libshared],
1420 install_rpath : rootlibexecdir,
1421 install : true,
1422 install_dir : rootbindir)
1423 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001424
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001425 if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001426 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1427 pam_systemd = shared_library(
1428 'pam_systemd',
1429 pam_systemd_c,
1430 name_prefix : '',
1431 include_directories : includes,
1432 link_args : ['-shared',
1433 '-Wl,--version-script=' + version_script_arg],
1434 link_with : [libsystemd_internal,
1435 libshared_static],
1436 dependencies : [threads,
1437 libpam,
1438 libpam_misc],
1439 link_depends : pam_systemd_sym,
1440 install : true,
1441 install_dir : pamlibdir)
1442
1443 test('dlopen-pam_systemd',
1444 test_dlopen,
1445 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1446 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001447endif
1448
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001449if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001450 executable('systemd-user-sessions',
1451 'src/user-sessions/user-sessions.c',
1452 include_directories : includes,
1453 link_with : [libshared],
1454 install_rpath : rootlibexecdir,
1455 install : true,
1456 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001457endif
1458
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001459if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001460 exe = executable('bootctl',
1461 'src/boot/bootctl.c',
1462 include_directories : includes,
1463 link_with : [libshared],
1464 dependencies : [libblkid],
1465 install_rpath : rootlibexecdir,
1466 install : true)
1467 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001468endif
1469
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001470exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1471 include_directories : includes,
1472 link_with : [libshared],
1473 dependencies : [threads],
1474 install_rpath : rootlibexecdir,
1475 install : true)
1476public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001477
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001478exe = executable('systemctl', 'src/systemctl/systemctl.c',
1479 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001480 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001481 dependencies : [threads,
1482 libcap,
1483 libselinux,
1484 libxz,
1485 liblz4],
1486 install_rpath : rootlibexecdir,
1487 install : true,
1488 install_dir : rootbindir)
1489public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001490
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001491if conf.get('ENABLE_BACKLIGHT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001492 executable('systemd-backlight',
1493 'src/backlight/backlight.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
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001501if conf.get('ENABLE_RFKILL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001502 executable('systemd-rfkill',
1503 'src/rfkill/rfkill.c',
1504 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001505 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001506 install_rpath : rootlibexecdir,
1507 install : true,
1508 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001509endif
1510
1511executable('systemd-system-update-generator',
1512 'src/system-update-generator/system-update-generator.c',
1513 include_directories : includes,
1514 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001515 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001516 install : true,
1517 install_dir : systemgeneratordir)
1518
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001519if conf.get('HAVE_LIBCRYPTSETUP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001520 executable('systemd-cryptsetup',
1521 'src/cryptsetup/cryptsetup.c',
1522 include_directories : includes,
1523 link_with : [libshared],
1524 dependencies : [libcryptsetup],
1525 install_rpath : rootlibexecdir,
1526 install : true,
1527 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001528
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001529 executable('systemd-cryptsetup-generator',
1530 'src/cryptsetup/cryptsetup-generator.c',
1531 include_directories : includes,
1532 link_with : [libshared],
1533 dependencies : [libcryptsetup],
1534 install_rpath : rootlibexecdir,
1535 install : true,
1536 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001537
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001538 executable('systemd-veritysetup',
1539 'src/veritysetup/veritysetup.c',
1540 include_directories : includes,
1541 link_with : [libshared],
1542 dependencies : [libcryptsetup],
1543 install_rpath : rootlibexecdir,
1544 install : true,
1545 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001546
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001547 executable('systemd-veritysetup-generator',
1548 'src/veritysetup/veritysetup-generator.c',
1549 include_directories : includes,
1550 link_with : [libshared],
1551 dependencies : [libcryptsetup],
1552 install_rpath : rootlibexecdir,
1553 install : true,
1554 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001555endif
1556
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001557if conf.get('HAVE_SYSV_COMPAT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001558 executable('systemd-sysv-generator',
1559 'src/sysv-generator/sysv-generator.c',
1560 include_directories : includes,
1561 link_with : [libshared],
1562 install_rpath : rootlibexecdir,
1563 install : true,
1564 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001565
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001566 executable('systemd-rc-local-generator',
1567 'src/rc-local-generator/rc-local-generator.c',
1568 include_directories : includes,
1569 link_with : [libshared],
1570 install_rpath : rootlibexecdir,
1571 install : true,
1572 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001573endif
1574
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001575if conf.get('ENABLE_HOSTNAMED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001576 executable('systemd-hostnamed',
1577 'src/hostname/hostnamed.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001578 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001579 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001580 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001581 install : true,
1582 install_dir : rootlibexecdir)
1583
1584 exe = executable('hostnamectl',
1585 'src/hostname/hostnamectl.c',
1586 include_directories : includes,
1587 link_with : [libshared],
1588 install_rpath : rootlibexecdir,
1589 install : true)
1590 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001591endif
1592
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001593if conf.get('ENABLE_LOCALED', false)
1594 if conf.get('HAVE_XKBCOMMON', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001595 # logind will load libxkbcommon.so dynamically on its own
1596 deps = [libdl]
1597 else
1598 deps = []
1599 endif
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -04001600
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001601 executable('systemd-localed',
1602 systemd_localed_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001603 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001604 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001605 dependencies : deps,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001606 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001607 install : true,
1608 install_dir : rootlibexecdir)
1609
1610 exe = executable('localectl',
1611 localectl_sources,
1612 include_directories : includes,
1613 link_with : [libshared],
1614 install_rpath : rootlibexecdir,
1615 install : true)
1616 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001617endif
1618
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001619if conf.get('ENABLE_TIMEDATED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001620 executable('systemd-timedated',
1621 'src/timedate/timedated.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001622 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001623 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001624 install_rpath : rootlibexecdir,
1625 install : true,
1626 install_dir : rootlibexecdir)
1627
1628 exe = executable('timedatectl',
1629 'src/timedate/timedatectl.c',
1630 include_directories : includes,
1631 install_rpath : rootlibexecdir,
1632 link_with : [libshared],
1633 install : true)
1634 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001635endif
1636
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001637if conf.get('ENABLE_TIMESYNCD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001638 executable('systemd-timesyncd',
1639 systemd_timesyncd_sources,
1640 include_directories : includes,
1641 link_with : [libshared],
1642 dependencies : [threads,
1643 libm],
1644 install_rpath : rootlibexecdir,
1645 install : true,
1646 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001647endif
1648
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001649if conf.get('ENABLE_MACHINED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001650 executable('systemd-machined',
1651 systemd_machined_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001652 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001653 link_with : [libmachine_core,
1654 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001655 install_rpath : rootlibexecdir,
1656 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001657 install_dir : rootlibexecdir)
1658
1659 exe = executable('machinectl',
1660 'src/machine/machinectl.c',
1661 include_directories : includes,
1662 link_with : [libshared],
1663 dependencies : [threads,
1664 libxz,
1665 liblz4],
1666 install_rpath : rootlibexecdir,
1667 install : true,
1668 install_dir : rootbindir)
1669 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001670endif
1671
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001672if conf.get('ENABLE_IMPORTD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001673 executable('systemd-importd',
1674 systemd_importd_sources,
1675 include_directories : includes,
1676 link_with : [libshared],
1677 dependencies : [threads],
1678 install_rpath : rootlibexecdir,
1679 install : true,
1680 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001681
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001682 systemd_pull = executable('systemd-pull',
1683 systemd_pull_sources,
1684 include_directories : includes,
1685 link_with : [libshared],
1686 dependencies : [libcurl,
1687 libz,
1688 libbzip2,
1689 libxz,
1690 libgcrypt],
1691 install_rpath : rootlibexecdir,
1692 install : true,
1693 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001694
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001695 systemd_import = executable('systemd-import',
1696 systemd_import_sources,
1697 include_directories : includes,
1698 link_with : [libshared],
1699 dependencies : [libcurl,
1700 libz,
1701 libbzip2,
1702 libxz],
1703 install_rpath : rootlibexecdir,
1704 install : true,
1705 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001706
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001707 systemd_export = executable('systemd-export',
1708 systemd_export_sources,
1709 include_directories : includes,
1710 link_with : [libshared],
1711 dependencies : [libcurl,
1712 libz,
1713 libbzip2,
1714 libxz],
1715 install_rpath : rootlibexecdir,
1716 install : true,
1717 install_dir : rootlibexecdir)
1718 public_programs += [systemd_pull, systemd_import, systemd_export]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001719endif
1720
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001721if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001722 exe = executable('systemd-journal-upload',
1723 systemd_journal_upload_sources,
1724 include_directories : includes,
1725 link_with : [libshared],
1726 dependencies : [threads,
1727 libcurl,
1728 libgnutls,
1729 libxz,
1730 liblz4],
1731 install_rpath : rootlibexecdir,
1732 install : true,
1733 install_dir : rootlibexecdir)
1734 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001735endif
1736
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001737if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001738 s_j_remote = executable('systemd-journal-remote',
1739 systemd_journal_remote_sources,
1740 include_directories : includes,
1741 link_with : [libshared],
1742 dependencies : [threads,
1743 libmicrohttpd,
1744 libgnutls,
1745 libxz,
1746 liblz4],
1747 install_rpath : rootlibexecdir,
1748 install : true,
1749 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001750
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001751 s_j_gatewayd = executable('systemd-journal-gatewayd',
1752 systemd_journal_gatewayd_sources,
1753 include_directories : includes,
1754 link_with : [libshared],
1755 dependencies : [threads,
1756 libmicrohttpd,
1757 libgnutls,
1758 libxz,
1759 liblz4],
1760 install_rpath : rootlibexecdir,
1761 install : true,
1762 install_dir : rootlibexecdir)
1763 public_programs += [s_j_remote, s_j_gatewayd]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001764endif
1765
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001766if conf.get('ENABLE_COREDUMP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001767 executable('systemd-coredump',
1768 systemd_coredump_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001769 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001770 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001771 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001772 libacl,
1773 libdw,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001774 libxz,
1775 liblz4],
1776 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001777 install : true,
1778 install_dir : rootlibexecdir)
1779
1780 exe = executable('coredumpctl',
1781 coredumpctl_sources,
1782 include_directories : includes,
1783 link_with : [libshared],
1784 dependencies : [threads,
1785 libxz,
1786 liblz4],
1787 install_rpath : rootlibexecdir,
1788 install : true)
1789 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001790endif
1791
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001792if conf.get('ENABLE_BINFMT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001793 exe = executable('systemd-binfmt',
1794 'src/binfmt/binfmt.c',
1795 include_directories : includes,
1796 link_with : [libshared],
1797 install_rpath : rootlibexecdir,
1798 install : true,
1799 install_dir : rootlibexecdir)
1800 public_programs += [exe]
1801
1802 meson.add_install_script('sh', '-c',
1803 mkdir_p.format(binfmtdir))
1804 meson.add_install_script('sh', '-c',
1805 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1806endif
1807
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001808if conf.get('ENABLE_VCONSOLE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001809 executable('systemd-vconsole-setup',
1810 'src/vconsole/vconsole-setup.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001811 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_RANDOMSEED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001819 executable('systemd-random-seed',
1820 'src/random-seed/random-seed.c',
1821 include_directories : includes,
1822 link_with : [libshared],
1823 install_rpath : rootlibexecdir,
1824 install : true,
1825 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001826endif
1827
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001828if conf.get('ENABLE_FIRSTBOOT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001829 executable('systemd-firstboot',
1830 'src/firstboot/firstboot.c',
1831 include_directories : includes,
1832 link_with : [libshared],
1833 dependencies : [libcrypt],
1834 install_rpath : rootlibexecdir,
1835 install : true,
1836 install_dir : rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001837endif
1838
1839executable('systemd-remount-fs',
1840 'src/remount-fs/remount-fs.c',
1841 'src/core/mount-setup.c',
1842 'src/core/mount-setup.h',
1843 include_directories : includes,
1844 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 : rootlibexecdir)
1848
1849executable('systemd-machine-id-setup',
1850 'src/machine-id-setup/machine-id-setup-main.c',
1851 'src/core/machine-id-setup.c',
1852 'src/core/machine-id-setup.h',
1853 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001854 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001855 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001856 install : true,
1857 install_dir : rootbindir)
1858
1859executable('systemd-fsck',
1860 'src/fsck/fsck.c',
1861 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001862 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001863 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001864 install : true,
1865 install_dir : rootlibexecdir)
1866
1867executable('systemd-sleep',
1868 'src/sleep/sleep.c',
1869 include_directories : includes,
1870 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001871 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001872 install : true,
1873 install_dir : rootlibexecdir)
1874
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001875exe = executable('systemd-sysctl',
1876 'src/sysctl/sysctl.c',
1877 include_directories : includes,
1878 link_with : [libshared],
1879 install_rpath : rootlibexecdir,
1880 install : true,
1881 install_dir : rootlibexecdir)
1882public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001883
1884executable('systemd-ac-power',
1885 'src/ac-power/ac-power.c',
1886 include_directories : includes,
1887 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001888 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001889 install : true,
1890 install_dir : rootlibexecdir)
1891
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001892exe = executable('systemd-detect-virt',
1893 'src/detect-virt/detect-virt.c',
1894 include_directories : includes,
1895 link_with : [libshared],
1896 install_rpath : rootlibexecdir,
1897 install : true)
1898public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001899
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001900exe = executable('systemd-delta',
1901 'src/delta/delta.c',
1902 include_directories : includes,
1903 link_with : [libshared],
1904 install_rpath : rootlibexecdir,
1905 install : true)
1906public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001907
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001908exe = executable('systemd-escape',
1909 'src/escape/escape.c',
1910 include_directories : includes,
1911 link_with : [libshared],
1912 install_rpath : rootlibexecdir,
1913 install : true,
1914 install_dir : rootbindir)
1915public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001916
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001917exe = executable('systemd-notify',
1918 'src/notify/notify.c',
1919 include_directories : includes,
1920 link_with : [libshared],
1921 install_rpath : rootlibexecdir,
1922 install : true,
1923 install_dir : rootbindir)
1924public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001925
1926executable('systemd-volatile-root',
1927 'src/volatile-root/volatile-root.c',
1928 include_directories : includes,
1929 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001930 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001931 install : true,
1932 install_dir : rootlibexecdir)
1933
1934executable('systemd-cgroups-agent',
1935 'src/cgroups-agent/cgroups-agent.c',
1936 include_directories : includes,
1937 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001938 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001939 install : true,
1940 install_dir : rootlibexecdir)
1941
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001942exe = executable('systemd-path',
1943 'src/path/path.c',
1944 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001945 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001946 install_rpath : rootlibexecdir,
1947 install : true)
1948public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001949
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001950exe = executable('systemd-ask-password',
1951 'src/ask-password/ask-password.c',
1952 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001953 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001954 install_rpath : rootlibexecdir,
1955 install : true,
1956 install_dir : rootbindir)
1957public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001958
1959executable('systemd-reply-password',
1960 'src/reply-password/reply-password.c',
1961 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001962 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001963 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001964 install : true,
1965 install_dir : rootlibexecdir)
1966
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001967exe = executable('systemd-tty-ask-password-agent',
1968 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1969 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001970 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001971 install_rpath : rootlibexecdir,
1972 install : true,
1973 install_dir : rootbindir)
1974public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001975
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001976exe = executable('systemd-cgls',
1977 'src/cgls/cgls.c',
1978 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001979 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001980 install_rpath : rootlibexecdir,
1981 install : true)
1982public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001983
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001984exe = executable('systemd-cgtop',
1985 'src/cgtop/cgtop.c',
1986 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001987 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001988 install_rpath : rootlibexecdir,
1989 install : true)
1990public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001991
1992executable('systemd-initctl',
1993 'src/initctl/initctl.c',
1994 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001995 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001996 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001997 install : true,
1998 install_dir : rootlibexecdir)
1999
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002000exe = executable('systemd-mount',
2001 'src/mount/mount-tool.c',
2002 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02002003 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002004 install_rpath : rootlibexecdir,
2005 install : true)
2006public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002007
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04002008meson.add_install_script(meson_make_symlink,
Michael Bieble17e5ba2017-04-13 10:30:56 -04002009 'systemd-mount', join_paths(bindir, 'systemd-umount'))
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04002010
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002011exe = executable('systemd-run',
2012 'src/run/run.c',
2013 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002014 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002015 install_rpath : rootlibexecdir,
2016 install : true)
2017public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002018
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002019exe = executable('systemd-stdio-bridge',
2020 'src/stdio-bridge/stdio-bridge.c',
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-Szmek005a29f2017-04-13 11:52:05 -04002027exe = executable('busctl',
2028 'src/busctl/busctl.c',
2029 'src/busctl/busctl-introspect.c',
2030 'src/busctl/busctl-introspect.h',
2031 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002032 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002033 install_rpath : rootlibexecdir,
2034 install : true)
2035public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002036
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002037if conf.get('ENABLE_SYSUSERS', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002038 exe = executable('systemd-sysusers',
2039 'src/sysusers/sysusers.c',
2040 include_directories : includes,
2041 link_with : [libshared],
2042 install_rpath : rootlibexecdir,
2043 install : true,
2044 install_dir : rootbindir)
2045 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002046endif
2047
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002048if conf.get('ENABLE_TMPFILES', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002049 exe = executable('systemd-tmpfiles',
2050 'src/tmpfiles/tmpfiles.c',
2051 include_directories : includes,
2052 link_with : [libshared],
2053 dependencies : [libacl],
2054 install_rpath : rootlibexecdir,
2055 install : true,
2056 install_dir : rootbindir)
2057 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002058endif
2059
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002060if conf.get('ENABLE_HWDB', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002061 exe = executable('systemd-hwdb',
2062 'src/hwdb/hwdb.c',
2063 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2064 include_directories : includes,
Michael Biebl0da6f392017-04-21 18:32:14 +02002065 link_with : [libudev_internal],
2066 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002067 install : true,
2068 install_dir : rootbindir)
2069 public_programs += [exe]
2070endif
2071
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002072if conf.get('ENABLE_QUOTACHECK', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002073 executable('systemd-quotacheck',
2074 'src/quotacheck/quotacheck.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002075 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002076 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002077 install_rpath : rootlibexecdir,
2078 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002079 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002080endif
2081
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002082exe = executable('systemd-socket-proxyd',
2083 'src/socket-proxy/socket-proxyd.c',
2084 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002085 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002086 dependencies : [threads],
2087 install_rpath : rootlibexecdir,
2088 install : true,
2089 install_dir : rootlibexecdir)
2090public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002091
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002092exe = executable('systemd-udevd',
2093 systemd_udevd_sources,
2094 include_directories : includes,
Zbigniew Jędrzejewski-Szmek5c720492017-02-22 23:13:22 -05002095 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002096 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002097 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002098 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002099 dependencies : [threads,
2100 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002101 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002102 libacl,
2103 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002104 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002105 install : true,
2106 install_dir : rootlibexecdir)
2107public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002108
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002109exe = executable('udevadm',
2110 udevadm_sources,
2111 include_directories : includes,
2112 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002113 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002114 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002115 dependencies : [threads,
2116 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002117 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002118 libacl,
2119 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002120 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002121 install : true,
2122 install_dir : rootbindir)
2123public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002124
2125executable('systemd-shutdown',
2126 systemd_shutdown_sources,
2127 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02002128 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002129 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002130 install : true,
2131 install_dir : rootlibexecdir)
2132
2133executable('systemd-update-done',
2134 'src/update-done/update-done.c',
2135 include_directories : includes,
2136 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002137 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002138 install : true,
2139 install_dir : rootlibexecdir)
2140
2141executable('systemd-update-utmp',
2142 'src/update-utmp/update-utmp.c',
2143 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002144 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002145 dependencies : [libaudit],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002146 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002147 install : true,
2148 install_dir : rootlibexecdir)
2149
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002150if conf.get('HAVE_KMOD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002151 executable('systemd-modules-load',
2152 'src/modules-load/modules-load.c',
2153 include_directories : includes,
2154 link_with : [libshared],
2155 dependencies : [libkmod],
2156 install_rpath : rootlibexecdir,
2157 install : true,
2158 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002159
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002160 meson.add_install_script('sh', '-c',
2161 mkdir_p.format(modulesloaddir))
2162 meson.add_install_script('sh', '-c',
2163 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002164endif
2165
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002166exe = executable('systemd-nspawn',
2167 systemd_nspawn_sources,
2168 'src/core/mount-setup.c', # FIXME: use a variable?
2169 'src/core/mount-setup.h',
2170 'src/core/loopback-setup.c',
2171 'src/core/loopback-setup.h',
2172 include_directories : [includes, include_directories('src/nspawn')],
Zbigniew Jędrzejewski-Szmek0bc91152017-04-27 13:39:54 -04002173 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002174 dependencies : [libacl,
2175 libblkid,
2176 libseccomp,
2177 libselinux],
2178 install_rpath : rootlibexecdir,
2179 install : true)
2180public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002181
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002182if conf.get('ENABLE_NETWORKD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002183 executable('systemd-networkd',
2184 systemd_networkd_sources,
2185 include_directories : includes,
2186 link_with : [libnetworkd_core,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002187 libsystemd_network,
2188 libudev_internal,
2189 libshared],
Zbigniew Jędrzejewski-Szmek4b57a272017-06-21 06:05:15 -04002190 dependencies : [threads],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002191 install_rpath : rootlibexecdir,
2192 install : true,
2193 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002194
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002195 executable('systemd-networkd-wait-online',
2196 systemd_networkd_wait_online_sources,
2197 include_directories : includes,
2198 link_with : [libnetworkd_core,
2199 libshared],
2200 install_rpath : rootlibexecdir,
2201 install : true,
2202 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmekf0bd7cc2017-04-12 12:14:30 -04002203endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002204
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002205exe = executable('networkctl',
2206 networkctl_sources,
2207 include_directories : includes,
2208 link_with : [libsystemd_network,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002209 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002210 install_rpath : rootlibexecdir,
2211 install : true,
2212 install_dir : rootbindir)
2213public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002214
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002215############################################################
2216
2217foreach tuple : tests
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002218 sources = tuple[0]
2219 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2220 dependencies = tuple[2]
2221 condition = tuple.length() >= 4 ? tuple[3] : ''
2222 type = tuple.length() >= 5 ? tuple[4] : ''
2223 defs = tuple.length() >= 6 ? tuple[5] : []
2224 incs = tuple.length() >= 7 ? tuple[6] : includes
2225 timeout = 30
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002226
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002227 name = sources[0].split('/')[-1].split('.')[0]
2228 if type.startswith('timeout=')
2229 timeout = type.split('=')[1].to_int()
2230 type = ''
2231 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002232
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002233 if condition == '' or conf.get(condition, false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002234 exe = executable(
2235 name,
2236 sources,
2237 include_directories : incs,
2238 link_with : link_with,
2239 dependencies : dependencies,
2240 c_args : defs,
2241 install_rpath : rootlibexecdir,
Michael Biebl7cdd9782017-06-23 03:23:30 +02002242 install : install_tests,
2243 install_dir : join_paths(testsdir, type))
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04002244
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002245 if type == 'manual'
2246 message('@0@ is a manual test'.format(name))
2247 elif type == 'unsafe' and want_tests != 'unsafe'
2248 message('@0@ is an unsafe test'.format(name))
2249 else
2250 test(name, exe,
2251 env : test_env,
2252 timeout : timeout)
2253 endif
2254 else
2255 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2256 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002257endforeach
2258
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002259test_libsystemd_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002260 'test-libsystemd-sym',
2261 test_libsystemd_sym_c,
2262 include_directories : includes,
2263 link_with : [libsystemd],
2264 install : install_tests,
2265 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002266test('test-libsystemd-sym',
2267 test_libsystemd_sym)
2268
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002269test_libudev_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002270 'test-libudev-sym',
2271 test_libudev_sym_c,
2272 include_directories : includes,
2273 c_args : ['-Wno-deprecated-declarations'],
2274 link_with : [libudev],
2275 install : install_tests,
2276 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002277test('test-libudev-sym',
2278 test_libudev_sym)
2279
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002280############################################################
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002281
2282make_directive_index_py = find_program('tools/make-directive-index.py')
2283make_man_index_py = find_program('tools/make-man-index.py')
Zbigniew Jędrzejewski-Szmekb184e8f2017-04-13 19:59:21 -04002284xml_helper_py = find_program('tools/xml_helper.py')
Zbigniew Jędrzejewski-Szmekabba22c2017-04-15 00:40:59 -04002285hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002286
2287subdir('units')
2288subdir('sysctl.d')
2289subdir('sysusers.d')
2290subdir('tmpfiles.d')
2291subdir('rules')
2292subdir('hwdb')
2293subdir('network')
2294subdir('man')
2295subdir('shell-completion/bash')
2296subdir('shell-completion/zsh')
2297subdir('docs/sysvinit')
2298subdir('docs/var-log')
2299
2300# FIXME: figure out if the warning is true:
2301# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2302install_subdir('factory/etc',
2303 install_dir : factorydir)
2304
2305
2306install_data('xorg/50-systemd-user.sh',
2307 install_dir : xinitrcdir)
2308install_data('system-preset/90-systemd.preset',
2309 install_dir : systempresetdir)
2310install_data('README',
2311 'NEWS',
2312 'CODING_STYLE',
2313 'DISTRO_PORTING',
2314 'ENVIRONMENT.md',
2315 'LICENSE.GPL2',
2316 'LICENSE.LGPL2.1',
2317 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2318 install_dir : docdir)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002319
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002320meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2321meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2322
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002323############################################################
2324
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002325meson_check_help = find_program('tools/meson-check-help.sh')
2326
2327foreach exec : public_programs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002328 name = exec.full_path().split('/')[-1]
2329 test('check-help-' + name,
2330 meson_check_help,
2331 args : [exec.full_path()])
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002332endforeach
2333
2334############################################################
2335
Zbigniew Jędrzejewski-Szmek0700e8b2017-07-03 12:42:29 -04002336if git.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002337 all_files = run_command(
2338 git,
2339 ['--git-dir=@0@/.git'.format(meson.source_root()),
2340 'ls-files',
2341 ':/*.[ch]'])
2342 all_files = files(all_files.stdout().split())
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002343
Zbigniew Jędrzejewski-Szmek341b8922017-05-30 19:56:12 -04002344 run_target(
Zbigniew Jędrzejewski-Szmek0700e8b2017-07-03 12:42:29 -04002345 'tags',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002346 input : all_files,
Zbigniew Jędrzejewski-Szmek0700e8b2017-07-03 12:42:29 -04002347 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.source_root())] + all_files)
2348 run_target(
2349 'ctags',
2350 input : all_files,
2351 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.source_root())] + all_files)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002352endif
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002353
2354if git.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002355 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
Zbigniew Jędrzejewski-Szmeka923e082017-04-17 19:48:20 -04002356 run_target(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002357 'git-contrib',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002358 command : [meson_git_contrib_sh])
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002359endif
Zbigniew Jędrzejewski-Szmekdd6ab3d2017-04-24 19:28:05 -04002360
2361if git.found()
2362 git_head = run_command(
2363 git,
2364 ['--git-dir=@0@/.git'.format(meson.source_root()),
2365 'rev-parse', 'HEAD']).stdout().strip()
2366 git_head_short = run_command(
2367 git,
2368 ['--git-dir=@0@/.git'.format(meson.source_root()),
2369 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2370
2371 run_target(
2372 'git-snapshot',
2373 command : ['git', 'archive',
2374 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.source_root(),
2375 git_head_short),
2376 '--prefix', 'systemd-@0@/'.format(git_head),
2377 'HEAD'])
2378endif
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002379
2380############################################################
2381
2382status = [
2383 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2384
2385 'prefix: @0@'.format(prefixdir),
2386 'rootprefix: @0@'.format(rootprefixdir),
2387 'sysconf dir: @0@'.format(sysconfdir),
2388 'includedir: @0@'.format(includedir),
2389 'lib dir: @0@'.format(libdir),
2390 'rootlib dir: @0@'.format(rootlibdir),
2391 'SysV init scripts: @0@'.format(sysvinit_path),
2392 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2393 'PAM modules dir: @0@'.format(pamlibdir),
2394 'PAM configuration dir: @0@'.format(pamconfdir),
2395 'RPM macros dir: @0@'.format(rpmmacrosdir),
2396 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2397 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2398 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2399 'bash completions dir: @0@'.format(bashcompletiondir),
2400 'zsh completions dir: @0@'.format(zshcompletiondir),
2401 'extra start script: @0@'.format(get_option('rc-local')),
2402 'extra stop script: @0@'.format(get_option('halt-local')),
2403 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2404 get_option('debug-tty')),
2405 'TTY GID: @0@'.format(tty_gid),
2406 'maximum system UID: @0@'.format(system_uid_max),
2407 'maximum system GID: @0@'.format(system_gid_max),
2408 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2409 'certificate root: @0@'.format(get_option('certificate-root')),
2410 'support URL: @0@'.format(support_url),
2411 'nobody user name: @0@'.format(get_option('nobody-user')),
2412 'nobody group name: @0@'.format(get_option('nobody-group')),
2413 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
Zbigniew Jędrzejewski-Szmek5248e7e2017-07-11 02:15:08 -04002414 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002415
2416 'default DNSSEC mode: @0@'.format(default_dnssec),
2417 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2418 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2419
2420alt_dns_servers = '\n '.join(dns_servers.split(' '))
2421alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2422status += [
2423 'default DNS servers: @0@'.format(alt_dns_servers),
2424 'default NTP servers: @0@'.format(alt_ntp_servers)]
2425
2426alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2427 '@@0@'.format(time_epoch)).stdout().strip()
2428status += [
2429 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2430
2431# TODO:
2432# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2433# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2434# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2435
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002436if conf.get('ENABLE_EFI', false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002437 status += [
2438 'efi arch: @0@'.format(efi_arch)]
2439
2440 if have_gnu_efi
2441 status += [
2442 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2443 'EFI CC @0@'.format(efi_cc),
2444 'EFI libdir: @0@'.format(efi_libdir),
2445 'EFI ldsdir: @0@'.format(efi_ldsdir),
2446 'EFI includedir: @0@'.format(efi_incdir)]
2447 endif
2448endif
2449
2450found = []
2451missing = []
2452
2453foreach tuple : [
2454 ['libcryptsetup'],
2455 ['PAM'],
2456 ['AUDIT'],
2457 ['IMA'],
2458 ['AppArmor'],
2459 ['SELinux'],
2460 ['SECCOMP'],
2461 ['SMACK'],
2462 ['zlib'],
2463 ['xz'],
2464 ['lz4'],
2465 ['bzip2'],
2466 ['ACL'],
2467 ['gcrypt'],
2468 ['qrencode'],
2469 ['microhttpd'],
2470 ['gnutls'],
2471 ['libcurl'],
Zbigniew Jędrzejewski-Szmekd1bf5672017-06-16 09:16:28 -04002472 ['idn'],
Zbigniew Jędrzejewski-Szmek87057e22017-05-09 21:56:34 -04002473 ['libidn2'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002474 ['libidn'],
Waldemar Brodkorbe7e11bb2017-06-24 19:30:26 +02002475 ['nss-systemd'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002476 ['libiptc'],
2477 ['elfutils'],
2478 ['binfmt'],
2479 ['vconsole'],
2480 ['quotacheck'],
2481 ['tmpfiles'],
2482 ['environment.d'],
2483 ['sysusers'],
2484 ['firstboot'],
2485 ['randomseed'],
2486 ['backlight'],
2487 ['rfkill'],
2488 ['logind'],
2489 ['machined'],
2490 ['importd'],
2491 ['hostnamed'],
2492 ['timedated'],
2493 ['timesyncd'],
2494 ['localed'],
2495 ['networkd'],
2496 ['resolved'],
2497 ['coredump'],
2498 ['polkit'],
2499 ['legacy pkla', install_polkit_pkla],
2500 ['efi'],
2501 ['gnu-efi', have_gnu_efi],
2502 ['kmod'],
2503 ['xkbcommon'],
2504 ['blkid'],
2505 ['dbus'],
2506 ['glib'],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002507 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002508 ['hwdb'],
2509 ['tpm'],
2510 ['man pages', want_man],
2511 ['html pages', want_html],
2512 ['man page indices', want_man and have_lxml],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002513 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002514 ['SysV compat'],
2515 ['utmp'],
2516 ['ldconfig'],
2517 ['hibernate'],
2518 ['adm group', get_option('adm-group')],
2519 ['wheel group', get_option('wheel-group')],
Franck Buib14e1b42017-05-09 14:02:37 +02002520 ['gshadow'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002521 ['debug hashmap'],
2522 ['debug mmap cache'],
2523]
2524
2525 cond = tuple.get(1, '')
2526 if cond == ''
2527 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2528 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002529 cond = conf.get(ident1, false) or conf.get(ident2, false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002530 endif
2531 if cond
2532 found += [tuple[0]]
2533 else
2534 missing += [tuple[0]]
2535 endif
2536endforeach
2537
2538status += [
Zbigniew Jędrzejewski-Szmek9d39c1b2017-07-26 14:14:44 -04002539 '',
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002540 'enabled features: @0@'.format(', '.join(found)),
Zbigniew Jędrzejewski-Szmek9d39c1b2017-07-26 14:14:44 -04002541 '',
2542 'disabled features: @0@'.format(', '.join(missing)),
2543 '']
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002544message('\n '.join(status))