]>
Commit | Line | Data |
---|---|---|
d4c880d5 | 1 | project('util-linux', 'c', |
e0c1a86b | 2 | version : run_command('tools/git-version-gen', check: true).stdout(), |
c12276dd | 3 | meson_version: '>=0.60.0', |
6240e445 TW |
4 | license : 'GPLv2+', |
5 | default_options : [ | |
6 | 'c_std=c99', | |
7 | 'cpp_std=c++11', | |
8 | ]) | |
d4c880d5 | 9 | |
3e0bbb12 | 10 | fs = import('fs') |
d4c880d5 ZJS |
11 | pkgconfig = import('pkgconfig') |
12 | ||
311ea4e7 KZ |
13 | # soname versions; This never change because we use symbols versioing. There is also |
14 | # API version (LIB*_VERSION macros) and it follow package version. | |
d4c880d5 | 15 | libblkid_version = '1.1.0' |
50736e49 | 16 | libblkid_date = '01-Jun-2021' |
d4c880d5 | 17 | libuuid_version = '1.3.0' |
476c8614 | 18 | liblastlog2_version = '2.0.0' |
d4c880d5 ZJS |
19 | libmount_version = '1.1.0' |
20 | libsmartcols_version = '1.1.0' | |
21 | libfdisk_version = '1.1.0' | |
22 | ||
23 | prefixdir = get_option('prefix') | |
b51eee74 | 24 | if not fs.is_absolute(prefixdir) |
d4c880d5 ZJS |
25 | error('Prefix is not absolute: "@0@"'.format(prefixdir)) |
26 | endif | |
27 | bindir = join_paths(prefixdir, get_option('bindir')) | |
28 | sbindir = join_paths(prefixdir, get_option('sbindir')) | |
29 | sysconfstaticdir = join_paths(prefixdir, 'lib') | |
12ebed03 | 30 | docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux') |
53b37016 | 31 | mandir = join_paths(prefixdir, get_option('mandir')) |
d4c880d5 | 32 | runstatedir = '/run' |
107b2fbe | 33 | localstatedir = '/var' |
0eb2a476 | 34 | execprefixdir = prefixdir |
5e67b421 | 35 | sysconfdir = join_paths(prefixdir, get_option('sysconfdir')) |
0eb2a476 KL |
36 | usrbin_exec_dir = join_paths(execprefixdir, bindir) |
37 | usrsbin_exec_dir = join_paths(execprefixdir, sbindir) | |
38bb89ee | 38 | bash_completion = dependency('bash-completion', required : get_option('build-bash-completion')) |
d4c880d5 | 39 | |
308a0979 KZ |
40 | vendordir = get_option('vendordir') |
41 | ||
b1a76c22 | 42 | add_project_arguments('-D_GNU_SOURCE', '-fsigned-char', language : 'c') |
d4c880d5 | 43 | |
df277231 JW |
44 | if host_machine.system() == 'darwin' |
45 | add_project_arguments('-D_DARWIN_C_SOURCE', language : 'c') | |
46 | endif | |
47 | ||
d4c880d5 ZJS |
48 | cc = meson.get_compiler('c') |
49 | ||
50 | conf = configuration_data() | |
3e43f629 RP |
51 | conf.set_quoted('PACKAGE', meson.project_name()) |
52 | conf.set_quoted('PACKAGE_VERSION', meson.project_version()) | |
d4c880d5 ZJS |
53 | package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version()) |
54 | conf.set_quoted('PACKAGE_STRING', package_string) | |
d4c880d5 | 55 | |
d4c880d5 | 56 | pc_version = [] |
922d025a | 57 | pc_version = meson.project_version().split('-')[0].split('.') |
58 | ||
59 | if pc_version.length() < 3 | |
60 | pc_version += '0' | |
61 | endif | |
62 | ||
d4c880d5 ZJS |
63 | pc_version = '.'.join(pc_version) |
64 | ||
311ea4e7 | 65 | conf.set_quoted('LIBBLKID_VERSION', pc_version) |
d4c880d5 ZJS |
66 | conf.set_quoted('LIBBLKID_DATE', libblkid_date) |
67 | ||
68 | conf.set('bindir', bindir) | |
69 | conf.set('sbindir', sbindir) | |
70 | conf.set('runstatedir', runstatedir) | |
107b2fbe | 71 | conf.set('localstatedir', localstatedir) |
5e67b421 | 72 | conf.set('sysconfdir', sysconfdir) |
7c080286 | 73 | conf.set('usrbin_execdir', usrbin_exec_dir) |
d4c880d5 ZJS |
74 | conf.set('usrsbin_execdir', usrsbin_exec_dir) |
75 | conf.set('docdir', docdir) | |
76 | conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir) | |
77 | conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir) | |
107b2fbe | 78 | conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir) |
d4c880d5 ZJS |
79 | conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime') |
80 | conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :( | |
81 | ||
308a0979 KZ |
82 | conf.set_quoted('_PATH_VENDORDIR', vendordir) |
83 | conf.set('USE_VENDORDIR', vendordir == '' ? false : 1) | |
84 | ||
efce415c | 85 | build_libblkid = get_option('build-libblkid').allowed() |
d4c880d5 ZJS |
86 | conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false) |
87 | summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components') | |
88 | ||
89 | build_libuuid = not get_option('build-libuuid').disabled() | |
90 | conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false) | |
91 | summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components') | |
92 | ||
66463f0c JW |
93 | lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2')) |
94 | build_liblastlog2 = get_option('build-liblastlog2').require(lib_sqlite3.found()).allowed() | |
c2e299d0 SS |
95 | conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false) |
96 | summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components') | |
97 | ||
e8b6e4ea SS |
98 | login_lastlogin = get_option('login-lastlogin') |
99 | conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false) | |
100 | summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components') | |
101 | ||
e23c3262 KZ |
102 | have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0 |
103 | conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false) | |
104 | conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false) | |
105 | ||
7d679f29 | 106 | have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0 |
8bcf89d3 TW |
107 | conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false) |
108 | ||
b8b63b36 JW |
109 | have_sys_vfs_header = cc.has_header('sys/vfs.h') |
110 | ||
111 | build_libmount = get_option('build-libmount').require( | |
112 | get_option('build-libblkid').allowed() \ | |
113 | and have_sys_vfs_header \ | |
114 | ).allowed() | |
b6799ccb | 115 | |
d4c880d5 | 116 | conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false) |
375ccf08 | 117 | conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1) |
e23c3262 | 118 | conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false) |
d4c880d5 ZJS |
119 | summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components') |
120 | ||
121 | build_libsmartcols = not get_option('build-libsmartcols').disabled() | |
122 | conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false) | |
123 | summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components') | |
124 | ||
b6799ccb | 125 | build_libfdisk = not get_option('build-libfdisk').require(get_option('build-libblkid').allowed()).disabled() |
d4c880d5 ZJS |
126 | conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false) |
127 | summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components') | |
128 | ||
129 | build_uuidd = not get_option('build-uuidd').disabled() | |
130 | conf.set('HAVE_UUIDD', build_uuidd ? 1 : false) | |
131 | summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components') | |
132 | ||
69939195 ZJS |
133 | static_programs = get_option('static-programs') |
134 | need_static_libs = static_programs.length() > 0 # a rough estimate... | |
135 | summary('static programs', static_programs) | |
136 | ||
d4c880d5 ZJS |
137 | LINUX = host_machine.system() in ['linux'] |
138 | BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd'] | |
139 | ||
140 | ############################################################ | |
141 | ||
142 | code = ''' | |
143 | #include <wchar.h> | |
144 | #include <wctype.h> | |
145 | #include <stdio.h> | |
146 | #include <stdlib.h> | |
147 | int main(void) { | |
148 | wchar_t wc; | |
149 | wint_t w; | |
150 | w = fgetwc(stdin); | |
151 | if (w == WEOF) | |
152 | return 1; | |
153 | wc = w; | |
154 | fputwc(wc,stdout); | |
155 | return 0; | |
156 | } | |
157 | ''' | |
158 | have = cc.compiles(code, name : 'wchar_t support') | |
159 | if not have and get_option('widechar').enabled() | |
160 | error('widechar support requested but unavailable') | |
161 | endif | |
162 | if get_option('ncurses').enabled() and get_option('widechar').enabled() | |
163 | error('widechar support is incompatible with non-wide ncurses') | |
164 | endif | |
165 | conf.set('HAVE_WIDECHAR', have ? 1 : false) | |
166 | ||
167 | headers = ''' | |
168 | byteswap.h | |
169 | crypt.h | |
170 | endian.h | |
171 | err.h | |
172 | errno.h | |
173 | fcntl.h | |
174 | getopt.h | |
175 | inttypes.h | |
176 | langinfo.h | |
177 | lastlog.h | |
178 | libutil.h | |
179 | locale.h | |
180 | mntent.h | |
181 | paths.h | |
182 | pty.h | |
183 | shadow.h | |
184 | stdint.h | |
185 | stdio_ext.h | |
186 | stdlib.h | |
187 | string.h | |
188 | strings.h | |
189 | unistd.h | |
190 | utmp.h | |
191 | utmpx.h | |
192 | asm/io.h | |
193 | linux/blkzoned.h | |
194 | linux/capability.h | |
195 | linux/cdrom.h | |
196 | linux/compiler.h | |
197 | linux/falloc.h | |
198 | linux/fd.h | |
0e186591 | 199 | linux/fs.h |
647f80e4 KZ |
200 | linux/fiemap.h |
201 | linux/gsmmux.h | |
0e186591 | 202 | linux/if_alg.h |
ae015d71 | 203 | linux/landlock.h |
0e186591 | 204 | linux/kcmp.h |
d4c880d5 | 205 | linux/net_namespace.h |
647f80e4 | 206 | linux/nsfs.h |
241e4a48 | 207 | linux/mount.h |
0e186591 | 208 | linux/pr.h |
d4c880d5 ZJS |
209 | linux/securebits.h |
210 | linux/tiocl.h | |
211 | linux/version.h | |
212 | linux/watchdog.h | |
213 | net/if.h | |
214 | net/if_dl.h | |
215 | netinet/in.h | |
216 | security/openpam.h | |
217 | security/pam_appl.h | |
218 | security/pam_misc.h | |
6b61e282 | 219 | security/pam_modules.h |
d4c880d5 ZJS |
220 | sys/disk.h |
221 | sys/disklabel.h | |
222 | sys/endian.h | |
223 | sys/file.h | |
224 | sys/io.h | |
225 | sys/ioccom.h | |
226 | sys/ioctl.h | |
227 | sys/mkdev.h | |
228 | sys/mount.h | |
229 | sys/param.h | |
aa5adf24 | 230 | sys/pidfd.h |
d4c880d5 ZJS |
231 | sys/prctl.h |
232 | sys/resource.h | |
6e92db54 | 233 | sys/sendfile.h |
d4c880d5 ZJS |
234 | sys/signalfd.h |
235 | sys/socket.h | |
236 | sys/sockio.h | |
237 | sys/stat.h | |
0e186591 | 238 | sys/statfs.h |
d4c880d5 ZJS |
239 | sys/swap.h |
240 | sys/syscall.h | |
241 | sys/sysmacros.h | |
242 | sys/time.h | |
243 | sys/timex.h | |
244 | sys/ttydefaults.h | |
245 | sys/types.h | |
246 | sys/ucred.h | |
247 | sys/un.h | |
0e186591 | 248 | sys/vfs.h |
647f80e4 | 249 | sys/xattr.h |
d4c880d5 ZJS |
250 | '''.split() |
251 | ||
252 | lib_m = cc.find_library('m') | |
253 | ||
254 | lib_tinfo = dependency( | |
255 | 'tinfo', | |
5f931ae8 | 256 | disabler : true, |
d4c880d5 ZJS |
257 | required : get_option('tinfo')) |
258 | ||
259 | lib_ncursesw = dependency( | |
260 | 'ncursesw', | |
261 | required : get_option('ncursesw')) | |
262 | if lib_ncursesw.found() | |
263 | headers += ['ncursesw/ncurses.h', | |
264 | 'ncursesw/term.h', | |
265 | 'ncurses.h', | |
266 | 'term.h'] | |
267 | lib_ncurses = disabler() | |
268 | else | |
269 | lib_ncurses = dependency( | |
270 | 'ncurses', | |
d632e5da | 271 | disabler : true, |
d4c880d5 ZJS |
272 | required : get_option('ncurses')) |
273 | headers += ['ncurses.h', | |
274 | 'term.h'] | |
275 | endif | |
276 | ||
277 | conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found()) | |
278 | conf.set('HAVE_LIBNCURSES', lib_ncurses.found()) | |
279 | conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found()) | |
280 | ||
281 | lib_slang = dependency( | |
282 | 'slang', | |
283 | required : get_option('slang')) | |
284 | if lib_slang.found() | |
285 | headers += ['slang.h', | |
286 | 'slang/slang.h', | |
287 | 'slcurses.h', | |
288 | 'slang/slcurses.h'] | |
289 | endif | |
290 | conf.set('HAVE_SLANG', lib_slang.found()) | |
291 | ||
292 | foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses] | |
293 | if curses_libs.found() | |
6e13cfed KZ |
294 | have = cc.has_function('use_default_colors', dependencies : curses_libs) |
295 | conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false) | |
296 | have = cc.has_function('resizeterm', dependencies : curses_libs) | |
297 | conf.set('HAVE_RESIZETERM', have ? 1 : false) | |
d4c880d5 ZJS |
298 | break |
299 | endif | |
300 | endforeach | |
301 | ||
302 | lib_z = dependency( | |
303 | 'zlib', | |
2c02ce7c | 304 | disabler : true, |
d4c880d5 ZJS |
305 | required : get_option('zlib')) |
306 | ||
307 | lib_readline = dependency( | |
308 | 'readline', | |
309 | required : get_option('readline')) | |
310 | conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false) | |
311 | ||
69939195 ZJS |
312 | lib_readline_static = dependency( |
313 | 'readline', | |
314 | static : true, | |
315 | required : need_static_libs ? get_option('readline') : disabler()) | |
316 | ||
fc63a3d0 RP |
317 | if meson.version().version_compare('>= 0.59.0') |
318 | lib_intl = dependency( | |
319 | 'intl', | |
320 | required : get_option('nls')) | |
321 | conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false) | |
322 | else | |
323 | if get_option('nls').enabled() | |
324 | error('nls is not supported with meson before 0.59.0') | |
325 | endif | |
326 | lib_intl = dependency('', required : false) | |
327 | endif | |
328 | ||
d4c880d5 ZJS |
329 | lib_user = dependency( |
330 | 'libuser', | |
331 | version : '>= 0.58', | |
332 | required : get_option('libuser')) | |
333 | conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false) | |
334 | ||
335 | lib_util = cc.find_library( | |
336 | 'util', | |
337 | required : get_option('libutil')) | |
338 | conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false) | |
339 | ||
340 | lib_utempter = cc.find_library( | |
341 | 'utempter', | |
342 | required : get_option('libutempter')) | |
343 | conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false) | |
344 | ||
345 | systemd = dependency( | |
346 | 'systemd', | |
347 | required : get_option('systemd')) | |
348 | ||
349 | lib_systemd = dependency( | |
350 | 'libsystemd', | |
351 | required : get_option('systemd')) | |
352 | conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false) | |
0e186591 | 353 | conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false) |
d4c880d5 | 354 | |
87fcd95a TK |
355 | have = cc.has_function( |
356 | 'sd_session_get_username', | |
357 | dependencies : lib_systemd) | |
358 | conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false) | |
359 | ||
d4c880d5 ZJS |
360 | lib_udev = dependency( |
361 | 'libudev', | |
362 | required : get_option('systemd')) | |
363 | conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false) | |
364 | ||
d0a07e7f JW |
365 | lib_crypt = cc.find_library('crypt', required : get_option('build-newgrp')) |
366 | if not lib_crypt.found() | |
367 | lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin')) | |
368 | endif | |
d4c880d5 | 369 | |
9e3c5d1b JW |
370 | lib_pam = cc.find_library( |
371 | 'pam', | |
372 | disabler : true, | |
373 | required : get_option('build-login').enabled() or \ | |
374 | get_option('build-chfn-chsh').enabled() or \ | |
375 | get_option('build-su').enabled() or \ | |
376 | get_option('build-runuser').enabled()) | |
d4c880d5 ZJS |
377 | if lib_pam.found() |
378 | lib_pam_misc = cc.find_library('pam_misc') | |
379 | lib_pam = [lib_pam, lib_pam_misc] | |
7bce9496 RP |
380 | else |
381 | lib_pam_misc = declare_dependency() | |
d4c880d5 ZJS |
382 | endif |
383 | ||
384 | lib_cryptsetup = dependency( | |
385 | 'libcryptsetup', | |
386 | required : get_option('cryptsetup')) | |
387 | conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false) | |
388 | ||
c12f8998 ZJS |
389 | cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled() |
390 | if cryptsetup_dlopen | |
324aa32c RP |
391 | if meson.version().version_compare('>= 0.62.0') |
392 | lib_dl = dependency('dl') | |
393 | else | |
394 | lib_dl = cc.find_library('dl') | |
395 | endif | |
e6a4b4a1 LB |
396 | conf.set('CRYPTSETUP_VIA_DLOPEN', 1) |
397 | summary('cryptsetup support (dlopen)', | |
398 | 'enabled', | |
399 | section : 'components') | |
400 | else | |
401 | summary('cryptsetup support', | |
402 | lib_cryptsetup.found() ? 'enabled' : 'disabled', | |
403 | section : 'components') | |
404 | endif | |
6e92db54 | 405 | |
d4c880d5 ZJS |
406 | have = cc.has_function( |
407 | 'crypt_activate_by_signed_key', | |
408 | dependencies : lib_cryptsetup) | |
5a6e9adf | 409 | conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false) |
d4c880d5 ZJS |
410 | |
411 | lib_cap_ng = dependency( | |
cd23a433 RP |
412 | 'libcap-ng', |
413 | required : get_option('build-setpriv')) | |
512c91a6 TW |
414 | if not lib_cap_ng.found() |
415 | lib_cap_ng = disabler() | |
416 | endif | |
d4c880d5 ZJS |
417 | |
418 | lib_selinux = dependency( | |
419 | 'libselinux', | |
6e92db54 | 420 | version : '>= 2.5', |
d4c880d5 ZJS |
421 | required : get_option('selinux')) |
422 | conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false) | |
423 | ||
6e92db54 KZ |
424 | lib_magic = dependency( |
425 | 'libmagic', | |
426 | required : get_option('magic')) | |
427 | conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false) | |
428 | ||
429 | lib_econf = dependency( | |
430 | 'libeconf', | |
431 | required : get_option('econf')) | |
432 | conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false) | |
433 | ||
d4c880d5 | 434 | lib_audit = dependency( |
b2ae39f6 | 435 | 'audit', |
d4c880d5 ZJS |
436 | required : get_option('audit')) |
437 | conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false) | |
438 | ||
439 | conf.set('HAVE_SMACK', not get_option('smack').disabled()) | |
440 | ||
9e970370 | 441 | |
d4c880d5 ZJS |
442 | foreach header : headers |
443 | have = cc.has_header(header) | |
444 | conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false) | |
445 | endforeach | |
446 | ||
447 | header = 'linux/btrfs.h' | |
448 | enable_btrfs = cc.has_header(header, | |
449 | required : get_option('btrfs')) | |
450 | conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false) | |
451 | conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false) | |
452 | ||
453 | prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : '' | |
454 | foreach header : [ | |
455 | 'linux/blkpg.h', | |
456 | 'linux/major.h', | |
457 | ] | |
458 | have = cc.has_header(header, | |
459 | prefix : prefix) | |
460 | conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false) | |
461 | endforeach | |
462 | ||
463 | have = cc.has_header('sched.h') | |
464 | conf.set10('HAVE_DECL_CPU_ALLOC', have) | |
fa3bce7e | 465 | have_cpu_set_t = cc.has_type('cpu_set_t', args : '-D_GNU_SOURCE', prefix : '#include <sched.h>') |
d4c880d5 ZJS |
466 | conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false) |
467 | ||
5afe34ef | 468 | have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE') |
640754e2 | 469 | conf.set('HAVE_ENVIRON_DECL', have ? 1 : false) |
d4c880d5 | 470 | |
5afe34ef | 471 | have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE') |
d4c880d5 ZJS |
472 | conf.set('HAVE_SIGHANDLER_T', have ? 1 : false) |
473 | ||
f3b9a18e | 474 | have = cc.has_function('strsignal') |
d4c880d5 ZJS |
475 | conf.set10('HAVE_STRSIGNAL_DECL', have) |
476 | ||
477 | have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0 | |
478 | conf.set('HAVE_UNION_SEMUN', have ? 1 : false) | |
479 | ||
1eeabbb4 TW |
480 | have = cc.has_type('loff_t', |
481 | args : '-D_GNU_SOURCE', | |
482 | prefix : '#include <sys/types.h>') | |
0e186591 TW |
483 | conf.set('HAVE_LOFF_T', have ? 1 : false) |
484 | ||
d4c880d5 ZJS |
485 | have = cc.compiles(''' |
486 | #define _GNU_SOURCE 1 | |
487 | #include <langinfo.h> | |
488 | int main(void) { | |
489 | char *str; | |
490 | str = nl_langinfo (ALTMON_1); | |
491 | str = nl_langinfo (ALTMON_2); | |
492 | str = nl_langinfo (ALTMON_3); | |
493 | str = nl_langinfo (ALTMON_4); | |
494 | str = nl_langinfo (ALTMON_5); | |
495 | str = nl_langinfo (ALTMON_6); | |
496 | str = nl_langinfo (ALTMON_7); | |
497 | str = nl_langinfo (ALTMON_8); | |
498 | str = nl_langinfo (ALTMON_9); | |
499 | str = nl_langinfo (ALTMON_10); | |
500 | str = nl_langinfo (ALTMON_11); | |
501 | str = nl_langinfo (ALTMON_12); | |
502 | return 0; | |
503 | } | |
504 | ''', | |
505 | name : 'langinfo.h defines ALTMON_x constants') | |
506 | conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false) | |
507 | ||
508 | have = cc.compiles(''' | |
509 | #define _GNU_SOURCE 1 | |
510 | #include <langinfo.h> | |
511 | int main(void) { | |
512 | char *str; | |
513 | str = nl_langinfo (_NL_ABALTMON_1); | |
514 | str = nl_langinfo (_NL_ABALTMON_2); | |
515 | str = nl_langinfo (_NL_ABALTMON_3); | |
516 | str = nl_langinfo (_NL_ABALTMON_4); | |
517 | str = nl_langinfo (_NL_ABALTMON_5); | |
518 | str = nl_langinfo (_NL_ABALTMON_6); | |
519 | str = nl_langinfo (_NL_ABALTMON_7); | |
520 | str = nl_langinfo (_NL_ABALTMON_8); | |
521 | str = nl_langinfo (_NL_ABALTMON_9); | |
522 | str = nl_langinfo (_NL_ABALTMON_10); | |
523 | str = nl_langinfo (_NL_ABALTMON_11); | |
524 | str = nl_langinfo (_NL_ABALTMON_12); | |
525 | return 0; | |
526 | } | |
527 | ''', | |
528 | name : 'langinfo.h defines _NL_ABALTMON_x constants') | |
529 | conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false) | |
530 | ||
17bc58e0 CH |
531 | have = cc.compiles(''' |
532 | #define _GNU_SOURCE 1 | |
533 | #include <langinfo.h> | |
534 | int main(void) { | |
535 | char *str; | |
536 | str = nl_langinfo (_NL_TIME_WEEK_1STDAY); | |
537 | return 0; | |
538 | } | |
539 | ''', | |
540 | name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant') | |
541 | conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false) | |
542 | ||
d4c880d5 | 543 | funcs = ''' |
c214cbeb | 544 | cachestat |
d4c880d5 | 545 | clearenv |
5bd1462d | 546 | close_range |
d4c880d5 ZJS |
547 | __fpurge |
548 | fpurge | |
549 | __fpending | |
550 | secure_getenv | |
551 | __secure_getenv | |
552 | eaccess | |
553 | err | |
554 | errx | |
555 | explicit_bzero | |
d9b022bd | 556 | fnmatch |
d4c880d5 | 557 | fseeko |
0120be6f KZ |
558 | fsconfig |
559 | fsmount | |
560 | fsopen | |
561 | fspick | |
d4c880d5 | 562 | fsync |
0e186591 | 563 | getttynam |
d4c880d5 ZJS |
564 | utimensat |
565 | getdomainname | |
566 | getdtablesize | |
567 | getexecname | |
568 | getmntinfo | |
569 | getrandom | |
570 | getrlimit | |
571 | getsgnam | |
572 | inotify_init | |
573 | jrand48 | |
ae015d71 TW |
574 | landlock_create_ruleset |
575 | landlock_add_rule | |
576 | landlock_restrict_self | |
d4c880d5 | 577 | lchown |
6124a6a3 TW |
578 | lgetxattr |
579 | llistxattr | |
d4c880d5 | 580 | llseek |
5bd1462d | 581 | newlocale |
d4c880d5 | 582 | mkostemp |
10efb9ea KZ |
583 | move_mount |
584 | mount_setattr | |
d4c880d5 ZJS |
585 | nanosleep |
586 | ntp_gettime | |
10efb9ea | 587 | open_tree |
d4c880d5 ZJS |
588 | personality |
589 | pidfd_open | |
590 | pidfd_send_signal | |
591 | posix_fadvise | |
592 | prctl | |
593 | qsort_r | |
0322c9cd | 594 | reallocarray |
cd094a05 | 595 | renameat2 |
d4c880d5 ZJS |
596 | rpmatch |
597 | scandirat | |
598 | setprogname | |
5bd1462d | 599 | sendfile |
d4c880d5 ZJS |
600 | setns |
601 | setresgid | |
602 | setresuid | |
603 | sched_setattr | |
604 | sched_setscheduler | |
605 | sigqueue | |
606 | srandom | |
30c59d67 | 607 | statx |
d4c880d5 ZJS |
608 | strnchr |
609 | strndup | |
610 | strnlen | |
5bd1462d | 611 | strtod_l |
d4c880d5 ZJS |
612 | sysconf |
613 | sysinfo | |
614 | swapon | |
615 | swapoff | |
616 | timegm | |
617 | unshare | |
618 | usleep | |
5bd1462d TW |
619 | uselocale |
620 | utimensat | |
d4c880d5 ZJS |
621 | vwarnx |
622 | warn | |
623 | warnx | |
624 | prlimit | |
625 | ||
626 | openat | |
627 | fstatat | |
628 | unlinkat | |
629 | ioperm | |
630 | iopl | |
631 | futimens | |
632 | inotify_init1 | |
633 | open_memstream | |
634 | reboot | |
635 | getusershell | |
636 | '''.split() | |
637 | ||
638 | foreach func: funcs | |
639 | have = cc.has_function(func) | |
993556aa | 640 | # For autotools compatibility, use either #define FOO 1 or #undef FOO. |
d4c880d5 ZJS |
641 | # This makes little sense, but is necessary to avoid warnings about |
642 | # redefined macros from Python.h, which uses this convention. | |
643 | conf.set('HAVE_' + func.to_upper(), have ? 1 : false) | |
d4c880d5 ZJS |
644 | endforeach |
645 | ||
2c5a42b3 JW |
646 | have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE') |
647 | conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false) | |
648 | ||
d4c880d5 ZJS |
649 | have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1] |
650 | conf.set('AGETTY_RELOAD', have ? 1 : false) | |
651 | if not have | |
652 | warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality') | |
653 | endif | |
654 | ||
655 | have_dirfd = (cc.has_function('dirfd') or | |
656 | cc.has_header_symbol('dirent.h', 'dirfd', | |
657 | prefix : '#include <sys/types.h>')) | |
658 | conf.set('HAVE_DIRFD', have_dirfd ? 1 : false) | |
659 | ||
660 | have_ddfd = cc.has_member('DIR', 'dd_fd', | |
661 | prefix : ''' | |
662 | #include <sys/types.h> | |
663 | #include <dirent.h> | |
664 | ''') | |
665 | conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false) | |
666 | ||
667 | have = cc.has_member('struct tm', 'tm_gmtoff', | |
1eeabbb4 | 668 | args : '-D_GNU_SOURCE', |
d4c880d5 ZJS |
669 | prefix : ''' |
670 | #include <time.h> | |
671 | #include <unistd.h> | |
672 | ''') | |
673 | conf.set('HAVE_TM_GMTOFF', have ? 1 : false) | |
674 | ||
10efb9ea | 675 | |
10efb9ea | 676 | |
0120be6f | 677 | have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0 |
e23c3262 | 678 | conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false) |
0120be6f | 679 | |
d4c880d5 ZJS |
680 | have = cc.has_member('struct termios', 'c_line', |
681 | prefix : '#include <termios.h>') | |
682 | conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false) | |
683 | ||
684 | have = cc.has_member('struct stat', 'st_mtim.tv_nsec', | |
1eeabbb4 | 685 | args : '-D_GNU_SOURCE', |
d4c880d5 ZJS |
686 | prefix : '#include <sys/stat.h>') |
687 | conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false) | |
688 | ||
2f82c248 | 689 | have = cc.has_member('struct statx', 'stx_mnt_id', |
7d679f29 | 690 | prefix : '#include <sys/stat.h>') |
2f82c248 KZ |
691 | conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false) |
692 | ||
d4c880d5 ZJS |
693 | # replacement for AC_STRUCT_TIMEZONE |
694 | have = cc.has_member('struct tm', 'tm_zone', | |
1eeabbb4 | 695 | args : '-D_GNU_SOURCE', |
d4c880d5 ZJS |
696 | prefix : '#include <time.h>') |
697 | conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false) | |
698 | ||
5afe34ef | 699 | have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE') |
d4c880d5 ZJS |
700 | conf.set('HAVE_DECL_TZNAME', have ? 1 : false) |
701 | ||
0e186591 TW |
702 | have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY') |
703 | conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false) | |
704 | ||
705 | have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY') | |
706 | conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false) | |
707 | ||
d4c880d5 ZJS |
708 | code = ''' |
709 | #include <time.h> | |
710 | #if !@0@ | |
711 | extern char *tzname[]; | |
712 | #endif | |
713 | int main(void) { | |
714 | return tzname ? 0 : 1; | |
715 | } | |
716 | '''.format(have ? 1 : 0) | |
e25db916 | 717 | have = cc.compiles(code, name : 'using tzname[]') |
d4c880d5 ZJS |
718 | conf.set('HAVE_TZNAME', have ? 1 : false) |
719 | ||
a31f4c4f TW |
720 | have = cc.sizeof('time_t', prefix : '#include <time.h>') |
721 | if have < 8 | |
722 | add_global_arguments('-D_TIME_BITS=64', language : 'c') | |
723 | have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>') | |
724 | if have < 8 | |
725 | if get_option('allow-32bit-time') | |
726 | warning('Could not make time_t 64bits wide') | |
727 | else | |
728 | error('Could not make time_t 64bits wide') | |
729 | endif | |
730 | endif | |
731 | endif | |
732 | ||
d4c880d5 ZJS |
733 | socket_libs = [] |
734 | if not cc.has_function('socket') | |
735 | socket_libs += cc.find_library('socket', required : true) | |
736 | have = cc.has_function('socket', | |
737 | dependencies : socket_libs) | |
738 | if not have | |
739 | error('socket() function not available') | |
740 | endif | |
741 | endif | |
742 | ||
24395027 | 743 | lib_rt = cc.find_library('rt', required : false) |
d4c880d5 ZJS |
744 | realtime_libs = [] |
745 | have = cc.has_function('clock_gettime') | |
746 | if not have | |
06b27058 JW |
747 | if lib_rt.found() |
748 | realtime_libs += lib_rt | |
749 | have = cc.has_function('clock_gettime', | |
750 | dependencies : realtime_libs) | |
751 | endif | |
d4c880d5 | 752 | endif |
e51565b6 | 753 | conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false) |
d4c880d5 ZJS |
754 | |
755 | thread_libs = dependency('threads') | |
756 | ||
757 | have = cc.has_function('timer_create') | |
758 | if not have | |
06b27058 JW |
759 | if lib_rt.found() |
760 | realtime_libs = [lib_rt] | |
761 | have = cc.has_function('timer_create', | |
762 | dependencies : realtime_libs) | |
763 | endif | |
d4c880d5 ZJS |
764 | if not have |
765 | realtime_libs += thread_libs | |
766 | have = cc.has_function('timer_create', | |
767 | dependencies : realtime_libs) | |
768 | endif | |
769 | endif | |
770 | conf.set('HAVE_TIMER_CREATE', have ? 1 : false) | |
771 | if not have | |
772 | have = cc.has_function('setitimer') | |
773 | conf.set('HAVE_SETITIMER', have ? 1 : false) | |
774 | endif | |
775 | ||
776 | rtas_libs = cc.find_library('rtas', required : false) | |
777 | conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false) | |
778 | ||
779 | math_libs = [] | |
77765258 | 780 | if not cc.has_header_symbol('math.h', 'isnan') |
d4c880d5 ZJS |
781 | lib = cc.find_library('m', required : true) |
782 | if (cc.has_function('isnan', dependencies : lib) and | |
783 | cc.has_function('__isnan', dependencies : lib)) | |
784 | math_libs += lib | |
785 | endif | |
786 | endif | |
787 | ||
788 | have = cc.has_header_symbol('errno.h', 'program_invocation_short_name', | |
789 | args : '-D_GNU_SOURCE') | |
790 | conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false) | |
791 | ||
792 | code = ''' | |
793 | extern char *__progname; | |
794 | int main(void) { | |
795 | return (*__progname != 0); | |
796 | } | |
797 | ''' | |
e25db916 | 798 | have = cc.compiles(code, name : 'using __progname') |
d4c880d5 ZJS |
799 | conf.set('HAVE___PROGNAME', have ? 1 : false) |
800 | ||
f71723ef JW |
801 | have_pty = conf.get('HAVE_PTY_H').to_string() == '1' \ |
802 | and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1' | |
803 | conf.set('HAVE_PTY', have_pty ? 1 : false) | |
44475360 | 804 | |
a0cf9105 LB |
805 | have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS') |
806 | conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false) | |
807 | ||
d4c880d5 ZJS |
808 | build_plymouth_support = get_option('build-plymouth-support') |
809 | have_tiocglcktrmios = cc.has_header_symbol( | |
810 | 'sys/ioctl.h', 'TIOCGLCKTRMIOS', | |
811 | required : build_plymouth_support.enabled()) | |
812 | have_sock_cloexec = cc.has_header_symbol( | |
813 | 'sys/socket.h', 'SOCK_CLOEXEC', | |
814 | prefix : '#include <sys/types.h>', | |
815 | required : build_plymouth_support.enabled()) | |
816 | have_sock_nonblock = cc.has_header_symbol( | |
817 | 'sys/socket.h', 'SOCK_NONBLOCK', | |
818 | prefix : '#include <sys/types.h>', | |
819 | required : build_plymouth_support.enabled()) | |
820 | have_so_passcred = cc.has_header_symbol( | |
821 | 'sys/socket.h', 'SO_PASSCRED', | |
b24dd22d | 822 | args : ['-D_GNU_SOURCE'], |
d4c880d5 ZJS |
823 | prefix : '#include <sys/types.h>', |
824 | required : build_plymouth_support.enabled()) | |
825 | ||
826 | build_plymouth_support = (not build_plymouth_support.disabled() and | |
827 | have_tiocglcktrmios and | |
828 | have_sock_cloexec and | |
829 | have_sock_nonblock and | |
830 | have_so_passcred) | |
831 | conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false) | |
832 | summary('plymouth support', | |
833 | build_plymouth_support ? 'enabled' : 'disabled', | |
834 | section : 'components') | |
835 | ||
836 | # check for valid fallocate() function | |
837 | # with 32 bits glibc 2.10, fallocate() exists but not fallocate64() | |
838 | # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64() | |
839 | # and program can't be linked. | |
840 | code = ''' | |
841 | #define _GNU_SOURCE | |
842 | #include <unistd.h> | |
843 | #include <fcntl.h> | |
844 | ||
845 | int main(void) { | |
846 | long ret; | |
847 | ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful); | |
848 | return ret == 0 ? 0 : 1; | |
849 | } | |
850 | ''' | |
851 | have = cc.links(code, name : 'fallocate() function') | |
852 | conf.set('HAVE_FALLOCATE', have ? 1 : false) | |
853 | ||
854 | code = ''' | |
855 | #include <unistd.h> | |
856 | #include <fcntl.h> | |
857 | ||
858 | int main(void) { | |
859 | long ret; | |
860 | ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful); | |
861 | return ret == 0 ? 0 : 1; | |
862 | } | |
863 | ''' | |
864 | have = cc.links(code, name : 'posix_fallocate() function') | |
865 | conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false) | |
866 | ||
867 | use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64'] | |
868 | message('Use CMOS clock: @0@'.format(use_hwclock_cmos)) | |
869 | conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false) | |
870 | ||
871 | conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false) | |
872 | conf.set('PG_BELL', get_option('pg-bell') ? 1 : false) | |
e0806c40 | 873 | conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false) |
d4c880d5 | 874 | |
8886d84e TW |
875 | is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__') |
876 | ||
d4c880d5 ZJS |
877 | ############################################################ |
878 | ||
6e92db54 | 879 | |
d4c880d5 ZJS |
880 | fs_search_path = get_option('fs-search-path') |
881 | fs_search_path_extra = get_option('fs-search-path-extra') | |
882 | if fs_search_path_extra != '' | |
883 | fs_search_path = ':'.join(fs_search_path, fs_search_path_extra) | |
884 | endif | |
885 | conf.set_quoted('FS_SEARCH_PATH', fs_search_path) | |
886 | ||
38b15ca2 | 887 | systemdsystemunitdir = '' |
fcbcb0cd | 888 | if systemd.found() |
e2b4f5be | 889 | systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir') |
fcbcb0cd | 890 | endif |
6e92db54 | 891 | |
5e67b421 CH |
892 | sysvinit = get_option('sysvinit').enabled() |
893 | sysvinitrcdir = sysconfdir + '/init.d' | |
894 | ||
ba30b89c | 895 | program_tests = get_option('program-tests') |
896 | ||
d4c880d5 ZJS |
897 | chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found() |
898 | conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false) | |
899 | ||
900 | have = get_option('chsh-only-listed') | |
901 | conf.set('ONLY_LISTED_SHELLS', have ? 1 : false) | |
902 | ||
903 | have = get_option('use-tty-group') | |
904 | conf.set('USE_TTY_GROUP', have ? 1 : false) | |
905 | ||
a4eeda56 KZ |
906 | bison = find_program('bison') |
907 | flex = find_program('flex') | |
7e8bf34a | 908 | sed = find_program('sed') |
a4eeda56 | 909 | |
d4c880d5 | 910 | build_hwclock = not get_option('build-hwclock').disabled() |
d4c880d5 ZJS |
911 | bison_gen = generator( |
912 | bison, | |
913 | output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'], | |
914 | arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']) | |
915 | ||
cb7ac65d | 916 | python_program = find_program('python3', 'python', native : true) |
b6799ccb | 917 | |
d4c880d5 | 918 | meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh' |
38bb89ee | 919 | meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh' |
d4c880d5 | 920 | |
7da59534 | 921 | configure_file( |
d4c880d5 ZJS |
922 | output : 'config.h', |
923 | configuration : conf) | |
924 | ||
5f2c862a | 925 | add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c') |
d4c880d5 | 926 | |
24b8804b TW |
927 | compiler_flags = [ |
928 | '-fno-common', | |
929 | ||
930 | '-Waddress-of-packed-member', | |
931 | '-Wdiscarded-qualifiers', | |
932 | '-Wembedded-directive', | |
933 | '-Wextra-semi', | |
934 | '-Wformat-security', | |
935 | '-Wimplicit-function-declaration', | |
936 | '-Wmissing-declarations', | |
937 | '-Wmissing-parameter-type', | |
938 | '-Wmissing-prototypes', | |
939 | '-Wnested-externs', | |
940 | '-Wno-missing-field-initializers', | |
9df5ac34 | 941 | '-Wold-style-definition', |
24b8804b TW |
942 | '-Wpointer-arith', |
943 | '-Wredundant-decls', | |
944 | '-Wsign-compare', | |
945 | '-Wstrict-prototypes', | |
946 | '-Wtype-limits', | |
947 | '-Wuninitialized', | |
948 | '-Wunused-but-set-parameter', | |
949 | '-Wunused-but-set-variable', | |
950 | '-Wunused-parameter', | |
951 | '-Wunused-result', | |
952 | '-Wunused-variable', | |
a52f9bdd | 953 | '-Wvla', |
2a91b213 | 954 | '-Walloca', |
24b8804b TW |
955 | ] |
956 | foreach compiler_flag : compiler_flags | |
957 | if cc.has_argument(compiler_flag) | |
958 | add_project_arguments(compiler_flag, language : 'c') | |
959 | endif | |
960 | endforeach | |
961 | ||
53b37016 | 962 | manadocs = [] |
38bb89ee | 963 | manlinks = {} |
aa519054 | 964 | |
38bb89ee | 965 | bashcompletions = [] |
aa519054 | 966 | bashcompletionslinks = {} |
53b37016 | 967 | |
d4c880d5 ZJS |
968 | subdir('include') |
969 | subdir('lib') | |
970 | subdir('libblkid') | |
971 | subdir('libmount') | |
972 | subdir('libsmartcols') | |
973 | subdir('libuuid') | |
c2e299d0 | 974 | subdir('liblastlog2') |
d4c880d5 | 975 | subdir('libfdisk') |
c2e299d0 | 976 | subdir('pam_lastlog2') |
d4c880d5 ZJS |
977 | subdir('login-utils') |
978 | subdir('sys-utils') | |
979 | subdir('disk-utils') | |
980 | subdir('misc-utils') | |
981 | subdir('text-utils') | |
982 | subdir('term-utils') | |
ac8be186 | 983 | subdir('lsfd-cmd') |
d4c880d5 ZJS |
984 | subdir('po') |
985 | ||
986 | includes = [dir_include, | |
d4c880d5 | 987 | dir_libsmartcols, |
d4c880d5 ZJS |
988 | dir_libfdisk, |
989 | dir_libuuid, | |
c2e299d0 | 990 | dir_liblastlog2, |
d4c880d5 ZJS |
991 | dir_sys_utils] |
992 | ||
993 | exes = [] | |
994 | ||
995 | opt = not get_option('build-chfn-chsh').disabled() | |
996 | exe = executable( | |
997 | 'chfn', | |
998 | chfn_sources, | |
999 | chfn_chsh_sources, | |
1000 | include_directories : includes, | |
0333c40b | 1001 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
1002 | dependencies : chfn_chsh_deps, |
1003 | install_dir : usrbin_exec_dir, | |
60d457f5 | 1004 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1005 | install : opt, |
1006 | build_by_default : opt) | |
38bb89ee | 1007 | |
d4c880d5 ZJS |
1008 | exe2 = executable( |
1009 | 'chsh', | |
1010 | 'login-utils/chsh.c', | |
4b724469 | 1011 | 'lib/shells.c', |
d4c880d5 ZJS |
1012 | chfn_chsh_sources, |
1013 | include_directories : includes, | |
1014 | link_with : lib_common, | |
1015 | dependencies : chfn_chsh_deps, | |
1016 | install_dir : usrbin_exec_dir, | |
a13574b1 | 1017 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1018 | install : opt, |
1019 | build_by_default : opt) | |
1020 | if opt and not is_disabler(exe) | |
1021 | exes += [exe, exe2] | |
38bb89ee TW |
1022 | manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc'] |
1023 | bashcompletions += ['chfn', 'chsh'] | |
d4c880d5 ZJS |
1024 | endif |
1025 | ||
1026 | exe = executable( | |
1027 | 'test_islocal', | |
1028 | test_islocal_sources, | |
1029 | include_directories : includes, | |
ba30b89c | 1030 | c_args : '-DTEST_PROGRAM', |
1031 | build_by_default : program_tests) | |
d4c880d5 ZJS |
1032 | exes += exe |
1033 | ||
d4c880d5 ZJS |
1034 | exe = executable( |
1035 | 'test-consoles', | |
1036 | test_consoles_sources, | |
1037 | c_args : ['-DTEST_PROGRAM'], | |
1038 | include_directories : includes, | |
ba30b89c | 1039 | link_with : lib_common, |
1040 | build_by_default : program_tests) | |
d4c880d5 ZJS |
1041 | exes += exe |
1042 | ||
1043 | opt = not get_option('build-last').disabled() | |
1044 | exe = executable( | |
1045 | 'last', | |
1046 | last_sources, | |
1047 | include_directories : includes, | |
1048 | link_with : [lib_common], | |
1049 | install_dir : usrbin_exec_dir, | |
1050 | install : opt, | |
1051 | build_by_default : opt) | |
1052 | if opt and not is_disabler(exe) | |
1053 | exes += exe | |
1054 | meson.add_install_script(meson_make_symlink, | |
1055 | 'last', | |
1056 | join_paths(usrbin_exec_dir, 'lastb')) | |
38bb89ee TW |
1057 | manadocs += ['login-utils/last.1.adoc'] |
1058 | manlinks += {'lastb.1': 'last.1'} | |
1059 | bashcompletions += ['last'] | |
aa519054 | 1060 | bashcompletionslinks += {'lastb': 'last'} |
d4c880d5 ZJS |
1061 | endif |
1062 | ||
1063 | opt = not get_option('build-nologin').disabled() | |
1064 | exe = executable( | |
1065 | 'nologin', | |
1066 | 'login-utils/nologin.c', | |
1067 | include_directories : includes, | |
1068 | install_dir : sbindir, | |
308a0979 | 1069 | link_with : [lib_common], |
d4c880d5 ZJS |
1070 | install : opt, |
1071 | build_by_default : opt) | |
1072 | if opt and not is_disabler(exe) | |
1073 | exes += exe | |
38bb89ee | 1074 | manadocs += ['login-utils/nologin.8.adoc'] |
d4c880d5 ZJS |
1075 | endif |
1076 | ||
1077 | opt = not get_option('build-utmpdump').disabled() | |
1078 | exe = executable( | |
1079 | 'utmpdump', | |
1080 | 'login-utils/utmpdump.c', | |
1081 | include_directories : includes, | |
1082 | link_with : [lib_common], | |
1083 | install_dir : usrbin_exec_dir, | |
1084 | install : opt, | |
1085 | build_by_default : opt) | |
1086 | if opt and not is_disabler(exe) | |
1087 | exes += exe | |
38bb89ee TW |
1088 | manadocs += ['login-utils/utmpdump.1.adoc'] |
1089 | bashcompletions += ['utmpdump'] | |
d4c880d5 ZJS |
1090 | endif |
1091 | ||
8c917cf8 | 1092 | opt = get_option('build-su').require(have_pty).allowed() |
d4c880d5 ZJS |
1093 | exe = executable( |
1094 | 'su', | |
1095 | 'login-utils/su.c', | |
1096 | 'login-utils/su-common.c', | |
1097 | 'login-utils/su-common.h', | |
4b724469 | 1098 | 'lib/shells.c', |
d4c880d5 ZJS |
1099 | pty_session_c, |
1100 | monotonic_c, | |
1101 | include_directories : includes, | |
0333c40b | 1102 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
1103 | dependencies : [lib_pam, |
1104 | lib_pam_misc, | |
1105 | lib_util, | |
1106 | realtime_libs], | |
fb8c224e | 1107 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1108 | install : opt, |
1109 | build_by_default : opt) | |
1110 | if opt and not is_disabler(exe) | |
1111 | exes += exe | |
38bb89ee TW |
1112 | manadocs += ['login-utils/su.1.adoc'] |
1113 | bashcompletions += ['su'] | |
d4c880d5 ZJS |
1114 | endif |
1115 | ||
1116 | opt = not get_option('build-newgrp').disabled() | |
1117 | exe = executable( | |
1118 | 'newgrp', | |
1119 | 'login-utils/newgrp.c', | |
1120 | include_directories : includes, | |
1121 | dependencies : [lib_crypt], | |
1122 | install_dir : usrbin_exec_dir, | |
cb3dee5a | 1123 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1124 | install : opt, |
1125 | build_by_default : opt) | |
1126 | if opt and not is_disabler(exe) | |
1127 | exes += exe | |
38bb89ee | 1128 | manadocs += ['login-utils/newgrp.1.adoc'] |
f265b432 | 1129 | bashcompletions += ['newgrp'] |
d4c880d5 ZJS |
1130 | endif |
1131 | ||
1132 | opt = not get_option('build-lslogins').disabled() | |
1133 | exe = executable( | |
1134 | 'lslogins', | |
1135 | 'login-utils/lslogins.c', | |
d4c880d5 ZJS |
1136 | include_directories : includes, |
1137 | link_with : [lib_common, | |
0333c40b | 1138 | lib_smartcols, |
13d2fd8f TW |
1139 | logindefs_c] + |
1140 | (build_liblastlog2 ? [lib_lastlog2] : []), | |
d4c880d5 ZJS |
1141 | dependencies : [lib_selinux, |
1142 | lib_systemd], | |
1143 | install_dir : usrbin_exec_dir, | |
1144 | install : opt, | |
1145 | build_by_default : opt) | |
1146 | if opt and not is_disabler(exe) | |
1147 | exes += exe | |
38bb89ee TW |
1148 | manadocs += ['login-utils/lslogins.1.adoc'] |
1149 | bashcompletions += ['lslogins'] | |
d4c880d5 ZJS |
1150 | endif |
1151 | ||
1152 | opt = not get_option('build-vipw').disabled() | |
1153 | exe = executable( | |
1154 | 'vipw', | |
1155 | 'login-utils/vipw.c', | |
1156 | 'login-utils/setpwnam.h', | |
1157 | include_directories : includes, | |
1158 | link_with : [lib_common], | |
1159 | dependencies : [lib_selinux], | |
1160 | install_dir : usrbin_exec_dir, | |
1161 | install : opt, | |
1162 | build_by_default : opt) | |
1163 | if opt and not is_disabler(exe) | |
1164 | exes += exe | |
1165 | meson.add_install_script(meson_make_symlink, | |
1166 | 'vipw', | |
1167 | join_paths(usrbin_exec_dir, 'vigr')) | |
38bb89ee | 1168 | manadocs += ['login-utils/vipw.8.adoc'] |
f6fb7fa7 CH |
1169 | meson.add_install_script(meson_make_symlink, |
1170 | 'vipw.8', | |
1171 | join_paths(mandir, 'man8/vigr.8')) | |
d4c880d5 ZJS |
1172 | endif |
1173 | ||
8c917cf8 | 1174 | opt = get_option('build-runuser').require(have_pty).allowed() |
d4c880d5 ZJS |
1175 | exe = executable( |
1176 | 'runuser', | |
1177 | 'login-utils/runuser.c', | |
1178 | 'login-utils/su-common.c', | |
1179 | 'login-utils/su-common.h', | |
4b724469 | 1180 | 'lib/shells.c', |
d4c880d5 ZJS |
1181 | pty_session_c, |
1182 | monotonic_c, | |
1183 | include_directories : includes, | |
0333c40b | 1184 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
1185 | dependencies : [lib_pam, |
1186 | lib_pam_misc, | |
1187 | lib_util, | |
1188 | realtime_libs], | |
1189 | install_dir : sbindir, | |
1190 | install : opt, | |
1191 | build_by_default : opt) | |
1192 | if opt and not is_disabler(exe) | |
1193 | exes += exe | |
38bb89ee | 1194 | manadocs += ['login-utils/runuser.1.adoc'] |
aa519054 | 1195 | bashcompletionslinks += {'runuser': 'su'} |
d4c880d5 ZJS |
1196 | endif |
1197 | ||
1198 | ############################################################ | |
1199 | ||
8886d84e TW |
1200 | if is_glibc |
1201 | exe = executable( | |
1202 | 'col', | |
1203 | col_sources, | |
1204 | include_directories : includes, | |
1205 | link_with : lib_common, | |
1206 | install_dir : usrbin_exec_dir, | |
1207 | install : true) | |
1208 | exes += exe | |
1209 | manadocs += ['text-utils/col.1.adoc'] | |
1210 | bashcompletions += ['col'] | |
1211 | endif | |
d4c880d5 ZJS |
1212 | |
1213 | exe = executable( | |
1214 | 'colcrt', | |
1215 | colcrt_sources, | |
1216 | include_directories : includes, | |
1217 | install_dir : usrbin_exec_dir, | |
1218 | install : true) | |
1219 | exes += exe | |
38bb89ee TW |
1220 | manadocs += ['text-utils/colcrt.1.adoc'] |
1221 | bashcompletions += ['colcrt'] | |
d4c880d5 ZJS |
1222 | |
1223 | exe = executable( | |
1224 | 'colrm', | |
1225 | colrm_sources, | |
1226 | include_directories : includes, | |
1227 | link_with : lib_common, | |
1228 | install_dir : usrbin_exec_dir, | |
1229 | install : true) | |
1230 | exes += exe | |
38bb89ee TW |
1231 | manadocs += ['text-utils/colrm.1.adoc'] |
1232 | bashcompletions += ['colrm'] | |
d4c880d5 ZJS |
1233 | |
1234 | exe = executable( | |
1235 | 'rev', | |
1236 | rev_sources, | |
1237 | include_directories : includes, | |
1238 | install_dir : usrbin_exec_dir, | |
1239 | install : true) | |
1240 | exes += exe | |
38bb89ee TW |
1241 | manadocs += ['text-utils/rev.1.adoc'] |
1242 | bashcompletions += ['rev'] | |
d4c880d5 ZJS |
1243 | |
1244 | exe = executable( | |
1245 | 'column', | |
1246 | column_sources, | |
1247 | include_directories : includes, | |
1248 | link_with : [lib_common, | |
1249 | lib_smartcols], | |
1250 | install_dir : usrbin_exec_dir, | |
1251 | install : true) | |
1252 | if not is_disabler(exe) | |
1253 | exes += exe | |
38bb89ee TW |
1254 | manadocs += ['text-utils/column.1.adoc'] |
1255 | bashcompletions += ['column'] | |
d4c880d5 ZJS |
1256 | endif |
1257 | ||
1258 | opt = not get_option('build-line').disabled() | |
1259 | exe = executable( | |
1260 | 'line', | |
1261 | line_sources, | |
1262 | include_directories : includes, | |
1263 | install_dir : usrbin_exec_dir, | |
1264 | install : opt, | |
1265 | build_by_default : opt) | |
1266 | if opt and not is_disabler(exe) | |
1267 | exes += exe | |
38bb89ee | 1268 | manadocs += ['text-utils/line.1.adoc'] |
d4c880d5 ZJS |
1269 | endif |
1270 | ||
1271 | opt = not get_option('build-pg').disabled() | |
1272 | exe = executable( | |
1273 | 'pg', | |
1274 | pg_sources, | |
1275 | link_with : lib_common, | |
1276 | include_directories : includes, | |
1277 | dependencies : [lib_tinfo, | |
1278 | curses_libs], | |
1279 | install_dir : usrbin_exec_dir, | |
1280 | install : opt, | |
1281 | build_by_default : opt) | |
1282 | if opt and not is_disabler(exe) | |
1283 | exes += exe | |
38bb89ee TW |
1284 | manadocs += ['text-utils/pg.1.adoc'] |
1285 | bashcompletions += ['pg'] | |
d4c880d5 ZJS |
1286 | endif |
1287 | ||
1288 | opt = not get_option('build-ul').disabled() | |
1289 | exe = executable( | |
1290 | 'ul', | |
1291 | ul_sources, | |
1292 | include_directories : includes, | |
1293 | dependencies : [lib_tinfo, | |
1294 | curses_libs], | |
1295 | install_dir : usrbin_exec_dir, | |
1296 | install : opt, | |
1297 | build_by_default : opt) | |
1298 | if opt and not is_disabler(exe) | |
1299 | exes += exe | |
38bb89ee TW |
1300 | manadocs += ['text-utils/ul.1.adoc'] |
1301 | bashcompletions += ['ul'] | |
d4c880d5 ZJS |
1302 | endif |
1303 | ||
1304 | opt = not get_option('build-more').disabled() | |
1305 | exe = executable( | |
1306 | 'more', | |
1307 | more_sources, | |
308a0979 | 1308 | link_with : [lib_common], |
d4c880d5 ZJS |
1309 | include_directories : includes, |
1310 | dependencies : [lib_tinfo, | |
6e92db54 KZ |
1311 | curses_libs, |
1312 | lib_magic], | |
d4c880d5 ZJS |
1313 | install : opt, |
1314 | build_by_default : opt) | |
1315 | exe2 = executable( | |
1316 | 'test_more', | |
1317 | more_sources, | |
308a0979 | 1318 | link_with : [lib_common], |
d4c880d5 ZJS |
1319 | include_directories : includes, |
1320 | c_args : '-DTEST_PROGRAM', | |
1321 | dependencies : [lib_tinfo, | |
6e92db54 KZ |
1322 | curses_libs, |
1323 | lib_magic], | |
ba30b89c | 1324 | build_by_default : opt and program_tests) |
d4c880d5 ZJS |
1325 | exes += exe |
1326 | if opt and not is_disabler(exe) | |
1327 | exes += [exe, exe2] | |
38bb89ee TW |
1328 | manadocs += ['text-utils/more.1.adoc'] |
1329 | bashcompletions += ['more'] | |
d4c880d5 ZJS |
1330 | endif |
1331 | ||
1332 | exe = executable( | |
1333 | 'hexdump', | |
1334 | hexdump_sources, | |
1335 | include_directories : includes, | |
1336 | link_with : [lib_common, | |
1337 | lib_tcolors], | |
1338 | install_dir : usrbin_exec_dir, | |
1339 | install : true) | |
1340 | if not is_disabler(exe) | |
1341 | exes += exe | |
53b37016 | 1342 | manadocs += ['text-utils/hexdump.1.adoc'] |
38bb89ee | 1343 | bashcompletions += ['hexdump'] |
d4c880d5 ZJS |
1344 | endif |
1345 | ||
1346 | opt = not get_option('build-lsmem').disabled() | |
1347 | exe = executable( | |
1348 | 'lsmem', | |
1349 | lsmem_sources, | |
1350 | include_directories : includes, | |
1351 | link_with : [lib_common, | |
1352 | lib_smartcols], | |
1353 | install_dir : usrbin_exec_dir, | |
1354 | install : opt, | |
1355 | build_by_default : opt) | |
1356 | if opt and not is_disabler(exe) | |
1357 | exes += exe | |
53b37016 | 1358 | manadocs += ['sys-utils/lsmem.1.adoc'] |
38bb89ee | 1359 | bashcompletions += ['lsmem'] |
d4c880d5 ZJS |
1360 | endif |
1361 | ||
1362 | opt = not get_option('build-chmem').disabled() | |
1363 | exe = executable( | |
1364 | 'chmem', | |
1365 | chmem_sources, | |
1366 | include_directories : includes, | |
1367 | link_with : [lib_common], | |
1368 | install_dir : usrbin_exec_dir, | |
1369 | install : opt, | |
1370 | build_by_default : opt) | |
1371 | if opt and not is_disabler(exe) | |
1372 | exes += exe | |
53b37016 | 1373 | manadocs += ['sys-utils/chmem.8.adoc'] |
38bb89ee | 1374 | bashcompletions += ['chmem'] |
d4c880d5 ZJS |
1375 | endif |
1376 | ||
1377 | exe = executable( | |
1378 | 'choom', | |
1379 | choom_sources, | |
1380 | include_directories : includes, | |
1381 | link_with : [lib_common], | |
1382 | install_dir : usrbin_exec_dir, | |
1383 | install : true) | |
1384 | exes += exe | |
53b37016 | 1385 | manadocs += ['sys-utils/choom.1.adoc'] |
d4c880d5 | 1386 | |
023950b1 JW |
1387 | has_seminfo_type = cc.has_type('struct seminfo', args : '-D_GNU_SOURCE', prefix : '#include <sys/sem.h>') |
1388 | ||
1389 | opt = get_option('build-ipcmk').require(has_seminfo_type).allowed() | |
d4c880d5 ZJS |
1390 | exe = executable( |
1391 | 'ipcmk', | |
1392 | ipcmk_sources, | |
1393 | include_directories : includes, | |
1394 | link_with : [lib_common], | |
1395 | install_dir : usrbin_exec_dir, | |
0b91fd9f JW |
1396 | install : opt, |
1397 | build_by_default : opt) | |
1398 | if opt and not is_disabler(exe) | |
1399 | exes += exe | |
1400 | manadocs += ['sys-utils/ipcmk.1.adoc'] | |
1401 | bashcompletions += ['ipcmk'] | |
1402 | endif | |
d4c880d5 | 1403 | |
023950b1 | 1404 | opt = get_option('build-ipcrm').require(has_seminfo_type).allowed() |
d4c880d5 ZJS |
1405 | exe = executable( |
1406 | 'ipcrm', | |
1407 | ipcrm_sources, | |
1408 | include_directories : includes, | |
1409 | link_with : [lib_common], | |
1410 | install_dir : usrbin_exec_dir, | |
25c9b3b4 JW |
1411 | install : opt, |
1412 | build_by_default : opt) | |
1413 | if opt and not is_disabler(exe) | |
1414 | exes += exe | |
1415 | manadocs += ['sys-utils/ipcrm.1.adoc'] | |
1416 | bashcompletions += ['ipcrm'] | |
1417 | endif | |
d4c880d5 | 1418 | |
023950b1 | 1419 | opt = not get_option('build-ipcs').require(has_seminfo_type).disabled() |
d4c880d5 ZJS |
1420 | exe = executable( |
1421 | 'ipcs', | |
1422 | ipcs_sources, | |
1423 | include_directories : includes, | |
1424 | link_with : [lib_common], | |
1425 | install_dir : usrbin_exec_dir, | |
1426 | install : opt, | |
1427 | build_by_default : opt) | |
1428 | if opt and not is_disabler(exe) | |
1429 | exes += exe | |
53b37016 | 1430 | manadocs += ['sys-utils/ipcs.1.adoc'] |
38bb89ee | 1431 | bashcompletions += ['ipcs'] |
d4c880d5 ZJS |
1432 | endif |
1433 | ||
1434 | opt = not get_option('build-rfkill').disabled() | |
1435 | exe = executable( | |
1436 | 'rfkill', | |
1437 | rfkill_sources, | |
1438 | include_directories : includes, | |
1439 | link_with : [lib_common, | |
1440 | lib_smartcols], | |
1441 | install_dir : usrsbin_exec_dir, | |
1442 | install : opt, | |
1443 | build_by_default : opt) | |
1444 | if opt and not is_disabler(exe) | |
1445 | exes += exe | |
53b37016 | 1446 | manadocs += ['sys-utils/rfkill.8.adoc'] |
38bb89ee | 1447 | bashcompletions += ['rfkill'] |
d4c880d5 ZJS |
1448 | endif |
1449 | ||
1450 | exe = executable( | |
1451 | 'renice', | |
1452 | renice_sources, | |
1453 | include_directories : includes, | |
1454 | link_with : [lib_common, | |
1455 | lib_smartcols], | |
1456 | install_dir : usrbin_exec_dir, | |
1457 | install : true) | |
1458 | if not is_disabler(exe) | |
1459 | exes += exe | |
53b37016 | 1460 | manadocs += ['sys-utils/renice.1.adoc'] |
38bb89ee | 1461 | bashcompletions += ['renice'] |
d4c880d5 ZJS |
1462 | endif |
1463 | ||
f092076f DDM |
1464 | exe = executable( |
1465 | 'setpgid', | |
1466 | setpgid_sources, | |
1467 | include_directories: includes, | |
1468 | link_with : [lib_common, | |
1469 | lib_smartcols], | |
1470 | install_dir : usrbin_exec_dir, | |
1471 | install : true) | |
1472 | if opt and not is_disabler(exe) | |
1473 | exes += exe | |
1474 | manadocs += ['sys-utils/setpgid.1.adoc'] | |
1475 | bashcompletions += ['setpgid'] | |
1476 | endif | |
1477 | ||
d4c880d5 ZJS |
1478 | exe = executable( |
1479 | 'setsid', | |
1480 | setsid_sources, | |
1481 | include_directories : includes, | |
1482 | link_with : [lib_common, | |
1483 | lib_smartcols], | |
1484 | install_dir : usrbin_exec_dir, | |
1485 | install : true) | |
1486 | if opt and not is_disabler(exe) | |
1487 | exes += exe | |
53b37016 | 1488 | manadocs += ['sys-utils/setsid.1.adoc'] |
38bb89ee | 1489 | bashcompletions += ['setsid'] |
d4c880d5 ZJS |
1490 | endif |
1491 | ||
1492 | exe = executable( | |
1493 | 'readprofile', | |
1494 | readprofile_sources, | |
1495 | include_directories : includes, | |
1496 | link_with : [lib_common, | |
1497 | lib_smartcols], | |
1498 | install_dir : usrsbin_exec_dir, | |
1499 | install : true) | |
1500 | if not is_disabler(exe) | |
1501 | exes += exe | |
53b37016 | 1502 | manadocs += ['sys-utils/readprofile.8.adoc'] |
38bb89ee | 1503 | bashcompletions += ['readprofile'] |
d4c880d5 ZJS |
1504 | endif |
1505 | ||
1506 | opt = not get_option('build-tunelp').disabled() | |
1507 | exe = executable( | |
1508 | 'tunelp', | |
1509 | tunelp_sources, | |
1510 | include_directories : includes, | |
1511 | link_with : [lib_common], | |
1512 | install_dir : usrsbin_exec_dir, | |
1513 | install : opt, | |
1514 | build_by_default : opt) | |
1515 | if opt and not is_disabler(exe) | |
1516 | exes += exe | |
53b37016 | 1517 | manadocs += ['sys-utils/tunelp.8.adoc'] |
38bb89ee | 1518 | bashcompletions += ['tunelp'] |
d4c880d5 ZJS |
1519 | endif |
1520 | ||
b8b63b36 | 1521 | opt = get_option('build-fstrim').require(have_sys_vfs_header).allowed() |
d4c880d5 ZJS |
1522 | exe = executable( |
1523 | 'fstrim', | |
1524 | fstrim_sources, | |
1525 | include_directories : includes, | |
c43b185a JW |
1526 | link_with : [lib_common], |
1527 | dependencies : [mount_dep], | |
d4c880d5 | 1528 | install_dir : sbindir, |
b6799ccb JW |
1529 | install : opt, |
1530 | build_by_default : opt) | |
1531 | if opt and not is_disabler(exe) | |
d4c880d5 | 1532 | exes += exe |
53b37016 | 1533 | manadocs += ['sys-utils/fstrim.8.adoc'] |
38bb89ee | 1534 | bashcompletions += ['fstrim'] |
73f3e2ad | 1535 | endif |
d4c880d5 | 1536 | |
73f3e2ad | 1537 | opt = get_option('build-dmesg').require(cc.has_header('sys/klog.h')).allowed() |
d4c880d5 ZJS |
1538 | exe = executable( |
1539 | 'dmesg', | |
1540 | dmesg_sources, | |
1541 | include_directories : includes, | |
1542 | link_with : [lib_common, | |
1543 | lib_tcolors], | |
73f3e2ad JW |
1544 | install : opt, |
1545 | build_by_default : opt) | |
1546 | if opt and not is_disabler(exe) | |
d4c880d5 | 1547 | exes += exe |
53b37016 | 1548 | manadocs += ['sys-utils/dmesg.1.adoc'] |
38bb89ee | 1549 | bashcompletions += ['dmesg'] |
d4c880d5 ZJS |
1550 | endif |
1551 | ||
1552 | exe = executable( | |
1553 | 'test_dmesg', | |
1554 | dmesg_sources, | |
1555 | include_directories : dir_include, | |
1556 | c_args : '-DTEST_DMESG', | |
1557 | link_with : [lib_common, | |
ba30b89c | 1558 | lib_tcolors], |
1559 | build_by_default : program_tests) | |
d4c880d5 ZJS |
1560 | if not is_disabler(exe) |
1561 | exes += exe | |
1562 | endif | |
1563 | ||
1564 | exe = executable( | |
1565 | 'ctrlaltdel', | |
1566 | ctrlaltdel_sources, | |
1567 | include_directories : includes, | |
1568 | link_with : [lib_common], | |
1569 | install_dir : sbindir, | |
1570 | install : true) | |
1571 | exes += exe | |
53b37016 | 1572 | manadocs += ['sys-utils/ctrlaltdel.8.adoc'] |
38bb89ee | 1573 | bashcompletions += ['ctrlaltdel'] |
d4c880d5 | 1574 | |
9c4ef6f7 JW |
1575 | have_linux_fs_h = conf.get('HAVE_LINUX_FS_H').to_string() == '1' |
1576 | ||
1577 | opt = get_option('build-fsfreeze').require(have_linux_fs_h).allowed() | |
d4c880d5 ZJS |
1578 | exe = executable( |
1579 | 'fsfreeze', | |
1580 | fsfreeze_sources, | |
1581 | include_directories : includes, | |
1582 | install_dir : sbindir, | |
6549a90c JW |
1583 | install : opt, |
1584 | build_by_default : opt) | |
1585 | if opt and not is_disabler(exe) | |
1586 | exes += exe | |
1587 | manadocs += ['sys-utils/fsfreeze.8.adoc'] | |
1588 | bashcompletions += ['fsfreeze'] | |
1589 | endif | |
d4c880d5 | 1590 | |
9c4ef6f7 | 1591 | opt = get_option('build-blkdiscard').require(have_linux_fs_h).allowed() |
d4c880d5 ZJS |
1592 | exe = executable( |
1593 | 'blkdiscard', | |
1594 | blkdiscard_sources, | |
1595 | include_directories : includes, | |
a764efb5 JW |
1596 | link_with : [lib_common], |
1597 | dependencies : [blkid_dep], | |
d4c880d5 | 1598 | install_dir : sbindir, |
9c4ef6f7 JW |
1599 | install : opt, |
1600 | build_by_default : opt) | |
1601 | if opt and not is_disabler(exe) | |
1602 | exes += exe | |
1603 | manadocs += ['sys-utils/blkdiscard.8.adoc'] | |
1604 | bashcompletions += ['blkdiscard'] | |
1605 | endif | |
d4c880d5 | 1606 | |
9c4ef6f7 | 1607 | opt = get_option('build-blkzone').require(have_linux_fs_h).allowed() |
ca42082d JW |
1608 | exe = executable( |
1609 | 'blkzone', | |
1610 | blkzone_sources, | |
1611 | include_directories : includes, | |
1612 | link_with : [lib_common], | |
1613 | install_dir : sbindir, | |
1614 | install : opt, | |
1615 | build_by_default : opt) | |
1616 | if opt and not is_disabler(exe) | |
1a374511 JW |
1617 | exes += exe |
1618 | manadocs += ['sys-utils/blkzone.8.adoc'] | |
1619 | bashcompletions += ['blkzone'] | |
1620 | endif | |
d4c880d5 | 1621 | |
cd8fd8a1 JW |
1622 | opt = get_option('build-blkpr').require(cc.has_header('linux/pr.h')).allowed() |
1623 | exe = executable( | |
1624 | 'blkpr', | |
1625 | blkpr_sources, | |
1626 | include_directories : includes, | |
1627 | link_with : [lib_common], | |
1628 | install_dir : sbindir, | |
1629 | install : opt, | |
1630 | build_by_default : opt) | |
1631 | if opt and not is_disabler(exe) | |
1a374511 JW |
1632 | exes += exe |
1633 | manadocs += ['sys-utils/blkpr.8.adoc'] | |
1634 | endif | |
61c2946d | 1635 | |
75637b88 | 1636 | opt = get_option('build-ldattach').require(cc.has_header('linux/if.h')).allowed() |
d4c880d5 ZJS |
1637 | exe = executable( |
1638 | 'ldattach', | |
1639 | ldattach_sources, | |
1640 | include_directories : includes, | |
1641 | link_with : [lib_common], | |
1642 | install_dir : usrsbin_exec_dir, | |
75637b88 JW |
1643 | install : opt, |
1644 | build_by_default : opt) | |
1645 | if opt and not is_disabler(exe) | |
1646 | exes += exe | |
1647 | manadocs += ['sys-utils/ldattach.8.adoc'] | |
1648 | bashcompletions += ['ldattach'] | |
1649 | endif | |
d4c880d5 | 1650 | |
5873f36e JW |
1651 | have_linux_rtc_h = cc.has_header('linux/rtc.h') |
1652 | ||
1653 | opt = get_option('build-rtcwake').require(have_linux_rtc_h).allowed() | |
d4c880d5 ZJS |
1654 | exe = executable( |
1655 | 'rtcwake', | |
1656 | rtcwake_sources, | |
1657 | include_directories : includes, | |
1658 | link_with : [lib_common], | |
1659 | install_dir : usrsbin_exec_dir, | |
fa907a88 JW |
1660 | install : opt, |
1661 | build_by_default : opt) | |
1662 | if opt and not is_disabler(exe) | |
1663 | exes += exe | |
1664 | manadocs += ['sys-utils/rtcwake.8.adoc'] | |
1665 | bashcompletions += ['rtcwake'] | |
1666 | endif | |
d4c880d5 | 1667 | |
17146fbf | 1668 | opt = get_option('build-setarch').require(cc.has_header('sys/personality.h')).allowed() |
d4c880d5 ZJS |
1669 | exe = executable( |
1670 | 'setarch', | |
1671 | setarch_sources, | |
1672 | include_directories : includes, | |
035fc2d9 | 1673 | link_with : [lib_common], |
d4c880d5 | 1674 | install_dir : usrbin_exec_dir, |
17146fbf JW |
1675 | install : opt, |
1676 | build_by_default : opt) | |
1677 | if opt and not is_disabler(exe) | |
1678 | exes += exe | |
1679 | manadocs += ['sys-utils/setarch.8.adoc'] | |
1680 | bashcompletions += ['setarch'] | |
1681 | endif | |
d4c880d5 | 1682 | |
17146fbf JW |
1683 | if opt |
1684 | setarch_links = ['uname26', 'linux32', 'linux64'] | |
1685 | setarch_links_arch = { | |
1686 | 's390x' : ['s390', 's390x'], | |
1687 | 'x86' : ['i386'], | |
1688 | 'x86_64' : ['i386', 'x86_64'], | |
1689 | 'ppc64' : ['ppc', 'ppc64', 'ppc32'], | |
1690 | 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'], | |
1691 | 'mips64' : ['mips', 'mips64', 'mips32'], | |
1692 | 'ia64' : ['i386', 'ia64'], | |
1693 | 'hppa' : ['parisc', 'parisc64', 'parisc32'], | |
1694 | } | |
1695 | setarch_links += setarch_links_arch.get(host_machine.cpu_family(), []) | |
1696 | ||
1697 | foreach link: setarch_links | |
1698 | meson.add_install_script(meson_make_symlink, | |
1699 | 'setarch', | |
1700 | join_paths(usrbin_exec_dir, link)) | |
1701 | manlinks += {link + '.8': 'setarch.8'} | |
1702 | endforeach | |
1703 | endif | |
d4c880d5 ZJS |
1704 | |
1705 | opt = not get_option('build-eject').disabled() | |
1706 | exe = executable( | |
1707 | 'eject', | |
1708 | eject_sources, | |
1709 | include_directories : includes, | |
c43b185a JW |
1710 | link_with : [lib_common], |
1711 | dependencies : [mount_dep], | |
d4c880d5 ZJS |
1712 | install_dir : usrbin_exec_dir, |
1713 | install : opt, | |
1714 | build_by_default : opt) | |
1715 | if opt and not is_disabler(exe) | |
1716 | exe = exe | |
53b37016 | 1717 | manadocs += ['sys-utils/eject.1.adoc'] |
38bb89ee | 1718 | bashcompletions += ['eject'] |
d4c880d5 ZJS |
1719 | endif |
1720 | ||
1721 | opt = not get_option('build-losetup').disabled() | |
1722 | exe = executable( | |
1723 | 'losetup', | |
1724 | losetup_sources, | |
1725 | include_directories : includes, | |
1726 | link_with : [lib_common, | |
1727 | lib_smartcols], | |
1728 | install_dir : sbindir, | |
1729 | install : opt, | |
1730 | build_by_default : opt) | |
1731 | if opt and not is_disabler(exe) | |
53b37016 | 1732 | manadocs += ['sys-utils/losetup.8.adoc'] |
d4c880d5 | 1733 | exes += exe |
38bb89ee | 1734 | bashcompletions += ['losetup'] |
d4c880d5 ZJS |
1735 | endif |
1736 | ||
69939195 ZJS |
1737 | opt = opt and 'losetup' in static_programs |
1738 | exe = executable( | |
1739 | 'losetup.static', | |
1740 | losetup_sources, | |
1741 | include_directories : includes, | |
1742 | link_args : ['--static'], | |
1743 | link_with : [lib_common, | |
1744 | lib_smartcols.get_static_lib()], | |
1745 | install_dir : sbindir, | |
1746 | install : opt, | |
1747 | build_by_default : opt) | |
1748 | if opt and not is_disabler(exe) | |
1749 | exes += exe | |
1750 | endif | |
1751 | ||
d4c880d5 ZJS |
1752 | opt = not get_option('build-zramctl').disabled() |
1753 | exe = executable( | |
1754 | 'zramctl', | |
1755 | zramctl_sources, | |
1756 | include_directories : includes, | |
1757 | link_with : [lib_common, | |
1758 | lib_smartcols], | |
1759 | install_dir : sbindir, | |
1760 | install : opt, | |
1761 | build_by_default : opt) | |
1762 | if opt and not is_disabler(exe) | |
1763 | exes += exe | |
53b37016 | 1764 | manadocs += ['sys-utils/zramctl.8.adoc'] |
38bb89ee | 1765 | bashcompletions += ['zramctl'] |
d4c880d5 ZJS |
1766 | endif |
1767 | ||
1768 | exe = executable( | |
1769 | 'prlimit', | |
1770 | prlimit_sources, | |
1771 | include_directories : includes, | |
1772 | link_with : [lib_common, | |
1773 | lib_smartcols], | |
1774 | install_dir : usrbin_exec_dir, | |
1775 | install : true) | |
1776 | if not is_disabler(exe) | |
1777 | exes += exe | |
53b37016 | 1778 | manadocs += ['sys-utils/prlimit.1.adoc'] |
38bb89ee | 1779 | bashcompletions += ['prlimit'] |
d4c880d5 ZJS |
1780 | endif |
1781 | ||
b6799ccb | 1782 | opt = not get_option('build-lsns').disabled() |
d4c880d5 ZJS |
1783 | exe = executable( |
1784 | 'lsns', | |
1785 | lsns_sources, | |
1786 | include_directories : includes, | |
1787 | link_with : [lib_common, | |
c43b185a JW |
1788 | lib_smartcols], |
1789 | dependencies : [mount_dep], | |
d4c880d5 | 1790 | install_dir : usrbin_exec_dir, |
b6799ccb JW |
1791 | install : opt, |
1792 | build_by_default : opt) | |
1793 | if opt and not is_disabler(exe) | |
d4c880d5 | 1794 | exes += exe |
53b37016 | 1795 | manadocs += ['sys-utils/lsns.8.adoc'] |
38bb89ee | 1796 | bashcompletions += ['lsns'] |
d4c880d5 ZJS |
1797 | endif |
1798 | ||
1799 | opt = not get_option('build-mount').disabled() | |
1800 | exe = executable( | |
1801 | 'mount', | |
1802 | mount_sources, | |
1803 | include_directories : includes, | |
1804 | link_with : [lib_common, | |
c43b185a JW |
1805 | lib_smartcols], |
1806 | dependencies : [lib_selinux, mount_dep], | |
8f49b369 | 1807 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1808 | install : opt, |
1809 | build_by_default : opt) | |
1810 | exe2 = executable( | |
1811 | 'umount', | |
1812 | umount_sources, | |
1813 | include_directories : includes, | |
c43b185a JW |
1814 | link_with : [lib_common], |
1815 | dependencies : [mount_dep], | |
1cb3c90c | 1816 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1817 | install : opt, |
1818 | build_by_default : opt) | |
1819 | if opt and not is_disabler(exe) | |
1820 | exes += [exe, exe2] | |
53b37016 KZ |
1821 | manadocs += ['sys-utils/fstab.5.adoc', |
1822 | 'sys-utils/mount.8.adoc', | |
1823 | 'sys-utils/umount.8.adoc'] | |
38bb89ee | 1824 | bashcompletions += ['mount', 'umount'] |
d4c880d5 ZJS |
1825 | endif |
1826 | ||
69939195 ZJS |
1827 | opt2 = opt and 'mount' in static_programs |
1828 | exe = executable( | |
1829 | 'mount.static', | |
1830 | mount_sources, | |
1831 | include_directories : includes, | |
1832 | link_args : ['--static'], | |
1833 | link_with : [lib_common, | |
c43b185a JW |
1834 | lib_smartcols_static], |
1835 | dependencies : [mount_static_dep], | |
69939195 ZJS |
1836 | install : opt2, |
1837 | build_by_default : opt2) | |
1838 | if opt2 and not is_disabler(exe) | |
1839 | exes += exe | |
1840 | endif | |
1841 | ||
1842 | opt2 = opt and 'umount' in static_programs | |
1843 | exe = executable( | |
1844 | 'umount.static', | |
1845 | umount_sources, | |
1846 | include_directories : includes, | |
1847 | link_args : ['--static'], | |
c43b185a JW |
1848 | link_with : [lib_common], |
1849 | dependencies : [mount_static_dep], | |
69939195 ZJS |
1850 | install : opt2, |
1851 | build_by_default : opt2) | |
1852 | if opt2 and not is_disabler(exe) | |
1853 | exes += exe | |
1854 | endif | |
1855 | ||
d4c880d5 ZJS |
1856 | # setuid? |
1857 | ||
b6799ccb | 1858 | opt = not get_option('build-swapon').disabled() |
d4c880d5 ZJS |
1859 | exe = executable( |
1860 | 'swapon', | |
1861 | swapon_sources, | |
1862 | include_directories : includes, | |
1863 | link_with : [lib_common, | |
d4c880d5 | 1864 | lib_smartcols], |
a764efb5 | 1865 | dependencies : [blkid_dep, mount_dep], |
d4c880d5 | 1866 | install_dir : sbindir, |
b6799ccb JW |
1867 | install : opt, |
1868 | build_by_default : opt) | |
1869 | if opt and not is_disabler(exe) | |
d4c880d5 | 1870 | exes += exe |
53b37016 | 1871 | manadocs += ['sys-utils/swapon.8.adoc'] |
38bb89ee | 1872 | bashcompletions += ['swapon'] |
d4c880d5 ZJS |
1873 | endif |
1874 | ||
b6799ccb | 1875 | opt = not get_option('build-swapoff').disabled() |
d4c880d5 ZJS |
1876 | exe = executable( |
1877 | 'swapoff', | |
1878 | swapoff_sources, | |
1879 | include_directories : includes, | |
a764efb5 JW |
1880 | link_with : [lib_common], |
1881 | dependencies : [blkid_dep, mount_dep], | |
d4c880d5 | 1882 | install_dir : sbindir, |
b6799ccb JW |
1883 | install : opt, |
1884 | build_by_default : opt) | |
1885 | if opt and not is_disabler(exe) | |
d4c880d5 | 1886 | exes += exe |
38bb89ee TW |
1887 | manlinks += {'swapoff.8': 'swapon.8'} |
1888 | bashcompletions += ['swapoff'] | |
d4c880d5 ZJS |
1889 | endif |
1890 | ||
1891 | exe = executable( | |
1892 | 'lscpu', | |
1893 | lscpu_sources, | |
1894 | include_directories : includes, | |
1895 | link_with : [lib_common, | |
1896 | lib_smartcols], | |
1897 | dependencies : [rtas_libs], | |
1898 | install_dir : usrbin_exec_dir, | |
1899 | install : true) | |
1900 | if not is_disabler(exe) | |
1901 | exes += exe | |
53b37016 | 1902 | manadocs += ['sys-utils/lscpu.1.adoc'] |
38bb89ee | 1903 | bashcompletions += ['lscpu'] |
d4c880d5 ZJS |
1904 | endif |
1905 | ||
a2c940f4 | 1906 | opt = get_option('build-chcpu').require(have_cpu_set_t).allowed() |
d4c880d5 ZJS |
1907 | exe = executable( |
1908 | 'chcpu', | |
1909 | chcpu_sources, | |
1910 | include_directories : includes, | |
1911 | link_with : [lib_common], | |
1912 | install_dir : sbindir, | |
a2c940f4 JW |
1913 | install : opt, |
1914 | build_by_default : opt) | |
1915 | if opt and not is_disabler(exe) | |
1916 | exes += exe | |
1917 | manadocs += ['sys-utils/chcpu.8.adoc'] | |
1918 | bashcompletions += ['chcpu'] | |
1919 | endif | |
d4c880d5 ZJS |
1920 | |
1921 | exe = executable( | |
1922 | 'wdctl', | |
1923 | wdctl_sources, | |
1924 | include_directories : includes, | |
1925 | link_with : [lib_common, | |
1926 | lib_smartcols], | |
1927 | install : true) | |
1928 | if not is_disabler(exe) | |
1929 | exes += exe | |
53b37016 | 1930 | manadocs += ['sys-utils/wdctl.8.adoc'] |
38bb89ee | 1931 | bashcompletions += ['wdctl'] |
d4c880d5 ZJS |
1932 | endif |
1933 | ||
1934 | opt = not get_option('build-mountpoint').disabled() | |
1935 | exe = executable( | |
1936 | 'mountpoint', | |
1937 | mountpoint_sources, | |
1938 | include_directories : includes, | |
c43b185a | 1939 | dependencies : [mount_dep], |
d4c880d5 ZJS |
1940 | install : opt, |
1941 | build_by_default : opt) | |
1942 | if opt and not is_disabler(exe) | |
1943 | exes += exe | |
53b37016 | 1944 | manadocs += ['sys-utils/mountpoint.1.adoc'] |
38bb89ee | 1945 | bashcompletions += ['mountpoint'] |
d4c880d5 ZJS |
1946 | endif |
1947 | ||
1948 | opt = not get_option('build-fallocate').disabled() | |
1949 | exe = executable( | |
1950 | 'fallocate', | |
1951 | fallocate_sources, | |
1952 | include_directories : includes, | |
1953 | link_with : [lib_common], | |
1954 | install_dir : usrbin_exec_dir, | |
1955 | install : opt, | |
1956 | build_by_default : opt) | |
1957 | if opt and not is_disabler(exe) | |
1958 | exes += exe | |
53b37016 | 1959 | manadocs += ['sys-utils/fallocate.1.adoc'] |
38bb89ee | 1960 | bashcompletions += ['fallocate'] |
d4c880d5 ZJS |
1961 | endif |
1962 | ||
1963 | opt = not get_option('build-pivot_root').disabled() | |
1964 | exe = executable( | |
1965 | 'pivot_root', | |
1966 | pivot_root_sources, | |
1967 | include_directories : includes, | |
1968 | install_dir : sbindir, | |
1969 | install : opt, | |
1970 | build_by_default : opt) | |
1971 | if opt and not is_disabler(exe) | |
1972 | exes += exe | |
53b37016 | 1973 | manadocs += ['sys-utils/pivot_root.8.adoc'] |
38bb89ee | 1974 | bashcompletions += ['pivot_root'] |
d4c880d5 ZJS |
1975 | endif |
1976 | ||
1977 | opt = not get_option('build-switch_root').disabled() | |
1978 | if opt and not have_dirfd and not have_ddfd | |
1979 | error('neither dirfd nor ddfd are available') | |
1980 | endif | |
1981 | exe = executable( | |
1982 | 'switch_root', | |
1983 | switch_root_sources, | |
1984 | include_directories : includes, | |
1985 | install_dir : sbindir, | |
1986 | install : opt, | |
1987 | build_by_default : opt) | |
1988 | if opt and not is_disabler(exe) | |
1989 | exes += exe | |
53b37016 | 1990 | manadocs += ['sys-utils/switch_root.8.adoc'] |
d4c880d5 ZJS |
1991 | endif |
1992 | ||
1993 | opt = not get_option('build-unshare').disabled() | |
1994 | exe = executable( | |
1995 | 'unshare', | |
1996 | unshare_sources, | |
1997 | include_directories : includes, | |
1998 | link_with : [lib_common], | |
c43b185a | 1999 | dependencies : [mount_dep], |
d4c880d5 ZJS |
2000 | install_dir : usrbin_exec_dir, |
2001 | install : opt, | |
2002 | build_by_default : opt) | |
2003 | if opt and not is_disabler(exe) | |
2004 | exes += exe | |
53b37016 | 2005 | manadocs += ['sys-utils/unshare.1.adoc'] |
38bb89ee | 2006 | bashcompletions += ['unshare'] |
d4c880d5 ZJS |
2007 | endif |
2008 | ||
69939195 ZJS |
2009 | opt = opt and 'unshare' in static_programs |
2010 | exe = executable( | |
2011 | 'unshare.static', | |
2012 | unshare_sources, | |
2013 | include_directories : includes, | |
2014 | link_with : [lib_common], | |
c43b185a | 2015 | dependencies : [mount_dep], |
69939195 ZJS |
2016 | install_dir : usrbin_exec_dir, |
2017 | install : opt, | |
2018 | build_by_default : opt) | |
2019 | if opt and not is_disabler(exe) | |
2020 | exes += exe | |
2021 | endif | |
2022 | ||
d4c880d5 ZJS |
2023 | opt = not get_option('build-nsenter').disabled() |
2024 | exe = executable( | |
2025 | 'nsenter', | |
2026 | nsenter_sources, | |
2027 | include_directories : includes, | |
2028 | link_with : [lib_common], | |
2029 | dependencies : [lib_selinux], | |
2030 | install_dir : usrbin_exec_dir, | |
2031 | install : opt, | |
2032 | build_by_default : opt) | |
2033 | if opt and not is_disabler(exe) | |
2034 | exes += exe | |
53b37016 | 2035 | manadocs += ['sys-utils/nsenter.1.adoc'] |
38bb89ee | 2036 | bashcompletions += ['nsenter'] |
d4c880d5 ZJS |
2037 | endif |
2038 | ||
69939195 ZJS |
2039 | opt = opt and 'nsenter' in static_programs |
2040 | exe = executable( | |
2041 | 'nsenter.static', | |
2042 | nsenter_sources, | |
2043 | include_directories : includes, | |
2044 | link_with : [lib_common], | |
2045 | dependencies : [lib_selinux], | |
2046 | install_dir : usrbin_exec_dir, | |
2047 | install : opt, | |
2048 | build_by_default : opt) | |
2049 | if opt and not is_disabler(exe) | |
2050 | exes += exe | |
2051 | endif | |
2052 | ||
cd23a433 | 2053 | opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found() |
d4c880d5 ZJS |
2054 | exe = executable( |
2055 | 'setpriv', | |
2056 | setpriv_sources, | |
2057 | include_directories : includes, | |
2058 | link_with : [lib_common], | |
2059 | dependencies : [lib_cap_ng], | |
2060 | install_dir : usrbin_exec_dir, | |
2061 | install : opt, | |
2062 | build_by_default : opt) | |
2063 | if opt and not is_disabler(exe) | |
2064 | exes += exe | |
53b37016 | 2065 | manadocs += ['sys-utils/setpriv.1.adoc'] |
38bb89ee | 2066 | bashcompletions += ['setpriv'] |
d4c880d5 ZJS |
2067 | endif |
2068 | ||
2069 | exe = executable( | |
2070 | 'flock', | |
2071 | flock_sources, | |
2072 | include_directories : includes, | |
2073 | link_with : [lib_common], | |
2074 | dependencies : realtime_libs, | |
2075 | install_dir : usrbin_exec_dir, | |
2076 | install : true) | |
2077 | exes += exe | |
53b37016 | 2078 | manadocs += ['sys-utils/flock.1.adoc'] |
38bb89ee | 2079 | bashcompletions += ['flock'] |
d4c880d5 | 2080 | |
645577c7 KZ |
2081 | opt = not get_option('build-lsirq').disabled() |
2082 | exe = executable( | |
2083 | 'lsirq', | |
2084 | lsirq_sources, | |
2085 | include_directories : includes, | |
2086 | link_with : [lib_common, | |
2087 | lib_smartcols], | |
2088 | install_dir : usrbin_exec_dir, | |
2089 | install : opt, | |
2090 | build_by_default : opt) | |
2091 | if opt and not is_disabler(exe) | |
2092 | exes += exe | |
53b37016 | 2093 | manadocs += ['sys-utils/lsirq.1.adoc'] |
38bb89ee | 2094 | bashcompletions += ['lsirq'] |
645577c7 KZ |
2095 | endif |
2096 | ||
2097 | opt = not get_option('build-irqtop').disabled() | |
2098 | exe = executable( | |
2099 | 'irqtop', | |
2100 | irqtop_sources, | |
2101 | include_directories : includes, | |
2102 | dependencies : [realtime_libs, curses_libs], | |
2103 | link_with : [lib_common, | |
2104 | lib_smartcols, | |
2105 | lib_tcolors], | |
2106 | install_dir : usrbin_exec_dir, | |
2107 | install : opt, | |
2108 | build_by_default : opt) | |
2109 | if opt and not is_disabler(exe) | |
2110 | exes += exe | |
53b37016 | 2111 | manadocs += ['sys-utils/irqtop.1.adoc'] |
38bb89ee | 2112 | bashcompletions += ['irqtop'] |
645577c7 KZ |
2113 | endif |
2114 | ||
d4c880d5 ZJS |
2115 | opt = not get_option('build-ipcs').disabled() |
2116 | exe = executable( | |
2117 | 'lsipc', | |
2118 | lsipc_sources, | |
2119 | include_directories : includes, | |
2120 | link_with : [lib_common, | |
2121 | lib_smartcols], | |
2122 | install_dir : usrbin_exec_dir, | |
2123 | install : opt, | |
2124 | build_by_default : opt) | |
2125 | if opt and not is_disabler(exe) | |
2126 | exes += exe | |
53b37016 | 2127 | manadocs += ['sys-utils/lsipc.1.adoc'] |
38bb89ee | 2128 | bashcompletions += ['lsipc'] |
d4c880d5 ZJS |
2129 | endif |
2130 | ||
2131 | opt = build_hwclock | |
2132 | exe = executable( | |
2133 | 'hwclock', | |
2134 | hwclock_sources, | |
2135 | include_directories : includes, | |
2136 | link_with : [lib_common], | |
2137 | dependencies : [lib_m, | |
2138 | lib_audit], | |
2139 | install_dir : sbindir, | |
2140 | install : opt, | |
2141 | build_by_default : opt) | |
2142 | if opt and not is_disabler(exe) | |
2143 | exes += exe | |
38bb89ee TW |
2144 | manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc'] |
2145 | bashcompletions += ['hwclock'] | |
d4c880d5 ZJS |
2146 | endif |
2147 | ||
2148 | exe = executable( | |
2149 | 'mkfs', | |
2150 | mkfs_sources, | |
2151 | include_directories : includes, | |
2152 | install_dir : sbindir, | |
2153 | install : true) | |
2154 | exes += exe | |
53b37016 | 2155 | manadocs += ['disk-utils/mkfs.8.adoc'] |
38bb89ee | 2156 | bashcompletions += ['mkfs'] |
d4c880d5 ZJS |
2157 | |
2158 | opt = not get_option('build-bfs').disabled() | |
2159 | exe = executable( | |
2160 | 'mkfs.bfs', | |
2161 | mkfs_bfs_sources, | |
2162 | include_directories : includes, | |
2163 | link_with : [lib_common], | |
2164 | install_dir : sbindir, | |
2165 | install : opt, | |
2166 | build_by_default : opt) | |
2167 | if opt and not is_disabler(exe) | |
2168 | exes += exe | |
53b37016 | 2169 | manadocs += ['disk-utils/mkfs.bfs.8.adoc'] |
38bb89ee | 2170 | bashcompletions += ['mkfs.bfs'] |
d4c880d5 ZJS |
2171 | endif |
2172 | ||
2173 | exe = executable( | |
2174 | 'isosize', | |
2175 | isosize_sources, | |
2176 | include_directories : includes, | |
2177 | link_with : [lib_common], | |
2178 | install_dir : usrbin_exec_dir, | |
2179 | install : true) | |
2180 | exes += exe | |
53b37016 | 2181 | manadocs += ['disk-utils/isosize.8.adoc'] |
38bb89ee | 2182 | bashcompletions += ['isosize'] |
d4c880d5 ZJS |
2183 | |
2184 | exe = executable( | |
2185 | 'mkswap', | |
2186 | mkswap_sources, | |
2187 | include_directories : includes, | |
2188 | link_with : [lib_common, | |
d4c880d5 | 2189 | lib_uuid], |
a764efb5 | 2190 | dependencies: [blkid_dep, lib_selinux], |
d4c880d5 ZJS |
2191 | install_dir : sbindir, |
2192 | install : true) | |
765961c3 | 2193 | if not is_disabler(exe) |
d4c880d5 | 2194 | exes += exe |
53b37016 | 2195 | manadocs += ['disk-utils/mkswap.8.adoc'] |
38bb89ee | 2196 | bashcompletions += ['mkswap'] |
d4c880d5 ZJS |
2197 | endif |
2198 | ||
2199 | exe = executable( | |
2200 | 'swaplabel', | |
2201 | swaplabel_sources, | |
2202 | include_directories : includes, | |
2203 | link_with : [lib_common, | |
d4c880d5 | 2204 | lib_uuid], |
a764efb5 | 2205 | dependencies : [blkid_dep], |
d4c880d5 ZJS |
2206 | install_dir : sbindir, |
2207 | install : true) | |
765961c3 | 2208 | if not is_disabler(exe) |
d4c880d5 | 2209 | exes += exe |
53b37016 | 2210 | manadocs += ['disk-utils/swaplabel.8.adoc'] |
38bb89ee | 2211 | bashcompletions += ['swaplabel'] |
d4c880d5 ZJS |
2212 | endif |
2213 | ||
2214 | opt = not get_option('build-fsck').disabled() | |
2215 | exe = executable( | |
2216 | 'fsck', | |
2217 | fsck_sources, | |
2218 | include_directories : includes, | |
a764efb5 JW |
2219 | link_with : [lib_common], |
2220 | dependencies : [blkid_dep, mount_dep, realtime_libs], | |
d4c880d5 ZJS |
2221 | install_dir : sbindir, |
2222 | install : opt, | |
2223 | build_by_default : opt) | |
2224 | if opt and not is_disabler(exe) | |
2225 | exes += exe | |
53b37016 | 2226 | manadocs += ['disk-utils/fsck.8.adoc'] |
38bb89ee | 2227 | bashcompletions += ['fsck'] |
d4c880d5 ZJS |
2228 | endif |
2229 | ||
2230 | opt = not get_option('build-minix').disabled() | |
2231 | exe = executable( | |
2232 | 'mkfs.minix', | |
2233 | mkfs_minix_sources, | |
2234 | include_directories : includes, | |
2235 | link_with : [lib_common], | |
2236 | install_dir : sbindir, | |
2237 | install : opt, | |
2238 | build_by_default : opt) | |
2239 | exe2 = executable( | |
2240 | 'test_mkfs_minix', | |
2241 | mkfs_minix_sources, | |
2242 | include_directories : includes, | |
2243 | c_args : '-DTEST_SCRIPT', | |
2244 | link_with : [lib_common], | |
ba30b89c | 2245 | build_by_default : opt and program_tests) |
d4c880d5 ZJS |
2246 | exe3 = executable( |
2247 | 'fsck.minix', | |
2248 | fsck_minix_sources, | |
2249 | include_directories : includes, | |
2250 | link_with : [lib_common], | |
2251 | install_dir : sbindir, | |
2252 | install : opt, | |
2253 | build_by_default : opt) | |
2254 | if opt and not is_disabler(exe) | |
2255 | exes += [exe, exe2, exe3] | |
53b37016 | 2256 | manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc'] |
38bb89ee | 2257 | bashcompletions += ['mkfs.minix', 'fsck.minix'] |
d4c880d5 ZJS |
2258 | endif |
2259 | ||
2260 | opt = not get_option('build-cramfs').disabled() | |
2261 | exe = executable( | |
2262 | 'mkfs.cramfs', | |
2263 | mkfs_cramfs_sources, | |
2264 | include_directories : includes, | |
2265 | link_with : [lib_common], | |
2266 | dependencies : [lib_z], | |
2267 | install_dir : sbindir, | |
2268 | install : opt, | |
2269 | build_by_default : opt) | |
2270 | exe2 = executable( | |
2271 | 'fsck.cramfs', | |
2272 | fsck_cramfs_sources, | |
2273 | include_directories : includes, | |
2274 | link_with : [lib_common], | |
2275 | dependencies : [lib_z], | |
2276 | install_dir : sbindir, | |
2277 | install : opt, | |
2278 | build_by_default : opt) | |
2279 | if not is_disabler(exe) | |
2280 | exes += [exe, exe2] | |
53b37016 | 2281 | manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc'] |
38bb89ee | 2282 | bashcompletions += ['mkfs.cramfs', 'fsck.cramfs'] |
d4c880d5 ZJS |
2283 | endif |
2284 | ||
2285 | opt = not get_option('build-raw').disabled() | |
dff176e2 | 2286 | if opt |
433e4b77 | 2287 | cc.has_header('linux/raw.h', required: opt) |
dff176e2 | 2288 | endif |
d4c880d5 ZJS |
2289 | exe = executable( |
2290 | 'raw', | |
2291 | raw_sources, | |
2292 | include_directories : includes, | |
2293 | install_dir : sbindir, | |
2294 | install : opt, | |
2295 | build_by_default : opt) | |
2296 | if opt and not is_disabler(exe) | |
2297 | exes += exe | |
53b37016 | 2298 | manadocs += ['disk-utils/raw.8.adoc'] |
38bb89ee | 2299 | bashcompletions += ['raw'] |
d4c880d5 ZJS |
2300 | endif |
2301 | ||
2302 | opt = not get_option('build-fdformat').disabled() | |
2303 | exe = executable( | |
2304 | 'fdformat', | |
2305 | fdformat_sources, | |
2306 | include_directories : includes, | |
2307 | link_with : [lib_common], | |
2308 | install_dir : usrsbin_exec_dir, | |
2309 | install : opt, | |
2310 | build_by_default : opt) | |
2311 | if opt and not is_disabler(exe) | |
2312 | exes += exe | |
53b37016 | 2313 | manadocs += ['disk-utils/fdformat.8.adoc'] |
669071f6 | 2314 | bashcompletions += ['fdformat'] |
d4c880d5 ZJS |
2315 | endif |
2316 | ||
3e6d539e | 2317 | opt = get_option('build-blockdev').require(LINUX).allowed() |
d4c880d5 ZJS |
2318 | exe = executable( |
2319 | 'blockdev', | |
2320 | blockdev_sources, | |
2321 | include_directories : includes, | |
2322 | link_with : [lib_common], | |
2323 | install_dir : sbindir, | |
3e6d539e JW |
2324 | install : opt, |
2325 | build_by_default : opt) | |
2326 | if opt and not is_disabler(exe) | |
2327 | exes += exe | |
2328 | manadocs += ['disk-utils/blockdev.8.adoc'] | |
2329 | bashcompletions += ['blockdev'] | |
2330 | endif | |
d4c880d5 ZJS |
2331 | |
2332 | opt = not get_option('build-fdisks').disabled() | |
2333 | if opt and not have_dirfd and not have_ddfd | |
2334 | error('neither dirfd nor ddfd are available') | |
2335 | endif | |
2336 | exe = executable( | |
2337 | 'fdisk', | |
2338 | fdisk_sources, | |
2339 | include_directories : includes, | |
2340 | link_with : [lib_common, | |
2341 | lib_fdisk, | |
2342 | lib_smartcols, | |
2343 | lib_tcolors], | |
2344 | dependencies : [lib_readline], | |
2345 | install_dir : sbindir, | |
2346 | install : opt, | |
2347 | build_by_default : opt) | |
2348 | if opt and not is_disabler(exe) | |
2349 | exes += exe | |
38bb89ee | 2350 | bashcompletions += ['fdisk'] |
d4c880d5 ZJS |
2351 | endif |
2352 | ||
69939195 ZJS |
2353 | opt2 = opt and 'fdisk' in static_programs |
2354 | exe = executable( | |
2355 | 'fdisk.static', | |
2356 | fdisk_sources, | |
2357 | link_args : ['--static'], | |
2358 | include_directories : includes, | |
2359 | link_with : [lib_common, | |
2360 | lib_tcolors, | |
2361 | lib_fdisk_static, | |
2362 | lib_smartcols.get_static_lib()], | |
2363 | dependencies : [lib_readline_static], | |
2364 | install_dir : sbindir, | |
2365 | install : opt2, | |
2366 | build_by_default : opt2) | |
2367 | if opt2 and not is_disabler(exe) | |
2368 | exes += exe | |
2369 | endif | |
d4c880d5 ZJS |
2370 | |
2371 | exe = executable( | |
2372 | 'sfdisk', | |
2373 | sfdisk_sources, | |
2374 | include_directories : includes, | |
2375 | link_with : [lib_common, | |
2376 | lib_fdisk, | |
2377 | lib_smartcols, | |
2378 | lib_tcolors], | |
2379 | dependencies : [lib_readline], | |
2380 | install_dir : sbindir, | |
2381 | install : opt, | |
2382 | build_by_default : opt) | |
2383 | if opt and not is_disabler(exe) | |
2384 | exes += exe | |
38bb89ee | 2385 | bashcompletions += ['sfdisk'] |
d4c880d5 ZJS |
2386 | endif |
2387 | ||
69939195 ZJS |
2388 | opt2 = opt and 'sfdisk' in static_programs |
2389 | exe = executable( | |
2390 | 'sfdisk.static', | |
2391 | sfdisk_sources, | |
2392 | include_directories : includes, | |
2393 | link_with : [lib_common, | |
2394 | lib_tcolors, | |
2395 | lib_fdisk_static, | |
2396 | lib_smartcols.get_static_lib()], | |
2397 | dependencies : [lib_readline_static], | |
2398 | install_dir : sbindir, | |
2399 | install : opt2, | |
2400 | build_by_default : opt2) | |
2401 | if opt2 and not is_disabler(exe) | |
2402 | exes += exe | |
2403 | endif | |
d4c880d5 ZJS |
2404 | |
2405 | exe = executable( | |
2406 | 'cfdisk', | |
2407 | cfdisk_sources, | |
2408 | include_directories : includes, | |
2409 | link_with : [lib_common, | |
2410 | lib_fdisk, | |
2411 | lib_smartcols, | |
c43b185a JW |
2412 | lib_tcolors], |
2413 | dependencies : [curses_libs, mount_dep], | |
d4c880d5 ZJS |
2414 | install_dir : sbindir, |
2415 | install : opt, | |
2416 | build_by_default : opt) | |
2417 | if opt and not is_disabler(exe) | |
2418 | exes += exe | |
53b37016 KZ |
2419 | manadocs += ['disk-utils/fdisk.8.adoc', |
2420 | 'disk-utils/sfdisk.8.adoc', | |
2421 | 'disk-utils/cfdisk.8.adoc'] | |
38bb89ee | 2422 | bashcompletions += ['cfdisk'] |
d4c880d5 ZJS |
2423 | endif |
2424 | ||
2425 | opt = not get_option('build-partx').disabled() | |
2426 | exe = executable( | |
2427 | 'addpart', | |
2428 | addpart_sources, | |
2429 | include_directories : includes, | |
2430 | link_with : [lib_common], | |
2431 | install_dir : usrsbin_exec_dir, | |
2432 | install : opt, | |
2433 | build_by_default : opt) | |
2434 | exe2 = executable( | |
2435 | 'delpart', | |
2436 | delpart_sources, | |
2437 | include_directories : includes, | |
2438 | link_with : [lib_common], | |
2439 | install_dir : usrsbin_exec_dir, | |
2440 | install : opt, | |
2441 | build_by_default : opt) | |
2442 | exe3 = executable( | |
2443 | 'resizepart', | |
2444 | resizepart_sources, | |
2445 | include_directories : includes, | |
2446 | link_with : [lib_common], | |
2447 | install_dir : usrsbin_exec_dir, | |
2448 | install : opt, | |
2449 | build_by_default : opt) | |
2450 | exe4 = executable( | |
2451 | 'partx', | |
2452 | partx_sources, | |
2453 | include_directories : includes, | |
2454 | link_with : [lib_common, | |
d4c880d5 | 2455 | lib_smartcols], |
a764efb5 | 2456 | dependencies : [blkid_dep], |
d4c880d5 ZJS |
2457 | install_dir : usrsbin_exec_dir, |
2458 | install : opt, | |
2459 | build_by_default : opt) | |
2460 | if opt | |
2461 | exes += [exe, exe2, exe3, exe4] | |
53b37016 KZ |
2462 | manadocs += ['disk-utils/addpart.8.adoc', |
2463 | 'disk-utils/delpart.8.adoc', | |
2464 | 'disk-utils/resizepart.8.adoc', | |
2465 | 'disk-utils/partx.8.adoc'] | |
38bb89ee | 2466 | bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx'] |
d4c880d5 | 2467 | endif |
44bf6d80 B |
2468 | opt = opt and 'partx' in static_programs |
2469 | exe = executable( | |
2470 | 'addpart.static', | |
2471 | addpart_sources, | |
2472 | include_directories : includes, | |
2473 | link_args : ['--static'], | |
2474 | link_with : [lib_common], | |
2475 | install_dir : usrsbin_exec_dir, | |
2476 | install : opt, | |
2477 | build_by_default : opt) | |
2478 | exe2 = executable( | |
2479 | 'delpart.static', | |
2480 | delpart_sources, | |
2481 | include_directories : includes, | |
2482 | link_args : ['--static'], | |
2483 | link_with : [lib_common], | |
2484 | install_dir : usrsbin_exec_dir, | |
2485 | install : opt, | |
2486 | build_by_default : opt) | |
2487 | exe3 = executable( | |
2488 | 'resizepart.static', | |
2489 | resizepart_sources, | |
2490 | include_directories : includes, | |
2491 | link_args : ['--static'], | |
2492 | link_with : [lib_common], | |
2493 | install_dir : usrsbin_exec_dir, | |
2494 | install : opt, | |
2495 | build_by_default : opt) | |
2496 | exe4 = executable( | |
2497 | 'partx.static', | |
2498 | partx_sources, | |
2499 | include_directories : includes, | |
2500 | link_args : ['--static'], | |
2501 | link_with : [lib_common, | |
44bf6d80 | 2502 | lib_smartcols.get_static_lib()], |
a764efb5 | 2503 | dependencies : [blkid_static_dep], |
44bf6d80 B |
2504 | install_dir : usrsbin_exec_dir, |
2505 | install : opt, | |
2506 | build_by_default : opt) | |
2507 | ||
2508 | if opt | |
2509 | exes += [exe, exe2, exe3, exe4] | |
2510 | endif | |
d4c880d5 ZJS |
2511 | |
2512 | ############################################################ | |
2513 | ||
236918fc | 2514 | opt = get_option('build-script').require(have_pty).allowed() |
d4c880d5 ZJS |
2515 | exe = executable( |
2516 | 'script', | |
2517 | script_sources, | |
2518 | include_directories : includes, | |
2519 | link_with : [lib_common], | |
2520 | dependencies : [lib_util, | |
2521 | lib_utempter, | |
2522 | realtime_libs, | |
2523 | math_libs], | |
2524 | install_dir : usrbin_exec_dir, | |
236918fc JW |
2525 | install : opt, |
2526 | build_by_default : opt) | |
2527 | if opt and not is_disabler(exe) | |
2528 | exes += exe | |
2529 | manadocs += ['term-utils/script.1.adoc'] | |
2530 | bashcompletions += ['script'] | |
2531 | endif | |
d4c880d5 ZJS |
2532 | |
2533 | exe = executable( | |
2534 | 'test_script', | |
2535 | script_sources, | |
2536 | include_directories : includes, | |
2537 | c_args : '-DTEST_SCRIPT', | |
2538 | link_with : [lib_common], | |
2539 | dependencies : [lib_util, | |
2540 | lib_utempter, | |
2541 | realtime_libs, | |
ba30b89c | 2542 | math_libs], |
236918fc JW |
2543 | build_by_default : opt and program_tests) |
2544 | if opt and not is_disabler(exe) | |
2545 | exes += exe | |
2546 | endif | |
d4c880d5 | 2547 | |
8f6efe8c | 2548 | opt = get_option('build-scriptlive').require(have_pty).allowed() |
d4c880d5 ZJS |
2549 | exe = executable( |
2550 | 'scriptlive', | |
2551 | scriptlive_sources, | |
2552 | include_directories : includes, | |
2553 | link_with : [lib_common], | |
2554 | dependencies : [lib_util, | |
2555 | realtime_libs, | |
2556 | math_libs], | |
2557 | install_dir : usrbin_exec_dir, | |
8f6efe8c JW |
2558 | install : opt, |
2559 | build_by_default : opt) | |
2560 | if opt and not is_disabler(exe) | |
2561 | exes += exe | |
2562 | manadocs += ['term-utils/scriptlive.1.adoc'] | |
2563 | bashcompletions += ['scriptlive'] | |
2564 | endif | |
d4c880d5 ZJS |
2565 | |
2566 | exe = executable( | |
2567 | 'scriptreplay', | |
2568 | scriptreplay_sources, | |
2569 | include_directories : includes, | |
2570 | link_with : [lib_common], | |
2571 | dependencies : [math_libs], | |
2572 | install_dir : usrbin_exec_dir, | |
2573 | install : true) | |
2574 | exes += exe | |
53b37016 | 2575 | manadocs += ['term-utils/scriptreplay.1.adoc'] |
38bb89ee | 2576 | bashcompletions += ['scriptreplay'] |
d4c880d5 ZJS |
2577 | |
2578 | opt = not get_option('build-agetty').disabled() | |
2579 | exe = executable( | |
2580 | 'agetty', | |
2581 | agetty_sources, | |
2582 | include_directories : includes, | |
0333c40b | 2583 | link_with : [lib_common, logindefs_c], |
87fcd95a | 2584 | dependencies : [BSD ? lib_util : [], lib_systemd], |
d4c880d5 ZJS |
2585 | install_dir : sbindir, |
2586 | install : opt, | |
2587 | build_by_default : opt) | |
2588 | if opt | |
2589 | exes += exe | |
53b37016 | 2590 | manadocs += ['term-utils/agetty.8.adoc'] |
d4c880d5 ZJS |
2591 | endif |
2592 | ||
2593 | opt = not get_option('build-setterm').disabled() | |
2594 | exe = executable( | |
2595 | 'setterm', | |
2596 | setterm_sources, | |
2597 | include_directories : includes, | |
2598 | link_with : [lib_common], | |
2599 | dependencies : [curses_libs], | |
2600 | install_dir : usrbin_exec_dir, | |
2601 | install : opt, | |
2602 | build_by_default : opt) | |
2603 | if opt | |
2604 | exes += exe | |
53b37016 | 2605 | manadocs += ['term-utils/setterm.1.adoc'] |
38bb89ee | 2606 | bashcompletions += ['setterm'] |
d4c880d5 ZJS |
2607 | endif |
2608 | ||
2609 | opt = not get_option('build-mesg').disabled() | |
2610 | exe = executable( | |
2611 | 'mesg', | |
2612 | mesg_sources, | |
2613 | include_directories : includes, | |
2614 | link_with : [lib_common], | |
2615 | install_dir : usrbin_exec_dir, | |
2616 | install : opt, | |
2617 | build_by_default : opt) | |
2618 | if opt | |
2619 | exes += exe | |
53b37016 | 2620 | manadocs += ['term-utils/mesg.1.adoc'] |
38bb89ee | 2621 | bashcompletions += ['mesg'] |
d4c880d5 ZJS |
2622 | endif |
2623 | ||
2624 | opt = not get_option('build-wall').disabled() | |
2625 | exe = executable( | |
2626 | 'wall', | |
2627 | wall_sources, | |
2628 | include_directories : includes, | |
2629 | link_with : [lib_common], | |
87fcd95a | 2630 | dependencies : [lib_systemd], |
d4c880d5 | 2631 | install_dir : usrbin_exec_dir, |
5f3359c5 | 2632 | install_mode : [ 'rwxr-sr-x', 'root', 'tty' ], |
d4c880d5 ZJS |
2633 | install : opt, |
2634 | build_by_default : opt) | |
2635 | if opt | |
2636 | exes += exe | |
53b37016 | 2637 | manadocs += ['term-utils/wall.1.adoc'] |
38bb89ee | 2638 | bashcompletions += ['wall'] |
d4c880d5 ZJS |
2639 | endif |
2640 | ||
2641 | # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall | |
2642 | # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall | |
2643 | ||
2644 | opt = not get_option('build-write').disabled() | |
2645 | exe = executable( | |
2646 | 'write', | |
2647 | write_sources, | |
2648 | include_directories : includes, | |
2649 | link_with : [lib_common], | |
87fcd95a | 2650 | dependencies : [lib_systemd], |
d4c880d5 | 2651 | install_dir : usrbin_exec_dir, |
00f115d8 | 2652 | install_mode : [ 'rwxr-sr-x', 'root', 'tty' ], |
d4c880d5 ZJS |
2653 | install : opt, |
2654 | build_by_default : opt) | |
2655 | if opt | |
2656 | exes += exe | |
53b37016 | 2657 | manadocs += ['term-utils/write.1.adoc'] |
e1cd4002 | 2658 | bashcompletions += ['write'] |
d4c880d5 ZJS |
2659 | endif |
2660 | ||
2661 | # chgrp tty $(DESTDIR)$(usrbin_execdir)/write | |
2662 | # chmod g+s $(DESTDIR)$(usrbin_execdir)/write | |
2663 | ||
2664 | opt = not get_option('build-login').disabled() | |
2665 | exe = executable( | |
2666 | 'login', | |
2667 | login_sources, | |
2668 | include_directories : includes, | |
0333c40b | 2669 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
2670 | dependencies : [lib_pam, |
2671 | lib_audit, | |
2672 | lib_selinux], | |
2673 | install : opt, | |
2674 | build_by_default : opt) | |
2675 | if not is_disabler(exe) | |
2676 | exes += exe | |
53b37016 | 2677 | manadocs += ['login-utils/login.1.adoc'] |
d4c880d5 ZJS |
2678 | endif |
2679 | ||
2680 | opt = not get_option('build-sulogin').disabled() | |
2681 | exe = executable( | |
2682 | 'sulogin', | |
2683 | sulogin_sources, | |
2684 | include_directories : includes, | |
2685 | link_with : [lib_common], | |
2686 | dependencies : [lib_crypt, | |
2687 | lib_selinux], | |
2688 | install_dir : sbindir, | |
2689 | install : opt, | |
2690 | build_by_default : opt) | |
2691 | if not is_disabler(exe) | |
2692 | exes += exe | |
53b37016 | 2693 | manadocs += ['login-utils/sulogin.8.adoc'] |
d4c880d5 ZJS |
2694 | endif |
2695 | ||
2696 | exe = executable( | |
2697 | 'cal', | |
2698 | cal_sources, | |
2699 | include_directories : includes, | |
2700 | link_with : [lib_common, | |
2701 | lib_tcolors], | |
2702 | dependencies : [curses_libs], | |
2703 | install_dir : usrbin_exec_dir, | |
2704 | install : true) | |
2705 | exes += exe | |
53b37016 | 2706 | manadocs += ['misc-utils/cal.1.adoc'] |
38bb89ee | 2707 | bashcompletions += ['cal'] |
d4c880d5 ZJS |
2708 | |
2709 | opt = not get_option('build-logger').disabled() | |
2710 | exe = executable( | |
2711 | 'logger', | |
2712 | logger_sources, | |
2713 | include_directories : includes, | |
dbb9999f | 2714 | link_with : [lib_common], |
d4c880d5 ZJS |
2715 | dependencies : [lib_systemd], |
2716 | install_dir : usrbin_exec_dir, | |
2717 | install : opt, | |
2718 | build_by_default : opt) | |
2719 | if opt and not is_disabler(exe) | |
2720 | exes += exe | |
53b37016 | 2721 | manadocs += ['misc-utils/logger.1.adoc'] |
38bb89ee | 2722 | bashcompletions += ['logger'] |
d4c880d5 ZJS |
2723 | endif |
2724 | ||
2725 | exe = executable( | |
2726 | 'test_logger', | |
2727 | logger_sources, | |
2728 | include_directories : includes, | |
2729 | c_args : '-DTEST_LOGGER', | |
dbb9999f | 2730 | link_with : [lib_common], |
ba30b89c | 2731 | dependencies : [lib_systemd], |
2732 | build_by_default: program_tests) | |
d4c880d5 ZJS |
2733 | if not is_disabler(exe) |
2734 | exes += exe | |
2735 | endif | |
2736 | ||
2737 | exe = executable( | |
2738 | 'look', | |
2739 | look_sources, | |
2740 | include_directories : includes, | |
2741 | install_dir : usrbin_exec_dir, | |
2742 | install : true) | |
2743 | exes += exe | |
53b37016 | 2744 | manadocs += ['misc-utils/look.1.adoc'] |
38bb89ee | 2745 | bashcompletions += ['look'] |
d4c880d5 ZJS |
2746 | |
2747 | exe = executable( | |
2748 | 'mcookie', | |
2749 | mcookie_sources, | |
2750 | include_directories : includes, | |
2751 | link_with : [lib_common], | |
2752 | install_dir : usrbin_exec_dir, | |
2753 | install : true) | |
2754 | exes += exe | |
53b37016 | 2755 | manadocs += ['misc-utils/mcookie.1.adoc'] |
38bb89ee | 2756 | bashcompletions += ['mcookie'] |
d4c880d5 | 2757 | |
c2e299d0 SS |
2758 | if build_liblastlog2 |
2759 | exe = executable( | |
2760 | 'lastlog2', | |
2761 | lastlog2_sources, | |
2762 | include_directories : includes, | |
2763 | link_with : [lib_common, lib_lastlog2], | |
2764 | install_dir : usrbin_exec_dir, | |
2765 | install : true) | |
2766 | exes += exe | |
2767 | manadocs += ['misc-utils/lastlog2.8.adoc'] | |
2768 | bashcompletions += ['lastlog2'] | |
2769 | manadocs += ['liblastlog2/man/lastlog2.3.adoc', | |
2770 | 'liblastlog2/man/ll2_write_entry.3.adoc', | |
2771 | 'liblastlog2/man/ll2_read_entry.3.adoc', | |
2772 | 'liblastlog2/man/ll2_import_lastlog.3.adoc', | |
2773 | 'liblastlog2/man/ll2_read_all.3.adoc', | |
2774 | 'liblastlog2/man/ll2_remove_entry.3.adoc', | |
2775 | 'liblastlog2/man/ll2_rename_user.3.adoc', | |
2776 | 'liblastlog2/man/ll2_update_login_time.3.adoc' | |
2777 | ] | |
2778 | endif | |
2779 | ||
d4c880d5 ZJS |
2780 | exe = executable( |
2781 | 'namei', | |
2782 | namei_sources, | |
2783 | include_directories : includes, | |
c07f7b4e | 2784 | dependencies : [lib_selinux], |
d4c880d5 ZJS |
2785 | install_dir : usrbin_exec_dir, |
2786 | install : true) | |
2787 | exes += exe | |
53b37016 | 2788 | manadocs += ['misc-utils/namei.1.adoc'] |
38bb89ee | 2789 | bashcompletions += ['namei'] |
d4c880d5 ZJS |
2790 | |
2791 | exe = executable( | |
2792 | 'whereis', | |
2793 | whereis_sources, | |
2794 | include_directories : includes, | |
2795 | link_with : [lib_common], | |
2796 | install_dir : usrbin_exec_dir, | |
2797 | install : true) | |
2798 | exes += exe | |
53b37016 | 2799 | manadocs += ['misc-utils/whereis.1.adoc'] |
38bb89ee | 2800 | bashcompletions += ['whereis'] |
d4c880d5 | 2801 | |
b6799ccb | 2802 | opt = not get_option('build-lslocks').disabled() |
d4c880d5 ZJS |
2803 | exe = executable( |
2804 | 'lslocks', | |
2805 | lslocks_sources, | |
2806 | include_directories : includes, | |
2807 | link_with : [lib_common, | |
d4c880d5 | 2808 | lib_smartcols], |
c43b185a | 2809 | dependencies : [mount_dep], |
d4c880d5 | 2810 | install_dir : usrbin_exec_dir, |
b6799ccb JW |
2811 | install : opt, |
2812 | build_by_default : opt) | |
2813 | if opt and not is_disabler(exe) | |
d4c880d5 | 2814 | exes += exe |
53b37016 | 2815 | manadocs += ['misc-utils/lslocks.8.adoc'] |
38bb89ee | 2816 | bashcompletions += ['lslocks'] |
d4c880d5 ZJS |
2817 | endif |
2818 | ||
b6799ccb | 2819 | opt = not get_option('build-lsblk').disabled() |
d4c880d5 ZJS |
2820 | exe = executable( |
2821 | 'lsblk', | |
2822 | lsblk_sources, | |
2823 | include_directories : includes, | |
2824 | link_with : [lib_common, | |
c3317cdc | 2825 | lib_tcolors, |
d4c880d5 | 2826 | lib_smartcols], |
a764efb5 | 2827 | dependencies : [blkid_dep, lib_udev, mount_dep], |
b6799ccb JW |
2828 | install : opt, |
2829 | build_by_default : opt) | |
2830 | if opt and not is_disabler(exe) | |
d4c880d5 | 2831 | exes += exe |
53b37016 | 2832 | manadocs += ['misc-utils/lsblk.8.adoc'] |
38bb89ee | 2833 | bashcompletions += ['lsblk'] |
d4c880d5 ZJS |
2834 | endif |
2835 | ||
a125e2ee MY |
2836 | errnos_h = custom_target('errnos.h', |
2837 | input : 'tools/all_errnos', | |
2838 | output : 'errnos.h', | |
7e8bf34a | 2839 | command : ['tools/all_errnos', sed.full_path(), |
543f991f | 2840 | cc.cmd_array(), get_option('c_args')], |
a125e2ee MY |
2841 | ) |
2842 | ||
24395027 | 2843 | opt = not get_option('build-lsfd').require(lib_rt.found()).disabled() |
ee194909 KZ |
2844 | exe = executable( |
2845 | 'lsfd', | |
a125e2ee | 2846 | lsfd_sources, errnos_h, |
ee194909 KZ |
2847 | include_directories : includes, |
2848 | link_with : [lib_common, | |
2849 | lib_smartcols], | |
06b27058 | 2850 | dependencies : [lib_rt], |
ee194909 | 2851 | install_dir : usrbin_exec_dir, |
06b27058 JW |
2852 | install : opt, |
2853 | build_by_default : opt) | |
2854 | if opt and not is_disabler(exe) | |
ee194909 | 2855 | exes += exe |
ac8be186 | 2856 | manadocs += ['lsfd-cmd/lsfd.1.adoc'] |
ee194909 KZ |
2857 | endif |
2858 | ||
d4c880d5 ZJS |
2859 | exe = executable( |
2860 | 'uuidgen', | |
2861 | uuidgen_sources, | |
2862 | include_directories : includes, | |
06d3a851 KZ |
2863 | link_with : [lib_common, |
2864 | lib_uuid], | |
d4c880d5 ZJS |
2865 | install_dir : usrbin_exec_dir, |
2866 | install : true) | |
2867 | if not is_disabler(exe) | |
2868 | exes += exe | |
53b37016 | 2869 | manadocs += ['misc-utils/uuidgen.1.adoc'] |
38bb89ee | 2870 | bashcompletions += ['uuidgen'] |
d4c880d5 ZJS |
2871 | endif |
2872 | ||
2873 | exe = executable( | |
2874 | 'uuidparse', | |
2875 | uuidparse_sources, | |
2876 | include_directories : includes, | |
2877 | link_with : [lib_common, | |
2878 | lib_uuid, | |
2879 | lib_smartcols], | |
2880 | install_dir : usrbin_exec_dir, | |
2881 | install : true) | |
2882 | if not is_disabler(exe) | |
2883 | exes += exe | |
53b37016 | 2884 | manadocs += ['misc-utils/uuidparse.1.adoc'] |
38bb89ee | 2885 | bashcompletions += ['uuidparse'] |
d4c880d5 ZJS |
2886 | endif |
2887 | ||
2888 | opt = build_uuidd | |
2889 | exe = executable( | |
2890 | 'uuidd', | |
2891 | uuidd_sources, | |
2892 | include_directories : includes, | |
2893 | link_with : [lib_common, | |
2894 | lib_uuid], | |
2895 | dependencies : [realtime_libs, | |
2896 | lib_systemd], | |
2897 | install_dir : usrsbin_exec_dir, | |
2898 | install : opt, | |
2899 | build_by_default : opt) | |
2900 | exe2 = executable( | |
2901 | 'test_uuidd', | |
2902 | test_uuidd_sources, | |
2903 | include_directories : includes, | |
2904 | link_with : [lib_common, | |
2905 | lib_uuid], | |
2906 | dependencies : thread_libs, | |
ba30b89c | 2907 | build_by_default : opt and program_tests) |
d4c880d5 ZJS |
2908 | if not is_disabler(exe) |
2909 | exes += [exe, exe2] | |
53b37016 | 2910 | manadocs += ['misc-utils/uuidd.8.adoc'] |
38bb89ee | 2911 | bashcompletions += ['uuidd'] |
d4c880d5 ZJS |
2912 | endif |
2913 | ||
2914 | opt = build_libblkid | |
2915 | exe = executable( | |
2916 | 'blkid', | |
2917 | blkid_sources, | |
2918 | include_directories : includes, | |
a764efb5 JW |
2919 | link_with : [lib_common], |
2920 | dependencies : [blkid_dep], | |
d4c880d5 ZJS |
2921 | install_dir : sbindir, |
2922 | install : opt, | |
2923 | build_by_default : opt) | |
2924 | if opt and not is_disabler(exe) | |
2925 | exes += exe | |
53b37016 | 2926 | manadocs += ['misc-utils/blkid.8.adoc'] |
38bb89ee | 2927 | bashcompletions += ['blkid'] |
d4c880d5 ZJS |
2928 | endif |
2929 | ||
69939195 ZJS |
2930 | opt = opt and 'blkid' in static_programs |
2931 | exe = executable( | |
2932 | 'blkid.static', | |
2933 | blkid_sources, | |
2934 | include_directories : includes, | |
a764efb5 JW |
2935 | link_with : [lib_common], |
2936 | dependencies : [blkid_static_dep], | |
69939195 ZJS |
2937 | install_dir : sbindir, |
2938 | install : opt, | |
2939 | build_by_default : opt) | |
2940 | if opt and not is_disabler(exe) | |
2941 | exes += exe | |
2942 | endif | |
d4c880d5 ZJS |
2943 | |
2944 | exe = executable( | |
2945 | 'sample-mkfs', | |
2946 | 'libblkid/samples/mkfs.c', | |
2947 | include_directories : includes, | |
a764efb5 | 2948 | dependencies : [blkid_dep]) |
d4c880d5 ZJS |
2949 | if not is_disabler(exe) |
2950 | exes += exe | |
2951 | endif | |
2952 | ||
2953 | exe = executable( | |
2954 | 'sample-partitions', | |
2955 | 'libblkid/samples/partitions.c', | |
2956 | include_directories : includes, | |
a764efb5 | 2957 | dependencies : [blkid_dep]) |
d4c880d5 ZJS |
2958 | if not is_disabler(exe) |
2959 | exes += exe | |
2960 | endif | |
2961 | ||
2962 | exe = executable( | |
2963 | 'sample-superblocks', | |
2964 | 'libblkid/samples/superblocks.c', | |
2965 | include_directories : includes, | |
a764efb5 | 2966 | dependencies : [blkid_dep]) |
d4c880d5 ZJS |
2967 | if not is_disabler(exe) |
2968 | exes += exe | |
2969 | endif | |
2970 | ||
2971 | exe = executable( | |
2972 | 'sample-topology', | |
2973 | 'libblkid/samples/topology.c', | |
2974 | include_directories : includes, | |
a764efb5 | 2975 | dependencies : [blkid_dep]) |
d4c880d5 ZJS |
2976 | if not is_disabler(exe) |
2977 | exes += exe | |
2978 | endif | |
2979 | ||
97e673a0 TW |
2980 | exe = executable( |
2981 | 'test_blkid_fuzz_sample', | |
2982 | 'libblkid/src/fuzz.c', | |
2983 | include_directories: includes, | |
a764efb5 | 2984 | dependencies : [blkid_dep], |
ba30b89c | 2985 | build_by_default: program_tests) |
97e673a0 TW |
2986 | if not is_disabler(exe) |
2987 | exes += exe | |
2988 | endif | |
2989 | ||
d4c880d5 ZJS |
2990 | ############################################################ |
2991 | ||
2992 | exe = executable( | |
2993 | 'findfs', | |
2994 | findfs_sources, | |
2995 | include_directories : includes, | |
a764efb5 | 2996 | dependencies : [blkid_dep], |
d4c880d5 ZJS |
2997 | install_dir : sbindir, |
2998 | install : true) | |
2999 | if not is_disabler(exe) | |
3000 | exes += exe | |
53b37016 | 3001 | manadocs += ['misc-utils/findfs.8.adoc'] |
38bb89ee | 3002 | bashcompletions += ['findfs'] |
d4c880d5 ZJS |
3003 | endif |
3004 | ||
3005 | exe = executable( | |
3006 | 'wipefs', | |
3007 | wipefs_sources, | |
3008 | include_directories : includes, | |
3009 | link_with : [lib_common, | |
d4c880d5 | 3010 | lib_smartcols], |
a764efb5 | 3011 | dependencies : [blkid_dep], |
d4c880d5 ZJS |
3012 | install_dir : sbindir, |
3013 | install : true) | |
3014 | if not is_disabler(exe) | |
3015 | exes += exe | |
53b37016 | 3016 | manadocs += ['misc-utils/wipefs.8.adoc'] |
38bb89ee | 3017 | bashcompletions += ['wipefs'] |
d4c880d5 ZJS |
3018 | endif |
3019 | ||
b6799ccb | 3020 | opt = not get_option('build-findmnt').disabled() |
d4c880d5 ZJS |
3021 | exe = executable( |
3022 | 'findmnt', | |
3023 | findmnt_sources, | |
3024 | include_directories : includes, | |
3025 | link_with : [lib_common, | |
d4c880d5 | 3026 | lib_smartcols], |
a764efb5 | 3027 | dependencies : [blkid_dep, lib_udev, mount_dep], |
b6799ccb JW |
3028 | install : opt, |
3029 | build_by_default : opt) | |
3030 | if opt and not is_disabler(exe) | |
d4c880d5 | 3031 | exes += exe |
53b37016 | 3032 | manadocs += ['misc-utils/findmnt.8.adoc'] |
38bb89ee | 3033 | bashcompletions += ['findmnt'] |
d4c880d5 ZJS |
3034 | endif |
3035 | ||
3036 | exe = executable( | |
3037 | 'kill', | |
3038 | kill_sources, | |
3039 | include_directories : includes, | |
3040 | link_with : [lib_common], | |
3041 | install : true) | |
3042 | if not is_disabler(exe) | |
3043 | exes += exe | |
53b37016 | 3044 | manadocs += ['misc-utils/kill.1.adoc'] |
d4c880d5 ZJS |
3045 | endif |
3046 | ||
3047 | opt = not get_option('build-rename').disabled() | |
3048 | exe = executable( | |
3049 | 'rename', | |
3050 | rename_sources, | |
3051 | include_directories : includes, | |
3052 | install_dir : usrbin_exec_dir, | |
3053 | install : opt, | |
3054 | build_by_default : opt) | |
3055 | if opt and not is_disabler(exe) | |
3056 | exes += exe | |
53b37016 | 3057 | manadocs += ['misc-utils/rename.1.adoc'] |
38bb89ee | 3058 | bashcompletions += ['rename'] |
d4c880d5 ZJS |
3059 | endif |
3060 | ||
3061 | exe = executable( | |
3062 | 'getopt', | |
3063 | getopt_sources, | |
3064 | include_directories : includes, | |
308a0979 | 3065 | link_with : [lib_common], |
d4c880d5 ZJS |
3066 | install_dir : usrbin_exec_dir, |
3067 | install : true) | |
3068 | exes += exe | |
53b37016 | 3069 | manadocs += ['misc-utils/getopt.1.adoc'] |
38bb89ee | 3070 | bashcompletions += ['getopt'] |
d4c880d5 ZJS |
3071 | |
3072 | exe = executable( | |
3073 | 'fincore', | |
3074 | fincore_sources, | |
3075 | include_directories : includes, | |
3076 | link_with : [lib_common, | |
3077 | lib_smartcols], | |
3078 | install_dir : usrbin_exec_dir, | |
3079 | install : true) | |
3080 | if not is_disabler(exe) | |
3081 | exes += exe | |
53b37016 | 3082 | manadocs += ['misc-utils/fincore.1.adoc'] |
38bb89ee | 3083 | bashcompletions += ['fincore'] |
d4c880d5 ZJS |
3084 | endif |
3085 | ||
3086 | exe = executable( | |
3087 | 'hardlink', | |
3088 | hardlink_sources, | |
3089 | include_directories : includes, | |
3090 | link_with : [lib_common], | |
d4c880d5 ZJS |
3091 | install_dir : usrbin_exec_dir, |
3092 | install : true) | |
3093 | if not is_disabler(exe) | |
3094 | exes += exe | |
53b37016 | 3095 | manadocs += ['misc-utils/hardlink.1.adoc'] |
38bb89ee | 3096 | bashcompletions += ['hardlink'] |
d4c880d5 ZJS |
3097 | endif |
3098 | ||
5cf8a7ac | 3099 | opt = get_option('build-pipesz').allowed() |
c221578e NS |
3100 | exe = executable( |
3101 | 'pipesz', | |
3102 | pipesz_sources, | |
3103 | include_directories : includes, | |
3104 | link_with : [lib_common], | |
3105 | install_dir : usrbin_exec_dir, | |
5cf8a7ac JW |
3106 | install : opt, |
3107 | build_by_default : opt) | |
c221578e NS |
3108 | if opt and not is_disabler(exe) |
3109 | exes += exe | |
62c27bd0 | 3110 | manadocs += ['misc-utils/pipesz.1.adoc'] |
80af57ed | 3111 | bashcompletions += ['pipesz'] |
c221578e NS |
3112 | endif |
3113 | ||
d4c880d5 ZJS |
3114 | exe = executable( |
3115 | 'test_cal', | |
3116 | cal_sources, | |
3117 | include_directories : includes, | |
3118 | c_args : '-DTEST_CAL', | |
3119 | link_with : [lib_common, | |
3120 | lib_tcolors], | |
ba30b89c | 3121 | dependencies : [curses_libs], |
3122 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3123 | if not is_disabler(exe) |
3124 | exes += exe | |
3125 | endif | |
3126 | ||
3ba934c9 JW |
3127 | have_posix_fadvise = conf.get('HAVE_POSIX_FADVISE').to_string() == '1' |
3128 | ||
3129 | opt = get_option('build-fadvise').require(have_posix_fadvise).allowed() | |
64bc8ab5 MY |
3130 | exe = executable( |
3131 | 'fadvise', | |
3132 | fadvise_sources, | |
3133 | include_directories : includes, | |
3134 | link_with : [lib_common], | |
3135 | install_dir : usrbin_exec_dir, | |
3ba934c9 JW |
3136 | install : opt, |
3137 | build_by_default : opt) | |
3138 | if opt and not is_disabler(exe) | |
64bc8ab5 MY |
3139 | exes += exe |
3140 | manadocs += ['misc-utils/fadvise.1.adoc'] | |
3141 | bashcompletions += ['fadvise'] | |
3142 | endif | |
3143 | ||
941e1d55 | 3144 | if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1' |
334939a1 ZJS |
3145 | exe = executable( |
3146 | 'waitpid', | |
3147 | waitpid_sources, | |
3148 | include_directories : includes, | |
3149 | link_with : [lib_common], | |
3150 | install_dir : usrbin_exec_dir, | |
3151 | install : true) | |
3152 | if not is_disabler(exe) | |
3153 | exes += exe | |
3154 | manadocs += ['misc-utils/waitpid.1.adoc'] | |
3155 | bashcompletions += ['waitpid'] | |
3156 | endif | |
550d32c4 TW |
3157 | endif |
3158 | ||
69e542bd TW |
3159 | syscalls_h = custom_target('syscalls.h', |
3160 | input : 'tools/all_syscalls', | |
3161 | output : 'syscalls.h', | |
7e8bf34a | 3162 | command : ['tools/all_syscalls', sed.full_path(), |
543f991f | 3163 | cc.cmd_array(), get_option('c_args')], |
69e542bd TW |
3164 | ) |
3165 | ||
0f2dd62e JW |
3166 | have_linux_audit_h = cc.has_header('linux/audit.h') |
3167 | have_audit_arch_native = cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE') | |
3168 | ||
3169 | opt = get_option('build-enosys').require(have_linux_audit_h and have_audit_arch_native).allowed() | |
3170 | exe = executable( | |
3171 | 'enosys', | |
3172 | 'misc-utils/enosys.c', syscalls_h, errnos_h, | |
3173 | include_directories : includes, | |
3174 | link_with : [lib_common], | |
3175 | install_dir : usrbin_exec_dir, | |
3176 | install : opt, | |
3177 | build_by_default : opt) | |
3178 | if opt and not is_disabler(exe) | |
3179 | exes += exe | |
3180 | manadocs += ['misc-utils/enosys.1.adoc'] | |
3181 | bashcompletions += ['enosys'] | |
cba52cc1 TW |
3182 | endif |
3183 | ||
5873f36e | 3184 | opt = get_option('build-lsclocks').require(have_linux_rtc_h).allowed() |
e9ddea79 TW |
3185 | exe = executable( |
3186 | 'lsclocks', | |
3187 | lsclocks_sources, | |
3188 | include_directories : includes, | |
3189 | link_with : [lib_common, lib_smartcols], | |
3190 | install_dir : usrbin_exec_dir, | |
5873f36e JW |
3191 | install : opt, |
3192 | build_by_default : opt) | |
3193 | if opt and not is_disabler(exe) | |
e9ddea79 TW |
3194 | exes += exe |
3195 | manadocs += ['misc-utils/lsclocks.1.adoc'] | |
3196 | bashcompletions += ['lsclocks'] | |
3197 | endif | |
3198 | ||
cd094a05 MY |
3199 | if conf.get('HAVE_RENAMEAT2').to_string() == '1' |
3200 | exe = executable( | |
3201 | 'exch', | |
3202 | exch_sources, | |
3203 | include_directories : includes, | |
3204 | link_with : [lib_common], | |
3205 | install_dir : usrbin_exec_dir, | |
3206 | install : true) | |
3207 | if not is_disabler(exe) | |
3208 | exes += exe | |
3209 | manadocs += ['misc-utils/exch.1.adoc'] | |
3210 | bashcompletions += ['exch'] | |
3211 | endif | |
3212 | endif | |
3213 | ||
d4c880d5 ZJS |
3214 | ############################################################ |
3215 | ||
3216 | opt = not get_option('build-schedutils').disabled() | |
3217 | exe = executable( | |
3218 | 'chrt', | |
3219 | 'schedutils/chrt.c', | |
3220 | include_directories : includes, | |
3221 | link_with : lib_common, | |
3222 | install_dir : usrbin_exec_dir, | |
3223 | install : opt, | |
3224 | build_by_default : opt) | |
3225 | ||
3226 | exe2 = executable( | |
3227 | 'ionice', | |
3228 | 'schedutils/ionice.c', | |
3229 | include_directories : includes, | |
3230 | link_with : lib_common, | |
3231 | install_dir : usrbin_exec_dir, | |
3232 | install : opt, | |
3233 | build_by_default : opt) | |
3234 | ||
3235 | exe3 = executable( | |
3236 | 'taskset', | |
3237 | 'schedutils/taskset.c', | |
3238 | include_directories : includes, | |
3239 | link_with : lib_common, | |
3240 | install_dir : usrbin_exec_dir, | |
3241 | install : opt, | |
3242 | build_by_default : opt) | |
3243 | ||
6e92db54 KZ |
3244 | exe4 = executable( |
3245 | 'uclampset', | |
3246 | 'schedutils/uclampset.c', | |
3247 | include_directories : includes, | |
3248 | link_with : lib_common, | |
3249 | install_dir : usrbin_exec_dir, | |
3250 | install : opt, | |
3251 | build_by_default : opt) | |
3252 | ||
b46a82a0 TR |
3253 | exe5 = executable( |
3254 | 'coresched', | |
3255 | 'schedutils/coresched.c', | |
3256 | include_directories : includes, | |
3257 | link_with : lib_common, | |
3258 | install_dir : usrbin_exec_dir, | |
3259 | install : opt, | |
3260 | build_by_default : opt) | |
3261 | ||
d4c880d5 | 3262 | if opt and not is_disabler(exe) |
b46a82a0 | 3263 | exes += [exe, exe2, exe3, exe4, exe5] |
53b37016 KZ |
3264 | manadocs += ['schedutils/chrt.1.adoc', |
3265 | 'schedutils/ionice.1.adoc', | |
3266 | 'schedutils/taskset.1.adoc', | |
b46a82a0 TR |
3267 | 'schedutils/uclampset.1.adoc', |
3268 | 'schedutils/coresched.1.adoc'] | |
3269 | bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset', 'coresched'] | |
d4c880d5 ZJS |
3270 | endif |
3271 | ||
3272 | ############################################################ | |
3273 | ||
3274 | # TODO: when autotools compat is not needed, s/_/-/g in file names? | |
3275 | ||
3276 | exe = executable( | |
3277 | 'test_ttyutils', | |
3278 | 'lib/ttyutils.c', | |
3279 | c_args : ['-DTEST_PROGRAM_TTYUTILS'], | |
3280 | include_directories : dir_include, | |
ba30b89c | 3281 | link_with : lib_common, |
3282 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3283 | exes += exe |
3284 | ||
3285 | exe = executable( | |
3286 | 'test_blkdev', | |
3287 | 'lib/blkdev.c', | |
3288 | c_args : ['-DTEST_PROGRAM_BLKDEV'], | |
3289 | include_directories : dir_include, | |
ba30b89c | 3290 | link_with : lib_common, |
3291 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3292 | exes += exe |
3293 | ||
3294 | exe = executable( | |
3295 | 'test_ismounted', | |
3296 | 'lib/ismounted.c', | |
3297 | c_args : ['-DTEST_PROGRAM_ISMOUNTED'], | |
3298 | include_directories : dir_include, | |
ba30b89c | 3299 | link_with : lib_common, |
3300 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3301 | exes += exe |
3302 | ||
3303 | exe = executable( | |
3304 | 'test_mangle', | |
3305 | 'lib/mangle.c', | |
3306 | c_args : ['-DTEST_PROGRAM_MANGLE'], | |
ba30b89c | 3307 | include_directories : dir_include, |
3308 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3309 | exes += exe |
3310 | ||
3311 | exe = executable( | |
3312 | 'test_strutils', | |
3313 | 'lib/strutils.c', | |
3314 | c_args : ['-DTEST_PROGRAM_STRUTILS'], | |
ba30b89c | 3315 | include_directories : dir_include, |
3316 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3317 | exes += exe |
3318 | ||
3319 | exe = executable( | |
3320 | 'test_colors', | |
3321 | 'lib/colors.c', | |
3322 | 'lib/color-names.c', | |
3323 | c_args : ['-DTEST_PROGRAM_COLORS'], | |
3324 | include_directories : dir_include, | |
ba30b89c | 3325 | link_with : [lib_common, lib_tcolors], |
3326 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3327 | exes += exe |
3328 | ||
3329 | exe = executable( | |
3330 | 'test_randutils', | |
3331 | 'lib/randutils.c', | |
3332 | c_args : ['-DTEST_PROGRAM_RANDUTILS'], | |
ba30b89c | 3333 | include_directories : dir_include, |
3334 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3335 | exes += exe |
3336 | ||
941e1d55 TW |
3337 | if conf.get('HAVE_OPENAT').to_string() == '1' \ |
3338 | and conf.get('HAVE_DIRFD').to_string() == '1' | |
d6418774 ZJS |
3339 | exe = executable( |
3340 | 'test_procfs', | |
3341 | 'lib/procfs.c', | |
3342 | c_args : ['-DTEST_PROGRAM_PROCFS'], | |
3343 | include_directories : dir_include, | |
ba30b89c | 3344 | link_with : lib_common, |
3345 | build_by_default: program_tests) | |
d6418774 | 3346 | exes += exe |
d4c880d5 | 3347 | |
d6418774 ZJS |
3348 | exe = executable( |
3349 | 'test_path', | |
3350 | 'lib/path.c', | |
3351 | 'lib/fileutils.c', | |
3352 | have_cpu_set_t ? 'lib/cpuset.c' : [], | |
3353 | c_args : ['-DTEST_PROGRAM_PATH'], | |
3354 | include_directories : dir_include, | |
ba30b89c | 3355 | link_with : lib_common, |
3356 | build_by_default: program_tests) | |
d6418774 ZJS |
3357 | exes += exe |
3358 | endif | |
d4c880d5 | 3359 | |
f71723ef | 3360 | if have_pty |
44475360 ZJS |
3361 | exe = executable( |
3362 | 'test_pty', | |
3363 | pty_session_c, | |
3364 | monotonic_c, | |
3365 | c_args : ['-DTEST_PROGRAM_PTY'], | |
3366 | include_directories : dir_include, | |
3367 | link_with : [lib_common], | |
3368 | dependencies : [lib_m, | |
3369 | realtime_libs, | |
ba30b89c | 3370 | lib_util], |
3371 | build_by_default: program_tests) | |
44475360 ZJS |
3372 | exes += exe |
3373 | endif | |
d4c880d5 | 3374 | |
d6418774 ZJS |
3375 | if LINUX |
3376 | exe = executable( | |
3377 | 'test_cpuset', | |
3378 | 'lib/cpuset.c', | |
3379 | c_args : ['-DTEST_PROGRAM_CPUSET'], | |
ba30b89c | 3380 | include_directories : dir_include, |
3381 | build_by_default: program_tests) | |
d6418774 ZJS |
3382 | exes += exe |
3383 | endif | |
d4c880d5 ZJS |
3384 | |
3385 | exe = executable( | |
3386 | 'test_sysfs', | |
3387 | 'lib/sysfs.c', | |
3388 | 'lib/path.c', | |
35d26ae8 | 3389 | 'lib/buffer.c', |
fb8493fd | 3390 | 'lib/mbsalign.c', |
d4c880d5 ZJS |
3391 | 'lib/fileutils.c', |
3392 | have_cpu_set_t ? 'lib/cpuset.c' : [], | |
3393 | c_args : ['-DTEST_PROGRAM_SYSFS'], | |
ba30b89c | 3394 | include_directories : dir_include, |
3395 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3396 | exes += exe |
3397 | ||
3398 | exe = executable( | |
3399 | 'test_pager', | |
3400 | 'lib/pager.c', | |
3401 | c_args : ['-DTEST_PROGRAM_PAGER'], | |
ba30b89c | 3402 | include_directories : dir_include, |
3403 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3404 | exes += exe |
3405 | ||
3406 | exe = executable( | |
3407 | 'test_linux_version', | |
3408 | 'lib/linux_version.c', | |
3409 | c_args : ['-DTEST_PROGRAM_LINUXVERSION'], | |
ba30b89c | 3410 | include_directories : dir_include, |
3411 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3412 | exes += exe |
3413 | ||
3414 | exe = executable( | |
3415 | 'test_fileutils', | |
3416 | 'lib/fileutils.c', | |
3417 | c_args : ['-DTEST_PROGRAM_FILEUTILS'], | |
ba30b89c | 3418 | include_directories : dir_include, |
3419 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3420 | exes += exe |
3421 | ||
3422 | exe = executable( | |
3423 | 'test_canonicalize', | |
3424 | 'lib/canonicalize.c', | |
3425 | c_args : ['-DTEST_PROGRAM_CANONICALIZE'], | |
ba30b89c | 3426 | include_directories : dir_include, |
3427 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3428 | exes += exe |
3429 | ||
3430 | exe = executable( | |
3431 | 'test_timeutils', | |
3432 | 'lib/timeutils.c', | |
3433 | 'lib/strutils.c', | |
3434 | c_args : ['-DTEST_PROGRAM_TIMEUTILS'], | |
ba30b89c | 3435 | include_directories : dir_include, |
3436 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3437 | exes += exe |
3438 | ||
3439 | exe = executable( | |
3440 | 'test_pwdutils', | |
3441 | 'lib/pwdutils.c', | |
3442 | c_args : ['-DTEST_PROGRAM'], | |
3443 | include_directories : dir_include, | |
ba30b89c | 3444 | link_with : lib_common, |
3445 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3446 | exes += exe |
3447 | ||
866d922b KZ |
3448 | exe = executable( |
3449 | 'test_logindefs', | |
3450 | 'lib/logindefs.c', | |
3451 | c_args : ['-DTEST_PROGRAM'], | |
3452 | include_directories : dir_include, | |
ba30b89c | 3453 | link_with : [lib_common, logindefs_c], |
3454 | build_by_default: program_tests) | |
866d922b KZ |
3455 | exes += exe |
3456 | ||
3457 | ||
d4c880d5 ZJS |
3458 | ############################################################ |
3459 | ||
3460 | exe = executable( | |
3461 | 'test_uuid_parser', | |
3462 | 'libuuid/src/test_uuid.c', | |
3463 | include_directories : [dir_include, dir_libuuid], | |
3464 | link_with : lib_uuid, | |
ba30b89c | 3465 | dependencies : socket_libs, |
3466 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3467 | if not is_disabler(exe) |
3468 | exes += exe | |
3469 | endif | |
3470 | ||
3471 | ############################################################ | |
3472 | ||
2a472ae8 | 3473 | libfdisk_tests_cflags = ['-DTEST_PROGRAM'] |
a764efb5 JW |
3474 | libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid] |
3475 | libfdisk_tests_ldadd_deps = [blkid_dep] | |
d4c880d5 ZJS |
3476 | |
3477 | exe = executable( | |
3478 | 'test_fdisk_ask', | |
3479 | 'libfdisk/src/ask.c', | |
3480 | c_args : libfdisk_tests_cflags, | |
3481 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3482 | link_with : libfdisk_tests_ldadd, |
a764efb5 | 3483 | dependencies : libfdisk_tests_ldadd_deps, |
ba30b89c | 3484 | build_by_default: program_tests) |
d4c880d5 ZJS |
3485 | if not is_disabler(exe) |
3486 | exes += exe | |
3487 | endif | |
3488 | ||
3489 | exe = executable( | |
3490 | 'test_fdisk_gpt', | |
3491 | 'libfdisk/src/gpt.c', | |
3492 | c_args : libfdisk_tests_cflags, | |
3493 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3494 | link_with : libfdisk_tests_ldadd, |
a764efb5 | 3495 | dependencies : libfdisk_tests_ldadd_deps, |
ba30b89c | 3496 | build_by_default: program_tests) |
d4c880d5 ZJS |
3497 | if not is_disabler(exe) |
3498 | exes += exe | |
3499 | endif | |
3500 | ||
3501 | exe = executable( | |
3502 | 'test_fdisk_utils', | |
3503 | 'libfdisk/src/utils.c', | |
3504 | c_args : libfdisk_tests_cflags, | |
3505 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3506 | link_with : libfdisk_tests_ldadd, |
a764efb5 | 3507 | dependencies : libfdisk_tests_ldadd_deps, |
ba30b89c | 3508 | build_by_default: program_tests) |
d4c880d5 ZJS |
3509 | if not is_disabler(exe) |
3510 | exes += exe | |
3511 | endif | |
3512 | ||
3513 | exe = executable( | |
3514 | 'test_fdisk_script', | |
3515 | 'libfdisk/src/script.c', | |
3516 | c_args : libfdisk_tests_cflags, | |
3517 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3518 | link_with : libfdisk_tests_ldadd, |
a764efb5 | 3519 | dependencies : libfdisk_tests_ldadd_deps, |
ba30b89c | 3520 | build_by_default: program_tests) |
d4c880d5 ZJS |
3521 | if not is_disabler(exe) |
3522 | exes += exe | |
3523 | endif | |
3524 | ||
3525 | exe = executable( | |
3526 | 'test_fdisk_version', | |
3527 | 'libfdisk/src/version.c', | |
3528 | c_args : libfdisk_tests_cflags, | |
3529 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3530 | link_with : libfdisk_tests_ldadd, |
a764efb5 | 3531 | dependencies : libfdisk_tests_ldadd_deps, |
ba30b89c | 3532 | build_by_default: program_tests) |
d4c880d5 ZJS |
3533 | if not is_disabler(exe) |
3534 | exes += exe | |
3535 | endif | |
3536 | ||
3537 | exe = executable( | |
3538 | 'test_fdisk_item', | |
3539 | 'libfdisk/src/item.c', | |
3540 | c_args : libfdisk_tests_cflags, | |
3541 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3542 | link_with : libfdisk_tests_ldadd, |
a764efb5 | 3543 | dependencies : libfdisk_tests_ldadd_deps, |
ba30b89c | 3544 | build_by_default: program_tests) |
d4c880d5 ZJS |
3545 | if not is_disabler(exe) |
3546 | exes += exe | |
3547 | endif | |
3548 | ||
d4c880d5 ZJS |
3549 | sample_fdisk_ldadd = [lib_common, lib_fdisk] |
3550 | ||
3551 | exe = executable( | |
3552 | 'sample-fdisk-mkpart', | |
3553 | 'libfdisk/samples/mkpart.c', | |
d4c880d5 ZJS |
3554 | include_directories : lib_fdisk_includes, |
3555 | link_with : sample_fdisk_ldadd) | |
3556 | if not is_disabler(exe) | |
3557 | exes += exe | |
3558 | endif | |
3559 | ||
3560 | exe = executable( | |
3561 | 'sample-fdisk-mkpart-fullspec', | |
3562 | 'libfdisk/samples/mkpart-fullspec.c', | |
d4c880d5 ZJS |
3563 | include_directories : lib_fdisk_includes, |
3564 | link_with : sample_fdisk_ldadd) | |
3565 | if not is_disabler(exe) | |
3566 | exes += exe | |
3567 | endif | |
3568 | ||
3569 | ############################################################ | |
3570 | ||
a76299c1 TW |
3571 | exe = executable( |
3572 | 'test_cap', | |
3573 | 'tests/helpers/test_cap.c', | |
3574 | include_directories : includes, | |
3575 | dependencies : [lib_cap_ng], | |
3576 | build_by_default: program_tests) | |
512c91a6 TW |
3577 | if not is_disabler(exe) |
3578 | exes += exe | |
3579 | endif | |
a76299c1 | 3580 | |
d4c880d5 ZJS |
3581 | exe = executable( |
3582 | 'test_mbsencode', | |
3583 | 'tests/helpers/test_mbsencode.c', | |
3584 | include_directories : includes, | |
ba30b89c | 3585 | link_with : lib_common, |
3586 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3587 | exes += exe |
3588 | ||
3589 | exe = executable( | |
3590 | 'test_byteswap', | |
3591 | 'tests/helpers/test_byteswap.c', | |
ba30b89c | 3592 | include_directories : includes, |
3593 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3594 | exes += exe |
3595 | ||
3596 | exe = executable( | |
3597 | 'test_md5', | |
3598 | 'tests/helpers/test_md5.c', | |
3599 | md5_c, | |
ba30b89c | 3600 | include_directories : includes, |
3601 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3602 | exes += exe |
3603 | ||
3604 | exe = executable( | |
3605 | 'test_sha1', | |
3606 | 'tests/helpers/test_sha1.c', | |
3607 | sha1_c, | |
ba30b89c | 3608 | include_directories : includes, |
3609 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3610 | exes += exe |
3611 | ||
3612 | exe = executable( | |
3613 | 'test_pathnames', | |
3614 | 'tests/helpers/test_pathnames.c', | |
ba30b89c | 3615 | include_directories : includes, |
3616 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3617 | exes += exe |
3618 | ||
3619 | exe = executable( | |
3620 | 'test_strerror', | |
3621 | 'tests/helpers/test_strerror.c', | |
ba30b89c | 3622 | include_directories : includes, |
3623 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3624 | exes += exe |
3625 | ||
3626 | exe = executable( | |
3627 | 'test_sysinfo', | |
3628 | 'tests/helpers/test_sysinfo.c', | |
ba30b89c | 3629 | include_directories : includes, |
3630 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3631 | exes += exe |
3632 | ||
3633 | exe = executable( | |
3634 | 'test_sigreceive', | |
3635 | 'tests/helpers/test_sigreceive.c', | |
3636 | include_directories : includes, | |
ba30b89c | 3637 | link_with : lib_common, |
3638 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3639 | exes += exe |
3640 | ||
3641 | exe = executable( | |
3642 | 'test_tiocsti', | |
3643 | 'tests/helpers/test_tiocsti.c', | |
ba30b89c | 3644 | include_directories : includes, |
3645 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3646 | exes += exe |
3647 | ||
3648 | exe = executable( | |
3649 | 'test_uuid_namespace', | |
3650 | 'tests/helpers/test_uuid_namespace.c', | |
3651 | predefined_c, | |
3652 | unpack_c, | |
3653 | unparse_c, | |
ba30b89c | 3654 | include_directories : includes, |
3655 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3656 | exes += exe |
3657 | ||
06b27058 | 3658 | if LINUX and lib_rt.found() |
d6418774 ZJS |
3659 | exe = executable( |
3660 | 'test_mkfds', | |
3661 | 'tests/helpers/test_mkfds.c', | |
b2033a32 | 3662 | 'tests/helpers/test_mkfds.h', |
38ffd1e3 | 3663 | 'tests/helpers/test_mkfds_ppoll.c', |
d6418774 | 3664 | include_directories : includes, |
06b27058 | 3665 | dependencies : [lib_rt], |
ba30b89c | 3666 | build_by_default: program_tests) |
d6418774 ZJS |
3667 | exes += exe |
3668 | endif | |
f7b41ef8 | 3669 | |
42900563 TW |
3670 | exe = executable( |
3671 | 'test_enosys', | |
3672 | 'tests/helpers/test_enosys.c', | |
ba30b89c | 3673 | include_directories : includes, |
3674 | build_by_default: program_tests) | |
42900563 TW |
3675 | exes += exe |
3676 | ||
d4c880d5 ZJS |
3677 | ############################################################ |
3678 | ||
941e1d55 | 3679 | if conf.get('HAVE_OPENAT').to_string() == '1' |
d6418774 ZJS |
3680 | exe = executable( |
3681 | 'sample-scols-tree', | |
3682 | 'libsmartcols/samples/tree.c', | |
3683 | include_directories : includes, | |
ba30b89c | 3684 | link_with : [lib_smartcols, lib_common], |
3685 | build_by_default: program_tests) | |
d6418774 ZJS |
3686 | if not is_disabler(exe) |
3687 | exes += exe | |
3688 | endif | |
d4c880d5 ZJS |
3689 | endif |
3690 | ||
3691 | exe = executable( | |
3692 | 'sample-scols-title', | |
3693 | 'libsmartcols/samples/title.c', | |
3694 | include_directories : includes, | |
3695 | link_with : [lib_smartcols, lib_common]) | |
3696 | if not is_disabler(exe) | |
3697 | exes += exe | |
3698 | endif | |
3699 | ||
3700 | exe = executable( | |
3701 | 'sample-scols-wrap', | |
3702 | 'libsmartcols/samples/wrap.c', | |
3703 | include_directories : includes, | |
3704 | link_with : [lib_smartcols, lib_common]) | |
3705 | if not is_disabler(exe) | |
3706 | exes += exe | |
3707 | endif | |
3708 | ||
3709 | exe = executable( | |
3710 | 'sample-scols-continuous', | |
3711 | 'libsmartcols/samples/continuous.c', | |
3712 | include_directories : includes, | |
3713 | link_with : [lib_smartcols, lib_common]) | |
3714 | if not is_disabler(exe) | |
3715 | exes += exe | |
3716 | endif | |
3717 | ||
be597292 TW |
3718 | exe = executable( |
3719 | 'sample-scols-continuous-json', | |
3720 | 'libsmartcols/samples/continuous-json.c', | |
3721 | include_directories : includes, | |
3722 | link_with : [lib_smartcols, lib_common]) | |
3723 | if not is_disabler(exe) | |
3724 | exes += exe | |
3725 | endif | |
3726 | ||
d4c880d5 ZJS |
3727 | exe = executable( |
3728 | 'sample-scols-maxout', | |
3729 | 'libsmartcols/samples/maxout.c', | |
3730 | include_directories : includes, | |
3731 | link_with : [lib_smartcols, lib_common]) | |
3732 | if not is_disabler(exe) | |
3733 | exes += exe | |
3734 | endif | |
3735 | ||
3736 | exe = executable( | |
3737 | 'sample-scols-fromfile', | |
3738 | 'libsmartcols/samples/fromfile.c', | |
3739 | include_directories : includes, | |
3740 | link_with : [lib_smartcols, lib_common]) | |
3741 | if not is_disabler(exe) | |
3742 | exes += exe | |
3743 | endif | |
3744 | ||
3745 | exe = executable( | |
3746 | 'sample-scols-grouping-simple', | |
3747 | 'libsmartcols/samples/grouping-simple.c', | |
3748 | include_directories : includes, | |
3749 | link_with : [lib_smartcols, lib_common]) | |
3750 | if not is_disabler(exe) | |
3751 | exes += exe | |
3752 | endif | |
3753 | ||
3754 | exe = executable( | |
3755 | 'sample-scols-grouping-overlay', | |
3756 | 'libsmartcols/samples/grouping-overlay.c', | |
3757 | include_directories : includes, | |
3758 | link_with : [lib_smartcols, lib_common]) | |
3759 | if not is_disabler(exe) | |
3760 | exes += exe | |
3761 | endif | |
48afece8 TW |
3762 | |
3763 | exe = executable( | |
3764 | 'test_boilerplate', | |
3765 | 'Documentation/boilerplate.c', | |
3766 | include_directories : includes, | |
3767 | build_by_default: program_tests) | |
3768 | if not is_disabler(exe) | |
3769 | exes += exe | |
3770 | endif | |
d4c880d5 ZJS |
3771 | |
3772 | ############################################################ | |
3773 | ||
3774 | # Let the test runner know whether we're running under asan and export | |
3775 | # some paths. We use a file on disk so that it is possible to run the | |
3776 | # test scripts from commandline without setting any variables. | |
3777 | configure_file(output : 'meson.conf', | |
3778 | capture : true, | |
3779 | command : ['echo', | |
3780 | '''asan=@0@ | |
3781 | PYTHON=@1@ | |
3782 | '''.format(get_option('b_sanitize')=='address' ? 'yes' : '', | |
cb7ac65d | 3783 | python_program.full_path())]) |
d4c880d5 ZJS |
3784 | |
3785 | run_sh = find_program('tests/run.sh') | |
3786 | run_target( | |
3787 | 'check', | |
3788 | command : [run_sh, | |
3789 | '--srcdir=' + meson.current_source_dir(), | |
3790 | '--builddir=' + meson.current_build_dir(), | |
3791 | '--parallel', | |
3792 | '--nonroot'], | |
3793 | depends : exes) | |
53b37016 KZ |
3794 | |
3795 | ||
3796 | manadocs += ['lib/terminal-colors.d.5.adoc'] | |
3797 | manadocs += ['libblkid/libblkid.3.adoc'] | |
3798 | ||
3799 | if build_libuuid | |
3800 | manadocs += [ | |
3801 | 'libuuid/man/uuid.3.adoc', | |
3802 | 'libuuid/man/uuid_clear.3.adoc', | |
3803 | 'libuuid/man/uuid_compare.3.adoc', | |
3804 | 'libuuid/man/uuid_copy.3.adoc', | |
3805 | 'libuuid/man/uuid_generate.3.adoc', | |
3806 | 'libuuid/man/uuid_is_null.3.adoc', | |
3807 | 'libuuid/man/uuid_parse.3.adoc', | |
3808 | 'libuuid/man/uuid_time.3.adoc', | |
3809 | 'libuuid/man/uuid_unparse.3.adoc'] | |
38bb89ee TW |
3810 | manlinks += { |
3811 | 'uuid_generate_random.3': 'uuid_generate.3', | |
3812 | 'uuid_generate_time.3': 'uuid_generate.3', | |
3813 | 'uuid_generate_time_safe.3': 'uuid_generate.3', | |
3814 | } | |
53b37016 KZ |
3815 | endif |
3816 | ||
00b8a51f | 3817 | asciidoctor = find_program('asciidoctor', required : false) |
53b37016 KZ |
3818 | if asciidoctor.found() |
3819 | foreach adoc : manadocs | |
3820 | name = adoc.split('/')[-1] | |
3821 | page = name.split('.adoc')[0] | |
3822 | section = page.split('.')[-1] | |
3823 | mandirn = join_paths(mandir, 'man' + section) | |
3824 | input = adoc | |
3825 | ||
3826 | custom_target( | |
3827 | page, | |
3828 | command : [ asciidoctor, | |
3829 | '-b', 'manpage', | |
3830 | '-a', 'VERSION=' + meson.project_version(), | |
38bb89ee | 3831 | '-a', 'release-version=' + meson.project_version(), |
53b37016 | 3832 | '-a', 'ADJTIME_PATH=/etc/adjtime', |
38bb89ee | 3833 | '-a', 'package-docdir=' + docdir, |
53b37016 KZ |
3834 | '--base-dir=' + meson.current_source_dir(), |
3835 | '--destination-dir=' + meson.current_build_dir(), | |
adcab835 TW |
3836 | '--load-path', '@SOURCE_ROOT@/tools', |
3837 | '--require', 'asciidoctor-includetracker', | |
53b37016 KZ |
3838 | '@INPUT@'], |
3839 | input : input, | |
3840 | output : [page], | |
adcab835 | 3841 | depfile : page + '.deps', |
53b37016 KZ |
3842 | install: true, |
3843 | install_dir : mandirn) | |
3844 | endforeach | |
38bb89ee TW |
3845 | |
3846 | foreach link_name, target : manlinks | |
3847 | link_section = link_name.split('.')[-1] | |
3848 | target_section = target.split('.')[-1] | |
3849 | meson.add_install_script(meson_make_manpage_stub, | |
3850 | join_paths('man' + target_section, target), | |
3851 | join_paths(mandir, 'man' + link_section, link_name)) | |
3852 | endforeach | |
3853 | endif | |
3854 | ||
3855 | if bash_completion.found() | |
3856 | foreach completion : bashcompletions | |
3857 | install_data( | |
3858 | join_paths('bash-completion', completion), | |
caa85688 | 3859 | install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir') |
38bb89ee TW |
3860 | ) |
3861 | endforeach | |
aa519054 KZ |
3862 | foreach link_name, target : bashcompletionslinks |
3863 | meson.add_install_script(meson_make_symlink, | |
3864 | target, | |
caa85688 | 3865 | join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name)) |
aa519054 | 3866 | endforeach |
53b37016 | 3867 | endif |