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