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