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