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