]> git.ipfire.org Git - thirdparty/util-linux.git/blob - meson.build
meson: Only pick up the rt library once
[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.set('HAVE_ENVIRON_DECL', have ? 1 : false)
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 lib_rt = cc.find_library('rt', required : false)
732 realtime_libs = []
733 have = cc.has_function('clock_gettime')
734 if not have
735 if lib_rt.found()
736 realtime_libs += lib_rt
737 have = cc.has_function('clock_gettime',
738 dependencies : realtime_libs)
739 endif
740 endif
741 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
742
743 thread_libs = dependency('threads')
744
745 have = cc.has_function('timer_create')
746 if not have
747 if lib_rt.found()
748 realtime_libs = [lib_rt]
749 have = cc.has_function('timer_create',
750 dependencies : realtime_libs)
751 endif
752 if not have
753 realtime_libs += thread_libs
754 have = cc.has_function('timer_create',
755 dependencies : realtime_libs)
756 endif
757 endif
758 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
759 if not have
760 have = cc.has_function('setitimer')
761 conf.set('HAVE_SETITIMER', have ? 1 : false)
762 endif
763
764 rtas_libs = cc.find_library('rtas', required : false)
765 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
766
767 math_libs = []
768 if not cc.has_header_symbol('math.h', 'isnan')
769 lib = cc.find_library('m', required : true)
770 if (cc.has_function('isnan', dependencies : lib) and
771 cc.has_function('__isnan', dependencies : lib))
772 math_libs += lib
773 endif
774 endif
775
776 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
777 args : '-D_GNU_SOURCE')
778 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
779
780 code = '''
781 extern char *__progname;
782 int main(void) {
783 return (*__progname != 0);
784 }
785 '''
786 have = cc.compiles(code, name : 'using __progname')
787 conf.set('HAVE___PROGNAME', have ? 1 : false)
788
789 have = conf.get('HAVE_PTY_H').to_string() == '1' \
790 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
791 conf.set('HAVE_PTY', have ? 1 : false)
792
793 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
794 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
795
796 build_plymouth_support = get_option('build-plymouth-support')
797 have_tiocglcktrmios = cc.has_header_symbol(
798 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
799 required : build_plymouth_support.enabled())
800 have_sock_cloexec = cc.has_header_symbol(
801 'sys/socket.h', 'SOCK_CLOEXEC',
802 prefix : '#include <sys/types.h>',
803 required : build_plymouth_support.enabled())
804 have_sock_nonblock = cc.has_header_symbol(
805 'sys/socket.h', 'SOCK_NONBLOCK',
806 prefix : '#include <sys/types.h>',
807 required : build_plymouth_support.enabled())
808 have_so_passcred = cc.has_header_symbol(
809 'sys/socket.h', 'SO_PASSCRED',
810 args : ['-D_GNU_SOURCE'],
811 prefix : '#include <sys/types.h>',
812 required : build_plymouth_support.enabled())
813
814 build_plymouth_support = (not build_plymouth_support.disabled() and
815 have_tiocglcktrmios and
816 have_sock_cloexec and
817 have_sock_nonblock and
818 have_so_passcred)
819 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
820 summary('plymouth support',
821 build_plymouth_support ? 'enabled' : 'disabled',
822 section : 'components')
823
824 # check for valid fallocate() function
825 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
826 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
827 # and program can't be linked.
828 code = '''
829 #define _GNU_SOURCE
830 #include <unistd.h>
831 #include <fcntl.h>
832
833 int main(void) {
834 long ret;
835 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
836 return ret == 0 ? 0 : 1;
837 }
838 '''
839 have = cc.links(code, name : 'fallocate() function')
840 conf.set('HAVE_FALLOCATE', have ? 1 : false)
841
842 code = '''
843 #include <unistd.h>
844 #include <fcntl.h>
845
846 int main(void) {
847 long ret;
848 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
849 return ret == 0 ? 0 : 1;
850 }
851 '''
852 have = cc.links(code, name : 'posix_fallocate() function')
853 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
854
855 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
856 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
857 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
858
859 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
860 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
861 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
862
863 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
864
865 ############################################################
866
867
868 fs_search_path = get_option('fs-search-path')
869 fs_search_path_extra = get_option('fs-search-path-extra')
870 if fs_search_path_extra != ''
871 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
872 endif
873 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
874
875 systemdsystemunitdir = ''
876 if systemd.found()
877 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
878 endif
879
880 sysvinit = get_option('sysvinit').enabled()
881 sysvinitrcdir = sysconfdir + '/init.d'
882
883 program_tests = get_option('program-tests')
884
885 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
886 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
887
888 have = get_option('chsh-only-listed')
889 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
890
891 have = get_option('use-tty-group')
892 conf.set('USE_TTY_GROUP', have ? 1 : false)
893
894 bison = find_program('bison')
895 flex = find_program('flex')
896
897 build_hwclock = not get_option('build-hwclock').disabled()
898 bison_gen = generator(
899 bison,
900 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
901 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
902
903 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
904 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
905
906 configure_file(
907 output : 'config.h',
908 configuration : conf)
909
910 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
911
912 compiler_flags = [
913 '-fno-common',
914
915 '-Waddress-of-packed-member',
916 '-Wdiscarded-qualifiers',
917 '-Wembedded-directive',
918 '-Wextra-semi',
919 '-Wformat-security',
920 '-Wimplicit-function-declaration',
921 '-Wmissing-declarations',
922 '-Wmissing-parameter-type',
923 '-Wmissing-prototypes',
924 '-Wnested-externs',
925 '-Wno-missing-field-initializers',
926 '-Wold-style-definition',
927 '-Wpointer-arith',
928 '-Wredundant-decls',
929 '-Wsign-compare',
930 '-Wstrict-prototypes',
931 '-Wtype-limits',
932 '-Wuninitialized',
933 '-Wunused-but-set-parameter',
934 '-Wunused-but-set-variable',
935 '-Wunused-parameter',
936 '-Wunused-result',
937 '-Wunused-variable',
938 '-Wvla',
939 '-Walloca',
940 ]
941 foreach compiler_flag : compiler_flags
942 if cc.has_argument(compiler_flag)
943 add_project_arguments(compiler_flag, language : 'c')
944 endif
945 endforeach
946
947 manadocs = []
948 manlinks = {}
949
950 bashcompletions = []
951 bashcompletionslinks = {}
952
953 subdir('include')
954 subdir('lib')
955 subdir('libblkid')
956 subdir('libmount')
957 subdir('libsmartcols')
958 subdir('libuuid')
959 subdir('liblastlog2')
960 subdir('libfdisk')
961 subdir('pam_lastlog2')
962 subdir('login-utils')
963 subdir('sys-utils')
964 subdir('disk-utils')
965 subdir('misc-utils')
966 subdir('text-utils')
967 subdir('term-utils')
968 subdir('po')
969
970 includes = [dir_include,
971 dir_libblkid,
972 dir_libsmartcols,
973 dir_libmount,
974 dir_libfdisk,
975 dir_libuuid,
976 dir_liblastlog2,
977 dir_sys_utils]
978
979 exes = []
980
981 opt = not get_option('build-chfn-chsh').disabled()
982 exe = executable(
983 'chfn',
984 chfn_sources,
985 chfn_chsh_sources,
986 include_directories : includes,
987 link_with : [lib_common, logindefs_c],
988 dependencies : chfn_chsh_deps,
989 install_dir : usrbin_exec_dir,
990 install_mode : 'rwsr-xr-x',
991 install : opt,
992 build_by_default : opt)
993
994 exe2 = executable(
995 'chsh',
996 'login-utils/chsh.c',
997 'lib/shells.c',
998 chfn_chsh_sources,
999 include_directories : includes,
1000 link_with : lib_common,
1001 dependencies : chfn_chsh_deps,
1002 install_dir : usrbin_exec_dir,
1003 install_mode : 'rwsr-xr-x',
1004 install : opt,
1005 build_by_default : opt)
1006 if opt and not is_disabler(exe)
1007 exes += [exe, exe2]
1008 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1009 bashcompletions += ['chfn', 'chsh']
1010 endif
1011
1012 exe = executable(
1013 'test_islocal',
1014 test_islocal_sources,
1015 include_directories : includes,
1016 c_args : '-DTEST_PROGRAM',
1017 build_by_default : program_tests)
1018 exes += exe
1019
1020 exe = executable(
1021 'test-consoles',
1022 test_consoles_sources,
1023 c_args : ['-DTEST_PROGRAM'],
1024 include_directories : includes,
1025 link_with : lib_common,
1026 build_by_default : program_tests)
1027 exes += exe
1028
1029 opt = not get_option('build-last').disabled()
1030 exe = executable(
1031 'last',
1032 last_sources,
1033 include_directories : includes,
1034 link_with : [lib_common],
1035 install_dir : usrbin_exec_dir,
1036 install : opt,
1037 build_by_default : opt)
1038 if opt and not is_disabler(exe)
1039 exes += exe
1040 meson.add_install_script(meson_make_symlink,
1041 'last',
1042 join_paths(usrbin_exec_dir, 'lastb'))
1043 manadocs += ['login-utils/last.1.adoc']
1044 manlinks += {'lastb.1': 'last.1'}
1045 bashcompletions += ['last']
1046 bashcompletionslinks += {'lastb': 'last'}
1047 endif
1048
1049 opt = not get_option('build-nologin').disabled()
1050 exe = executable(
1051 'nologin',
1052 'login-utils/nologin.c',
1053 include_directories : includes,
1054 install_dir : sbindir,
1055 link_with : [lib_common],
1056 install : opt,
1057 build_by_default : opt)
1058 if opt and not is_disabler(exe)
1059 exes += exe
1060 manadocs += ['login-utils/nologin.8.adoc']
1061 endif
1062
1063 opt = not get_option('build-utmpdump').disabled()
1064 exe = executable(
1065 'utmpdump',
1066 'login-utils/utmpdump.c',
1067 include_directories : includes,
1068 link_with : [lib_common],
1069 install_dir : usrbin_exec_dir,
1070 install : opt,
1071 build_by_default : opt)
1072 if opt and not is_disabler(exe)
1073 exes += exe
1074 manadocs += ['login-utils/utmpdump.1.adoc']
1075 bashcompletions += ['utmpdump']
1076 endif
1077
1078 opt = not get_option('build-su').disabled()
1079 exe = executable(
1080 'su',
1081 'login-utils/su.c',
1082 'login-utils/su-common.c',
1083 'login-utils/su-common.h',
1084 'lib/shells.c',
1085 pty_session_c,
1086 monotonic_c,
1087 include_directories : includes,
1088 link_with : [lib_common, logindefs_c],
1089 dependencies : [lib_pam,
1090 lib_pam_misc,
1091 lib_util,
1092 realtime_libs],
1093 install_mode : 'rwsr-xr-x',
1094 install : opt,
1095 build_by_default : opt)
1096 if opt and not is_disabler(exe)
1097 exes += exe
1098 manadocs += ['login-utils/su.1.adoc']
1099 bashcompletions += ['su']
1100 endif
1101
1102 opt = not get_option('build-newgrp').disabled()
1103 exe = executable(
1104 'newgrp',
1105 'login-utils/newgrp.c',
1106 include_directories : includes,
1107 dependencies : [lib_crypt],
1108 install_dir : usrbin_exec_dir,
1109 install_mode : 'rwsr-xr-x',
1110 install : opt,
1111 build_by_default : opt)
1112 if opt and not is_disabler(exe)
1113 exes += exe
1114 manadocs += ['login-utils/newgrp.1.adoc']
1115 bashcompletions += ['newgrp']
1116 endif
1117
1118 opt = not get_option('build-lslogins').disabled()
1119 exe = executable(
1120 'lslogins',
1121 'login-utils/lslogins.c',
1122 include_directories : includes,
1123 link_with : [lib_common,
1124 lib_smartcols,
1125 logindefs_c] +
1126 (build_liblastlog2 ? [lib_lastlog2] : []),
1127 dependencies : [lib_selinux,
1128 lib_systemd],
1129 install_dir : usrbin_exec_dir,
1130 install : opt,
1131 build_by_default : opt)
1132 if opt and not is_disabler(exe)
1133 exes += exe
1134 manadocs += ['login-utils/lslogins.1.adoc']
1135 bashcompletions += ['lslogins']
1136 endif
1137
1138 opt = not get_option('build-vipw').disabled()
1139 exe = executable(
1140 'vipw',
1141 'login-utils/vipw.c',
1142 'login-utils/setpwnam.h',
1143 include_directories : includes,
1144 link_with : [lib_common],
1145 dependencies : [lib_selinux],
1146 install_dir : usrbin_exec_dir,
1147 install : opt,
1148 build_by_default : opt)
1149 if opt and not is_disabler(exe)
1150 exes += exe
1151 meson.add_install_script(meson_make_symlink,
1152 'vipw',
1153 join_paths(usrbin_exec_dir, 'vigr'))
1154 manadocs += ['login-utils/vipw.8.adoc']
1155 meson.add_install_script(meson_make_symlink,
1156 'vipw.8',
1157 join_paths(mandir, 'man8/vigr.8'))
1158 endif
1159
1160 opt = not get_option('build-runuser').disabled()
1161 exe = executable(
1162 'runuser',
1163 'login-utils/runuser.c',
1164 'login-utils/su-common.c',
1165 'login-utils/su-common.h',
1166 'lib/shells.c',
1167 pty_session_c,
1168 monotonic_c,
1169 include_directories : includes,
1170 link_with : [lib_common, logindefs_c],
1171 dependencies : [lib_pam,
1172 lib_pam_misc,
1173 lib_util,
1174 realtime_libs],
1175 install_dir : sbindir,
1176 install : opt,
1177 build_by_default : opt)
1178 if opt and not is_disabler(exe)
1179 exes += exe
1180 manadocs += ['login-utils/runuser.1.adoc']
1181 bashcompletionslinks += {'runuser': 'su'}
1182 endif
1183
1184 ############################################################
1185
1186 if is_glibc
1187 exe = executable(
1188 'col',
1189 col_sources,
1190 include_directories : includes,
1191 link_with : lib_common,
1192 install_dir : usrbin_exec_dir,
1193 install : true)
1194 exes += exe
1195 manadocs += ['text-utils/col.1.adoc']
1196 bashcompletions += ['col']
1197 endif
1198
1199 exe = executable(
1200 'colcrt',
1201 colcrt_sources,
1202 include_directories : includes,
1203 install_dir : usrbin_exec_dir,
1204 install : true)
1205 exes += exe
1206 manadocs += ['text-utils/colcrt.1.adoc']
1207 bashcompletions += ['colcrt']
1208
1209 exe = executable(
1210 'colrm',
1211 colrm_sources,
1212 include_directories : includes,
1213 link_with : lib_common,
1214 install_dir : usrbin_exec_dir,
1215 install : true)
1216 exes += exe
1217 manadocs += ['text-utils/colrm.1.adoc']
1218 bashcompletions += ['colrm']
1219
1220 exe = executable(
1221 'rev',
1222 rev_sources,
1223 include_directories : includes,
1224 install_dir : usrbin_exec_dir,
1225 install : true)
1226 exes += exe
1227 manadocs += ['text-utils/rev.1.adoc']
1228 bashcompletions += ['rev']
1229
1230 exe = executable(
1231 'column',
1232 column_sources,
1233 include_directories : includes,
1234 link_with : [lib_common,
1235 lib_smartcols],
1236 install_dir : usrbin_exec_dir,
1237 install : true)
1238 if not is_disabler(exe)
1239 exes += exe
1240 manadocs += ['text-utils/column.1.adoc']
1241 bashcompletions += ['column']
1242 endif
1243
1244 opt = not get_option('build-line').disabled()
1245 exe = executable(
1246 'line',
1247 line_sources,
1248 include_directories : includes,
1249 install_dir : usrbin_exec_dir,
1250 install : opt,
1251 build_by_default : opt)
1252 if opt and not is_disabler(exe)
1253 exes += exe
1254 manadocs += ['text-utils/line.1.adoc']
1255 endif
1256
1257 opt = not get_option('build-pg').disabled()
1258 exe = executable(
1259 'pg',
1260 pg_sources,
1261 link_with : lib_common,
1262 include_directories : includes,
1263 dependencies : [lib_tinfo,
1264 curses_libs],
1265 install_dir : usrbin_exec_dir,
1266 install : opt,
1267 build_by_default : opt)
1268 if opt and not is_disabler(exe)
1269 exes += exe
1270 manadocs += ['text-utils/pg.1.adoc']
1271 bashcompletions += ['pg']
1272 endif
1273
1274 opt = not get_option('build-ul').disabled()
1275 exe = executable(
1276 'ul',
1277 ul_sources,
1278 include_directories : includes,
1279 dependencies : [lib_tinfo,
1280 curses_libs],
1281 install_dir : usrbin_exec_dir,
1282 install : opt,
1283 build_by_default : opt)
1284 if opt and not is_disabler(exe)
1285 exes += exe
1286 manadocs += ['text-utils/ul.1.adoc']
1287 bashcompletions += ['ul']
1288 endif
1289
1290 opt = not get_option('build-more').disabled()
1291 exe = executable(
1292 'more',
1293 more_sources,
1294 link_with : [lib_common],
1295 include_directories : includes,
1296 dependencies : [lib_tinfo,
1297 curses_libs,
1298 lib_magic],
1299 install : opt,
1300 build_by_default : opt)
1301 exe2 = executable(
1302 'test_more',
1303 more_sources,
1304 link_with : [lib_common],
1305 include_directories : includes,
1306 c_args : '-DTEST_PROGRAM',
1307 dependencies : [lib_tinfo,
1308 curses_libs,
1309 lib_magic],
1310 build_by_default : opt and program_tests)
1311 exes += exe
1312 if opt and not is_disabler(exe)
1313 exes += [exe, exe2]
1314 manadocs += ['text-utils/more.1.adoc']
1315 bashcompletions += ['more']
1316 endif
1317
1318 exe = executable(
1319 'hexdump',
1320 hexdump_sources,
1321 include_directories : includes,
1322 link_with : [lib_common,
1323 lib_tcolors],
1324 install_dir : usrbin_exec_dir,
1325 install : true)
1326 if not is_disabler(exe)
1327 exes += exe
1328 manadocs += ['text-utils/hexdump.1.adoc']
1329 bashcompletions += ['hexdump']
1330 endif
1331
1332 opt = not get_option('build-lsmem').disabled()
1333 exe = executable(
1334 'lsmem',
1335 lsmem_sources,
1336 include_directories : includes,
1337 link_with : [lib_common,
1338 lib_smartcols],
1339 install_dir : usrbin_exec_dir,
1340 install : opt,
1341 build_by_default : opt)
1342 if opt and not is_disabler(exe)
1343 exes += exe
1344 manadocs += ['sys-utils/lsmem.1.adoc']
1345 bashcompletions += ['lsmem']
1346 endif
1347
1348 opt = not get_option('build-chmem').disabled()
1349 exe = executable(
1350 'chmem',
1351 chmem_sources,
1352 include_directories : includes,
1353 link_with : [lib_common],
1354 install_dir : usrbin_exec_dir,
1355 install : opt,
1356 build_by_default : opt)
1357 if opt and not is_disabler(exe)
1358 exes += exe
1359 manadocs += ['sys-utils/chmem.8.adoc']
1360 bashcompletions += ['chmem']
1361 endif
1362
1363 exe = executable(
1364 'choom',
1365 choom_sources,
1366 include_directories : includes,
1367 link_with : [lib_common],
1368 install_dir : usrbin_exec_dir,
1369 install : true)
1370 exes += exe
1371 manadocs += ['sys-utils/choom.1.adoc']
1372
1373 exe = executable(
1374 'ipcmk',
1375 ipcmk_sources,
1376 include_directories : includes,
1377 link_with : [lib_common],
1378 install_dir : usrbin_exec_dir,
1379 install : true)
1380 exes += exe
1381 manadocs += ['sys-utils/ipcmk.1.adoc']
1382 bashcompletions += ['ipcmk']
1383
1384 exe = executable(
1385 'ipcrm',
1386 ipcrm_sources,
1387 include_directories : includes,
1388 link_with : [lib_common],
1389 install_dir : usrbin_exec_dir,
1390 install : true)
1391 exes += exe
1392 manadocs += ['sys-utils/ipcrm.1.adoc']
1393 bashcompletions += ['ipcrm']
1394
1395 opt = not get_option('build-ipcs').disabled()
1396 exe = executable(
1397 'ipcs',
1398 ipcs_sources,
1399 include_directories : includes,
1400 link_with : [lib_common],
1401 install_dir : usrbin_exec_dir,
1402 install : opt,
1403 build_by_default : opt)
1404 if opt and not is_disabler(exe)
1405 exes += exe
1406 manadocs += ['sys-utils/ipcs.1.adoc']
1407 bashcompletions += ['ipcs']
1408 endif
1409
1410 opt = not get_option('build-rfkill').disabled()
1411 exe = executable(
1412 'rfkill',
1413 rfkill_sources,
1414 include_directories : includes,
1415 link_with : [lib_common,
1416 lib_smartcols],
1417 install_dir : usrsbin_exec_dir,
1418 install : opt,
1419 build_by_default : opt)
1420 if opt and not is_disabler(exe)
1421 exes += exe
1422 manadocs += ['sys-utils/rfkill.8.adoc']
1423 bashcompletions += ['rfkill']
1424 endif
1425
1426 exe = executable(
1427 'renice',
1428 renice_sources,
1429 include_directories : includes,
1430 link_with : [lib_common,
1431 lib_smartcols],
1432 install_dir : usrbin_exec_dir,
1433 install : true)
1434 if not is_disabler(exe)
1435 exes += exe
1436 manadocs += ['sys-utils/renice.1.adoc']
1437 bashcompletions += ['renice']
1438 endif
1439
1440 exe = executable(
1441 'setpgid',
1442 setpgid_sources,
1443 include_directories: includes,
1444 link_with : [lib_common,
1445 lib_smartcols],
1446 install_dir : usrbin_exec_dir,
1447 install : true)
1448 if opt and not is_disabler(exe)
1449 exes += exe
1450 manadocs += ['sys-utils/setpgid.1.adoc']
1451 bashcompletions += ['setpgid']
1452 endif
1453
1454 exe = executable(
1455 'setsid',
1456 setsid_sources,
1457 include_directories : includes,
1458 link_with : [lib_common,
1459 lib_smartcols],
1460 install_dir : usrbin_exec_dir,
1461 install : true)
1462 if opt and not is_disabler(exe)
1463 exes += exe
1464 manadocs += ['sys-utils/setsid.1.adoc']
1465 bashcompletions += ['setsid']
1466 endif
1467
1468 exe = executable(
1469 'readprofile',
1470 readprofile_sources,
1471 include_directories : includes,
1472 link_with : [lib_common,
1473 lib_smartcols],
1474 install_dir : usrsbin_exec_dir,
1475 install : true)
1476 if not is_disabler(exe)
1477 exes += exe
1478 manadocs += ['sys-utils/readprofile.8.adoc']
1479 bashcompletions += ['readprofile']
1480 endif
1481
1482 opt = not get_option('build-tunelp').disabled()
1483 exe = executable(
1484 'tunelp',
1485 tunelp_sources,
1486 include_directories : includes,
1487 link_with : [lib_common],
1488 install_dir : usrsbin_exec_dir,
1489 install : opt,
1490 build_by_default : opt)
1491 if opt and not is_disabler(exe)
1492 exes += exe
1493 manadocs += ['sys-utils/tunelp.8.adoc']
1494 bashcompletions += ['tunelp']
1495 endif
1496
1497 exe = executable(
1498 'fstrim',
1499 fstrim_sources,
1500 include_directories : includes,
1501 link_with : [lib_common,
1502 lib_mount],
1503 install_dir : sbindir,
1504 install : true)
1505 if not is_disabler(exe)
1506 exes += exe
1507 manadocs += ['sys-utils/fstrim.8.adoc']
1508 bashcompletions += ['fstrim']
1509 endif
1510
1511 exe = executable(
1512 'dmesg',
1513 dmesg_sources,
1514 include_directories : includes,
1515 link_with : [lib_common,
1516 lib_tcolors],
1517 install : true)
1518 if not is_disabler(exe)
1519 exes += exe
1520 manadocs += ['sys-utils/dmesg.1.adoc']
1521 bashcompletions += ['dmesg']
1522 endif
1523
1524 exe = executable(
1525 'test_dmesg',
1526 dmesg_sources,
1527 include_directories : dir_include,
1528 c_args : '-DTEST_DMESG',
1529 link_with : [lib_common,
1530 lib_tcolors],
1531 build_by_default : program_tests)
1532 if not is_disabler(exe)
1533 exes += exe
1534 endif
1535
1536 exe = executable(
1537 'ctrlaltdel',
1538 ctrlaltdel_sources,
1539 include_directories : includes,
1540 link_with : [lib_common],
1541 install_dir : sbindir,
1542 install : true)
1543 exes += exe
1544 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1545 bashcompletions += ['ctrlaltdel']
1546
1547 exe = executable(
1548 'fsfreeze',
1549 fsfreeze_sources,
1550 include_directories : includes,
1551 install_dir : sbindir,
1552 install : true)
1553 exes += exe
1554 manadocs += ['sys-utils/fsfreeze.8.adoc']
1555 bashcompletions += ['fsfreeze']
1556
1557 exe = executable(
1558 'blkdiscard',
1559 blkdiscard_sources,
1560 include_directories : includes,
1561 link_with : [lib_common,
1562 lib_blkid],
1563 install_dir : sbindir,
1564 install : true)
1565 exes += exe
1566 manadocs += ['sys-utils/blkdiscard.8.adoc']
1567 bashcompletions += ['blkdiscard']
1568
1569 if cc.has_header('linux/blkzoned.h')
1570 exe = executable(
1571 'blkzone',
1572 blkzone_sources,
1573 include_directories : includes,
1574 link_with : [lib_common],
1575 install_dir : sbindir,
1576 install : true)
1577 exes += exe
1578 manadocs += ['sys-utils/blkzone.8.adoc']
1579 bashcompletions += ['blkzone']
1580 endif
1581
1582 if cc.has_header('linux/pr.h')
1583 exe = executable(
1584 'blkpr',
1585 blkpr_sources,
1586 include_directories : includes,
1587 link_with : [lib_common],
1588 install_dir : sbindir,
1589 install : true)
1590 exes += exe
1591 manadocs += ['sys-utils/blkpr.8.adoc']
1592 endif
1593
1594 exe = executable(
1595 'ldattach',
1596 ldattach_sources,
1597 include_directories : includes,
1598 link_with : [lib_common],
1599 install_dir : usrsbin_exec_dir,
1600 install : true)
1601 exes += exe
1602 manadocs += ['sys-utils/ldattach.8.adoc']
1603 bashcompletions += ['ldattach']
1604
1605 exe = executable(
1606 'rtcwake',
1607 rtcwake_sources,
1608 include_directories : includes,
1609 link_with : [lib_common],
1610 install_dir : usrsbin_exec_dir,
1611 install : true)
1612 exes += exe
1613 manadocs += ['sys-utils/rtcwake.8.adoc']
1614 bashcompletions += ['rtcwake']
1615
1616 exe = executable(
1617 'setarch',
1618 setarch_sources,
1619 include_directories : includes,
1620 link_with : [lib_common],
1621 install_dir : usrbin_exec_dir,
1622 install : true)
1623 exes += exe
1624 manadocs += ['sys-utils/setarch.8.adoc']
1625 bashcompletions += ['setarch']
1626
1627 setarch_links = ['uname26', 'linux32', 'linux64']
1628 setarch_links_arch = {
1629 's390x' : ['s390', 's390x'],
1630 'x86' : ['i386'],
1631 'x86_64' : ['i386', 'x86_64'],
1632 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1633 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1634 'mips64' : ['mips', 'mips64', 'mips32'],
1635 'ia64' : ['i386', 'ia64'],
1636 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1637 }
1638 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1639
1640 foreach link: setarch_links
1641 meson.add_install_script(meson_make_symlink,
1642 'setarch',
1643 join_paths(usrbin_exec_dir, link))
1644 manlinks += {link + '.8': 'setarch.8'}
1645 endforeach
1646
1647 opt = not get_option('build-eject').disabled()
1648 exe = executable(
1649 'eject',
1650 eject_sources,
1651 include_directories : includes,
1652 link_with : [lib_common,
1653 lib_mount],
1654 install_dir : usrbin_exec_dir,
1655 install : opt,
1656 build_by_default : opt)
1657 if opt and not is_disabler(exe)
1658 exe = exe
1659 manadocs += ['sys-utils/eject.1.adoc']
1660 bashcompletions += ['eject']
1661 endif
1662
1663 opt = not get_option('build-losetup').disabled()
1664 exe = executable(
1665 'losetup',
1666 losetup_sources,
1667 include_directories : includes,
1668 link_with : [lib_common,
1669 lib_smartcols],
1670 install_dir : sbindir,
1671 install : opt,
1672 build_by_default : opt)
1673 if opt and not is_disabler(exe)
1674 manadocs += ['sys-utils/losetup.8.adoc']
1675 exes += exe
1676 bashcompletions += ['losetup']
1677 endif
1678
1679 opt = opt and 'losetup' in static_programs
1680 exe = executable(
1681 'losetup.static',
1682 losetup_sources,
1683 include_directories : includes,
1684 link_args : ['--static'],
1685 link_with : [lib_common,
1686 lib_smartcols.get_static_lib()],
1687 install_dir : sbindir,
1688 install : opt,
1689 build_by_default : opt)
1690 if opt and not is_disabler(exe)
1691 exes += exe
1692 endif
1693
1694 opt = not get_option('build-zramctl').disabled()
1695 exe = executable(
1696 'zramctl',
1697 zramctl_sources,
1698 include_directories : includes,
1699 link_with : [lib_common,
1700 lib_smartcols],
1701 install_dir : sbindir,
1702 install : opt,
1703 build_by_default : opt)
1704 if opt and not is_disabler(exe)
1705 exes += exe
1706 manadocs += ['sys-utils/zramctl.8.adoc']
1707 bashcompletions += ['zramctl']
1708 endif
1709
1710 exe = executable(
1711 'prlimit',
1712 prlimit_sources,
1713 include_directories : includes,
1714 link_with : [lib_common,
1715 lib_smartcols],
1716 install_dir : usrbin_exec_dir,
1717 install : true)
1718 if not is_disabler(exe)
1719 exes += exe
1720 manadocs += ['sys-utils/prlimit.1.adoc']
1721 bashcompletions += ['prlimit']
1722 endif
1723
1724 exe = executable(
1725 'lsns',
1726 lsns_sources,
1727 include_directories : includes,
1728 link_with : [lib_common,
1729 lib_smartcols,
1730 lib_mount],
1731 install_dir : usrbin_exec_dir,
1732 install : true)
1733 if not is_disabler(exe)
1734 exes += exe
1735 manadocs += ['sys-utils/lsns.8.adoc']
1736 bashcompletions += ['lsns']
1737 endif
1738
1739 opt = not get_option('build-mount').disabled()
1740 exe = executable(
1741 'mount',
1742 mount_sources,
1743 include_directories : includes,
1744 link_with : [lib_common,
1745 lib_smartcols,
1746 lib_mount],
1747 dependencies : lib_selinux,
1748 install_mode : 'rwsr-xr-x',
1749 install : opt,
1750 build_by_default : opt)
1751 exe2 = executable(
1752 'umount',
1753 umount_sources,
1754 include_directories : includes,
1755 link_with : [lib_common,
1756 lib_mount],
1757 install_mode : 'rwsr-xr-x',
1758 install : opt,
1759 build_by_default : opt)
1760 if opt and not is_disabler(exe)
1761 exes += [exe, exe2]
1762 manadocs += ['sys-utils/fstab.5.adoc',
1763 'sys-utils/mount.8.adoc',
1764 'sys-utils/umount.8.adoc']
1765 bashcompletions += ['mount', 'umount']
1766 endif
1767
1768 opt2 = opt and 'mount' in static_programs
1769 exe = executable(
1770 'mount.static',
1771 mount_sources,
1772 include_directories : includes,
1773 link_args : ['--static'],
1774 link_with : [lib_common,
1775 lib_smartcols_static,
1776 lib_mount_static],
1777 install : opt2,
1778 build_by_default : opt2)
1779 if opt2 and not is_disabler(exe)
1780 exes += exe
1781 endif
1782
1783 opt2 = opt and 'umount' in static_programs
1784 exe = executable(
1785 'umount.static',
1786 umount_sources,
1787 include_directories : includes,
1788 link_args : ['--static'],
1789 link_with : [lib_common,
1790 lib_mount_static],
1791 install : opt2,
1792 build_by_default : opt2)
1793 if opt2 and not is_disabler(exe)
1794 exes += exe
1795 endif
1796
1797 # setuid?
1798
1799 exe = executable(
1800 'swapon',
1801 swapon_sources,
1802 include_directories : includes,
1803 link_with : [lib_common,
1804 lib_blkid,
1805 lib_mount,
1806 lib_smartcols],
1807 install_dir : sbindir,
1808 install : true)
1809 if not is_disabler(exe)
1810 exes += exe
1811 manadocs += ['sys-utils/swapon.8.adoc']
1812 bashcompletions += ['swapon']
1813 endif
1814
1815 exe = executable(
1816 'swapoff',
1817 swapoff_sources,
1818 include_directories : includes,
1819 link_with : [lib_common,
1820 lib_blkid,
1821 lib_mount],
1822 install_dir : sbindir,
1823 install : true)
1824 if not is_disabler(exe)
1825 exes += exe
1826 manlinks += {'swapoff.8': 'swapon.8'}
1827 bashcompletions += ['swapoff']
1828 endif
1829
1830 exe = executable(
1831 'lscpu',
1832 lscpu_sources,
1833 include_directories : includes,
1834 link_with : [lib_common,
1835 lib_smartcols],
1836 dependencies : [rtas_libs],
1837 install_dir : usrbin_exec_dir,
1838 install : true)
1839 if not is_disabler(exe)
1840 exes += exe
1841 manadocs += ['sys-utils/lscpu.1.adoc']
1842 bashcompletions += ['lscpu']
1843 endif
1844
1845 exe = executable(
1846 'chcpu',
1847 chcpu_sources,
1848 include_directories : includes,
1849 link_with : [lib_common],
1850 install_dir : sbindir,
1851 install : true)
1852 exes += exe
1853 manadocs += ['sys-utils/chcpu.8.adoc']
1854 bashcompletions += ['chcpu']
1855
1856 exe = executable(
1857 'wdctl',
1858 wdctl_sources,
1859 include_directories : includes,
1860 link_with : [lib_common,
1861 lib_smartcols],
1862 install : true)
1863 if not is_disabler(exe)
1864 exes += exe
1865 manadocs += ['sys-utils/wdctl.8.adoc']
1866 bashcompletions += ['wdctl']
1867 endif
1868
1869 opt = not get_option('build-mountpoint').disabled()
1870 exe = executable(
1871 'mountpoint',
1872 mountpoint_sources,
1873 include_directories : includes,
1874 link_with : [lib_mount],
1875 install : opt,
1876 build_by_default : opt)
1877 if opt and not is_disabler(exe)
1878 exes += exe
1879 manadocs += ['sys-utils/mountpoint.1.adoc']
1880 bashcompletions += ['mountpoint']
1881 endif
1882
1883 opt = not get_option('build-fallocate').disabled()
1884 exe = executable(
1885 'fallocate',
1886 fallocate_sources,
1887 include_directories : includes,
1888 link_with : [lib_common],
1889 install_dir : usrbin_exec_dir,
1890 install : opt,
1891 build_by_default : opt)
1892 if opt and not is_disabler(exe)
1893 exes += exe
1894 manadocs += ['sys-utils/fallocate.1.adoc']
1895 bashcompletions += ['fallocate']
1896 endif
1897
1898 opt = not get_option('build-pivot_root').disabled()
1899 exe = executable(
1900 'pivot_root',
1901 pivot_root_sources,
1902 include_directories : includes,
1903 install_dir : sbindir,
1904 install : opt,
1905 build_by_default : opt)
1906 if opt and not is_disabler(exe)
1907 exes += exe
1908 manadocs += ['sys-utils/pivot_root.8.adoc']
1909 bashcompletions += ['pivot_root']
1910 endif
1911
1912 opt = not get_option('build-switch_root').disabled()
1913 if opt and not have_dirfd and not have_ddfd
1914 error('neither dirfd nor ddfd are available')
1915 endif
1916 exe = executable(
1917 'switch_root',
1918 switch_root_sources,
1919 include_directories : includes,
1920 install_dir : sbindir,
1921 install : opt,
1922 build_by_default : opt)
1923 if opt and not is_disabler(exe)
1924 exes += exe
1925 manadocs += ['sys-utils/switch_root.8.adoc']
1926 endif
1927
1928 opt = not get_option('build-unshare').disabled()
1929 exe = executable(
1930 'unshare',
1931 unshare_sources,
1932 include_directories : includes,
1933 link_with : [lib_common],
1934 install_dir : usrbin_exec_dir,
1935 install : opt,
1936 build_by_default : opt)
1937 if opt and not is_disabler(exe)
1938 exes += exe
1939 manadocs += ['sys-utils/unshare.1.adoc']
1940 bashcompletions += ['unshare']
1941 endif
1942
1943 opt = opt and 'unshare' in static_programs
1944 exe = executable(
1945 'unshare.static',
1946 unshare_sources,
1947 include_directories : includes,
1948 link_with : [lib_common],
1949 install_dir : usrbin_exec_dir,
1950 install : opt,
1951 build_by_default : opt)
1952 if opt and not is_disabler(exe)
1953 exes += exe
1954 endif
1955
1956 opt = not get_option('build-nsenter').disabled()
1957 exe = executable(
1958 'nsenter',
1959 nsenter_sources,
1960 include_directories : includes,
1961 link_with : [lib_common],
1962 dependencies : [lib_selinux],
1963 install_dir : usrbin_exec_dir,
1964 install : opt,
1965 build_by_default : opt)
1966 if opt and not is_disabler(exe)
1967 exes += exe
1968 manadocs += ['sys-utils/nsenter.1.adoc']
1969 bashcompletions += ['nsenter']
1970 endif
1971
1972 opt = opt and 'nsenter' in static_programs
1973 exe = executable(
1974 'nsenter.static',
1975 nsenter_sources,
1976 include_directories : includes,
1977 link_with : [lib_common],
1978 dependencies : [lib_selinux],
1979 install_dir : usrbin_exec_dir,
1980 install : opt,
1981 build_by_default : opt)
1982 if opt and not is_disabler(exe)
1983 exes += exe
1984 endif
1985
1986 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1987 exe = executable(
1988 'setpriv',
1989 setpriv_sources,
1990 include_directories : includes,
1991 link_with : [lib_common],
1992 dependencies : [lib_cap_ng],
1993 install_dir : usrbin_exec_dir,
1994 install : opt,
1995 build_by_default : opt)
1996 if opt and not is_disabler(exe)
1997 exes += exe
1998 manadocs += ['sys-utils/setpriv.1.adoc']
1999 bashcompletions += ['setpriv']
2000 endif
2001
2002 exe = executable(
2003 'flock',
2004 flock_sources,
2005 include_directories : includes,
2006 link_with : [lib_common],
2007 dependencies : realtime_libs,
2008 install_dir : usrbin_exec_dir,
2009 install : true)
2010 exes += exe
2011 manadocs += ['sys-utils/flock.1.adoc']
2012 bashcompletions += ['flock']
2013
2014 opt = not get_option('build-lsirq').disabled()
2015 exe = executable(
2016 'lsirq',
2017 lsirq_sources,
2018 include_directories : includes,
2019 link_with : [lib_common,
2020 lib_smartcols],
2021 install_dir : usrbin_exec_dir,
2022 install : opt,
2023 build_by_default : opt)
2024 if opt and not is_disabler(exe)
2025 exes += exe
2026 manadocs += ['sys-utils/lsirq.1.adoc']
2027 bashcompletions += ['lsirq']
2028 endif
2029
2030 opt = not get_option('build-irqtop').disabled()
2031 exe = executable(
2032 'irqtop',
2033 irqtop_sources,
2034 include_directories : includes,
2035 dependencies : [realtime_libs, curses_libs],
2036 link_with : [lib_common,
2037 lib_smartcols,
2038 lib_tcolors],
2039 install_dir : usrbin_exec_dir,
2040 install : opt,
2041 build_by_default : opt)
2042 if opt and not is_disabler(exe)
2043 exes += exe
2044 manadocs += ['sys-utils/irqtop.1.adoc']
2045 bashcompletions += ['irqtop']
2046 endif
2047
2048 opt = not get_option('build-ipcs').disabled()
2049 exe = executable(
2050 'lsipc',
2051 lsipc_sources,
2052 include_directories : includes,
2053 link_with : [lib_common,
2054 lib_smartcols],
2055 install_dir : usrbin_exec_dir,
2056 install : opt,
2057 build_by_default : opt)
2058 if opt and not is_disabler(exe)
2059 exes += exe
2060 manadocs += ['sys-utils/lsipc.1.adoc']
2061 bashcompletions += ['lsipc']
2062 endif
2063
2064 opt = build_hwclock
2065 exe = executable(
2066 'hwclock',
2067 hwclock_sources,
2068 include_directories : includes,
2069 link_with : [lib_common],
2070 dependencies : [lib_m,
2071 lib_audit],
2072 install_dir : sbindir,
2073 install : opt,
2074 build_by_default : opt)
2075 if opt and not is_disabler(exe)
2076 exes += exe
2077 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2078 bashcompletions += ['hwclock']
2079 endif
2080
2081 exe = executable(
2082 'mkfs',
2083 mkfs_sources,
2084 include_directories : includes,
2085 install_dir : sbindir,
2086 install : true)
2087 exes += exe
2088 manadocs += ['disk-utils/mkfs.8.adoc']
2089 bashcompletions += ['mkfs']
2090
2091 opt = not get_option('build-bfs').disabled()
2092 exe = executable(
2093 'mkfs.bfs',
2094 mkfs_bfs_sources,
2095 include_directories : includes,
2096 link_with : [lib_common],
2097 install_dir : sbindir,
2098 install : opt,
2099 build_by_default : opt)
2100 if opt and not is_disabler(exe)
2101 exes += exe
2102 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2103 bashcompletions += ['mkfs.bfs']
2104 endif
2105
2106 exe = executable(
2107 'isosize',
2108 isosize_sources,
2109 include_directories : includes,
2110 link_with : [lib_common],
2111 install_dir : usrbin_exec_dir,
2112 install : true)
2113 exes += exe
2114 manadocs += ['disk-utils/isosize.8.adoc']
2115 bashcompletions += ['isosize']
2116
2117 exe = executable(
2118 'mkswap',
2119 mkswap_sources,
2120 include_directories : includes,
2121 link_with : [lib_common,
2122 lib_blkid,
2123 lib_uuid],
2124 dependencies: [lib_selinux],
2125 install_dir : sbindir,
2126 install : true)
2127 if not is_disabler(exe)
2128 exes += exe
2129 manadocs += ['disk-utils/mkswap.8.adoc']
2130 bashcompletions += ['mkswap']
2131 endif
2132
2133 exe = executable(
2134 'swaplabel',
2135 swaplabel_sources,
2136 include_directories : includes,
2137 link_with : [lib_common,
2138 lib_blkid,
2139 lib_uuid],
2140 install_dir : sbindir,
2141 install : true)
2142 if not is_disabler(exe)
2143 exes += exe
2144 manadocs += ['disk-utils/swaplabel.8.adoc']
2145 bashcompletions += ['swaplabel']
2146 endif
2147
2148 opt = not get_option('build-fsck').disabled()
2149 exe = executable(
2150 'fsck',
2151 fsck_sources,
2152 include_directories : includes,
2153 link_with : [lib_common,
2154 lib_blkid,
2155 lib_mount],
2156 dependencies : realtime_libs,
2157 install_dir : sbindir,
2158 install : opt,
2159 build_by_default : opt)
2160 if opt and not is_disabler(exe)
2161 exes += exe
2162 manadocs += ['disk-utils/fsck.8.adoc']
2163 bashcompletions += ['fsck']
2164 endif
2165
2166 opt = not get_option('build-minix').disabled()
2167 exe = executable(
2168 'mkfs.minix',
2169 mkfs_minix_sources,
2170 include_directories : includes,
2171 link_with : [lib_common],
2172 install_dir : sbindir,
2173 install : opt,
2174 build_by_default : opt)
2175 exe2 = executable(
2176 'test_mkfs_minix',
2177 mkfs_minix_sources,
2178 include_directories : includes,
2179 c_args : '-DTEST_SCRIPT',
2180 link_with : [lib_common],
2181 build_by_default : opt and program_tests)
2182 exe3 = executable(
2183 'fsck.minix',
2184 fsck_minix_sources,
2185 include_directories : includes,
2186 link_with : [lib_common],
2187 install_dir : sbindir,
2188 install : opt,
2189 build_by_default : opt)
2190 if opt and not is_disabler(exe)
2191 exes += [exe, exe2, exe3]
2192 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2193 bashcompletions += ['mkfs.minix', 'fsck.minix']
2194 endif
2195
2196 opt = not get_option('build-cramfs').disabled()
2197 exe = executable(
2198 'mkfs.cramfs',
2199 mkfs_cramfs_sources,
2200 include_directories : includes,
2201 link_with : [lib_common],
2202 dependencies : [lib_z],
2203 install_dir : sbindir,
2204 install : opt,
2205 build_by_default : opt)
2206 exe2 = executable(
2207 'fsck.cramfs',
2208 fsck_cramfs_sources,
2209 include_directories : includes,
2210 link_with : [lib_common],
2211 dependencies : [lib_z],
2212 install_dir : sbindir,
2213 install : opt,
2214 build_by_default : opt)
2215 if not is_disabler(exe)
2216 exes += [exe, exe2]
2217 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2218 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2219 endif
2220
2221 opt = not get_option('build-raw').disabled()
2222 if opt
2223 cc.has_header('linux/raw.h', required: opt)
2224 endif
2225 exe = executable(
2226 'raw',
2227 raw_sources,
2228 include_directories : includes,
2229 install_dir : sbindir,
2230 install : opt,
2231 build_by_default : opt)
2232 if opt and not is_disabler(exe)
2233 exes += exe
2234 manadocs += ['disk-utils/raw.8.adoc']
2235 bashcompletions += ['raw']
2236 endif
2237
2238 opt = not get_option('build-fdformat').disabled()
2239 exe = executable(
2240 'fdformat',
2241 fdformat_sources,
2242 include_directories : includes,
2243 link_with : [lib_common],
2244 install_dir : usrsbin_exec_dir,
2245 install : opt,
2246 build_by_default : opt)
2247 if opt and not is_disabler(exe)
2248 exes += exe
2249 manadocs += ['disk-utils/fdformat.8.adoc']
2250 bashcompletions += ['fdformat']
2251 endif
2252
2253 exe = executable(
2254 'blockdev',
2255 blockdev_sources,
2256 include_directories : includes,
2257 link_with : [lib_common],
2258 install_dir : sbindir,
2259 install : true)
2260 manadocs += ['disk-utils/blockdev.8.adoc']
2261 bashcompletions += ['blockdev']
2262
2263 opt = not get_option('build-fdisks').disabled()
2264 if opt and not have_dirfd and not have_ddfd
2265 error('neither dirfd nor ddfd are available')
2266 endif
2267 exe = executable(
2268 'fdisk',
2269 fdisk_sources,
2270 include_directories : includes,
2271 link_with : [lib_common,
2272 lib_fdisk,
2273 lib_smartcols,
2274 lib_tcolors],
2275 dependencies : [lib_readline],
2276 install_dir : sbindir,
2277 install : opt,
2278 build_by_default : opt)
2279 if opt and not is_disabler(exe)
2280 exes += exe
2281 bashcompletions += ['fdisk']
2282 endif
2283
2284 opt2 = opt and 'fdisk' in static_programs
2285 exe = executable(
2286 'fdisk.static',
2287 fdisk_sources,
2288 link_args : ['--static'],
2289 include_directories : includes,
2290 link_with : [lib_common,
2291 lib_tcolors,
2292 lib_fdisk_static,
2293 lib_smartcols.get_static_lib()],
2294 dependencies : [lib_readline_static],
2295 install_dir : sbindir,
2296 install : opt2,
2297 build_by_default : opt2)
2298 if opt2 and not is_disabler(exe)
2299 exes += exe
2300 endif
2301
2302 exe = executable(
2303 'sfdisk',
2304 sfdisk_sources,
2305 include_directories : includes,
2306 link_with : [lib_common,
2307 lib_fdisk,
2308 lib_smartcols,
2309 lib_tcolors],
2310 dependencies : [lib_readline],
2311 install_dir : sbindir,
2312 install : opt,
2313 build_by_default : opt)
2314 if opt and not is_disabler(exe)
2315 exes += exe
2316 bashcompletions += ['sfdisk']
2317 endif
2318
2319 opt2 = opt and 'sfdisk' in static_programs
2320 exe = executable(
2321 'sfdisk.static',
2322 sfdisk_sources,
2323 include_directories : includes,
2324 link_with : [lib_common,
2325 lib_tcolors,
2326 lib_fdisk_static,
2327 lib_smartcols.get_static_lib()],
2328 dependencies : [lib_readline_static],
2329 install_dir : sbindir,
2330 install : opt2,
2331 build_by_default : opt2)
2332 if opt2 and not is_disabler(exe)
2333 exes += exe
2334 endif
2335
2336 exe = executable(
2337 'cfdisk',
2338 cfdisk_sources,
2339 include_directories : includes,
2340 link_with : [lib_common,
2341 lib_fdisk,
2342 lib_smartcols,
2343 lib_tcolors,
2344 lib_mount],
2345 dependencies : [curses_libs],
2346 install_dir : sbindir,
2347 install : opt,
2348 build_by_default : opt)
2349 if opt and not is_disabler(exe)
2350 exes += exe
2351 manadocs += ['disk-utils/fdisk.8.adoc',
2352 'disk-utils/sfdisk.8.adoc',
2353 'disk-utils/cfdisk.8.adoc']
2354 bashcompletions += ['cfdisk']
2355 endif
2356
2357 opt = not get_option('build-partx').disabled()
2358 exe = executable(
2359 'addpart',
2360 addpart_sources,
2361 include_directories : includes,
2362 link_with : [lib_common],
2363 install_dir : usrsbin_exec_dir,
2364 install : opt,
2365 build_by_default : opt)
2366 exe2 = executable(
2367 'delpart',
2368 delpart_sources,
2369 include_directories : includes,
2370 link_with : [lib_common],
2371 install_dir : usrsbin_exec_dir,
2372 install : opt,
2373 build_by_default : opt)
2374 exe3 = executable(
2375 'resizepart',
2376 resizepart_sources,
2377 include_directories : includes,
2378 link_with : [lib_common],
2379 install_dir : usrsbin_exec_dir,
2380 install : opt,
2381 build_by_default : opt)
2382 exe4 = executable(
2383 'partx',
2384 partx_sources,
2385 include_directories : includes,
2386 link_with : [lib_common,
2387 lib_blkid,
2388 lib_smartcols],
2389 install_dir : usrsbin_exec_dir,
2390 install : opt,
2391 build_by_default : opt)
2392 if opt
2393 exes += [exe, exe2, exe3, exe4]
2394 manadocs += ['disk-utils/addpart.8.adoc',
2395 'disk-utils/delpart.8.adoc',
2396 'disk-utils/resizepart.8.adoc',
2397 'disk-utils/partx.8.adoc']
2398 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2399 endif
2400
2401 ############################################################
2402
2403 exe = executable(
2404 'script',
2405 script_sources,
2406 include_directories : includes,
2407 link_with : [lib_common],
2408 dependencies : [lib_util,
2409 lib_utempter,
2410 realtime_libs,
2411 math_libs],
2412 install_dir : usrbin_exec_dir,
2413 install : true)
2414 exes += exe
2415 manadocs += ['term-utils/script.1.adoc']
2416 bashcompletions += ['script']
2417
2418 exe = executable(
2419 'test_script',
2420 script_sources,
2421 include_directories : includes,
2422 c_args : '-DTEST_SCRIPT',
2423 link_with : [lib_common],
2424 dependencies : [lib_util,
2425 lib_utempter,
2426 realtime_libs,
2427 math_libs],
2428 build_by_default : program_tests)
2429 exes += exe
2430
2431 exe = executable(
2432 'scriptlive',
2433 scriptlive_sources,
2434 include_directories : includes,
2435 link_with : [lib_common],
2436 dependencies : [lib_util,
2437 realtime_libs,
2438 math_libs],
2439 install_dir : usrbin_exec_dir,
2440 install : true)
2441 exes += exe
2442 manadocs += ['term-utils/scriptlive.1.adoc']
2443 bashcompletions += ['scriptlive']
2444
2445 exe = executable(
2446 'scriptreplay',
2447 scriptreplay_sources,
2448 include_directories : includes,
2449 link_with : [lib_common],
2450 dependencies : [math_libs],
2451 install_dir : usrbin_exec_dir,
2452 install : true)
2453 exes += exe
2454 manadocs += ['term-utils/scriptreplay.1.adoc']
2455 bashcompletions += ['scriptreplay']
2456
2457 opt = not get_option('build-agetty').disabled()
2458 exe = executable(
2459 'agetty',
2460 agetty_sources,
2461 include_directories : includes,
2462 link_with : [lib_common, logindefs_c],
2463 dependencies : [BSD ? lib_util : [], lib_systemd],
2464 install_dir : sbindir,
2465 install : opt,
2466 build_by_default : opt)
2467 if opt
2468 exes += exe
2469 manadocs += ['term-utils/agetty.8.adoc']
2470 endif
2471
2472 opt = not get_option('build-setterm').disabled()
2473 exe = executable(
2474 'setterm',
2475 setterm_sources,
2476 include_directories : includes,
2477 link_with : [lib_common],
2478 dependencies : [curses_libs],
2479 install_dir : usrbin_exec_dir,
2480 install : opt,
2481 build_by_default : opt)
2482 if opt
2483 exes += exe
2484 manadocs += ['term-utils/setterm.1.adoc']
2485 bashcompletions += ['setterm']
2486 endif
2487
2488 opt = not get_option('build-mesg').disabled()
2489 exe = executable(
2490 'mesg',
2491 mesg_sources,
2492 include_directories : includes,
2493 link_with : [lib_common],
2494 install_dir : usrbin_exec_dir,
2495 install : opt,
2496 build_by_default : opt)
2497 if opt
2498 exes += exe
2499 manadocs += ['term-utils/mesg.1.adoc']
2500 bashcompletions += ['mesg']
2501 endif
2502
2503 opt = not get_option('build-wall').disabled()
2504 exe = executable(
2505 'wall',
2506 wall_sources,
2507 include_directories : includes,
2508 link_with : [lib_common],
2509 dependencies : [lib_systemd],
2510 install_dir : usrbin_exec_dir,
2511 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2512 install : opt,
2513 build_by_default : opt)
2514 if opt
2515 exes += exe
2516 manadocs += ['term-utils/wall.1.adoc']
2517 bashcompletions += ['wall']
2518 endif
2519
2520 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2521 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2522
2523 opt = not get_option('build-write').disabled()
2524 exe = executable(
2525 'write',
2526 write_sources,
2527 include_directories : includes,
2528 link_with : [lib_common],
2529 dependencies : [lib_systemd],
2530 install_dir : usrbin_exec_dir,
2531 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2532 install : opt,
2533 build_by_default : opt)
2534 if opt
2535 exes += exe
2536 manadocs += ['term-utils/write.1.adoc']
2537 bashcompletions += ['write']
2538 endif
2539
2540 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2541 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2542
2543 opt = not get_option('build-login').disabled()
2544 exe = executable(
2545 'login',
2546 login_sources,
2547 include_directories : includes,
2548 link_with : [lib_common, logindefs_c],
2549 dependencies : [lib_pam,
2550 lib_audit,
2551 lib_selinux],
2552 install : opt,
2553 build_by_default : opt)
2554 if not is_disabler(exe)
2555 exes += exe
2556 manadocs += ['login-utils/login.1.adoc']
2557 endif
2558
2559 opt = not get_option('build-sulogin').disabled()
2560 exe = executable(
2561 'sulogin',
2562 sulogin_sources,
2563 include_directories : includes,
2564 link_with : [lib_common],
2565 dependencies : [lib_crypt,
2566 lib_selinux],
2567 install_dir : sbindir,
2568 install : opt,
2569 build_by_default : opt)
2570 if not is_disabler(exe)
2571 exes += exe
2572 manadocs += ['login-utils/sulogin.8.adoc']
2573 endif
2574
2575 exe = executable(
2576 'cal',
2577 cal_sources,
2578 include_directories : includes,
2579 link_with : [lib_common,
2580 lib_tcolors],
2581 dependencies : [curses_libs],
2582 install_dir : usrbin_exec_dir,
2583 install : true)
2584 exes += exe
2585 manadocs += ['misc-utils/cal.1.adoc']
2586 bashcompletions += ['cal']
2587
2588 opt = not get_option('build-logger').disabled()
2589 exe = executable(
2590 'logger',
2591 logger_sources,
2592 include_directories : includes,
2593 link_with : [lib_common],
2594 dependencies : [lib_systemd],
2595 install_dir : usrbin_exec_dir,
2596 install : opt,
2597 build_by_default : opt)
2598 if opt and not is_disabler(exe)
2599 exes += exe
2600 manadocs += ['misc-utils/logger.1.adoc']
2601 bashcompletions += ['logger']
2602 endif
2603
2604 exe = executable(
2605 'test_logger',
2606 logger_sources,
2607 include_directories : includes,
2608 c_args : '-DTEST_LOGGER',
2609 link_with : [lib_common],
2610 dependencies : [lib_systemd],
2611 build_by_default: program_tests)
2612 if not is_disabler(exe)
2613 exes += exe
2614 endif
2615
2616 exe = executable(
2617 'look',
2618 look_sources,
2619 include_directories : includes,
2620 install_dir : usrbin_exec_dir,
2621 install : true)
2622 exes += exe
2623 manadocs += ['misc-utils/look.1.adoc']
2624 bashcompletions += ['look']
2625
2626 exe = executable(
2627 'mcookie',
2628 mcookie_sources,
2629 include_directories : includes,
2630 link_with : [lib_common],
2631 install_dir : usrbin_exec_dir,
2632 install : true)
2633 exes += exe
2634 manadocs += ['misc-utils/mcookie.1.adoc']
2635 bashcompletions += ['mcookie']
2636
2637 if build_liblastlog2
2638 exe = executable(
2639 'lastlog2',
2640 lastlog2_sources,
2641 include_directories : includes,
2642 link_with : [lib_common, lib_lastlog2],
2643 install_dir : usrbin_exec_dir,
2644 install : true)
2645 exes += exe
2646 manadocs += ['misc-utils/lastlog2.8.adoc']
2647 bashcompletions += ['lastlog2']
2648 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2649 'liblastlog2/man/ll2_write_entry.3.adoc',
2650 'liblastlog2/man/ll2_read_entry.3.adoc',
2651 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2652 'liblastlog2/man/ll2_read_all.3.adoc',
2653 'liblastlog2/man/ll2_remove_entry.3.adoc',
2654 'liblastlog2/man/ll2_rename_user.3.adoc',
2655 'liblastlog2/man/ll2_update_login_time.3.adoc'
2656 ]
2657 endif
2658
2659 exe = executable(
2660 'namei',
2661 namei_sources,
2662 include_directories : includes,
2663 dependencies : [lib_selinux],
2664 install_dir : usrbin_exec_dir,
2665 install : true)
2666 exes += exe
2667 manadocs += ['misc-utils/namei.1.adoc']
2668 bashcompletions += ['namei']
2669
2670 exe = executable(
2671 'whereis',
2672 whereis_sources,
2673 include_directories : includes,
2674 link_with : [lib_common],
2675 install_dir : usrbin_exec_dir,
2676 install : true)
2677 exes += exe
2678 manadocs += ['misc-utils/whereis.1.adoc']
2679 bashcompletions += ['whereis']
2680
2681 exe = executable(
2682 'lslocks',
2683 lslocks_sources,
2684 include_directories : includes,
2685 link_with : [lib_common,
2686 lib_mount,
2687 lib_smartcols],
2688 install_dir : usrbin_exec_dir,
2689 install : true)
2690 if not is_disabler(exe)
2691 exes += exe
2692 manadocs += ['misc-utils/lslocks.8.adoc']
2693 bashcompletions += ['lslocks']
2694 endif
2695
2696 exe = executable(
2697 'lsblk',
2698 lsblk_sources,
2699 include_directories : includes,
2700 link_with : [lib_common,
2701 lib_blkid,
2702 lib_mount,
2703 lib_tcolors,
2704 lib_smartcols],
2705 dependencies : lib_udev,
2706 install : true)
2707 if not is_disabler(exe)
2708 exes += exe
2709 manadocs += ['misc-utils/lsblk.8.adoc']
2710 bashcompletions += ['lsblk']
2711 endif
2712
2713 errnos_h = custom_target('errnos.h',
2714 input : 'tools/all_errnos',
2715 output : 'errnos.h',
2716 command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
2717 )
2718
2719 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2720 exe = executable(
2721 'lsfd',
2722 lsfd_sources, errnos_h,
2723 include_directories : includes,
2724 link_with : [lib_common,
2725 lib_smartcols],
2726 dependencies : [lib_rt],
2727 install_dir : usrbin_exec_dir,
2728 install : opt,
2729 build_by_default : opt)
2730 if opt and not is_disabler(exe)
2731 exes += exe
2732 manadocs += ['misc-utils/lsfd.1.adoc']
2733 endif
2734
2735 exe = executable(
2736 'uuidgen',
2737 uuidgen_sources,
2738 include_directories : includes,
2739 link_with : [lib_common,
2740 lib_uuid],
2741 install_dir : usrbin_exec_dir,
2742 install : true)
2743 if not is_disabler(exe)
2744 exes += exe
2745 manadocs += ['misc-utils/uuidgen.1.adoc']
2746 bashcompletions += ['uuidgen']
2747 endif
2748
2749 exe = executable(
2750 'uuidparse',
2751 uuidparse_sources,
2752 include_directories : includes,
2753 link_with : [lib_common,
2754 lib_uuid,
2755 lib_smartcols],
2756 install_dir : usrbin_exec_dir,
2757 install : true)
2758 if not is_disabler(exe)
2759 exes += exe
2760 manadocs += ['misc-utils/uuidparse.1.adoc']
2761 bashcompletions += ['uuidparse']
2762 endif
2763
2764 opt = build_uuidd
2765 exe = executable(
2766 'uuidd',
2767 uuidd_sources,
2768 include_directories : includes,
2769 link_with : [lib_common,
2770 lib_uuid],
2771 dependencies : [realtime_libs,
2772 lib_systemd],
2773 install_dir : usrsbin_exec_dir,
2774 install : opt,
2775 build_by_default : opt)
2776 exe2 = executable(
2777 'test_uuidd',
2778 test_uuidd_sources,
2779 include_directories : includes,
2780 link_with : [lib_common,
2781 lib_uuid],
2782 dependencies : thread_libs,
2783 build_by_default : opt and program_tests)
2784 if not is_disabler(exe)
2785 exes += [exe, exe2]
2786 manadocs += ['misc-utils/uuidd.8.adoc']
2787 bashcompletions += ['uuidd']
2788 endif
2789
2790 opt = build_libblkid
2791 exe = executable(
2792 'blkid',
2793 blkid_sources,
2794 include_directories : includes,
2795 link_with : [lib_common,
2796 lib_blkid],
2797 install_dir : sbindir,
2798 install : opt,
2799 build_by_default : opt)
2800 if opt and not is_disabler(exe)
2801 exes += exe
2802 manadocs += ['misc-utils/blkid.8.adoc']
2803 bashcompletions += ['blkid']
2804 endif
2805
2806 opt = opt and 'blkid' in static_programs
2807 exe = executable(
2808 'blkid.static',
2809 blkid_sources,
2810 include_directories : includes,
2811 link_with : [lib_common,
2812 lib_blkid_static],
2813 install_dir : sbindir,
2814 install : opt,
2815 build_by_default : opt)
2816 if opt and not is_disabler(exe)
2817 exes += exe
2818 endif
2819
2820 exe = executable(
2821 'sample-mkfs',
2822 'libblkid/samples/mkfs.c',
2823 include_directories : includes,
2824 link_with : lib_blkid)
2825 if not is_disabler(exe)
2826 exes += exe
2827 endif
2828
2829 exe = executable(
2830 'sample-partitions',
2831 'libblkid/samples/partitions.c',
2832 include_directories : includes,
2833 link_with : lib_blkid)
2834 if not is_disabler(exe)
2835 exes += exe
2836 endif
2837
2838 exe = executable(
2839 'sample-superblocks',
2840 'libblkid/samples/superblocks.c',
2841 include_directories : includes,
2842 link_with : lib_blkid)
2843 if not is_disabler(exe)
2844 exes += exe
2845 endif
2846
2847 exe = executable(
2848 'sample-topology',
2849 'libblkid/samples/topology.c',
2850 include_directories : includes,
2851 link_with : lib_blkid)
2852 if not is_disabler(exe)
2853 exes += exe
2854 endif
2855
2856 exe = executable(
2857 'test_blkid_fuzz_sample',
2858 'libblkid/src/fuzz.c',
2859 include_directories: includes,
2860 link_with: lib_blkid,
2861 build_by_default: program_tests)
2862 if not is_disabler(exe)
2863 exes += exe
2864 endif
2865
2866 ############################################################
2867
2868 exe = executable(
2869 'findfs',
2870 findfs_sources,
2871 include_directories : includes,
2872 link_with : [lib_blkid],
2873 install_dir : sbindir,
2874 install : true)
2875 if not is_disabler(exe)
2876 exes += exe
2877 manadocs += ['misc-utils/findfs.8.adoc']
2878 bashcompletions += ['findfs']
2879 endif
2880
2881 exe = executable(
2882 'wipefs',
2883 wipefs_sources,
2884 include_directories : includes,
2885 link_with : [lib_common,
2886 lib_blkid,
2887 lib_smartcols],
2888 install_dir : sbindir,
2889 install : true)
2890 if not is_disabler(exe)
2891 exes += exe
2892 manadocs += ['misc-utils/wipefs.8.adoc']
2893 bashcompletions += ['wipefs']
2894 endif
2895
2896 exe = executable(
2897 'findmnt',
2898 findmnt_sources,
2899 include_directories : includes,
2900 link_with : [lib_common,
2901 lib_blkid,
2902 lib_mount,
2903 lib_smartcols],
2904 dependencies : [lib_udev],
2905 install : true)
2906 if not is_disabler(exe)
2907 exes += exe
2908 manadocs += ['misc-utils/findmnt.8.adoc']
2909 bashcompletions += ['findmnt']
2910 endif
2911
2912 exe = executable(
2913 'kill',
2914 kill_sources,
2915 include_directories : includes,
2916 link_with : [lib_common],
2917 install : true)
2918 if not is_disabler(exe)
2919 exes += exe
2920 manadocs += ['misc-utils/kill.1.adoc']
2921 endif
2922
2923 opt = not get_option('build-rename').disabled()
2924 exe = executable(
2925 'rename',
2926 rename_sources,
2927 include_directories : includes,
2928 install_dir : usrbin_exec_dir,
2929 install : opt,
2930 build_by_default : opt)
2931 if opt and not is_disabler(exe)
2932 exes += exe
2933 manadocs += ['misc-utils/rename.1.adoc']
2934 bashcompletions += ['rename']
2935 endif
2936
2937 exe = executable(
2938 'getopt',
2939 getopt_sources,
2940 include_directories : includes,
2941 link_with : [lib_common],
2942 install_dir : usrbin_exec_dir,
2943 install : true)
2944 exes += exe
2945 manadocs += ['misc-utils/getopt.1.adoc']
2946 bashcompletions += ['getopt']
2947
2948 exe = executable(
2949 'fincore',
2950 fincore_sources,
2951 include_directories : includes,
2952 link_with : [lib_common,
2953 lib_smartcols],
2954 install_dir : usrbin_exec_dir,
2955 install : true)
2956 if not is_disabler(exe)
2957 exes += exe
2958 manadocs += ['misc-utils/fincore.1.adoc']
2959 bashcompletions += ['fincore']
2960 endif
2961
2962 exe = executable(
2963 'hardlink',
2964 hardlink_sources,
2965 include_directories : includes,
2966 link_with : [lib_common],
2967 install_dir : usrbin_exec_dir,
2968 install : true)
2969 if not is_disabler(exe)
2970 exes += exe
2971 manadocs += ['misc-utils/hardlink.1.adoc']
2972 bashcompletions += ['hardlink']
2973 endif
2974
2975 opt = not get_option('build-pipesz').disabled()
2976 exe = executable(
2977 'pipesz',
2978 pipesz_sources,
2979 include_directories : includes,
2980 link_with : [lib_common],
2981 install_dir : usrbin_exec_dir,
2982 install : true)
2983 if opt and not is_disabler(exe)
2984 exes += exe
2985 manadocs += ['misc-utils/pipesz.1.adoc']
2986 bashcompletions += ['pipesz']
2987 endif
2988
2989 exe = executable(
2990 'test_cal',
2991 cal_sources,
2992 include_directories : includes,
2993 c_args : '-DTEST_CAL',
2994 link_with : [lib_common,
2995 lib_tcolors],
2996 dependencies : [curses_libs],
2997 build_by_default: program_tests)
2998 if not is_disabler(exe)
2999 exes += exe
3000 endif
3001
3002 exe = executable(
3003 'fadvise',
3004 fadvise_sources,
3005 include_directories : includes,
3006 link_with : [lib_common],
3007 install_dir : usrbin_exec_dir,
3008 install : true)
3009 if not is_disabler(exe)
3010 exes += exe
3011 manadocs += ['misc-utils/fadvise.1.adoc']
3012 bashcompletions += ['fadvise']
3013 endif
3014
3015 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3016 exe = executable(
3017 'waitpid',
3018 waitpid_sources,
3019 include_directories : includes,
3020 link_with : [lib_common],
3021 install_dir : usrbin_exec_dir,
3022 install : true)
3023 if not is_disabler(exe)
3024 exes += exe
3025 manadocs += ['misc-utils/waitpid.1.adoc']
3026 bashcompletions += ['waitpid']
3027 endif
3028 endif
3029
3030 syscalls_h = custom_target('syscalls.h',
3031 input : 'tools/all_syscalls',
3032 output : 'syscalls.h',
3033 command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
3034 )
3035
3036 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3037 exe = executable(
3038 'enosys',
3039 'misc-utils/enosys.c', syscalls_h, errnos_h,
3040 include_directories : includes,
3041 link_with : [lib_common],
3042 install_dir : usrbin_exec_dir,
3043 install : true)
3044 if not is_disabler(exe)
3045 exes += exe
3046 manadocs += ['misc-utils/enosys.1.adoc']
3047 bashcompletions += ['enosys']
3048 endif
3049 endif
3050
3051 exe = executable(
3052 'lsclocks',
3053 lsclocks_sources,
3054 include_directories : includes,
3055 link_with : [lib_common, lib_smartcols],
3056 install_dir : usrbin_exec_dir,
3057 install : true)
3058 if not is_disabler(exe)
3059 exes += exe
3060 manadocs += ['misc-utils/lsclocks.1.adoc']
3061 bashcompletions += ['lsclocks']
3062 endif
3063
3064 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3065 exe = executable(
3066 'exch',
3067 exch_sources,
3068 include_directories : includes,
3069 link_with : [lib_common],
3070 install_dir : usrbin_exec_dir,
3071 install : true)
3072 if not is_disabler(exe)
3073 exes += exe
3074 manadocs += ['misc-utils/exch.1.adoc']
3075 bashcompletions += ['exch']
3076 endif
3077 endif
3078
3079 ############################################################
3080
3081 opt = not get_option('build-schedutils').disabled()
3082 exe = executable(
3083 'chrt',
3084 'schedutils/chrt.c',
3085 include_directories : includes,
3086 link_with : lib_common,
3087 install_dir : usrbin_exec_dir,
3088 install : opt,
3089 build_by_default : opt)
3090
3091 exe2 = executable(
3092 'ionice',
3093 'schedutils/ionice.c',
3094 include_directories : includes,
3095 link_with : lib_common,
3096 install_dir : usrbin_exec_dir,
3097 install : opt,
3098 build_by_default : opt)
3099
3100 exe3 = executable(
3101 'taskset',
3102 'schedutils/taskset.c',
3103 include_directories : includes,
3104 link_with : lib_common,
3105 install_dir : usrbin_exec_dir,
3106 install : opt,
3107 build_by_default : opt)
3108
3109 exe4 = executable(
3110 'uclampset',
3111 'schedutils/uclampset.c',
3112 include_directories : includes,
3113 link_with : lib_common,
3114 install_dir : usrbin_exec_dir,
3115 install : opt,
3116 build_by_default : opt)
3117
3118 if opt and not is_disabler(exe)
3119 exes += [exe, exe2, exe3, exe4]
3120 manadocs += ['schedutils/chrt.1.adoc',
3121 'schedutils/ionice.1.adoc',
3122 'schedutils/taskset.1.adoc',
3123 'schedutils/uclampset.1.adoc']
3124 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3125 endif
3126
3127 ############################################################
3128
3129 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3130
3131 exe = executable(
3132 'test_ttyutils',
3133 'lib/ttyutils.c',
3134 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3135 include_directories : dir_include,
3136 link_with : lib_common,
3137 build_by_default: program_tests)
3138 exes += exe
3139
3140 exe = executable(
3141 'test_blkdev',
3142 'lib/blkdev.c',
3143 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3144 include_directories : dir_include,
3145 link_with : lib_common,
3146 build_by_default: program_tests)
3147 exes += exe
3148
3149 exe = executable(
3150 'test_ismounted',
3151 'lib/ismounted.c',
3152 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3153 include_directories : dir_include,
3154 link_with : lib_common,
3155 build_by_default: program_tests)
3156 exes += exe
3157
3158 exe = executable(
3159 'test_mangle',
3160 'lib/mangle.c',
3161 c_args : ['-DTEST_PROGRAM_MANGLE'],
3162 include_directories : dir_include,
3163 build_by_default: program_tests)
3164 exes += exe
3165
3166 exe = executable(
3167 'test_strutils',
3168 'lib/strutils.c',
3169 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3170 include_directories : dir_include,
3171 build_by_default: program_tests)
3172 exes += exe
3173
3174 exe = executable(
3175 'test_colors',
3176 'lib/colors.c',
3177 'lib/color-names.c',
3178 c_args : ['-DTEST_PROGRAM_COLORS'],
3179 include_directories : dir_include,
3180 link_with : [lib_common, lib_tcolors],
3181 build_by_default: program_tests)
3182 exes += exe
3183
3184 exe = executable(
3185 'test_randutils',
3186 'lib/randutils.c',
3187 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3188 include_directories : dir_include,
3189 build_by_default: program_tests)
3190 exes += exe
3191
3192 if conf.get('HAVE_OPENAT').to_string() == '1' \
3193 and conf.get('HAVE_DIRFD').to_string() == '1'
3194 exe = executable(
3195 'test_procfs',
3196 'lib/procfs.c',
3197 c_args : ['-DTEST_PROGRAM_PROCFS'],
3198 include_directories : dir_include,
3199 link_with : lib_common,
3200 build_by_default: program_tests)
3201 exes += exe
3202
3203 exe = executable(
3204 'test_path',
3205 'lib/path.c',
3206 'lib/fileutils.c',
3207 have_cpu_set_t ? 'lib/cpuset.c' : [],
3208 c_args : ['-DTEST_PROGRAM_PATH'],
3209 include_directories : dir_include,
3210 link_with : lib_common,
3211 build_by_default: program_tests)
3212 exes += exe
3213 endif
3214
3215 if conf.get('HAVE_PTY').to_string() == '1'
3216 exe = executable(
3217 'test_pty',
3218 pty_session_c,
3219 monotonic_c,
3220 c_args : ['-DTEST_PROGRAM_PTY'],
3221 include_directories : dir_include,
3222 link_with : [lib_common],
3223 dependencies : [lib_m,
3224 realtime_libs,
3225 lib_util],
3226 build_by_default: program_tests)
3227 exes += exe
3228 endif
3229
3230 if LINUX
3231 exe = executable(
3232 'test_cpuset',
3233 'lib/cpuset.c',
3234 c_args : ['-DTEST_PROGRAM_CPUSET'],
3235 include_directories : dir_include,
3236 build_by_default: program_tests)
3237 exes += exe
3238 endif
3239
3240 exe = executable(
3241 'test_sysfs',
3242 'lib/sysfs.c',
3243 'lib/path.c',
3244 'lib/buffer.c',
3245 'lib/mbsalign.c',
3246 'lib/fileutils.c',
3247 have_cpu_set_t ? 'lib/cpuset.c' : [],
3248 c_args : ['-DTEST_PROGRAM_SYSFS'],
3249 include_directories : dir_include,
3250 build_by_default: program_tests)
3251 exes += exe
3252
3253 exe = executable(
3254 'test_pager',
3255 'lib/pager.c',
3256 c_args : ['-DTEST_PROGRAM_PAGER'],
3257 include_directories : dir_include,
3258 build_by_default: program_tests)
3259 exes += exe
3260
3261 exe = executable(
3262 'test_linux_version',
3263 'lib/linux_version.c',
3264 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3265 include_directories : dir_include,
3266 build_by_default: program_tests)
3267 exes += exe
3268
3269 exe = executable(
3270 'test_fileutils',
3271 'lib/fileutils.c',
3272 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3273 include_directories : dir_include,
3274 build_by_default: program_tests)
3275 exes += exe
3276
3277 exe = executable(
3278 'test_canonicalize',
3279 'lib/canonicalize.c',
3280 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3281 include_directories : dir_include,
3282 build_by_default: program_tests)
3283 exes += exe
3284
3285 exe = executable(
3286 'test_timeutils',
3287 'lib/timeutils.c',
3288 'lib/strutils.c',
3289 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3290 include_directories : dir_include,
3291 build_by_default: program_tests)
3292 exes += exe
3293
3294 exe = executable(
3295 'test_pwdutils',
3296 'lib/pwdutils.c',
3297 c_args : ['-DTEST_PROGRAM'],
3298 include_directories : dir_include,
3299 link_with : lib_common,
3300 build_by_default: program_tests)
3301 exes += exe
3302
3303 exe = executable(
3304 'test_logindefs',
3305 'lib/logindefs.c',
3306 c_args : ['-DTEST_PROGRAM'],
3307 include_directories : dir_include,
3308 link_with : [lib_common, logindefs_c],
3309 build_by_default: program_tests)
3310 exes += exe
3311
3312
3313 ############################################################
3314
3315 exe = executable(
3316 'test_uuid_parser',
3317 'libuuid/src/test_uuid.c',
3318 include_directories : [dir_include, dir_libuuid],
3319 link_with : lib_uuid,
3320 dependencies : socket_libs,
3321 build_by_default: program_tests)
3322 if not is_disabler(exe)
3323 exes += exe
3324 endif
3325
3326 ############################################################
3327
3328 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3329 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3330
3331 exe = executable(
3332 'test_fdisk_ask',
3333 'libfdisk/src/ask.c',
3334 c_args : libfdisk_tests_cflags,
3335 include_directories : lib_fdisk_includes,
3336 link_with : libfdisk_tests_ldadd,
3337 build_by_default: program_tests)
3338 if not is_disabler(exe)
3339 exes += exe
3340 endif
3341
3342 exe = executable(
3343 'test_fdisk_gpt',
3344 'libfdisk/src/gpt.c',
3345 c_args : libfdisk_tests_cflags,
3346 include_directories : lib_fdisk_includes,
3347 link_with : libfdisk_tests_ldadd,
3348 build_by_default: program_tests)
3349 if not is_disabler(exe)
3350 exes += exe
3351 endif
3352
3353 exe = executable(
3354 'test_fdisk_utils',
3355 'libfdisk/src/utils.c',
3356 c_args : libfdisk_tests_cflags,
3357 include_directories : lib_fdisk_includes,
3358 link_with : libfdisk_tests_ldadd,
3359 build_by_default: program_tests)
3360 if not is_disabler(exe)
3361 exes += exe
3362 endif
3363
3364 exe = executable(
3365 'test_fdisk_script',
3366 'libfdisk/src/script.c',
3367 c_args : libfdisk_tests_cflags,
3368 include_directories : lib_fdisk_includes,
3369 link_with : libfdisk_tests_ldadd,
3370 build_by_default: program_tests)
3371 if not is_disabler(exe)
3372 exes += exe
3373 endif
3374
3375 exe = executable(
3376 'test_fdisk_version',
3377 'libfdisk/src/version.c',
3378 c_args : libfdisk_tests_cflags,
3379 include_directories : lib_fdisk_includes,
3380 link_with : libfdisk_tests_ldadd,
3381 build_by_default: program_tests)
3382 if not is_disabler(exe)
3383 exes += exe
3384 endif
3385
3386 exe = executable(
3387 'test_fdisk_item',
3388 'libfdisk/src/item.c',
3389 c_args : libfdisk_tests_cflags,
3390 include_directories : lib_fdisk_includes,
3391 link_with : libfdisk_tests_ldadd,
3392 build_by_default: program_tests)
3393 if not is_disabler(exe)
3394 exes += exe
3395 endif
3396
3397 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3398
3399 exe = executable(
3400 'sample-fdisk-mkpart',
3401 'libfdisk/samples/mkpart.c',
3402 include_directories : lib_fdisk_includes,
3403 link_with : sample_fdisk_ldadd)
3404 if not is_disabler(exe)
3405 exes += exe
3406 endif
3407
3408 exe = executable(
3409 'sample-fdisk-mkpart-fullspec',
3410 'libfdisk/samples/mkpart-fullspec.c',
3411 include_directories : lib_fdisk_includes,
3412 link_with : sample_fdisk_ldadd)
3413 if not is_disabler(exe)
3414 exes += exe
3415 endif
3416
3417 ############################################################
3418
3419 exe = executable(
3420 'test_cap',
3421 'tests/helpers/test_cap.c',
3422 include_directories : includes,
3423 dependencies : [lib_cap_ng],
3424 build_by_default: program_tests)
3425 if not is_disabler(exe)
3426 exes += exe
3427 endif
3428
3429 exe = executable(
3430 'test_mbsencode',
3431 'tests/helpers/test_mbsencode.c',
3432 include_directories : includes,
3433 link_with : lib_common,
3434 build_by_default: program_tests)
3435 exes += exe
3436
3437 exe = executable(
3438 'test_byteswap',
3439 'tests/helpers/test_byteswap.c',
3440 include_directories : includes,
3441 build_by_default: program_tests)
3442 exes += exe
3443
3444 exe = executable(
3445 'test_md5',
3446 'tests/helpers/test_md5.c',
3447 md5_c,
3448 include_directories : includes,
3449 build_by_default: program_tests)
3450 exes += exe
3451
3452 exe = executable(
3453 'test_sha1',
3454 'tests/helpers/test_sha1.c',
3455 sha1_c,
3456 include_directories : includes,
3457 build_by_default: program_tests)
3458 exes += exe
3459
3460 exe = executable(
3461 'test_pathnames',
3462 'tests/helpers/test_pathnames.c',
3463 include_directories : includes,
3464 build_by_default: program_tests)
3465 exes += exe
3466
3467 exe = executable(
3468 'test_strerror',
3469 'tests/helpers/test_strerror.c',
3470 include_directories : includes,
3471 build_by_default: program_tests)
3472 exes += exe
3473
3474 exe = executable(
3475 'test_sysinfo',
3476 'tests/helpers/test_sysinfo.c',
3477 include_directories : includes,
3478 build_by_default: program_tests)
3479 exes += exe
3480
3481 exe = executable(
3482 'test_sigreceive',
3483 'tests/helpers/test_sigreceive.c',
3484 include_directories : includes,
3485 link_with : lib_common,
3486 build_by_default: program_tests)
3487 exes += exe
3488
3489 exe = executable(
3490 'test_tiocsti',
3491 'tests/helpers/test_tiocsti.c',
3492 include_directories : includes,
3493 build_by_default: program_tests)
3494 exes += exe
3495
3496 exe = executable(
3497 'test_uuid_namespace',
3498 'tests/helpers/test_uuid_namespace.c',
3499 predefined_c,
3500 unpack_c,
3501 unparse_c,
3502 include_directories : includes,
3503 build_by_default: program_tests)
3504 exes += exe
3505
3506 if LINUX and lib_rt.found()
3507 exe = executable(
3508 'test_mkfds',
3509 'tests/helpers/test_mkfds.c',
3510 'tests/helpers/test_mkfds.h',
3511 'tests/helpers/test_mkfds_ppoll.c',
3512 include_directories : includes,
3513 dependencies : [lib_rt],
3514 build_by_default: program_tests)
3515 exes += exe
3516 endif
3517
3518 exe = executable(
3519 'test_enosys',
3520 'tests/helpers/test_enosys.c',
3521 include_directories : includes,
3522 build_by_default: program_tests)
3523 exes += exe
3524
3525 ############################################################
3526
3527 if conf.get('HAVE_OPENAT').to_string() == '1'
3528 exe = executable(
3529 'sample-scols-tree',
3530 'libsmartcols/samples/tree.c',
3531 include_directories : includes,
3532 link_with : [lib_smartcols, lib_common],
3533 build_by_default: program_tests)
3534 if not is_disabler(exe)
3535 exes += exe
3536 endif
3537 endif
3538
3539 exe = executable(
3540 'sample-scols-title',
3541 'libsmartcols/samples/title.c',
3542 include_directories : includes,
3543 link_with : [lib_smartcols, lib_common])
3544 if not is_disabler(exe)
3545 exes += exe
3546 endif
3547
3548 exe = executable(
3549 'sample-scols-wrap',
3550 'libsmartcols/samples/wrap.c',
3551 include_directories : includes,
3552 link_with : [lib_smartcols, lib_common])
3553 if not is_disabler(exe)
3554 exes += exe
3555 endif
3556
3557 exe = executable(
3558 'sample-scols-continuous',
3559 'libsmartcols/samples/continuous.c',
3560 include_directories : includes,
3561 link_with : [lib_smartcols, lib_common])
3562 if not is_disabler(exe)
3563 exes += exe
3564 endif
3565
3566 exe = executable(
3567 'sample-scols-continuous-json',
3568 'libsmartcols/samples/continuous-json.c',
3569 include_directories : includes,
3570 link_with : [lib_smartcols, lib_common])
3571 if not is_disabler(exe)
3572 exes += exe
3573 endif
3574
3575 exe = executable(
3576 'sample-scols-maxout',
3577 'libsmartcols/samples/maxout.c',
3578 include_directories : includes,
3579 link_with : [lib_smartcols, lib_common])
3580 if not is_disabler(exe)
3581 exes += exe
3582 endif
3583
3584 exe = executable(
3585 'sample-scols-fromfile',
3586 'libsmartcols/samples/fromfile.c',
3587 include_directories : includes,
3588 link_with : [lib_smartcols, lib_common])
3589 if not is_disabler(exe)
3590 exes += exe
3591 endif
3592
3593 exe = executable(
3594 'sample-scols-grouping-simple',
3595 'libsmartcols/samples/grouping-simple.c',
3596 include_directories : includes,
3597 link_with : [lib_smartcols, lib_common])
3598 if not is_disabler(exe)
3599 exes += exe
3600 endif
3601
3602 exe = executable(
3603 'sample-scols-grouping-overlay',
3604 'libsmartcols/samples/grouping-overlay.c',
3605 include_directories : includes,
3606 link_with : [lib_smartcols, lib_common])
3607 if not is_disabler(exe)
3608 exes += exe
3609 endif
3610
3611 exe = executable(
3612 'test_boilerplate',
3613 'Documentation/boilerplate.c',
3614 include_directories : includes,
3615 build_by_default: program_tests)
3616 if not is_disabler(exe)
3617 exes += exe
3618 endif
3619
3620 ############################################################
3621
3622 # Let the test runner know whether we're running under asan and export
3623 # some paths. We use a file on disk so that it is possible to run the
3624 # test scripts from commandline without setting any variables.
3625 configure_file(output : 'meson.conf',
3626 capture : true,
3627 command : ['echo',
3628 '''asan=@0@
3629 PYTHON=@1@
3630 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3631 python.full_path())])
3632
3633 run_sh = find_program('tests/run.sh')
3634 run_target(
3635 'check',
3636 command : [run_sh,
3637 '--srcdir=' + meson.current_source_dir(),
3638 '--builddir=' + meson.current_build_dir(),
3639 '--parallel',
3640 '--nonroot'],
3641 depends : exes)
3642
3643
3644 manadocs += ['lib/terminal-colors.d.5.adoc']
3645 manadocs += ['libblkid/libblkid.3.adoc']
3646
3647 if build_libuuid
3648 manadocs += [
3649 'libuuid/man/uuid.3.adoc',
3650 'libuuid/man/uuid_clear.3.adoc',
3651 'libuuid/man/uuid_compare.3.adoc',
3652 'libuuid/man/uuid_copy.3.adoc',
3653 'libuuid/man/uuid_generate.3.adoc',
3654 'libuuid/man/uuid_is_null.3.adoc',
3655 'libuuid/man/uuid_parse.3.adoc',
3656 'libuuid/man/uuid_time.3.adoc',
3657 'libuuid/man/uuid_unparse.3.adoc']
3658 manlinks += {
3659 'uuid_generate_random.3': 'uuid_generate.3',
3660 'uuid_generate_time.3': 'uuid_generate.3',
3661 'uuid_generate_time_safe.3': 'uuid_generate.3',
3662 }
3663 endif
3664
3665 asciidoctor = find_program('asciidoctor', required : false)
3666 if asciidoctor.found()
3667 foreach adoc : manadocs
3668 name = adoc.split('/')[-1]
3669 page = name.split('.adoc')[0]
3670 section = page.split('.')[-1]
3671 mandirn = join_paths(mandir, 'man' + section)
3672 input = adoc
3673
3674 custom_target(
3675 page,
3676 command : [ asciidoctor,
3677 '-b', 'manpage',
3678 '-a', 'VERSION=' + meson.project_version(),
3679 '-a', 'release-version=' + meson.project_version(),
3680 '-a', 'ADJTIME_PATH=/etc/adjtime',
3681 '-a', 'package-docdir=' + docdir,
3682 '--base-dir=' + meson.current_source_dir(),
3683 '--destination-dir=' + meson.current_build_dir(),
3684 '--load-path', '@SOURCE_ROOT@/tools',
3685 '--require', 'asciidoctor-includetracker',
3686 '@INPUT@'],
3687 input : input,
3688 output : [page],
3689 depfile : page + '.deps',
3690 install: true,
3691 install_dir : mandirn)
3692 endforeach
3693
3694 foreach link_name, target : manlinks
3695 link_section = link_name.split('.')[-1]
3696 target_section = target.split('.')[-1]
3697 meson.add_install_script(meson_make_manpage_stub,
3698 join_paths('man' + target_section, target),
3699 join_paths(mandir, 'man' + link_section, link_name))
3700 endforeach
3701 endif
3702
3703 if bash_completion.found()
3704 foreach completion : bashcompletions
3705 install_data(
3706 join_paths('bash-completion', completion),
3707 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3708 )
3709 endforeach
3710 foreach link_name, target : bashcompletionslinks
3711 meson.add_install_script(meson_make_symlink,
3712 target,
3713 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))
3714 endforeach
3715 endif