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