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