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