1 project('util-linux', 'c',
2 version : run_command('tools/git-version-gen', check: true).stdout(),
3 meson_version: '>=0.60.0',
11 pkgconfig = import('pkgconfig')
13 libblkid_version = '1.1.0'
14 libblkid_date = '01-Jun-2021'
15 libuuid_version = '1.3.0'
16 liblastlog2_version = '2.0.0'
17 libmount_version = '1.1.0'
18 libsmartcols_version = '1.1.0'
19 libfdisk_version = '1.1.0'
21 prefixdir = get_option('prefix')
22 if not prefixdir.startswith('/')
23 error('Prefix is not absolute: "@0@"'.format(prefixdir))
25 bindir = join_paths(prefixdir, get_option('bindir'))
26 sbindir = join_paths(prefixdir, get_option('sbindir'))
27 sysconfstaticdir = join_paths(prefixdir, 'lib')
28 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
29 mandir = join_paths(prefixdir, get_option('mandir'))
31 execprefixdir = prefixdir
32 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
33 usrbin_exec_dir = join_paths(execprefixdir, bindir)
34 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
35 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
37 vendordir = get_option('vendordir')
39 add_project_arguments('-D_GNU_SOURCE', language : 'c')
41 cc = meson.get_compiler('c')
43 conf = configuration_data()
44 conf.set_quoted('PACKAGE', meson.project_name())
45 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
46 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
47 conf.set_quoted('PACKAGE_STRING', package_string)
50 pc_version = meson.project_version().split('-')[0].split('.')
52 if pc_version.length() < 3
56 pc_version = '.'.join(pc_version)
58 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
59 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
61 conf.set('bindir', bindir)
62 conf.set('sbindir', sbindir)
63 conf.set('runstatedir', runstatedir)
64 conf.set('sysconfdir', sysconfdir)
65 conf.set('usrsbin_execdir', usrsbin_exec_dir)
66 conf.set('docdir', docdir)
67 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
68 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
69 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
70 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
72 conf.set_quoted('_PATH_VENDORDIR', vendordir)
73 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
75 build_libblkid = not get_option('build-libblkid').disabled()
76 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
77 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
79 build_libuuid = not get_option('build-libuuid').disabled()
80 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
81 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
83 build_liblastlog2 = not get_option('build-liblastlog2').disabled()
84 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
85 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
87 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
88 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
89 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
91 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
92 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
94 build_libmount = not get_option('build-libmount').disabled()
95 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
96 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
97 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
98 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
100 build_libsmartcols = not get_option('build-libsmartcols').disabled()
101 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
102 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
104 build_libfdisk = not get_option('build-libfdisk').disabled()
105 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
106 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
108 build_uuidd = not get_option('build-uuidd').disabled()
109 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
110 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
112 static_programs = get_option('static-programs')
113 need_static_libs = static_programs.length() > 0 # a rough estimate...
114 summary('static programs', static_programs)
116 LINUX = host_machine.system() in ['linux']
117 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
119 ############################################################
137 have = cc.compiles(code, name : 'wchar_t support')
138 if not have and get_option('widechar').enabled()
139 error('widechar support requested but unavailable')
141 if get_option('ncurses').enabled() and get_option('widechar').enabled()
142 error('widechar support is incompatible with non-wide ncurses')
144 conf.set('HAVE_WIDECHAR', have ? 1 : false)
186 linux/net_namespace.h
232 lib_m = cc.find_library('m')
234 lib_tinfo = dependency(
236 required : get_option('tinfo'))
238 lib_ncursesw = dependency(
240 required : get_option('ncursesw'))
241 if lib_ncursesw.found()
242 headers += ['ncursesw/ncurses.h',
246 lib_ncurses = disabler()
248 lib_ncurses = dependency(
250 required : get_option('ncurses'))
251 headers += ['ncurses.h',
255 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
256 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
257 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
259 lib_slang = dependency(
261 required : get_option('slang'))
263 headers += ['slang.h',
268 conf.set('HAVE_SLANG', lib_slang.found())
270 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
271 if curses_libs.found()
272 have = cc.has_function('use_default_colors', dependencies : curses_libs)
273 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
274 have = cc.has_function('resizeterm', dependencies : curses_libs)
275 conf.set('HAVE_RESIZETERM', have ? 1 : false)
282 required : get_option('zlib'))
284 lib_readline = dependency(
286 required : get_option('readline'))
287 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
289 lib_readline_static = dependency(
292 required : need_static_libs ? get_option('readline') : disabler())
294 if meson.version().version_compare('>= 0.59.0')
295 lib_intl = dependency(
297 required : get_option('nls'))
298 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
300 if get_option('nls').enabled()
301 error('nls is not supported with meson before 0.59.0')
303 lib_intl = dependency('', required : false)
306 lib_user = dependency(
309 required : get_option('libuser'))
310 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
312 lib_util = cc.find_library(
314 required : get_option('libutil'))
315 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
317 lib_utempter = cc.find_library(
319 required : get_option('libutempter'))
320 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
322 systemd = dependency(
324 required : get_option('systemd'))
326 lib_systemd = dependency(
328 required : get_option('systemd'))
329 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
330 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
332 have = cc.has_function(
333 'sd_session_get_username',
334 dependencies : lib_systemd)
335 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
337 lib_udev = dependency(
339 required : get_option('systemd'))
340 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
342 lib_crypt = cc.find_library('crypt')
344 lib_pam = cc.find_library('pam', required : get_option('build-login'))
345 if not lib_pam.found()
346 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
348 if not lib_pam.found()
349 lib_pam = cc.find_library('pam', required : get_option('build-su'))
351 if not lib_pam.found()
352 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
355 lib_pam_misc = cc.find_library('pam_misc')
356 lib_pam = [lib_pam, lib_pam_misc]
358 lib_pam_misc = declare_dependency()
361 lib_cryptsetup = dependency(
363 required : get_option('cryptsetup'))
364 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
366 if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
367 if meson.version().version_compare('>= 0.62.0')
368 lib_dl = dependency('dl')
370 lib_dl = cc.find_library('dl')
372 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
373 summary('cryptsetup support (dlopen)',
375 section : 'components')
377 summary('cryptsetup support',
378 lib_cryptsetup.found() ? 'enabled' : 'disabled',
379 section : 'components')
382 have = cc.has_function(
383 'crypt_activate_by_signed_key',
384 dependencies : lib_cryptsetup)
385 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
387 lib_cap_ng = dependency(
389 required : get_option('build-setpriv'))
390 if not lib_cap_ng.found()
391 lib_cap_ng = disabler()
394 lib_selinux = dependency(
397 required : get_option('selinux'))
398 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
400 lib_magic = dependency(
402 required : get_option('magic'))
403 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
405 lib_econf = dependency(
407 required : get_option('econf'))
408 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
410 lib_audit = dependency(
412 required : get_option('audit'))
413 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
415 conf.set('HAVE_SMACK', not get_option('smack').disabled())
417 foreach header : headers
418 have = cc.has_header(header)
419 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
422 header = 'linux/btrfs.h'
423 enable_btrfs = cc.has_header(header,
424 required : get_option('btrfs'))
425 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
426 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
428 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
433 have = cc.has_header(header,
435 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
438 have = cc.has_header('sched.h')
439 conf.set10('HAVE_DECL_CPU_ALLOC', have)
440 # We get -1 if the size cannot be determined
441 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
442 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
444 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
445 conf.set10('HAVE_ENVIRON_DECL', have)
447 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
448 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
450 have = cc.has_function('strsignal')
451 conf.set10('HAVE_STRSIGNAL_DECL', have)
453 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
454 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
456 have = cc.has_type('loff_t', prefix : '#include <sys/types.h>')
457 conf.set('HAVE_LOFF_T', have ? 1 : false)
459 have = cc.compiles('''
460 #define _GNU_SOURCE 1
461 #include <langinfo.h>
464 str = nl_langinfo (ALTMON_1);
465 str = nl_langinfo (ALTMON_2);
466 str = nl_langinfo (ALTMON_3);
467 str = nl_langinfo (ALTMON_4);
468 str = nl_langinfo (ALTMON_5);
469 str = nl_langinfo (ALTMON_6);
470 str = nl_langinfo (ALTMON_7);
471 str = nl_langinfo (ALTMON_8);
472 str = nl_langinfo (ALTMON_9);
473 str = nl_langinfo (ALTMON_10);
474 str = nl_langinfo (ALTMON_11);
475 str = nl_langinfo (ALTMON_12);
479 name : 'langinfo.h defines ALTMON_x constants')
480 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
482 have = cc.compiles('''
483 #define _GNU_SOURCE 1
484 #include <langinfo.h>
487 str = nl_langinfo (_NL_ABALTMON_1);
488 str = nl_langinfo (_NL_ABALTMON_2);
489 str = nl_langinfo (_NL_ABALTMON_3);
490 str = nl_langinfo (_NL_ABALTMON_4);
491 str = nl_langinfo (_NL_ABALTMON_5);
492 str = nl_langinfo (_NL_ABALTMON_6);
493 str = nl_langinfo (_NL_ABALTMON_7);
494 str = nl_langinfo (_NL_ABALTMON_8);
495 str = nl_langinfo (_NL_ABALTMON_9);
496 str = nl_langinfo (_NL_ABALTMON_10);
497 str = nl_langinfo (_NL_ABALTMON_11);
498 str = nl_langinfo (_NL_ABALTMON_12);
502 name : 'langinfo.h defines _NL_ABALTMON_x constants')
503 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
505 have = cc.compiles('''
506 #define _GNU_SOURCE 1
507 #include <langinfo.h>
510 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
514 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
515 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
548 landlock_create_ruleset
550 landlock_restrict_self
614 have = cc.has_function(func)
615 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
616 # This makes little sense, but is necessary to avoid warnings about
617 # redefined macros from Python.h, which uses this convention.
618 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
621 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
622 conf.set('AGETTY_RELOAD', have ? 1 : false)
624 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
627 have_dirfd = (cc.has_function('dirfd') or
628 cc.has_header_symbol('dirent.h', 'dirfd',
629 prefix : '#include <sys/types.h>'))
630 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
632 have_ddfd = cc.has_member('DIR', 'dd_fd',
634 #include <sys/types.h>
637 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
639 have = cc.has_member('struct tm', 'tm_gmtoff',
644 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
648 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
649 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
651 have = cc.has_member('struct termios', 'c_line',
652 prefix : '#include <termios.h>')
653 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
655 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
656 prefix : '#include <sys/stat.h>')
657 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
659 have = cc.has_member('struct statx', 'stx_mnt_id',
660 prefix : '#include <sys/stat.h>')
661 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
663 # replacement for AC_STRUCT_TIMEZONE
664 have = cc.has_member('struct tm', 'tm_zone',
665 prefix : '#include <time.h>')
666 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
668 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
669 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
671 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
672 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
674 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
675 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
680 extern char *tzname[];
683 return tzname ? 0 : 1;
685 '''.format(have ? 1 : 0)
686 have = cc.compiles(code, name : 'using tzname[]')
687 conf.set('HAVE_TZNAME', have ? 1 : false)
689 have = cc.sizeof('time_t', prefix : '#include <time.h>')
691 add_global_arguments('-D_TIME_BITS=64', language : 'c')
692 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
694 if get_option('allow-32bit-time')
695 warning('Could not make time_t 64bits wide')
697 error('Could not make time_t 64bits wide')
703 if not cc.has_function('socket')
704 socket_libs += cc.find_library('socket', required : true)
705 have = cc.has_function('socket',
706 dependencies : socket_libs)
708 error('socket() function not available')
713 have = cc.has_function('clock_gettime')
715 realtime_libs += cc.find_library('rt', required : true)
716 have = cc.has_function('clock_gettime',
717 dependencies : realtime_libs)
719 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
721 thread_libs = dependency('threads')
723 have = cc.has_function('timer_create')
725 realtime_libs = [cc.find_library('rt', required : true)]
726 have = cc.has_function('timer_create',
727 dependencies : realtime_libs)
729 realtime_libs += thread_libs
730 have = cc.has_function('timer_create',
731 dependencies : realtime_libs)
734 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
736 have = cc.has_function('setitimer')
737 conf.set('HAVE_SETITIMER', have ? 1 : false)
740 rtas_libs = cc.find_library('rtas', required : false)
741 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
744 if not cc.has_header_symbol('math.h', 'isnan')
745 lib = cc.find_library('m', required : true)
746 if (cc.has_function('isnan', dependencies : lib) and
747 cc.has_function('__isnan', dependencies : lib))
752 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
753 args : '-D_GNU_SOURCE')
754 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
757 extern char *__progname;
759 return (*__progname != 0);
762 have = cc.compiles(code, name : 'using __progname')
763 conf.set('HAVE___PROGNAME', have ? 1 : false)
765 have = conf.get('HAVE_PTY_H').to_string() == '1' \
766 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
767 conf.set('HAVE_PTY', have ? 1 : false)
769 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
770 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
772 build_plymouth_support = get_option('build-plymouth-support')
773 have_tiocglcktrmios = cc.has_header_symbol(
774 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
775 required : build_plymouth_support.enabled())
776 have_sock_cloexec = cc.has_header_symbol(
777 'sys/socket.h', 'SOCK_CLOEXEC',
778 prefix : '#include <sys/types.h>',
779 required : build_plymouth_support.enabled())
780 have_sock_nonblock = cc.has_header_symbol(
781 'sys/socket.h', 'SOCK_NONBLOCK',
782 prefix : '#include <sys/types.h>',
783 required : build_plymouth_support.enabled())
784 have_so_passcred = cc.has_header_symbol(
785 'sys/socket.h', 'SO_PASSCRED',
786 prefix : '#include <sys/types.h>',
787 required : build_plymouth_support.enabled())
789 build_plymouth_support = (not build_plymouth_support.disabled() and
790 have_tiocglcktrmios and
791 have_sock_cloexec and
792 have_sock_nonblock and
794 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
795 summary('plymouth support',
796 build_plymouth_support ? 'enabled' : 'disabled',
797 section : 'components')
799 # check for valid fallocate() function
800 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
801 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
802 # and program can't be linked.
810 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
811 return ret == 0 ? 0 : 1;
814 have = cc.links(code, name : 'fallocate() function')
815 conf.set('HAVE_FALLOCATE', have ? 1 : false)
823 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
824 return ret == 0 ? 0 : 1;
827 have = cc.links(code, name : 'posix_fallocate() function')
828 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
830 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
831 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
832 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
834 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
835 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
836 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
838 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
840 ############################################################
843 fs_search_path = get_option('fs-search-path')
844 fs_search_path_extra = get_option('fs-search-path-extra')
845 if fs_search_path_extra != ''
846 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
848 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
850 systemdsystemunitdir = ''
852 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
855 sysvinit = get_option('sysvinit').enabled()
856 sysvinitrcdir = sysconfdir + '/init.d'
858 program_tests = get_option('program-tests')
860 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
861 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
863 have = get_option('chsh-only-listed')
864 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
866 have = get_option('use-tty-group')
867 conf.set('USE_TTY_GROUP', have ? 1 : false)
869 bison = find_program('bison')
870 flex = find_program('flex')
872 build_hwclock = not get_option('build-hwclock').disabled()
873 bison_gen = generator(
875 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
876 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
878 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
879 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
883 configuration : conf)
885 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
890 '-Waddress-of-packed-member',
891 '-Wdiscarded-qualifiers',
892 '-Wembedded-directive',
895 '-Wimplicit-function-declaration',
896 '-Wmissing-declarations',
897 '-Wmissing-parameter-type',
898 '-Wmissing-prototypes',
900 '-Wno-missing-field-initializers',
901 '-Wold-style-definition',
905 '-Wstrict-prototypes',
908 '-Wunused-but-set-parameter',
909 '-Wunused-but-set-variable',
910 '-Wunused-parameter',
916 foreach compiler_flag : compiler_flags
917 if cc.has_argument(compiler_flag)
918 add_project_arguments(compiler_flag, language : 'c')
926 bashcompletionslinks = {}
932 subdir('libsmartcols')
934 subdir('liblastlog2')
936 subdir('pam_lastlog2')
937 subdir('login-utils')
945 includes = [dir_include,
956 opt = not get_option('build-chfn-chsh').disabled()
961 include_directories : includes,
962 link_with : [lib_common, logindefs_c],
963 dependencies : chfn_chsh_deps,
964 install_dir : usrbin_exec_dir,
965 install_mode : 'rwsr-xr-x',
967 build_by_default : opt)
971 'login-utils/chsh.c',
974 include_directories : includes,
975 link_with : lib_common,
976 dependencies : chfn_chsh_deps,
977 install_dir : usrbin_exec_dir,
978 install_mode : 'rwsr-xr-x',
980 build_by_default : opt)
981 if opt and not is_disabler(exe)
983 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
984 bashcompletions += ['chfn', 'chsh']
989 test_islocal_sources,
990 include_directories : includes,
991 c_args : '-DTEST_PROGRAM',
992 build_by_default : program_tests)
997 test_consoles_sources,
998 c_args : ['-DTEST_PROGRAM'],
999 include_directories : includes,
1000 link_with : lib_common,
1001 build_by_default : program_tests)
1004 opt = not get_option('build-last').disabled()
1008 include_directories : includes,
1009 link_with : [lib_common],
1010 install_dir : usrbin_exec_dir,
1012 build_by_default : opt)
1013 if opt and not is_disabler(exe)
1015 meson.add_install_script(meson_make_symlink,
1017 join_paths(usrbin_exec_dir, 'lastb'))
1018 manadocs += ['login-utils/last.1.adoc']
1019 manlinks += {'lastb.1': 'last.1'}
1020 bashcompletions += ['last']
1021 bashcompletionslinks += {'lastb': 'last'}
1024 opt = not get_option('build-nologin').disabled()
1027 'login-utils/nologin.c',
1028 include_directories : includes,
1029 install_dir : sbindir,
1030 link_with : [lib_common],
1032 build_by_default : opt)
1033 if opt and not is_disabler(exe)
1035 manadocs += ['login-utils/nologin.8.adoc']
1038 opt = not get_option('build-utmpdump').disabled()
1041 'login-utils/utmpdump.c',
1042 include_directories : includes,
1043 link_with : [lib_common],
1044 install_dir : usrbin_exec_dir,
1046 build_by_default : opt)
1047 if opt and not is_disabler(exe)
1049 manadocs += ['login-utils/utmpdump.1.adoc']
1050 bashcompletions += ['utmpdump']
1053 opt = not get_option('build-su').disabled()
1057 'login-utils/su-common.c',
1058 'login-utils/su-common.h',
1062 include_directories : includes,
1063 link_with : [lib_common, logindefs_c],
1064 dependencies : [lib_pam,
1068 install_mode : 'rwsr-xr-x',
1070 build_by_default : opt)
1071 if opt and not is_disabler(exe)
1073 manadocs += ['login-utils/su.1.adoc']
1074 bashcompletions += ['su']
1077 opt = not get_option('build-newgrp').disabled()
1080 'login-utils/newgrp.c',
1081 include_directories : includes,
1082 dependencies : [lib_crypt],
1083 install_dir : usrbin_exec_dir,
1084 install_mode : 'rwsr-xr-x',
1086 build_by_default : opt)
1087 if opt and not is_disabler(exe)
1089 manadocs += ['login-utils/newgrp.1.adoc']
1090 bashcompletions += ['newgrp']
1093 opt = not get_option('build-lslogins').disabled()
1096 'login-utils/lslogins.c',
1097 include_directories : includes,
1098 link_with : [lib_common,
1101 dependencies : [lib_selinux,
1103 install_dir : usrbin_exec_dir,
1105 build_by_default : opt)
1106 if opt and not is_disabler(exe)
1108 manadocs += ['login-utils/lslogins.1.adoc']
1109 bashcompletions += ['lslogins']
1112 opt = not get_option('build-vipw').disabled()
1115 'login-utils/vipw.c',
1116 'login-utils/setpwnam.h',
1117 include_directories : includes,
1118 link_with : [lib_common],
1119 dependencies : [lib_selinux],
1120 install_dir : usrbin_exec_dir,
1122 build_by_default : opt)
1123 if opt and not is_disabler(exe)
1125 meson.add_install_script(meson_make_symlink,
1127 join_paths(usrbin_exec_dir, 'vigr'))
1128 manadocs += ['login-utils/vipw.8.adoc']
1129 meson.add_install_script(meson_make_symlink,
1131 join_paths(mandir, 'man8/vigr.8'))
1134 opt = not get_option('build-runuser').disabled()
1137 'login-utils/runuser.c',
1138 'login-utils/su-common.c',
1139 'login-utils/su-common.h',
1143 include_directories : includes,
1144 link_with : [lib_common, logindefs_c],
1145 dependencies : [lib_pam,
1149 install_dir : sbindir,
1151 build_by_default : opt)
1152 if opt and not is_disabler(exe)
1154 manadocs += ['login-utils/runuser.1.adoc']
1155 bashcompletionslinks += {'runuser': 'su'}
1158 ############################################################
1164 include_directories : includes,
1165 link_with : lib_common,
1166 install_dir : usrbin_exec_dir,
1169 manadocs += ['text-utils/col.1.adoc']
1170 bashcompletions += ['col']
1176 include_directories : includes,
1177 install_dir : usrbin_exec_dir,
1180 manadocs += ['text-utils/colcrt.1.adoc']
1181 bashcompletions += ['colcrt']
1186 include_directories : includes,
1187 link_with : lib_common,
1188 install_dir : usrbin_exec_dir,
1191 manadocs += ['text-utils/colrm.1.adoc']
1192 bashcompletions += ['colrm']
1197 include_directories : includes,
1198 install_dir : usrbin_exec_dir,
1201 manadocs += ['text-utils/rev.1.adoc']
1202 bashcompletions += ['rev']
1207 include_directories : includes,
1208 link_with : [lib_common,
1210 install_dir : usrbin_exec_dir,
1212 if not is_disabler(exe)
1214 manadocs += ['text-utils/column.1.adoc']
1215 bashcompletions += ['column']
1218 opt = not get_option('build-line').disabled()
1222 include_directories : includes,
1223 install_dir : usrbin_exec_dir,
1225 build_by_default : opt)
1226 if opt and not is_disabler(exe)
1228 manadocs += ['text-utils/line.1.adoc']
1231 opt = not get_option('build-pg').disabled()
1235 link_with : lib_common,
1236 include_directories : includes,
1237 dependencies : [lib_tinfo,
1239 install_dir : usrbin_exec_dir,
1241 build_by_default : opt)
1242 if opt and not is_disabler(exe)
1244 manadocs += ['text-utils/pg.1.adoc']
1245 bashcompletions += ['pg']
1248 opt = not get_option('build-ul').disabled()
1252 include_directories : includes,
1253 dependencies : [lib_tinfo,
1255 install_dir : usrbin_exec_dir,
1257 build_by_default : opt)
1258 if opt and not is_disabler(exe)
1260 manadocs += ['text-utils/ul.1.adoc']
1261 bashcompletions += ['ul']
1264 opt = not get_option('build-more').disabled()
1268 link_with : [lib_common],
1269 include_directories : includes,
1270 dependencies : [lib_tinfo,
1274 build_by_default : opt)
1278 link_with : [lib_common],
1279 include_directories : includes,
1280 c_args : '-DTEST_PROGRAM',
1281 dependencies : [lib_tinfo,
1284 build_by_default : opt and program_tests)
1286 if opt and not is_disabler(exe)
1288 manadocs += ['text-utils/more.1.adoc']
1289 bashcompletions += ['more']
1295 include_directories : includes,
1296 link_with : [lib_common,
1298 install_dir : usrbin_exec_dir,
1300 if not is_disabler(exe)
1302 manadocs += ['text-utils/hexdump.1.adoc']
1303 bashcompletions += ['hexdump']
1306 opt = not get_option('build-lsmem').disabled()
1310 include_directories : includes,
1311 link_with : [lib_common,
1313 install_dir : usrbin_exec_dir,
1315 build_by_default : opt)
1316 if opt and not is_disabler(exe)
1318 manadocs += ['sys-utils/lsmem.1.adoc']
1319 bashcompletions += ['lsmem']
1322 opt = not get_option('build-chmem').disabled()
1326 include_directories : includes,
1327 link_with : [lib_common],
1328 install_dir : usrbin_exec_dir,
1330 build_by_default : opt)
1331 if opt and not is_disabler(exe)
1333 manadocs += ['sys-utils/chmem.8.adoc']
1334 bashcompletions += ['chmem']
1340 include_directories : includes,
1341 link_with : [lib_common],
1342 install_dir : usrbin_exec_dir,
1345 manadocs += ['sys-utils/choom.1.adoc']
1350 include_directories : includes,
1351 link_with : [lib_common],
1352 install_dir : usrbin_exec_dir,
1355 manadocs += ['sys-utils/ipcmk.1.adoc']
1356 bashcompletions += ['ipcmk']
1361 include_directories : includes,
1362 link_with : [lib_common],
1363 install_dir : usrbin_exec_dir,
1366 manadocs += ['sys-utils/ipcrm.1.adoc']
1367 bashcompletions += ['ipcrm']
1369 opt = not get_option('build-ipcs').disabled()
1373 include_directories : includes,
1374 link_with : [lib_common],
1375 install_dir : usrbin_exec_dir,
1377 build_by_default : opt)
1378 if opt and not is_disabler(exe)
1380 manadocs += ['sys-utils/ipcs.1.adoc']
1381 bashcompletions += ['ipcs']
1384 opt = not get_option('build-rfkill').disabled()
1388 include_directories : includes,
1389 link_with : [lib_common,
1391 install_dir : usrsbin_exec_dir,
1393 build_by_default : opt)
1394 if opt and not is_disabler(exe)
1396 manadocs += ['sys-utils/rfkill.8.adoc']
1397 bashcompletions += ['rfkill']
1403 include_directories : includes,
1404 link_with : [lib_common,
1406 install_dir : usrbin_exec_dir,
1408 if not is_disabler(exe)
1410 manadocs += ['sys-utils/renice.1.adoc']
1411 bashcompletions += ['renice']
1417 include_directories: includes,
1418 link_with : [lib_common,
1420 install_dir : usrbin_exec_dir,
1422 if opt and not is_disabler(exe)
1424 manadocs += ['sys-utils/setpgid.1.adoc']
1425 bashcompletions += ['setpgid']
1431 include_directories : includes,
1432 link_with : [lib_common,
1434 install_dir : usrbin_exec_dir,
1436 if opt and not is_disabler(exe)
1438 manadocs += ['sys-utils/setsid.1.adoc']
1439 bashcompletions += ['setsid']
1444 readprofile_sources,
1445 include_directories : includes,
1446 link_with : [lib_common,
1448 install_dir : usrsbin_exec_dir,
1450 if not is_disabler(exe)
1452 manadocs += ['sys-utils/readprofile.8.adoc']
1453 bashcompletions += ['readprofile']
1456 opt = not get_option('build-tunelp').disabled()
1460 include_directories : includes,
1461 link_with : [lib_common],
1462 install_dir : usrsbin_exec_dir,
1464 build_by_default : opt)
1465 if opt and not is_disabler(exe)
1467 manadocs += ['sys-utils/tunelp.8.adoc']
1468 bashcompletions += ['tunelp']
1474 include_directories : includes,
1475 link_with : [lib_common,
1477 install_dir : sbindir,
1479 if not is_disabler(exe)
1481 manadocs += ['sys-utils/fstrim.8.adoc']
1482 bashcompletions += ['fstrim']
1488 include_directories : includes,
1489 link_with : [lib_common,
1492 if not is_disabler(exe)
1494 manadocs += ['sys-utils/dmesg.1.adoc']
1495 bashcompletions += ['dmesg']
1501 include_directories : dir_include,
1502 c_args : '-DTEST_DMESG',
1503 link_with : [lib_common,
1505 build_by_default : program_tests)
1506 if not is_disabler(exe)
1513 include_directories : includes,
1514 link_with : [lib_common],
1515 install_dir : sbindir,
1518 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1519 bashcompletions += ['ctrlaltdel']
1524 include_directories : includes,
1525 install_dir : sbindir,
1528 manadocs += ['sys-utils/fsfreeze.8.adoc']
1529 bashcompletions += ['fsfreeze']
1534 include_directories : includes,
1535 link_with : [lib_common,
1537 install_dir : sbindir,
1540 manadocs += ['sys-utils/blkdiscard.8.adoc']
1541 bashcompletions += ['blkdiscard']
1546 include_directories : includes,
1547 link_with : [lib_common],
1548 install_dir : sbindir,
1551 manadocs += ['sys-utils/blkzone.8.adoc']
1552 bashcompletions += ['blkzone']
1557 include_directories : includes,
1558 link_with : [lib_common],
1559 install_dir : sbindir,
1562 manadocs += ['sys-utils/blkpr.8.adoc']
1567 include_directories : includes,
1568 link_with : [lib_common],
1569 install_dir : usrsbin_exec_dir,
1572 manadocs += ['sys-utils/ldattach.8.adoc']
1573 bashcompletions += ['ldattach']
1578 include_directories : includes,
1579 link_with : [lib_common],
1580 install_dir : usrsbin_exec_dir,
1583 manadocs += ['sys-utils/rtcwake.8.adoc']
1584 bashcompletions += ['rtcwake']
1589 include_directories : includes,
1590 link_with : [lib_common],
1591 install_dir : usrbin_exec_dir,
1594 manadocs += ['sys-utils/setarch.8.adoc']
1595 bashcompletions += ['setarch']
1597 setarch_links = ['uname26', 'linux32', 'linux64']
1598 setarch_links_arch = {
1599 's390x' : ['s390', 's390x'],
1601 'x86_64' : ['i386', 'x86_64'],
1602 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1603 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1604 'mips64' : ['mips', 'mips64', 'mips32'],
1605 'ia64' : ['i386', 'ia64'],
1606 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1608 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1610 foreach link: setarch_links
1611 meson.add_install_script(meson_make_symlink,
1613 join_paths(usrbin_exec_dir, link))
1614 manlinks += {link + '.8': 'setarch.8'}
1617 opt = not get_option('build-eject').disabled()
1621 include_directories : includes,
1622 link_with : [lib_common,
1624 install_dir : usrbin_exec_dir,
1626 build_by_default : opt)
1627 if opt and not is_disabler(exe)
1629 manadocs += ['sys-utils/eject.1.adoc']
1630 bashcompletions += ['eject']
1633 opt = not get_option('build-losetup').disabled()
1637 include_directories : includes,
1638 link_with : [lib_common,
1640 install_dir : sbindir,
1642 build_by_default : opt)
1643 if opt and not is_disabler(exe)
1644 manadocs += ['sys-utils/losetup.8.adoc']
1646 bashcompletions += ['losetup']
1649 opt = opt and 'losetup' in static_programs
1653 include_directories : includes,
1654 link_args : ['--static'],
1655 link_with : [lib_common,
1656 lib_smartcols.get_static_lib()],
1657 install_dir : sbindir,
1659 build_by_default : opt)
1660 if opt and not is_disabler(exe)
1664 opt = not get_option('build-zramctl').disabled()
1668 include_directories : includes,
1669 link_with : [lib_common,
1671 install_dir : sbindir,
1673 build_by_default : opt)
1674 if opt and not is_disabler(exe)
1676 manadocs += ['sys-utils/zramctl.8.adoc']
1677 bashcompletions += ['zramctl']
1683 include_directories : includes,
1684 link_with : [lib_common,
1686 install_dir : usrbin_exec_dir,
1688 if not is_disabler(exe)
1690 manadocs += ['sys-utils/prlimit.1.adoc']
1691 bashcompletions += ['prlimit']
1697 include_directories : includes,
1698 link_with : [lib_common,
1701 install_dir : usrbin_exec_dir,
1703 if not is_disabler(exe)
1705 manadocs += ['sys-utils/lsns.8.adoc']
1706 bashcompletions += ['lsns']
1709 opt = not get_option('build-mount').disabled()
1713 include_directories : includes,
1714 link_with : [lib_common,
1717 dependencies : lib_selinux,
1718 install_mode : 'rwsr-xr-x',
1720 build_by_default : opt)
1724 include_directories : includes,
1725 link_with : [lib_common,
1727 install_mode : 'rwsr-xr-x',
1729 build_by_default : opt)
1730 if opt and not is_disabler(exe)
1732 manadocs += ['sys-utils/fstab.5.adoc',
1733 'sys-utils/mount.8.adoc',
1734 'sys-utils/umount.8.adoc']
1735 bashcompletions += ['mount', 'umount']
1738 opt2 = opt and 'mount' in static_programs
1742 include_directories : includes,
1743 link_args : ['--static'],
1744 link_with : [lib_common,
1745 lib_smartcols_static,
1748 build_by_default : opt2)
1749 if opt2 and not is_disabler(exe)
1753 opt2 = opt and 'umount' in static_programs
1757 include_directories : includes,
1758 link_args : ['--static'],
1759 link_with : [lib_common,
1762 build_by_default : opt2)
1763 if opt2 and not is_disabler(exe)
1772 include_directories : includes,
1773 link_with : [lib_common,
1777 install_dir : sbindir,
1779 if not is_disabler(exe)
1781 manadocs += ['sys-utils/swapon.8.adoc']
1782 bashcompletions += ['swapon']
1788 include_directories : includes,
1789 link_with : [lib_common,
1792 install_dir : sbindir,
1794 if not is_disabler(exe)
1796 manlinks += {'swapoff.8': 'swapon.8'}
1797 bashcompletions += ['swapoff']
1803 include_directories : includes,
1804 link_with : [lib_common,
1806 dependencies : [rtas_libs],
1807 install_dir : usrbin_exec_dir,
1809 if not is_disabler(exe)
1811 manadocs += ['sys-utils/lscpu.1.adoc']
1812 bashcompletions += ['lscpu']
1818 include_directories : includes,
1819 link_with : [lib_common],
1820 install_dir : sbindir,
1823 manadocs += ['sys-utils/chcpu.8.adoc']
1824 bashcompletions += ['chcpu']
1829 include_directories : includes,
1830 link_with : [lib_common,
1833 if not is_disabler(exe)
1835 manadocs += ['sys-utils/wdctl.8.adoc']
1836 bashcompletions += ['wdctl']
1839 opt = not get_option('build-mountpoint').disabled()
1843 include_directories : includes,
1844 link_with : [lib_mount],
1846 build_by_default : opt)
1847 if opt and not is_disabler(exe)
1849 manadocs += ['sys-utils/mountpoint.1.adoc']
1850 bashcompletions += ['mountpoint']
1853 opt = not get_option('build-fallocate').disabled()
1857 include_directories : includes,
1858 link_with : [lib_common],
1859 install_dir : usrbin_exec_dir,
1861 build_by_default : opt)
1862 if opt and not is_disabler(exe)
1864 manadocs += ['sys-utils/fallocate.1.adoc']
1865 bashcompletions += ['fallocate']
1868 opt = not get_option('build-pivot_root').disabled()
1872 include_directories : includes,
1873 install_dir : sbindir,
1875 build_by_default : opt)
1876 if opt and not is_disabler(exe)
1878 manadocs += ['sys-utils/pivot_root.8.adoc']
1879 bashcompletions += ['pivot_root']
1882 opt = not get_option('build-switch_root').disabled()
1883 if opt and not have_dirfd and not have_ddfd
1884 error('neither dirfd nor ddfd are available')
1888 switch_root_sources,
1889 include_directories : includes,
1890 install_dir : sbindir,
1892 build_by_default : opt)
1893 if opt and not is_disabler(exe)
1895 manadocs += ['sys-utils/switch_root.8.adoc']
1898 opt = not get_option('build-unshare').disabled()
1902 include_directories : includes,
1903 link_with : [lib_common],
1904 install_dir : usrbin_exec_dir,
1906 build_by_default : opt)
1907 if opt and not is_disabler(exe)
1909 manadocs += ['sys-utils/unshare.1.adoc']
1910 bashcompletions += ['unshare']
1913 opt = opt and 'unshare' in static_programs
1917 include_directories : includes,
1918 link_with : [lib_common],
1919 install_dir : usrbin_exec_dir,
1921 build_by_default : opt)
1922 if opt and not is_disabler(exe)
1926 opt = not get_option('build-nsenter').disabled()
1930 include_directories : includes,
1931 link_with : [lib_common],
1932 dependencies : [lib_selinux],
1933 install_dir : usrbin_exec_dir,
1935 build_by_default : opt)
1936 if opt and not is_disabler(exe)
1938 manadocs += ['sys-utils/nsenter.1.adoc']
1939 bashcompletions += ['nsenter']
1942 opt = opt and 'nsenter' in static_programs
1946 include_directories : includes,
1947 link_with : [lib_common],
1948 dependencies : [lib_selinux],
1949 install_dir : usrbin_exec_dir,
1951 build_by_default : opt)
1952 if opt and not is_disabler(exe)
1956 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1960 include_directories : includes,
1961 link_with : [lib_common],
1962 dependencies : [lib_cap_ng],
1963 install_dir : usrbin_exec_dir,
1965 build_by_default : opt)
1966 if opt and not is_disabler(exe)
1968 manadocs += ['sys-utils/setpriv.1.adoc']
1969 bashcompletions += ['setpriv']
1975 include_directories : includes,
1976 link_with : [lib_common],
1977 dependencies : realtime_libs,
1978 install_dir : usrbin_exec_dir,
1981 manadocs += ['sys-utils/flock.1.adoc']
1982 bashcompletions += ['flock']
1984 opt = not get_option('build-lsirq').disabled()
1988 include_directories : includes,
1989 link_with : [lib_common,
1991 install_dir : usrbin_exec_dir,
1993 build_by_default : opt)
1994 if opt and not is_disabler(exe)
1996 manadocs += ['sys-utils/lsirq.1.adoc']
1997 bashcompletions += ['lsirq']
2000 opt = not get_option('build-irqtop').disabled()
2004 include_directories : includes,
2005 dependencies : [realtime_libs, curses_libs],
2006 link_with : [lib_common,
2009 install_dir : usrbin_exec_dir,
2011 build_by_default : opt)
2012 if opt and not is_disabler(exe)
2014 manadocs += ['sys-utils/irqtop.1.adoc']
2015 bashcompletions += ['irqtop']
2018 opt = not get_option('build-ipcs').disabled()
2022 include_directories : includes,
2023 link_with : [lib_common,
2025 install_dir : usrbin_exec_dir,
2027 build_by_default : opt)
2028 if opt and not is_disabler(exe)
2030 manadocs += ['sys-utils/lsipc.1.adoc']
2031 bashcompletions += ['lsipc']
2038 include_directories : includes,
2039 link_with : [lib_common],
2040 dependencies : [lib_m,
2042 install_dir : sbindir,
2044 build_by_default : opt)
2045 if opt and not is_disabler(exe)
2047 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2048 bashcompletions += ['hwclock']
2054 include_directories : includes,
2055 install_dir : sbindir,
2058 manadocs += ['disk-utils/mkfs.8.adoc']
2059 bashcompletions += ['mkfs']
2061 opt = not get_option('build-bfs').disabled()
2065 include_directories : includes,
2066 link_with : [lib_common],
2067 install_dir : sbindir,
2069 build_by_default : opt)
2070 if opt and not is_disabler(exe)
2072 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2073 bashcompletions += ['mkfs.bfs']
2079 include_directories : includes,
2080 link_with : [lib_common],
2081 install_dir : usrbin_exec_dir,
2084 manadocs += ['disk-utils/isosize.8.adoc']
2085 bashcompletions += ['isosize']
2090 include_directories : includes,
2091 link_with : [lib_common,
2094 dependencies: [lib_selinux],
2095 install_dir : sbindir,
2097 if opt and not is_disabler(exe)
2099 manadocs += ['disk-utils/mkswap.8.adoc']
2100 bashcompletions += ['mkswap']
2106 include_directories : includes,
2107 link_with : [lib_common,
2110 install_dir : sbindir,
2112 if opt and not is_disabler(exe)
2114 manadocs += ['disk-utils/swaplabel.8.adoc']
2115 bashcompletions += ['swaplabel']
2118 opt = not get_option('build-fsck').disabled()
2122 include_directories : includes,
2123 link_with : [lib_common,
2126 dependencies : realtime_libs,
2127 install_dir : sbindir,
2129 build_by_default : opt)
2130 if opt and not is_disabler(exe)
2132 manadocs += ['disk-utils/fsck.8.adoc']
2133 bashcompletions += ['fsck']
2136 opt = not get_option('build-minix').disabled()
2140 include_directories : includes,
2141 link_with : [lib_common],
2142 install_dir : sbindir,
2144 build_by_default : opt)
2148 include_directories : includes,
2149 c_args : '-DTEST_SCRIPT',
2150 link_with : [lib_common],
2151 build_by_default : opt and program_tests)
2155 include_directories : includes,
2156 link_with : [lib_common],
2157 install_dir : sbindir,
2159 build_by_default : opt)
2160 if opt and not is_disabler(exe)
2161 exes += [exe, exe2, exe3]
2162 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2163 bashcompletions += ['mkfs.minix', 'fsck.minix']
2166 opt = not get_option('build-cramfs').disabled()
2169 mkfs_cramfs_sources,
2170 include_directories : includes,
2171 link_with : [lib_common],
2172 dependencies : [lib_z],
2173 install_dir : sbindir,
2175 build_by_default : opt)
2178 fsck_cramfs_sources,
2179 include_directories : includes,
2180 link_with : [lib_common],
2181 dependencies : [lib_z],
2182 install_dir : sbindir,
2184 build_by_default : opt)
2185 if not is_disabler(exe)
2187 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2188 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2191 opt = not get_option('build-raw').disabled()
2193 cc.has_header('linux/raw.h', required: opt)
2198 include_directories : includes,
2199 install_dir : sbindir,
2201 build_by_default : opt)
2202 if opt and not is_disabler(exe)
2204 manadocs += ['disk-utils/raw.8.adoc']
2205 bashcompletions += ['raw']
2208 opt = not get_option('build-fdformat').disabled()
2212 include_directories : includes,
2213 link_with : [lib_common],
2214 install_dir : usrsbin_exec_dir,
2216 build_by_default : opt)
2217 if opt and not is_disabler(exe)
2219 manadocs += ['disk-utils/fdformat.8.adoc']
2225 include_directories : includes,
2226 link_with : [lib_common],
2227 install_dir : sbindir,
2229 manadocs += ['disk-utils/blockdev.8.adoc']
2230 bashcompletions += ['blockdev']
2232 opt = not get_option('build-fdisks').disabled()
2233 if opt and not have_dirfd and not have_ddfd
2234 error('neither dirfd nor ddfd are available')
2239 include_directories : includes,
2240 link_with : [lib_common,
2244 dependencies : [lib_readline],
2245 install_dir : sbindir,
2247 build_by_default : opt)
2248 if opt and not is_disabler(exe)
2250 bashcompletions += ['fdisk']
2253 opt2 = opt and 'fdisk' in static_programs
2257 link_args : ['--static'],
2258 include_directories : includes,
2259 link_with : [lib_common,
2262 lib_smartcols.get_static_lib()],
2263 dependencies : [lib_readline_static],
2264 install_dir : sbindir,
2266 build_by_default : opt2)
2267 if opt2 and not is_disabler(exe)
2274 include_directories : includes,
2275 link_with : [lib_common,
2279 dependencies : [lib_readline],
2280 install_dir : sbindir,
2282 build_by_default : opt)
2283 if opt and not is_disabler(exe)
2285 bashcompletions += ['sfdisk']
2288 opt2 = opt and 'sfdisk' in static_programs
2292 include_directories : includes,
2293 link_with : [lib_common,
2296 lib_smartcols.get_static_lib()],
2297 dependencies : [lib_readline_static],
2298 install_dir : sbindir,
2300 build_by_default : opt2)
2301 if opt2 and not is_disabler(exe)
2308 include_directories : includes,
2309 link_with : [lib_common,
2314 dependencies : [curses_libs],
2315 install_dir : sbindir,
2317 build_by_default : opt)
2318 if opt and not is_disabler(exe)
2320 manadocs += ['disk-utils/fdisk.8.adoc',
2321 'disk-utils/sfdisk.8.adoc',
2322 'disk-utils/cfdisk.8.adoc']
2323 bashcompletions += ['cfdisk']
2326 opt = not get_option('build-partx').disabled()
2330 include_directories : includes,
2331 link_with : [lib_common],
2332 install_dir : usrsbin_exec_dir,
2334 build_by_default : opt)
2338 include_directories : includes,
2339 link_with : [lib_common],
2340 install_dir : usrsbin_exec_dir,
2342 build_by_default : opt)
2346 include_directories : includes,
2347 link_with : [lib_common],
2348 install_dir : usrsbin_exec_dir,
2350 build_by_default : opt)
2354 include_directories : includes,
2355 link_with : [lib_common,
2358 install_dir : usrsbin_exec_dir,
2360 build_by_default : opt)
2362 exes += [exe, exe2, exe3, exe4]
2363 manadocs += ['disk-utils/addpart.8.adoc',
2364 'disk-utils/delpart.8.adoc',
2365 'disk-utils/resizepart.8.adoc',
2366 'disk-utils/partx.8.adoc']
2367 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2370 ############################################################
2375 include_directories : includes,
2376 link_with : [lib_common],
2377 dependencies : [lib_util,
2381 install_dir : usrbin_exec_dir,
2384 manadocs += ['term-utils/script.1.adoc']
2385 bashcompletions += ['script']
2390 include_directories : includes,
2391 c_args : '-DTEST_SCRIPT',
2392 link_with : [lib_common],
2393 dependencies : [lib_util,
2397 build_by_default : program_tests)
2403 include_directories : includes,
2404 link_with : [lib_common],
2405 dependencies : [lib_util,
2408 install_dir : usrbin_exec_dir,
2411 manadocs += ['term-utils/scriptlive.1.adoc']
2412 bashcompletions += ['scriptlive']
2416 scriptreplay_sources,
2417 include_directories : includes,
2418 link_with : [lib_common],
2419 dependencies : [math_libs],
2420 install_dir : usrbin_exec_dir,
2423 manadocs += ['term-utils/scriptreplay.1.adoc']
2424 bashcompletions += ['scriptreplay']
2426 opt = not get_option('build-agetty').disabled()
2430 include_directories : includes,
2431 link_with : [lib_common, logindefs_c],
2432 dependencies : [BSD ? lib_util : [], lib_systemd],
2433 install_dir : sbindir,
2435 build_by_default : opt)
2438 manadocs += ['term-utils/agetty.8.adoc']
2441 opt = not get_option('build-setterm').disabled()
2445 include_directories : includes,
2446 link_with : [lib_common],
2447 dependencies : [curses_libs],
2448 install_dir : usrbin_exec_dir,
2450 build_by_default : opt)
2453 manadocs += ['term-utils/setterm.1.adoc']
2454 bashcompletions += ['setterm']
2457 opt = not get_option('build-mesg').disabled()
2461 include_directories : includes,
2462 link_with : [lib_common],
2463 install_dir : usrbin_exec_dir,
2465 build_by_default : opt)
2468 manadocs += ['term-utils/mesg.1.adoc']
2469 bashcompletions += ['mesg']
2472 opt = not get_option('build-wall').disabled()
2476 include_directories : includes,
2477 link_with : [lib_common],
2478 dependencies : [lib_systemd],
2479 install_dir : usrbin_exec_dir,
2480 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2482 build_by_default : opt)
2485 manadocs += ['term-utils/wall.1.adoc']
2486 bashcompletions += ['wall']
2489 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2490 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2492 opt = not get_option('build-write').disabled()
2496 include_directories : includes,
2497 link_with : [lib_common],
2498 dependencies : [lib_systemd],
2499 install_dir : usrbin_exec_dir,
2500 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2502 build_by_default : opt)
2505 manadocs += ['term-utils/write.1.adoc']
2506 bashcompletions += ['write']
2509 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2510 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2512 opt = not get_option('build-login').disabled()
2516 include_directories : includes,
2517 link_with : [lib_common, logindefs_c],
2518 dependencies : [lib_pam,
2522 build_by_default : opt)
2523 if not is_disabler(exe)
2525 manadocs += ['login-utils/login.1.adoc']
2528 opt = not get_option('build-sulogin').disabled()
2532 include_directories : includes,
2533 link_with : [lib_common],
2534 dependencies : [lib_crypt,
2536 install_dir : sbindir,
2538 build_by_default : opt)
2539 if not is_disabler(exe)
2541 manadocs += ['login-utils/sulogin.8.adoc']
2547 include_directories : includes,
2548 link_with : [lib_common,
2550 dependencies : [curses_libs],
2551 install_dir : usrbin_exec_dir,
2554 manadocs += ['misc-utils/cal.1.adoc']
2555 bashcompletions += ['cal']
2557 opt = not get_option('build-logger').disabled()
2561 include_directories : includes,
2562 link_with : [lib_common],
2563 dependencies : [lib_systemd],
2564 install_dir : usrbin_exec_dir,
2566 build_by_default : opt)
2567 if opt and not is_disabler(exe)
2569 manadocs += ['misc-utils/logger.1.adoc']
2570 bashcompletions += ['logger']
2576 include_directories : includes,
2577 c_args : '-DTEST_LOGGER',
2578 link_with : [lib_common],
2579 dependencies : [lib_systemd],
2580 build_by_default: program_tests)
2581 if not is_disabler(exe)
2588 include_directories : includes,
2589 install_dir : usrbin_exec_dir,
2592 manadocs += ['misc-utils/look.1.adoc']
2593 bashcompletions += ['look']
2598 include_directories : includes,
2599 link_with : [lib_common],
2600 install_dir : usrbin_exec_dir,
2603 manadocs += ['misc-utils/mcookie.1.adoc']
2604 bashcompletions += ['mcookie']
2606 if build_liblastlog2
2610 include_directories : includes,
2611 link_with : [lib_common, lib_lastlog2],
2612 install_dir : usrbin_exec_dir,
2615 manadocs += ['misc-utils/lastlog2.8.adoc']
2616 bashcompletions += ['lastlog2']
2617 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2618 'liblastlog2/man/ll2_write_entry.3.adoc',
2619 'liblastlog2/man/ll2_read_entry.3.adoc',
2620 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2621 'liblastlog2/man/ll2_read_all.3.adoc',
2622 'liblastlog2/man/ll2_remove_entry.3.adoc',
2623 'liblastlog2/man/ll2_rename_user.3.adoc',
2624 'liblastlog2/man/ll2_update_login_time.3.adoc'
2631 include_directories : includes,
2632 dependencies : [lib_selinux],
2633 install_dir : usrbin_exec_dir,
2636 manadocs += ['misc-utils/namei.1.adoc']
2637 bashcompletions += ['namei']
2642 include_directories : includes,
2643 link_with : [lib_common],
2644 install_dir : usrbin_exec_dir,
2647 manadocs += ['misc-utils/whereis.1.adoc']
2648 bashcompletions += ['whereis']
2653 include_directories : includes,
2654 link_with : [lib_common,
2657 install_dir : usrbin_exec_dir,
2659 if not is_disabler(exe)
2661 manadocs += ['misc-utils/lslocks.8.adoc']
2662 bashcompletions += ['lslocks']
2668 include_directories : includes,
2669 link_with : [lib_common,
2674 dependencies : lib_udev,
2676 if not is_disabler(exe)
2678 manadocs += ['misc-utils/lsblk.8.adoc']
2679 bashcompletions += ['lsblk']
2683 mq_libs += cc.find_library('rt', required : true)
2688 include_directories : includes,
2689 link_with : [lib_common,
2691 dependencies : mq_libs,
2692 install_dir : usrbin_exec_dir,
2694 if not is_disabler(exe)
2696 manadocs += ['misc-utils/lsfd.1.adoc']
2702 include_directories : includes,
2703 link_with : [lib_common,
2705 install_dir : usrbin_exec_dir,
2707 if not is_disabler(exe)
2709 manadocs += ['misc-utils/uuidgen.1.adoc']
2710 bashcompletions += ['uuidgen']
2716 include_directories : includes,
2717 link_with : [lib_common,
2720 install_dir : usrbin_exec_dir,
2722 if not is_disabler(exe)
2724 manadocs += ['misc-utils/uuidparse.1.adoc']
2725 bashcompletions += ['uuidparse']
2732 include_directories : includes,
2733 link_with : [lib_common,
2735 dependencies : [realtime_libs,
2737 install_dir : usrsbin_exec_dir,
2739 build_by_default : opt)
2743 include_directories : includes,
2744 link_with : [lib_common,
2746 dependencies : thread_libs,
2747 build_by_default : opt and program_tests)
2748 if not is_disabler(exe)
2750 manadocs += ['misc-utils/uuidd.8.adoc']
2751 bashcompletions += ['uuidd']
2754 opt = build_libblkid
2758 include_directories : includes,
2759 link_with : [lib_common,
2761 install_dir : sbindir,
2763 build_by_default : opt)
2764 if opt and not is_disabler(exe)
2766 manadocs += ['misc-utils/blkid.8.adoc']
2767 bashcompletions += ['blkid']
2770 opt = opt and 'blkid' in static_programs
2774 include_directories : includes,
2775 link_with : [lib_common,
2777 install_dir : sbindir,
2779 build_by_default : opt)
2780 if opt and not is_disabler(exe)
2786 'libblkid/samples/mkfs.c',
2787 include_directories : includes,
2788 link_with : lib_blkid)
2789 if not is_disabler(exe)
2794 'sample-partitions',
2795 'libblkid/samples/partitions.c',
2796 include_directories : includes,
2797 link_with : lib_blkid)
2798 if not is_disabler(exe)
2803 'sample-superblocks',
2804 'libblkid/samples/superblocks.c',
2805 include_directories : includes,
2806 link_with : lib_blkid)
2807 if not is_disabler(exe)
2813 'libblkid/samples/topology.c',
2814 include_directories : includes,
2815 link_with : lib_blkid)
2816 if not is_disabler(exe)
2821 'test_blkid_fuzz_sample',
2822 'libblkid/src/fuzz.c',
2823 include_directories: includes,
2824 link_with: lib_blkid,
2825 build_by_default: program_tests)
2826 if not is_disabler(exe)
2830 ############################################################
2835 include_directories : includes,
2836 link_with : [lib_blkid],
2837 install_dir : sbindir,
2839 if not is_disabler(exe)
2841 manadocs += ['misc-utils/findfs.8.adoc']
2842 bashcompletions += ['findfs']
2848 include_directories : includes,
2849 link_with : [lib_common,
2852 install_dir : sbindir,
2854 if not is_disabler(exe)
2856 manadocs += ['misc-utils/wipefs.8.adoc']
2857 bashcompletions += ['wipefs']
2863 include_directories : includes,
2864 link_with : [lib_common,
2868 dependencies : [lib_udev],
2870 if not is_disabler(exe)
2872 manadocs += ['misc-utils/findmnt.8.adoc']
2873 bashcompletions += ['findmnt']
2879 include_directories : includes,
2880 link_with : [lib_common],
2882 if not is_disabler(exe)
2884 manadocs += ['misc-utils/kill.1.adoc']
2887 opt = not get_option('build-rename').disabled()
2891 include_directories : includes,
2892 install_dir : usrbin_exec_dir,
2894 build_by_default : opt)
2895 if opt and not is_disabler(exe)
2897 manadocs += ['misc-utils/rename.1.adoc']
2898 bashcompletions += ['rename']
2904 include_directories : includes,
2905 link_with : [lib_common],
2906 install_dir : usrbin_exec_dir,
2909 manadocs += ['misc-utils/getopt.1.adoc']
2910 bashcompletions += ['getopt']
2915 include_directories : includes,
2916 link_with : [lib_common,
2918 install_dir : usrbin_exec_dir,
2920 if not is_disabler(exe)
2922 manadocs += ['misc-utils/fincore.1.adoc']
2923 bashcompletions += ['fincore']
2929 include_directories : includes,
2930 link_with : [lib_common],
2931 install_dir : usrbin_exec_dir,
2933 if not is_disabler(exe)
2935 manadocs += ['misc-utils/hardlink.1.adoc']
2936 bashcompletions += ['hardlink']
2939 opt = not get_option('build-pipesz').disabled()
2943 include_directories : includes,
2944 link_with : [lib_common],
2945 install_dir : usrbin_exec_dir,
2947 if opt and not is_disabler(exe)
2949 manadocs += ['misc-utils/pipesz.1.adoc']
2950 bashcompletions += ['pipesz']
2956 include_directories : includes,
2957 c_args : '-DTEST_CAL',
2958 link_with : [lib_common,
2960 dependencies : [curses_libs],
2961 build_by_default: program_tests)
2962 if not is_disabler(exe)
2969 include_directories : includes,
2970 link_with : [lib_common],
2971 install_dir : usrbin_exec_dir,
2973 if not is_disabler(exe)
2975 manadocs += ['misc-utils/fadvise.1.adoc']
2976 bashcompletions += ['fadvise']
2979 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
2983 include_directories : includes,
2984 link_with : [lib_common],
2985 install_dir : usrbin_exec_dir,
2987 if not is_disabler(exe)
2989 manadocs += ['misc-utils/waitpid.1.adoc']
2990 bashcompletions += ['waitpid']
2994 syscalls_h = custom_target('syscalls.h',
2995 input : 'tools/all_syscalls',
2996 output : 'syscalls.h',
2997 command : ['tools/all_syscalls', cc.cmd_array()]
3000 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3003 'misc-utils/enosys.c', syscalls_h,
3004 include_directories : includes,
3005 link_with : [lib_common],
3006 install_dir : usrbin_exec_dir,
3008 if not is_disabler(exe)
3010 manadocs += ['misc-utils/enosys.1.adoc']
3011 bashcompletions += ['enosys']
3018 include_directories : includes,
3019 link_with : [lib_common, lib_smartcols],
3020 install_dir : usrbin_exec_dir,
3022 if not is_disabler(exe)
3024 manadocs += ['misc-utils/lsclocks.1.adoc']
3025 bashcompletions += ['lsclocks']
3028 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3032 include_directories : includes,
3033 link_with : [lib_common],
3034 install_dir : usrbin_exec_dir,
3036 if not is_disabler(exe)
3038 manadocs += ['misc-utils/exch.1.adoc']
3039 bashcompletions += ['exch']
3043 ############################################################
3045 opt = not get_option('build-schedutils').disabled()
3048 'schedutils/chrt.c',
3049 include_directories : includes,
3050 link_with : lib_common,
3051 install_dir : usrbin_exec_dir,
3053 build_by_default : opt)
3057 'schedutils/ionice.c',
3058 include_directories : includes,
3059 link_with : lib_common,
3060 install_dir : usrbin_exec_dir,
3062 build_by_default : opt)
3066 'schedutils/taskset.c',
3067 include_directories : includes,
3068 link_with : lib_common,
3069 install_dir : usrbin_exec_dir,
3071 build_by_default : opt)
3075 'schedutils/uclampset.c',
3076 include_directories : includes,
3077 link_with : lib_common,
3078 install_dir : usrbin_exec_dir,
3080 build_by_default : opt)
3082 if opt and not is_disabler(exe)
3083 exes += [exe, exe2, exe3, exe4]
3084 manadocs += ['schedutils/chrt.1.adoc',
3085 'schedutils/ionice.1.adoc',
3086 'schedutils/taskset.1.adoc',
3087 'schedutils/uclampset.1.adoc']
3088 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3091 ############################################################
3093 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3098 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3099 include_directories : dir_include,
3100 link_with : lib_common,
3101 build_by_default: program_tests)
3107 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3108 include_directories : dir_include,
3109 link_with : lib_common,
3110 build_by_default: program_tests)
3116 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3117 include_directories : dir_include,
3118 link_with : lib_common,
3119 build_by_default: program_tests)
3125 c_args : ['-DTEST_PROGRAM_MANGLE'],
3126 include_directories : dir_include,
3127 build_by_default: program_tests)
3133 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3134 include_directories : dir_include,
3135 build_by_default: program_tests)
3141 'lib/color-names.c',
3142 c_args : ['-DTEST_PROGRAM_COLORS'],
3143 include_directories : dir_include,
3144 link_with : [lib_common, lib_tcolors],
3145 build_by_default: program_tests)
3151 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3152 include_directories : dir_include,
3153 build_by_default: program_tests)
3156 if conf.get('HAVE_OPENAT').to_string() == '1' \
3157 and conf.get('HAVE_DIRFD').to_string() == '1'
3161 c_args : ['-DTEST_PROGRAM_PROCFS'],
3162 include_directories : dir_include,
3163 link_with : lib_common,
3164 build_by_default: program_tests)
3171 have_cpu_set_t ? 'lib/cpuset.c' : [],
3172 c_args : ['-DTEST_PROGRAM_PATH'],
3173 include_directories : dir_include,
3174 link_with : lib_common,
3175 build_by_default: program_tests)
3179 if conf.get('HAVE_PTY').to_string() == '1'
3184 c_args : ['-DTEST_PROGRAM_PTY'],
3185 include_directories : dir_include,
3186 link_with : [lib_common],
3187 dependencies : [lib_m,
3190 build_by_default: program_tests)
3198 c_args : ['-DTEST_PROGRAM_CPUSET'],
3199 include_directories : dir_include,
3200 build_by_default: program_tests)
3211 have_cpu_set_t ? 'lib/cpuset.c' : [],
3212 c_args : ['-DTEST_PROGRAM_SYSFS'],
3213 include_directories : dir_include,
3214 build_by_default: program_tests)
3220 c_args : ['-DTEST_PROGRAM_PAGER'],
3221 include_directories : dir_include,
3222 build_by_default: program_tests)
3226 'test_linux_version',
3227 'lib/linux_version.c',
3228 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3229 include_directories : dir_include,
3230 build_by_default: program_tests)
3236 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3237 include_directories : dir_include,
3238 build_by_default: program_tests)
3242 'test_canonicalize',
3243 'lib/canonicalize.c',
3244 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3245 include_directories : dir_include,
3246 build_by_default: program_tests)
3253 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3254 include_directories : dir_include,
3255 build_by_default: program_tests)
3261 c_args : ['-DTEST_PROGRAM'],
3262 include_directories : dir_include,
3263 link_with : lib_common,
3264 build_by_default: program_tests)
3270 c_args : ['-DTEST_PROGRAM'],
3271 include_directories : dir_include,
3272 link_with : [lib_common, logindefs_c],
3273 build_by_default: program_tests)
3277 ############################################################
3281 'libuuid/src/test_uuid.c',
3282 include_directories : [dir_include, dir_libuuid],
3283 link_with : lib_uuid,
3284 dependencies : socket_libs,
3285 build_by_default: program_tests)
3286 if not is_disabler(exe)
3290 ############################################################
3292 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3293 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3297 'libfdisk/src/ask.c',
3298 c_args : libfdisk_tests_cflags,
3299 include_directories : lib_fdisk_includes,
3300 link_with : libfdisk_tests_ldadd,
3301 build_by_default: program_tests)
3302 if not is_disabler(exe)
3308 'libfdisk/src/gpt.c',
3309 c_args : libfdisk_tests_cflags,
3310 include_directories : lib_fdisk_includes,
3311 link_with : libfdisk_tests_ldadd,
3312 build_by_default: program_tests)
3313 if not is_disabler(exe)
3319 'libfdisk/src/utils.c',
3320 c_args : libfdisk_tests_cflags,
3321 include_directories : lib_fdisk_includes,
3322 link_with : libfdisk_tests_ldadd,
3323 build_by_default: program_tests)
3324 if not is_disabler(exe)
3329 'test_fdisk_script',
3330 'libfdisk/src/script.c',
3331 c_args : libfdisk_tests_cflags,
3332 include_directories : lib_fdisk_includes,
3333 link_with : libfdisk_tests_ldadd,
3334 build_by_default: program_tests)
3335 if not is_disabler(exe)
3340 'test_fdisk_version',
3341 'libfdisk/src/version.c',
3342 c_args : libfdisk_tests_cflags,
3343 include_directories : lib_fdisk_includes,
3344 link_with : libfdisk_tests_ldadd,
3345 build_by_default: program_tests)
3346 if not is_disabler(exe)
3352 'libfdisk/src/item.c',
3353 c_args : libfdisk_tests_cflags,
3354 include_directories : lib_fdisk_includes,
3355 link_with : libfdisk_tests_ldadd,
3356 build_by_default: program_tests)
3357 if not is_disabler(exe)
3361 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3364 'sample-fdisk-mkpart',
3365 'libfdisk/samples/mkpart.c',
3366 include_directories : lib_fdisk_includes,
3367 link_with : sample_fdisk_ldadd)
3368 if not is_disabler(exe)
3373 'sample-fdisk-mkpart-fullspec',
3374 'libfdisk/samples/mkpart-fullspec.c',
3375 include_directories : lib_fdisk_includes,
3376 link_with : sample_fdisk_ldadd)
3377 if not is_disabler(exe)
3381 ############################################################
3385 'tests/helpers/test_cap.c',
3386 include_directories : includes,
3387 dependencies : [lib_cap_ng],
3388 build_by_default: program_tests)
3389 if not is_disabler(exe)
3395 'tests/helpers/test_mbsencode.c',
3396 include_directories : includes,
3397 link_with : lib_common,
3398 build_by_default: program_tests)
3403 'tests/helpers/test_byteswap.c',
3404 include_directories : includes,
3405 build_by_default: program_tests)
3410 'tests/helpers/test_md5.c',
3412 include_directories : includes,
3413 build_by_default: program_tests)
3418 'tests/helpers/test_sha1.c',
3420 include_directories : includes,
3421 build_by_default: program_tests)
3426 'tests/helpers/test_pathnames.c',
3427 include_directories : includes,
3428 build_by_default: program_tests)
3433 'tests/helpers/test_strerror.c',
3434 include_directories : includes,
3435 build_by_default: program_tests)
3440 'tests/helpers/test_sysinfo.c',
3441 include_directories : includes,
3442 build_by_default: program_tests)
3447 'tests/helpers/test_sigreceive.c',
3448 include_directories : includes,
3449 link_with : lib_common,
3450 build_by_default: program_tests)
3455 'tests/helpers/test_tiocsti.c',
3456 include_directories : includes,
3457 build_by_default: program_tests)
3461 'test_uuid_namespace',
3462 'tests/helpers/test_uuid_namespace.c',
3466 include_directories : includes,
3467 build_by_default: program_tests)
3473 'tests/helpers/test_mkfds.c',
3474 'tests/helpers/test_mkfds.h',
3475 'tests/helpers/test_mkfds_ppoll.c',
3476 include_directories : includes,
3477 dependencies : mq_libs,
3478 build_by_default: program_tests)
3484 'tests/helpers/test_enosys.c',
3485 include_directories : includes,
3486 build_by_default: program_tests)
3489 ############################################################
3491 if conf.get('HAVE_OPENAT').to_string() == '1'
3493 'sample-scols-tree',
3494 'libsmartcols/samples/tree.c',
3495 include_directories : includes,
3496 link_with : [lib_smartcols, lib_common],
3497 build_by_default: program_tests)
3498 if not is_disabler(exe)
3504 'sample-scols-title',
3505 'libsmartcols/samples/title.c',
3506 include_directories : includes,
3507 link_with : [lib_smartcols, lib_common])
3508 if not is_disabler(exe)
3513 'sample-scols-wrap',
3514 'libsmartcols/samples/wrap.c',
3515 include_directories : includes,
3516 link_with : [lib_smartcols, lib_common])
3517 if not is_disabler(exe)
3522 'sample-scols-continuous',
3523 'libsmartcols/samples/continuous.c',
3524 include_directories : includes,
3525 link_with : [lib_smartcols, lib_common])
3526 if not is_disabler(exe)
3531 'sample-scols-continuous-json',
3532 'libsmartcols/samples/continuous-json.c',
3533 include_directories : includes,
3534 link_with : [lib_smartcols, lib_common])
3535 if not is_disabler(exe)
3540 'sample-scols-maxout',
3541 'libsmartcols/samples/maxout.c',
3542 include_directories : includes,
3543 link_with : [lib_smartcols, lib_common])
3544 if not is_disabler(exe)
3549 'sample-scols-fromfile',
3550 'libsmartcols/samples/fromfile.c',
3551 include_directories : includes,
3552 link_with : [lib_smartcols, lib_common])
3553 if not is_disabler(exe)
3558 'sample-scols-grouping-simple',
3559 'libsmartcols/samples/grouping-simple.c',
3560 include_directories : includes,
3561 link_with : [lib_smartcols, lib_common])
3562 if not is_disabler(exe)
3567 'sample-scols-grouping-overlay',
3568 'libsmartcols/samples/grouping-overlay.c',
3569 include_directories : includes,
3570 link_with : [lib_smartcols, lib_common])
3571 if not is_disabler(exe)
3577 'Documentation/boilerplate.c',
3578 include_directories : includes,
3579 build_by_default: program_tests)
3580 if not is_disabler(exe)
3584 ############################################################
3586 # Let the test runner know whether we're running under asan and export
3587 # some paths. We use a file on disk so that it is possible to run the
3588 # test scripts from commandline without setting any variables.
3589 configure_file(output : 'meson.conf',
3594 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3595 python.full_path())])
3597 run_sh = find_program('tests/run.sh')
3601 '--srcdir=' + meson.current_source_dir(),
3602 '--builddir=' + meson.current_build_dir(),
3608 manadocs += ['lib/terminal-colors.d.5.adoc']
3609 manadocs += ['libblkid/libblkid.3.adoc']
3613 'libuuid/man/uuid.3.adoc',
3614 'libuuid/man/uuid_clear.3.adoc',
3615 'libuuid/man/uuid_compare.3.adoc',
3616 'libuuid/man/uuid_copy.3.adoc',
3617 'libuuid/man/uuid_generate.3.adoc',
3618 'libuuid/man/uuid_is_null.3.adoc',
3619 'libuuid/man/uuid_parse.3.adoc',
3620 'libuuid/man/uuid_time.3.adoc',
3621 'libuuid/man/uuid_unparse.3.adoc']
3623 'uuid_generate_random.3': 'uuid_generate.3',
3624 'uuid_generate_time.3': 'uuid_generate.3',
3625 'uuid_generate_time_safe.3': 'uuid_generate.3',
3629 asciidoctor = find_program('asciidoctor', required : false)
3630 if asciidoctor.found()
3631 foreach adoc : manadocs
3632 name = adoc.split('/')[-1]
3633 page = name.split('.adoc')[0]
3634 section = page.split('.')[-1]
3635 mandirn = join_paths(mandir, 'man' + section)
3640 command : [ asciidoctor,
3642 '-a', 'VERSION=' + meson.project_version(),
3643 '-a', 'release-version=' + meson.project_version(),
3644 '-a', 'ADJTIME_PATH=/etc/adjtime',
3645 '-a', 'package-docdir=' + docdir,
3646 '--base-dir=' + meson.current_source_dir(),
3647 '--destination-dir=' + meson.current_build_dir(),
3648 '--load-path', '@SOURCE_ROOT@/tools',
3649 '--require', 'asciidoctor-includetracker',
3653 depfile : page + '.deps',
3655 install_dir : mandirn)
3658 foreach link_name, target : manlinks
3659 link_section = link_name.split('.')[-1]
3660 target_section = target.split('.')[-1]
3661 meson.add_install_script(meson_make_manpage_stub,
3662 join_paths('man' + target_section, target),
3663 join_paths(mandir, 'man' + link_section, link_name))
3667 if bash_completion.found()
3668 foreach completion : bashcompletions
3670 join_paths('bash-completion', completion),
3671 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3674 foreach link_name, target : bashcompletionslinks
3675 meson.add_install_script(meson_make_symlink,
3677 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))