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