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