chiark / gitweb /
firstboot: Include <crypt.h> for declaration of crypt() if needed (#7944)
[elogind.git] / meson.build
1 # SPDX-License-Identifier: LGPL-2.1+
2 #
3 # Copyright 2017 Zbigniew JÄ™drzejewski-Szmek
4 #
5 # elogind is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) any later version.
9 #
10 # elogind is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with elogind; If not, see <http://www.gnu.org/licenses/>.
17
18 project('elogind', 'c',
19         version : '236',
20         license : 'LGPLv2+',
21         default_options: [
22                 'c_std=gnu99',
23                 'prefix=/usr',
24                 'sysconfdir=/etc',
25                 'localstatedir=/var',
26         ],
27         meson_version : '>= 0.41',
28        )
29
30 #if 0 /// UNNEEDED by elogind - libudev is external
31 # libsystemd_version = '0.20.0'
32 # libudev_version = '1.6.8'
33 #else
34 libelogind_version = '0.20.0'
35 #endif // 0
36
37 # We need the same data in three different formats, ugh!
38 # Also, for hysterical reasons, we use different variable
39 # names, sometimes. Not all variables are included in every
40 # set. Ugh, ugh, ugh!
41 conf = configuration_data()
42 conf.set_quoted('PACKAGE_STRING',  meson.project_name() + ' ' + meson.project_version())
43 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
44
45 substs = configuration_data()
46 #if 0 /// Set elogind Package PACKAGE_URL
47 # substs.set('PACKAGE_URL',          'https://www.freedesktop.org/wiki/Software/systemd')
48 #else
49 substs.set('PACKAGE_URL',          'https://github.com/elogind/elogind')
50 #endif // 0
51 substs.set('PACKAGE_VERSION',      meson.project_version())
52
53 m4_defines = []
54
55 #####################################################################
56 #if 0 /// elogind does not need this
57
58 # # Try to install the git pre-commit hook
59 # git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
60 # if git_hook.returncode() == 0
61 #         message(git_hook.stdout().strip())
62 # endif
63 #else
64 # elogind Note: We use precompiler masks for two reasons:
65 #               1) The masking is consistent with the sources
66 #               2) The git patch creator we use for preparing upstream patches
67 #                  manipulates commits to not take those masks out. Therefore
68 #                  it can be used to add commits updating the meson files, too.
69 #endif // 0
70
71 #####################################################################
72
73 split_usr = get_option('split-usr')
74 conf.set10('HAVE_SPLIT_USR', split_usr)
75
76 rootprefixdir = get_option('rootprefix')
77 # Unusual rootprefixdir values are used by some distros
78 # (see https://github.com/systemd/systemd/pull/7461).
79 rootprefix_default = get_option('split-usr') ? '/' : '/usr'
80 if rootprefixdir == ''
81         rootprefixdir = rootprefix_default
82 endif
83
84 #if 0 /// UNNEEDED by elogind
85 # sysvinit_path = get_option('sysvinit-path')
86 # sysvrcnd_path = get_option('sysvrcnd-path')
87 # have = sysvinit_path != '' and sysvrcnd_path != ''
88 # conf.set10('HAVE_SYSV_COMPAT', have,
89 #            description : 'SysV init scripts and rcN.d links are supported')
90 # m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
91 #endif // 0
92
93 # join_paths ignore the preceding arguments if an absolute component is
94 # encountered, so this should canonicalize various paths when they are
95 # absolute or relative.
96 prefixdir = get_option('prefix')
97 if not prefixdir.startswith('/')
98         error('Prefix is not absolute: "@0@"'.format(prefixdir))
99 endif
100 bindir = join_paths(prefixdir, get_option('bindir'))
101 libdir = join_paths(prefixdir, get_option('libdir'))
102 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
103 includedir = join_paths(prefixdir, get_option('includedir'))
104 datadir = join_paths(prefixdir, get_option('datadir'))
105 localstatedir = join_paths('/', get_option('localstatedir'))
106
107 rootbindir = join_paths(rootprefixdir, 'bin')
108 #if 0 /// elogind has a different default
109 # rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
110 #else
111 rootlibexecdir = get_option('rootlibexecdir')
112 rootlibexecdir = rootlibexecdir != '' ? rootlibexecdir : join_paths(rootprefixdir, 'lib/elogind')
113 #endif // 0
114
115 rootlibdir = get_option('rootlibdir')
116 if rootlibdir == ''
117         rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
118 endif
119
120 # Dirs of external packages
121 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
122 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
123 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
124 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
125 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
126 varlogdir = join_paths(localstatedir, 'log')
127 #if 0 /// UNNEEDED by elogind
128 # xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
129 # rpmmacrosdir = get_option('rpmmacrosdir')
130 # if rpmmacrosdir != 'no'
131 #         rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
132 # endif
133 #endif // 0
134 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
135
136 # Our own paths
137 #if 0 /// elogind has a bit different layout and does not need all of theses
138 # pkgdatadir = join_paths(datadir, 'systemd')
139 # environmentdir = join_paths(prefixdir, 'lib/environment.d')
140 # pkgsysconfdir = join_paths(sysconfdir, 'systemd')
141 # userunitdir = join_paths(prefixdir, 'lib/systemd/user')
142 # userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
143 # tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
144 # sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
145 # sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
146 # binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
147 # modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
148 # networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
149 # pkgincludedir = join_paths(includedir, 'systemd')
150 # systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
151 # usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
152 # systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
153 # userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
154 # systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
155 # systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
156 # systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
157 # systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
158 # udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
159 # udevhomedir = udevlibexecdir
160 # udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
161 # udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
162 # catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
163 # kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
164 # factorydir = join_paths(datadir, 'factory')
165 # docdir = join_paths(datadir, 'doc/systemd')
166 # bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
167 # testsdir = join_paths(prefixdir, 'lib/systemd/tests')
168 # systemdstatedir = join_paths(localstatedir, 'lib/systemd')
169 # catalogstatedir = join_paths(systemdstatedir, 'catalog')
170 # randomseeddir = join_paths(localstatedir, 'lib/systemd')
171 #else
172 pkgdatadir = join_paths(datadir, 'elogind')
173 pkgsysconfdir = join_paths(sysconfdir, 'elogind')
174 pkgincludedir = join_paths(includedir, 'elogind/systemd')
175 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
176 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
177
178 # in elogind, udev is external and thus configurable
179 udevlibexecdir = get_option('udevbindir')
180 udevlibexecdir = udevlibexecdir != '' ? udevlibexecdir : join_paths(rootprefixdir, 'lib/udev')
181 udevrulesdir = get_option('udevrulesdir')
182 udevrulesdir = udevrulesdir != '' ? udevrulesdir : join_paths(udevlibexecdir, 'rules.d')
183 udevhomedir = udevlibexecdir
184 factorydir = join_paths(datadir, 'factory')
185 docdir = get_option('docdir')
186 docdir = docdir != '' ? docdir: '-'.join([join_paths(datadir, 'doc/elogind'),
187                                           meson.project_version()])
188 testsdir = join_paths(prefixdir, 'lib/elogind/tests')
189 randomseeddir = join_paths(localstatedir, 'lib/elogind')
190 #endif // 0
191
192 dbuspolicydir = get_option('dbuspolicydir')
193 if dbuspolicydir == ''
194         dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
195 endif
196
197 dbussessionservicedir = get_option('dbussessionservicedir')
198 if dbussessionservicedir == ''
199         dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
200 endif
201
202 dbussystemservicedir = get_option('dbussystemservicedir')
203 if dbussystemservicedir == ''
204         dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
205 endif
206
207 pamlibdir = get_option('pamlibdir')
208 if pamlibdir == ''
209         pamlibdir = join_paths(rootlibdir, 'security')
210 endif
211
212 pamconfdir = get_option('pamconfdir')
213 if pamconfdir == ''
214         pamconfdir = join_paths(sysconfdir, 'pam.d')
215 endif
216
217 conf.set_quoted('PKGSYSCONFDIR',                              pkgsysconfdir)
218 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH',                    join_paths(pkgsysconfdir, 'system'))
219 #if 0 /// UNNEEDED by elogind
220 # conf.set_quoted('SYSTEM_DATA_UNIT_PATH',                      systemunitdir)
221 # conf.set_quoted('SYSTEM_SYSVINIT_PATH',                       sysvinit_path)
222 # conf.set_quoted('SYSTEM_SYSVRCND_PATH',                       sysvrcnd_path)
223 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START',                 get_option('rc-local'))
224 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP',                  get_option('halt-local'))
225 # conf.set_quoted('USER_CONFIG_UNIT_PATH',                      join_paths(pkgsysconfdir, 'user'))
226 # conf.set_quoted('USER_DATA_UNIT_PATH',                        userunitdir)
227 # conf.set_quoted('CERTIFICATE_ROOT',                           get_option('certificate-root'))
228 # conf.set_quoted('CATALOG_DATABASE',                           join_paths(catalogstatedir, 'database'))
229 # conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH',                  join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
230 # conf.set_quoted('SYSTEMD_BINARY_PATH',                        join_paths(rootlibexecdir, 'systemd'))
231 # conf.set_quoted('SYSTEMD_FSCK_PATH',                          join_paths(rootlibexecdir, 'systemd-fsck'))
232 # conf.set_quoted('SYSTEMD_MAKEFS_PATH',                        join_paths(rootlibexecdir, 'systemd-makefs'))
233 # conf.set_quoted('SYSTEMD_GROWFS_PATH',                        join_paths(rootlibexecdir, 'systemd-growfs'))
234 # conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH',               join_paths(rootlibexecdir, 'systemd-shutdown'))
235 # conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH',                  join_paths(rootlibexecdir, 'systemd-sleep'))
236 # conf.set_quoted('SYSTEMCTL_BINARY_PATH',                      join_paths(rootbindir, 'systemctl'))
237 # conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
238 # conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH',           join_paths(bindir, 'systemd-stdio-bridge'))
239 #else
240 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH',                  join_paths(rootlibexecdir, 'elogind-cgroups-agent'))
241 conf.set_quoted('ELOGIND_UACCESS_COMMAND_PATH',               join_paths(rootlibexecdir, 'elogind-uaccess-command'))
242 conf.set_quoted('SYSTEMD_BINARY_PATH',                        join_paths(rootlibexecdir, 'elogind'))
243 #endif // 0
244 conf.set_quoted('ROOTPREFIX',                                 rootprefixdir)
245 #if 0 /// UNNEEDED by elogind
246 # conf.set_quoted('RANDOM_SEED_DIR',                            randomseeddir)
247 # conf.set_quoted('RANDOM_SEED',                                join_paths(randomseeddir, 'random-seed'))
248 # conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH',                    join_paths(rootlibexecdir, 'systemd-cryptsetup'))
249 # conf.set_quoted('SYSTEM_GENERATOR_PATH',                      systemgeneratordir)
250 # conf.set_quoted('USER_GENERATOR_PATH',                        usergeneratordir)
251 # conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH',                  systemenvgeneratordir)
252 # conf.set_quoted('USER_ENV_GENERATOR_PATH',                    userenvgeneratordir)
253 #endif // 0
254 conf.set_quoted('SYSTEM_SHUTDOWN_PATH',                       systemshutdowndir)
255 conf.set_quoted('SYSTEM_SLEEP_PATH',                          systemsleepdir)
256 #if 0 /// UNNEEDED by elogind
257 # conf.set_quoted('SYSTEMD_KBD_MODEL_MAP',                      join_paths(pkgdatadir, 'kbd-model-map'))
258 # conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP',              join_paths(pkgdatadir, 'language-fallback-map'))
259 #endif // 0
260 conf.set_quoted('UDEVLIBEXECDIR',                             udevlibexecdir)
261 conf.set_quoted('POLKIT_AGENT_BINARY_PATH',                   join_paths(bindir, 'pkttyagent'))
262 conf.set_quoted('LIBDIR',                                     libdir)
263 conf.set_quoted('ROOTLIBDIR',                                 rootlibdir)
264 conf.set_quoted('ROOTLIBEXECDIR',                             rootlibexecdir)
265 #if 0 /// UNNEEDED by elogind
266 # conf.set_quoted('BOOTLIBDIR',                                 bootlibdir)
267 # conf.set_quoted('SYSTEMD_PULL_PATH',                          join_paths(rootlibexecdir, 'systemd-pull'))
268 # conf.set_quoted('SYSTEMD_IMPORT_PATH',                        join_paths(rootlibexecdir, 'systemd-import'))
269 # conf.set_quoted('SYSTEMD_EXPORT_PATH',                        join_paths(rootlibexecdir, 'systemd-export'))
270 # conf.set_quoted('VENDOR_KEYRING_PATH',                        join_paths(rootlibexecdir, 'import-pubring.gpg'))
271 # conf.set_quoted('USER_KEYRING_PATH',                          join_paths(pkgsysconfdir, 'import-pubring.gpg'))
272 # conf.set_quoted('DOCUMENT_ROOT',                              join_paths(pkgdatadir, 'gatewayd'))
273 #endif // 0
274
275 conf.set_quoted('ABS_BUILD_DIR',                              meson.build_root())
276 conf.set_quoted('ABS_SRC_DIR',                                meson.source_root())
277
278 substs.set('prefix',                                          prefixdir)
279 substs.set('exec_prefix',                                     prefixdir)
280 substs.set('libdir',                                          libdir)
281 substs.set('rootlibdir',                                      rootlibdir)
282 substs.set('includedir',                                      includedir)
283 substs.set('pkgsysconfdir',                                   pkgsysconfdir)
284 substs.set('bindir',                                          bindir)
285 substs.set('rootbindir',                                      rootbindir)
286 substs.set('rootlibexecdir',                                  rootlibexecdir)
287 #if 0 /// UNNEEDED by elogind
288 # substs.set('systemunitdir',                                   systemunitdir)
289 # substs.set('userunitdir',                                     userunitdir)
290 # substs.set('systempresetdir',                                 systempresetdir)
291 # substs.set('userpresetdir',                                   userpresetdir)
292 # substs.set('udevhwdbdir',                                     udevhwdbdir)
293 #endif // 0
294 substs.set('udevrulesdir',                                    udevrulesdir)
295 substs.set('udevlibexecdir',                                  udevlibexecdir)
296 #if 0 /// UNNEEDED by elogind
297 # substs.set('catalogdir',                                      catalogdir)
298 # substs.set('tmpfilesdir',                                     tmpfilesdir)
299 # substs.set('sysusersdir',                                     sysusersdir)
300 # substs.set('sysctldir',                                       sysctldir)
301 # substs.set('binfmtdir',                                       binfmtdir)
302 # substs.set('modulesloaddir',                                  modulesloaddir)
303 # substs.set('systemgeneratordir',                              systemgeneratordir)
304 # substs.set('usergeneratordir',                                usergeneratordir)
305 # substs.set('systemenvgeneratordir',                           systemenvgeneratordir)
306 # substs.set('userenvgeneratordir',                             userenvgeneratordir)
307 #endif // 0
308 substs.set('systemshutdowndir',                               systemshutdowndir)
309 substs.set('systemsleepdir',                                  systemsleepdir)
310 substs.set('VARLOGDIR',                                       varlogdir)
311 #if 0 /// UNNEEDED by elogind
312 # substs.set('CERTIFICATEROOT',                                 get_option('certificate-root'))
313 # substs.set('SYSTEMCTL',                                       join_paths(rootbindir, 'systemctl'))
314 # substs.set('RANDOM_SEED',                                     join_paths(randomseeddir, 'random-seed'))
315 # substs.set('SYSTEM_SYSVINIT_PATH',                            sysvinit_path)
316 # substs.set('SYSTEM_SYSVRCND_PATH',                            sysvrcnd_path)
317 # substs.set('RC_LOCAL_SCRIPT_PATH_START',                      get_option('rc-local'))
318 # substs.set('RC_LOCAL_SCRIPT_PATH_STOP',                       get_option('halt-local'))
319 #endif // 0
320
321 #####################################################################
322
323 cc = meson.get_compiler('c')
324 pkgconfig = import('pkgconfig')
325 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
326
327 if get_option('tests') != 'false'
328         cxx = find_program('c++', required : false)
329         if cxx.found()
330                 #  Used only for tests
331                 add_languages('cpp')
332         endif
333 endif
334
335 want_ossfuzz = get_option('oss-fuzz')
336 want_libfuzzer = get_option('llvm-fuzz')
337 fuzzer_build = want_ossfuzz or want_libfuzzer
338 if want_ossfuzz and want_libfuzzer
339         error('only one of oss-fuzz and llvm-fuzz can be specified')
340 endif
341 if want_libfuzzer
342         fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
343 endif
344 if want_ossfuzz
345         fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
346 endif
347
348 foreach arg : ['-Wextra',
349                '-Werror=undef',
350                '-Wlogical-op',
351                '-Wmissing-include-dirs',
352                '-Wold-style-definition',
353                '-Wpointer-arith',
354                '-Winit-self',
355                '-Wdeclaration-after-statement',
356                '-Wfloat-equal',
357                '-Wsuggest-attribute=noreturn',
358                '-Werror=missing-prototypes',
359                '-Werror=implicit-function-declaration',
360                '-Werror=missing-declarations',
361                '-Werror=return-type',
362                '-Werror=incompatible-pointer-types',
363                '-Werror=format=2',
364                '-Wstrict-prototypes',
365                '-Wredundant-decls',
366                '-Wmissing-noreturn',
367                '-Wimplicit-fallthrough=5',
368                '-Wshadow',
369                '-Wendif-labels',
370                '-Wstrict-aliasing=2',
371                '-Wwrite-strings',
372                '-Werror=overflow',
373                '-Wdate-time',
374                '-Wnested-externs',
375                '-ffast-math',
376                '-fno-common',
377                '-fdiagnostics-show-option',
378                '-fno-strict-aliasing',
379                '-fvisibility=hidden',
380                '-fstack-protector',
381                '-fstack-protector-strong',
382                '--param=ssp-buffer-size=4',
383               ]
384         if cc.has_argument(arg)
385                 add_project_arguments(arg, language : 'c')
386         endif
387 endforeach
388
389 # the oss-fuzz fuzzers are not built with -fPIE, so don't
390 # enable it when we are linking against them
391 if not fuzzer_build
392         if cc.has_argument('-fPIE')
393               add_project_arguments('-fPIE', language : 'c')
394         endif
395 endif
396
397 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
398 # arguments, just emits a warnings. So test for the "positive" version instead.
399 foreach arg : ['unused-parameter',
400                'missing-field-initializers',
401                'unused-result',
402                'format-signedness',
403                'error=nonnull', # work-around for gcc 7.1 turning this on on its own
404               ]
405         if cc.has_argument('-W' + arg)
406                 add_project_arguments('-Wno-' + arg, language : 'c')
407         endif
408 endforeach
409
410 if cc.compiles('
411    #include <time.h>
412    #include <inttypes.h>
413    typedef uint64_t usec_t;
414    usec_t now(clockid_t clock);
415    int main(void) {
416            struct timespec now;
417            return 0;
418    }
419 ', name : '-Werror=shadow with local shadowing')
420         add_project_arguments('-Werror=shadow', language : 'c')
421 endif
422
423 if cc.get_id() == 'clang'
424         foreach arg : ['-Wno-typedef-redefinition',
425                        '-Wno-gnu-variable-sized-type-not-at-end',
426                       ]
427                 if cc.has_argument(arg,
428                                    name : '@0@ is supported'.format(arg))
429                         add_project_arguments(arg, language : 'c')
430                 endif
431         endforeach
432 endif
433
434 link_test_c = files('tools/meson-link-test.c')
435
436 # --as-needed and --no-undefined are provided by meson by default,
437 # run mesonconf to see what is enabled
438 foreach arg : ['-Wl,-z,relro',
439                '-Wl,-z,now',
440                '-pie',
441               ]
442
443         have = run_command(check_compilation_sh,
444                            cc.cmd_array(), '-x', 'c', arg,
445                            '-include', link_test_c).returncode() == 0
446         message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
447         if have and (arg != '-pie' or not fuzzer_build)
448                 add_project_link_arguments(arg, language : 'c')
449         endif
450 endforeach
451
452 if get_option('buildtype') != 'debug'
453         foreach arg : ['-ffunction-sections',
454                        '-fdata-sections']
455                 if cc.has_argument(arg,
456                                    name : '@0@ is supported'.format(arg))
457                         add_project_arguments(arg, language : 'c')
458                 endif
459         endforeach
460
461         foreach arg : ['-Wl,--gc-sections']
462                 have = run_command(check_compilation_sh,
463                                    cc.cmd_array(), '-x', 'c', arg,
464                                    '-include', link_test_c).returncode() == 0
465                 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
466                 if have
467                         add_project_link_arguments(arg, language : 'c')
468                 endif
469         endforeach
470 endif
471
472 cpp = ' '.join(cc.cmd_array()) + ' -E'
473
474 #####################################################################
475 # compilation result tests
476
477 conf.set('_GNU_SOURCE', true)
478 conf.set('__SANE_USERSPACE_TYPES__', true)
479
480 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
481 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
482 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
483 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
484 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
485 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
486 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
487
488 decl_headers = '''
489 #include <uchar.h>
490 #include <linux/ethtool.h>
491 #include <linux/fib_rules.h>
492 '''
493 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
494
495 foreach decl : ['char16_t',
496                 'char32_t',
497                 'key_serial_t',
498                 'struct ethtool_link_settings',
499                 'struct fib_rule_uid_range',
500                ]
501
502         # We get -1 if the size cannot be determined
503         have = cc.sizeof(decl, prefix : decl_headers) > 0
504         conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
505 endforeach
506
507 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE',         'linux/if_link.h'],
508                 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
509                 ['IFLA_VRF_TABLE',                   'linux/if_link.h'],
510                 ['IFLA_MACVLAN_FLAGS',               'linux/if_link.h'],
511                 ['IFLA_IPVLAN_FLAGS',                'linux/if_link.h'],
512                 ['IFLA_PHYS_PORT_ID',                'linux/if_link.h'],
513                 ['IFLA_BOND_AD_INFO',                'linux/if_link.h'],
514                 ['IFLA_VLAN_PROTOCOL',               'linux/if_link.h'],
515                 ['IFLA_VXLAN_REMCSUM_NOPARTIAL',     'linux/if_link.h'],
516                 ['IFLA_VXLAN_GPE',                   'linux/if_link.h'],
517                 ['IFLA_GENEVE_LABEL',                'linux/if_link.h'],
518                 # if_tunnel.h is buggy and cannot be included on its own
519                 ['IFLA_VTI_REMOTE',                  'linux/if_tunnel.h', '#include <net/if.h>'],
520                 ['IFLA_IPTUN_ENCAP_DPORT',           'linux/if_tunnel.h', '#include <net/if.h>'],
521                 ['IFLA_GRE_ENCAP_DPORT',             'linux/if_tunnel.h', '#include <net/if.h>'],
522                 ['IFLA_BRIDGE_VLAN_INFO',            'linux/if_bridge.h'],
523                 ['IFLA_BRPORT_PROXYARP',             'linux/if_link.h'],
524                 ['IFLA_BRPORT_LEARNING_SYNC',        'linux/if_link.h'],
525                 ['IFLA_BR_VLAN_DEFAULT_PVID',        'linux/if_link.h'],
526                 ['IPVLAN_F_PRIVATE',                 'linux/if_link.h'],
527                 ['NDA_IFINDEX',                      'linux/neighbour.h'],
528                 ['IFA_FLAGS',                        'linux/if_addr.h'],
529                 ['FRA_UID_RANGE',                    'linux/fib_rules.h'],
530                 ['LO_FLAGS_PARTSCAN',                'linux/loop.h'],
531                 ['VXCAN_INFO_PEER',                  'linux/can/vxcan.h'],
532                ]
533         prefix = decl.length() > 2 ? decl[2] : ''
534         have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
535         conf.set10('HAVE_' + decl[0], have)
536 endforeach
537
538 foreach ident : ['secure_getenv', '__secure_getenv']
539         conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
540 endforeach
541
542 foreach ident : [
543         ['memfd_create',      '''#include <sys/mman.h>'''],
544         ['gettid',            '''#include <sys/types.h>
545 //                                 #include <unistd.h>'''],
546         ['pivot_root',        '''#include <stdlib.h>
547                                  #include <unistd.h>'''],     # no known header declares pivot_root
548         ['name_to_handle_at', '''#include <sys/types.h>
549                                  #include <sys/stat.h>
550                                  #include <fcntl.h>'''],
551         ['setns',             '''#include <sched.h>'''],
552         ['renameat2',         '''#include <stdio.h>
553 //                                 #include <fcntl.h>'''],
554         ['kcmp',              '''#include <linux/kcmp.h>'''],
555         ['keyctl',            '''#include <sys/types.h>
556                                  #include <keyutils.h>'''],
557         ['copy_file_range',   '''#include <sys/syscall.h>
558                                  #include <unistd.h>'''],
559         ['bpf',               '''#include <sys/syscall.h>
560                                  #include <unistd.h>'''],
561         ['explicit_bzero' ,   '''#include <string.h>'''],
562 ]
563
564         have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
565         conf.set10('HAVE_' + ident[0].to_upper(), have)
566 endforeach
567
568 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
569         conf.set10('USE_SYS_RANDOM_H', true)
570         conf.set10('HAVE_GETRANDOM', true)
571 else
572         have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
573         conf.set10('USE_SYS_RANDOM_H', false)
574         conf.set10('HAVE_GETRANDOM', have)
575 endif
576
577 #####################################################################
578
579 sed = find_program('sed')
580 awk = find_program('awk')
581 m4 = find_program('m4')
582 stat = find_program('stat')
583 git = find_program('git', required : false)
584
585 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
586 #if 1 /// Needed by elogind
587 meson_symlink_headers = meson.source_root() + '/tools/meson-symlink_headers.sh'
588 #endif // 1
589 mkdir_p = 'mkdir -p $DESTDIR/@0@'
590 #if 0 /// unneeded by elogind
591 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
592 # splash_bmp = files('test/splash.bmp')
593 #endif // 0
594
595 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
596 # /usr/sbin, /sbin, and fall back to the default from middle column.
597 #if 0 /// elogind has a bit different list and some adaptions
598 # progs = [['quotaon',    '/usr/sbin/quotaon'    ],
599 #          ['quotacheck', '/usr/sbin/quotacheck' ],
600 #          ['kill',       '/usr/bin/kill'        ],
601 #          ['kmod',       '/usr/bin/kmod'        ],
602 #          ['kexec',      '/usr/sbin/kexec'      ],
603 #          ['sulogin',    '/usr/sbin/sulogin'    ],
604 #          ['mount',      '/usr/bin/mount',      'MOUNT_PATH'],
605 #          ['umount',     '/usr/bin/umount',     'UMOUNT_PATH'],
606 #          ['loadkeys',   '/usr/bin/loadkeys',   'KBD_LOADKEYS'],
607 #          ['setfont',    '/usr/bin/setfont',    'KBD_SETFONT'],
608 #         ]
609 #else
610 progs = [['kexec',      '/usr/sbin/kexec',     'KEXEC'],
611          ['reboot',     '/sbin/reboot',        'REBOOT'],
612          ['halt',       '/sbin/halt',          'HALT'],
613         ]
614 #endif // 0
615 foreach prog : progs
616         path = get_option(prog[0] + '-path')
617         if path != ''
618                 message('Using @1@ for @0@'.format(prog[0], path))
619         else
620                 exe = find_program(prog[0],
621                                    '/usr/sbin/' + prog[0],
622                                    '/sbin/' + prog[0],
623                                    required: false)
624                 path = exe.found() ? exe.path() : prog[1]
625         endif
626         name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
627         conf.set_quoted(name, path)
628         substs.set(name, path)
629 endforeach
630
631 conf.set_quoted('TELINIT', get_option('telinit-path'))
632
633 if run_command('ln', '--relative', '--help').returncode() != 0
634         error('ln does not support --relative')
635 endif
636
637 ############################################################
638
639 gperf = find_program('gperf')
640
641 gperf_test_format = '''
642 #include <string.h>
643 const char * in_word_set(const char *, @0@);
644 @1@
645 '''
646 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
647 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
648 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
649 if cc.compiles(gperf_test)
650         gperf_len_type = 'size_t'
651 else
652         gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
653         if cc.compiles(gperf_test)
654                 gperf_len_type = 'unsigned'
655         else
656                 error('unable to determine gperf len type')
657         endif
658 endif
659 message('gperf len type is @0@'.format(gperf_len_type))
660 conf.set('GPERF_LEN_TYPE', gperf_len_type,
661          description : 'The type of gperf "len" parameter')
662
663 ############################################################
664
665 if not cc.has_header('sys/capability.h')
666         error('POSIX caps headers not found')
667 endif
668 foreach header : ['crypt.h',
669                   'linux/btrfs.h',
670                   'linux/memfd.h',
671                   'linux/vm_sockets.h',
672                   'sys/auxv.h',
673                   'valgrind/memcheck.h',
674                   'valgrind/valgrind.h',
675                  ]
676
677         conf.set10('HAVE_' + header.underscorify().to_upper(),
678                    cc.has_header(header))
679 endforeach
680
681 ############################################################
682
683 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
684 #if 0 /// UNNEEDED by elogind
685 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
686 # gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
687 #endif // 0
688
689 default_hierarchy = get_option('default-hierarchy')
690 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
691                 description : 'default cgroup hierarchy as string')
692 if default_hierarchy == 'legacy'
693         conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
694 elif default_hierarchy == 'hybrid'
695         conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
696 else
697         conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
698 endif
699
700 #if 0 /// UNNEEDED by elogind
701 # time_epoch = get_option('time-epoch')
702 # if time_epoch == ''
703 #         NEWS = files('NEWS')
704 #         time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
705 # endif
706 # time_epoch = time_epoch.to_int()
707 # conf.set('TIME_EPOCH', time_epoch)
708 #else
709 ############################################################
710 # elogind needs to know which cgroups controller to follow.
711 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
712 with_cgroupctrl = get_option('cgroup-controller')
713 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
714         with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
715 elif with_cgroupctrl == 'none'
716         with_cgroupctrl = 'elogind'
717 endif
718
719 # No controller now is a problem:
720 if with_cgroupctrl == ''
721         error('Unable to determine cgroup controller, but cgroups support is mandatory!')
722 endif
723
724 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
725                 description : 'name of the cgroup controller to use')
726 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
727                 '='.join(['name', with_cgroupctrl]))
728 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
729                 '='.join(['name', with_cgroupctrl]))
730 ############################################################
731 #endif // 0
732
733 system_uid_max = get_option('system-uid-max')
734 if system_uid_max == ''
735         system_uid_max = run_command(
736                 awk,
737                 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
738                 '/etc/login.defs').stdout()
739 endif
740 system_uid_max = system_uid_max.to_int()
741 conf.set('SYSTEM_UID_MAX', system_uid_max)
742 substs.set('systemuidmax', system_uid_max)
743 message('maximum system UID is @0@'.format(system_uid_max))
744
745 system_gid_max = get_option('system-gid-max')
746 if system_gid_max == ''
747         system_gid_max = run_command(
748                 awk,
749                 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
750                 '/etc/login.defs').stdout()
751 endif
752 system_gid_max = system_gid_max.to_int()
753 conf.set('SYSTEM_GID_MAX', system_gid_max)
754 substs.set('systemgidmax', system_gid_max)
755 message('maximum system GID is @0@'.format(system_gid_max))
756
757 #if 0 /// UNNEEDED by elogind
758 # dynamic_uid_min = get_option('dynamic-uid-min').to_int()
759 # dynamic_uid_max = get_option('dynamic-uid-max').to_int()
760 # conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
761 # conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
762 # substs.set('dynamicuidmin', dynamic_uid_min)
763 # substs.set('dynamicuidmax', dynamic_uid_max)
764
765 # container_uid_base_min = get_option('container-uid-base-min').to_int()
766 # container_uid_base_max = get_option('container-uid-base-max').to_int()
767 # conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
768 # conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
769 # substs.set('containeruidbasemin', container_uid_base_min)
770 # substs.set('containeruidbasemax', container_uid_base_max)
771 #endif // 0
772
773 nobody_user = get_option('nobody-user')
774 nobody_group = get_option('nobody-group')
775
776 getent_result = run_command('getent', 'passwd', '65534')
777 if getent_result.returncode() == 0
778         name = getent_result.stdout().split(':')[0]
779         if name != nobody_user
780                 message('WARNING:\n' +
781                         '        The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
782                         '        Your build will result in an user table setup that is incompatible with the local system.')
783         endif
784 endif
785 id_result = run_command('id', '-u', nobody_user)
786 if id_result.returncode() == 0
787         id = id_result.stdout().to_int()
788         if id != 65534
789                 message('WARNING:\n' +
790                         '        The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
791                         '        Your build will result in an user table setup that is incompatible with the local system.')
792         endif
793 endif
794
795 getent_result = run_command('getent', 'group', '65534')
796 if getent_result.returncode() == 0
797         name = getent_result.stdout().split(':')[0]
798         if name != nobody_group
799                 message('WARNING:\n' +
800                         '        The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
801                         '        Your build will result in an group table setup that is incompatible with the local system.')
802         endif
803 endif
804 id_result = run_command('id', '-g', nobody_group)
805 if id_result.returncode() == 0
806         id = id_result.stdout().to_int()
807         if id != 65534
808                 message('WARNING:\n' +
809                         '        The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
810                         '        Your build will result in an group table setup that is incompatible with the local system.')
811         endif
812 endif
813 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
814         message('WARNING:\n' +
815                 '        The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
816                 '        Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
817 endif
818
819 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
820 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
821 substs.set('NOBODY_USER_NAME', nobody_user)
822 substs.set('NOBODY_GROUP_NAME', nobody_group)
823
824 tty_gid = get_option('tty-gid')
825 conf.set('TTY_GID', tty_gid)
826 substs.set('TTY_GID', tty_gid)
827
828 #if 0 /// UNNEEDED by elogind
829 # # Ensure provided GID argument is numeric, otherwise fallback to default assignment
830 # if get_option('users-gid') != ''
831 #         users_gid = get_option('users-gid').to_int()
832 # else
833 #         users_gid = '-'
834 # endif
835 # substs.set('USERS_GID', users_gid)
836
837 # if get_option('adm-group')
838 #         m4_defines += ['-DENABLE_ADM_GROUP']
839 # endif
840
841 # if get_option('wheel-group')
842 #         m4_defines += ['-DENABLE_WHEEL_GROUP']
843 # endif
844
845 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
846 # substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
847 #endif // 0
848
849 kill_user_processes = get_option('default-kill-user-processes')
850 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
851 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
852
853 #if 0 /// UNNEEDED by elogind
854 # dns_servers = get_option('dns-servers')
855 # conf.set_quoted('DNS_SERVERS', dns_servers)
856 # substs.set('DNS_SERVERS', dns_servers)
857
858 # ntp_servers = get_option('ntp-servers')
859 # conf.set_quoted('NTP_SERVERS', ntp_servers)
860 # substs.set('NTP_SERVERS', ntp_servers)
861 #endif // 0
862
863 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
864
865 #if 0 /// UNNEEDED by elogind
866 # substs.set('SUSHELL', get_option('debug-shell'))
867 # substs.set('DEBUGTTY', get_option('debug-tty'))
868 #endif // 0
869
870 debug = get_option('debug')
871 enable_debug_hashmap = false
872 enable_debug_mmap_cache = false
873 #if 1 /// additional elogind debug mode
874 enable_debug_elogind = false
875 #endif // 1
876 if debug != ''
877         foreach name : debug.split(',')
878                 if name == 'hashmap'
879                         enable_debug_hashmap = true
880                 elif name == 'mmap-cache'
881                         enable_debug_mmap_cache = true
882 #if 1 /// additional elogind debug mode
883                 elif name == 'elogind'
884                         enable_debug_elogind = true
885 #endif // 1
886                 else
887                         message('unknown debug option "@0@", ignoring'.format(name))
888                 endif
889         endforeach
890 endif
891 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
892 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
893 #if 1 /// additional elogind debug mode
894 conf.set10('ENABLE_DEBUG_ELOGIND', enable_debug_elogind)
895 #endif // 1
896
897 #####################################################################
898
899 threads = dependency('threads')
900 librt = cc.find_library('rt')
901 libm = cc.find_library('m')
902 libdl = cc.find_library('dl')
903 libcrypt = cc.find_library('crypt')
904
905 libcap = dependency('libcap', required : false)
906 if not libcap.found()
907         # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
908         libcap = cc.find_library('cap')
909 endif
910
911 #if 0 /// UNNEEDED by elogind
912 # libmount = dependency('mount',
913 #                       version : '>= 2.30',
914 #                       required : not fuzzer_build)
915
916 # want_seccomp = get_option('seccomp')
917 # if want_seccomp != 'false' and not fuzzer_build
918 #         libseccomp = dependency('libseccomp',
919 #                                 version : '>= 2.3.1',
920 #                                 required : want_seccomp == 'true')
921 #         have = libseccomp.found()
922 # else
923 #         have = false
924 #         libseccomp = []
925 # endif
926 #else
927 libseccomp = []
928 #endif // 0
929 conf.set10('HAVE_SECCOMP', have)
930 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
931
932 want_selinux = get_option('selinux')
933 if want_selinux != 'false' and not fuzzer_build
934         libselinux = dependency('libselinux',
935                                 version : '>= 2.1.9',
936                                 required : want_selinux == 'true')
937         have = libselinux.found()
938 else
939         have = false
940         libselinux = []
941 endif
942 conf.set10('HAVE_SELINUX', have)
943 m4_defines += have ? ['-DHAVE_SELINUX'] : []
944
945 #if 0 /// UNNEEDED by elogind
946 # want_apparmor = get_option('apparmor')
947 # if want_apparmor != 'false' and not fuzzer_build
948 #         libapparmor = dependency('libapparmor',
949 #                                  required : want_apparmor == 'true')
950 #         have = libapparmor.found()
951 # else
952 #         have = false
953 #         libapparmor = []
954 # endif
955 #else
956 libapparmor = []
957 #endif // 0
958 conf.set10('HAVE_APPARMOR', have)
959 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
960
961 smack_run_label = get_option('smack-run-label')
962 if smack_run_label != ''
963         conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
964         m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
965 endif
966
967 want_polkit = get_option('polkit')
968 install_polkit = false
969 install_polkit_pkla = false
970 if want_polkit != 'false' and not fuzzer_build
971         install_polkit = true
972
973         libpolkit = dependency('polkit-gobject-1',
974                                required : false)
975         if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
976                 message('Old polkit detected, will install pkla files')
977                 install_polkit_pkla = true
978         endif
979 endif
980 conf.set10('ENABLE_POLKIT', install_polkit)
981
982 want_acl = get_option('acl')
983 if want_acl != 'false' and not fuzzer_build
984         libacl = cc.find_library('acl', required : want_acl == 'true')
985         have = libacl.found()
986 else
987         have = false
988         libacl = []
989 endif
990 conf.set10('HAVE_ACL', have)
991 m4_defines += have ? ['-DHAVE_ACL'] : []
992
993 want_audit = get_option('audit')
994 if want_audit != 'false' and not fuzzer_build
995         libaudit = dependency('audit', required : want_audit == 'true')
996         have = libaudit.found()
997 else
998         have = false
999         libaudit = []
1000 endif
1001 conf.set10('HAVE_AUDIT', have)
1002
1003 #if 0 /// UNNEEDED by elogind
1004 # want_blkid = get_option('blkid')
1005 # if want_blkid != 'false' and not fuzzer_build
1006 #         libblkid = dependency('blkid', required : want_blkid == 'true')
1007 #         have = libblkid.found()
1008 # else
1009 #         have = false
1010 #         libblkid = []
1011 # endif
1012 # conf.set10('HAVE_BLKID', have)
1013
1014 # want_kmod = get_option('kmod')
1015 # if want_kmod != 'false' and not fuzzer_build
1016 #         libkmod = dependency('libkmod',
1017 #                              version : '>= 15',
1018 #                              required : want_kmod == 'true')
1019 #         have = libkmod.found()
1020 # else
1021 #         have = false
1022 #         libkmod = []
1023 # endif
1024 # conf.set10('HAVE_KMOD', have)
1025 #else
1026 libblkid = []
1027 libkmod = []
1028 #endif // 0
1029
1030 want_pam = get_option('pam')
1031 if want_pam != 'false' and not fuzzer_build
1032         libpam = cc.find_library('pam', required : want_pam == 'true')
1033         libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1034         have = libpam.found() and libpam_misc.found()
1035 else
1036         have = false
1037         libpam = []
1038         libpam_misc = []
1039 endif
1040 conf.set10('HAVE_PAM', have)
1041 m4_defines += have ? ['-DHAVE_PAM'] : []
1042
1043 #if 0 /// UNNEEDED by elogind
1044 # want_microhttpd = get_option('microhttpd')
1045 # if want_microhttpd != 'false' and not fuzzer_build
1046 #         libmicrohttpd = dependency('libmicrohttpd',
1047 #                                    version : '>= 0.9.33',
1048 #                                    required : want_microhttpd == 'true')
1049 #         have = libmicrohttpd.found()
1050 # else
1051 #         have = false
1052 #         libmicrohttpd = []
1053 # endif
1054 # conf.set10('HAVE_MICROHTTPD', have)
1055 # m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
1056
1057 # want_libcryptsetup = get_option('libcryptsetup')
1058 # if want_libcryptsetup != 'false' and not fuzzer_build
1059 #         libcryptsetup = dependency('libcryptsetup',
1060 #                                    version : '>= 1.6.0',
1061 #                                    required : want_libcryptsetup == 'true')
1062 #         have = libcryptsetup.found()
1063 # else
1064 #         have = false
1065 #         libcryptsetup = []
1066 # endif
1067 # conf.set10('HAVE_LIBCRYPTSETUP', have)
1068
1069 # want_libcurl = get_option('libcurl')
1070 # if want_libcurl != 'false' and not fuzzer_build
1071 #         libcurl = dependency('libcurl',
1072 #                              version : '>= 7.32.0',
1073 #                              required : want_libcurl == 'true')
1074 #         have = libcurl.found()
1075 # else
1076 #         have = false
1077 #         libcurl = []
1078 # endif
1079 # conf.set10('HAVE_LIBCURL', have)
1080 # m4_defines += have ? ['-DHAVE_LIBCURL'] : []
1081
1082 # want_libidn = get_option('libidn')
1083 # want_libidn2 = get_option('libidn2')
1084 # if want_libidn == 'true' and want_libidn2 == 'true'
1085 #         error('libidn and libidn2 cannot be requested simultaneously')
1086 # endif
1087
1088 # if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
1089 #         libidn = dependency('libidn',
1090 #                             required : want_libidn == 'true')
1091 #         have = libidn.found()
1092 # else
1093 #         have = false
1094 #         libidn = []
1095 # endif
1096 # conf.set10('HAVE_LIBIDN', have)
1097 # m4_defines += have ? ['-DHAVE_LIBIDN'] : []
1098 # if not have and want_libidn2 != 'false' and not fuzzer_build
1099 #         # libidn is used for both libidn and libidn2 objects
1100 #         libidn = dependency('libidn2',
1101 #                             required : want_libidn2 == 'true')
1102 #         have = libidn.found()
1103 # else
1104 #         have = false
1105 # endif
1106 # conf.set10('HAVE_LIBIDN2', have)
1107 # m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
1108
1109 # want_libiptc = get_option('libiptc')
1110 # if want_libiptc != 'false' and not fuzzer_build
1111 #         libiptc = dependency('libiptc',
1112 #                              required : want_libiptc == 'true')
1113 #         have = libiptc.found()
1114 # else
1115 #         have = false
1116 #         libiptc = []
1117 # endif
1118 # conf.set10('HAVE_LIBIPTC', have)
1119 # m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
1120
1121 # want_qrencode = get_option('qrencode')
1122 # if want_qrencode != 'false' and not fuzzer_build
1123 #         libqrencode = dependency('libqrencode',
1124 #                                  required : want_qrencode == 'true')
1125 #         have = libqrencode.found()
1126 # else
1127 #         have = false
1128 #         libqrencode = []
1129 # endif
1130 # conf.set10('HAVE_QRENCODE', have)
1131
1132 # want_gcrypt = get_option('gcrypt')
1133 # if want_gcrypt != 'false' and not fuzzer_build
1134 #         libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1135 #         libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1136 #         have = libgcrypt.found() and libgpg_error.found()
1137 # else
1138 #         have = false
1139 # endif
1140 # if not have
1141 #         # link to neither of the libs if one is not found
1142 #         libgcrypt = []
1143 #         libgpg_error = []
1144 # endif
1145 # conf.set10('HAVE_GCRYPT', have)
1146
1147 # want_gnutls = get_option('gnutls')
1148 # if want_gnutls != 'false' and not fuzzer_build
1149 #         libgnutls = dependency('gnutls',
1150 #                                version : '>= 3.1.4',
1151 #                                required : want_gnutls == 'true')
1152 #         have = libgnutls.found()
1153 # else
1154 #         have = false
1155 #         libgnutls = []
1156 # endif
1157 # conf.set10('HAVE_GNUTLS', have)
1158
1159 # want_elfutils = get_option('elfutils')
1160 # if want_elfutils != 'false' and not fuzzer_build
1161 #         libdw = dependency('libdw',
1162 #                            required : want_elfutils == 'true')
1163 #         have = libdw.found()
1164 # else
1165 #         have = false
1166 #         libdw = []
1167 # endif
1168 # conf.set10('HAVE_ELFUTILS', have)
1169
1170 # want_zlib = get_option('zlib')
1171 # if want_zlib != 'false' and not fuzzer_build
1172 #         libz = dependency('zlib',
1173 #                           required : want_zlib == 'true')
1174 #         have = libz.found()
1175 # else
1176 #         have = false
1177 #         libz = []
1178 # endif
1179 # conf.set10('HAVE_ZLIB', have)
1180
1181 # want_bzip2 = get_option('bzip2')
1182 # if want_bzip2 != 'false' and not fuzzer_build
1183 #         libbzip2 = cc.find_library('bz2',
1184 #                                    required : want_bzip2 == 'true')
1185 #         have = libbzip2.found()
1186 # else
1187 #         have = false
1188 #         libbzip2 = []
1189 # endif
1190 # conf.set10('HAVE_BZIP2', have)
1191
1192 # want_xz = get_option('xz')
1193 # if want_xz != 'false' and not fuzzer_build
1194 #         libxz = dependency('liblzma',
1195 #                            required : want_xz == 'true')
1196 #         have = libxz.found()
1197 # else
1198 #         have = false
1199 #         libxz = []
1200 # endif
1201 # conf.set10('HAVE_XZ', have)
1202
1203 # want_lz4 = get_option('lz4')
1204 # if want_lz4 != 'false' and not fuzzer_build
1205 #         liblz4 = dependency('liblz4',
1206 #                             required : want_lz4 == 'true')
1207 #         have = liblz4.found()
1208 # else
1209 #         have = false
1210 #         liblz4 = []
1211 # endif
1212 # conf.set10('HAVE_LZ4', have)
1213
1214 # want_xkbcommon = get_option('xkbcommon')
1215 # if want_xkbcommon != 'false' and not fuzzer_build
1216 #         libxkbcommon = dependency('xkbcommon',
1217 #                                   version : '>= 0.3.0',
1218 #                                   required : want_xkbcommon == 'true')
1219 #         have = libxkbcommon.found()
1220 # else
1221 #         have = false
1222 #         libxkbcommon = []
1223 # endif
1224 #else
1225 libmicrohttpd = []
1226 libcryptsetup = []
1227 libcurl = []
1228 libidn = []
1229 libiptc = []
1230 libqrencode = []
1231 libgcrypt = []
1232 libgpg_error = []
1233 libgnutls = []
1234 libdw = []
1235 libz = []
1236 libbzip2 = []
1237 libxz = []
1238 liblz4 = []
1239 libxkbcommon = []
1240 #endif // 0
1241 conf.set10('HAVE_XKBCOMMON', have)
1242
1243 want_glib = get_option('glib')
1244 if want_glib != 'false' and not fuzzer_build
1245         libglib =    dependency('glib-2.0',
1246                                 version : '>= 2.22.0',
1247                                 required : want_glib == 'true')
1248         libgobject = dependency('gobject-2.0',
1249                                 version : '>= 2.22.0',
1250                                 required : want_glib == 'true')
1251         libgio =     dependency('gio-2.0',
1252                                 required : want_glib == 'true')
1253         have = libglib.found() and libgobject.found() and libgio.found()
1254 else
1255         have = false
1256         libglib = []
1257         libgobject = []
1258         libgio = []
1259 endif
1260 conf.set10('HAVE_GLIB', have)
1261
1262 want_dbus = get_option('dbus')
1263 if want_dbus != 'false' and not fuzzer_build
1264         libdbus = dependency('dbus-1',
1265                              version : '>= 1.3.2',
1266                              required : want_dbus == 'true')
1267         have = libdbus.found()
1268 else
1269         have = false
1270         libdbus = []
1271 endif
1272 conf.set10('HAVE_DBUS', have)
1273
1274 #if 0 /// UNNEEDED by elogind
1275 # default_dnssec = get_option('default-dnssec')
1276 # if fuzzer_build
1277 #         default_dnssec = 'no'
1278 # endif
1279 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1280 #         message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1281 #         default_dnssec = 'no'
1282 # endif
1283 # conf.set('DEFAULT_DNSSEC_MODE',
1284 #          'DNSSEC_' + default_dnssec.underscorify().to_upper())
1285 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1286
1287 # want_importd = get_option('importd')
1288 # if want_importd != 'false'
1289 #         have = (conf.get('HAVE_LIBCURL') == 1 and
1290 #                 conf.get('HAVE_ZLIB') == 1 and
1291 #                 conf.get('HAVE_BZIP2') == 1 and
1292 #                 conf.get('HAVE_XZ') == 1 and
1293 #                 conf.get('HAVE_GCRYPT') == 1)
1294 #         if want_importd == 'true' and not have
1295 #                 error('importd support was requested, but dependencies are not available')
1296 #         endif
1297 # else
1298 #         have = false
1299 # endif
1300 # conf.set10('ENABLE_IMPORTD', have)
1301
1302 # want_remote = get_option('remote')
1303 # if want_remote != 'false'
1304 #         have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1305 #                      conf.get('HAVE_LIBCURL') == 1]
1306 #         # sd-j-remote requires Âµhttpd, and sd-j-upload requires libcurl, so
1307 #         # it's possible to build one without the other. Complain only if
1308 #         # support was explictly requested. The auxiliary files like sysusers
1309 #         # config should be installed when any of the programs are built.
1310 #         if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1311 #                 error('remote support was requested, but dependencies are not available')
1312 #         endif
1313 #         have = have_deps[0] or have_deps[1]
1314 # else
1315 #         have = false
1316 # endif
1317 #endif // 0
1318 conf.set10('ENABLE_REMOTE', have)
1319
1320 foreach term : ['utmp',
1321 #if 0 /// UNNEEDED by elogind
1322 #                 'hibernate',
1323 #                 'environment-d',
1324 #                 'binfmt',
1325 #                 'coredump',
1326 #                 'resolve',
1327 #                 'logind',
1328 #                 'hostnamed',
1329 #                 'localed',
1330 #                 'machined',
1331 #                 'networkd',
1332 #                 'timedated',
1333 #                 'timesyncd',
1334 #                 'myhostname',
1335 #                 'firstboot',
1336 #                 'randomseed',
1337 #                 'backlight',
1338 #                 'vconsole',
1339 #                 'quotacheck',
1340 #                 'sysusers',
1341 #                 'tmpfiles',
1342 #                 'hwdb',
1343 #                 'rfkill',
1344 #                 'ldconfig',
1345 #                 'efi',
1346 #                 'tpm',
1347 #                 'ima',
1348 #                 'smack',
1349 #                 'gshadow',
1350 #                 'idn',
1351 #                 'nss-systemd']
1352 #else
1353                 'smack']
1354 #endif // 0
1355         have = get_option(term)
1356         name = 'ENABLE_' + term.underscorify().to_upper()
1357         conf.set10(name, have)
1358         m4_defines += have ? ['-D' + name] : []
1359 endforeach
1360
1361 want_tests = get_option('tests')
1362 install_tests = get_option('install-tests')
1363 tests = []
1364 fuzzers = []
1365
1366 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1367
1368 #####################################################################
1369
1370 #if 0 /// UNNEEDED by elogind
1371 # if get_option('efi')
1372 #         efi_arch = host_machine.cpu_family()
1373
1374 #         if efi_arch == 'x86'
1375 #                 EFI_MACHINE_TYPE_NAME = 'ia32'
1376 #                 gnu_efi_arch = 'ia32'
1377 #         elif efi_arch == 'x86_64'
1378 #                 EFI_MACHINE_TYPE_NAME = 'x64'
1379 #                 gnu_efi_arch = 'x86_64'
1380 #         elif efi_arch == 'arm'
1381 #                 EFI_MACHINE_TYPE_NAME = 'arm'
1382 #                 gnu_efi_arch = 'arm'
1383 #         elif efi_arch == 'aarch64'
1384 #                 EFI_MACHINE_TYPE_NAME = 'aa64'
1385 #                 gnu_efi_arch = 'aarch64'
1386 #         else
1387 #                 EFI_MACHINE_TYPE_NAME = ''
1388 #                 gnu_efi_arch = ''
1389 #         endif
1390
1391 #         have = true
1392 #         conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1393
1394 #         conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1395 # else
1396 #         have = false
1397 # endif
1398 #endif // 0
1399 conf.set10('ENABLE_EFI', have)
1400
1401 #####################################################################
1402
1403 config_h = configure_file(
1404         output : 'config.h',
1405         configuration : conf)
1406
1407 includes = include_directories('src/basic',
1408                                'src/shared',
1409                                'src/systemd',
1410 #if 0 /// UNNEEDED by elogind
1411 #                                'src/journal',
1412 #                                'src/resolve',
1413 #                                'src/timesync',
1414 #endif // 0
1415                                'src/login',
1416 #if 0 /// UNNEEDED by elogind
1417 #                                'src/udev',
1418 #                                'src/libudev',
1419 #endif // 0
1420                                'src/core',
1421 #if 0 /// elogind has a different list
1422 #                                'src/libsystemd/sd-bus',
1423 #                                'src/libsystemd/sd-device',
1424 #                                'src/libsystemd/sd-hwdb',
1425 #                                'src/libsystemd/sd-id128',
1426 #                                'src/libsystemd/sd-netlink',
1427 #                                'src/libsystemd/sd-network',
1428 #                                'src/libsystemd-network',
1429 #                                '.')
1430 #else
1431                                'src/libelogind/sd-bus',
1432                                'src/libelogind/sd-id128',
1433                                'src/sleep',
1434                                'src/update-utmp',
1435 #endif // 0
1436
1437 add_project_arguments('-include', 'config.h', language : 'c')
1438
1439 #if 0 /// UNNEEDED by elogind
1440 #endif // 0
1441 subdir('po')
1442 #if 0 /// UNNEEDED by elogind
1443 # subdir('catalog')
1444 #endif // 0
1445 subdir('src/systemd')
1446 subdir('src/basic')
1447 #if 0 /// UNNEEDED by elogind
1448 # subdir('src/libsystemd')
1449 # subdir('src/libsystemd-network')
1450 # subdir('src/journal')
1451 #else
1452 subdir('src/core')
1453 subdir('src/libelogind')
1454 subdir('src/sleep')
1455 subdir('src/update-utmp')
1456 #endif // 0
1457 subdir('src/login')
1458
1459 #if 0 /// UNNEEDED by elogind
1460 # libjournal_core = static_library(
1461 #         'journal-core',
1462 #         libjournal_core_sources,
1463 #         journald_gperf_c,
1464 #         include_directories : includes,
1465 #         install : false)
1466
1467 # libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1468 # libsystemd = shared_library(
1469 #         'systemd',
1470 #         'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
1471 #         version : libsystemd_version,
1472 #         include_directories : includes,
1473 #         link_args : ['-shared',
1474 #                      '-Wl,--version-script=' + libsystemd_sym_path],
1475 #         link_with : [libbasic,
1476 #                      libbasic_gcrypt],
1477 #         link_whole : [libsystemd_static,
1478 #                       libjournal_client],
1479 #         dependencies : [threads,
1480 #                         librt,
1481 #                         libxz,
1482 #                         liblz4],
1483 #         link_depends : libsystemd_sym,
1484 #         install : true,
1485 #         install_dir : rootlibdir)
1486 #else
1487 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1488 libelogind = shared_library(
1489         'elogind',
1490         libelogind_internal_sources,
1491         version : libelogind_version,
1492         include_directories : includes,
1493         link_args : ['-shared',
1494                      '-Wl,--version-script=' + libelogind_sym_path],
1495         link_with : [libbasic],
1496         dependencies : [threads],
1497         link_depends : libelogind_sym,
1498         install : true,
1499         install_dir : rootlibdir)
1500 #endif // 0
1501
1502 ############################################################
1503
1504 # binaries that have --help and are intended for use by humans,
1505 # usually, but not always, installed in /bin.
1506 public_programs = []
1507
1508 #if 0 /// UNNEEDED by elogind
1509 # subdir('src/libudev')
1510 #else
1511 # elogind depends on external libudev:
1512 libudev = dependency('libudev', required : true)
1513 #endif // 0
1514 subdir('src/shared')
1515 #if 0 /// UNNEEDED by elogind
1516 # subdir('src/core')
1517 # subdir('src/udev')
1518 # subdir('src/network')
1519
1520 # subdir('src/analyze')
1521 # subdir('src/journal-remote')
1522 # subdir('src/coredump')
1523 # subdir('src/hostname')
1524 # subdir('src/import')
1525 # subdir('src/kernel-install')
1526 # subdir('src/locale')
1527 # subdir('src/machine')
1528 # subdir('src/nspawn')
1529 # subdir('src/resolve')
1530 # subdir('src/timedate')
1531 # subdir('src/timesync')
1532 # subdir('src/vconsole')
1533 # subdir('src/boot/efi')
1534 #endif // 0
1535
1536 subdir('src/test')
1537 subdir('src/fuzz')
1538 #if 0 /// UNNEEDED in elogind
1539 # subdir('rules')
1540 # subdir('test')
1541 #endif // 0
1542
1543 ############################################################
1544
1545 # only static linking apart from libdl, to make sure that the
1546 # module is linked to all libraries that it uses.
1547 test_dlopen = executable(
1548         'test-dlopen',
1549         test_dlopen_c,
1550         include_directories : includes,
1551         link_with : [libbasic],
1552         dependencies : [libdl])
1553
1554 #if 0 /// UNNEEDED by elogind
1555 # foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1556 #                  ['systemd',    'ENABLE_NSS_SYSTEMD'],
1557 #                  ['mymachines', 'ENABLE_MACHINED'],
1558 #                  ['resolve',    'ENABLE_RESOLVE']]
1559
1560 #         condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1561 #         if condition
1562 #                 module = tuple[0]
1563
1564 #                 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1565 #                 version_script_arg = join_paths(meson.current_source_dir(), sym)
1566
1567 #                 nss = shared_library(
1568 #                         'nss_' + module,
1569 #                         'src/nss-@0@/nss-@0@.c'.format(module),
1570 #                         version : '2',
1571 #                         include_directories : includes,
1572 #                         # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1573 #                         link_args : ['-Wl,-z,nodelete',
1574 #                                      '-shared',
1575 #                                      '-Wl,--version-script=' + version_script_arg,
1576 #                                      '-Wl,--undefined'],
1577 #                         link_with : [libsystemd_static,
1578 #                                      libbasic],
1579 #                         dependencies : [threads,
1580 #                                         librt],
1581 #                         link_depends : sym,
1582 #                         install : true,
1583 #                         install_dir : rootlibdir)
1584
1585 #                 # We cannot use shared_module because it does not support version suffix.
1586 #                 # Unfortunately shared_library insists on creating the symlink…
1587 #                 meson.add_install_script('sh', '-c',
1588 #                                          'rm $DESTDIR@0@/libnss_@1@.so'
1589 #                                          .format(rootlibdir, module))
1590
1591 #                 test('dlopen-nss_' + module,
1592 #                      test_dlopen,
1593 #                      args : [nss.full_path()]) # path to dlopen must include a slash
1594 #         endif
1595 # endforeach
1596 #endif // 0
1597
1598 ############################################################
1599
1600 #if 0 /// UNNEEDED by elogind
1601 # executable('systemd',
1602 #            systemd_sources,
1603 #            include_directories : includes,
1604 #            link_with : [libcore,
1605 #                         libshared],
1606 #            dependencies : [threads,
1607 #                            librt,
1608 #                            libseccomp,
1609 #                            libselinux,
1610 #                            libmount,
1611 #                            libblkid],
1612 #            install_rpath : rootlibexecdir,
1613 #            install : true,
1614 #            install_dir : rootlibexecdir)
1615
1616 # exe = executable('systemd-analyze',
1617 #                  systemd_analyze_sources,
1618 #                  include_directories : includes,
1619 #                  link_with : [libcore,
1620 #                               libshared],
1621 #                  dependencies : [threads,
1622 #                                  librt,
1623 #                                  libseccomp,
1624 #                                  libselinux,
1625 #                                  libmount,
1626 #                                  libblkid],
1627 #                  install_rpath : rootlibexecdir,
1628 #                  install : true)
1629 # public_programs += [exe]
1630
1631 # executable('systemd-journald',
1632 #            systemd_journald_sources,
1633 #            include_directories : includes,
1634 #            link_with : [libjournal_core,
1635 #                         libshared],
1636 #            dependencies : [threads,
1637 #                            libxz,
1638 #                            liblz4,
1639 #                            libselinux],
1640 #            install_rpath : rootlibexecdir,
1641 #            install : true,
1642 #            install_dir : rootlibexecdir)
1643
1644 # exe = executable('systemd-cat',
1645 #                  systemd_cat_sources,
1646 #                  include_directories : includes,
1647 #                  link_with : [libjournal_core,
1648 #                               libshared],
1649 #                  dependencies : [threads],
1650 #                  install_rpath : rootlibexecdir,
1651 #                  install : true)
1652 # public_programs += [exe]
1653
1654 # exe = executable('journalctl',
1655 #                  journalctl_sources,
1656 #                  include_directories : includes,
1657 #                  link_with : [libshared],
1658 #                  dependencies : [threads,
1659 #                                  libqrencode,
1660 #                                  libxz,
1661 #                                  liblz4],
1662 #                  install_rpath : rootlibexecdir,
1663 #                  install : true,
1664 #                  install_dir : rootbindir)
1665 # public_programs += [exe]
1666
1667 # executable('systemd-getty-generator',
1668 #            'src/getty-generator/getty-generator.c',
1669 #            include_directories : includes,
1670 #            link_with : [libshared],
1671 #            install_rpath : rootlibexecdir,
1672 #            install : true,
1673 #            install_dir : systemgeneratordir)
1674
1675 # executable('systemd-debug-generator',
1676 #            'src/debug-generator/debug-generator.c',
1677 #            include_directories : includes,
1678 #            link_with : [libshared],
1679 #            install_rpath : rootlibexecdir,
1680 #            install : true,
1681 #            install_dir : systemgeneratordir)
1682
1683 # executable('systemd-fstab-generator',
1684 #            'src/fstab-generator/fstab-generator.c',
1685 #            'src/core/mount-setup.c',
1686 #            include_directories : includes,
1687 #            link_with : [libshared],
1688 #            install_rpath : rootlibexecdir,
1689 #            install : true,
1690 #            install_dir : systemgeneratordir)
1691
1692 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1693 #         executable('30-systemd-environment-d-generator',
1694 #                    'src/environment-d-generator/environment-d-generator.c',
1695 #                    include_directories : includes,
1696 #                    link_with : [libshared],
1697 #                    install_rpath : rootlibexecdir,
1698 #                    install : true,
1699 #                    install_dir : userenvgeneratordir)
1700
1701 #         meson.add_install_script(meson_make_symlink,
1702 #                                  join_paths(sysconfdir, 'environment'),
1703 #                                  join_paths(environmentdir, '99-environment.conf'))
1704 # endif
1705
1706 # if conf.get('ENABLE_HIBERNATE') == 1
1707 #         executable('systemd-hibernate-resume-generator',
1708 #                    'src/hibernate-resume/hibernate-resume-generator.c',
1709 #                    include_directories : includes,
1710 #                    link_with : [libshared],
1711 #                    install_rpath : rootlibexecdir,
1712 #                    install : true,
1713 #                    install_dir : systemgeneratordir)
1714
1715 #         executable('systemd-hibernate-resume',
1716 #                    'src/hibernate-resume/hibernate-resume.c',
1717 #                    include_directories : includes,
1718 #                    link_with : [libshared],
1719 #                    install_rpath : rootlibexecdir,
1720 #                    install : true,
1721 #                    install_dir : rootlibexecdir)
1722 # endif
1723
1724 # if conf.get('HAVE_BLKID') == 1
1725 #         executable('systemd-gpt-auto-generator',
1726 #                    'src/gpt-auto-generator/gpt-auto-generator.c',
1727 #                    'src/basic/blkid-util.h',
1728 #                    include_directories : includes,
1729 #                    link_with : [libshared],
1730 #                    dependencies : libblkid,
1731 #                    install_rpath : rootlibexecdir,
1732 #                    install : true,
1733 #                    install_dir : systemgeneratordir)
1734
1735 #         exe = executable('systemd-dissect',
1736 #                          'src/dissect/dissect.c',
1737 #                          include_directories : includes,
1738 #                          link_with : [libshared],
1739 #                          install_rpath : rootlibexecdir,
1740 #                          install : true,
1741 #                          install_dir : rootlibexecdir)
1742 #         public_programs += [exe]
1743 # endif
1744
1745 # if conf.get('ENABLE_RESOLVE') == 1
1746 #         executable('systemd-resolved',
1747 #                    systemd_resolved_sources,
1748 #                    include_directories : includes,
1749 #                    link_with : [libshared,
1750 #                                 libbasic_gcrypt,
1751 #                                 libsystemd_resolve_core],
1752 #                    dependencies : [threads,
1753 #                                    libgpg_error,
1754 #                                    libm,
1755 #                                    libidn],
1756 #                    install_rpath : rootlibexecdir,
1757 #                    install : true,
1758 #                    install_dir : rootlibexecdir)
1759
1760 #         exe = executable('systemd-resolve',
1761 #                          systemd_resolve_sources,
1762 #                          include_directories : includes,
1763 #                          link_with : [libshared,
1764 #                                       libbasic_gcrypt,
1765 #                                       libsystemd_resolve_core],
1766 #                          dependencies : [threads,
1767 #                                          libgpg_error,
1768 #                                          libm,
1769 #                                          libidn],
1770 #                          install_rpath : rootlibexecdir,
1771 #                          install : true)
1772 #         public_programs += [exe]
1773 # endif
1774
1775 # if conf.get('ENABLE_LOGIND') == 1
1776 #         executable('systemd-logind',
1777 #                    systemd_logind_sources,
1778 #                    include_directories : includes,
1779 #                    link_with : [liblogind_core,
1780 #                                 libshared],
1781 #                    dependencies : [threads,
1782 #                                    libacl],
1783 #                    install_rpath : rootlibexecdir,
1784 #                    install : true,
1785 #                    install_dir : rootlibexecdir)
1786
1787 #         exe = executable('loginctl',
1788 #                          loginctl_sources,
1789 #                          include_directories : includes,
1790 #                          link_with : [libshared],
1791 #                          dependencies : [threads,
1792 #                                          liblz4,
1793 #                                          libxz],
1794 #                          install_rpath : rootlibexecdir,
1795 #                          install : true,
1796 #                          install_dir : rootbindir)
1797 #         public_programs += [exe]
1798
1799 #         exe = executable('systemd-inhibit',
1800 #                          'src/login/inhibit.c',
1801 #                          include_directories : includes,
1802 #                          link_with : [libshared],
1803 #                          install_rpath : rootlibexecdir,
1804 #                          install : true,
1805 #                          install_dir : rootbindir)
1806 #         public_programs += [exe]
1807
1808 #         if conf.get('HAVE_PAM') == 1
1809 #                 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1810 #                 pam_systemd = shared_library(
1811 #                         'pam_systemd',
1812 #                         pam_systemd_c,
1813 #                         name_prefix : '',
1814 #                         include_directories : includes,
1815 #                         link_args : ['-shared',
1816 #                                      '-Wl,--version-script=' + version_script_arg],
1817 #                         link_with : [libsystemd_static,
1818 #                                      libshared_static],
1819 #                         dependencies : [threads,
1820 #                                         libpam,
1821 #                                         libpam_misc],
1822 #                         link_depends : pam_systemd_sym,
1823 #                         install : true,
1824 #                         install_dir : pamlibdir)
1825
1826 #                 test('dlopen-pam_systemd',
1827 #                      test_dlopen,
1828 #                      args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1829 #         endif
1830 # endif
1831 #else
1832
1833 executable('elogind',
1834                 elogind_sources,
1835                 include_directories : includes,
1836                 link_with : [liblogind_core,
1837                              libshared],
1838                 dependencies : [threads,
1839                                 libacl,
1840                                 libudev],
1841                 install_rpath : rootlibexecdir,
1842                 install : true,
1843                 install_dir : rootlibexecdir)
1844
1845 exe = executable('loginctl',
1846                         loginctl_sources,
1847                         include_directories : includes,
1848                         link_with : [libshared],
1849                         dependencies : [threads,
1850                                         libudev],
1851                         install_rpath : rootlibexecdir,
1852                         install : true,
1853                         install_dir : rootbindir)
1854 public_programs += [exe]
1855
1856 exe = executable('elogind-inhibit',
1857                         'src/login/inhibit.c',
1858                         include_directories : includes,
1859                         link_with : [libshared],
1860                         dependencies : [threads],
1861                         install_rpath : rootlibexecdir,
1862                         install : true,
1863                         install_dir : rootbindir)
1864 public_programs += [exe]
1865
1866 if conf.get('HAVE_PAM') == 1
1867         version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1868         pam_elogind = shared_library(
1869                 'pam_elogind',
1870                 pam_elogind_c,
1871                 name_prefix : '',
1872                 include_directories : includes,
1873                 link_args : ['-shared',
1874                                 '-Wl,--version-script=' + version_script_arg],
1875                 link_with : [libelogind,
1876                              libshared_static],
1877                 dependencies : [threads,
1878                                 libpam,
1879                                 libpam_misc],
1880                 link_depends : pam_elogind_sym,
1881                 install : true,
1882                 install_dir : pamlibdir)
1883
1884         test('dlopen-pam_elogind',
1885              test_dlopen,
1886              args : [pam_elogind.full_path()]) # path to dlopen must include a slash
1887 endif
1888 #endif // 0
1889 #if 0 /// UNNEEDED by elogind
1890 #         executable('systemd-user-sessions',
1891 #                    'src/user-sessions/user-sessions.c',
1892 #                    include_directories : includes,
1893 #                    link_with : [libshared],
1894 #                    install_rpath : rootlibexecdir,
1895 #                    install : true,
1896 #                    install_dir : rootlibexecdir)
1897 # endif
1898
1899 # if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1900 #         exe = executable('bootctl',
1901 #                          'src/boot/bootctl.c',
1902 #                          include_directories : includes,
1903 #                          link_with : [libshared],
1904 #                          dependencies : [libblkid],
1905 #                          install_rpath : rootlibexecdir,
1906 #                          install : true)
1907 #         public_programs += [exe]
1908 # endif
1909
1910 # exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1911 #                  include_directories : includes,
1912 #                  link_with : [libshared],
1913 #                  dependencies : [threads],
1914 #                  install_rpath : rootlibexecdir,
1915 #                  install : true)
1916 # public_programs += [exe]
1917
1918 # exe = executable('systemctl', 'src/systemctl/systemctl.c',
1919 #                  include_directories : includes,
1920 #                  link_with : [libshared],
1921 #                  dependencies : [threads,
1922 #                                  libcap,
1923 #                                  libselinux,
1924 #                                  libxz,
1925 #                                  liblz4],
1926 #                  install_rpath : rootlibexecdir,
1927 #                  install : true,
1928 #                  install_dir : rootbindir)
1929 # public_programs += [exe]
1930
1931 # if conf.get('ENABLE_BACKLIGHT') == 1
1932 #         executable('systemd-backlight',
1933 #                    'src/backlight/backlight.c',
1934 #                    include_directories : includes,
1935 #                    link_with : [libshared],
1936 #                    install_rpath : rootlibexecdir,
1937 #                    install : true,
1938 #                    install_dir : rootlibexecdir)
1939 # endif
1940
1941 # if conf.get('ENABLE_RFKILL') == 1
1942 #         executable('systemd-rfkill',
1943 #                    'src/rfkill/rfkill.c',
1944 #                    include_directories : includes,
1945 #                    link_with : [libshared],
1946 #                    install_rpath : rootlibexecdir,
1947 #                    install : true,
1948 #                    install_dir : rootlibexecdir)
1949 # endif
1950
1951 # executable('systemd-system-update-generator',
1952 #            'src/system-update-generator/system-update-generator.c',
1953 #            include_directories : includes,
1954 #            link_with : [libshared],
1955 #            install_rpath : rootlibexecdir,
1956 #            install : true,
1957 #            install_dir : systemgeneratordir)
1958
1959 # if conf.get('HAVE_LIBCRYPTSETUP') == 1
1960 #         executable('systemd-cryptsetup',
1961 #                    'src/cryptsetup/cryptsetup.c',
1962 #                    include_directories : includes,
1963 #                    link_with : [libshared],
1964 #                    dependencies : [libcryptsetup],
1965 #                    install_rpath : rootlibexecdir,
1966 #                    install : true,
1967 #                    install_dir : rootlibexecdir)
1968
1969 #         executable('systemd-cryptsetup-generator',
1970 #                    'src/cryptsetup/cryptsetup-generator.c',
1971 #                    include_directories : includes,
1972 #                    link_with : [libshared],
1973 #                    dependencies : [libcryptsetup],
1974 #                    install_rpath : rootlibexecdir,
1975 #                    install : true,
1976 #                    install_dir : systemgeneratordir)
1977
1978 #         executable('systemd-veritysetup',
1979 #                    'src/veritysetup/veritysetup.c',
1980 #                    include_directories : includes,
1981 #                    link_with : [libshared],
1982 #                    dependencies : [libcryptsetup],
1983 #                    install_rpath : rootlibexecdir,
1984 #                    install : true,
1985 #                    install_dir : rootlibexecdir)
1986
1987 #         executable('systemd-veritysetup-generator',
1988 #                    'src/veritysetup/veritysetup-generator.c',
1989 #                    include_directories : includes,
1990 #                    link_with : [libshared],
1991 #                    dependencies : [libcryptsetup],
1992 #                    install_rpath : rootlibexecdir,
1993 #                    install : true,
1994 #                    install_dir : systemgeneratordir)
1995 # endif
1996
1997 # if conf.get('HAVE_SYSV_COMPAT') == 1
1998 #         executable('systemd-sysv-generator',
1999 #                    'src/sysv-generator/sysv-generator.c',
2000 #                    include_directories : includes,
2001 #                    link_with : [libshared],
2002 #                    install_rpath : rootlibexecdir,
2003 #                    install : true,
2004 #                    install_dir : systemgeneratordir)
2005
2006 #         executable('systemd-rc-local-generator',
2007 #                    'src/rc-local-generator/rc-local-generator.c',
2008 #                    include_directories : includes,
2009 #                    link_with : [libshared],
2010 #                    install_rpath : rootlibexecdir,
2011 #                    install : true,
2012 #                    install_dir : systemgeneratordir)
2013 # endif
2014
2015 # if conf.get('ENABLE_HOSTNAMED') == 1
2016 #         executable('systemd-hostnamed',
2017 #                    'src/hostname/hostnamed.c',
2018 #                    include_directories : includes,
2019 #                    link_with : [libshared],
2020 #                    install_rpath : rootlibexecdir,
2021 #                    install : true,
2022 #                    install_dir : rootlibexecdir)
2023
2024 #         exe = executable('hostnamectl',
2025 #                          'src/hostname/hostnamectl.c',
2026 #                          include_directories : includes,
2027 #                          link_with : [libshared],
2028 #                          install_rpath : rootlibexecdir,
2029 #                          install : true)
2030 #         public_programs += [exe]
2031 # endif
2032
2033 # if conf.get('ENABLE_LOCALED') == 1
2034 #         if conf.get('HAVE_XKBCOMMON') == 1
2035 #                 # logind will load libxkbcommon.so dynamically on its own
2036 #                 deps = [libdl]
2037 #         else
2038 #                 deps = []
2039 #         endif
2040
2041 #         executable('systemd-localed',
2042 #                    systemd_localed_sources,
2043 #                    include_directories : includes,
2044 #                    link_with : [libshared],
2045 #                    dependencies : deps,
2046 #                    install_rpath : rootlibexecdir,
2047 #                    install : true,
2048 #                    install_dir : rootlibexecdir)
2049
2050 #         exe = executable('localectl',
2051 #                          localectl_sources,
2052 #                          include_directories : includes,
2053 #                          link_with : [libshared],
2054 #                          install_rpath : rootlibexecdir,
2055 #                          install : true)
2056 #         public_programs += [exe]
2057 # endif
2058
2059 # if conf.get('ENABLE_TIMEDATED') == 1
2060 #         executable('systemd-timedated',
2061 #                    'src/timedate/timedated.c',
2062 #                    include_directories : includes,
2063 #                    link_with : [libshared],
2064 #                    install_rpath : rootlibexecdir,
2065 #                    install : true,
2066 #                    install_dir : rootlibexecdir)
2067
2068 #         exe = executable('timedatectl',
2069 #                          'src/timedate/timedatectl.c',
2070 #                          include_directories : includes,
2071 #                          install_rpath : rootlibexecdir,
2072 #                          link_with : [libshared],
2073 #                          install : true)
2074 #         public_programs += [exe]
2075 # endif
2076
2077 # if conf.get('ENABLE_TIMESYNCD') == 1
2078 #         executable('systemd-timesyncd',
2079 #                    systemd_timesyncd_sources,
2080 #                    include_directories : includes,
2081 #                    link_with : [libshared],
2082 #                    dependencies : [threads,
2083 #                                    libm],
2084 #                    install_rpath : rootlibexecdir,
2085 #                    install : true,
2086 #                    install_dir : rootlibexecdir)
2087 # endif
2088
2089 # if conf.get('ENABLE_MACHINED') == 1
2090 #         executable('systemd-machined',
2091 #                    systemd_machined_sources,
2092 #                    include_directories : includes,
2093 #                    link_with : [libmachine_core,
2094 #                                 libshared],
2095 #                    install_rpath : rootlibexecdir,
2096 #                    install : true,
2097 #                    install_dir : rootlibexecdir)
2098
2099 #         exe = executable('machinectl',
2100 #                          'src/machine/machinectl.c',
2101 #                          include_directories : includes,
2102 #                          link_with : [libshared],
2103 #                          dependencies : [threads,
2104 #                                          libxz,
2105 #                                          liblz4],
2106 #                          install_rpath : rootlibexecdir,
2107 #                          install : true,
2108 #                          install_dir : rootbindir)
2109 #         public_programs += [exe]
2110 # endif
2111
2112 # if conf.get('ENABLE_IMPORTD') == 1
2113 #         executable('systemd-importd',
2114 #                    systemd_importd_sources,
2115 #                    include_directories : includes,
2116 #                    link_with : [libshared],
2117 #                    dependencies : [threads],
2118 #                    install_rpath : rootlibexecdir,
2119 #                    install : true,
2120 #                    install_dir : rootlibexecdir)
2121
2122 #         systemd_pull = executable('systemd-pull',
2123 #                                   systemd_pull_sources,
2124 #                                   include_directories : includes,
2125 #                                   link_with : [libshared],
2126 #                                   dependencies : [libcurl,
2127 #                                                   libz,
2128 #                                                   libbzip2,
2129 #                                                   libxz,
2130 #                                                   libgcrypt],
2131 #                                   install_rpath : rootlibexecdir,
2132 #                                   install : true,
2133 #                                   install_dir : rootlibexecdir)
2134
2135 #         systemd_import = executable('systemd-import',
2136 #                                     systemd_import_sources,
2137 #                                     include_directories : includes,
2138 #                                     link_with : [libshared],
2139 #                                     dependencies : [libcurl,
2140 #                                                     libz,
2141 #                                                     libbzip2,
2142 #                                                     libxz],
2143 #                                     install_rpath : rootlibexecdir,
2144 #                                     install : true,
2145 #                                     install_dir : rootlibexecdir)
2146
2147 #         systemd_export = executable('systemd-export',
2148 #                                     systemd_export_sources,
2149 #                                     include_directories : includes,
2150 #                                     link_with : [libshared],
2151 #                                     dependencies : [libcurl,
2152 #                                                     libz,
2153 #                                                     libbzip2,
2154 #                                                     libxz],
2155 #                                     install_rpath : rootlibexecdir,
2156 #                                     install : true,
2157 #                                     install_dir : rootlibexecdir)
2158 #         public_programs += [systemd_pull, systemd_import, systemd_export]
2159 # endif
2160
2161 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2162 #         exe = executable('systemd-journal-upload',
2163 #                          systemd_journal_upload_sources,
2164 #                          include_directories : includes,
2165 #                          link_with : [libshared],
2166 #                          dependencies : [threads,
2167 #                                          libcurl,
2168 #                                          libgnutls,
2169 #                                          libxz,
2170 #                                          liblz4],
2171 #                          install_rpath : rootlibexecdir,
2172 #                          install : true,
2173 #                          install_dir : rootlibexecdir)
2174 #         public_programs += [exe]
2175 # endif
2176
2177 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2178 #         s_j_remote = executable('systemd-journal-remote',
2179 #                                 systemd_journal_remote_sources,
2180 #                                 include_directories : includes,
2181 #                                 link_with : [libshared],
2182 #                                 dependencies : [threads,
2183 #                                                 libmicrohttpd,
2184 #                                                 libgnutls,
2185 #                                                 libxz,
2186 #                                                 liblz4],
2187 #                                 install_rpath : rootlibexecdir,
2188 #                                 install : true,
2189 #                                 install_dir : rootlibexecdir)
2190
2191 #         s_j_gatewayd = executable('systemd-journal-gatewayd',
2192 #                                   systemd_journal_gatewayd_sources,
2193 #                                   include_directories : includes,
2194 #                                   link_with : [libshared],
2195 #                                   dependencies : [threads,
2196 #                                                   libmicrohttpd,
2197 #                                                   libgnutls,
2198 #                                                   libxz,
2199 #                                                   liblz4],
2200 #                                   install_rpath : rootlibexecdir,
2201 #                                   install : true,
2202 #                                   install_dir : rootlibexecdir)
2203 #         public_programs += [s_j_remote, s_j_gatewayd]
2204 # endif
2205
2206 # if conf.get('ENABLE_COREDUMP') == 1
2207 #         executable('systemd-coredump',
2208 #                    systemd_coredump_sources,
2209 #                    include_directories : includes,
2210 #                    link_with : [libshared],
2211 #                    dependencies : [threads,
2212 #                                    libacl,
2213 #                                    libdw,
2214 #                                    libxz,
2215 #                                    liblz4],
2216 #                    install_rpath : rootlibexecdir,
2217 #                    install : true,
2218 #                    install_dir : rootlibexecdir)
2219
2220 #         exe = executable('coredumpctl',
2221 #                          coredumpctl_sources,
2222 #                          include_directories : includes,
2223 #                          link_with : [libshared],
2224 #                          dependencies : [threads,
2225 #                                          libxz,
2226 #                                          liblz4],
2227 #                          install_rpath : rootlibexecdir,
2228 #                          install : true)
2229 #         public_programs += [exe]
2230 # endif
2231
2232 # if conf.get('ENABLE_BINFMT') == 1
2233 #         exe = executable('systemd-binfmt',
2234 #                          'src/binfmt/binfmt.c',
2235 #                          include_directories : includes,
2236 #                          link_with : [libshared],
2237 #                          install_rpath : rootlibexecdir,
2238 #                          install : true,
2239 #                          install_dir : rootlibexecdir)
2240 #         public_programs += [exe]
2241
2242 #         meson.add_install_script('sh', '-c',
2243 #                                  mkdir_p.format(binfmtdir))
2244 #         meson.add_install_script('sh', '-c',
2245 #                                  mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2246 # endif
2247
2248 # if conf.get('ENABLE_VCONSOLE') == 1
2249 #         executable('systemd-vconsole-setup',
2250 #                    'src/vconsole/vconsole-setup.c',
2251 #                    include_directories : includes,
2252 #                    link_with : [libshared],
2253 #                    install_rpath : rootlibexecdir,
2254 #                    install : true,
2255 #                    install_dir : rootlibexecdir)
2256 # endif
2257
2258 # if conf.get('ENABLE_RANDOMSEED') == 1
2259 #         executable('systemd-random-seed',
2260 #                    'src/random-seed/random-seed.c',
2261 #                    include_directories : includes,
2262 #                    link_with : [libshared],
2263 #                    install_rpath : rootlibexecdir,
2264 #                    install : true,
2265 #                    install_dir : rootlibexecdir)
2266 # endif
2267
2268 # if conf.get('ENABLE_FIRSTBOOT') == 1
2269 #         executable('systemd-firstboot',
2270 #                    'src/firstboot/firstboot.c',
2271 #                    include_directories : includes,
2272 #                    link_with : [libshared],
2273 #                    dependencies : [libcrypt],
2274 #                    install_rpath : rootlibexecdir,
2275 #                    install : true,
2276 #                    install_dir : rootbindir)
2277 # endif
2278
2279 # executable('systemd-remount-fs',
2280 #            'src/remount-fs/remount-fs.c',
2281 #            'src/core/mount-setup.c',
2282 #            'src/core/mount-setup.h',
2283 #            include_directories : includes,
2284 #            link_with : [libshared],
2285 #            install_rpath : rootlibexecdir,
2286 #            install : true,
2287 #            install_dir : rootlibexecdir)
2288
2289 # executable('systemd-machine-id-setup',
2290 #            'src/machine-id-setup/machine-id-setup-main.c',
2291 #            'src/core/machine-id-setup.c',
2292 #            'src/core/machine-id-setup.h',
2293 #            include_directories : includes,
2294 #            link_with : [libshared],
2295 #            install_rpath : rootlibexecdir,
2296 #            install : true,
2297 #            install_dir : rootbindir)
2298
2299 # executable('systemd-fsck',
2300 #            'src/fsck/fsck.c',
2301 #            include_directories : includes,
2302 #            link_with : [libshared],
2303 #            install_rpath : rootlibexecdir,
2304 #            install : true,
2305 #            install_dir : rootlibexecdir)
2306
2307 # executable('elogind-growfs',
2308 #            'src/partition/growfs.c',
2309 #            include_directories : includes,
2310 #            link_with : [libshared],
2311 #            dependencies : [libcryptsetup],
2312 #            install_rpath : rootlibexecdir,
2313 #            install : true,
2314 #            install_dir : rootlibexecdir)
2315
2316 # executable('elogind-makefs',
2317 #            'src/partition/makefs.c',
2318 #            include_directories : includes,
2319 #            link_with : [libshared],
2320 #            install_rpath : rootlibexecdir,
2321 #            install : true,
2322 #            install_dir : rootlibexecdir)
2323
2324 # executable('systemd-sleep',
2325 #            'src/sleep/sleep.c',
2326 #            include_directories : includes,
2327 #            link_with : [libshared],
2328 #            install_rpath : rootlibexecdir,
2329 #            install : true,
2330 #            install_dir : rootlibexecdir)
2331
2332 # exe = executable('systemd-sysctl',
2333 #                  'src/sysctl/sysctl.c',
2334 #                  include_directories : includes,
2335 #                  link_with : [libshared],
2336 #                  install_rpath : rootlibexecdir,
2337 #                  install : true,
2338 #                  install_dir : rootlibexecdir)
2339 # public_programs += [exe]
2340
2341 # executable('systemd-ac-power',
2342 #            'src/ac-power/ac-power.c',
2343 #            include_directories : includes,
2344 #            link_with : [libshared],
2345 #            install_rpath : rootlibexecdir,
2346 #            install : true,
2347 #            install_dir : rootlibexecdir)
2348
2349 # exe = executable('systemd-detect-virt',
2350 #                  'src/detect-virt/detect-virt.c',
2351 #                  include_directories : includes,
2352 #                  link_with : [libshared],
2353 #                  install_rpath : rootlibexecdir,
2354 #                  install : true)
2355 # public_programs += [exe]
2356
2357 # exe = executable('systemd-delta',
2358 #                  'src/delta/delta.c',
2359 #                  include_directories : includes,
2360 #                  link_with : [libshared],
2361 #                  install_rpath : rootlibexecdir,
2362 #                  install : true)
2363 # public_programs += [exe]
2364
2365 # exe = executable('systemd-escape',
2366 #                  'src/escape/escape.c',
2367 #                  include_directories : includes,
2368 #                  link_with : [libshared],
2369 #                  install_rpath : rootlibexecdir,
2370 #                  install : true,
2371 #                  install_dir : rootbindir)
2372 # public_programs += [exe]
2373
2374 # exe = executable('systemd-notify',
2375 #                  'src/notify/notify.c',
2376 #                  include_directories : includes,
2377 #                  link_with : [libshared],
2378 #                  install_rpath : rootlibexecdir,
2379 #                  install : true,
2380 #                  install_dir : rootbindir)
2381 # public_programs += [exe]
2382
2383 # executable('systemd-volatile-root',
2384 #            'src/volatile-root/volatile-root.c',
2385 #            include_directories : includes,
2386 #            link_with : [libshared],
2387 #            install_rpath : rootlibexecdir,
2388 #            install : true,
2389 #            install_dir : rootlibexecdir)
2390
2391 # executable('systemd-cgroups-agent',
2392 #            'src/cgroups-agent/cgroups-agent.c',
2393 #            include_directories : includes,
2394 #            link_with : [libshared],
2395 #            install_rpath : rootlibexecdir,
2396 #            install : true,
2397 #            install_dir : rootlibexecdir)
2398 #else
2399 executable('elogind-cgroups-agent',
2400            'src/cgroups-agent/cgroups-agent.c',
2401            include_directories : includes,
2402            link_with : [libshared_static],
2403            install_rpath : rootlibexecdir,
2404            install : true,
2405            install_dir : rootlibexecdir)
2406 #endif // 0
2407
2408 #if 0 /// UNNEEDED by elogind
2409 # exe = executable('systemd-path',
2410 #                  'src/path/path.c',
2411 #                  include_directories : includes,
2412 #                  link_with : [libshared],
2413 #                  install_rpath : rootlibexecdir,
2414 #                  install : true)
2415 # public_programs += [exe]
2416
2417 # exe = executable('systemd-ask-password',
2418 #                  'src/ask-password/ask-password.c',
2419 #                  include_directories : includes,
2420 #                  link_with : [libshared],
2421 #                  install_rpath : rootlibexecdir,
2422 #                  install : true,
2423 #                  install_dir : rootbindir)
2424 # public_programs += [exe]
2425
2426 # executable('systemd-reply-password',
2427 #            'src/reply-password/reply-password.c',
2428 #            include_directories : includes,
2429 #            link_with : [libshared],
2430 #            install_rpath : rootlibexecdir,
2431 #            install : true,
2432 #            install_dir : rootlibexecdir)
2433
2434 # exe = executable('systemd-tty-ask-password-agent',
2435 #                  'src/tty-ask-password-agent/tty-ask-password-agent.c',
2436 #                  include_directories : includes,
2437 #                  link_with : [libshared],
2438 #                  install_rpath : rootlibexecdir,
2439 #                  install : true,
2440 #                  install_dir : rootbindir)
2441 # public_programs += [exe]
2442
2443 # exe = executable('systemd-cgls',
2444 #                  'src/cgls/cgls.c',
2445 #                  include_directories : includes,
2446 #                  link_with : [libshared],
2447 #                  install_rpath : rootlibexecdir,
2448 #                  install : true)
2449 # public_programs += [exe]
2450
2451 # exe = executable('systemd-cgtop',
2452 #                  'src/cgtop/cgtop.c',
2453 #                  include_directories : includes,
2454 #                  link_with : [libshared],
2455 #                  install_rpath : rootlibexecdir,
2456 #                  install : true)
2457 # public_programs += [exe]
2458
2459 # executable('systemd-initctl',
2460 #            'src/initctl/initctl.c',
2461 #            include_directories : includes,
2462 #            link_with : [libshared],
2463 #            install_rpath : rootlibexecdir,
2464 #            install : true,
2465 #            install_dir : rootlibexecdir)
2466
2467 # exe = executable('systemd-mount',
2468 #                  'src/mount/mount-tool.c',
2469 #                  include_directories : includes,
2470 #                  link_with : [libshared],
2471 #                  install_rpath : rootlibexecdir,
2472 #                  install : true)
2473 # public_programs += [exe]
2474
2475 # meson.add_install_script(meson_make_symlink,
2476 #                          'systemd-mount', join_paths(bindir, 'systemd-umount'))
2477
2478 # exe = executable('systemd-run',
2479 #                  'src/run/run.c',
2480 #                  include_directories : includes,
2481 #                  link_with : [libshared],
2482 #                  install_rpath : rootlibexecdir,
2483 #                  install : true)
2484 # public_programs += [exe]
2485
2486 # exe = executable('systemd-stdio-bridge',
2487 #                  'src/stdio-bridge/stdio-bridge.c',
2488 #                  include_directories : includes,
2489 #                  link_with : [libshared],
2490 #                  install_rpath : rootlibexecdir,
2491 #                  install : true)
2492 # public_programs += [exe]
2493
2494 # exe = executable('busctl',
2495 #                  'src/busctl/busctl.c',
2496 #                  'src/busctl/busctl-introspect.c',
2497 #                  'src/busctl/busctl-introspect.h',
2498 #                  include_directories : includes,
2499 #                  link_with : [libshared],
2500 #                  install_rpath : rootlibexecdir,
2501 #                  install : true)
2502 # public_programs += [exe]
2503
2504 # if conf.get('ENABLE_SYSUSERS') == 1
2505 #         exe = executable('systemd-sysusers',
2506 #                          'src/sysusers/sysusers.c',
2507 #                          include_directories : includes,
2508 #                          link_with : [libshared],
2509 #                          install_rpath : rootlibexecdir,
2510 #                          install : true,
2511 #                          install_dir : rootbindir)
2512 #         public_programs += [exe]
2513 # endif
2514
2515 # if conf.get('ENABLE_TMPFILES') == 1
2516 #         exe = executable('systemd-tmpfiles',
2517 #                          'src/tmpfiles/tmpfiles.c',
2518 #                          include_directories : includes,
2519 #                          link_with : [libshared],
2520 #                          dependencies : [libacl],
2521 #                          install_rpath : rootlibexecdir,
2522 #                          install : true,
2523 #                          install_dir : rootbindir)
2524 #         public_programs += [exe]
2525
2526 #         test('test-systemd-tmpfiles',
2527 #              test_systemd_tmpfiles_py,
2528 #              args : exe.full_path())
2529 #         # https://github.com/mesonbuild/meson/issues/2681
2530 # endif
2531
2532 # if conf.get('ENABLE_HWDB') == 1
2533 #         exe = executable('systemd-hwdb',
2534 #                          'src/hwdb/hwdb.c',
2535 #                          'src/libsystemd/sd-hwdb/hwdb-internal.h',
2536 #                          include_directories : includes,
2537 #                          link_with : [libudev_static],
2538 #                          install_rpath : udev_rpath,
2539 #                          install : true,
2540 #                          install_dir : rootbindir)
2541 #         public_programs += [exe]
2542 # endif
2543
2544 # if conf.get('ENABLE_QUOTACHECK') == 1
2545 #         executable('systemd-quotacheck',
2546 #                    'src/quotacheck/quotacheck.c',
2547 #                    include_directories : includes,
2548 #                    link_with : [libshared],
2549 #                    install_rpath : rootlibexecdir,
2550 #                    install : true,
2551 #                    install_dir : rootlibexecdir)
2552 # endif
2553
2554 # exe = executable('systemd-socket-proxyd',
2555 #                  'src/socket-proxy/socket-proxyd.c',
2556 #                  include_directories : includes,
2557 #                  link_with : [libshared],
2558 #                  dependencies : [threads],
2559 #                  install_rpath : rootlibexecdir,
2560 #                  install : true,
2561 #                  install_dir : rootlibexecdir)
2562 # public_programs += [exe]
2563
2564 # exe = executable('systemd-udevd',
2565 #                  systemd_udevd_sources,
2566 #                  include_directories : includes,
2567 #                  c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2568 #                  link_with : [libudev_core,
2569 #                               libsystemd_network,
2570 #                               libudev_static],
2571 #                  dependencies : [threads,
2572 #                                  libkmod,
2573 #                                  libidn,
2574 #                                  libacl,
2575 #                                  libblkid],
2576 #                  install_rpath : udev_rpath,
2577 #                  install : true,
2578 #                  install_dir : rootlibexecdir)
2579 # public_programs += [exe]
2580
2581 # exe = executable('udevadm',
2582 #                  udevadm_sources,
2583 #                  c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2584 #                  include_directories : includes,
2585 #                  link_with : [libudev_core,
2586 #                               libsystemd_network,
2587 #                               libudev_static],
2588 #                  dependencies : [threads,
2589 #                                  libkmod,
2590 #                                  libidn,
2591 #                                  libacl,
2592 #                                  libblkid],
2593 #                  install_rpath : udev_rpath,
2594 #                  install : true,
2595 #                  install_dir : rootbindir)
2596 # public_programs += [exe]
2597
2598 # executable('systemd-shutdown',
2599 #            systemd_shutdown_sources,
2600 #            include_directories : includes,
2601 #            link_with : [libshared],
2602 #            install_rpath : rootlibexecdir,
2603 #            install : true,
2604 #            install_dir : rootlibexecdir)
2605
2606 # executable('systemd-update-done',
2607 #            'src/update-done/update-done.c',
2608 #            include_directories : includes,
2609 #            link_with : [libshared],
2610 #            install_rpath : rootlibexecdir,
2611 #            install : true,
2612 #            install_dir : rootlibexecdir)
2613
2614 # executable('systemd-update-utmp',
2615 #            'src/update-utmp/update-utmp.c',
2616 #            include_directories : includes,
2617 #            link_with : [libshared],
2618 #            dependencies : [libaudit],
2619 #            install_rpath : rootlibexecdir,
2620 #            install : true,
2621 #            install_dir : rootlibexecdir)
2622
2623 # if conf.get('HAVE_KMOD') == 1
2624 #         executable('systemd-modules-load',
2625 #                    'src/modules-load/modules-load.c',
2626 #                    include_directories : includes,
2627 #                    link_with : [libshared],
2628 #                    dependencies : [libkmod],
2629 #                    install_rpath : rootlibexecdir,
2630 #                    install : true,
2631 #                    install_dir : rootlibexecdir)
2632
2633 #         meson.add_install_script('sh', '-c',
2634 #                                  mkdir_p.format(modulesloaddir))
2635 #         meson.add_install_script('sh', '-c',
2636 #                                  mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2637 # endif
2638
2639 # exe = executable('systemd-nspawn',
2640 #                  systemd_nspawn_sources,
2641 #                  'src/core/mount-setup.c', # FIXME: use a variable?
2642 #                  'src/core/mount-setup.h',
2643 #                  'src/core/loopback-setup.c',
2644 #                  'src/core/loopback-setup.h',
2645 #                  include_directories : [includes, include_directories('src/nspawn')],
2646 #                  link_with : [libshared],
2647 #                  dependencies : [libacl,
2648 #                                  libblkid,
2649 #                                  libseccomp,
2650 #                                  libselinux],
2651 #                  install_rpath : rootlibexecdir,
2652 #                  install : true)
2653 # public_programs += [exe]
2654
2655 # if conf.get('ENABLE_NETWORKD') == 1
2656 #         executable('systemd-networkd',
2657 #                    systemd_networkd_sources,
2658 #                    include_directories : includes,
2659 #                    link_with : [libnetworkd_core,
2660 #                                 libsystemd_network,
2661 #                                 libudev_static,
2662 #                                 libshared],
2663 #                    dependencies : [threads],
2664 #                    install_rpath : rootlibexecdir,
2665 #                    install : true,
2666 #                    install_dir : rootlibexecdir)
2667
2668 #         executable('systemd-networkd-wait-online',
2669 #                    systemd_networkd_wait_online_sources,
2670 #                    include_directories : includes,
2671 #                    link_with : [libnetworkd_core,
2672 #                                 libshared],
2673 #                    install_rpath : rootlibexecdir,
2674 #                    install : true,
2675 #                    install_dir : rootlibexecdir)
2676
2677 #         exe = executable('networkctl',
2678 #                    networkctl_sources,
2679 #                    include_directories : includes,
2680 #                    link_with : [libsystemd_network,
2681 #                               libshared],
2682 #                    install_rpath : rootlibexecdir,
2683 #                    install : true,
2684 #                    install_dir : rootbindir)
2685 #         public_programs += [exe]
2686 # endif
2687
2688 # executable('systemd-sulogin-shell',
2689 #            ['src/sulogin-shell/sulogin-shell.c'],
2690 #            include_directories : includes,
2691 #            link_with : [libshared],
2692 #            install_rpath : rootlibexecdir,
2693 #            install : true,
2694 #            install_dir : rootlibexecdir)
2695 #else
2696 executable('elogind-uaccess-command',
2697            'src/uaccess-command/uaccess-command.c',
2698            include_directories : includes,
2699            link_with : [liblogind_core,
2700                         libshared_static],
2701            dependencies: [libacl,
2702                           libudev],
2703            install_rpath : rootlibexecdir,
2704            install : true,
2705            install_dir : rootlibexecdir)
2706 #endif // 0
2707
2708 ############################################################
2709
2710 foreach tuple : tests
2711         sources = tuple[0]
2712         link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2713         dependencies = tuple[2]
2714         condition = tuple.length() >= 4 ? tuple[3] : ''
2715         type = tuple.length() >= 5 ? tuple[4] : ''
2716         defs = tuple.length() >= 6 ? tuple[5] : []
2717         incs = tuple.length() >= 7 ? tuple[6] : includes
2718         timeout = 30
2719
2720         name = sources[0].split('/')[-1].split('.')[0]
2721         if type.startswith('timeout=')
2722                 timeout = type.split('=')[1].to_int()
2723                 type = ''
2724         endif
2725         if want_tests == 'false'
2726                 message('Not compiling @0@ because tests is set to false'.format(name))
2727         elif condition == '' or conf.get(condition) == 1
2728                 exe = executable(
2729                         name,
2730                         sources,
2731                         include_directories : incs,
2732                         link_with : link_with,
2733                         dependencies : dependencies,
2734                         c_args : defs,
2735                         install_rpath : rootlibexecdir,
2736                         install : install_tests,
2737                         install_dir : join_paths(testsdir, type))
2738
2739                 if type == 'manual'
2740                         message('@0@ is a manual test'.format(name))
2741                 elif type == 'unsafe' and want_tests != 'unsafe'
2742                         message('@0@ is an unsafe test'.format(name))
2743                 else
2744                         test(name, exe,
2745                              env : test_env,
2746                              timeout : timeout)
2747                 endif
2748         else
2749                 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2750         endif
2751 endforeach
2752
2753 #if 0 /// UNNEEDED by elogind
2754 # test_libsystemd_sym = executable(
2755 #         'test-libsystemd-sym',
2756 #         test_libsystemd_sym_c,
2757 #         include_directories : includes,
2758 #         link_with : [libsystemd],
2759 #         install : install_tests,
2760 #         install_dir : testsdir)
2761 # test('test-libsystemd-sym',
2762 #      test_libsystemd_sym)
2763
2764 # test_libudev_sym = executable(
2765 #         'test-libudev-sym',
2766 #         test_libudev_sym_c,
2767 #         include_directories : includes,
2768 #         c_args : ['-Wno-deprecated-declarations'],
2769 #         link_with : [libudev],
2770 #         install : install_tests,
2771 #         install_dir : testsdir)
2772 # test('test-libudev-sym',
2773 #      test_libudev_sym)
2774
2775 # ############################################################
2776
2777 # fuzzer_exes = []
2778
2779 # foreach tuple : fuzzers
2780 #         sources = tuple[0]
2781 #         link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2782 #         dependencies = tuple[2]
2783 #         defs = tuple.length() >= 4 ? tuple[3] : []
2784 #         incs = tuple.length() >= 5 ? tuple[4] : includes
2785
2786 #         if fuzzer_build
2787 #                 dependencies += fuzzing_engine
2788 #         else
2789 #                 sources += 'src/fuzz/fuzz-main.c'
2790 #         endif
2791
2792 #         name = sources[0].split('/')[-1].split('.')[0]
2793
2794 #         fuzzer_exes += executable(
2795 #                 name,
2796 #                 sources,
2797 #                 include_directories : [incs, include_directories('src/fuzz')],
2798 #                 link_with : link_with,
2799 #                 dependencies : dependencies,
2800 #                 c_args : defs,
2801 #                 install : false)
2802 # endforeach
2803
2804 # run_target('fuzzers',
2805 #         depends : fuzzer_exes,
2806 #         command : ['true'])
2807 #else
2808 test_libelogind_sym = executable(
2809         'test-libelogind-sym',
2810         test_libelogind_sym_c,
2811         include_directories : includes,
2812         link_with : [libelogind],
2813         install : install_tests,
2814         install_dir : testsdir)
2815 test('test-libelogind-sym',
2816      test_libelogind_sym)
2817 #endif // 0
2818
2819 ############################################################
2820
2821 make_directive_index_py = find_program('tools/make-directive-index.py')
2822 make_man_index_py = find_program('tools/make-man-index.py')
2823 xml_helper_py = find_program('tools/xml_helper.py')
2824 #if 0 /// UNNEEDED by elogind
2825 # hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2826
2827 # subdir('units')
2828 # subdir('sysctl.d')
2829 # subdir('sysusers.d')
2830 # subdir('tmpfiles.d')
2831 # subdir('presets')
2832 # subdir('hwdb')
2833 # subdir('network')
2834 #endif // 0
2835 subdir('man')
2836 subdir('shell-completion/bash')
2837 subdir('shell-completion/zsh')
2838 #if 0 /// UNNEEDED by elogind
2839 # subdir('docs/sysvinit')
2840 # subdir('docs/var-log')
2841 #endif // 0
2842
2843 # FIXME: figure out if the warning is true:
2844 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2845 install_subdir('factory/etc',
2846                install_dir : factorydir)
2847
2848
2849 #if 0 /// UNNEEDED by elogind
2850 # install_data('xorg/50-systemd-user.sh',
2851 #              install_dir : xinitrcdir)
2852 # install_data('modprobe.d/systemd.conf',
2853 #              install_dir : modprobedir)
2854 #endif // 0
2855 install_data('README',
2856              'NEWS',
2857              'CODING_STYLE',
2858 #if 0 /// UNNEEDED by elogind
2859 #              'DISTRO_PORTING',
2860 #              'ENVIRONMENT.md',
2861 #endif // 0
2862              'LICENSE.GPL2',
2863              'LICENSE.LGPL2.1',
2864              'TRANSIENT-SETTINGS.md',
2865              'UIDS-GIDS.md',
2866              'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
2867              install_dir : docdir)
2868
2869 #if 0 /// UNNEEDED by elogind
2870 # meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2871 #endif // 0
2872 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2873
2874 ############################################################
2875
2876 meson_check_help = find_program('tools/meson-check-help.sh')
2877
2878 foreach exec : public_programs
2879         name = exec.full_path().split('/')[-1]
2880         test('check-help-' + name,
2881              meson_check_help,
2882              args : [exec.full_path()])
2883 endforeach
2884
2885 ############################################################
2886
2887 if git.found()
2888         all_files = run_command(
2889                 git,
2890                 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2891                  'ls-files',
2892                  ':/*.[ch]'])
2893         all_files = files(all_files.stdout().split())
2894
2895         custom_target(
2896                 'tags',
2897                 output : 'tags',
2898                 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2899         custom_target(
2900                 'ctags',
2901                 output : 'ctags',
2902                 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2903 endif
2904
2905 #if 0 /// UNNEEDED by elogind
2906 # if git.found()
2907 #         meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2908 #         run_target(
2909 #                 'git-contrib',
2910 #                 command : [meson_git_contrib_sh])
2911 # endif
2912 #endif // 0
2913
2914 if git.found()
2915         git_head = run_command(
2916                 git,
2917                 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2918                  'rev-parse', 'HEAD']).stdout().strip()
2919         git_head_short = run_command(
2920                 git,
2921                 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2922                  'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2923
2924         run_target(
2925                 'git-snapshot',
2926                 command : ['git', 'archive',
2927                            '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2928                                                                  git_head_short),
2929                            '--prefix', 'systemd-@0@/'.format(git_head),
2930                            'HEAD'])
2931 endif
2932
2933 ############################################################
2934
2935 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
2936 run_target(
2937         'check-api-docs',
2938         depends : [man, libelogind, libudev],
2939         command : [meson_check_api_docs_sh, libelogind.full_path(), libudev.full_path()])
2940
2941 ############################################################
2942
2943 status = [
2944         '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2945
2946 #if 0 /// UNSUPPORTED by elogind
2947 #         'prefix directory:                  @0@'.format(prefixdir),
2948 #         'rootprefix directory:              @0@'.format(rootprefixdir),
2949 #         'sysconf directory:                 @0@'.format(sysconfdir),
2950 #         'include directory:                 @0@'.format(includedir),
2951 #         'lib directory:                     @0@'.format(libdir),
2952 #         'rootlib directory:                 @0@'.format(rootlibdir),
2953 #         'SysV init scripts:                 @0@'.format(sysvinit_path),
2954 #         'SysV rc?.d directories:            @0@'.format(sysvrcnd_path),
2955 #else
2956         'rootexeclib dir:                   @0@'.format(rootlibexecdir),
2957 #endif // 0
2958 #if 0 /// UNSUPPORTED by elogind
2959 #         'PAM modules directory:             @0@'.format(pamlibdir),
2960 #         'PAM configuration directory:       @0@'.format(pamconfdir),
2961 #         'RPM macros directory:              @0@'.format(rpmmacrosdir),
2962 #         'modprobe.d directory:              @0@'.format(modprobedir),
2963 #         'D-Bus policy directory:            @0@'.format(dbuspolicydir),
2964 #         'D-Bus session directory:           @0@'.format(dbussessionservicedir),
2965 #         'D-Bus system directory:            @0@'.format(dbussystemservicedir),
2966 #         'bash completions directory:        @0@'.format(bashcompletiondir),
2967 #         'zsh completions directory:         @0@'.format(zshcompletiondir),
2968 #         'extra start script:                @0@'.format(get_option('rc-local')),
2969 #         'extra stop script:                 @0@'.format(get_option('halt-local')),
2970 #         'debug shell:                       @0@ @ @1@'.format(get_option('debug-shell'),
2971 #                                                               get_option('debug-tty')),
2972 #endif // 0
2973         'TTY GID:                           @0@'.format(tty_gid),
2974 #if 0 /// UNSUPPORTED by elogind
2975 #         'users GID:                         @0@'.format(users_gid),
2976 #endif // 0
2977         'maximum system UID:                @0@'.format(system_uid_max),
2978         'maximum system GID:                @0@'.format(system_gid_max),
2979 #if 0 /// UNSUPPORTED by elogind
2980 #         'minimum dynamic UID:               @0@'.format(dynamic_uid_min),
2981 #         'maximum dynamic UID:               @0@'.format(dynamic_uid_max),
2982 #         'minimum container UID base:        @0@'.format(container_uid_base_min),
2983 #         'maximum container UID base:        @0@'.format(container_uid_base_max),
2984 #         '/dev/kvm access mode:              @0@'.format(get_option('dev-kvm-mode')),
2985 #         'render group access mode:          @0@'.format(get_option('group-render-mode')),
2986 #         'certificate root directory:        @0@'.format(get_option('certificate-root')),
2987 #         'support URL:                       @0@'.format(support_url),
2988 #         'nobody user name:                  @0@'.format(nobody_user),
2989 #         'nobody group name:                 @0@'.format(nobody_group),
2990 #         'fallback hostname:                 @0@'.format(get_option('fallback-hostname')),
2991 #         'symbolic gateway hostnames:        @0@'.format(', '.join(gateway_hostnames)),
2992
2993 #         'default DNSSEC mode:               @0@'.format(default_dnssec),
2994 #         'default cgroup hierarchy:          @0@'.format(default_hierarchy),
2995 #endif // 0
2996         'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2997
2998 #if 0 /// UNSUPPORTED by elogind
2999 # alt_dns_servers = '\n                                            '.join(dns_servers.split(' '))
3000 # alt_ntp_servers = '\n                                            '.join(ntp_servers.split(' '))
3001 # status += [
3002 #         'default DNS servers:               @0@'.format(alt_dns_servers),
3003 #         'default NTP servers:               @0@'.format(alt_ntp_servers)]
3004
3005 # alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3006 #                              '@@0@'.format(time_epoch)).stdout().strip()
3007 # status += [
3008 #         'time epoch:                        @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3009 #endif // 0
3010
3011 # TODO:
3012 # CFLAGS:   ${OUR_CFLAGS} ${CFLAGS}
3013 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3014 # LDFLAGS:  ${OUR_LDFLAGS} ${LDFLAGS}
3015
3016 #if 0 /// UNNEEDED by elogind
3017 # if conf.get('ENABLE_EFI') == 1
3018 #         status += [
3019 #                 'efi arch:                          @0@'.format(efi_arch)]
3020
3021 #         if have_gnu_efi
3022 #                 status += [
3023 #                         'EFI machine type:                  @0@'.format(EFI_MACHINE_TYPE_NAME),
3024 #                         'EFI CC                             @0@'.format(efi_cc),
3025 #                         'EFI lib directory:                 @0@'.format(efi_libdir),
3026 #                         'EFI lds directory:                 @0@'.format(efi_ldsdir),
3027 #                         'EFI include directory:             @0@'.format(efi_incdir)]
3028 #         endif
3029 # endif
3030 #endif // 0
3031
3032 found = []
3033 missing = []
3034
3035 foreach tuple : [
3036 #if 0 /// UNNEEDED by elogind
3037 #         ['libcryptsetup'],
3038 #endif // 0
3039         ['PAM'],
3040         ['AUDIT'],
3041 #if 0 /// UNNEEDED by elogind
3042 #         ['IMA'],
3043 #         ['AppArmor'],
3044 #endif // 0
3045         ['SELinux'],
3046 #if 0 /// UNNEEDED by elogind
3047 #         ['SECCOMP'],
3048 #endif // 0
3049         ['SMACK'],
3050 #if 0 /// UNNEEDED by elogind
3051 #         ['zlib'],
3052 #         ['xz'],
3053 #         ['lz4'],
3054 #         ['bzip2'],
3055 #endif // 0
3056         ['ACL'],
3057 #if 0 /// UNNEEDED by elogind
3058 #         ['gcrypt'],
3059 #         ['qrencode'],
3060 #         ['microhttpd'],
3061 #         ['gnutls'],
3062 #         ['libcurl'],
3063 #         ['idn'],
3064 #         ['libidn2'],
3065 #         ['libidn'],
3066 #         ['nss-systemd'],
3067 #         ['libiptc'],
3068 #         ['elfutils'],
3069 #         ['binfmt'],
3070 #         ['vconsole'],
3071 #         ['quotacheck'],
3072 #         ['tmpfiles'],
3073 #         ['environment.d'],
3074 #         ['sysusers'],
3075 #         ['firstboot'],
3076 #         ['randomseed'],
3077 #         ['backlight'],
3078 #         ['rfkill'],
3079 #         ['logind'],
3080 #         ['machined'],
3081 #         ['importd'],
3082 #         ['hostnamed'],
3083 #         ['timedated'],
3084 #         ['timesyncd'],
3085 #         ['localed'],
3086 #         ['networkd'],
3087 #         ['resolve'],
3088 #         ['coredump'],
3089 #endif // 0
3090         ['polkit'],
3091         ['legacy pkla',      install_polkit_pkla],
3092 #if 0 /// UNNEEDED by elogind
3093 #         ['efi'],
3094 #         ['gnu-efi',          have_gnu_efi],
3095 #         ['kmod'],
3096 #         ['xkbcommon'],
3097 #         ['blkid'],
3098 #endif // 0
3099         ['dbus'],
3100         ['glib'],
3101 #if 0 /// UNNEEDED by elogind
3102 #         ['nss-myhostname',   conf.get('ENABLE_MYHOSTNAME') == 1],
3103 #         ['hwdb'],
3104 #         ['tpm'],
3105 #endif // 0
3106         ['man pages',        want_man],
3107         ['html pages',       want_html],
3108         ['man page indices', want_man and have_lxml],
3109 #if 0 /// UNNEEDED by elogind
3110 #         ['split /usr',       conf.get('HAVE_SPLIT_USR') == 1],
3111 #         ['SysV compat'],
3112 #endif // 0
3113         ['utmp'],
3114 #if 0 /// UNNEEDED by elogind
3115 #         ['ldconfig'],
3116 #         ['hibernate'],
3117 #         ['adm group',        get_option('adm-group')],
3118 #         ['wheel group',      get_option('wheel-group')],
3119 #         ['gshadow'],
3120 #else
3121         ['debug elogind'],
3122 #endif // 0
3123         ['debug hashmap'],
3124         ['debug mmap cache'],
3125 ]
3126
3127         cond = tuple.get(1, '')
3128         if cond == ''
3129                 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3130                 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3131                 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3132         endif
3133         if cond
3134                 found += [tuple[0]]
3135         else
3136                 missing += [tuple[0]]
3137         endif
3138 endforeach
3139
3140 status += [
3141         '',
3142         'enabled features: @0@'.format(', '.join(found)),
3143         '',
3144         'disabled features: @0@'.format(', '.join(missing)),
3145         '']
3146 message('\n         '.join(status))
3147
3148 if rootprefixdir != rootprefix_default
3149         message('WARNING:\n' +
3150                 '        Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3151                 '        elogind used fixed names for unit file directories and other paths, so anything\n' +
3152                 '        except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
3153 endif