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