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