blob: 407d7ea08eff7913e9e87dfcb71faefe61f6e49b [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
Zbigniew Jędrzejewski-Szmek94e25232017-05-13 13:23:28 -0400227cxx = find_program('c++', required : false)
228if cxx.found()
229 # Used only for tests
230 add_languages('cpp')
231endif
232
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400233foreach arg : ['-Wundef',
234 '-Wlogical-op',
235 '-Wmissing-include-dirs',
236 '-Wold-style-definition',
237 '-Wpointer-arith',
238 '-Winit-self',
239 '-Wdeclaration-after-statement',
240 '-Wfloat-equal',
241 '-Wsuggest-attribute=noreturn',
242 '-Werror=missing-prototypes',
243 '-Werror=implicit-function-declaration',
244 '-Werror=missing-declarations',
245 '-Werror=return-type',
246 '-Werror=incompatible-pointer-types',
247 '-Werror=format=2',
248 '-Wstrict-prototypes',
249 '-Wredundant-decls',
250 '-Wmissing-noreturn',
251 '-Wshadow',
252 '-Wendif-labels',
253 '-Wstrict-aliasing=2',
254 '-Wwrite-strings',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400255 '-Werror=overflow',
256 '-Wdate-time',
257 '-Wnested-externs',
258 '-ffast-math',
259 '-fno-common',
260 '-fdiagnostics-show-option',
261 '-fno-strict-aliasing',
262 '-fvisibility=hidden',
263 '-fstack-protector',
264 '-fstack-protector-strong',
265 '-fPIE',
266 '--param=ssp-buffer-size=4',
267 ]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400268 if cc.has_argument(arg)
269 add_project_arguments(arg, language : 'c')
270 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400271endforeach
272
Zbigniew Jędrzejewski-Szmek2c5434a2017-04-27 10:05:41 -0400273# "negative" arguments: gcc on purpose does not return an error for "-Wno-"
274# arguments, just emits a warnings. So test for the "positive" version instead.
275foreach arg : ['unused-parameter',
276 'missing-field-initializers',
277 'unused-result',
278 'format-signedness']
279 if cc.has_argument('-W' + arg)
280 add_project_arguments('-Wno-' + arg, language : 'c')
281 endif
282endforeach
283
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400284if cc.compiles('
285 #include <time.h>
286 #include <inttypes.h>
287 typedef uint64_t usec_t;
288 usec_t now(clockid_t clock);
289 int main(void) {
290 struct timespec now;
291 return 0;
292 }
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400293', name : '-Werror=shadow with local shadowing')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400294 add_project_arguments('-Werror=shadow', language : 'c')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400295endif
296
297if cc.get_id() == 'clang'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400298 foreach arg : ['-Wno-typedef-redefinition',
299 '-Wno-gnu-variable-sized-type-not-at-end',
300 ]
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400301 if cc.has_argument(arg,
302 name : '@0@ is supported'.format(arg))
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400303 add_project_arguments(arg, language : 'c')
304 endif
305 endforeach
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400306endif
307
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400308link_test_c = files('tools/meson-link-test.c')
309
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400310# --as-needed and --no-undefined are provided by meson by default,
311# run mesonconf to see what is enabled
312foreach arg : ['-Wl,-z,relro',
313 '-Wl,-z,now',
314 '-pie',
315 '-Wl,-fuse-ld=gold',
316 ]
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400317
318 have = run_command(check_compilation_sh,
319 cc.cmd_array(), '-x', 'c', arg,
320 '-include', link_test_c).returncode() == 0
321 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
322 if have
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400323 add_project_link_arguments(arg, language : 'c')
324 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400325endforeach
326
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400327if get_option('buildtype') != 'debug'
328 foreach arg : ['-ffunction-sections',
329 '-fdata-sections']
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400330 if cc.has_argument(arg,
331 name : '@0@ is supported'.format(arg))
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400332 add_project_arguments(arg, language : 'c')
333 endif
334 endforeach
335
336 foreach arg : ['-Wl,--gc-sections']
Zbigniew Jędrzejewski-Szmek6e2afb12017-04-24 21:03:35 -0400337 have = run_command(check_compilation_sh,
338 cc.cmd_array(), '-x', 'c', arg,
339 '-include', link_test_c).returncode() == 0
340 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
341 if have
Zbigniew Jędrzejewski-Szmek41afb5e2017-04-24 19:28:04 -0400342 add_project_link_arguments(arg, language : 'c')
343 endif
344 endforeach
345endif
346
Zbigniew Jędrzejewski-Szmek9cc0e6e2017-04-11 10:25:34 -0400347cpp = ' '.join(cc.cmd_array()) + ' -E'
348
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400349#####################################################################
350# compilation result tests
351
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400352conf.set('_GNU_SOURCE', true)
353conf.set('__SANE_USERSPACE_TYPES__', true)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400354
355conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
356conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
357conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
358conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
359conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
360conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
361conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
362
363decl_headers = '''
364#include <uchar.h>
365#include <linux/ethtool.h>
366'''
367# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
368
369foreach decl : ['char16_t',
370 'char32_t',
371 'key_serial_t',
372 'struct ethtool_link_settings',
373 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400374
375 # We get -1 if the size cannot be determined
376 have = cc.sizeof(decl, prefix : decl_headers) > 0
377 conf.set('HAVE_' + decl.underscorify().to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400378endforeach
379
380foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
381 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
382 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
383 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
384 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
385 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
386 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
387 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
388 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
389 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
Susant Sahani9dfed8d2017-04-25 20:30:34 +0530390 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400391 # if_tunnel.h is buggy and cannot be included on its own
392 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
393 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
394 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
395 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
396 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
397 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
398 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
399 ['NDA_IFINDEX', 'linux/neighbour.h'],
400 ['IFA_FLAGS', 'linux/if_addr.h'],
401 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
402 ]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400403 prefix = decl.length() > 2 ? decl[2] : ''
404 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
405 conf.set10('HAVE_DECL_' + decl[0], have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400406endforeach
407
408skip = false
409foreach ident : ['secure_getenv', '__secure_getenv']
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400410 if not skip and cc.has_function(ident)
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400411 conf.set('HAVE_' + ident.to_upper(), true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400412 skip = true
413 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400414endforeach
415
416foreach ident : [
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400417 ['memfd_create', '''#include <sys/memfd.h>'''],
418 ['gettid', '''#include <sys/types.h>'''],
419 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
420 ['name_to_handle_at', '''#define _GNU_SOURCE
421 #include <sys/types.h>
422 #include <sys/stat.h>
423 #include <fcntl.h>'''],
424 ['setns', '''#define _GNU_SOURCE
425 #include <sched.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400426 ['renameat2', '''#include <stdio.h>'''],
427 ['kcmp', '''#include <linux/kcmp.h>'''],
428 ['keyctl', '''#include <sys/types.h>
429 #include <keyutils.h>'''],
430 ['copy_file_range', '''#include <sys/syscall.h>
431 #include <unistd.h>'''],
Zbigniew Jędrzejewski-Szmek38f1ae02017-04-19 16:14:16 -0400432 ['explicit_bzero' , '''#include <string.h>'''],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400433]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400434
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400435 have = cc.has_function(ident[0], prefix : ident[1])
436 conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400437endforeach
438
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400439if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400440 conf.set('USE_SYS_RANDOM_H', true)
441 conf.set10('HAVE_DECL_GETRANDOM', true)
Zbigniew Jędrzejewski-Szmek4984c8b2017-04-19 21:20:54 -0400442else
443 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
444 conf.set10('HAVE_DECL_GETRANDOM', have)
445endif
446
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400447#####################################################################
448
449sed = find_program('sed')
450grep = find_program('grep')
451awk = find_program('awk')
Zbigniew Jędrzejewski-Szmekd730e2d2017-04-25 08:49:58 -0400452m4 = find_program('m4')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400453stat = find_program('stat')
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -0400454git = find_program('git', required : false)
455etags = find_program('etags', required : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400456
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -0400457meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400458mkdir_p = 'mkdir -p $DESTDIR/@0@'
Zbigniew Jędrzejewski-Szmekd83f4f52017-04-16 12:04:46 -0400459test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
460splash_bmp = files('test/splash.bmp')
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -0400461
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400462# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
463# /usr/sbin, /sbin, and fall back to the default from middle column.
464progs = [['telinit', '/lib/sysvinit/telinit'],
465 ['quotaon', '/usr/sbin/quotaon' ],
466 ['quotacheck', '/usr/sbin/quotacheck' ],
467 ['kill', '/usr/bin/kill' ],
468 ['kmod', '/usr/bin/kmod' ],
469 ['kexec', '/usr/sbin/kexec' ],
470 ['sulogin', '/usr/sbin/sulogin' ],
471 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
472 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
473 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
474 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
475 ]
476foreach prog : progs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400477 path = get_option(prog[0] + '-path')
478 if path != ''
479 message('Using @1@ for @0@'.format(prog[0], path))
480 else
481 exe = find_program(prog[0],
482 '/usr/sbin/' + prog[0],
483 '/sbin/' + prog[0],
484 required: false)
485 path = exe.found() ? exe.path() : prog[1]
486 endif
487 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
488 conf.set_quoted(name, path)
489 substs.set(name, path)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400490endforeach
491
Zbigniew Jędrzejewski-Szmek1276a9f2017-04-18 19:11:54 -0400492if run_command('ln', '--relative', '--help').returncode() != 0
493 error('ln does not support --relative')
494endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400495
496############################################################
497
498gperf = find_program('gperf')
499
500gperf_test_format = '''
501#include <string.h>
502const char * in_word_set(const char *, @0@);
503@1@
504'''
505gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
506gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
507gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
508if cc.compiles(gperf_test)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400509 gperf_len_type = 'size_t'
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400510else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400511 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
512 if cc.compiles(gperf_test)
513 gperf_len_type = 'unsigned'
514 else
515 error('unable to determine gperf len type')
516 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400517endif
518message('gperf len type is @0@'.format(gperf_len_type))
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400519conf.set('GPERF_LEN_TYPE', gperf_len_type,
520 description : 'The type of gperf "len" parameter')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400521
522############################################################
523
524if not cc.has_header('sys/capability.h')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400525 error('POSIX caps headers not found')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400526endif
527foreach header : ['linux/btrfs.h',
528 'linux/memfd.h',
529 'linux/vm_sockets.h',
530 'valgrind/memcheck.h',
531 'valgrind/valgrind.h',
532 ]
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400533
534 conf.set('HAVE_' + header.underscorify().to_upper(),
535 cc.has_header(header))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400536endforeach
537
538############################################################
539
540conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
541
542default_hierarchy = get_option('default-hierarchy')
543conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
544 description : 'default cgroup hierarchy as string')
545if default_hierarchy == 'legacy'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400546 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400547elif default_hierarchy == 'hybrid'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400548 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400549else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400550 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400551endif
552
553time_epoch = get_option('time-epoch')
554if time_epoch == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400555 NEWS = files('NEWS')
556 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400557endif
558time_epoch = time_epoch.to_int()
559conf.set('TIME_EPOCH', time_epoch)
560
561system_uid_max = get_option('system-uid-max')
562if system_uid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400563 system_uid_max = run_command(
564 awk,
565 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
566 '/etc/login.defs').stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400567endif
568system_uid_max = system_uid_max.to_int()
569conf.set('SYSTEM_UID_MAX', system_uid_max)
570substs.set('systemuidmax', system_uid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400571message('maximum system UID is @0@'.format(system_uid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400572
573conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
574conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
575
576system_gid_max = get_option('system-gid-max')
577if system_gid_max == ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400578 system_gid_max = run_command(
579 awk,
580 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
581 '/etc/login.defs').stdout()
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400582endif
583system_gid_max = system_gid_max.to_int()
584conf.set('SYSTEM_GID_MAX', system_gid_max)
585substs.set('systemgidmax', system_gid_max)
Zbigniew Jędrzejewski-Szmek7572aa82017-04-24 21:46:40 -0400586message('maximum system GID is @0@'.format(system_gid_max))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400587
588tty_gid = get_option('tty-gid')
589conf.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400590substs.set('TTY_GID', tty_gid)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400591
592if get_option('adm-group')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400593 m4_defines += ['-DENABLE_ADM_GROUP']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400594endif
595
596if get_option('wheel-group')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400597 m4_defines += ['-DENABLE_WHEEL_GROUP']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400598endif
599
600substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
601
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400602kill_user_processes = get_option('default-kill-user-processes')
603conf.set10('KILL_USER_PROCESSES', kill_user_processes)
604substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400605
606default_dnssec = get_option('default-dnssec')
607conf.set('DEFAULT_DNSSEC_MODE',
608 'DNSSEC_' + default_dnssec.underscorify().to_upper())
Zbigniew Jędrzejewski-Szmek2a4c1562017-04-12 19:54:33 -0400609substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400610
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400611dns_servers = get_option('dns-servers')
612conf.set_quoted('DNS_SERVERS', dns_servers)
613substs.set('DNS_SERVERS', dns_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400614
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -0400615ntp_servers = get_option('ntp-servers')
616conf.set_quoted('NTP_SERVERS', ntp_servers)
617substs.set('NTP_SERVERS', ntp_servers)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400618
619conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
620
Zbigniew Jędrzejewski-Szmek3131bfe2017-04-10 19:06:45 -0400621substs.set('SUSHELL', get_option('debug-shell'))
622substs.set('DEBUGTTY', get_option('debug-tty'))
623
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400624debug = get_option('debug')
625if debug != ''
626 foreach name : debug.split(',')
627 if name == 'hashmap'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400628 conf.set('ENABLE_DEBUG_HASHMAP', true)
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400629 elif name == 'mmap-cache'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400630 conf.set('ENABLE_DEBUG_MMAP_CACHE', true)
Zbigniew Jędrzejewski-Szmek671677d2017-04-27 20:51:34 -0400631 else
632 message('unknown debug option "@0@", ignoring'.format(name))
633 endif
634 endforeach
635endif
636
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400637#####################################################################
638
639threads = dependency('threads')
640librt = cc.find_library('rt')
641libm = cc.find_library('m')
642libdl = cc.find_library('dl')
643libcrypt = cc.find_library('crypt')
644
Zbigniew Jędrzejewski-Szmek1800cc82017-04-27 01:30:30 -0400645libcap = dependency('libcap', required : false)
646if not libcap.found()
647 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
648 libcap = cc.find_library('cap')
649endif
650
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400651libmount = dependency('mount',
652 version : '>= 2.27')
653
654want_seccomp = get_option('seccomp')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400655if want_seccomp != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400656 libseccomp = dependency('libseccomp',
Zbigniew Jędrzejewski-Szmek9f0e9c02017-04-27 10:05:18 -0400657 version : '>= 2.3.1',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400658 required : want_seccomp == 'true')
659 if libseccomp.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400660 conf.set('HAVE_SECCOMP', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400661 m4_defines += ['-DHAVE_SECCOMP']
662 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400663else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400664 libseccomp = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400665endif
666
667want_selinux = get_option('selinux')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400668if want_selinux != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400669 libselinux = dependency('libselinux',
670 version : '>= 2.1.9',
671 required : want_selinux == 'true')
672 if libselinux.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400673 conf.set('HAVE_SELINUX', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400674 m4_defines += ['-DHAVE_SELINUX']
675 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400676else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400677 libselinux = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400678endif
679
680want_apparmor = get_option('apparmor')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400681if want_apparmor != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400682 libapparmor = dependency('libapparmor',
683 required : want_apparmor == 'true')
684 if libapparmor.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400685 conf.set('HAVE_APPARMOR', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400686 m4_defines += ['-DHAVE_APPARMOR']
687 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400688else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400689 libapparmor = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400690endif
691
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400692smack_run_label = get_option('smack-run-label')
693if smack_run_label != ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400694 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
695 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400696endif
697
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400698want_polkit = get_option('polkit')
699install_polkit = false
700install_polkit_pkla = false
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400701if want_polkit != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400702 conf.set('ENABLE_POLKIT', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400703 install_polkit = true
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400704
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400705 libpolkit = dependency('polkit-gobject-1',
706 required : false)
707 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
708 message('Old polkit detected, will install pkla files')
709 install_polkit_pkla = true
710 endif
Zbigniew Jędrzejewski-Szmek3ca0cb72017-04-12 19:09:26 -0400711endif
712
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400713want_acl = get_option('acl')
714if want_acl != 'false'
715 libacl = cc.find_library('acl', required : want_acl == 'true')
716 if libacl.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400717 conf.set('HAVE_ACL', true)
Zbigniew Jędrzejewski-Szmek36f03872017-04-21 13:53:59 -0400718 m4_defines += ['-DHAVE_ACL']
719 endif
720else
721 libacl = []
722endif
723
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400724want_audit = get_option('audit')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400725if want_audit != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400726 libaudit = dependency('audit', required : want_audit == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400727 conf.set('HAVE_AUDIT', libaudit.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400728else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400729 libaudit = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400730endif
731
732want_blkid = get_option('blkid')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400733if want_blkid != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400734 libblkid = dependency('blkid', required : want_blkid == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400735 conf.set('HAVE_BLKID', libblkid.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400736else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400737 libblkid = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400738endif
739
740want_kmod = get_option('kmod')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400741if want_kmod != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400742 libkmod = dependency('libkmod',
743 version : '>= 15',
744 required : want_kmod == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400745 conf.set('HAVE_KMOD', libkmod.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400746else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400747 libkmod = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400748endif
749
750want_pam = get_option('pam')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400751if want_pam != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400752 libpam = cc.find_library('pam', required : want_pam == 'true')
753 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
754 if libpam.found() and libpam_misc.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400755 conf.set('HAVE_PAM', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400756 m4_defines += ['-DHAVE_PAM']
757 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400758else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400759 libpam = []
760 libpam_misc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400761endif
762
763want_microhttpd = get_option('microhttpd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400764if want_microhttpd != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400765 libmicrohttpd = dependency('libmicrohttpd',
766 version : '>= 0.9.33',
767 required : want_microhttpd == 'true')
768 if libmicrohttpd.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400769 conf.set('HAVE_MICROHTTPD', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400770 m4_defines += ['-DHAVE_MICROHTTPD']
771 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400772else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400773 libmicrohttpd = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400774endif
775
776want_libcryptsetup = get_option('libcryptsetup')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400777if want_libcryptsetup != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400778 libcryptsetup = dependency('libcryptsetup',
779 version : '>= 1.6.0',
780 required : want_libcryptsetup == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400781 conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400782else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400783 libcryptsetup = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400784endif
785
786want_libcurl = get_option('libcurl')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400787if want_libcurl != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400788 libcurl = dependency('libcurl',
789 version : '>= 7.32.0',
790 required : want_libcurl == 'true')
791 if libcurl.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400792 conf.set('HAVE_LIBCURL', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400793 m4_defines += ['-DHAVE_LIBCURL']
794 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400795else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400796 libcurl = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400797endif
798
799want_libidn = get_option('libidn')
Zbigniew Jędrzejewski-Szmek87057e22017-05-09 21:56:34 -0400800want_libidn2 = get_option('libidn2')
801if want_libidn == 'true' and want_libidn2 == 'true'
802 error('libidn and libidn2 cannot be requested simultaneously')
803endif
804
805if want_libidn2 != 'false' and want_libidn != 'true'
806 libidn = dependency('libidn2',
807 required : want_libidn2 == 'true')
808 # libidn is used for both libidn and libidn2 objects
809 if libidn.found()
810 conf.set('HAVE_LIBIDN2', true)
811 m4_defines += ['-DHAVE_LIBIDN2']
812 endif
813else
814 libidn = []
815endif
816if not conf.get('HAVE_LIBIDN2', false) and want_libidn != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400817 libidn = dependency('libidn',
818 required : want_libidn == 'true')
819 if libidn.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400820 conf.set('HAVE_LIBIDN', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400821 m4_defines += ['-DHAVE_LIBIDN']
822 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400823endif
824
825want_libiptc = get_option('libiptc')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400826if want_libiptc != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400827 libiptc = dependency('libiptc',
828 required : want_libiptc == 'true')
829 if libiptc.found()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400830 conf.set('HAVE_LIBIPTC', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400831 m4_defines += ['-DHAVE_LIBIPTC']
832 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400833else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400834 libiptc = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400835endif
836
837want_qrencode = get_option('qrencode')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400838if want_qrencode != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400839 libqrencode = dependency('libqrencode',
840 required : want_qrencode == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400841 conf.set('HAVE_QRENCODE', libqrencode.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400842else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400843 libqrencode = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400844endif
845
846want_gnutls = get_option('gnutls')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400847if want_gnutls != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400848 libgnutls = dependency('gnutls',
849 version : '>= 3.1.4',
850 required : want_gnutls == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400851 conf.set('HAVE_GNUTLS', libgnutls.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400852else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400853 libgnutls = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400854endif
855
856want_elfutils = get_option('elfutils')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400857if want_elfutils != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400858 libdw = dependency('libdw',
859 required : want_elfutils == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400860 conf.set('HAVE_ELFUTILS', libdw.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400861else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400862 libdw = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400863endif
864
865want_zlib = get_option('zlib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400866if want_zlib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400867 libz = dependency('zlib',
868 required : want_zlib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400869 conf.set('HAVE_ZLIB', libz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400870else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400871 libz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400872endif
873
874want_bzip2 = get_option('bzip2')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400875if want_bzip2 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400876 libbzip2 = cc.find_library('bz2',
877 required : want_bzip2 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400878 conf.set('HAVE_BZIP2', libbzip2.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400879else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400880 libbzip2 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400881endif
882
883want_xz = get_option('xz')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400884if want_xz != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400885 libxz = dependency('liblzma',
886 required : want_xz == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400887 conf.set('HAVE_XZ', libxz.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400888else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400889 libxz = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400890endif
891
892want_lz4 = get_option('lz4')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400893if want_lz4 != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400894 liblz4 = dependency('liblz4',
895 required : want_lz4 == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400896 conf.set('HAVE_LZ4', liblz4.found())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400897else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400898 liblz4 = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400899endif
900
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400901want_glib = get_option('glib')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400902if want_glib != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400903 libglib = dependency('glib-2.0',
904 version : '>= 2.22.0',
905 required : want_glib == 'true')
906 libgobject = dependency('gobject-2.0',
907 version : '>= 2.22.0',
908 required : want_glib == 'true')
909 libgio = dependency('gio-2.0',
910 required : want_glib == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400911 have = libglib.found() and libgobject.found() and libgio.found()
912 conf.set('HAVE_GLIB', have)
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400913else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400914 libglib = []
915 libgobject = []
916 libgio = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400917endif
918
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400919want_xkbcommon = get_option('xkbcommon')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400920if want_xkbcommon != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400921 libxkbcommon = dependency('xkbcommon',
922 version : '>= 0.3.0',
923 required : want_xkbcommon == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400924 conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400925else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400926 libxkbcommon = []
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -0400927endif
928
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400929want_dbus = get_option('dbus')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400930if want_dbus != 'false'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400931 libdbus = dependency('dbus-1',
932 version : '>= 1.3.2',
933 required : want_dbus == 'true')
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400934 conf.set('HAVE_DBUS', libdbus.found())
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400935else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400936 libdbus = []
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -0400937endif
938
Michael Biebl76c87412017-04-21 23:45:54 +0200939want_gcrypt = get_option('gcrypt')
940if want_gcrypt != 'false'
941 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
942 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
943
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400944 have_deps = libgcrypt.found() and libgpg_error.found()
945 conf.set('HAVE_GCRYPT', have_deps)
946 if not have_deps
Michael Biebl76c87412017-04-21 23:45:54 +0200947 # link to neither of the libs if one is not found
948 libgcrypt = []
949 libgpg_error = []
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400950 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400951else
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400952 libgcrypt = []
Michael Biebl76c87412017-04-21 23:45:54 +0200953 libgpg_error = []
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400954endif
955
956want_importd = get_option('importd')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400957if want_importd != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400958 have_deps = (conf.get('HAVE_LIBCURL', false) and
959 conf.get('HAVE_ZLIB', false) and
960 conf.get('HAVE_BZIP2', false) and
961 conf.get('HAVE_XZ', false) and
962 conf.get('HAVE_GCRYPT', false))
963 conf.set('ENABLE_IMPORTD', have_deps)
964 if want_importd == 'true' and not have_deps
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400965 error('importd support was requested, but dependencies are not available')
966 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400967endif
968
969want_remote = get_option('remote')
Zbigniew Jędrzejewski-Szmek4390be32017-04-13 20:30:07 -0400970if want_remote != 'false'
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400971 have_deps = [conf.get('HAVE_MICROHTTPD', false),
972 conf.get('HAVE_LIBCURL', false)]
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -0400973 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
974 # it's possible to build one without the other. Complain only if
975 # support was explictly requested. The auxiliary files like sysusers
976 # config should be installed when any of the programs are built.
977 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
978 error('remote support was requested, but dependencies are not available')
979 endif
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -0400980 conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -0400981endif
982
983foreach pair : [['utmp', 'HAVE_UTMP'],
984 ['hibernate', 'ENABLE_HIBERNATE'],
985 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
986 ['binfmt', 'ENABLE_BINFMT'],
987 ['coredump', 'ENABLE_COREDUMP'],
988 ['resolve', 'ENABLE_RESOLVED'],
989 ['logind', 'ENABLE_LOGIND'],
990 ['hostnamed', 'ENABLE_HOSTNAMED'],
991 ['localed', 'ENABLE_LOCALED'],
992 ['machined', 'ENABLE_MACHINED'],
993 ['networkd', 'ENABLE_NETWORKD'],
994 ['timedated', 'ENABLE_TIMEDATED'],
995 ['timesyncd', 'ENABLE_TIMESYNCD'],
996 ['myhostname', 'HAVE_MYHOSTNAME'],
997 ['firstboot', 'ENABLE_FIRSTBOOT'],
998 ['randomseed', 'ENABLE_RANDOMSEED'],
999 ['backlight', 'ENABLE_BACKLIGHT'],
1000 ['vconsole', 'ENABLE_VCONSOLE'],
1001 ['quotacheck', 'ENABLE_QUOTACHECK'],
1002 ['sysusers', 'ENABLE_SYSUSERS'],
1003 ['tmpfiles', 'ENABLE_TMPFILES'],
1004 ['hwdb', 'ENABLE_HWDB'],
1005 ['rfkill', 'ENABLE_RFKILL'],
1006 ['ldconfig', 'ENABLE_LDCONFIG'],
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001007 ['efi', 'ENABLE_EFI'],
Zbigniew Jędrzejewski-Szmek80c6fce2017-04-24 19:28:04 -04001008 ['tpm', 'SD_BOOT_LOG_TPM'],
Zbigniew Jędrzejewski-Szmek2895c8e2017-04-13 19:45:05 -04001009 ['ima', 'HAVE_IMA'],
Zbigniew Jędrzejewski-Szmek5464ec82017-04-24 19:28:04 -04001010 ['smack', 'HAVE_SMACK'],
Franck Buib14e1b42017-05-09 14:02:37 +02001011 ['gshadow', 'ENABLE_GSHADOW'],
Zbigniew Jędrzejewski-Szmekd1bf5672017-06-16 09:16:28 -04001012 ['idn', 'ENABLE_IDN'],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001013 ]
1014
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001015 if get_option(pair[0])
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001016 conf.set(pair[1], true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001017 m4_defines += ['-D' + pair[1]]
1018 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001019endforeach
1020
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001021want_tests = get_option('tests')
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04001022install_tests = get_option('install-tests')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001023tests = []
1024
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001025#####################################################################
1026
1027if get_option('efi')
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001028 efi_arch = host_machine.cpu_family()
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001029
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001030 if efi_arch == 'x86'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001031 EFI_MACHINE_TYPE_NAME = 'ia32'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001032 gnu_efi_arch = 'ia32'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001033 elif efi_arch == 'x86_64'
1034 EFI_MACHINE_TYPE_NAME = 'x64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001035 gnu_efi_arch = 'x86_64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001036 elif efi_arch == 'arm'
1037 EFI_MACHINE_TYPE_NAME = 'arm'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001038 gnu_efi_arch = 'arm'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001039 elif efi_arch == 'aarch64'
1040 EFI_MACHINE_TYPE_NAME = 'aa64'
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001041 gnu_efi_arch = 'aarch64'
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001042 else
1043 EFI_MACHINE_TYPE_NAME = ''
Zbigniew Jędrzejewski-Szmek6800fe72017-04-19 22:57:52 -04001044 gnu_efi_arch = ''
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001045 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001046
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001047 conf.set('ENABLE_EFI', true)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001048 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
Zbigniew Jędrzejewski-Szmek80c6fce2017-04-24 19:28:04 -04001049
1050 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001051endif
1052
1053#####################################################################
1054
1055config_h = configure_file(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001056 output : 'config.h',
1057 configuration : conf)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001058
1059includes = include_directories('src/basic',
1060 'src/shared',
1061 'src/systemd',
1062 'src/journal',
1063 'src/resolve',
1064 'src/timesync',
1065 'src/login',
1066 'src/udev',
1067 'src/libudev',
1068 'src/core',
1069 'src/libsystemd/sd-bus',
1070 'src/libsystemd/sd-device',
1071 'src/libsystemd/sd-hwdb',
1072 'src/libsystemd/sd-id128',
1073 'src/libsystemd/sd-netlink',
1074 'src/libsystemd/sd-network',
1075 'src/libsystemd-network',
1076 )
1077
1078add_project_arguments('-include', 'config.h', language : 'c')
1079
1080gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1081 'src/shared/gcrypt-util.c')
1082
1083subdir('po')
1084subdir('catalog')
1085subdir('src/systemd')
1086subdir('src/basic')
1087subdir('src/libsystemd')
1088subdir('src/libsystemd-network')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001089subdir('src/journal')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001090subdir('src/login')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001091
1092libjournal_core = static_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001093 'journal-core',
1094 libjournal_core_sources,
1095 journald_gperf_c,
1096 include_directories : includes,
1097 install : false)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001098
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04001099libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001100libsystemd = shared_library(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001101 'systemd',
1102 libsystemd_internal_sources,
1103 journal_internal_sources,
1104 version : '0.18.0',
1105 include_directories : includes,
1106 link_args : ['-shared',
1107 '-Wl,--version-script=' + libsystemd_sym_path],
1108 link_with : [libbasic],
1109 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001110 libgcrypt,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001111 librt,
1112 libxz,
1113 liblz4],
1114 link_depends : libsystemd_sym,
1115 install : true,
1116 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001117
1118############################################################
1119
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001120# binaries that have --help and are intended for use by humans,
1121# usually, but not always, installed in /bin.
1122public_programs = []
1123
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001124subdir('src/libudev')
1125subdir('src/shared')
1126subdir('src/core')
1127subdir('src/udev')
1128subdir('src/network')
1129
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001130subdir('src/analyze')
1131subdir('src/journal-remote')
1132subdir('src/coredump')
1133subdir('src/hostname')
1134subdir('src/import')
1135subdir('src/kernel-install')
1136subdir('src/locale')
1137subdir('src/machine')
1138subdir('src/nspawn')
1139subdir('src/resolve')
1140subdir('src/timedate')
1141subdir('src/timesync')
1142subdir('src/vconsole')
Zbigniew Jędrzejewski-Szmek4e4ab1c2017-04-10 12:37:52 -04001143subdir('src/sulogin-shell')
Zbigniew Jędrzejewski-Szmekb7100722017-04-12 15:05:55 -04001144subdir('src/boot/efi')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001145
1146subdir('src/test')
Zbigniew Jędrzejewski-Szmek4ff3f252017-04-13 20:47:20 -04001147subdir('test')
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04001148
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001149############################################################
1150
1151# only static linking apart from libdl, to make sure that the
1152# module is linked to all libraries that it uses.
1153test_dlopen = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001154 'test-dlopen',
1155 test_dlopen_c,
1156 include_directories : includes,
1157 link_with : [libbasic],
1158 dependencies : [libdl])
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001159
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001160foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
1161 ['systemd', '' ],
1162 ['mymachines', 'ENABLE_MACHINED'],
1163 ['resolve', 'ENABLE_RESOLVED']]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001164
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001165 condition = tuple[1] == '' or conf.get(tuple[1], false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001166 if condition
1167 module = tuple[0]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001168
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001169 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1170 version_script_arg = join_paths(meson.current_source_dir(), sym)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001171
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001172 nss = shared_library(
1173 'nss_' + module,
1174 'src/nss-@0@/nss-@0@.c'.format(module),
1175 version : '2',
1176 include_directories : includes,
1177 link_args : ['-shared',
1178 '-Wl,--version-script=' + version_script_arg,
1179 '-Wl,--undefined'],
1180 link_with : [libsystemd_internal,
1181 libbasic],
1182 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek5486a312017-05-12 08:31:46 -04001183 librt],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001184 link_depends : sym,
1185 install : true,
1186 install_dir : rootlibdir)
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001187
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001188 # We cannot use shared_module because it does not support version suffix.
1189 # Unfortunately shared_library insists on creating the symlink…
1190 meson.add_install_script('sh', '-c',
1191 'rm $DESTDIR@0@/libnss_@1@.so'
1192 .format(rootlibdir, module))
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001193
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001194 test('dlopen-nss_' + module,
1195 test_dlopen,
1196 args : [nss.full_path()]) # path to dlopen must include a slash
1197 endif
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001198endforeach
1199
1200############################################################
1201
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001202executable('systemd',
1203 systemd_sources,
1204 include_directories : includes,
1205 link_with : [libcore,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001206 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001207 dependencies : [threads,
1208 librt,
1209 libseccomp,
1210 libselinux,
Zbigniew Jędrzejewski-Szmekf4ee10a2017-04-09 14:08:53 -04001211 libmount,
1212 libblkid],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001213 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001214 install : true,
1215 install_dir : rootlibexecdir)
1216
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001217exe = executable('systemd-analyze',
1218 systemd_analyze_sources,
1219 include_directories : includes,
1220 link_with : [libcore,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001221 libshared],
1222 dependencies : [threads,
1223 librt,
1224 libseccomp,
1225 libselinux,
1226 libmount,
1227 libblkid],
1228 install_rpath : rootlibexecdir,
1229 install : true)
1230public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001231
1232executable('systemd-journald',
1233 systemd_journald_sources,
1234 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001235 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001236 libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001237 dependencies : [threads,
1238 libxz,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001239 liblz4,
1240 libselinux],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001241 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001242 install : true,
1243 install_dir : rootlibexecdir)
1244
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001245exe = executable('systemd-cat',
1246 systemd_cat_sources,
1247 include_directories : includes,
1248 link_with : [libjournal_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001249 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001250 dependencies : [threads],
1251 install_rpath : rootlibexecdir,
1252 install : true)
1253public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001254
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001255exe = executable('journalctl',
1256 journalctl_sources,
1257 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001258 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001259 dependencies : [threads,
1260 libqrencode,
1261 libxz,
1262 liblz4],
1263 install_rpath : rootlibexecdir,
1264 install : true,
1265 install_dir : rootbindir)
1266public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001267
1268executable('systemd-getty-generator',
1269 'src/getty-generator/getty-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001270 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001271 link_with : [libshared],
1272 install_rpath : rootlibexecdir,
1273 install : true,
1274 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001275
1276executable('systemd-debug-generator',
1277 'src/debug-generator/debug-generator.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001278 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001279 link_with : [libshared],
1280 install_rpath : rootlibexecdir,
1281 install : true,
1282 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001283
1284executable('systemd-fstab-generator',
1285 'src/fstab-generator/fstab-generator.c',
1286 'src/core/mount-setup.c',
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001287 include_directories : includes,
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001288 link_with : [libshared],
1289 install_rpath : rootlibexecdir,
1290 install : true,
1291 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001292
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001293if conf.get('ENABLE_ENVIRONMENT_D', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001294 executable('30-systemd-environment-d-generator',
1295 'src/environment-d-generator/environment-d-generator.c',
1296 include_directories : includes,
1297 link_with : [libshared],
1298 install_rpath : rootlibexecdir,
1299 install : true,
1300 install_dir : userenvgeneratordir)
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001301
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001302 meson.add_install_script(meson_make_symlink,
1303 join_paths(sysconfdir, 'environment'),
1304 join_paths(environmentdir, '99-environment.conf'))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001305endif
1306
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001307if conf.get('ENABLE_HIBERNATE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001308 executable('systemd-hibernate-resume-generator',
1309 'src/hibernate-resume/hibernate-resume-generator.c',
1310 include_directories : includes,
1311 link_with : [libshared],
1312 install_rpath : rootlibexecdir,
1313 install : true,
1314 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001315
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001316 executable('systemd-hibernate-resume',
1317 'src/hibernate-resume/hibernate-resume.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001318 include_directories : includes,
1319 link_with : [libshared],
1320 install_rpath : rootlibexecdir,
1321 install : true,
1322 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001323endif
1324
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001325if conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001326 executable('systemd-gpt-auto-generator',
1327 'src/gpt-auto-generator/gpt-auto-generator.c',
1328 'src/basic/blkid-util.h',
1329 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001330 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001331 dependencies : libblkid,
1332 install_rpath : rootlibexecdir,
1333 install : true,
1334 install_dir : systemgeneratordir)
1335
1336 exe = executable('systemd-dissect',
1337 'src/dissect/dissect.c',
1338 include_directories : includes,
1339 link_with : [libshared],
1340 install_rpath : rootlibexecdir,
1341 install : true,
1342 install_dir : rootlibexecdir)
1343 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001344endif
1345
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001346if conf.get('ENABLE_RESOLVED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001347 executable('systemd-resolved',
1348 systemd_resolved_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001349 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001350 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001351 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001352 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001353 libgcrypt,
1354 libgpg_error,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001355 libm,
1356 libidn],
1357 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001358 install : true,
1359 install_dir : rootlibexecdir)
1360
1361 exe = executable('systemd-resolve',
1362 systemd_resolve_sources,
Michael Biebl76c87412017-04-21 23:45:54 +02001363 gcrypt_util_sources,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001364 include_directories : includes,
1365 link_with : [libshared],
1366 dependencies : [threads,
Michael Biebl76c87412017-04-21 23:45:54 +02001367 libgcrypt,
1368 libgpg_error,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001369 libm,
1370 libidn],
1371 install_rpath : rootlibexecdir,
1372 install : true)
1373 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001374endif
1375
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001376if conf.get('ENABLE_LOGIND', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001377 executable('systemd-logind',
1378 systemd_logind_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001379 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001380 link_with : [liblogind_core,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001381 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001382 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001383 libacl],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001384 install_rpath : rootlibexecdir,
1385 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001386 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001387
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001388 exe = executable('loginctl',
1389 loginctl_sources,
1390 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001391 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001392 dependencies : [threads,
1393 liblz4,
1394 libxz],
1395 install_rpath : rootlibexecdir,
1396 install : true,
1397 install_dir : rootbindir)
1398 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001399
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001400 exe = executable('systemd-inhibit',
1401 'src/login/inhibit.c',
1402 include_directories : includes,
1403 link_with : [libshared],
1404 install_rpath : rootlibexecdir,
1405 install : true,
1406 install_dir : rootbindir)
1407 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek83b6af32017-04-14 20:10:28 -04001408
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001409 if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001410 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1411 pam_systemd = shared_library(
1412 'pam_systemd',
1413 pam_systemd_c,
1414 name_prefix : '',
1415 include_directories : includes,
1416 link_args : ['-shared',
1417 '-Wl,--version-script=' + version_script_arg],
1418 link_with : [libsystemd_internal,
1419 libshared_static],
1420 dependencies : [threads,
1421 libpam,
1422 libpam_misc],
1423 link_depends : pam_systemd_sym,
1424 install : true,
1425 install_dir : pamlibdir)
1426
1427 test('dlopen-pam_systemd',
1428 test_dlopen,
1429 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1430 endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001431endif
1432
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001433if conf.get('HAVE_PAM', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001434 executable('systemd-user-sessions',
1435 'src/user-sessions/user-sessions.c',
1436 include_directories : includes,
1437 link_with : [libshared],
1438 install_rpath : rootlibexecdir,
1439 install : true,
1440 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001441endif
1442
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001443if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001444 exe = executable('bootctl',
1445 'src/boot/bootctl.c',
1446 include_directories : includes,
1447 link_with : [libshared],
1448 dependencies : [libblkid],
1449 install_rpath : rootlibexecdir,
1450 install : true)
1451 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001452endif
1453
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001454exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1455 include_directories : includes,
1456 link_with : [libshared],
1457 dependencies : [threads],
1458 install_rpath : rootlibexecdir,
1459 install : true)
1460public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001461
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001462exe = executable('systemctl', 'src/systemctl/systemctl.c',
1463 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001464 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001465 dependencies : [threads,
1466 libcap,
1467 libselinux,
1468 libxz,
1469 liblz4],
1470 install_rpath : rootlibexecdir,
1471 install : true,
1472 install_dir : rootbindir)
1473public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001474
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001475if conf.get('ENABLE_BACKLIGHT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001476 executable('systemd-backlight',
1477 'src/backlight/backlight.c',
1478 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001479 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001480 install_rpath : rootlibexecdir,
1481 install : true,
1482 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001483endif
1484
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001485if conf.get('ENABLE_RFKILL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001486 executable('systemd-rfkill',
1487 'src/rfkill/rfkill.c',
1488 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001489 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001490 install_rpath : rootlibexecdir,
1491 install : true,
1492 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001493endif
1494
1495executable('systemd-system-update-generator',
1496 'src/system-update-generator/system-update-generator.c',
1497 include_directories : includes,
1498 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001499 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001500 install : true,
1501 install_dir : systemgeneratordir)
1502
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001503if conf.get('HAVE_LIBCRYPTSETUP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001504 executable('systemd-cryptsetup',
1505 'src/cryptsetup/cryptsetup.c',
1506 include_directories : includes,
1507 link_with : [libshared],
1508 dependencies : [libcryptsetup],
1509 install_rpath : rootlibexecdir,
1510 install : true,
1511 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001512
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001513 executable('systemd-cryptsetup-generator',
1514 'src/cryptsetup/cryptsetup-generator.c',
1515 include_directories : includes,
1516 link_with : [libshared],
1517 dependencies : [libcryptsetup],
1518 install_rpath : rootlibexecdir,
1519 install : true,
1520 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001521
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001522 executable('systemd-veritysetup',
1523 'src/veritysetup/veritysetup.c',
1524 include_directories : includes,
1525 link_with : [libshared],
1526 dependencies : [libcryptsetup],
1527 install_rpath : rootlibexecdir,
1528 install : true,
1529 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001530
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001531 executable('systemd-veritysetup-generator',
1532 'src/veritysetup/veritysetup-generator.c',
1533 include_directories : includes,
1534 link_with : [libshared],
1535 dependencies : [libcryptsetup],
1536 install_rpath : rootlibexecdir,
1537 install : true,
1538 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001539endif
1540
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001541if conf.get('HAVE_SYSV_COMPAT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001542 executable('systemd-sysv-generator',
1543 'src/sysv-generator/sysv-generator.c',
1544 include_directories : includes,
1545 link_with : [libshared],
1546 install_rpath : rootlibexecdir,
1547 install : true,
1548 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001549
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001550 executable('systemd-rc-local-generator',
1551 'src/rc-local-generator/rc-local-generator.c',
1552 include_directories : includes,
1553 link_with : [libshared],
1554 install_rpath : rootlibexecdir,
1555 install : true,
1556 install_dir : systemgeneratordir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001557endif
1558
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001559if conf.get('ENABLE_HOSTNAMED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001560 executable('systemd-hostnamed',
1561 'src/hostname/hostnamed.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001562 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001563 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001564 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001565 install : true,
1566 install_dir : rootlibexecdir)
1567
1568 exe = executable('hostnamectl',
1569 'src/hostname/hostnamectl.c',
1570 include_directories : includes,
1571 link_with : [libshared],
1572 install_rpath : rootlibexecdir,
1573 install : true)
1574 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001575endif
1576
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001577if conf.get('ENABLE_LOCALED', false)
1578 if conf.get('HAVE_XKBCOMMON', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001579 # logind will load libxkbcommon.so dynamically on its own
1580 deps = [libdl]
1581 else
1582 deps = []
1583 endif
Zbigniew Jędrzejewski-Szmek1eeb43f2017-04-13 19:37:14 -04001584
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001585 executable('systemd-localed',
1586 systemd_localed_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001587 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001588 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001589 dependencies : deps,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001590 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001591 install : true,
1592 install_dir : rootlibexecdir)
1593
1594 exe = executable('localectl',
1595 localectl_sources,
1596 include_directories : includes,
1597 link_with : [libshared],
1598 install_rpath : rootlibexecdir,
1599 install : true)
1600 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001601endif
1602
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001603if conf.get('ENABLE_TIMEDATED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001604 executable('systemd-timedated',
1605 'src/timedate/timedated.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001606 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001607 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001608 install_rpath : rootlibexecdir,
1609 install : true,
1610 install_dir : rootlibexecdir)
1611
1612 exe = executable('timedatectl',
1613 'src/timedate/timedatectl.c',
1614 include_directories : includes,
1615 install_rpath : rootlibexecdir,
1616 link_with : [libshared],
1617 install : true)
1618 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001619endif
1620
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001621if conf.get('ENABLE_TIMESYNCD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001622 executable('systemd-timesyncd',
1623 systemd_timesyncd_sources,
1624 include_directories : includes,
1625 link_with : [libshared],
1626 dependencies : [threads,
1627 libm],
1628 install_rpath : rootlibexecdir,
1629 install : true,
1630 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001631endif
1632
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001633if conf.get('ENABLE_MACHINED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001634 executable('systemd-machined',
1635 systemd_machined_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001636 include_directories : includes,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001637 link_with : [libmachine_core,
1638 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001639 install_rpath : rootlibexecdir,
1640 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001641 install_dir : rootlibexecdir)
1642
1643 exe = executable('machinectl',
1644 'src/machine/machinectl.c',
1645 include_directories : includes,
1646 link_with : [libshared],
1647 dependencies : [threads,
1648 libxz,
1649 liblz4],
1650 install_rpath : rootlibexecdir,
1651 install : true,
1652 install_dir : rootbindir)
1653 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001654endif
1655
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001656if conf.get('ENABLE_IMPORTD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001657 executable('systemd-importd',
1658 systemd_importd_sources,
1659 include_directories : includes,
1660 link_with : [libshared],
1661 dependencies : [threads],
1662 install_rpath : rootlibexecdir,
1663 install : true,
1664 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001665
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001666 systemd_pull = executable('systemd-pull',
1667 systemd_pull_sources,
1668 include_directories : includes,
1669 link_with : [libshared],
1670 dependencies : [libcurl,
1671 libz,
1672 libbzip2,
1673 libxz,
1674 libgcrypt],
1675 install_rpath : rootlibexecdir,
1676 install : true,
1677 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001678
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001679 systemd_import = executable('systemd-import',
1680 systemd_import_sources,
1681 include_directories : includes,
1682 link_with : [libshared],
1683 dependencies : [libcurl,
1684 libz,
1685 libbzip2,
1686 libxz],
1687 install_rpath : rootlibexecdir,
1688 install : true,
1689 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001690
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001691 systemd_export = executable('systemd-export',
1692 systemd_export_sources,
1693 include_directories : includes,
1694 link_with : [libshared],
1695 dependencies : [libcurl,
1696 libz,
1697 libbzip2,
1698 libxz],
1699 install_rpath : rootlibexecdir,
1700 install : true,
1701 install_dir : rootlibexecdir)
1702 public_programs += [systemd_pull, systemd_import, systemd_export]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001703endif
1704
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001705if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001706 exe = executable('systemd-journal-upload',
1707 systemd_journal_upload_sources,
1708 include_directories : includes,
1709 link_with : [libshared],
1710 dependencies : [threads,
1711 libcurl,
1712 libgnutls,
1713 libxz,
1714 liblz4],
1715 install_rpath : rootlibexecdir,
1716 install : true,
1717 install_dir : rootlibexecdir)
1718 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001719endif
1720
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001721if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001722 s_j_remote = executable('systemd-journal-remote',
1723 systemd_journal_remote_sources,
1724 include_directories : includes,
1725 link_with : [libshared],
1726 dependencies : [threads,
1727 libmicrohttpd,
1728 libgnutls,
1729 libxz,
1730 liblz4],
1731 install_rpath : rootlibexecdir,
1732 install : true,
1733 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001734
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001735 s_j_gatewayd = executable('systemd-journal-gatewayd',
1736 systemd_journal_gatewayd_sources,
1737 include_directories : includes,
1738 link_with : [libshared],
1739 dependencies : [threads,
1740 libmicrohttpd,
1741 libgnutls,
1742 libxz,
1743 liblz4],
1744 install_rpath : rootlibexecdir,
1745 install : true,
1746 install_dir : rootlibexecdir)
1747 public_programs += [s_j_remote, s_j_gatewayd]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001748endif
1749
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001750if conf.get('ENABLE_COREDUMP', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001751 executable('systemd-coredump',
1752 systemd_coredump_sources,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001753 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001754 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001755 dependencies : [threads,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001756 libacl,
1757 libdw,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001758 libxz,
1759 liblz4],
1760 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001761 install : true,
1762 install_dir : rootlibexecdir)
1763
1764 exe = executable('coredumpctl',
1765 coredumpctl_sources,
1766 include_directories : includes,
1767 link_with : [libshared],
1768 dependencies : [threads,
1769 libxz,
1770 liblz4],
1771 install_rpath : rootlibexecdir,
1772 install : true)
1773 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001774endif
1775
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001776if conf.get('ENABLE_BINFMT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001777 exe = executable('systemd-binfmt',
1778 'src/binfmt/binfmt.c',
1779 include_directories : includes,
1780 link_with : [libshared],
1781 install_rpath : rootlibexecdir,
1782 install : true,
1783 install_dir : rootlibexecdir)
1784 public_programs += [exe]
1785
1786 meson.add_install_script('sh', '-c',
1787 mkdir_p.format(binfmtdir))
1788 meson.add_install_script('sh', '-c',
1789 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1790endif
1791
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001792if conf.get('ENABLE_VCONSOLE', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001793 executable('systemd-vconsole-setup',
1794 'src/vconsole/vconsole-setup.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001795 include_directories : includes,
1796 link_with : [libshared],
1797 install_rpath : rootlibexecdir,
1798 install : true,
1799 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001800endif
1801
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001802if conf.get('ENABLE_RANDOMSEED', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001803 executable('systemd-random-seed',
1804 'src/random-seed/random-seed.c',
1805 include_directories : includes,
1806 link_with : [libshared],
1807 install_rpath : rootlibexecdir,
1808 install : true,
1809 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001810endif
1811
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04001812if conf.get('ENABLE_FIRSTBOOT', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04001813 executable('systemd-firstboot',
1814 'src/firstboot/firstboot.c',
1815 include_directories : includes,
1816 link_with : [libshared],
1817 dependencies : [libcrypt],
1818 install_rpath : rootlibexecdir,
1819 install : true,
1820 install_dir : rootbindir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001821endif
1822
1823executable('systemd-remount-fs',
1824 'src/remount-fs/remount-fs.c',
1825 'src/core/mount-setup.c',
1826 'src/core/mount-setup.h',
1827 include_directories : includes,
1828 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001829 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001830 install : true,
1831 install_dir : rootlibexecdir)
1832
1833executable('systemd-machine-id-setup',
1834 'src/machine-id-setup/machine-id-setup-main.c',
1835 'src/core/machine-id-setup.c',
1836 'src/core/machine-id-setup.h',
1837 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001838 link_with : [libshared],
Zbigniew Jędrzejewski-Szmekb2fc5832017-04-10 18:13:00 -04001839 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001840 install : true,
1841 install_dir : rootbindir)
1842
1843executable('systemd-fsck',
1844 'src/fsck/fsck.c',
1845 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001846 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001847 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001848 install : true,
1849 install_dir : rootlibexecdir)
1850
1851executable('systemd-sleep',
1852 'src/sleep/sleep.c',
1853 include_directories : includes,
1854 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001855 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001856 install : true,
1857 install_dir : rootlibexecdir)
1858
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001859exe = executable('systemd-sysctl',
1860 'src/sysctl/sysctl.c',
1861 include_directories : includes,
1862 link_with : [libshared],
1863 install_rpath : rootlibexecdir,
1864 install : true,
1865 install_dir : rootlibexecdir)
1866public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001867
1868executable('systemd-ac-power',
1869 'src/ac-power/ac-power.c',
1870 include_directories : includes,
1871 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001872 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001873 install : true,
1874 install_dir : rootlibexecdir)
1875
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001876exe = executable('systemd-detect-virt',
1877 'src/detect-virt/detect-virt.c',
1878 include_directories : includes,
1879 link_with : [libshared],
1880 install_rpath : rootlibexecdir,
1881 install : true)
1882public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001883
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001884exe = executable('systemd-delta',
1885 'src/delta/delta.c',
1886 include_directories : includes,
1887 link_with : [libshared],
1888 install_rpath : rootlibexecdir,
1889 install : true)
1890public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001891
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001892exe = executable('systemd-escape',
1893 'src/escape/escape.c',
1894 include_directories : includes,
1895 link_with : [libshared],
1896 install_rpath : rootlibexecdir,
1897 install : true,
1898 install_dir : rootbindir)
1899public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001900
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001901exe = executable('systemd-notify',
1902 'src/notify/notify.c',
1903 include_directories : includes,
1904 link_with : [libshared],
1905 install_rpath : rootlibexecdir,
1906 install : true,
1907 install_dir : rootbindir)
1908public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001909
1910executable('systemd-volatile-root',
1911 'src/volatile-root/volatile-root.c',
1912 include_directories : includes,
1913 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001914 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001915 install : true,
1916 install_dir : rootlibexecdir)
1917
1918executable('systemd-cgroups-agent',
1919 'src/cgroups-agent/cgroups-agent.c',
1920 include_directories : includes,
1921 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001922 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001923 install : true,
1924 install_dir : rootlibexecdir)
1925
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001926exe = executable('systemd-path',
1927 'src/path/path.c',
1928 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001929 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001930 install_rpath : rootlibexecdir,
1931 install : true)
1932public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001933
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001934exe = executable('systemd-ask-password',
1935 'src/ask-password/ask-password.c',
1936 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001937 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001938 install_rpath : rootlibexecdir,
1939 install : true,
1940 install_dir : rootbindir)
1941public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001942
1943executable('systemd-reply-password',
1944 'src/reply-password/reply-password.c',
1945 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001946 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001947 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001948 install : true,
1949 install_dir : rootlibexecdir)
1950
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001951exe = executable('systemd-tty-ask-password-agent',
1952 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1953 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001954 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001955 install_rpath : rootlibexecdir,
1956 install : true,
1957 install_dir : rootbindir)
1958public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001959
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001960exe = executable('systemd-cgls',
1961 'src/cgls/cgls.c',
1962 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001963 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001964 install_rpath : rootlibexecdir,
1965 install : true)
1966public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001967
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001968exe = executable('systemd-cgtop',
1969 'src/cgtop/cgtop.c',
1970 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001971 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001972 install_rpath : rootlibexecdir,
1973 install : true)
1974public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001975
1976executable('systemd-initctl',
1977 'src/initctl/initctl.c',
1978 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001979 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04001980 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001981 install : true,
1982 install_dir : rootlibexecdir)
1983
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001984exe = executable('systemd-mount',
1985 'src/mount/mount-tool.c',
1986 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02001987 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001988 install_rpath : rootlibexecdir,
1989 install : true)
1990public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04001991
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001992meson.add_install_script(meson_make_symlink,
Michael Bieble17e5ba2017-04-13 10:30:56 -04001993 'systemd-mount', join_paths(bindir, 'systemd-umount'))
Zbigniew Jędrzejewski-Szmek7b76fce2017-04-09 23:55:50 -04001994
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001995exe = executable('systemd-run',
1996 'src/run/run.c',
1997 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04001998 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04001999 install_rpath : rootlibexecdir,
2000 install : true)
2001public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002002
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002003exe = executable('systemd-stdio-bridge',
2004 'src/stdio-bridge/stdio-bridge.c',
2005 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002006 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002007 install_rpath : rootlibexecdir,
2008 install : true)
2009public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002010
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002011exe = executable('busctl',
2012 'src/busctl/busctl.c',
2013 'src/busctl/busctl-introspect.c',
2014 'src/busctl/busctl-introspect.h',
2015 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002016 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002017 install_rpath : rootlibexecdir,
2018 install : true)
2019public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002020
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002021if conf.get('ENABLE_SYSUSERS', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002022 exe = executable('systemd-sysusers',
2023 'src/sysusers/sysusers.c',
2024 include_directories : includes,
2025 link_with : [libshared],
2026 install_rpath : rootlibexecdir,
2027 install : true,
2028 install_dir : rootbindir)
2029 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002030endif
2031
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002032if conf.get('ENABLE_TMPFILES', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002033 exe = executable('systemd-tmpfiles',
2034 'src/tmpfiles/tmpfiles.c',
2035 include_directories : includes,
2036 link_with : [libshared],
2037 dependencies : [libacl],
2038 install_rpath : rootlibexecdir,
2039 install : true,
2040 install_dir : rootbindir)
2041 public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002042endif
2043
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002044if conf.get('ENABLE_HWDB', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002045 exe = executable('systemd-hwdb',
2046 'src/hwdb/hwdb.c',
2047 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2048 include_directories : includes,
Michael Biebl0da6f392017-04-21 18:32:14 +02002049 link_with : [libudev_internal],
2050 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002051 install : true,
2052 install_dir : rootbindir)
2053 public_programs += [exe]
2054endif
2055
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002056if conf.get('ENABLE_QUOTACHECK', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002057 executable('systemd-quotacheck',
2058 'src/quotacheck/quotacheck.c',
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002059 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002060 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002061 install_rpath : rootlibexecdir,
2062 install : true,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002063 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002064endif
2065
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002066exe = executable('systemd-socket-proxyd',
2067 'src/socket-proxy/socket-proxyd.c',
2068 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002069 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002070 dependencies : [threads],
2071 install_rpath : rootlibexecdir,
2072 install : true,
2073 install_dir : rootlibexecdir)
2074public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002075
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002076exe = executable('systemd-udevd',
2077 systemd_udevd_sources,
2078 include_directories : includes,
Zbigniew Jędrzejewski-Szmek5c720492017-02-22 23:13:22 -05002079 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002080 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002081 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002082 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002083 dependencies : [threads,
2084 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002085 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002086 libacl,
2087 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002088 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002089 install : true,
2090 install_dir : rootlibexecdir)
2091public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002092
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002093exe = executable('udevadm',
2094 udevadm_sources,
2095 include_directories : includes,
2096 link_with : [libudev_core,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002097 libsystemd_network,
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002098 libudev_internal],
Zbigniew Jędrzejewski-Szmek3a30f212017-04-17 12:07:12 -04002099 dependencies : [threads,
2100 libkmod,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002101 libidn,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002102 libacl,
2103 libblkid],
Zbigniew Jędrzejewski-Szmek1aec3ed2017-04-17 19:33:10 -04002104 install_rpath : udev_rpath,
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002105 install : true,
2106 install_dir : rootbindir)
2107public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002108
2109executable('systemd-shutdown',
2110 systemd_shutdown_sources,
2111 include_directories : includes,
Michael Biebl34ce0a52017-04-25 20:19:54 +02002112 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-done',
2118 'src/update-done/update-done.c',
2119 include_directories : includes,
2120 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002121 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002122 install : true,
2123 install_dir : rootlibexecdir)
2124
2125executable('systemd-update-utmp',
2126 'src/update-utmp/update-utmp.c',
2127 include_directories : includes,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002128 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002129 dependencies : [libaudit],
Zbigniew Jędrzejewski-Szmek421f0012017-04-12 12:02:30 -04002130 install_rpath : rootlibexecdir,
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002131 install : true,
2132 install_dir : rootlibexecdir)
2133
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002134if conf.get('HAVE_KMOD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002135 executable('systemd-modules-load',
2136 'src/modules-load/modules-load.c',
2137 include_directories : includes,
2138 link_with : [libshared],
2139 dependencies : [libkmod],
2140 install_rpath : rootlibexecdir,
2141 install : true,
2142 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002143
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002144 meson.add_install_script('sh', '-c',
2145 mkdir_p.format(modulesloaddir))
2146 meson.add_install_script('sh', '-c',
2147 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002148endif
2149
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002150exe = executable('systemd-nspawn',
2151 systemd_nspawn_sources,
2152 'src/core/mount-setup.c', # FIXME: use a variable?
2153 'src/core/mount-setup.h',
2154 'src/core/loopback-setup.c',
2155 'src/core/loopback-setup.h',
2156 include_directories : [includes, include_directories('src/nspawn')],
Zbigniew Jędrzejewski-Szmek0bc91152017-04-27 13:39:54 -04002157 link_with : [libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002158 dependencies : [libacl,
2159 libblkid,
2160 libseccomp,
2161 libselinux],
2162 install_rpath : rootlibexecdir,
2163 install : true)
2164public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002165
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002166if conf.get('ENABLE_NETWORKD', false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002167 executable('systemd-networkd',
2168 systemd_networkd_sources,
2169 include_directories : includes,
2170 link_with : [libnetworkd_core,
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002171 libsystemd_network,
2172 libudev_internal,
2173 libshared],
2174 install_rpath : rootlibexecdir,
2175 install : true,
2176 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002177
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002178 executable('systemd-networkd-wait-online',
2179 systemd_networkd_wait_online_sources,
2180 include_directories : includes,
2181 link_with : [libnetworkd_core,
2182 libshared],
2183 install_rpath : rootlibexecdir,
2184 install : true,
2185 install_dir : rootlibexecdir)
Zbigniew Jędrzejewski-Szmekf0bd7cc2017-04-12 12:14:30 -04002186endif
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002187
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002188exe = executable('networkctl',
2189 networkctl_sources,
2190 include_directories : includes,
2191 link_with : [libsystemd_network,
Zbigniew Jędrzejewski-Szmekaac26052017-04-14 18:49:47 -04002192 libshared],
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002193 install_rpath : rootlibexecdir,
2194 install : true,
2195 install_dir : rootbindir)
2196public_programs += [exe]
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002197
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002198############################################################
2199
2200foreach tuple : tests
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002201 sources = tuple[0]
2202 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2203 dependencies = tuple[2]
2204 condition = tuple.length() >= 4 ? tuple[3] : ''
2205 type = tuple.length() >= 5 ? tuple[4] : ''
2206 defs = tuple.length() >= 6 ? tuple[5] : []
2207 incs = tuple.length() >= 7 ? tuple[6] : includes
2208 timeout = 30
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002209
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002210 name = sources[0].split('/')[-1].split('.')[0]
2211 if type.startswith('timeout=')
2212 timeout = type.split('=')[1].to_int()
2213 type = ''
2214 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002215
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002216 if condition == '' or conf.get(condition, false)
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002217 install = install_tests and type == ''
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04002218
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002219 exe = executable(
2220 name,
2221 sources,
2222 include_directories : incs,
2223 link_with : link_with,
2224 dependencies : dependencies,
2225 c_args : defs,
2226 install_rpath : rootlibexecdir,
2227 install : install,
2228 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek572baca2017-04-08 01:55:38 -04002229
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002230 if type == 'manual'
2231 message('@0@ is a manual test'.format(name))
2232 elif type == 'unsafe' and want_tests != 'unsafe'
2233 message('@0@ is an unsafe test'.format(name))
2234 else
2235 test(name, exe,
2236 env : test_env,
2237 timeout : timeout)
2238 endif
2239 else
2240 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2241 endif
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002242endforeach
2243
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002244test_libsystemd_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002245 'test-libsystemd-sym',
2246 test_libsystemd_sym_c,
2247 include_directories : includes,
2248 link_with : [libsystemd],
2249 install : install_tests,
2250 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmek37ab1a22017-04-10 14:13:40 -04002251test('test-libsystemd-sym',
2252 test_libsystemd_sym)
2253
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002254test_libudev_sym = executable(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002255 'test-libudev-sym',
2256 test_libudev_sym_c,
2257 include_directories : includes,
2258 c_args : ['-Wno-deprecated-declarations'],
2259 link_with : [libudev],
2260 install : install_tests,
2261 install_dir : testsdir)
Zbigniew Jędrzejewski-Szmeke0bec522017-04-10 15:20:42 -04002262test('test-libudev-sym',
2263 test_libudev_sym)
2264
Zbigniew Jędrzejewski-Szmek69e96422017-04-07 00:19:09 -04002265############################################################
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002266
2267make_directive_index_py = find_program('tools/make-directive-index.py')
2268make_man_index_py = find_program('tools/make-man-index.py')
Zbigniew Jędrzejewski-Szmekb184e8f2017-04-13 19:59:21 -04002269xml_helper_py = find_program('tools/xml_helper.py')
Zbigniew Jędrzejewski-Szmekabba22c2017-04-15 00:40:59 -04002270hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
Zbigniew Jędrzejewski-Szmek5c231282017-04-04 23:03:47 -04002271
2272subdir('units')
2273subdir('sysctl.d')
2274subdir('sysusers.d')
2275subdir('tmpfiles.d')
2276subdir('rules')
2277subdir('hwdb')
2278subdir('network')
2279subdir('man')
2280subdir('shell-completion/bash')
2281subdir('shell-completion/zsh')
2282subdir('docs/sysvinit')
2283subdir('docs/var-log')
2284
2285# FIXME: figure out if the warning is true:
2286# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2287install_subdir('factory/etc',
2288 install_dir : factorydir)
2289
2290
2291install_data('xorg/50-systemd-user.sh',
2292 install_dir : xinitrcdir)
2293install_data('system-preset/90-systemd.preset',
2294 install_dir : systempresetdir)
2295install_data('README',
2296 'NEWS',
2297 'CODING_STYLE',
2298 'DISTRO_PORTING',
2299 'ENVIRONMENT.md',
2300 'LICENSE.GPL2',
2301 'LICENSE.LGPL2.1',
2302 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2303 install_dir : docdir)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002304
Zbigniew Jędrzejewski-Szmek94e75a52017-04-09 23:55:05 -04002305meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2306meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2307
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002308############################################################
2309
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002310meson_check_help = find_program('tools/meson-check-help.sh')
2311
2312foreach exec : public_programs
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002313 name = exec.full_path().split('/')[-1]
2314 test('check-help-' + name,
2315 meson_check_help,
2316 args : [exec.full_path()])
Zbigniew Jędrzejewski-Szmek005a29f2017-04-13 11:52:05 -04002317endforeach
2318
2319############################################################
2320
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002321if git.found() and etags.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002322 all_files = run_command(
2323 git,
2324 ['--git-dir=@0@/.git'.format(meson.source_root()),
2325 'ls-files',
2326 ':/*.[ch]'])
2327 all_files = files(all_files.stdout().split())
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002328
Zbigniew Jędrzejewski-Szmek341b8922017-05-30 19:56:12 -04002329 run_target(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002330 'TAGS',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002331 input : all_files,
Zbigniew Jędrzejewski-Szmek341b8922017-05-30 19:56:12 -04002332 command : [etags, '-o', '@0@/TAGS'.format(meson.source_root())] + all_files)
Zbigniew Jędrzejewski-Szmekd68b3422017-04-06 14:33:27 -04002333endif
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002334
2335if git.found()
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002336 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
Zbigniew Jędrzejewski-Szmeka923e082017-04-17 19:48:20 -04002337 run_target(
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002338 'git-contrib',
Zbigniew Jędrzejewski-Szmek37efbbd2017-04-17 19:25:00 -04002339 command : [meson_git_contrib_sh])
Zbigniew Jędrzejewski-Szmek177929c2017-04-15 00:16:23 -04002340endif
Zbigniew Jędrzejewski-Szmekdd6ab3d2017-04-24 19:28:05 -04002341
2342if git.found()
2343 git_head = run_command(
2344 git,
2345 ['--git-dir=@0@/.git'.format(meson.source_root()),
2346 'rev-parse', 'HEAD']).stdout().strip()
2347 git_head_short = run_command(
2348 git,
2349 ['--git-dir=@0@/.git'.format(meson.source_root()),
2350 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2351
2352 run_target(
2353 'git-snapshot',
2354 command : ['git', 'archive',
2355 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.source_root(),
2356 git_head_short),
2357 '--prefix', 'systemd-@0@/'.format(git_head),
2358 'HEAD'])
2359endif
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002360
2361############################################################
2362
2363status = [
2364 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2365
2366 'prefix: @0@'.format(prefixdir),
2367 'rootprefix: @0@'.format(rootprefixdir),
2368 'sysconf dir: @0@'.format(sysconfdir),
2369 'includedir: @0@'.format(includedir),
2370 'lib dir: @0@'.format(libdir),
2371 'rootlib dir: @0@'.format(rootlibdir),
2372 'SysV init scripts: @0@'.format(sysvinit_path),
2373 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2374 'PAM modules dir: @0@'.format(pamlibdir),
2375 'PAM configuration dir: @0@'.format(pamconfdir),
2376 'RPM macros dir: @0@'.format(rpmmacrosdir),
2377 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2378 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2379 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2380 'bash completions dir: @0@'.format(bashcompletiondir),
2381 'zsh completions dir: @0@'.format(zshcompletiondir),
2382 'extra start script: @0@'.format(get_option('rc-local')),
2383 'extra stop script: @0@'.format(get_option('halt-local')),
2384 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2385 get_option('debug-tty')),
2386 'TTY GID: @0@'.format(tty_gid),
2387 'maximum system UID: @0@'.format(system_uid_max),
2388 'maximum system GID: @0@'.format(system_gid_max),
2389 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2390 'certificate root: @0@'.format(get_option('certificate-root')),
2391 'support URL: @0@'.format(support_url),
2392 'nobody user name: @0@'.format(get_option('nobody-user')),
2393 'nobody group name: @0@'.format(get_option('nobody-group')),
2394 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2395
2396 'default DNSSEC mode: @0@'.format(default_dnssec),
2397 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2398 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2399
2400alt_dns_servers = '\n '.join(dns_servers.split(' '))
2401alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2402status += [
2403 'default DNS servers: @0@'.format(alt_dns_servers),
2404 'default NTP servers: @0@'.format(alt_ntp_servers)]
2405
2406alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2407 '@@0@'.format(time_epoch)).stdout().strip()
2408status += [
2409 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2410
2411# TODO:
2412# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2413# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2414# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2415
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002416if conf.get('ENABLE_EFI', false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002417 status += [
2418 'efi arch: @0@'.format(efi_arch)]
2419
2420 if have_gnu_efi
2421 status += [
2422 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2423 'EFI CC @0@'.format(efi_cc),
2424 'EFI libdir: @0@'.format(efi_libdir),
2425 'EFI ldsdir: @0@'.format(efi_ldsdir),
2426 'EFI includedir: @0@'.format(efi_incdir)]
2427 endif
2428endif
2429
2430found = []
2431missing = []
2432
2433foreach tuple : [
2434 ['libcryptsetup'],
2435 ['PAM'],
2436 ['AUDIT'],
2437 ['IMA'],
2438 ['AppArmor'],
2439 ['SELinux'],
2440 ['SECCOMP'],
2441 ['SMACK'],
2442 ['zlib'],
2443 ['xz'],
2444 ['lz4'],
2445 ['bzip2'],
2446 ['ACL'],
2447 ['gcrypt'],
2448 ['qrencode'],
2449 ['microhttpd'],
2450 ['gnutls'],
2451 ['libcurl'],
Zbigniew Jędrzejewski-Szmekd1bf5672017-06-16 09:16:28 -04002452 ['idn'],
Zbigniew Jędrzejewski-Szmek87057e22017-05-09 21:56:34 -04002453 ['libidn2'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002454 ['libidn'],
2455 ['libiptc'],
2456 ['elfutils'],
2457 ['binfmt'],
2458 ['vconsole'],
2459 ['quotacheck'],
2460 ['tmpfiles'],
2461 ['environment.d'],
2462 ['sysusers'],
2463 ['firstboot'],
2464 ['randomseed'],
2465 ['backlight'],
2466 ['rfkill'],
2467 ['logind'],
2468 ['machined'],
2469 ['importd'],
2470 ['hostnamed'],
2471 ['timedated'],
2472 ['timesyncd'],
2473 ['localed'],
2474 ['networkd'],
2475 ['resolved'],
2476 ['coredump'],
2477 ['polkit'],
2478 ['legacy pkla', install_polkit_pkla],
2479 ['efi'],
2480 ['gnu-efi', have_gnu_efi],
2481 ['kmod'],
2482 ['xkbcommon'],
2483 ['blkid'],
2484 ['dbus'],
2485 ['glib'],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002486 ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002487 ['hwdb'],
2488 ['tpm'],
2489 ['man pages', want_man],
2490 ['html pages', want_html],
2491 ['man page indices', want_man and have_lxml],
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002492 ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002493 ['SysV compat'],
2494 ['utmp'],
2495 ['ldconfig'],
2496 ['hibernate'],
2497 ['adm group', get_option('adm-group')],
2498 ['wheel group', get_option('wheel-group')],
Franck Buib14e1b42017-05-09 14:02:37 +02002499 ['gshadow'],
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002500 ['debug hashmap'],
2501 ['debug mmap cache'],
2502]
2503
2504 cond = tuple.get(1, '')
2505 if cond == ''
2506 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2507 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
Zbigniew Jędrzejewski-Szmek2c201c22017-04-27 21:13:08 -04002508 cond = conf.get(ident1, false) or conf.get(ident2, false)
Zbigniew Jędrzejewski-Szmek829257d2017-04-27 20:54:52 -04002509 endif
2510 if cond
2511 found += [tuple[0]]
2512 else
2513 missing += [tuple[0]]
2514 endif
2515endforeach
2516
2517status += [
2518 'enabled features: @0@'.format(', '.join(found)),
2519 'disabled features: @0@'.format(', '.join(missing))]
2520message('\n '.join(status))