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