blob: 6e3901c85ee5487db27b33eab54b21905ce03a59 [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-Szmek87057e22017-05-09 21:56:34 -0400794want_libidn2 = get_option('libidn2')
795if want_libidn == 'true' and want_libidn2 == 'true'
796 error('libidn and libidn2 cannot be requested simultaneously')
797endif
798
799if want_libidn2 != 'false' and want_libidn != 'true'
800 libidn = dependency('libidn2',
801 required : want_libidn2 == 'true')
802 # libidn is used for both libidn and libidn2 objects
803 if libidn.found()
804 conf.set('HAVE_LIBIDN2', true)
805 m4_defines += ['-DHAVE_LIBIDN2']
806 endif
807else
808 libidn = []
809endif
810if not conf.get('HAVE_LIBIDN2', false) and want_libidn != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400811 libidn = dependency('libidn',
812 required : want_libidn == 'true')
813 if libidn.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400814 conf.set('HAVE_LIBIDN', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400815 m4_defines += ['-DHAVE_LIBIDN']
816 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400817endif
818
819want_libiptc = get_option('libiptc')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400820if want_libiptc != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400821 libiptc = dependency('libiptc',
822 required : want_libiptc == 'true')
823 if libiptc.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400824 conf.set('HAVE_LIBIPTC', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400825 m4_defines += ['-DHAVE_LIBIPTC']
826 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400827else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400828 libiptc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400829endif
830
831want_qrencode = get_option('qrencode')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400832if want_qrencode != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400833 libqrencode = dependency('libqrencode',
834 required : want_qrencode == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400835 conf.set('HAVE_QRENCODE', libqrencode.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400836else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400837 libqrencode = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400838endif
839
840want_gnutls = get_option('gnutls')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400841if want_gnutls != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400842 libgnutls = dependency('gnutls',
843 version : '>= 3.1.4',
844 required : want_gnutls == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400845 conf.set('HAVE_GNUTLS', libgnutls.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400846else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400847 libgnutls = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400848endif
849
850want_elfutils = get_option('elfutils')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400851if want_elfutils != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400852 libdw = dependency('libdw',
853 required : want_elfutils == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400854 conf.set('HAVE_ELFUTILS', libdw.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400855else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400856 libdw = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400857endif
858
859want_zlib = get_option('zlib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400860if want_zlib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400861 libz = dependency('zlib',
862 required : want_zlib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400863 conf.set('HAVE_ZLIB', libz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400864else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400865 libz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400866endif
867
868want_bzip2 = get_option('bzip2')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400869if want_bzip2 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400870 libbzip2 = cc.find_library('bz2',
871 required : want_bzip2 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400872 conf.set('HAVE_BZIP2', libbzip2.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400873else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400874 libbzip2 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400875endif
876
877want_xz = get_option('xz')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400878if want_xz != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400879 libxz = dependency('liblzma',
880 required : want_xz == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400881 conf.set('HAVE_XZ', libxz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400882else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400883 libxz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400884endif
885
886want_lz4 = get_option('lz4')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400887if want_lz4 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400888 liblz4 = dependency('liblz4',
889 required : want_lz4 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400890 conf.set('HAVE_LZ4', liblz4.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400891else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400892 liblz4 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400893endif
894
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400895want_glib = get_option('glib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400896if want_glib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400897 libglib = dependency('glib-2.0',
898 version : '>= 2.22.0',
899 required : want_glib == 'true')
900 libgobject = dependency('gobject-2.0',
901 version : '>= 2.22.0',
902 required : want_glib == 'true')
903 libgio = dependency('gio-2.0',
904 required : want_glib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400905 have = libglib.found() and libgobject.found() and libgio.found()
906 conf.set('HAVE_GLIB', have)
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400907else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400908 libglib = []
909 libgobject = []
910 libgio = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400911endif
912
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400913want_xkbcommon = get_option('xkbcommon')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400914if want_xkbcommon != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400915 libxkbcommon = dependency('xkbcommon',
916 version : '>= 0.3.0',
917 required : want_xkbcommon == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400918 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400919else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400920 libxkbcommon = []
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400921endif
922
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400923want_dbus = get_option('dbus')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400924if want_dbus != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400925 libdbus = dependency('dbus-1',
926 version : '>= 1.3.2',
927 required : want_dbus == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400928 conf.set('HAVE_DBUS', libdbus.found())
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400929else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400930 libdbus = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400931endif
932
Michael Biebl76c87412017-04-21 23:45:54 +0200933want_gcrypt = get_option('gcrypt')
934if want_gcrypt != 'false'
935 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
936 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
937
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400938 have_deps = libgcrypt.found() and libgpg_error.found()
939 conf.set('HAVE_GCRYPT', have_deps)
940 if not have_deps
Michael Biebl76c87412017-04-21 23:45:54 +0200941 # link to neither of the libs if one is not found
942 libgcrypt = []
943 libgpg_error = []
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400944 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400945else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400946 libgcrypt = []
Michael Biebl76c87412017-04-21 23:45:54 +0200947 libgpg_error = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400948endif
949
950want_importd = get_option('importd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400951if want_importd != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400952 have_deps = (conf.get('HAVE_LIBCURL', false) and
953 conf.get('HAVE_ZLIB', false) and
954 conf.get('HAVE_BZIP2', false) and
955 conf.get('HAVE_XZ', false) and
956 conf.get('HAVE_GCRYPT', false))
957 conf.set('ENABLE_IMPORTD', have_deps)
958 if want_importd == 'true' and not have_deps
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400959 error('importd support was requested, but dependencies are not available')
960 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400961endif
962
963want_remote = get_option('remote')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400964if want_remote != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400965 have_deps = [conf.get('HAVE_MICROHTTPD', false),
966 conf.get('HAVE_LIBCURL', false)]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400967 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
968 # it's possible to build one without the other. Complain only if
969 # support was explictly requested. The auxiliary files like sysusers
970 # config should be installed when any of the programs are built.
971 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
972 error('remote support was requested, but dependencies are not available')
973 endif
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400974 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400975endif
976
977foreach pair : [['utmp', 'HAVE_UTMP'],
978 ['hibernate', 'ENABLE_HIBERNATE'],
979 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
980 ['binfmt', 'ENABLE_BINFMT'],
981 ['coredump', 'ENABLE_COREDUMP'],
982 ['resolve', 'ENABLE_RESOLVED'],
983 ['logind', 'ENABLE_LOGIND'],
984 ['hostnamed', 'ENABLE_HOSTNAMED'],
985 ['localed', 'ENABLE_LOCALED'],
986 ['machined', 'ENABLE_MACHINED'],
987 ['networkd', 'ENABLE_NETWORKD'],
988 ['timedated', 'ENABLE_TIMEDATED'],
989 ['timesyncd', 'ENABLE_TIMESYNCD'],
990 ['myhostname', 'HAVE_MYHOSTNAME'],
991 ['firstboot', 'ENABLE_FIRSTBOOT'],
992 ['randomseed', 'ENABLE_RANDOMSEED'],
993 ['backlight', 'ENABLE_BACKLIGHT'],
994 ['vconsole', 'ENABLE_VCONSOLE'],
995 ['quotacheck', 'ENABLE_QUOTACHECK'],
996 ['sysusers', 'ENABLE_SYSUSERS'],
997 ['tmpfiles', 'ENABLE_TMPFILES'],
998 ['hwdb', 'ENABLE_HWDB'],
999 ['rfkill', 'ENABLE_RFKILL'],
1000 ['ldconfig', 'ENABLE_LDCONFIG'],
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001001 ['efi', 'ENABLE_EFI'],
Zbigniew Jędrzejewski-Szmek80c6fce2017-04-24 19:28:04 -04001002 ['tpm', 'SD_BOOT_LOG_TPM'],
Zbigniew Jędrzejewski-Szmek2895c8e2017-04-13 19:45:05 -04001003 ['ima', 'HAVE_IMA'],
Zbigniew Jędrzejewski-Szmek5464ec82017-04-24 19:28:04 -04001004 ['smack', 'HAVE_SMACK'],
Franck Buib14e1b42017-05-09 14:02:37 +02001005 ['gshadow', 'ENABLE_GSHADOW'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001006 ]
1007
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001008 if get_option(pair[0])
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001009 conf.set(pair[1], true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001010 m4_defines += ['-D' + pair[1]]
1011 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001012endforeach
1013
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001014want_tests = get_option('tests')
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04001015install_tests = get_option('install-tests')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001016tests = []
1017
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001018#####################################################################
1019
1020if get_option('efi')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001021 efi_arch = host_machine.cpu_family()
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001022
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001023 if efi_arch == 'x86'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001024 EFI_MACHINE_TYPE_NAME = 'ia32'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001025 gnu_efi_arch = 'ia32'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001026 elif efi_arch == 'x86_64'
1027 EFI_MACHINE_TYPE_NAME = 'x64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001028 gnu_efi_arch = 'x86_64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001029 elif efi_arch == 'arm'
1030 EFI_MACHINE_TYPE_NAME = 'arm'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001031 gnu_efi_arch = 'arm'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001032 elif efi_arch == 'aarch64'
1033 EFI_MACHINE_TYPE_NAME = 'aa64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001034 gnu_efi_arch = 'aarch64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001035 else
1036 EFI_MACHINE_TYPE_NAME = ''
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001037 gnu_efi_arch = ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001038 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001039
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001040 conf.set('ENABLE_EFI', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001041 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
Zbigniew Jędrzejewski-Szmek80c6fce2017-04-24 19:28:04 -04001042
1043 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001044endif
1045
1046#####################################################################
1047
1048config_h = configure_file(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001049 output : 'config.h',
1050 configuration : conf)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001051
1052includes = include_directories('src/basic',
1053 'src/shared',
1054 'src/systemd',
1055 'src/journal',
1056 'src/resolve',
1057 'src/timesync',
1058 'src/login',
1059 'src/udev',
1060 'src/libudev',
1061 'src/core',
1062 'src/libsystemd/sd-bus',
1063 'src/libsystemd/sd-device',
1064 'src/libsystemd/sd-hwdb',
1065 'src/libsystemd/sd-id128',
1066 'src/libsystemd/sd-netlink',
1067 'src/libsystemd/sd-network',
1068 'src/libsystemd-network',
1069 )
1070
1071add_project_arguments('-include', 'config.h', language : 'c')
1072
1073gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1074 'src/shared/gcrypt-util.c')
1075
1076subdir('po')
1077subdir('catalog')
1078subdir('src/systemd')
1079subdir('src/basic')
1080subdir('src/libsystemd')
1081subdir('src/libsystemd-network')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001082subdir('src/journal')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001083subdir('src/login')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001084
1085libjournal_core = static_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001086 'journal-core',
1087 libjournal_core_sources,
1088 journald_gperf_c,
1089 include_directories : includes,
1090 install : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001091
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04001092libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001093libsystemd = shared_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001094 'systemd',
1095 libsystemd_internal_sources,
1096 journal_internal_sources,
1097 version : '0.18.0',
1098 include_directories : includes,
1099 link_args : ['-shared',
1100 '-Wl,--version-script=' + libsystemd_sym_path],
1101 link_with : [libbasic],
1102 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001103 libgcrypt,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001104 librt,
1105 libxz,
1106 liblz4],
1107 link_depends : libsystemd_sym,
1108 install : true,
1109 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001110
1111############################################################
1112
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001113# binaries that have --help and are intended for use by humans,
1114# usually, but not always, installed in /bin.
1115public_programs = []
1116
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001117subdir('src/libudev')
1118subdir('src/shared')
1119subdir('src/core')
1120subdir('src/udev')
1121subdir('src/network')
1122
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001123subdir('src/analyze')
1124subdir('src/journal-remote')
1125subdir('src/coredump')
1126subdir('src/hostname')
1127subdir('src/import')
1128subdir('src/kernel-install')
1129subdir('src/locale')
1130subdir('src/machine')
1131subdir('src/nspawn')
1132subdir('src/resolve')
1133subdir('src/timedate')
1134subdir('src/timesync')
1135subdir('src/vconsole')
Zbigniew Jędrzejewski-Szmek4e4ab1c2017-04-10 12:37:52 -04001136subdir('src/sulogin-shell')
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001137subdir('src/boot/efi')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001138
1139subdir('src/test')
Zbigniew Jędrzejewski-Szmek4ff3f252017-04-13 20:47:20 -04001140subdir('test')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001141
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001142############################################################
1143
1144# only static linking apart from libdl, to make sure that the
1145# module is linked to all libraries that it uses.
1146test_dlopen = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001147 'test-dlopen',
1148 test_dlopen_c,
1149 include_directories : includes,
1150 link_with : [libbasic],
1151 dependencies : [libdl])
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001152
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001153foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
1154 ['systemd', '' ],
1155 ['mymachines', 'ENABLE_MACHINED'],
1156 ['resolve', 'ENABLE_RESOLVED']]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001157
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001158 condition = tuple[1] == '' or conf.get(tuple[1], false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001159 if condition
1160 module = tuple[0]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001161
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001162 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1163 version_script_arg = join_paths(meson.current_source_dir(), sym)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001164
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001165 nss = shared_library(
1166 'nss_' + module,
1167 'src/nss-@0@/nss-@0@.c'.format(module),
1168 version : '2',
1169 include_directories : includes,
1170 link_args : ['-shared',
1171 '-Wl,--version-script=' + version_script_arg,
1172 '-Wl,--undefined'],
1173 link_with : [libsystemd_internal,
1174 libbasic],
1175 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001176 librt],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001177 link_depends : sym,
1178 install : true,
1179 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001180
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001181 # We cannot use shared_module because it does not support version suffix.
1182 # Unfortunately shared_library insists on creating the symlink…
1183 meson.add_install_script('sh', '-c',
1184 'rm $DESTDIR@0@/libnss_@1@.so'
1185 .format(rootlibdir, module))
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001186
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001187 test('dlopen-nss_' + module,
1188 test_dlopen,
1189 args : [nss.full_path()]) # path to dlopen must include a slash
1190 endif
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001191endforeach
1192
1193############################################################
1194
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001195executable('systemd',
1196 systemd_sources,
1197 include_directories : includes,
1198 link_with : [libcore,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001199 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001200 dependencies : [threads,
1201 librt,
1202 libseccomp,
1203 libselinux,
Zbigniew Jędrzejewski-Szmekf4ee10a2017-04-09 14:08:53 -04001204 libmount,
1205 libblkid],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001206 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001207 install : true,
1208 install_dir : rootlibexecdir)
1209
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001210exe = executable('systemd-analyze',
1211 systemd_analyze_sources,
1212 include_directories : includes,
1213 link_with : [libcore,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001214 libshared],
1215 dependencies : [threads,
1216 librt,
1217 libseccomp,
1218 libselinux,
1219 libmount,
1220 libblkid],
1221 install_rpath : rootlibexecdir,
1222 install : true)
1223public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001224
1225executable('systemd-journald',
1226 systemd_journald_sources,
1227 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001228 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001229 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001230 dependencies : [threads,
1231 libxz,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001232 liblz4,
1233 libselinux],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001234 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001235 install : true,
1236 install_dir : rootlibexecdir)
1237
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001238exe = executable('systemd-cat',
1239 systemd_cat_sources,
1240 include_directories : includes,
1241 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001242 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001243 dependencies : [threads],
1244 install_rpath : rootlibexecdir,
1245 install : true)
1246public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001247
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001248exe = executable('journalctl',
1249 journalctl_sources,
1250 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001251 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001252 dependencies : [threads,
1253 libqrencode,
1254 libxz,
1255 liblz4],
1256 install_rpath : rootlibexecdir,
1257 install : true,
1258 install_dir : rootbindir)
1259public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001260
1261executable('systemd-getty-generator',
1262 'src/getty-generator/getty-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001263 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001264 link_with : [libshared],
1265 install_rpath : rootlibexecdir,
1266 install : true,
1267 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001268
1269executable('systemd-debug-generator',
1270 'src/debug-generator/debug-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001271 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001272 link_with : [libshared],
1273 install_rpath : rootlibexecdir,
1274 install : true,
1275 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001276
1277executable('systemd-fstab-generator',
1278 'src/fstab-generator/fstab-generator.c',
1279 'src/core/mount-setup.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001280 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001281 link_with : [libshared],
1282 install_rpath : rootlibexecdir,
1283 install : true,
1284 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001285
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001286if conf.get('ENABLE_ENVIRONMENT_D', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001287 executable('30-systemd-environment-d-generator',
1288 'src/environment-d-generator/environment-d-generator.c',
1289 include_directories : includes,
1290 link_with : [libshared],
1291 install_rpath : rootlibexecdir,
1292 install : true,
1293 install_dir : userenvgeneratordir)
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001294
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001295 meson.add_install_script(meson_make_symlink,
1296 join_paths(sysconfdir, 'environment'),
1297 join_paths(environmentdir, '99-environment.conf'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001298endif
1299
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001300if conf.get('ENABLE_HIBERNATE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001301 executable('systemd-hibernate-resume-generator',
1302 'src/hibernate-resume/hibernate-resume-generator.c',
1303 include_directories : includes,
1304 link_with : [libshared],
1305 install_rpath : rootlibexecdir,
1306 install : true,
1307 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001308
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001309 executable('systemd-hibernate-resume',
1310 'src/hibernate-resume/hibernate-resume.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001311 include_directories : includes,
1312 link_with : [libshared],
1313 install_rpath : rootlibexecdir,
1314 install : true,
1315 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001316endif
1317
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001318if conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001319 executable('systemd-gpt-auto-generator',
1320 'src/gpt-auto-generator/gpt-auto-generator.c',
1321 'src/basic/blkid-util.h',
1322 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001323 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001324 dependencies : libblkid,
1325 install_rpath : rootlibexecdir,
1326 install : true,
1327 install_dir : systemgeneratordir)
1328
1329 exe = executable('systemd-dissect',
1330 'src/dissect/dissect.c',
1331 include_directories : includes,
1332 link_with : [libshared],
1333 install_rpath : rootlibexecdir,
1334 install : true,
1335 install_dir : rootlibexecdir)
1336 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001337endif
1338
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001339if conf.get('ENABLE_RESOLVED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001340 executable('systemd-resolved',
1341 systemd_resolved_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001342 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001343 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001344 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001345 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001346 libgcrypt,
1347 libgpg_error,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001348 libm,
1349 libidn],
1350 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001351 install : true,
1352 install_dir : rootlibexecdir)
1353
1354 exe = executable('systemd-resolve',
1355 systemd_resolve_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001356 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001357 include_directories : includes,
1358 link_with : [libshared],
1359 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001360 libgcrypt,
1361 libgpg_error,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001362 libm,
1363 libidn],
1364 install_rpath : rootlibexecdir,
1365 install : true)
1366 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001367endif
1368
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001369if conf.get('ENABLE_LOGIND', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001370 executable('systemd-logind',
1371 systemd_logind_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001372 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001373 link_with : [liblogind_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001374 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001375 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001376 libacl],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001377 install_rpath : rootlibexecdir,
1378 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001379 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001380
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001381 exe = executable('loginctl',
1382 loginctl_sources,
1383 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001384 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001385 dependencies : [threads,
1386 liblz4,
1387 libxz],
1388 install_rpath : rootlibexecdir,
1389 install : true,
1390 install_dir : rootbindir)
1391 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001392
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001393 exe = executable('systemd-inhibit',
1394 'src/login/inhibit.c',
1395 include_directories : includes,
1396 link_with : [libshared],
1397 install_rpath : rootlibexecdir,
1398 install : true,
1399 install_dir : rootbindir)
1400 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001401
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001402 if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001403 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1404 pam_systemd = shared_library(
1405 'pam_systemd',
1406 pam_systemd_c,
1407 name_prefix : '',
1408 include_directories : includes,
1409 link_args : ['-shared',
1410 '-Wl,--version-script=' + version_script_arg],
1411 link_with : [libsystemd_internal,
1412 libshared_static],
1413 dependencies : [threads,
1414 libpam,
1415 libpam_misc],
1416 link_depends : pam_systemd_sym,
1417 install : true,
1418 install_dir : pamlibdir)
1419
1420 test('dlopen-pam_systemd',
1421 test_dlopen,
1422 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1423 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001424endif
1425
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001426if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001427 executable('systemd-user-sessions',
1428 'src/user-sessions/user-sessions.c',
1429 include_directories : includes,
1430 link_with : [libshared],
1431 install_rpath : rootlibexecdir,
1432 install : true,
1433 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001434endif
1435
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001436if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001437 exe = executable('bootctl',
1438 'src/boot/bootctl.c',
1439 include_directories : includes,
1440 link_with : [libshared],
1441 dependencies : [libblkid],
1442 install_rpath : rootlibexecdir,
1443 install : true)
1444 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001445endif
1446
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001447exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1448 include_directories : includes,
1449 link_with : [libshared],
1450 dependencies : [threads],
1451 install_rpath : rootlibexecdir,
1452 install : true)
1453public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001454
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001455exe = executable('systemctl', 'src/systemctl/systemctl.c',
1456 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001457 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001458 dependencies : [threads,
1459 libcap,
1460 libselinux,
1461 libxz,
1462 liblz4],
1463 install_rpath : rootlibexecdir,
1464 install : true,
1465 install_dir : rootbindir)
1466public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001467
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001468if conf.get('ENABLE_BACKLIGHT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001469 executable('systemd-backlight',
1470 'src/backlight/backlight.c',
1471 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001472 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001473 install_rpath : rootlibexecdir,
1474 install : true,
1475 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001476endif
1477
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001478if conf.get('ENABLE_RFKILL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001479 executable('systemd-rfkill',
1480 'src/rfkill/rfkill.c',
1481 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001482 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001483 install_rpath : rootlibexecdir,
1484 install : true,
1485 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001486endif
1487
1488executable('systemd-system-update-generator',
1489 'src/system-update-generator/system-update-generator.c',
1490 include_directories : includes,
1491 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001492 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001493 install : true,
1494 install_dir : systemgeneratordir)
1495
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001496if conf.get('HAVE_LIBCRYPTSETUP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001497 executable('systemd-cryptsetup',
1498 'src/cryptsetup/cryptsetup.c',
1499 include_directories : includes,
1500 link_with : [libshared],
1501 dependencies : [libcryptsetup],
1502 install_rpath : rootlibexecdir,
1503 install : true,
1504 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001505
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001506 executable('systemd-cryptsetup-generator',
1507 'src/cryptsetup/cryptsetup-generator.c',
1508 include_directories : includes,
1509 link_with : [libshared],
1510 dependencies : [libcryptsetup],
1511 install_rpath : rootlibexecdir,
1512 install : true,
1513 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001514
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001515 executable('systemd-veritysetup',
1516 'src/veritysetup/veritysetup.c',
1517 include_directories : includes,
1518 link_with : [libshared],
1519 dependencies : [libcryptsetup],
1520 install_rpath : rootlibexecdir,
1521 install : true,
1522 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001523
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001524 executable('systemd-veritysetup-generator',
1525 'src/veritysetup/veritysetup-generator.c',
1526 include_directories : includes,
1527 link_with : [libshared],
1528 dependencies : [libcryptsetup],
1529 install_rpath : rootlibexecdir,
1530 install : true,
1531 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001532endif
1533
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001534if conf.get('HAVE_SYSV_COMPAT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001535 executable('systemd-sysv-generator',
1536 'src/sysv-generator/sysv-generator.c',
1537 include_directories : includes,
1538 link_with : [libshared],
1539 install_rpath : rootlibexecdir,
1540 install : true,
1541 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001542
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001543 executable('systemd-rc-local-generator',
1544 'src/rc-local-generator/rc-local-generator.c',
1545 include_directories : includes,
1546 link_with : [libshared],
1547 install_rpath : rootlibexecdir,
1548 install : true,
1549 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001550endif
1551
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001552if conf.get('ENABLE_HOSTNAMED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001553 executable('systemd-hostnamed',
1554 'src/hostname/hostnamed.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001555 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001556 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001557 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001558 install : true,
1559 install_dir : rootlibexecdir)
1560
1561 exe = executable('hostnamectl',
1562 'src/hostname/hostnamectl.c',
1563 include_directories : includes,
1564 link_with : [libshared],
1565 install_rpath : rootlibexecdir,
1566 install : true)
1567 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001568endif
1569
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001570if conf.get('ENABLE_LOCALED', false)
1571 if conf.get('HAVE_XKBCOMMON', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001572 # logind will load libxkbcommon.so dynamically on its own
1573 deps = [libdl]
1574 else
1575 deps = []
1576 endif
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -04001577
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001578 executable('systemd-localed',
1579 systemd_localed_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001580 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001581 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001582 dependencies : deps,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001583 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001584 install : true,
1585 install_dir : rootlibexecdir)
1586
1587 exe = executable('localectl',
1588 localectl_sources,
1589 include_directories : includes,
1590 link_with : [libshared],
1591 install_rpath : rootlibexecdir,
1592 install : true)
1593 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001594endif
1595
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001596if conf.get('ENABLE_TIMEDATED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001597 executable('systemd-timedated',
1598 'src/timedate/timedated.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001599 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001600 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001601 install_rpath : rootlibexecdir,
1602 install : true,
1603 install_dir : rootlibexecdir)
1604
1605 exe = executable('timedatectl',
1606 'src/timedate/timedatectl.c',
1607 include_directories : includes,
1608 install_rpath : rootlibexecdir,
1609 link_with : [libshared],
1610 install : true)
1611 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001612endif
1613
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001614if conf.get('ENABLE_TIMESYNCD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001615 executable('systemd-timesyncd',
1616 systemd_timesyncd_sources,
1617 include_directories : includes,
1618 link_with : [libshared],
1619 dependencies : [threads,
1620 libm],
1621 install_rpath : rootlibexecdir,
1622 install : true,
1623 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001624endif
1625
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001626if conf.get('ENABLE_MACHINED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001627 executable('systemd-machined',
1628 systemd_machined_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001629 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001630 link_with : [libmachine_core,
1631 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001632 install_rpath : rootlibexecdir,
1633 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001634 install_dir : rootlibexecdir)
1635
1636 exe = executable('machinectl',
1637 'src/machine/machinectl.c',
1638 include_directories : includes,
1639 link_with : [libshared],
1640 dependencies : [threads,
1641 libxz,
1642 liblz4],
1643 install_rpath : rootlibexecdir,
1644 install : true,
1645 install_dir : rootbindir)
1646 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001647endif
1648
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001649if conf.get('ENABLE_IMPORTD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001650 executable('systemd-importd',
1651 systemd_importd_sources,
1652 include_directories : includes,
1653 link_with : [libshared],
1654 dependencies : [threads],
1655 install_rpath : rootlibexecdir,
1656 install : true,
1657 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001658
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001659 systemd_pull = executable('systemd-pull',
1660 systemd_pull_sources,
1661 include_directories : includes,
1662 link_with : [libshared],
1663 dependencies : [libcurl,
1664 libz,
1665 libbzip2,
1666 libxz,
1667 libgcrypt],
1668 install_rpath : rootlibexecdir,
1669 install : true,
1670 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001671
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001672 systemd_import = executable('systemd-import',
1673 systemd_import_sources,
1674 include_directories : includes,
1675 link_with : [libshared],
1676 dependencies : [libcurl,
1677 libz,
1678 libbzip2,
1679 libxz],
1680 install_rpath : rootlibexecdir,
1681 install : true,
1682 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001683
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001684 systemd_export = executable('systemd-export',
1685 systemd_export_sources,
1686 include_directories : includes,
1687 link_with : [libshared],
1688 dependencies : [libcurl,
1689 libz,
1690 libbzip2,
1691 libxz],
1692 install_rpath : rootlibexecdir,
1693 install : true,
1694 install_dir : rootlibexecdir)
1695 public_programs += [systemd_pull, systemd_import, systemd_export]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001696endif
1697
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001698if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001699 exe = executable('systemd-journal-upload',
1700 systemd_journal_upload_sources,
1701 include_directories : includes,
1702 link_with : [libshared],
1703 dependencies : [threads,
1704 libcurl,
1705 libgnutls,
1706 libxz,
1707 liblz4],
1708 install_rpath : rootlibexecdir,
1709 install : true,
1710 install_dir : rootlibexecdir)
1711 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001712endif
1713
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001714if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001715 s_j_remote = executable('systemd-journal-remote',
1716 systemd_journal_remote_sources,
1717 include_directories : includes,
1718 link_with : [libshared],
1719 dependencies : [threads,
1720 libmicrohttpd,
1721 libgnutls,
1722 libxz,
1723 liblz4],
1724 install_rpath : rootlibexecdir,
1725 install : true,
1726 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001727
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001728 s_j_gatewayd = executable('systemd-journal-gatewayd',
1729 systemd_journal_gatewayd_sources,
1730 include_directories : includes,
1731 link_with : [libshared],
1732 dependencies : [threads,
1733 libmicrohttpd,
1734 libgnutls,
1735 libxz,
1736 liblz4],
1737 install_rpath : rootlibexecdir,
1738 install : true,
1739 install_dir : rootlibexecdir)
1740 public_programs += [s_j_remote, s_j_gatewayd]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001741endif
1742
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001743if conf.get('ENABLE_COREDUMP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001744 executable('systemd-coredump',
1745 systemd_coredump_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001746 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001747 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001748 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001749 libacl,
1750 libdw,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001751 libxz,
1752 liblz4],
1753 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001754 install : true,
1755 install_dir : rootlibexecdir)
1756
1757 exe = executable('coredumpctl',
1758 coredumpctl_sources,
1759 include_directories : includes,
1760 link_with : [libshared],
1761 dependencies : [threads,
1762 libxz,
1763 liblz4],
1764 install_rpath : rootlibexecdir,
1765 install : true)
1766 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001767endif
1768
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001769if conf.get('ENABLE_BINFMT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001770 exe = executable('systemd-binfmt',
1771 'src/binfmt/binfmt.c',
1772 include_directories : includes,
1773 link_with : [libshared],
1774 install_rpath : rootlibexecdir,
1775 install : true,
1776 install_dir : rootlibexecdir)
1777 public_programs += [exe]
1778
1779 meson.add_install_script('sh', '-c',
1780 mkdir_p.format(binfmtdir))
1781 meson.add_install_script('sh', '-c',
1782 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1783endif
1784
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001785if conf.get('ENABLE_VCONSOLE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001786 executable('systemd-vconsole-setup',
1787 'src/vconsole/vconsole-setup.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001788 include_directories : includes,
1789 link_with : [libshared],
1790 install_rpath : rootlibexecdir,
1791 install : true,
1792 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001793endif
1794
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001795if conf.get('ENABLE_RANDOMSEED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001796 executable('systemd-random-seed',
1797 'src/random-seed/random-seed.c',
1798 include_directories : includes,
1799 link_with : [libshared],
1800 install_rpath : rootlibexecdir,
1801 install : true,
1802 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001803endif
1804
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001805if conf.get('ENABLE_FIRSTBOOT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001806 executable('systemd-firstboot',
1807 'src/firstboot/firstboot.c',
1808 include_directories : includes,
1809 link_with : [libshared],
1810 dependencies : [libcrypt],
1811 install_rpath : rootlibexecdir,
1812 install : true,
1813 install_dir : rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001814endif
1815
1816executable('systemd-remount-fs',
1817 'src/remount-fs/remount-fs.c',
1818 'src/core/mount-setup.c',
1819 'src/core/mount-setup.h',
1820 include_directories : includes,
1821 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001822 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001823 install : true,
1824 install_dir : rootlibexecdir)
1825
1826executable('systemd-machine-id-setup',
1827 'src/machine-id-setup/machine-id-setup-main.c',
1828 'src/core/machine-id-setup.c',
1829 'src/core/machine-id-setup.h',
1830 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001831 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001832 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001833 install : true,
1834 install_dir : rootbindir)
1835
1836executable('systemd-fsck',
1837 'src/fsck/fsck.c',
1838 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001839 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001840 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001841 install : true,
1842 install_dir : rootlibexecdir)
1843
1844executable('systemd-sleep',
1845 'src/sleep/sleep.c',
1846 include_directories : includes,
1847 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001848 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001849 install : true,
1850 install_dir : rootlibexecdir)
1851
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001852exe = executable('systemd-sysctl',
1853 'src/sysctl/sysctl.c',
1854 include_directories : includes,
1855 link_with : [libshared],
1856 install_rpath : rootlibexecdir,
1857 install : true,
1858 install_dir : rootlibexecdir)
1859public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001860
1861executable('systemd-ac-power',
1862 'src/ac-power/ac-power.c',
1863 include_directories : includes,
1864 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001865 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001866 install : true,
1867 install_dir : rootlibexecdir)
1868
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001869exe = executable('systemd-detect-virt',
1870 'src/detect-virt/detect-virt.c',
1871 include_directories : includes,
1872 link_with : [libshared],
1873 install_rpath : rootlibexecdir,
1874 install : true)
1875public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001876
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001877exe = executable('systemd-delta',
1878 'src/delta/delta.c',
1879 include_directories : includes,
1880 link_with : [libshared],
1881 install_rpath : rootlibexecdir,
1882 install : true)
1883public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001884
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001885exe = executable('systemd-escape',
1886 'src/escape/escape.c',
1887 include_directories : includes,
1888 link_with : [libshared],
1889 install_rpath : rootlibexecdir,
1890 install : true,
1891 install_dir : rootbindir)
1892public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001893
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001894exe = executable('systemd-notify',
1895 'src/notify/notify.c',
1896 include_directories : includes,
1897 link_with : [libshared],
1898 install_rpath : rootlibexecdir,
1899 install : true,
1900 install_dir : rootbindir)
1901public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001902
1903executable('systemd-volatile-root',
1904 'src/volatile-root/volatile-root.c',
1905 include_directories : includes,
1906 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001907 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001908 install : true,
1909 install_dir : rootlibexecdir)
1910
1911executable('systemd-cgroups-agent',
1912 'src/cgroups-agent/cgroups-agent.c',
1913 include_directories : includes,
1914 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001915 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001916 install : true,
1917 install_dir : rootlibexecdir)
1918
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001919exe = executable('systemd-path',
1920 'src/path/path.c',
1921 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001922 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001923 install_rpath : rootlibexecdir,
1924 install : true)
1925public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001926
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001927exe = executable('systemd-ask-password',
1928 'src/ask-password/ask-password.c',
1929 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001930 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001931 install_rpath : rootlibexecdir,
1932 install : true,
1933 install_dir : rootbindir)
1934public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001935
1936executable('systemd-reply-password',
1937 'src/reply-password/reply-password.c',
1938 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001939 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001940 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001941 install : true,
1942 install_dir : rootlibexecdir)
1943
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001944exe = executable('systemd-tty-ask-password-agent',
1945 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1946 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001947 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001948 install_rpath : rootlibexecdir,
1949 install : true,
1950 install_dir : rootbindir)
1951public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001952
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001953exe = executable('systemd-cgls',
1954 'src/cgls/cgls.c',
1955 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001956 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001957 install_rpath : rootlibexecdir,
1958 install : true)
1959public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001960
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001961exe = executable('systemd-cgtop',
1962 'src/cgtop/cgtop.c',
1963 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001964 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001965 install_rpath : rootlibexecdir,
1966 install : true)
1967public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001968
1969executable('systemd-initctl',
1970 'src/initctl/initctl.c',
1971 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001972 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001973 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001974 install : true,
1975 install_dir : rootlibexecdir)
1976
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001977exe = executable('systemd-mount',
1978 'src/mount/mount-tool.c',
1979 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001980 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001981 install_rpath : rootlibexecdir,
1982 install : true)
1983public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001984
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001985meson.add_install_script(meson_make_symlink,
Michael Bieble17e5ba2017-04-13 10:30:56 -04001986 'systemd-mount', join_paths(bindir, 'systemd-umount'))
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001987
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001988exe = executable('systemd-run',
1989 'src/run/run.c',
1990 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001991 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001992 install_rpath : rootlibexecdir,
1993 install : true)
1994public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001995
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001996exe = executable('systemd-stdio-bridge',
1997 'src/stdio-bridge/stdio-bridge.c',
1998 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001999 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002000 install_rpath : rootlibexecdir,
2001 install : true)
2002public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002003
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002004exe = executable('busctl',
2005 'src/busctl/busctl.c',
2006 'src/busctl/busctl-introspect.c',
2007 'src/busctl/busctl-introspect.h',
2008 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002009 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002010 install_rpath : rootlibexecdir,
2011 install : true)
2012public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002013
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002014if conf.get('ENABLE_SYSUSERS', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002015 exe = executable('systemd-sysusers',
2016 'src/sysusers/sysusers.c',
2017 include_directories : includes,
2018 link_with : [libshared],
2019 install_rpath : rootlibexecdir,
2020 install : true,
2021 install_dir : rootbindir)
2022 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002023endif
2024
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002025if conf.get('ENABLE_TMPFILES', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002026 exe = executable('systemd-tmpfiles',
2027 'src/tmpfiles/tmpfiles.c',
2028 include_directories : includes,
2029 link_with : [libshared],
2030 dependencies : [libacl],
2031 install_rpath : rootlibexecdir,
2032 install : true,
2033 install_dir : rootbindir)
2034 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002035endif
2036
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002037if conf.get('ENABLE_HWDB', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002038 exe = executable('systemd-hwdb',
2039 'src/hwdb/hwdb.c',
2040 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2041 include_directories : includes,
Michael Biebl0da6f392017-04-21 18:32:14 +02002042 link_with : [libudev_internal],
2043 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002044 install : true,
2045 install_dir : rootbindir)
2046 public_programs += [exe]
2047endif
2048
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002049if conf.get('ENABLE_QUOTACHECK', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002050 executable('systemd-quotacheck',
2051 'src/quotacheck/quotacheck.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002052 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002053 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002054 install_rpath : rootlibexecdir,
2055 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002056 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002057endif
2058
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002059exe = executable('systemd-socket-proxyd',
2060 'src/socket-proxy/socket-proxyd.c',
2061 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002062 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002063 dependencies : [threads],
2064 install_rpath : rootlibexecdir,
2065 install : true,
2066 install_dir : rootlibexecdir)
2067public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002068
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002069exe = executable('systemd-udevd',
2070 systemd_udevd_sources,
2071 include_directories : includes,
2072 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002073 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002074 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002075 dependencies : [threads,
2076 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002077 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002078 libacl,
2079 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002080 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002081 install : true,
2082 install_dir : rootlibexecdir)
2083public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002084
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002085exe = executable('udevadm',
2086 udevadm_sources,
2087 include_directories : includes,
2088 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002089 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002090 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002091 dependencies : [threads,
2092 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002093 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002094 libacl,
2095 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002096 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002097 install : true,
2098 install_dir : rootbindir)
2099public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002100
2101executable('systemd-shutdown',
2102 systemd_shutdown_sources,
2103 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02002104 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002105 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002106 install : true,
2107 install_dir : rootlibexecdir)
2108
2109executable('systemd-update-done',
2110 'src/update-done/update-done.c',
2111 include_directories : includes,
2112 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002113 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002114 install : true,
2115 install_dir : rootlibexecdir)
2116
2117executable('systemd-update-utmp',
2118 'src/update-utmp/update-utmp.c',
2119 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002120 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002121 dependencies : [libaudit],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002122 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002123 install : true,
2124 install_dir : rootlibexecdir)
2125
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002126if conf.get('HAVE_KMOD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002127 executable('systemd-modules-load',
2128 'src/modules-load/modules-load.c',
2129 include_directories : includes,
2130 link_with : [libshared],
2131 dependencies : [libkmod],
2132 install_rpath : rootlibexecdir,
2133 install : true,
2134 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002135
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002136 meson.add_install_script('sh', '-c',
2137 mkdir_p.format(modulesloaddir))
2138 meson.add_install_script('sh', '-c',
2139 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002140endif
2141
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002142exe = executable('systemd-nspawn',
2143 systemd_nspawn_sources,
2144 'src/core/mount-setup.c', # FIXME: use a variable?
2145 'src/core/mount-setup.h',
2146 'src/core/loopback-setup.c',
2147 'src/core/loopback-setup.h',
2148 include_directories : [includes, include_directories('src/nspawn')],
Zbigniew Jędrzejewski-Szmek0bc91152017-04-27 13:39:54 -04002149 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002150 dependencies : [libacl,
2151 libblkid,
2152 libseccomp,
2153 libselinux],
2154 install_rpath : rootlibexecdir,
2155 install : true)
2156public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002157
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002158if conf.get('ENABLE_NETWORKD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002159 executable('systemd-networkd',
2160 systemd_networkd_sources,
2161 include_directories : includes,
2162 link_with : [libnetworkd_core,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002163 libsystemd_network,
2164 libudev_internal,
2165 libshared],
2166 install_rpath : rootlibexecdir,
2167 install : true,
2168 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002169
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002170 executable('systemd-networkd-wait-online',
2171 systemd_networkd_wait_online_sources,
2172 include_directories : includes,
2173 link_with : [libnetworkd_core,
2174 libshared],
2175 install_rpath : rootlibexecdir,
2176 install : true,
2177 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmekf0bd7cc2017-04-12 12:14:30 -04002178endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002179
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002180exe = executable('networkctl',
2181 networkctl_sources,
2182 include_directories : includes,
2183 link_with : [libsystemd_network,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002184 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002185 install_rpath : rootlibexecdir,
2186 install : true,
2187 install_dir : rootbindir)
2188public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002189
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002190############################################################
2191
2192foreach tuple : tests
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002193 sources = tuple[0]
2194 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2195 dependencies = tuple[2]
2196 condition = tuple.length() >= 4 ? tuple[3] : ''
2197 type = tuple.length() >= 5 ? tuple[4] : ''
2198 defs = tuple.length() >= 6 ? tuple[5] : []
2199 incs = tuple.length() >= 7 ? tuple[6] : includes
2200 timeout = 30
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002201
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002202 name = sources[0].split('/')[-1].split('.')[0]
2203 if type.startswith('timeout=')
2204 timeout = type.split('=')[1].to_int()
2205 type = ''
2206 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002207
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002208 if condition == '' or conf.get(condition, false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002209 install = install_tests and type == ''
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04002210
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002211 exe = executable(
2212 name,
2213 sources,
2214 include_directories : incs,
2215 link_with : link_with,
2216 dependencies : dependencies,
2217 c_args : defs,
2218 install_rpath : rootlibexecdir,
2219 install : install,
2220 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04002221
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002222 if type == 'manual'
2223 message('@0@ is a manual test'.format(name))
2224 elif type == 'unsafe' and want_tests != 'unsafe'
2225 message('@0@ is an unsafe test'.format(name))
2226 else
2227 test(name, exe,
2228 env : test_env,
2229 timeout : timeout)
2230 endif
2231 else
2232 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2233 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002234endforeach
2235
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002236test_libsystemd_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002237 'test-libsystemd-sym',
2238 test_libsystemd_sym_c,
2239 include_directories : includes,
2240 link_with : [libsystemd],
2241 install : install_tests,
2242 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002243test('test-libsystemd-sym',
2244 test_libsystemd_sym)
2245
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002246test_libudev_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002247 'test-libudev-sym',
2248 test_libudev_sym_c,
2249 include_directories : includes,
2250 c_args : ['-Wno-deprecated-declarations'],
2251 link_with : [libudev],
2252 install : install_tests,
2253 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002254test('test-libudev-sym',
2255 test_libudev_sym)
2256
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002257############################################################
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002258
2259make_directive_index_py = find_program('tools/make-directive-index.py')
2260make_man_index_py = find_program('tools/make-man-index.py')
Zbigniew Jędrzejewski-Szmekb184e8f2017-04-13 19:59:21 -04002261xml_helper_py = find_program('tools/xml_helper.py')
Zbigniew Jędrzejewski-Szmekabba22c2017-04-15 00:40:59 -04002262hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002263
2264subdir('units')
2265subdir('sysctl.d')
2266subdir('sysusers.d')
2267subdir('tmpfiles.d')
2268subdir('rules')
2269subdir('hwdb')
2270subdir('network')
2271subdir('man')
2272subdir('shell-completion/bash')
2273subdir('shell-completion/zsh')
2274subdir('docs/sysvinit')
2275subdir('docs/var-log')
2276
2277# FIXME: figure out if the warning is true:
2278# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2279install_subdir('factory/etc',
2280 install_dir : factorydir)
2281
2282
2283install_data('xorg/50-systemd-user.sh',
2284 install_dir : xinitrcdir)
2285install_data('system-preset/90-systemd.preset',
2286 install_dir : systempresetdir)
2287install_data('README',
2288 'NEWS',
2289 'CODING_STYLE',
2290 'DISTRO_PORTING',
2291 'ENVIRONMENT.md',
2292 'LICENSE.GPL2',
2293 'LICENSE.LGPL2.1',
2294 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2295 install_dir : docdir)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002296
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002297meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2298meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2299
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002300############################################################
2301
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002302meson_check_help = find_program('tools/meson-check-help.sh')
2303
2304foreach exec : public_programs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002305 name = exec.full_path().split('/')[-1]
2306 test('check-help-' + name,
2307 meson_check_help,
2308 args : [exec.full_path()])
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002309endforeach
2310
2311############################################################
2312
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002313if git.found() and etags.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002314 all_files = run_command(
2315 git,
2316 ['--git-dir=@0@/.git'.format(meson.source_root()),
2317 'ls-files',
2318 ':/*.[ch]'])
2319 all_files = files(all_files.stdout().split())
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002320
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002321 custom_target(
2322 'TAGS',
2323 output : 'TAGS',
2324 input : all_files,
2325 command : [etags, '-o', '@OUTPUT@'] + all_files)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002326endif
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002327
2328if git.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002329 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
Zbigniew Jędrzejewski-Szmeka923e082017-04-17 19:48:20 -04002330 run_target(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002331 'git-contrib',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002332 command : [meson_git_contrib_sh])
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002333endif
Zbigniew Jędrzejewski-Szmekdd6ab3d2017-04-24 19:28:05 -04002334
2335if git.found()
2336 git_head = run_command(
2337 git,
2338 ['--git-dir=@0@/.git'.format(meson.source_root()),
2339 'rev-parse', 'HEAD']).stdout().strip()
2340 git_head_short = run_command(
2341 git,
2342 ['--git-dir=@0@/.git'.format(meson.source_root()),
2343 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2344
2345 run_target(
2346 'git-snapshot',
2347 command : ['git', 'archive',
2348 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.source_root(),
2349 git_head_short),
2350 '--prefix', 'systemd-@0@/'.format(git_head),
2351 'HEAD'])
2352endif
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002353
2354############################################################
2355
2356status = [
2357 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2358
2359 'prefix: @0@'.format(prefixdir),
2360 'rootprefix: @0@'.format(rootprefixdir),
2361 'sysconf dir: @0@'.format(sysconfdir),
2362 'includedir: @0@'.format(includedir),
2363 'lib dir: @0@'.format(libdir),
2364 'rootlib dir: @0@'.format(rootlibdir),
2365 'SysV init scripts: @0@'.format(sysvinit_path),
2366 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2367 'PAM modules dir: @0@'.format(pamlibdir),
2368 'PAM configuration dir: @0@'.format(pamconfdir),
2369 'RPM macros dir: @0@'.format(rpmmacrosdir),
2370 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2371 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2372 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2373 'bash completions dir: @0@'.format(bashcompletiondir),
2374 'zsh completions dir: @0@'.format(zshcompletiondir),
2375 'extra start script: @0@'.format(get_option('rc-local')),
2376 'extra stop script: @0@'.format(get_option('halt-local')),
2377 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2378 get_option('debug-tty')),
2379 'TTY GID: @0@'.format(tty_gid),
2380 'maximum system UID: @0@'.format(system_uid_max),
2381 'maximum system GID: @0@'.format(system_gid_max),
2382 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2383 'certificate root: @0@'.format(get_option('certificate-root')),
2384 'support URL: @0@'.format(support_url),
2385 'nobody user name: @0@'.format(get_option('nobody-user')),
2386 'nobody group name: @0@'.format(get_option('nobody-group')),
2387 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2388
2389 'default DNSSEC mode: @0@'.format(default_dnssec),
2390 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2391 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2392
2393alt_dns_servers = '\n '.join(dns_servers.split(' '))
2394alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2395status += [
2396 'default DNS servers: @0@'.format(alt_dns_servers),
2397 'default NTP servers: @0@'.format(alt_ntp_servers)]
2398
2399alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2400 '@@0@'.format(time_epoch)).stdout().strip()
2401status += [
2402 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2403
2404# TODO:
2405# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2406# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2407# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2408
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002409if conf.get('ENABLE_EFI', false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002410 status += [
2411 'efi arch: @0@'.format(efi_arch)]
2412
2413 if have_gnu_efi
2414 status += [
2415 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2416 'EFI CC @0@'.format(efi_cc),
2417 'EFI libdir: @0@'.format(efi_libdir),
2418 'EFI ldsdir: @0@'.format(efi_ldsdir),
2419 'EFI includedir: @0@'.format(efi_incdir)]
2420 endif
2421endif
2422
2423found = []
2424missing = []
2425
2426foreach tuple : [
2427 ['libcryptsetup'],
2428 ['PAM'],
2429 ['AUDIT'],
2430 ['IMA'],
2431 ['AppArmor'],
2432 ['SELinux'],
2433 ['SECCOMP'],
2434 ['SMACK'],
2435 ['zlib'],
2436 ['xz'],
2437 ['lz4'],
2438 ['bzip2'],
2439 ['ACL'],
2440 ['gcrypt'],
2441 ['qrencode'],
2442 ['microhttpd'],
2443 ['gnutls'],
2444 ['libcurl'],
Zbigniew Jędrzejewski-Szmek87057e22017-05-09 21:56:34 -04002445 ['libidn2'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002446 ['libidn'],
2447 ['libiptc'],
2448 ['elfutils'],
2449 ['binfmt'],
2450 ['vconsole'],
2451 ['quotacheck'],
2452 ['tmpfiles'],
2453 ['environment.d'],
2454 ['sysusers'],
2455 ['firstboot'],
2456 ['randomseed'],
2457 ['backlight'],
2458 ['rfkill'],
2459 ['logind'],
2460 ['machined'],
2461 ['importd'],
2462 ['hostnamed'],
2463 ['timedated'],
2464 ['timesyncd'],
2465 ['localed'],
2466 ['networkd'],
2467 ['resolved'],
2468 ['coredump'],
2469 ['polkit'],
2470 ['legacy pkla', install_polkit_pkla],
2471 ['efi'],
2472 ['gnu-efi', have_gnu_efi],
2473 ['kmod'],
2474 ['xkbcommon'],
2475 ['blkid'],
2476 ['dbus'],
2477 ['glib'],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002478 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002479 ['hwdb'],
2480 ['tpm'],
2481 ['man pages', want_man],
2482 ['html pages', want_html],
2483 ['man page indices', want_man and have_lxml],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002484 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002485 ['SysV compat'],
2486 ['utmp'],
2487 ['ldconfig'],
2488 ['hibernate'],
2489 ['adm group', get_option('adm-group')],
2490 ['wheel group', get_option('wheel-group')],
Franck Buib14e1b42017-05-09 14:02:37 +02002491 ['gshadow'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002492 ['debug hashmap'],
2493 ['debug mmap cache'],
2494]
2495
2496 cond = tuple.get(1, '')
2497 if cond == ''
2498 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2499 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002500 cond = conf.get(ident1, false) or conf.get(ident2, false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002501 endif
2502 if cond
2503 found += [tuple[0]]
2504 else
2505 missing += [tuple[0]]
2506 endif
2507endforeach
2508
2509status += [
2510 'enabled features: @0@'.format(', '.join(found)),
2511 'disabled features: @0@'.format(', '.join(missing))]
2512message('\n '.join(status))