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