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