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