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