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