blob: 14a20530d432a608632f0178c3b83ac548a28f24 [file] [log] [blame]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001project('systemd', 'c',
2 version : '233',
3 license : 'LGPLv2+',
4 default_options: [
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04005 'c_std=gnu99',
6 'prefix=/usr',
7 'sysconfdir=/etc',
8 'localstatedir=/var',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04009 ],
Zbigniew Jędrzejewski-Szmekd730e2d2017-04-25 08:49:58 -040010 meson_version : '>= 0.40',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040011 )
12
13# We need the same data in three different formats, ugh!
14# Also, for hysterical reasons, we use different variable
15# names, sometimes. Not all variables are included in every
16# set. Ugh, ugh, ugh!
17conf = configuration_data()
18conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
19conf.set_quoted('PACKAGE_VERSION', meson.project_version())
20
21substs = configuration_data()
22substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
23substs.set('PACKAGE_VERSION', meson.project_version())
24
25m4_defines = []
26
27#####################################################################
28
Zbigniew Jędrzejewski-Szmekab916f22017-04-13 22:15:01 -040029rootprefixdir = get_option('rootprefix')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040030if get_option('split-usr')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -040031 conf.set('HAVE_SPLIT_USR', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040032 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040033else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040034 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040035endif
36
37sysvinit_path = get_option('sysvinit-path')
38sysvrcnd_path = get_option('sysvrcnd-path')
39if sysvinit_path != '' or sysvrcnd_path != ''
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -040040 conf.set('HAVE_SYSV_COMPAT', true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040041 description : 'SysV init scripts and rcN.d links are supported')
42 m4_defines += ['-DHAVE_SYSV_COMPAT']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040043endif
44
45# join_paths ignore the preceding arguments if an absolute component is
46# encountered, so this should canonicalize various paths when they are
47# absolute or relative.
48prefixdir = get_option('prefix')
49if not prefixdir.startswith('/')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040050 error('Prefix is not absolute: "@0@"'.format(prefixdir))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040051endif
52bindir = join_paths(prefixdir, get_option('bindir'))
53libdir = join_paths(prefixdir, get_option('libdir'))
54sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
55includedir = join_paths(prefixdir, get_option('includedir'))
56datadir = join_paths(prefixdir, get_option('datadir'))
57localstatedir = join_paths('/', get_option('localstatedir'))
58
59rootbindir = join_paths(rootprefixdir, 'bin')
60rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
61
62rootlibdir = get_option('rootlibdir')
63if rootlibdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -040064 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040065endif
66
67# Dirs of external packages
Michael Bieble17e5ba2017-04-13 10:30:56 -040068pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
69pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
70polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
71polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
72polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
73varlogdir = join_paths(localstatedir, 'log')
74xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -040075rpmmacrosdir = get_option('rpmmacrosdir')
76
77# Our own paths
Michael Bieble17e5ba2017-04-13 10:30:56 -040078pkgdatadir = join_paths(datadir, 'systemd')
79environmentdir = join_paths(prefixdir, 'lib/environment.d')
80pkgsysconfdir = join_paths(sysconfdir, 'systemd')
81userunitdir = join_paths(prefixdir, 'lib/systemd/user')
82userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
83tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
84sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
85sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
86binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
87modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
88networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
89pkgincludedir = join_paths(includedir, 'systemd')
90systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
91usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
92systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
93userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
94systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
95systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
96systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
97systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
98udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
99udevhomedir = udevlibexecdir
100udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
101udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
102catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
103kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
104factorydir = join_paths(datadir, 'factory')
105docdir = join_paths(datadir, 'doc/systemd')
106bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
107testsdir = join_paths(prefixdir, 'lib/systemd/tests')
108systemdstatedir = join_paths(localstatedir, 'lib/systemd')
109catalogstatedir = join_paths(systemdstatedir, 'catalog')
110randomseeddir = join_paths(localstatedir, 'lib/systemd')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400111
112dbuspolicydir = get_option('dbuspolicydir')
113if dbuspolicydir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400114 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400115endif
116
117dbussessionservicedir = get_option('dbussessionservicedir')
118if dbussessionservicedir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400119 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400120endif
121
122dbussystemservicedir = get_option('dbussystemservicedir')
123if dbussystemservicedir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400124 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400125endif
126
127pamlibdir = get_option('pamlibdir')
128if pamlibdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400129 pamlibdir = join_paths(rootlibdir, 'security')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400130endif
131
132pamconfdir = get_option('pamconfdir')
133if pamconfdir == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400134 pamconfdir = join_paths(sysconfdir, 'pam.d')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400135endif
136
137conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400138conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400139conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
140conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
141conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400142conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
143conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400144conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400145conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
146conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400147conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
148conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
149conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
150conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
151conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
152conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
153conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
154conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
155conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400156conf.set_quoted('ROOTPREFIX', rootprefixdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400157conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400158conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
159conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400160conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
161conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
162conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
163conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
164conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
165conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400166conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
167conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400168conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400169conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400170conf.set_quoted('LIBDIR', libdir)
171conf.set_quoted('ROOTLIBDIR', rootlibdir)
172conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
173conf.set_quoted('BOOTLIBDIR', bootlibdir)
Michael Bieble17e5ba2017-04-13 10:30:56 -0400174conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
175conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
176conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
177conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
178conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
179conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400180
181conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
182conf.set_quoted('ABS_SRC_DIR', meson.source_root())
183
184substs.set('prefix', prefixdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400185substs.set('exec_prefix', prefixdir)
186substs.set('libdir', libdir)
187substs.set('rootlibdir', rootlibdir)
188substs.set('includedir', includedir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400189substs.set('pkgsysconfdir', pkgsysconfdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400190substs.set('bindir', bindir)
191substs.set('rootbindir', rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400192substs.set('rootlibexecdir', rootlibexecdir)
193substs.set('systemunitdir', systemunitdir)
194substs.set('userunitdir', userunitdir)
195substs.set('systempresetdir', systempresetdir)
196substs.set('userpresetdir', userpresetdir)
197substs.set('udevhwdbdir', udevhwdbdir)
198substs.set('udevrulesdir', udevrulesdir)
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400199substs.set('udevlibexecdir', udevlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400200substs.set('catalogdir', catalogdir)
201substs.set('tmpfilesdir', tmpfilesdir)
202substs.set('sysusersdir', sysusersdir)
203substs.set('sysctldir', sysctldir)
204substs.set('binfmtdir', binfmtdir)
205substs.set('modulesloaddir', modulesloaddir)
206substs.set('systemgeneratordir', systemgeneratordir)
207substs.set('usergeneratordir', usergeneratordir)
208substs.set('systemenvgeneratordir', systemenvgeneratordir)
209substs.set('userenvgeneratordir', userenvgeneratordir)
210substs.set('systemshutdowndir', systemshutdowndir)
211substs.set('systemsleepdir', systemsleepdir)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400212substs.set('VARLOGDIR', varlogdir)
213substs.set('CERTIFICATEROOT', get_option('certificate-root'))
Michael Bieble17e5ba2017-04-13 10:30:56 -0400214substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
215substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400216substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
217substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
218substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
219substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400220
221#####################################################################
222
223cc = meson.get_compiler('c')
224pkgconfig = import('pkgconfig')
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400225check_compilation_sh = find_program('tools/meson-check-compilation.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400226
227foreach arg : ['-Wundef',
228 '-Wlogical-op',
229 '-Wmissing-include-dirs',
230 '-Wold-style-definition',
231 '-Wpointer-arith',
232 '-Winit-self',
233 '-Wdeclaration-after-statement',
234 '-Wfloat-equal',
235 '-Wsuggest-attribute=noreturn',
236 '-Werror=missing-prototypes',
237 '-Werror=implicit-function-declaration',
238 '-Werror=missing-declarations',
239 '-Werror=return-type',
240 '-Werror=incompatible-pointer-types',
241 '-Werror=format=2',
242 '-Wstrict-prototypes',
243 '-Wredundant-decls',
244 '-Wmissing-noreturn',
245 '-Wshadow',
246 '-Wendif-labels',
247 '-Wstrict-aliasing=2',
248 '-Wwrite-strings',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400249 '-Werror=overflow',
250 '-Wdate-time',
251 '-Wnested-externs',
252 '-ffast-math',
253 '-fno-common',
254 '-fdiagnostics-show-option',
255 '-fno-strict-aliasing',
256 '-fvisibility=hidden',
257 '-fstack-protector',
258 '-fstack-protector-strong',
259 '-fPIE',
260 '--param=ssp-buffer-size=4',
261 ]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400262 if cc.has_argument(arg)
263 add_project_arguments(arg, language : 'c')
264 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400265endforeach
266
Zbigniew Jędrzejewski-Szmek2c5434a2017-04-27 10:05:41 -0400267# "negative" arguments: gcc on purpose does not return an error for "-Wno-"
268# arguments, just emits a warnings. So test for the "positive" version instead.
269foreach arg : ['unused-parameter',
270 'missing-field-initializers',
271 'unused-result',
272 'format-signedness']
273 if cc.has_argument('-W' + arg)
274 add_project_arguments('-Wno-' + arg, language : 'c')
275 endif
276endforeach
277
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400278if cc.compiles('
279 #include <time.h>
280 #include <inttypes.h>
281 typedef uint64_t usec_t;
282 usec_t now(clockid_t clock);
283 int main(void) {
284 struct timespec now;
285 return 0;
286 }
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400287', name : '-Werror=shadow with local shadowing')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400288 add_project_arguments('-Werror=shadow', language : 'c')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400289endif
290
291if cc.get_id() == 'clang'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400292 foreach arg : ['-Wno-typedef-redefinition',
293 '-Wno-gnu-variable-sized-type-not-at-end',
294 ]
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400295 if cc.has_argument(arg,
296 name : '@0@ is supported'.format(arg))
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400297 add_project_arguments(arg, language : 'c')
298 endif
299 endforeach
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400300endif
301
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400302link_test_c = files('tools/meson-link-test.c')
303
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400304# --as-needed and --no-undefined are provided by meson by default,
305# run mesonconf to see what is enabled
306foreach arg : ['-Wl,-z,relro',
307 '-Wl,-z,now',
308 '-pie',
309 '-Wl,-fuse-ld=gold',
310 ]
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400311
312 have = run_command(check_compilation_sh,
313 cc.cmd_array(), '-x', 'c', arg,
314 '-include', link_test_c).returncode() == 0
315 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
316 if have
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400317 add_project_link_arguments(arg, language : 'c')
318 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400319endforeach
320
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400321if get_option('buildtype') != 'debug'
322 foreach arg : ['-ffunction-sections',
323 '-fdata-sections']
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400324 if cc.has_argument(arg,
325 name : '@0@ is supported'.format(arg))
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400326 add_project_arguments(arg, language : 'c')
327 endif
328 endforeach
329
330 foreach arg : ['-Wl,--gc-sections']
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400331 have = run_command(check_compilation_sh,
332 cc.cmd_array(), '-x', 'c', arg,
333 '-include', link_test_c).returncode() == 0
334 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
335 if have
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400336 add_project_link_arguments(arg, language : 'c')
337 endif
338 endforeach
339endif
340
Zbigniew Jędrzejewski-Szmek9cc0e6e2017-04-11 10:25:34 -0400341cpp = ' '.join(cc.cmd_array()) + ' -E'
342
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400343#####################################################################
344# compilation result tests
345
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400346conf.set('_GNU_SOURCE', true)
347conf.set('__SANE_USERSPACE_TYPES__', true)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400348
349conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
350conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
351conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
352conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
353conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
354conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
355conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
356
357decl_headers = '''
358#include <uchar.h>
359#include <linux/ethtool.h>
360'''
361# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
362
363foreach decl : ['char16_t',
364 'char32_t',
365 'key_serial_t',
366 'struct ethtool_link_settings',
367 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400368
369 # We get -1 if the size cannot be determined
370 have = cc.sizeof(decl, prefix : decl_headers) > 0
371 conf.set('HAVE_' + decl.underscorify().to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400372endforeach
373
374foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
375 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
376 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
377 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
378 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
379 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
380 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
381 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
382 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
383 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
Susant Sahani9dfed8d2017-04-25 20:30:34 +0530384 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400385 # if_tunnel.h is buggy and cannot be included on its own
386 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
387 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
388 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
389 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
390 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
391 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
392 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
393 ['NDA_IFINDEX', 'linux/neighbour.h'],
394 ['IFA_FLAGS', 'linux/if_addr.h'],
395 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
396 ]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400397 prefix = decl.length() > 2 ? decl[2] : ''
398 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
399 conf.set10('HAVE_DECL_' + decl[0], have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400400endforeach
401
402skip = false
403foreach ident : ['secure_getenv', '__secure_getenv']
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400404 if not skip and cc.has_function(ident)
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400405 conf.set('HAVE_' + ident.to_upper(), true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400406 skip = true
407 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400408endforeach
409
410foreach ident : [
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400411 ['memfd_create', '''#include <sys/memfd.h>'''],
412 ['gettid', '''#include <sys/types.h>'''],
413 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
414 ['name_to_handle_at', '''#define _GNU_SOURCE
415 #include <sys/types.h>
416 #include <sys/stat.h>
417 #include <fcntl.h>'''],
418 ['setns', '''#define _GNU_SOURCE
419 #include <sched.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400420 ['renameat2', '''#include <stdio.h>'''],
421 ['kcmp', '''#include <linux/kcmp.h>'''],
422 ['keyctl', '''#include <sys/types.h>
423 #include <keyutils.h>'''],
424 ['copy_file_range', '''#include <sys/syscall.h>
425 #include <unistd.h>'''],
Zbigniew Jędrzejewski-Szmek38f1ae02017-04-19 16:14:16 -0400426 ['explicit_bzero' , '''#include <string.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400427]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400428
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400429 have = cc.has_function(ident[0], prefix : ident[1])
430 conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400431endforeach
432
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400433if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400434 conf.set('USE_SYS_RANDOM_H', true)
435 conf.set10('HAVE_DECL_GETRANDOM', true)
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400436else
437 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
438 conf.set10('HAVE_DECL_GETRANDOM', have)
439endif
440
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400441#####################################################################
442
443sed = find_program('sed')
444grep = find_program('grep')
445awk = find_program('awk')
Zbigniew Jędrzejewski-Szmekd730e2d2017-04-25 08:49:58 -0400446m4 = find_program('m4')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400447stat = find_program('stat')
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -0400448git = find_program('git', required : false)
449etags = find_program('etags', required : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400450
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -0400451meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400452mkdir_p = 'mkdir -p $DESTDIR/@0@'
Zbigniew Jędrzejewski-Szmekd83f4f52017-04-16 12:04:46 -0400453test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
454splash_bmp = files('test/splash.bmp')
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400455
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400456# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
457# /usr/sbin, /sbin, and fall back to the default from middle column.
458progs = [['telinit', '/lib/sysvinit/telinit'],
459 ['quotaon', '/usr/sbin/quotaon' ],
460 ['quotacheck', '/usr/sbin/quotacheck' ],
461 ['kill', '/usr/bin/kill' ],
462 ['kmod', '/usr/bin/kmod' ],
463 ['kexec', '/usr/sbin/kexec' ],
464 ['sulogin', '/usr/sbin/sulogin' ],
465 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
466 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
467 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
468 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
469 ]
470foreach prog : progs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400471 path = get_option(prog[0] + '-path')
472 if path != ''
473 message('Using @1@ for @0@'.format(prog[0], path))
474 else
475 exe = find_program(prog[0],
476 '/usr/sbin/' + prog[0],
477 '/sbin/' + prog[0],
478 required: false)
479 path = exe.found() ? exe.path() : prog[1]
480 endif
481 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
482 conf.set_quoted(name, path)
483 substs.set(name, path)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400484endforeach
485
Zbigniew Jędrzejewski-Szmek1276a9f2017-04-18 19:11:54 -0400486if run_command('ln', '--relative', '--help').returncode() != 0
487 error('ln does not support --relative')
488endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400489
490############################################################
491
492gperf = find_program('gperf')
493
494gperf_test_format = '''
495#include <string.h>
496const char * in_word_set(const char *, @0@);
497@1@
498'''
499gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
500gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
501gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
502if cc.compiles(gperf_test)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400503 gperf_len_type = 'size_t'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400504else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400505 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
506 if cc.compiles(gperf_test)
507 gperf_len_type = 'unsigned'
508 else
509 error('unable to determine gperf len type')
510 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400511endif
512message('gperf len type is @0@'.format(gperf_len_type))
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400513conf.set('GPERF_LEN_TYPE', gperf_len_type,
514 description : 'The type of gperf "len" parameter')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400515
516############################################################
517
518if not cc.has_header('sys/capability.h')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400519 error('POSIX caps headers not found')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400520endif
521foreach header : ['linux/btrfs.h',
522 'linux/memfd.h',
523 'linux/vm_sockets.h',
524 'valgrind/memcheck.h',
525 'valgrind/valgrind.h',
526 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400527
528 conf.set('HAVE_' + header.underscorify().to_upper(),
529 cc.has_header(header))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400530endforeach
531
532############################################################
533
534conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
535
536default_hierarchy = get_option('default-hierarchy')
537conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
538 description : 'default cgroup hierarchy as string')
539if default_hierarchy == 'legacy'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400540 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400541elif default_hierarchy == 'hybrid'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400542 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400543else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400544 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400545endif
546
547time_epoch = get_option('time-epoch')
548if time_epoch == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400549 NEWS = files('NEWS')
550 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400551endif
552time_epoch = time_epoch.to_int()
553conf.set('TIME_EPOCH', time_epoch)
554
555system_uid_max = get_option('system-uid-max')
556if system_uid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400557 system_uid_max = run_command(
558 awk,
559 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
560 '/etc/login.defs').stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400561endif
562system_uid_max = system_uid_max.to_int()
563conf.set('SYSTEM_UID_MAX', system_uid_max)
564substs.set('systemuidmax', system_uid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400565message('maximum system UID is @0@'.format(system_uid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400566
567conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
568conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
569
570system_gid_max = get_option('system-gid-max')
571if system_gid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400572 system_gid_max = run_command(
573 awk,
574 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
575 '/etc/login.defs').stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400576endif
577system_gid_max = system_gid_max.to_int()
578conf.set('SYSTEM_GID_MAX', system_gid_max)
579substs.set('systemgidmax', system_gid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400580message('maximum system GID is @0@'.format(system_gid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400581
582tty_gid = get_option('tty-gid')
583conf.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400584substs.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400585
586if get_option('adm-group')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400587 m4_defines += ['-DENABLE_ADM_GROUP']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400588endif
589
590if get_option('wheel-group')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400591 m4_defines += ['-DENABLE_WHEEL_GROUP']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400592endif
593
594substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
595
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400596kill_user_processes = get_option('default-kill-user-processes')
597conf.set10('KILL_USER_PROCESSES', kill_user_processes)
598substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400599
600default_dnssec = get_option('default-dnssec')
601conf.set('DEFAULT_DNSSEC_MODE',
602 'DNSSEC_' + default_dnssec.underscorify().to_upper())
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400603substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400604
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400605dns_servers = get_option('dns-servers')
606conf.set_quoted('DNS_SERVERS', dns_servers)
607substs.set('DNS_SERVERS', dns_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400608
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400609ntp_servers = get_option('ntp-servers')
610conf.set_quoted('NTP_SERVERS', ntp_servers)
611substs.set('NTP_SERVERS', ntp_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400612
613conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
614
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400615substs.set('SUSHELL', get_option('debug-shell'))
616substs.set('DEBUGTTY', get_option('debug-tty'))
617
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400618debug = get_option('debug')
619if debug != ''
620 foreach name : debug.split(',')
621 if name == 'hashmap'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400622 conf.set('ENABLE_DEBUG_HASHMAP', true)
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400623 elif name == 'mmap-cache'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400624 conf.set('ENABLE_DEBUG_MMAP_CACHE', true)
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400625 else
626 message('unknown debug option "@0@", ignoring'.format(name))
627 endif
628 endforeach
629endif
630
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400631#####################################################################
632
633threads = dependency('threads')
634librt = cc.find_library('rt')
635libm = cc.find_library('m')
636libdl = cc.find_library('dl')
637libcrypt = cc.find_library('crypt')
638
Zbigniew Jędrzejewski-Szmek1800cc82017-04-27 01:30:30 -0400639libcap = dependency('libcap', required : false)
640if not libcap.found()
641 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
642 libcap = cc.find_library('cap')
643endif
644
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400645libmount = dependency('mount',
646 version : '>= 2.27')
647
648want_seccomp = get_option('seccomp')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400649if want_seccomp != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400650 libseccomp = dependency('libseccomp',
Zbigniew Jędrzejewski-Szmek9f0e9c02017-04-27 10:05:18 -0400651 version : '>= 2.3.1',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400652 required : want_seccomp == 'true')
653 if libseccomp.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400654 conf.set('HAVE_SECCOMP', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400655 m4_defines += ['-DHAVE_SECCOMP']
656 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400657else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400658 libseccomp = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400659endif
660
661want_selinux = get_option('selinux')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400662if want_selinux != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400663 libselinux = dependency('libselinux',
664 version : '>= 2.1.9',
665 required : want_selinux == 'true')
666 if libselinux.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400667 conf.set('HAVE_SELINUX', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400668 m4_defines += ['-DHAVE_SELINUX']
669 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400670else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400671 libselinux = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400672endif
673
674want_apparmor = get_option('apparmor')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400675if want_apparmor != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400676 libapparmor = dependency('libapparmor',
677 required : want_apparmor == 'true')
678 if libapparmor.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400679 conf.set('HAVE_APPARMOR', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400680 m4_defines += ['-DHAVE_APPARMOR']
681 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400682else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400683 libapparmor = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400684endif
685
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400686smack_run_label = get_option('smack-run-label')
687if smack_run_label != ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400688 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
689 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400690endif
691
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400692want_polkit = get_option('polkit')
693install_polkit = false
694install_polkit_pkla = false
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400695if want_polkit != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400696 conf.set('ENABLE_POLKIT', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400697 install_polkit = true
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400698
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400699 libpolkit = dependency('polkit-gobject-1',
700 required : false)
701 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
702 message('Old polkit detected, will install pkla files')
703 install_polkit_pkla = true
704 endif
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400705endif
706
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400707want_acl = get_option('acl')
708if want_acl != 'false'
709 libacl = cc.find_library('acl', required : want_acl == 'true')
710 if libacl.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400711 conf.set('HAVE_ACL', true)
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400712 m4_defines += ['-DHAVE_ACL']
713 endif
714else
715 libacl = []
716endif
717
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400718want_audit = get_option('audit')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400719if want_audit != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400720 libaudit = dependency('audit', required : want_audit == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400721 conf.set('HAVE_AUDIT', libaudit.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400722else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400723 libaudit = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400724endif
725
726want_blkid = get_option('blkid')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400727if want_blkid != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400728 libblkid = dependency('blkid', required : want_blkid == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400729 conf.set('HAVE_BLKID', libblkid.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400730else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400731 libblkid = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400732endif
733
734want_kmod = get_option('kmod')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400735if want_kmod != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400736 libkmod = dependency('libkmod',
737 version : '>= 15',
738 required : want_kmod == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400739 conf.set('HAVE_KMOD', libkmod.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400740else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400741 libkmod = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400742endif
743
744want_pam = get_option('pam')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400745if want_pam != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400746 libpam = cc.find_library('pam', required : want_pam == 'true')
747 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
748 if libpam.found() and libpam_misc.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400749 conf.set('HAVE_PAM', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400750 m4_defines += ['-DHAVE_PAM']
751 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400752else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400753 libpam = []
754 libpam_misc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400755endif
756
757want_microhttpd = get_option('microhttpd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400758if want_microhttpd != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400759 libmicrohttpd = dependency('libmicrohttpd',
760 version : '>= 0.9.33',
761 required : want_microhttpd == 'true')
762 if libmicrohttpd.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400763 conf.set('HAVE_MICROHTTPD', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400764 m4_defines += ['-DHAVE_MICROHTTPD']
765 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400766else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400767 libmicrohttpd = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400768endif
769
770want_libcryptsetup = get_option('libcryptsetup')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400771if want_libcryptsetup != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400772 libcryptsetup = dependency('libcryptsetup',
773 version : '>= 1.6.0',
774 required : want_libcryptsetup == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400775 conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400776else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400777 libcryptsetup = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400778endif
779
780want_libcurl = get_option('libcurl')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400781if want_libcurl != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400782 libcurl = dependency('libcurl',
783 version : '>= 7.32.0',
784 required : want_libcurl == 'true')
785 if libcurl.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400786 conf.set('HAVE_LIBCURL', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400787 m4_defines += ['-DHAVE_LIBCURL']
788 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400789else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400790 libcurl = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400791endif
792
793want_libidn = get_option('libidn')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400794if want_libidn != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400795 libidn = dependency('libidn',
796 required : want_libidn == 'true')
797 if libidn.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400798 conf.set('HAVE_LIBIDN', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400799 m4_defines += ['-DHAVE_LIBIDN']
800 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400801else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400802 libidn = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400803endif
804
805want_libiptc = get_option('libiptc')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400806if want_libiptc != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400807 libiptc = dependency('libiptc',
808 required : want_libiptc == 'true')
809 if libiptc.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400810 conf.set('HAVE_LIBIPTC', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400811 m4_defines += ['-DHAVE_LIBIPTC']
812 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400813else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400814 libiptc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400815endif
816
817want_qrencode = get_option('qrencode')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400818if want_qrencode != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400819 libqrencode = dependency('libqrencode',
820 required : want_qrencode == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400821 conf.set('HAVE_QRENCODE', libqrencode.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400822else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400823 libqrencode = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400824endif
825
826want_gnutls = get_option('gnutls')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400827if want_gnutls != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400828 libgnutls = dependency('gnutls',
829 version : '>= 3.1.4',
830 required : want_gnutls == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400831 conf.set('HAVE_GNUTLS', libgnutls.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400832else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400833 libgnutls = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400834endif
835
836want_elfutils = get_option('elfutils')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400837if want_elfutils != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400838 libdw = dependency('libdw',
839 required : want_elfutils == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400840 conf.set('HAVE_ELFUTILS', libdw.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400841else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400842 libdw = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400843endif
844
845want_zlib = get_option('zlib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400846if want_zlib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400847 libz = dependency('zlib',
848 required : want_zlib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400849 conf.set('HAVE_ZLIB', libz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400850else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400851 libz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400852endif
853
854want_bzip2 = get_option('bzip2')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400855if want_bzip2 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400856 libbzip2 = cc.find_library('bz2',
857 required : want_bzip2 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400858 conf.set('HAVE_BZIP2', libbzip2.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400859else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400860 libbzip2 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400861endif
862
863want_xz = get_option('xz')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400864if want_xz != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400865 libxz = dependency('liblzma',
866 required : want_xz == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400867 conf.set('HAVE_XZ', libxz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400868else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400869 libxz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400870endif
871
872want_lz4 = get_option('lz4')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400873if want_lz4 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400874 liblz4 = dependency('liblz4',
875 required : want_lz4 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400876 conf.set('HAVE_LZ4', liblz4.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400877else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400878 liblz4 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400879endif
880
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400881want_glib = get_option('glib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400882if want_glib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400883 libglib = dependency('glib-2.0',
884 version : '>= 2.22.0',
885 required : want_glib == 'true')
886 libgobject = dependency('gobject-2.0',
887 version : '>= 2.22.0',
888 required : want_glib == 'true')
889 libgio = dependency('gio-2.0',
890 required : want_glib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400891 have = libglib.found() and libgobject.found() and libgio.found()
892 conf.set('HAVE_GLIB', have)
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400893else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400894 libglib = []
895 libgobject = []
896 libgio = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400897endif
898
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400899want_xkbcommon = get_option('xkbcommon')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400900if want_xkbcommon != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400901 libxkbcommon = dependency('xkbcommon',
902 version : '>= 0.3.0',
903 required : want_xkbcommon == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400904 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400905else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400906 libxkbcommon = []
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400907endif
908
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400909want_dbus = get_option('dbus')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400910if want_dbus != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400911 libdbus = dependency('dbus-1',
912 version : '>= 1.3.2',
913 required : want_dbus == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400914 conf.set('HAVE_DBUS', libdbus.found())
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400915else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400916 libdbus = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400917endif
918
Michael Biebl76c87412017-04-21 23:45:54 +0200919want_gcrypt = get_option('gcrypt')
920if want_gcrypt != 'false'
921 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
922 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
923
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400924 have_deps = libgcrypt.found() and libgpg_error.found()
925 conf.set('HAVE_GCRYPT', have_deps)
926 if not have_deps
Michael Biebl76c87412017-04-21 23:45:54 +0200927 # link to neither of the libs if one is not found
928 libgcrypt = []
929 libgpg_error = []
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400930 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400931else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400932 libgcrypt = []
Michael Biebl76c87412017-04-21 23:45:54 +0200933 libgpg_error = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400934endif
935
936want_importd = get_option('importd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400937if want_importd != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400938 have_deps = (conf.get('HAVE_LIBCURL', false) and
939 conf.get('HAVE_ZLIB', false) and
940 conf.get('HAVE_BZIP2', false) and
941 conf.get('HAVE_XZ', false) and
942 conf.get('HAVE_GCRYPT', false))
943 conf.set('ENABLE_IMPORTD', have_deps)
944 if want_importd == 'true' and not have_deps
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400945 error('importd support was requested, but dependencies are not available')
946 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400947endif
948
949want_remote = get_option('remote')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400950if want_remote != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400951 have_deps = [conf.get('HAVE_MICROHTTPD', false),
952 conf.get('HAVE_LIBCURL', false)]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400953 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
954 # it's possible to build one without the other. Complain only if
955 # support was explictly requested. The auxiliary files like sysusers
956 # config should be installed when any of the programs are built.
957 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
958 error('remote support was requested, but dependencies are not available')
959 endif
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400960 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400961endif
962
963foreach pair : [['utmp', 'HAVE_UTMP'],
964 ['hibernate', 'ENABLE_HIBERNATE'],
965 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
966 ['binfmt', 'ENABLE_BINFMT'],
967 ['coredump', 'ENABLE_COREDUMP'],
968 ['resolve', 'ENABLE_RESOLVED'],
969 ['logind', 'ENABLE_LOGIND'],
970 ['hostnamed', 'ENABLE_HOSTNAMED'],
971 ['localed', 'ENABLE_LOCALED'],
972 ['machined', 'ENABLE_MACHINED'],
973 ['networkd', 'ENABLE_NETWORKD'],
974 ['timedated', 'ENABLE_TIMEDATED'],
975 ['timesyncd', 'ENABLE_TIMESYNCD'],
976 ['myhostname', 'HAVE_MYHOSTNAME'],
977 ['firstboot', 'ENABLE_FIRSTBOOT'],
978 ['randomseed', 'ENABLE_RANDOMSEED'],
979 ['backlight', 'ENABLE_BACKLIGHT'],
980 ['vconsole', 'ENABLE_VCONSOLE'],
981 ['quotacheck', 'ENABLE_QUOTACHECK'],
982 ['sysusers', 'ENABLE_SYSUSERS'],
983 ['tmpfiles', 'ENABLE_TMPFILES'],
984 ['hwdb', 'ENABLE_HWDB'],
985 ['rfkill', 'ENABLE_RFKILL'],
986 ['ldconfig', 'ENABLE_LDCONFIG'],
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -0400987 ['efi', 'ENABLE_EFI'],
Zbigniew Jędrzejewski-Szmek80c6fce2017-04-24 19:28:04 -0400988 ['tpm', 'SD_BOOT_LOG_TPM'],
Zbigniew Jędrzejewski-Szmek2895c8e2017-04-13 19:45:05 -0400989 ['ima', 'HAVE_IMA'],
Zbigniew Jędrzejewski-Szmek5464ec82017-04-24 19:28:04 -0400990 ['smack', 'HAVE_SMACK'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400991 ]
992
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400993 if get_option(pair[0])
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400994 conf.set(pair[1], true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400995 m4_defines += ['-D' + pair[1]]
996 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400997endforeach
998
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400999want_tests = get_option('tests')
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04001000install_tests = get_option('install-tests')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001001tests = []
1002
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001003#####################################################################
1004
1005if get_option('efi')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001006 efi_arch = host_machine.cpu_family()
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001007
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001008 if efi_arch == 'x86'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001009 EFI_MACHINE_TYPE_NAME = 'ia32'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001010 gnu_efi_arch = 'ia32'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001011 elif efi_arch == 'x86_64'
1012 EFI_MACHINE_TYPE_NAME = 'x64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001013 gnu_efi_arch = 'x86_64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001014 elif efi_arch == 'arm'
1015 EFI_MACHINE_TYPE_NAME = 'arm'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001016 gnu_efi_arch = 'arm'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001017 elif efi_arch == 'aarch64'
1018 EFI_MACHINE_TYPE_NAME = 'aa64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001019 gnu_efi_arch = 'aarch64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001020 else
1021 EFI_MACHINE_TYPE_NAME = ''
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001022 gnu_efi_arch = ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001023 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001024
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001025 conf.set('ENABLE_EFI', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001026 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
Zbigniew Jędrzejewski-Szmek80c6fce2017-04-24 19:28:04 -04001027
1028 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001029endif
1030
1031#####################################################################
1032
1033config_h = configure_file(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001034 output : 'config.h',
1035 configuration : conf)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001036
1037includes = include_directories('src/basic',
1038 'src/shared',
1039 'src/systemd',
1040 'src/journal',
1041 'src/resolve',
1042 'src/timesync',
1043 'src/login',
1044 'src/udev',
1045 'src/libudev',
1046 'src/core',
1047 'src/libsystemd/sd-bus',
1048 'src/libsystemd/sd-device',
1049 'src/libsystemd/sd-hwdb',
1050 'src/libsystemd/sd-id128',
1051 'src/libsystemd/sd-netlink',
1052 'src/libsystemd/sd-network',
1053 'src/libsystemd-network',
1054 )
1055
1056add_project_arguments('-include', 'config.h', language : 'c')
1057
1058gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1059 'src/shared/gcrypt-util.c')
1060
1061subdir('po')
1062subdir('catalog')
1063subdir('src/systemd')
1064subdir('src/basic')
1065subdir('src/libsystemd')
1066subdir('src/libsystemd-network')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001067subdir('src/journal')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001068subdir('src/login')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001069
1070libjournal_core = static_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001071 'journal-core',
1072 libjournal_core_sources,
1073 journald_gperf_c,
1074 include_directories : includes,
1075 install : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001076
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04001077libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001078libsystemd = shared_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001079 'systemd',
1080 libsystemd_internal_sources,
1081 journal_internal_sources,
1082 version : '0.18.0',
1083 include_directories : includes,
1084 link_args : ['-shared',
1085 '-Wl,--version-script=' + libsystemd_sym_path],
1086 link_with : [libbasic],
1087 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001088 libgcrypt,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001089 librt,
1090 libxz,
1091 liblz4],
1092 link_depends : libsystemd_sym,
1093 install : true,
1094 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001095
1096############################################################
1097
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001098# binaries that have --help and are intended for use by humans,
1099# usually, but not always, installed in /bin.
1100public_programs = []
1101
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001102subdir('src/libudev')
1103subdir('src/shared')
1104subdir('src/core')
1105subdir('src/udev')
1106subdir('src/network')
1107
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001108subdir('src/analyze')
1109subdir('src/journal-remote')
1110subdir('src/coredump')
1111subdir('src/hostname')
1112subdir('src/import')
1113subdir('src/kernel-install')
1114subdir('src/locale')
1115subdir('src/machine')
1116subdir('src/nspawn')
1117subdir('src/resolve')
1118subdir('src/timedate')
1119subdir('src/timesync')
1120subdir('src/vconsole')
Zbigniew Jędrzejewski-Szmek4e4ab1c2017-04-10 12:37:52 -04001121subdir('src/sulogin-shell')
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001122subdir('src/boot/efi')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001123
1124subdir('src/test')
Zbigniew Jędrzejewski-Szmek4ff3f252017-04-13 20:47:20 -04001125subdir('test')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001126
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001127############################################################
1128
1129# only static linking apart from libdl, to make sure that the
1130# module is linked to all libraries that it uses.
1131test_dlopen = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001132 'test-dlopen',
1133 test_dlopen_c,
1134 include_directories : includes,
1135 link_with : [libbasic],
1136 dependencies : [libdl])
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001137
1138foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME', []],
1139 ['systemd', '', []],
1140 ['mymachines', 'ENABLE_MACHINED', []],
1141 ['resolve', 'ENABLE_RESOLVED', [libdl]]]
1142
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001143 condition = tuple[1] == '' or conf.get(tuple[1], false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001144 if condition
1145 module = tuple[0]
1146 extra_deps = tuple[2]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001147
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001148 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1149 version_script_arg = join_paths(meson.current_source_dir(), sym)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001150
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001151 nss = shared_library(
1152 'nss_' + module,
1153 'src/nss-@0@/nss-@0@.c'.format(module),
1154 version : '2',
1155 include_directories : includes,
1156 link_args : ['-shared',
1157 '-Wl,--version-script=' + version_script_arg,
1158 '-Wl,--undefined'],
1159 link_with : [libsystemd_internal,
1160 libbasic],
1161 dependencies : [threads,
1162 librt] + extra_deps,
1163 link_depends : sym,
1164 install : true,
1165 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001166
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001167 # We cannot use shared_module because it does not support version suffix.
1168 # Unfortunately shared_library insists on creating the symlink…
1169 meson.add_install_script('sh', '-c',
1170 'rm $DESTDIR@0@/libnss_@1@.so'
1171 .format(rootlibdir, module))
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001172
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001173 test('dlopen-nss_' + module,
1174 test_dlopen,
1175 args : [nss.full_path()]) # path to dlopen must include a slash
1176 endif
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001177endforeach
1178
1179############################################################
1180
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001181executable('systemd',
1182 systemd_sources,
1183 include_directories : includes,
1184 link_with : [libcore,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001185 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001186 dependencies : [threads,
1187 librt,
1188 libseccomp,
1189 libselinux,
Zbigniew Jędrzejewski-Szmekf4ee10a2017-04-09 14:08:53 -04001190 libmount,
1191 libblkid],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001192 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001193 install : true,
1194 install_dir : rootlibexecdir)
1195
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001196exe = executable('systemd-analyze',
1197 systemd_analyze_sources,
1198 include_directories : includes,
1199 link_with : [libcore,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001200 libshared],
1201 dependencies : [threads,
1202 librt,
1203 libseccomp,
1204 libselinux,
1205 libmount,
1206 libblkid],
1207 install_rpath : rootlibexecdir,
1208 install : true)
1209public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001210
1211executable('systemd-journald',
1212 systemd_journald_sources,
1213 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001214 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001215 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001216 dependencies : [threads,
1217 libxz,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001218 liblz4,
1219 libselinux],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001220 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001221 install : true,
1222 install_dir : rootlibexecdir)
1223
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001224exe = executable('systemd-cat',
1225 systemd_cat_sources,
1226 include_directories : includes,
1227 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001228 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001229 dependencies : [threads],
1230 install_rpath : rootlibexecdir,
1231 install : true)
1232public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001233
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001234exe = executable('journalctl',
1235 journalctl_sources,
1236 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001237 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001238 dependencies : [threads,
1239 libqrencode,
1240 libxz,
1241 liblz4],
1242 install_rpath : rootlibexecdir,
1243 install : true,
1244 install_dir : rootbindir)
1245public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001246
1247executable('systemd-getty-generator',
1248 'src/getty-generator/getty-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001249 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001250 link_with : [libshared],
1251 install_rpath : rootlibexecdir,
1252 install : true,
1253 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001254
1255executable('systemd-debug-generator',
1256 'src/debug-generator/debug-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001257 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001258 link_with : [libshared],
1259 install_rpath : rootlibexecdir,
1260 install : true,
1261 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001262
1263executable('systemd-fstab-generator',
1264 'src/fstab-generator/fstab-generator.c',
1265 'src/core/mount-setup.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001266 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001267 link_with : [libshared],
1268 install_rpath : rootlibexecdir,
1269 install : true,
1270 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001271
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001272if conf.get('ENABLE_ENVIRONMENT_D', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001273 executable('30-systemd-environment-d-generator',
1274 'src/environment-d-generator/environment-d-generator.c',
1275 include_directories : includes,
1276 link_with : [libshared],
1277 install_rpath : rootlibexecdir,
1278 install : true,
1279 install_dir : userenvgeneratordir)
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001280
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001281 meson.add_install_script(meson_make_symlink,
1282 join_paths(sysconfdir, 'environment'),
1283 join_paths(environmentdir, '99-environment.conf'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001284endif
1285
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001286if conf.get('ENABLE_HIBERNATE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001287 executable('systemd-hibernate-resume-generator',
1288 'src/hibernate-resume/hibernate-resume-generator.c',
1289 include_directories : includes,
1290 link_with : [libshared],
1291 install_rpath : rootlibexecdir,
1292 install : true,
1293 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001294
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001295 executable('systemd-hibernate-resume',
1296 'src/hibernate-resume/hibernate-resume.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001297 include_directories : includes,
1298 link_with : [libshared],
1299 install_rpath : rootlibexecdir,
1300 install : true,
1301 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001302endif
1303
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001304if conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001305 executable('systemd-gpt-auto-generator',
1306 'src/gpt-auto-generator/gpt-auto-generator.c',
1307 'src/basic/blkid-util.h',
1308 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001309 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001310 dependencies : libblkid,
1311 install_rpath : rootlibexecdir,
1312 install : true,
1313 install_dir : systemgeneratordir)
1314
1315 exe = executable('systemd-dissect',
1316 'src/dissect/dissect.c',
1317 include_directories : includes,
1318 link_with : [libshared],
1319 install_rpath : rootlibexecdir,
1320 install : true,
1321 install_dir : rootlibexecdir)
1322 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001323endif
1324
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001325if conf.get('ENABLE_RESOLVED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001326 executable('systemd-resolved',
1327 systemd_resolved_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001328 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001329 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001330 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001331 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001332 libgcrypt,
1333 libgpg_error,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001334 libm,
1335 libidn],
1336 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001337 install : true,
1338 install_dir : rootlibexecdir)
1339
1340 exe = executable('systemd-resolve',
1341 systemd_resolve_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001342 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001343 include_directories : includes,
1344 link_with : [libshared],
1345 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001346 libgcrypt,
1347 libgpg_error,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001348 libm,
1349 libidn],
1350 install_rpath : rootlibexecdir,
1351 install : true)
1352 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001353endif
1354
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001355if conf.get('ENABLE_LOGIND', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001356 executable('systemd-logind',
1357 systemd_logind_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001358 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001359 link_with : [liblogind_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001360 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001361 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001362 libacl],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001363 install_rpath : rootlibexecdir,
1364 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001365 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001366
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001367 exe = executable('loginctl',
1368 loginctl_sources,
1369 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001370 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001371 dependencies : [threads,
1372 liblz4,
1373 libxz],
1374 install_rpath : rootlibexecdir,
1375 install : true,
1376 install_dir : rootbindir)
1377 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001378
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001379 exe = executable('systemd-inhibit',
1380 'src/login/inhibit.c',
1381 include_directories : includes,
1382 link_with : [libshared],
1383 install_rpath : rootlibexecdir,
1384 install : true,
1385 install_dir : rootbindir)
1386 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001387
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001388 if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001389 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1390 pam_systemd = shared_library(
1391 'pam_systemd',
1392 pam_systemd_c,
1393 name_prefix : '',
1394 include_directories : includes,
1395 link_args : ['-shared',
1396 '-Wl,--version-script=' + version_script_arg],
1397 link_with : [libsystemd_internal,
1398 libshared_static],
1399 dependencies : [threads,
1400 libpam,
1401 libpam_misc],
1402 link_depends : pam_systemd_sym,
1403 install : true,
1404 install_dir : pamlibdir)
1405
1406 test('dlopen-pam_systemd',
1407 test_dlopen,
1408 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1409 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001410endif
1411
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001412if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001413 executable('systemd-user-sessions',
1414 'src/user-sessions/user-sessions.c',
1415 include_directories : includes,
1416 link_with : [libshared],
1417 install_rpath : rootlibexecdir,
1418 install : true,
1419 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001420endif
1421
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001422if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001423 exe = executable('bootctl',
1424 'src/boot/bootctl.c',
1425 include_directories : includes,
1426 link_with : [libshared],
1427 dependencies : [libblkid],
1428 install_rpath : rootlibexecdir,
1429 install : true)
1430 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001431endif
1432
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001433exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1434 include_directories : includes,
1435 link_with : [libshared],
1436 dependencies : [threads],
1437 install_rpath : rootlibexecdir,
1438 install : true)
1439public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001440
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001441exe = executable('systemctl', 'src/systemctl/systemctl.c',
1442 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001443 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001444 dependencies : [threads,
1445 libcap,
1446 libselinux,
1447 libxz,
1448 liblz4],
1449 install_rpath : rootlibexecdir,
1450 install : true,
1451 install_dir : rootbindir)
1452public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001453
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001454if conf.get('ENABLE_BACKLIGHT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001455 executable('systemd-backlight',
1456 'src/backlight/backlight.c',
1457 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001458 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001459 install_rpath : rootlibexecdir,
1460 install : true,
1461 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001462endif
1463
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001464if conf.get('ENABLE_RFKILL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001465 executable('systemd-rfkill',
1466 'src/rfkill/rfkill.c',
1467 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001468 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001469 install_rpath : rootlibexecdir,
1470 install : true,
1471 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001472endif
1473
1474executable('systemd-system-update-generator',
1475 'src/system-update-generator/system-update-generator.c',
1476 include_directories : includes,
1477 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001478 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001479 install : true,
1480 install_dir : systemgeneratordir)
1481
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001482if conf.get('HAVE_LIBCRYPTSETUP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001483 executable('systemd-cryptsetup',
1484 'src/cryptsetup/cryptsetup.c',
1485 include_directories : includes,
1486 link_with : [libshared],
1487 dependencies : [libcryptsetup],
1488 install_rpath : rootlibexecdir,
1489 install : true,
1490 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001491
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001492 executable('systemd-cryptsetup-generator',
1493 'src/cryptsetup/cryptsetup-generator.c',
1494 include_directories : includes,
1495 link_with : [libshared],
1496 dependencies : [libcryptsetup],
1497 install_rpath : rootlibexecdir,
1498 install : true,
1499 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001500
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001501 executable('systemd-veritysetup',
1502 'src/veritysetup/veritysetup.c',
1503 include_directories : includes,
1504 link_with : [libshared],
1505 dependencies : [libcryptsetup],
1506 install_rpath : rootlibexecdir,
1507 install : true,
1508 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001509
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001510 executable('systemd-veritysetup-generator',
1511 'src/veritysetup/veritysetup-generator.c',
1512 include_directories : includes,
1513 link_with : [libshared],
1514 dependencies : [libcryptsetup],
1515 install_rpath : rootlibexecdir,
1516 install : true,
1517 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001518endif
1519
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001520if conf.get('HAVE_SYSV_COMPAT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001521 executable('systemd-sysv-generator',
1522 'src/sysv-generator/sysv-generator.c',
1523 include_directories : includes,
1524 link_with : [libshared],
1525 install_rpath : rootlibexecdir,
1526 install : true,
1527 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001528
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001529 executable('systemd-rc-local-generator',
1530 'src/rc-local-generator/rc-local-generator.c',
1531 include_directories : includes,
1532 link_with : [libshared],
1533 install_rpath : rootlibexecdir,
1534 install : true,
1535 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001536endif
1537
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001538if conf.get('ENABLE_HOSTNAMED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001539 executable('systemd-hostnamed',
1540 'src/hostname/hostnamed.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001541 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001542 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001543 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001544 install : true,
1545 install_dir : rootlibexecdir)
1546
1547 exe = executable('hostnamectl',
1548 'src/hostname/hostnamectl.c',
1549 include_directories : includes,
1550 link_with : [libshared],
1551 install_rpath : rootlibexecdir,
1552 install : true)
1553 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001554endif
1555
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001556if conf.get('ENABLE_LOCALED', false)
1557 if conf.get('HAVE_XKBCOMMON', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001558 # logind will load libxkbcommon.so dynamically on its own
1559 deps = [libdl]
1560 else
1561 deps = []
1562 endif
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -04001563
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001564 executable('systemd-localed',
1565 systemd_localed_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001566 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001567 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001568 dependencies : deps,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001569 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001570 install : true,
1571 install_dir : rootlibexecdir)
1572
1573 exe = executable('localectl',
1574 localectl_sources,
1575 include_directories : includes,
1576 link_with : [libshared],
1577 install_rpath : rootlibexecdir,
1578 install : true)
1579 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001580endif
1581
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001582if conf.get('ENABLE_TIMEDATED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001583 executable('systemd-timedated',
1584 'src/timedate/timedated.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001585 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001586 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001587 install_rpath : rootlibexecdir,
1588 install : true,
1589 install_dir : rootlibexecdir)
1590
1591 exe = executable('timedatectl',
1592 'src/timedate/timedatectl.c',
1593 include_directories : includes,
1594 install_rpath : rootlibexecdir,
1595 link_with : [libshared],
1596 install : true)
1597 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001598endif
1599
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001600if conf.get('ENABLE_TIMESYNCD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001601 executable('systemd-timesyncd',
1602 systemd_timesyncd_sources,
1603 include_directories : includes,
1604 link_with : [libshared],
1605 dependencies : [threads,
1606 libm],
1607 install_rpath : rootlibexecdir,
1608 install : true,
1609 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001610endif
1611
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001612if conf.get('ENABLE_MACHINED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001613 executable('systemd-machined',
1614 systemd_machined_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001615 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001616 link_with : [libmachine_core,
1617 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001618 install_rpath : rootlibexecdir,
1619 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001620 install_dir : rootlibexecdir)
1621
1622 exe = executable('machinectl',
1623 'src/machine/machinectl.c',
1624 include_directories : includes,
1625 link_with : [libshared],
1626 dependencies : [threads,
1627 libxz,
1628 liblz4],
1629 install_rpath : rootlibexecdir,
1630 install : true,
1631 install_dir : rootbindir)
1632 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001633endif
1634
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001635if conf.get('ENABLE_IMPORTD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001636 executable('systemd-importd',
1637 systemd_importd_sources,
1638 include_directories : includes,
1639 link_with : [libshared],
1640 dependencies : [threads],
1641 install_rpath : rootlibexecdir,
1642 install : true,
1643 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001644
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001645 systemd_pull = executable('systemd-pull',
1646 systemd_pull_sources,
1647 include_directories : includes,
1648 link_with : [libshared],
1649 dependencies : [libcurl,
1650 libz,
1651 libbzip2,
1652 libxz,
1653 libgcrypt],
1654 install_rpath : rootlibexecdir,
1655 install : true,
1656 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001657
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001658 systemd_import = executable('systemd-import',
1659 systemd_import_sources,
1660 include_directories : includes,
1661 link_with : [libshared],
1662 dependencies : [libcurl,
1663 libz,
1664 libbzip2,
1665 libxz],
1666 install_rpath : rootlibexecdir,
1667 install : true,
1668 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001669
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001670 systemd_export = executable('systemd-export',
1671 systemd_export_sources,
1672 include_directories : includes,
1673 link_with : [libshared],
1674 dependencies : [libcurl,
1675 libz,
1676 libbzip2,
1677 libxz],
1678 install_rpath : rootlibexecdir,
1679 install : true,
1680 install_dir : rootlibexecdir)
1681 public_programs += [systemd_pull, systemd_import, systemd_export]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001682endif
1683
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001684if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001685 exe = executable('systemd-journal-upload',
1686 systemd_journal_upload_sources,
1687 include_directories : includes,
1688 link_with : [libshared],
1689 dependencies : [threads,
1690 libcurl,
1691 libgnutls,
1692 libxz,
1693 liblz4],
1694 install_rpath : rootlibexecdir,
1695 install : true,
1696 install_dir : rootlibexecdir)
1697 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001698endif
1699
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001700if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001701 s_j_remote = executable('systemd-journal-remote',
1702 systemd_journal_remote_sources,
1703 include_directories : includes,
1704 link_with : [libshared],
1705 dependencies : [threads,
1706 libmicrohttpd,
1707 libgnutls,
1708 libxz,
1709 liblz4],
1710 install_rpath : rootlibexecdir,
1711 install : true,
1712 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001713
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001714 s_j_gatewayd = executable('systemd-journal-gatewayd',
1715 systemd_journal_gatewayd_sources,
1716 include_directories : includes,
1717 link_with : [libshared],
1718 dependencies : [threads,
1719 libmicrohttpd,
1720 libgnutls,
1721 libxz,
1722 liblz4],
1723 install_rpath : rootlibexecdir,
1724 install : true,
1725 install_dir : rootlibexecdir)
1726 public_programs += [s_j_remote, s_j_gatewayd]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001727endif
1728
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001729if conf.get('ENABLE_COREDUMP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001730 executable('systemd-coredump',
1731 systemd_coredump_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001732 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001733 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001734 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001735 libacl,
1736 libdw,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001737 libxz,
1738 liblz4],
1739 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001740 install : true,
1741 install_dir : rootlibexecdir)
1742
1743 exe = executable('coredumpctl',
1744 coredumpctl_sources,
1745 include_directories : includes,
1746 link_with : [libshared],
1747 dependencies : [threads,
1748 libxz,
1749 liblz4],
1750 install_rpath : rootlibexecdir,
1751 install : true)
1752 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001753endif
1754
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001755if conf.get('ENABLE_BINFMT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001756 exe = executable('systemd-binfmt',
1757 'src/binfmt/binfmt.c',
1758 include_directories : includes,
1759 link_with : [libshared],
1760 install_rpath : rootlibexecdir,
1761 install : true,
1762 install_dir : rootlibexecdir)
1763 public_programs += [exe]
1764
1765 meson.add_install_script('sh', '-c',
1766 mkdir_p.format(binfmtdir))
1767 meson.add_install_script('sh', '-c',
1768 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1769endif
1770
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001771if conf.get('ENABLE_VCONSOLE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001772 executable('systemd-vconsole-setup',
1773 'src/vconsole/vconsole-setup.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001774 include_directories : includes,
1775 link_with : [libshared],
1776 install_rpath : rootlibexecdir,
1777 install : true,
1778 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001779endif
1780
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001781if conf.get('ENABLE_RANDOMSEED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001782 executable('systemd-random-seed',
1783 'src/random-seed/random-seed.c',
1784 include_directories : includes,
1785 link_with : [libshared],
1786 install_rpath : rootlibexecdir,
1787 install : true,
1788 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001789endif
1790
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001791if conf.get('ENABLE_FIRSTBOOT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001792 executable('systemd-firstboot',
1793 'src/firstboot/firstboot.c',
1794 include_directories : includes,
1795 link_with : [libshared],
1796 dependencies : [libcrypt],
1797 install_rpath : rootlibexecdir,
1798 install : true,
1799 install_dir : rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001800endif
1801
1802executable('systemd-remount-fs',
1803 'src/remount-fs/remount-fs.c',
1804 'src/core/mount-setup.c',
1805 'src/core/mount-setup.h',
1806 include_directories : includes,
1807 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001808 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001809 install : true,
1810 install_dir : rootlibexecdir)
1811
1812executable('systemd-machine-id-setup',
1813 'src/machine-id-setup/machine-id-setup-main.c',
1814 'src/core/machine-id-setup.c',
1815 'src/core/machine-id-setup.h',
1816 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001817 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001818 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001819 install : true,
1820 install_dir : rootbindir)
1821
1822executable('systemd-fsck',
1823 'src/fsck/fsck.c',
1824 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001825 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001826 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001827 install : true,
1828 install_dir : rootlibexecdir)
1829
1830executable('systemd-sleep',
1831 'src/sleep/sleep.c',
1832 include_directories : includes,
1833 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001834 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001835 install : true,
1836 install_dir : rootlibexecdir)
1837
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001838exe = executable('systemd-sysctl',
1839 'src/sysctl/sysctl.c',
1840 include_directories : includes,
1841 link_with : [libshared],
1842 install_rpath : rootlibexecdir,
1843 install : true,
1844 install_dir : rootlibexecdir)
1845public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001846
1847executable('systemd-ac-power',
1848 'src/ac-power/ac-power.c',
1849 include_directories : includes,
1850 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001851 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001852 install : true,
1853 install_dir : rootlibexecdir)
1854
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001855exe = executable('systemd-detect-virt',
1856 'src/detect-virt/detect-virt.c',
1857 include_directories : includes,
1858 link_with : [libshared],
1859 install_rpath : rootlibexecdir,
1860 install : true)
1861public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001862
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001863exe = executable('systemd-delta',
1864 'src/delta/delta.c',
1865 include_directories : includes,
1866 link_with : [libshared],
1867 install_rpath : rootlibexecdir,
1868 install : true)
1869public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001870
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001871exe = executable('systemd-escape',
1872 'src/escape/escape.c',
1873 include_directories : includes,
1874 link_with : [libshared],
1875 install_rpath : rootlibexecdir,
1876 install : true,
1877 install_dir : rootbindir)
1878public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001879
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001880exe = executable('systemd-notify',
1881 'src/notify/notify.c',
1882 include_directories : includes,
1883 link_with : [libshared],
1884 install_rpath : rootlibexecdir,
1885 install : true,
1886 install_dir : rootbindir)
1887public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001888
1889executable('systemd-volatile-root',
1890 'src/volatile-root/volatile-root.c',
1891 include_directories : includes,
1892 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001893 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001894 install : true,
1895 install_dir : rootlibexecdir)
1896
1897executable('systemd-cgroups-agent',
1898 'src/cgroups-agent/cgroups-agent.c',
1899 include_directories : includes,
1900 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001901 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001902 install : true,
1903 install_dir : rootlibexecdir)
1904
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001905exe = executable('systemd-path',
1906 'src/path/path.c',
1907 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001908 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001909 install_rpath : rootlibexecdir,
1910 install : true)
1911public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001912
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001913exe = executable('systemd-ask-password',
1914 'src/ask-password/ask-password.c',
1915 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001916 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001917 install_rpath : rootlibexecdir,
1918 install : true,
1919 install_dir : rootbindir)
1920public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001921
1922executable('systemd-reply-password',
1923 'src/reply-password/reply-password.c',
1924 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001925 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001926 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001927 install : true,
1928 install_dir : rootlibexecdir)
1929
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001930exe = executable('systemd-tty-ask-password-agent',
1931 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1932 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001933 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001934 install_rpath : rootlibexecdir,
1935 install : true,
1936 install_dir : rootbindir)
1937public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001938
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001939exe = executable('systemd-cgls',
1940 'src/cgls/cgls.c',
1941 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001942 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001943 install_rpath : rootlibexecdir,
1944 install : true)
1945public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001946
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001947exe = executable('systemd-cgtop',
1948 'src/cgtop/cgtop.c',
1949 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001950 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001951 install_rpath : rootlibexecdir,
1952 install : true)
1953public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001954
1955executable('systemd-initctl',
1956 'src/initctl/initctl.c',
1957 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001958 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001959 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001960 install : true,
1961 install_dir : rootlibexecdir)
1962
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001963exe = executable('systemd-mount',
1964 'src/mount/mount-tool.c',
1965 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001966 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001967 install_rpath : rootlibexecdir,
1968 install : true)
1969public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001970
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001971meson.add_install_script(meson_make_symlink,
Michael Bieble17e5ba2017-04-13 10:30:56 -04001972 'systemd-mount', join_paths(bindir, 'systemd-umount'))
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001973
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001974exe = executable('systemd-run',
1975 'src/run/run.c',
1976 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001977 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001978 install_rpath : rootlibexecdir,
1979 install : true)
1980public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001981
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001982exe = executable('systemd-stdio-bridge',
1983 'src/stdio-bridge/stdio-bridge.c',
1984 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001985 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001986 install_rpath : rootlibexecdir,
1987 install : true)
1988public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001989
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001990exe = executable('busctl',
1991 'src/busctl/busctl.c',
1992 'src/busctl/busctl-introspect.c',
1993 'src/busctl/busctl-introspect.h',
1994 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001995 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001996 install_rpath : rootlibexecdir,
1997 install : true)
1998public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001999
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002000if conf.get('ENABLE_SYSUSERS', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002001 exe = executable('systemd-sysusers',
2002 'src/sysusers/sysusers.c',
2003 include_directories : includes,
2004 link_with : [libshared],
2005 install_rpath : rootlibexecdir,
2006 install : true,
2007 install_dir : rootbindir)
2008 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002009endif
2010
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002011if conf.get('ENABLE_TMPFILES', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002012 exe = executable('systemd-tmpfiles',
2013 'src/tmpfiles/tmpfiles.c',
2014 include_directories : includes,
2015 link_with : [libshared],
2016 dependencies : [libacl],
2017 install_rpath : rootlibexecdir,
2018 install : true,
2019 install_dir : rootbindir)
2020 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002021endif
2022
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002023if conf.get('ENABLE_HWDB', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002024 exe = executable('systemd-hwdb',
2025 'src/hwdb/hwdb.c',
2026 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2027 include_directories : includes,
Michael Biebl0da6f392017-04-21 18:32:14 +02002028 link_with : [libudev_internal],
2029 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002030 install : true,
2031 install_dir : rootbindir)
2032 public_programs += [exe]
2033endif
2034
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002035if conf.get('ENABLE_QUOTACHECK', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002036 executable('systemd-quotacheck',
2037 'src/quotacheck/quotacheck.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002038 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002039 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002040 install_rpath : rootlibexecdir,
2041 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002042 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002043endif
2044
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002045exe = executable('systemd-socket-proxyd',
2046 'src/socket-proxy/socket-proxyd.c',
2047 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002048 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002049 dependencies : [threads],
2050 install_rpath : rootlibexecdir,
2051 install : true,
2052 install_dir : rootlibexecdir)
2053public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002054
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002055exe = executable('systemd-udevd',
2056 systemd_udevd_sources,
2057 include_directories : includes,
2058 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002059 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002060 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002061 dependencies : [threads,
2062 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002063 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002064 libacl,
2065 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002066 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002067 install : true,
2068 install_dir : rootlibexecdir)
2069public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002070
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002071exe = executable('udevadm',
2072 udevadm_sources,
2073 include_directories : includes,
2074 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002075 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002076 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002077 dependencies : [threads,
2078 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002079 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002080 libacl,
2081 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002082 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002083 install : true,
2084 install_dir : rootbindir)
2085public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002086
2087executable('systemd-shutdown',
2088 systemd_shutdown_sources,
2089 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02002090 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002091 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002092 install : true,
2093 install_dir : rootlibexecdir)
2094
2095executable('systemd-update-done',
2096 'src/update-done/update-done.c',
2097 include_directories : includes,
2098 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002099 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002100 install : true,
2101 install_dir : rootlibexecdir)
2102
2103executable('systemd-update-utmp',
2104 'src/update-utmp/update-utmp.c',
2105 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002106 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002107 dependencies : [libaudit],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002108 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002109 install : true,
2110 install_dir : rootlibexecdir)
2111
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002112if conf.get('HAVE_KMOD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002113 executable('systemd-modules-load',
2114 'src/modules-load/modules-load.c',
2115 include_directories : includes,
2116 link_with : [libshared],
2117 dependencies : [libkmod],
2118 install_rpath : rootlibexecdir,
2119 install : true,
2120 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002121
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002122 meson.add_install_script('sh', '-c',
2123 mkdir_p.format(modulesloaddir))
2124 meson.add_install_script('sh', '-c',
2125 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002126endif
2127
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002128exe = executable('systemd-nspawn',
2129 systemd_nspawn_sources,
2130 'src/core/mount-setup.c', # FIXME: use a variable?
2131 'src/core/mount-setup.h',
2132 'src/core/loopback-setup.c',
2133 'src/core/loopback-setup.h',
2134 include_directories : [includes, include_directories('src/nspawn')],
Zbigniew Jędrzejewski-Szmek0bc91152017-04-27 13:39:54 -04002135 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002136 dependencies : [libacl,
2137 libblkid,
2138 libseccomp,
2139 libselinux],
2140 install_rpath : rootlibexecdir,
2141 install : true)
2142public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002143
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002144if conf.get('ENABLE_NETWORKD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002145 executable('systemd-networkd',
2146 systemd_networkd_sources,
2147 include_directories : includes,
2148 link_with : [libnetworkd_core,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002149 libsystemd_network,
2150 libudev_internal,
2151 libshared],
2152 install_rpath : rootlibexecdir,
2153 install : true,
2154 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002155
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002156 executable('systemd-networkd-wait-online',
2157 systemd_networkd_wait_online_sources,
2158 include_directories : includes,
2159 link_with : [libnetworkd_core,
2160 libshared],
2161 install_rpath : rootlibexecdir,
2162 install : true,
2163 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmekf0bd7cc2017-04-12 12:14:30 -04002164endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002165
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002166exe = executable('networkctl',
2167 networkctl_sources,
2168 include_directories : includes,
2169 link_with : [libsystemd_network,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002170 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002171 install_rpath : rootlibexecdir,
2172 install : true,
2173 install_dir : rootbindir)
2174public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002175
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002176############################################################
2177
2178foreach tuple : tests
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002179 sources = tuple[0]
2180 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2181 dependencies = tuple[2]
2182 condition = tuple.length() >= 4 ? tuple[3] : ''
2183 type = tuple.length() >= 5 ? tuple[4] : ''
2184 defs = tuple.length() >= 6 ? tuple[5] : []
2185 incs = tuple.length() >= 7 ? tuple[6] : includes
2186 timeout = 30
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002187
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002188 name = sources[0].split('/')[-1].split('.')[0]
2189 if type.startswith('timeout=')
2190 timeout = type.split('=')[1].to_int()
2191 type = ''
2192 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002193
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002194 if condition == '' or conf.get(condition, false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002195 install = install_tests and type == ''
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04002196
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002197 exe = executable(
2198 name,
2199 sources,
2200 include_directories : incs,
2201 link_with : link_with,
2202 dependencies : dependencies,
2203 c_args : defs,
2204 install_rpath : rootlibexecdir,
2205 install : install,
2206 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04002207
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002208 if type == 'manual'
2209 message('@0@ is a manual test'.format(name))
2210 elif type == 'unsafe' and want_tests != 'unsafe'
2211 message('@0@ is an unsafe test'.format(name))
2212 else
2213 test(name, exe,
2214 env : test_env,
2215 timeout : timeout)
2216 endif
2217 else
2218 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2219 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002220endforeach
2221
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002222test_libsystemd_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002223 'test-libsystemd-sym',
2224 test_libsystemd_sym_c,
2225 include_directories : includes,
2226 link_with : [libsystemd],
2227 install : install_tests,
2228 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002229test('test-libsystemd-sym',
2230 test_libsystemd_sym)
2231
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002232test_libudev_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002233 'test-libudev-sym',
2234 test_libudev_sym_c,
2235 include_directories : includes,
2236 c_args : ['-Wno-deprecated-declarations'],
2237 link_with : [libudev],
2238 install : install_tests,
2239 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002240test('test-libudev-sym',
2241 test_libudev_sym)
2242
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002243############################################################
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002244
2245make_directive_index_py = find_program('tools/make-directive-index.py')
2246make_man_index_py = find_program('tools/make-man-index.py')
Zbigniew Jędrzejewski-Szmekb184e8f2017-04-13 19:59:21 -04002247xml_helper_py = find_program('tools/xml_helper.py')
Zbigniew Jędrzejewski-Szmekabba22c2017-04-15 00:40:59 -04002248hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002249
2250subdir('units')
2251subdir('sysctl.d')
2252subdir('sysusers.d')
2253subdir('tmpfiles.d')
2254subdir('rules')
2255subdir('hwdb')
2256subdir('network')
2257subdir('man')
2258subdir('shell-completion/bash')
2259subdir('shell-completion/zsh')
2260subdir('docs/sysvinit')
2261subdir('docs/var-log')
2262
2263# FIXME: figure out if the warning is true:
2264# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2265install_subdir('factory/etc',
2266 install_dir : factorydir)
2267
2268
2269install_data('xorg/50-systemd-user.sh',
2270 install_dir : xinitrcdir)
2271install_data('system-preset/90-systemd.preset',
2272 install_dir : systempresetdir)
2273install_data('README',
2274 'NEWS',
2275 'CODING_STYLE',
2276 'DISTRO_PORTING',
2277 'ENVIRONMENT.md',
2278 'LICENSE.GPL2',
2279 'LICENSE.LGPL2.1',
2280 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2281 install_dir : docdir)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002282
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002283meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2284meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2285
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002286############################################################
2287
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002288meson_check_help = find_program('tools/meson-check-help.sh')
2289
2290foreach exec : public_programs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002291 name = exec.full_path().split('/')[-1]
2292 test('check-help-' + name,
2293 meson_check_help,
2294 args : [exec.full_path()])
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002295endforeach
2296
2297############################################################
2298
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002299if git.found() and etags.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002300 all_files = run_command(
2301 git,
2302 ['--git-dir=@0@/.git'.format(meson.source_root()),
2303 'ls-files',
2304 ':/*.[ch]'])
2305 all_files = files(all_files.stdout().split())
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002306
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002307 custom_target(
2308 'TAGS',
2309 output : 'TAGS',
2310 input : all_files,
2311 command : [etags, '-o', '@OUTPUT@'] + all_files)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002312endif
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002313
2314if git.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002315 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
Zbigniew Jędrzejewski-Szmeka923e082017-04-17 19:48:20 -04002316 run_target(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002317 'git-contrib',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002318 command : [meson_git_contrib_sh])
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002319endif
Zbigniew Jędrzejewski-Szmekdd6ab3d2017-04-24 19:28:05 -04002320
2321if git.found()
2322 git_head = run_command(
2323 git,
2324 ['--git-dir=@0@/.git'.format(meson.source_root()),
2325 'rev-parse', 'HEAD']).stdout().strip()
2326 git_head_short = run_command(
2327 git,
2328 ['--git-dir=@0@/.git'.format(meson.source_root()),
2329 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2330
2331 run_target(
2332 'git-snapshot',
2333 command : ['git', 'archive',
2334 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.source_root(),
2335 git_head_short),
2336 '--prefix', 'systemd-@0@/'.format(git_head),
2337 'HEAD'])
2338endif
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002339
2340############################################################
2341
2342status = [
2343 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2344
2345 'prefix: @0@'.format(prefixdir),
2346 'rootprefix: @0@'.format(rootprefixdir),
2347 'sysconf dir: @0@'.format(sysconfdir),
2348 'includedir: @0@'.format(includedir),
2349 'lib dir: @0@'.format(libdir),
2350 'rootlib dir: @0@'.format(rootlibdir),
2351 'SysV init scripts: @0@'.format(sysvinit_path),
2352 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2353 'PAM modules dir: @0@'.format(pamlibdir),
2354 'PAM configuration dir: @0@'.format(pamconfdir),
2355 'RPM macros dir: @0@'.format(rpmmacrosdir),
2356 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2357 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2358 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2359 'bash completions dir: @0@'.format(bashcompletiondir),
2360 'zsh completions dir: @0@'.format(zshcompletiondir),
2361 'extra start script: @0@'.format(get_option('rc-local')),
2362 'extra stop script: @0@'.format(get_option('halt-local')),
2363 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2364 get_option('debug-tty')),
2365 'TTY GID: @0@'.format(tty_gid),
2366 'maximum system UID: @0@'.format(system_uid_max),
2367 'maximum system GID: @0@'.format(system_gid_max),
2368 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2369 'certificate root: @0@'.format(get_option('certificate-root')),
2370 'support URL: @0@'.format(support_url),
2371 'nobody user name: @0@'.format(get_option('nobody-user')),
2372 'nobody group name: @0@'.format(get_option('nobody-group')),
2373 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2374
2375 'default DNSSEC mode: @0@'.format(default_dnssec),
2376 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2377 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2378
2379alt_dns_servers = '\n '.join(dns_servers.split(' '))
2380alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2381status += [
2382 'default DNS servers: @0@'.format(alt_dns_servers),
2383 'default NTP servers: @0@'.format(alt_ntp_servers)]
2384
2385alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2386 '@@0@'.format(time_epoch)).stdout().strip()
2387status += [
2388 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2389
2390# TODO:
2391# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2392# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2393# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2394
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002395if conf.get('ENABLE_EFI', false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002396 status += [
2397 'efi arch: @0@'.format(efi_arch)]
2398
2399 if have_gnu_efi
2400 status += [
2401 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2402 'EFI CC @0@'.format(efi_cc),
2403 'EFI libdir: @0@'.format(efi_libdir),
2404 'EFI ldsdir: @0@'.format(efi_ldsdir),
2405 'EFI includedir: @0@'.format(efi_incdir)]
2406 endif
2407endif
2408
2409found = []
2410missing = []
2411
2412foreach tuple : [
2413 ['libcryptsetup'],
2414 ['PAM'],
2415 ['AUDIT'],
2416 ['IMA'],
2417 ['AppArmor'],
2418 ['SELinux'],
2419 ['SECCOMP'],
2420 ['SMACK'],
2421 ['zlib'],
2422 ['xz'],
2423 ['lz4'],
2424 ['bzip2'],
2425 ['ACL'],
2426 ['gcrypt'],
2427 ['qrencode'],
2428 ['microhttpd'],
2429 ['gnutls'],
2430 ['libcurl'],
2431 ['libidn'],
2432 ['libiptc'],
2433 ['elfutils'],
2434 ['binfmt'],
2435 ['vconsole'],
2436 ['quotacheck'],
2437 ['tmpfiles'],
2438 ['environment.d'],
2439 ['sysusers'],
2440 ['firstboot'],
2441 ['randomseed'],
2442 ['backlight'],
2443 ['rfkill'],
2444 ['logind'],
2445 ['machined'],
2446 ['importd'],
2447 ['hostnamed'],
2448 ['timedated'],
2449 ['timesyncd'],
2450 ['localed'],
2451 ['networkd'],
2452 ['resolved'],
2453 ['coredump'],
2454 ['polkit'],
2455 ['legacy pkla', install_polkit_pkla],
2456 ['efi'],
2457 ['gnu-efi', have_gnu_efi],
2458 ['kmod'],
2459 ['xkbcommon'],
2460 ['blkid'],
2461 ['dbus'],
2462 ['glib'],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002463 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002464 ['hwdb'],
2465 ['tpm'],
2466 ['man pages', want_man],
2467 ['html pages', want_html],
2468 ['man page indices', want_man and have_lxml],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002469 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002470 ['SysV compat'],
2471 ['utmp'],
2472 ['ldconfig'],
2473 ['hibernate'],
2474 ['adm group', get_option('adm-group')],
2475 ['wheel group', get_option('wheel-group')],
2476 ['debug hashmap'],
2477 ['debug mmap cache'],
2478]
2479
2480 cond = tuple.get(1, '')
2481 if cond == ''
2482 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2483 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002484 cond = conf.get(ident1, false) or conf.get(ident2, false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002485 endif
2486 if cond
2487 found += [tuple[0]]
2488 else
2489 missing += [tuple[0]]
2490 endif
2491endforeach
2492
2493status += [
2494 'enabled features: @0@'.format(', '.join(found)),
2495 'disabled features: @0@'.format(', '.join(missing))]
2496message('\n '.join(status))