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