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('usrbin_execdir', usrbin_exec_dir)
66 conf.set('usrsbin_execdir', usrsbin_exec_dir)
67 conf.set('docdir', docdir)
68 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
69 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
70 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
71 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
73 conf.set_quoted('_PATH_VENDORDIR', vendordir)
74 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
76 build_libblkid = not get_option('build-libblkid').disabled()
77 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
78 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
80 build_libuuid = not get_option('build-libuuid').disabled()
81 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
82 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
84 build_liblastlog2 = not get_option('build-liblastlog2').disabled()
85 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
86 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
88 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
89 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
90 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
92 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
93 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
95 build_libmount = not get_option('build-libmount').disabled()
96 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
97 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
98 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
99 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
101 build_libsmartcols = not get_option('build-libsmartcols').disabled()
102 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
103 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
105 build_libfdisk = not get_option('build-libfdisk').disabled()
106 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
107 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
109 build_uuidd = not get_option('build-uuidd').disabled()
110 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
111 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
113 static_programs = get_option('static-programs')
114 need_static_libs = static_programs.length() > 0 # a rough estimate...
115 summary('static programs', static_programs)
117 LINUX = host_machine.system() in ['linux']
118 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
120 ############################################################
138 have = cc.compiles(code, name : 'wchar_t support')
139 if not have and get_option('widechar').enabled()
140 error('widechar support requested but unavailable')
142 if get_option('ncurses').enabled() and get_option('widechar').enabled()
143 error('widechar support is incompatible with non-wide ncurses')
145 conf.set('HAVE_WIDECHAR', have ? 1 : false)
187 linux/net_namespace.h
201 security/pam_modules.h
234 lib_m = cc.find_library('m')
236 lib_tinfo = dependency(
238 required : get_option('tinfo'))
240 lib_ncursesw = dependency(
242 required : get_option('ncursesw'))
243 if lib_ncursesw.found()
244 headers += ['ncursesw/ncurses.h',
248 lib_ncurses = disabler()
250 lib_ncurses = dependency(
252 required : get_option('ncurses'))
253 headers += ['ncurses.h',
257 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
258 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
259 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
261 lib_slang = dependency(
263 required : get_option('slang'))
265 headers += ['slang.h',
270 conf.set('HAVE_SLANG', lib_slang.found())
272 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
273 if curses_libs.found()
274 have = cc.has_function('use_default_colors', dependencies : curses_libs)
275 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
276 have = cc.has_function('resizeterm', dependencies : curses_libs)
277 conf.set('HAVE_RESIZETERM', have ? 1 : false)
284 required : get_option('zlib'))
286 lib_readline = dependency(
288 required : get_option('readline'))
289 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
291 lib_readline_static = dependency(
294 required : need_static_libs ? get_option('readline') : disabler())
296 if meson.version().version_compare('>= 0.59.0')
297 lib_intl = dependency(
299 required : get_option('nls'))
300 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
302 if get_option('nls').enabled()
303 error('nls is not supported with meson before 0.59.0')
305 lib_intl = dependency('', required : false)
308 lib_user = dependency(
311 required : get_option('libuser'))
312 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
314 lib_util = cc.find_library(
316 required : get_option('libutil'))
317 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
319 lib_utempter = cc.find_library(
321 required : get_option('libutempter'))
322 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
324 systemd = dependency(
326 required : get_option('systemd'))
328 lib_systemd = dependency(
330 required : get_option('systemd'))
331 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
332 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
334 have = cc.has_function(
335 'sd_session_get_username',
336 dependencies : lib_systemd)
337 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
339 lib_udev = dependency(
341 required : get_option('systemd'))
342 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
344 lib_crypt = cc.find_library('crypt')
346 lib_pam = cc.find_library('pam', required : get_option('build-login'))
347 if not lib_pam.found()
348 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
350 if not lib_pam.found()
351 lib_pam = cc.find_library('pam', required : get_option('build-su'))
353 if not lib_pam.found()
354 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
357 lib_pam_misc = cc.find_library('pam_misc')
358 lib_pam = [lib_pam, lib_pam_misc]
360 lib_pam_misc = declare_dependency()
363 lib_cryptsetup = dependency(
365 required : get_option('cryptsetup'))
366 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
368 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
370 if meson.version().version_compare('>= 0.62.0')
371 lib_dl = dependency('dl')
373 lib_dl = cc.find_library('dl')
375 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
376 summary('cryptsetup support (dlopen)',
378 section : 'components')
380 summary('cryptsetup support',
381 lib_cryptsetup.found() ? 'enabled' : 'disabled',
382 section : 'components')
385 have = cc.has_function(
386 'crypt_activate_by_signed_key',
387 dependencies : lib_cryptsetup)
388 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
390 lib_cap_ng = dependency(
392 required : get_option('build-setpriv'))
393 if not lib_cap_ng.found()
394 lib_cap_ng = disabler()
397 lib_selinux = dependency(
400 required : get_option('selinux'))
401 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
403 lib_magic = dependency(
405 required : get_option('magic'))
406 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
408 lib_econf = dependency(
410 required : get_option('econf'))
411 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
413 lib_audit = dependency(
415 required : get_option('audit'))
416 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
418 conf.set('HAVE_SMACK', not get_option('smack').disabled())
420 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
422 foreach header : headers
423 have = cc.has_header(header)
424 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
427 header = 'linux/btrfs.h'
428 enable_btrfs = cc.has_header(header,
429 required : get_option('btrfs'))
430 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
431 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
433 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
438 have = cc.has_header(header,
440 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
443 have = cc.has_header('sched.h')
444 conf.set10('HAVE_DECL_CPU_ALLOC', have)
445 # We get -1 if the size cannot be determined
446 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
447 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
449 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
450 conf.set10('HAVE_ENVIRON_DECL', have)
452 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
453 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
455 have = cc.has_function('strsignal')
456 conf.set10('HAVE_STRSIGNAL_DECL', have)
458 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
459 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
461 have = cc.has_type('loff_t', prefix : '#include <sys/types.h>')
462 conf.set('HAVE_LOFF_T', have ? 1 : false)
464 have = cc.compiles('''
465 #define _GNU_SOURCE 1
466 #include <langinfo.h>
469 str = nl_langinfo (ALTMON_1);
470 str = nl_langinfo (ALTMON_2);
471 str = nl_langinfo (ALTMON_3);
472 str = nl_langinfo (ALTMON_4);
473 str = nl_langinfo (ALTMON_5);
474 str = nl_langinfo (ALTMON_6);
475 str = nl_langinfo (ALTMON_7);
476 str = nl_langinfo (ALTMON_8);
477 str = nl_langinfo (ALTMON_9);
478 str = nl_langinfo (ALTMON_10);
479 str = nl_langinfo (ALTMON_11);
480 str = nl_langinfo (ALTMON_12);
484 name : 'langinfo.h defines ALTMON_x constants')
485 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
487 have = cc.compiles('''
488 #define _GNU_SOURCE 1
489 #include <langinfo.h>
492 str = nl_langinfo (_NL_ABALTMON_1);
493 str = nl_langinfo (_NL_ABALTMON_2);
494 str = nl_langinfo (_NL_ABALTMON_3);
495 str = nl_langinfo (_NL_ABALTMON_4);
496 str = nl_langinfo (_NL_ABALTMON_5);
497 str = nl_langinfo (_NL_ABALTMON_6);
498 str = nl_langinfo (_NL_ABALTMON_7);
499 str = nl_langinfo (_NL_ABALTMON_8);
500 str = nl_langinfo (_NL_ABALTMON_9);
501 str = nl_langinfo (_NL_ABALTMON_10);
502 str = nl_langinfo (_NL_ABALTMON_11);
503 str = nl_langinfo (_NL_ABALTMON_12);
507 name : 'langinfo.h defines _NL_ABALTMON_x constants')
508 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
510 have = cc.compiles('''
511 #define _GNU_SOURCE 1
512 #include <langinfo.h>
515 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
519 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
520 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
553 landlock_create_ruleset
555 landlock_restrict_self
619 have = cc.has_function(func)
620 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
621 # This makes little sense, but is necessary to avoid warnings about
622 # redefined macros from Python.h, which uses this convention.
623 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
626 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
627 conf.set('AGETTY_RELOAD', have ? 1 : false)
629 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
632 have_dirfd = (cc.has_function('dirfd') or
633 cc.has_header_symbol('dirent.h', 'dirfd',
634 prefix : '#include <sys/types.h>'))
635 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
637 have_ddfd = cc.has_member('DIR', 'dd_fd',
639 #include <sys/types.h>
642 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
644 have = cc.has_member('struct tm', 'tm_gmtoff',
649 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
653 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
654 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
656 have = cc.has_member('struct termios', 'c_line',
657 prefix : '#include <termios.h>')
658 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
660 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
661 prefix : '#include <sys/stat.h>')
662 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
664 have = cc.has_member('struct statx', 'stx_mnt_id',
665 prefix : '#include <sys/stat.h>')
666 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
668 # replacement for AC_STRUCT_TIMEZONE
669 have = cc.has_member('struct tm', 'tm_zone',
670 prefix : '#include <time.h>')
671 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
673 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
674 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
676 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
677 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
679 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
680 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
685 extern char *tzname[];
688 return tzname ? 0 : 1;
690 '''.format(have ? 1 : 0)
691 have = cc.compiles(code, name : 'using tzname[]')
692 conf.set('HAVE_TZNAME', have ? 1 : false)
694 have = cc.sizeof('time_t', prefix : '#include <time.h>')
696 add_global_arguments('-D_TIME_BITS=64', language : 'c')
697 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
699 if get_option('allow-32bit-time')
700 warning('Could not make time_t 64bits wide')
702 error('Could not make time_t 64bits wide')
708 if not cc.has_function('socket')
709 socket_libs += cc.find_library('socket', required : true)
710 have = cc.has_function('socket',
711 dependencies : socket_libs)
713 error('socket() function not available')
718 have = cc.has_function('clock_gettime')
720 realtime_libs += cc.find_library('rt', required : true)
721 have = cc.has_function('clock_gettime',
722 dependencies : realtime_libs)
724 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
726 thread_libs = dependency('threads')
728 have = cc.has_function('timer_create')
730 realtime_libs = [cc.find_library('rt', required : true)]
731 have = cc.has_function('timer_create',
732 dependencies : realtime_libs)
734 realtime_libs += thread_libs
735 have = cc.has_function('timer_create',
736 dependencies : realtime_libs)
739 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
741 have = cc.has_function('setitimer')
742 conf.set('HAVE_SETITIMER', have ? 1 : false)
745 rtas_libs = cc.find_library('rtas', required : false)
746 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
749 if not cc.has_header_symbol('math.h', 'isnan')
750 lib = cc.find_library('m', required : true)
751 if (cc.has_function('isnan', dependencies : lib) and
752 cc.has_function('__isnan', dependencies : lib))
757 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
758 args : '-D_GNU_SOURCE')
759 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
762 extern char *__progname;
764 return (*__progname != 0);
767 have = cc.compiles(code, name : 'using __progname')
768 conf.set('HAVE___PROGNAME', have ? 1 : false)
770 have = conf.get('HAVE_PTY_H').to_string() == '1' \
771 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
772 conf.set('HAVE_PTY', have ? 1 : false)
774 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
775 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
777 build_plymouth_support = get_option('build-plymouth-support')
778 have_tiocglcktrmios = cc.has_header_symbol(
779 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
780 required : build_plymouth_support.enabled())
781 have_sock_cloexec = cc.has_header_symbol(
782 'sys/socket.h', 'SOCK_CLOEXEC',
783 prefix : '#include <sys/types.h>',
784 required : build_plymouth_support.enabled())
785 have_sock_nonblock = cc.has_header_symbol(
786 'sys/socket.h', 'SOCK_NONBLOCK',
787 prefix : '#include <sys/types.h>',
788 required : build_plymouth_support.enabled())
789 have_so_passcred = cc.has_header_symbol(
790 'sys/socket.h', 'SO_PASSCRED',
791 args : ['-D_GNU_SOURCE'],
792 prefix : '#include <sys/types.h>',
793 required : build_plymouth_support.enabled())
795 build_plymouth_support = (not build_plymouth_support.disabled() and
796 have_tiocglcktrmios and
797 have_sock_cloexec and
798 have_sock_nonblock and
800 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
801 summary('plymouth support',
802 build_plymouth_support ? 'enabled' : 'disabled',
803 section : 'components')
805 # check for valid fallocate() function
806 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
807 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
808 # and program can't be linked.
816 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
817 return ret == 0 ? 0 : 1;
820 have = cc.links(code, name : 'fallocate() function')
821 conf.set('HAVE_FALLOCATE', have ? 1 : false)
829 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
830 return ret == 0 ? 0 : 1;
833 have = cc.links(code, name : 'posix_fallocate() function')
834 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
836 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
837 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
838 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
840 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
841 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
842 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
844 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
846 ############################################################
849 fs_search_path = get_option('fs-search-path')
850 fs_search_path_extra = get_option('fs-search-path-extra')
851 if fs_search_path_extra != ''
852 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
854 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
856 systemdsystemunitdir = ''
858 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
861 sysvinit = get_option('sysvinit').enabled()
862 sysvinitrcdir = sysconfdir + '/init.d'
864 program_tests = get_option('program-tests')
866 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
867 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
869 have = get_option('chsh-only-listed')
870 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
872 have = get_option('use-tty-group')
873 conf.set('USE_TTY_GROUP', have ? 1 : false)
875 bison = find_program('bison')
876 flex = find_program('flex')
878 build_hwclock = not get_option('build-hwclock').disabled()
879 bison_gen = generator(
881 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
882 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
884 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
885 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
889 configuration : conf)
891 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
896 '-Waddress-of-packed-member',
897 '-Wdiscarded-qualifiers',
898 '-Wembedded-directive',
901 '-Wimplicit-function-declaration',
902 '-Wmissing-declarations',
903 '-Wmissing-parameter-type',
904 '-Wmissing-prototypes',
906 '-Wno-missing-field-initializers',
907 '-Wold-style-definition',
911 '-Wstrict-prototypes',
914 '-Wunused-but-set-parameter',
915 '-Wunused-but-set-variable',
916 '-Wunused-parameter',
922 foreach compiler_flag : compiler_flags
923 if cc.has_argument(compiler_flag)
924 add_project_arguments(compiler_flag, language : 'c')
932 bashcompletionslinks = {}
938 subdir('libsmartcols')
940 subdir('liblastlog2')
942 subdir('pam_lastlog2')
943 subdir('login-utils')
951 includes = [dir_include,
962 opt = not get_option('build-chfn-chsh').disabled()
967 include_directories : includes,
968 link_with : [lib_common, logindefs_c],
969 dependencies : chfn_chsh_deps,
970 install_dir : usrbin_exec_dir,
971 install_mode : 'rwsr-xr-x',
973 build_by_default : opt)
977 'login-utils/chsh.c',
980 include_directories : includes,
981 link_with : lib_common,
982 dependencies : chfn_chsh_deps,
983 install_dir : usrbin_exec_dir,
984 install_mode : 'rwsr-xr-x',
986 build_by_default : opt)
987 if opt and not is_disabler(exe)
989 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
990 bashcompletions += ['chfn', 'chsh']
995 test_islocal_sources,
996 include_directories : includes,
997 c_args : '-DTEST_PROGRAM',
998 build_by_default : program_tests)
1003 test_consoles_sources,
1004 c_args : ['-DTEST_PROGRAM'],
1005 include_directories : includes,
1006 link_with : lib_common,
1007 build_by_default : program_tests)
1010 opt = not get_option('build-last').disabled()
1014 include_directories : includes,
1015 link_with : [lib_common],
1016 install_dir : usrbin_exec_dir,
1018 build_by_default : opt)
1019 if opt and not is_disabler(exe)
1021 meson.add_install_script(meson_make_symlink,
1023 join_paths(usrbin_exec_dir, 'lastb'))
1024 manadocs += ['login-utils/last.1.adoc']
1025 manlinks += {'lastb.1': 'last.1'}
1026 bashcompletions += ['last']
1027 bashcompletionslinks += {'lastb': 'last'}
1030 opt = not get_option('build-nologin').disabled()
1033 'login-utils/nologin.c',
1034 include_directories : includes,
1035 install_dir : sbindir,
1036 link_with : [lib_common],
1038 build_by_default : opt)
1039 if opt and not is_disabler(exe)
1041 manadocs += ['login-utils/nologin.8.adoc']
1044 opt = not get_option('build-utmpdump').disabled()
1047 'login-utils/utmpdump.c',
1048 include_directories : includes,
1049 link_with : [lib_common],
1050 install_dir : usrbin_exec_dir,
1052 build_by_default : opt)
1053 if opt and not is_disabler(exe)
1055 manadocs += ['login-utils/utmpdump.1.adoc']
1056 bashcompletions += ['utmpdump']
1059 opt = not get_option('build-su').disabled()
1063 'login-utils/su-common.c',
1064 'login-utils/su-common.h',
1068 include_directories : includes,
1069 link_with : [lib_common, logindefs_c],
1070 dependencies : [lib_pam,
1074 install_mode : 'rwsr-xr-x',
1076 build_by_default : opt)
1077 if opt and not is_disabler(exe)
1079 manadocs += ['login-utils/su.1.adoc']
1080 bashcompletions += ['su']
1083 opt = not get_option('build-newgrp').disabled()
1086 'login-utils/newgrp.c',
1087 include_directories : includes,
1088 dependencies : [lib_crypt],
1089 install_dir : usrbin_exec_dir,
1090 install_mode : 'rwsr-xr-x',
1092 build_by_default : opt)
1093 if opt and not is_disabler(exe)
1095 manadocs += ['login-utils/newgrp.1.adoc']
1096 bashcompletions += ['newgrp']
1099 opt = not get_option('build-lslogins').disabled()
1102 'login-utils/lslogins.c',
1103 include_directories : includes,
1104 link_with : [lib_common,
1107 dependencies : [lib_selinux,
1109 install_dir : usrbin_exec_dir,
1111 build_by_default : opt)
1112 if opt and not is_disabler(exe)
1114 manadocs += ['login-utils/lslogins.1.adoc']
1115 bashcompletions += ['lslogins']
1118 opt = not get_option('build-vipw').disabled()
1121 'login-utils/vipw.c',
1122 'login-utils/setpwnam.h',
1123 include_directories : includes,
1124 link_with : [lib_common],
1125 dependencies : [lib_selinux],
1126 install_dir : usrbin_exec_dir,
1128 build_by_default : opt)
1129 if opt and not is_disabler(exe)
1131 meson.add_install_script(meson_make_symlink,
1133 join_paths(usrbin_exec_dir, 'vigr'))
1134 manadocs += ['login-utils/vipw.8.adoc']
1135 meson.add_install_script(meson_make_symlink,
1137 join_paths(mandir, 'man8/vigr.8'))
1140 opt = not get_option('build-runuser').disabled()
1143 'login-utils/runuser.c',
1144 'login-utils/su-common.c',
1145 'login-utils/su-common.h',
1149 include_directories : includes,
1150 link_with : [lib_common, logindefs_c],
1151 dependencies : [lib_pam,
1155 install_dir : sbindir,
1157 build_by_default : opt)
1158 if opt and not is_disabler(exe)
1160 manadocs += ['login-utils/runuser.1.adoc']
1161 bashcompletionslinks += {'runuser': 'su'}
1164 ############################################################
1170 include_directories : includes,
1171 link_with : lib_common,
1172 install_dir : usrbin_exec_dir,
1175 manadocs += ['text-utils/col.1.adoc']
1176 bashcompletions += ['col']
1182 include_directories : includes,
1183 install_dir : usrbin_exec_dir,
1186 manadocs += ['text-utils/colcrt.1.adoc']
1187 bashcompletions += ['colcrt']
1192 include_directories : includes,
1193 link_with : lib_common,
1194 install_dir : usrbin_exec_dir,
1197 manadocs += ['text-utils/colrm.1.adoc']
1198 bashcompletions += ['colrm']
1203 include_directories : includes,
1204 install_dir : usrbin_exec_dir,
1207 manadocs += ['text-utils/rev.1.adoc']
1208 bashcompletions += ['rev']
1213 include_directories : includes,
1214 link_with : [lib_common,
1216 install_dir : usrbin_exec_dir,
1218 if not is_disabler(exe)
1220 manadocs += ['text-utils/column.1.adoc']
1221 bashcompletions += ['column']
1224 opt = not get_option('build-line').disabled()
1228 include_directories : includes,
1229 install_dir : usrbin_exec_dir,
1231 build_by_default : opt)
1232 if opt and not is_disabler(exe)
1234 manadocs += ['text-utils/line.1.adoc']
1237 opt = not get_option('build-pg').disabled()
1241 link_with : lib_common,
1242 include_directories : includes,
1243 dependencies : [lib_tinfo,
1245 install_dir : usrbin_exec_dir,
1247 build_by_default : opt)
1248 if opt and not is_disabler(exe)
1250 manadocs += ['text-utils/pg.1.adoc']
1251 bashcompletions += ['pg']
1254 opt = not get_option('build-ul').disabled()
1258 include_directories : includes,
1259 dependencies : [lib_tinfo,
1261 install_dir : usrbin_exec_dir,
1263 build_by_default : opt)
1264 if opt and not is_disabler(exe)
1266 manadocs += ['text-utils/ul.1.adoc']
1267 bashcompletions += ['ul']
1270 opt = not get_option('build-more').disabled()
1274 link_with : [lib_common],
1275 include_directories : includes,
1276 dependencies : [lib_tinfo,
1280 build_by_default : opt)
1284 link_with : [lib_common],
1285 include_directories : includes,
1286 c_args : '-DTEST_PROGRAM',
1287 dependencies : [lib_tinfo,
1290 build_by_default : opt and program_tests)
1292 if opt and not is_disabler(exe)
1294 manadocs += ['text-utils/more.1.adoc']
1295 bashcompletions += ['more']
1301 include_directories : includes,
1302 link_with : [lib_common,
1304 install_dir : usrbin_exec_dir,
1306 if not is_disabler(exe)
1308 manadocs += ['text-utils/hexdump.1.adoc']
1309 bashcompletions += ['hexdump']
1312 opt = not get_option('build-lsmem').disabled()
1316 include_directories : includes,
1317 link_with : [lib_common,
1319 install_dir : usrbin_exec_dir,
1321 build_by_default : opt)
1322 if opt and not is_disabler(exe)
1324 manadocs += ['sys-utils/lsmem.1.adoc']
1325 bashcompletions += ['lsmem']
1328 opt = not get_option('build-chmem').disabled()
1332 include_directories : includes,
1333 link_with : [lib_common],
1334 install_dir : usrbin_exec_dir,
1336 build_by_default : opt)
1337 if opt and not is_disabler(exe)
1339 manadocs += ['sys-utils/chmem.8.adoc']
1340 bashcompletions += ['chmem']
1346 include_directories : includes,
1347 link_with : [lib_common],
1348 install_dir : usrbin_exec_dir,
1351 manadocs += ['sys-utils/choom.1.adoc']
1356 include_directories : includes,
1357 link_with : [lib_common],
1358 install_dir : usrbin_exec_dir,
1361 manadocs += ['sys-utils/ipcmk.1.adoc']
1362 bashcompletions += ['ipcmk']
1367 include_directories : includes,
1368 link_with : [lib_common],
1369 install_dir : usrbin_exec_dir,
1372 manadocs += ['sys-utils/ipcrm.1.adoc']
1373 bashcompletions += ['ipcrm']
1375 opt = not get_option('build-ipcs').disabled()
1379 include_directories : includes,
1380 link_with : [lib_common],
1381 install_dir : usrbin_exec_dir,
1383 build_by_default : opt)
1384 if opt and not is_disabler(exe)
1386 manadocs += ['sys-utils/ipcs.1.adoc']
1387 bashcompletions += ['ipcs']
1390 opt = not get_option('build-rfkill').disabled()
1394 include_directories : includes,
1395 link_with : [lib_common,
1397 install_dir : usrsbin_exec_dir,
1399 build_by_default : opt)
1400 if opt and not is_disabler(exe)
1402 manadocs += ['sys-utils/rfkill.8.adoc']
1403 bashcompletions += ['rfkill']
1409 include_directories : includes,
1410 link_with : [lib_common,
1412 install_dir : usrbin_exec_dir,
1414 if not is_disabler(exe)
1416 manadocs += ['sys-utils/renice.1.adoc']
1417 bashcompletions += ['renice']
1423 include_directories: includes,
1424 link_with : [lib_common,
1426 install_dir : usrbin_exec_dir,
1428 if opt and not is_disabler(exe)
1430 manadocs += ['sys-utils/setpgid.1.adoc']
1431 bashcompletions += ['setpgid']
1437 include_directories : includes,
1438 link_with : [lib_common,
1440 install_dir : usrbin_exec_dir,
1442 if opt and not is_disabler(exe)
1444 manadocs += ['sys-utils/setsid.1.adoc']
1445 bashcompletions += ['setsid']
1450 readprofile_sources,
1451 include_directories : includes,
1452 link_with : [lib_common,
1454 install_dir : usrsbin_exec_dir,
1456 if not is_disabler(exe)
1458 manadocs += ['sys-utils/readprofile.8.adoc']
1459 bashcompletions += ['readprofile']
1462 opt = not get_option('build-tunelp').disabled()
1466 include_directories : includes,
1467 link_with : [lib_common],
1468 install_dir : usrsbin_exec_dir,
1470 build_by_default : opt)
1471 if opt and not is_disabler(exe)
1473 manadocs += ['sys-utils/tunelp.8.adoc']
1474 bashcompletions += ['tunelp']
1480 include_directories : includes,
1481 link_with : [lib_common,
1483 install_dir : sbindir,
1485 if not is_disabler(exe)
1487 manadocs += ['sys-utils/fstrim.8.adoc']
1488 bashcompletions += ['fstrim']
1494 include_directories : includes,
1495 link_with : [lib_common,
1498 if not is_disabler(exe)
1500 manadocs += ['sys-utils/dmesg.1.adoc']
1501 bashcompletions += ['dmesg']
1507 include_directories : dir_include,
1508 c_args : '-DTEST_DMESG',
1509 link_with : [lib_common,
1511 build_by_default : program_tests)
1512 if not is_disabler(exe)
1519 include_directories : includes,
1520 link_with : [lib_common],
1521 install_dir : sbindir,
1524 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1525 bashcompletions += ['ctrlaltdel']
1530 include_directories : includes,
1531 install_dir : sbindir,
1534 manadocs += ['sys-utils/fsfreeze.8.adoc']
1535 bashcompletions += ['fsfreeze']
1540 include_directories : includes,
1541 link_with : [lib_common,
1543 install_dir : sbindir,
1546 manadocs += ['sys-utils/blkdiscard.8.adoc']
1547 bashcompletions += ['blkdiscard']
1552 include_directories : includes,
1553 link_with : [lib_common],
1554 install_dir : sbindir,
1557 manadocs += ['sys-utils/blkzone.8.adoc']
1558 bashcompletions += ['blkzone']
1563 include_directories : includes,
1564 link_with : [lib_common],
1565 install_dir : sbindir,
1568 manadocs += ['sys-utils/blkpr.8.adoc']
1573 include_directories : includes,
1574 link_with : [lib_common],
1575 install_dir : usrsbin_exec_dir,
1578 manadocs += ['sys-utils/ldattach.8.adoc']
1579 bashcompletions += ['ldattach']
1584 include_directories : includes,
1585 link_with : [lib_common],
1586 install_dir : usrsbin_exec_dir,
1589 manadocs += ['sys-utils/rtcwake.8.adoc']
1590 bashcompletions += ['rtcwake']
1595 include_directories : includes,
1596 link_with : [lib_common],
1597 install_dir : usrbin_exec_dir,
1600 manadocs += ['sys-utils/setarch.8.adoc']
1601 bashcompletions += ['setarch']
1603 setarch_links = ['uname26', 'linux32', 'linux64']
1604 setarch_links_arch = {
1605 's390x' : ['s390', 's390x'],
1607 'x86_64' : ['i386', 'x86_64'],
1608 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1609 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1610 'mips64' : ['mips', 'mips64', 'mips32'],
1611 'ia64' : ['i386', 'ia64'],
1612 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1614 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1616 foreach link: setarch_links
1617 meson.add_install_script(meson_make_symlink,
1619 join_paths(usrbin_exec_dir, link))
1620 manlinks += {link + '.8': 'setarch.8'}
1623 opt = not get_option('build-eject').disabled()
1627 include_directories : includes,
1628 link_with : [lib_common,
1630 install_dir : usrbin_exec_dir,
1632 build_by_default : opt)
1633 if opt and not is_disabler(exe)
1635 manadocs += ['sys-utils/eject.1.adoc']
1636 bashcompletions += ['eject']
1639 opt = not get_option('build-losetup').disabled()
1643 include_directories : includes,
1644 link_with : [lib_common,
1646 install_dir : sbindir,
1648 build_by_default : opt)
1649 if opt and not is_disabler(exe)
1650 manadocs += ['sys-utils/losetup.8.adoc']
1652 bashcompletions += ['losetup']
1655 opt = opt and 'losetup' in static_programs
1659 include_directories : includes,
1660 link_args : ['--static'],
1661 link_with : [lib_common,
1662 lib_smartcols.get_static_lib()],
1663 install_dir : sbindir,
1665 build_by_default : opt)
1666 if opt and not is_disabler(exe)
1670 opt = not get_option('build-zramctl').disabled()
1674 include_directories : includes,
1675 link_with : [lib_common,
1677 install_dir : sbindir,
1679 build_by_default : opt)
1680 if opt and not is_disabler(exe)
1682 manadocs += ['sys-utils/zramctl.8.adoc']
1683 bashcompletions += ['zramctl']
1689 include_directories : includes,
1690 link_with : [lib_common,
1692 install_dir : usrbin_exec_dir,
1694 if not is_disabler(exe)
1696 manadocs += ['sys-utils/prlimit.1.adoc']
1697 bashcompletions += ['prlimit']
1703 include_directories : includes,
1704 link_with : [lib_common,
1707 install_dir : usrbin_exec_dir,
1709 if not is_disabler(exe)
1711 manadocs += ['sys-utils/lsns.8.adoc']
1712 bashcompletions += ['lsns']
1715 opt = not get_option('build-mount').disabled()
1719 include_directories : includes,
1720 link_with : [lib_common,
1723 dependencies : lib_selinux,
1724 install_mode : 'rwsr-xr-x',
1726 build_by_default : opt)
1730 include_directories : includes,
1731 link_with : [lib_common,
1733 install_mode : 'rwsr-xr-x',
1735 build_by_default : opt)
1736 if opt and not is_disabler(exe)
1738 manadocs += ['sys-utils/fstab.5.adoc',
1739 'sys-utils/mount.8.adoc',
1740 'sys-utils/umount.8.adoc']
1741 bashcompletions += ['mount', 'umount']
1744 opt2 = opt and 'mount' in static_programs
1748 include_directories : includes,
1749 link_args : ['--static'],
1750 link_with : [lib_common,
1751 lib_smartcols_static,
1754 build_by_default : opt2)
1755 if opt2 and not is_disabler(exe)
1759 opt2 = opt and 'umount' in static_programs
1763 include_directories : includes,
1764 link_args : ['--static'],
1765 link_with : [lib_common,
1768 build_by_default : opt2)
1769 if opt2 and not is_disabler(exe)
1778 include_directories : includes,
1779 link_with : [lib_common,
1783 install_dir : sbindir,
1785 if not is_disabler(exe)
1787 manadocs += ['sys-utils/swapon.8.adoc']
1788 bashcompletions += ['swapon']
1794 include_directories : includes,
1795 link_with : [lib_common,
1798 install_dir : sbindir,
1800 if not is_disabler(exe)
1802 manlinks += {'swapoff.8': 'swapon.8'}
1803 bashcompletions += ['swapoff']
1809 include_directories : includes,
1810 link_with : [lib_common,
1812 dependencies : [rtas_libs],
1813 install_dir : usrbin_exec_dir,
1815 if not is_disabler(exe)
1817 manadocs += ['sys-utils/lscpu.1.adoc']
1818 bashcompletions += ['lscpu']
1824 include_directories : includes,
1825 link_with : [lib_common],
1826 install_dir : sbindir,
1829 manadocs += ['sys-utils/chcpu.8.adoc']
1830 bashcompletions += ['chcpu']
1835 include_directories : includes,
1836 link_with : [lib_common,
1839 if not is_disabler(exe)
1841 manadocs += ['sys-utils/wdctl.8.adoc']
1842 bashcompletions += ['wdctl']
1845 opt = not get_option('build-mountpoint').disabled()
1849 include_directories : includes,
1850 link_with : [lib_mount],
1852 build_by_default : opt)
1853 if opt and not is_disabler(exe)
1855 manadocs += ['sys-utils/mountpoint.1.adoc']
1856 bashcompletions += ['mountpoint']
1859 opt = not get_option('build-fallocate').disabled()
1863 include_directories : includes,
1864 link_with : [lib_common],
1865 install_dir : usrbin_exec_dir,
1867 build_by_default : opt)
1868 if opt and not is_disabler(exe)
1870 manadocs += ['sys-utils/fallocate.1.adoc']
1871 bashcompletions += ['fallocate']
1874 opt = not get_option('build-pivot_root').disabled()
1878 include_directories : includes,
1879 install_dir : sbindir,
1881 build_by_default : opt)
1882 if opt and not is_disabler(exe)
1884 manadocs += ['sys-utils/pivot_root.8.adoc']
1885 bashcompletions += ['pivot_root']
1888 opt = not get_option('build-switch_root').disabled()
1889 if opt and not have_dirfd and not have_ddfd
1890 error('neither dirfd nor ddfd are available')
1894 switch_root_sources,
1895 include_directories : includes,
1896 install_dir : sbindir,
1898 build_by_default : opt)
1899 if opt and not is_disabler(exe)
1901 manadocs += ['sys-utils/switch_root.8.adoc']
1904 opt = not get_option('build-unshare').disabled()
1908 include_directories : includes,
1909 link_with : [lib_common],
1910 install_dir : usrbin_exec_dir,
1912 build_by_default : opt)
1913 if opt and not is_disabler(exe)
1915 manadocs += ['sys-utils/unshare.1.adoc']
1916 bashcompletions += ['unshare']
1919 opt = opt and 'unshare' in static_programs
1923 include_directories : includes,
1924 link_with : [lib_common],
1925 install_dir : usrbin_exec_dir,
1927 build_by_default : opt)
1928 if opt and not is_disabler(exe)
1932 opt = not get_option('build-nsenter').disabled()
1936 include_directories : includes,
1937 link_with : [lib_common],
1938 dependencies : [lib_selinux],
1939 install_dir : usrbin_exec_dir,
1941 build_by_default : opt)
1942 if opt and not is_disabler(exe)
1944 manadocs += ['sys-utils/nsenter.1.adoc']
1945 bashcompletions += ['nsenter']
1948 opt = opt and 'nsenter' in static_programs
1952 include_directories : includes,
1953 link_with : [lib_common],
1954 dependencies : [lib_selinux],
1955 install_dir : usrbin_exec_dir,
1957 build_by_default : opt)
1958 if opt and not is_disabler(exe)
1962 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1966 include_directories : includes,
1967 link_with : [lib_common],
1968 dependencies : [lib_cap_ng],
1969 install_dir : usrbin_exec_dir,
1971 build_by_default : opt)
1972 if opt and not is_disabler(exe)
1974 manadocs += ['sys-utils/setpriv.1.adoc']
1975 bashcompletions += ['setpriv']
1981 include_directories : includes,
1982 link_with : [lib_common],
1983 dependencies : realtime_libs,
1984 install_dir : usrbin_exec_dir,
1987 manadocs += ['sys-utils/flock.1.adoc']
1988 bashcompletions += ['flock']
1990 opt = not get_option('build-lsirq').disabled()
1994 include_directories : includes,
1995 link_with : [lib_common,
1997 install_dir : usrbin_exec_dir,
1999 build_by_default : opt)
2000 if opt and not is_disabler(exe)
2002 manadocs += ['sys-utils/lsirq.1.adoc']
2003 bashcompletions += ['lsirq']
2006 opt = not get_option('build-irqtop').disabled()
2010 include_directories : includes,
2011 dependencies : [realtime_libs, curses_libs],
2012 link_with : [lib_common,
2015 install_dir : usrbin_exec_dir,
2017 build_by_default : opt)
2018 if opt and not is_disabler(exe)
2020 manadocs += ['sys-utils/irqtop.1.adoc']
2021 bashcompletions += ['irqtop']
2024 opt = not get_option('build-ipcs').disabled()
2028 include_directories : includes,
2029 link_with : [lib_common,
2031 install_dir : usrbin_exec_dir,
2033 build_by_default : opt)
2034 if opt and not is_disabler(exe)
2036 manadocs += ['sys-utils/lsipc.1.adoc']
2037 bashcompletions += ['lsipc']
2044 include_directories : includes,
2045 link_with : [lib_common],
2046 dependencies : [lib_m,
2048 install_dir : sbindir,
2050 build_by_default : opt)
2051 if opt and not is_disabler(exe)
2053 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2054 bashcompletions += ['hwclock']
2060 include_directories : includes,
2061 install_dir : sbindir,
2064 manadocs += ['disk-utils/mkfs.8.adoc']
2065 bashcompletions += ['mkfs']
2067 opt = not get_option('build-bfs').disabled()
2071 include_directories : includes,
2072 link_with : [lib_common],
2073 install_dir : sbindir,
2075 build_by_default : opt)
2076 if opt and not is_disabler(exe)
2078 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2079 bashcompletions += ['mkfs.bfs']
2085 include_directories : includes,
2086 link_with : [lib_common],
2087 install_dir : usrbin_exec_dir,
2090 manadocs += ['disk-utils/isosize.8.adoc']
2091 bashcompletions += ['isosize']
2096 include_directories : includes,
2097 link_with : [lib_common,
2100 dependencies: [lib_selinux],
2101 install_dir : sbindir,
2103 if not is_disabler(exe)
2105 manadocs += ['disk-utils/mkswap.8.adoc']
2106 bashcompletions += ['mkswap']
2112 include_directories : includes,
2113 link_with : [lib_common,
2116 install_dir : sbindir,
2118 if not is_disabler(exe)
2120 manadocs += ['disk-utils/swaplabel.8.adoc']
2121 bashcompletions += ['swaplabel']
2124 opt = not get_option('build-fsck').disabled()
2128 include_directories : includes,
2129 link_with : [lib_common,
2132 dependencies : realtime_libs,
2133 install_dir : sbindir,
2135 build_by_default : opt)
2136 if opt and not is_disabler(exe)
2138 manadocs += ['disk-utils/fsck.8.adoc']
2139 bashcompletions += ['fsck']
2142 opt = not get_option('build-minix').disabled()
2146 include_directories : includes,
2147 link_with : [lib_common],
2148 install_dir : sbindir,
2150 build_by_default : opt)
2154 include_directories : includes,
2155 c_args : '-DTEST_SCRIPT',
2156 link_with : [lib_common],
2157 build_by_default : opt and program_tests)
2161 include_directories : includes,
2162 link_with : [lib_common],
2163 install_dir : sbindir,
2165 build_by_default : opt)
2166 if opt and not is_disabler(exe)
2167 exes += [exe, exe2, exe3]
2168 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2169 bashcompletions += ['mkfs.minix', 'fsck.minix']
2172 opt = not get_option('build-cramfs').disabled()
2175 mkfs_cramfs_sources,
2176 include_directories : includes,
2177 link_with : [lib_common],
2178 dependencies : [lib_z],
2179 install_dir : sbindir,
2181 build_by_default : opt)
2184 fsck_cramfs_sources,
2185 include_directories : includes,
2186 link_with : [lib_common],
2187 dependencies : [lib_z],
2188 install_dir : sbindir,
2190 build_by_default : opt)
2191 if not is_disabler(exe)
2193 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2194 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2197 opt = not get_option('build-raw').disabled()
2199 cc.has_header('linux/raw.h', required: opt)
2204 include_directories : includes,
2205 install_dir : sbindir,
2207 build_by_default : opt)
2208 if opt and not is_disabler(exe)
2210 manadocs += ['disk-utils/raw.8.adoc']
2211 bashcompletions += ['raw']
2214 opt = not get_option('build-fdformat').disabled()
2218 include_directories : includes,
2219 link_with : [lib_common],
2220 install_dir : usrsbin_exec_dir,
2222 build_by_default : opt)
2223 if opt and not is_disabler(exe)
2225 manadocs += ['disk-utils/fdformat.8.adoc']
2226 bashcompletions += ['fdformat']
2232 include_directories : includes,
2233 link_with : [lib_common],
2234 install_dir : sbindir,
2236 manadocs += ['disk-utils/blockdev.8.adoc']
2237 bashcompletions += ['blockdev']
2239 opt = not get_option('build-fdisks').disabled()
2240 if opt and not have_dirfd and not have_ddfd
2241 error('neither dirfd nor ddfd are available')
2246 include_directories : includes,
2247 link_with : [lib_common,
2251 dependencies : [lib_readline],
2252 install_dir : sbindir,
2254 build_by_default : opt)
2255 if opt and not is_disabler(exe)
2257 bashcompletions += ['fdisk']
2260 opt2 = opt and 'fdisk' in static_programs
2264 link_args : ['--static'],
2265 include_directories : includes,
2266 link_with : [lib_common,
2269 lib_smartcols.get_static_lib()],
2270 dependencies : [lib_readline_static],
2271 install_dir : sbindir,
2273 build_by_default : opt2)
2274 if opt2 and not is_disabler(exe)
2281 include_directories : includes,
2282 link_with : [lib_common,
2286 dependencies : [lib_readline],
2287 install_dir : sbindir,
2289 build_by_default : opt)
2290 if opt and not is_disabler(exe)
2292 bashcompletions += ['sfdisk']
2295 opt2 = opt and 'sfdisk' in static_programs
2299 include_directories : includes,
2300 link_with : [lib_common,
2303 lib_smartcols.get_static_lib()],
2304 dependencies : [lib_readline_static],
2305 install_dir : sbindir,
2307 build_by_default : opt2)
2308 if opt2 and not is_disabler(exe)
2315 include_directories : includes,
2316 link_with : [lib_common,
2321 dependencies : [curses_libs],
2322 install_dir : sbindir,
2324 build_by_default : opt)
2325 if opt and not is_disabler(exe)
2327 manadocs += ['disk-utils/fdisk.8.adoc',
2328 'disk-utils/sfdisk.8.adoc',
2329 'disk-utils/cfdisk.8.adoc']
2330 bashcompletions += ['cfdisk']
2333 opt = not get_option('build-partx').disabled()
2337 include_directories : includes,
2338 link_with : [lib_common],
2339 install_dir : usrsbin_exec_dir,
2341 build_by_default : opt)
2345 include_directories : includes,
2346 link_with : [lib_common],
2347 install_dir : usrsbin_exec_dir,
2349 build_by_default : opt)
2353 include_directories : includes,
2354 link_with : [lib_common],
2355 install_dir : usrsbin_exec_dir,
2357 build_by_default : opt)
2361 include_directories : includes,
2362 link_with : [lib_common,
2365 install_dir : usrsbin_exec_dir,
2367 build_by_default : opt)
2369 exes += [exe, exe2, exe3, exe4]
2370 manadocs += ['disk-utils/addpart.8.adoc',
2371 'disk-utils/delpart.8.adoc',
2372 'disk-utils/resizepart.8.adoc',
2373 'disk-utils/partx.8.adoc']
2374 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2377 ############################################################
2382 include_directories : includes,
2383 link_with : [lib_common],
2384 dependencies : [lib_util,
2388 install_dir : usrbin_exec_dir,
2391 manadocs += ['term-utils/script.1.adoc']
2392 bashcompletions += ['script']
2397 include_directories : includes,
2398 c_args : '-DTEST_SCRIPT',
2399 link_with : [lib_common],
2400 dependencies : [lib_util,
2404 build_by_default : program_tests)
2410 include_directories : includes,
2411 link_with : [lib_common],
2412 dependencies : [lib_util,
2415 install_dir : usrbin_exec_dir,
2418 manadocs += ['term-utils/scriptlive.1.adoc']
2419 bashcompletions += ['scriptlive']
2423 scriptreplay_sources,
2424 include_directories : includes,
2425 link_with : [lib_common],
2426 dependencies : [math_libs],
2427 install_dir : usrbin_exec_dir,
2430 manadocs += ['term-utils/scriptreplay.1.adoc']
2431 bashcompletions += ['scriptreplay']
2433 opt = not get_option('build-agetty').disabled()
2437 include_directories : includes,
2438 link_with : [lib_common, logindefs_c],
2439 dependencies : [BSD ? lib_util : [], lib_systemd],
2440 install_dir : sbindir,
2442 build_by_default : opt)
2445 manadocs += ['term-utils/agetty.8.adoc']
2448 opt = not get_option('build-setterm').disabled()
2452 include_directories : includes,
2453 link_with : [lib_common],
2454 dependencies : [curses_libs],
2455 install_dir : usrbin_exec_dir,
2457 build_by_default : opt)
2460 manadocs += ['term-utils/setterm.1.adoc']
2461 bashcompletions += ['setterm']
2464 opt = not get_option('build-mesg').disabled()
2468 include_directories : includes,
2469 link_with : [lib_common],
2470 install_dir : usrbin_exec_dir,
2472 build_by_default : opt)
2475 manadocs += ['term-utils/mesg.1.adoc']
2476 bashcompletions += ['mesg']
2479 opt = not get_option('build-wall').disabled()
2483 include_directories : includes,
2484 link_with : [lib_common],
2485 dependencies : [lib_systemd],
2486 install_dir : usrbin_exec_dir,
2487 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2489 build_by_default : opt)
2492 manadocs += ['term-utils/wall.1.adoc']
2493 bashcompletions += ['wall']
2496 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2497 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2499 opt = not get_option('build-write').disabled()
2503 include_directories : includes,
2504 link_with : [lib_common],
2505 dependencies : [lib_systemd],
2506 install_dir : usrbin_exec_dir,
2507 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2509 build_by_default : opt)
2512 manadocs += ['term-utils/write.1.adoc']
2513 bashcompletions += ['write']
2516 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2517 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2519 opt = not get_option('build-login').disabled()
2523 include_directories : includes,
2524 link_with : [lib_common, logindefs_c],
2525 dependencies : [lib_pam,
2529 build_by_default : opt)
2530 if not is_disabler(exe)
2532 manadocs += ['login-utils/login.1.adoc']
2535 opt = not get_option('build-sulogin').disabled()
2539 include_directories : includes,
2540 link_with : [lib_common],
2541 dependencies : [lib_crypt,
2543 install_dir : sbindir,
2545 build_by_default : opt)
2546 if not is_disabler(exe)
2548 manadocs += ['login-utils/sulogin.8.adoc']
2554 include_directories : includes,
2555 link_with : [lib_common,
2557 dependencies : [curses_libs],
2558 install_dir : usrbin_exec_dir,
2561 manadocs += ['misc-utils/cal.1.adoc']
2562 bashcompletions += ['cal']
2564 opt = not get_option('build-logger').disabled()
2568 include_directories : includes,
2569 link_with : [lib_common],
2570 dependencies : [lib_systemd],
2571 install_dir : usrbin_exec_dir,
2573 build_by_default : opt)
2574 if opt and not is_disabler(exe)
2576 manadocs += ['misc-utils/logger.1.adoc']
2577 bashcompletions += ['logger']
2583 include_directories : includes,
2584 c_args : '-DTEST_LOGGER',
2585 link_with : [lib_common],
2586 dependencies : [lib_systemd],
2587 build_by_default: program_tests)
2588 if not is_disabler(exe)
2595 include_directories : includes,
2596 install_dir : usrbin_exec_dir,
2599 manadocs += ['misc-utils/look.1.adoc']
2600 bashcompletions += ['look']
2605 include_directories : includes,
2606 link_with : [lib_common],
2607 install_dir : usrbin_exec_dir,
2610 manadocs += ['misc-utils/mcookie.1.adoc']
2611 bashcompletions += ['mcookie']
2613 if build_liblastlog2
2617 include_directories : includes,
2618 link_with : [lib_common, lib_lastlog2],
2619 install_dir : usrbin_exec_dir,
2622 manadocs += ['misc-utils/lastlog2.8.adoc']
2623 bashcompletions += ['lastlog2']
2624 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2625 'liblastlog2/man/ll2_write_entry.3.adoc',
2626 'liblastlog2/man/ll2_read_entry.3.adoc',
2627 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2628 'liblastlog2/man/ll2_read_all.3.adoc',
2629 'liblastlog2/man/ll2_remove_entry.3.adoc',
2630 'liblastlog2/man/ll2_rename_user.3.adoc',
2631 'liblastlog2/man/ll2_update_login_time.3.adoc'
2638 include_directories : includes,
2639 dependencies : [lib_selinux],
2640 install_dir : usrbin_exec_dir,
2643 manadocs += ['misc-utils/namei.1.adoc']
2644 bashcompletions += ['namei']
2649 include_directories : includes,
2650 link_with : [lib_common],
2651 install_dir : usrbin_exec_dir,
2654 manadocs += ['misc-utils/whereis.1.adoc']
2655 bashcompletions += ['whereis']
2660 include_directories : includes,
2661 link_with : [lib_common,
2664 install_dir : usrbin_exec_dir,
2666 if not is_disabler(exe)
2668 manadocs += ['misc-utils/lslocks.8.adoc']
2669 bashcompletions += ['lslocks']
2675 include_directories : includes,
2676 link_with : [lib_common,
2681 dependencies : lib_udev,
2683 if not is_disabler(exe)
2685 manadocs += ['misc-utils/lsblk.8.adoc']
2686 bashcompletions += ['lsblk']
2689 errnos_h = custom_target('errnos.h',
2690 input : 'tools/all_errnos',
2691 output : 'errnos.h',
2692 command : ['tools/all_errnos', cc.cmd_array()]
2696 mq_libs += cc.find_library('rt', required : true)
2700 lsfd_sources, errnos_h,
2701 include_directories : includes,
2702 link_with : [lib_common,
2704 dependencies : mq_libs,
2705 install_dir : usrbin_exec_dir,
2707 if not is_disabler(exe)
2709 manadocs += ['misc-utils/lsfd.1.adoc']
2715 include_directories : includes,
2716 link_with : [lib_common,
2718 install_dir : usrbin_exec_dir,
2720 if not is_disabler(exe)
2722 manadocs += ['misc-utils/uuidgen.1.adoc']
2723 bashcompletions += ['uuidgen']
2729 include_directories : includes,
2730 link_with : [lib_common,
2733 install_dir : usrbin_exec_dir,
2735 if not is_disabler(exe)
2737 manadocs += ['misc-utils/uuidparse.1.adoc']
2738 bashcompletions += ['uuidparse']
2745 include_directories : includes,
2746 link_with : [lib_common,
2748 dependencies : [realtime_libs,
2750 install_dir : usrsbin_exec_dir,
2752 build_by_default : opt)
2756 include_directories : includes,
2757 link_with : [lib_common,
2759 dependencies : thread_libs,
2760 build_by_default : opt and program_tests)
2761 if not is_disabler(exe)
2763 manadocs += ['misc-utils/uuidd.8.adoc']
2764 bashcompletions += ['uuidd']
2767 opt = build_libblkid
2771 include_directories : includes,
2772 link_with : [lib_common,
2774 install_dir : sbindir,
2776 build_by_default : opt)
2777 if opt and not is_disabler(exe)
2779 manadocs += ['misc-utils/blkid.8.adoc']
2780 bashcompletions += ['blkid']
2783 opt = opt and 'blkid' in static_programs
2787 include_directories : includes,
2788 link_with : [lib_common,
2790 install_dir : sbindir,
2792 build_by_default : opt)
2793 if opt and not is_disabler(exe)
2799 'libblkid/samples/mkfs.c',
2800 include_directories : includes,
2801 link_with : lib_blkid)
2802 if not is_disabler(exe)
2807 'sample-partitions',
2808 'libblkid/samples/partitions.c',
2809 include_directories : includes,
2810 link_with : lib_blkid)
2811 if not is_disabler(exe)
2816 'sample-superblocks',
2817 'libblkid/samples/superblocks.c',
2818 include_directories : includes,
2819 link_with : lib_blkid)
2820 if not is_disabler(exe)
2826 'libblkid/samples/topology.c',
2827 include_directories : includes,
2828 link_with : lib_blkid)
2829 if not is_disabler(exe)
2834 'test_blkid_fuzz_sample',
2835 'libblkid/src/fuzz.c',
2836 include_directories: includes,
2837 link_with: lib_blkid,
2838 build_by_default: program_tests)
2839 if not is_disabler(exe)
2843 ############################################################
2848 include_directories : includes,
2849 link_with : [lib_blkid],
2850 install_dir : sbindir,
2852 if not is_disabler(exe)
2854 manadocs += ['misc-utils/findfs.8.adoc']
2855 bashcompletions += ['findfs']
2861 include_directories : includes,
2862 link_with : [lib_common,
2865 install_dir : sbindir,
2867 if not is_disabler(exe)
2869 manadocs += ['misc-utils/wipefs.8.adoc']
2870 bashcompletions += ['wipefs']
2876 include_directories : includes,
2877 link_with : [lib_common,
2881 dependencies : [lib_udev],
2883 if not is_disabler(exe)
2885 manadocs += ['misc-utils/findmnt.8.adoc']
2886 bashcompletions += ['findmnt']
2892 include_directories : includes,
2893 link_with : [lib_common],
2895 if not is_disabler(exe)
2897 manadocs += ['misc-utils/kill.1.adoc']
2900 opt = not get_option('build-rename').disabled()
2904 include_directories : includes,
2905 install_dir : usrbin_exec_dir,
2907 build_by_default : opt)
2908 if opt and not is_disabler(exe)
2910 manadocs += ['misc-utils/rename.1.adoc']
2911 bashcompletions += ['rename']
2917 include_directories : includes,
2918 link_with : [lib_common],
2919 install_dir : usrbin_exec_dir,
2922 manadocs += ['misc-utils/getopt.1.adoc']
2923 bashcompletions += ['getopt']
2928 include_directories : includes,
2929 link_with : [lib_common,
2931 install_dir : usrbin_exec_dir,
2933 if not is_disabler(exe)
2935 manadocs += ['misc-utils/fincore.1.adoc']
2936 bashcompletions += ['fincore']
2942 include_directories : includes,
2943 link_with : [lib_common],
2944 install_dir : usrbin_exec_dir,
2946 if not is_disabler(exe)
2948 manadocs += ['misc-utils/hardlink.1.adoc']
2949 bashcompletions += ['hardlink']
2952 opt = not get_option('build-pipesz').disabled()
2956 include_directories : includes,
2957 link_with : [lib_common],
2958 install_dir : usrbin_exec_dir,
2960 if opt and not is_disabler(exe)
2962 manadocs += ['misc-utils/pipesz.1.adoc']
2963 bashcompletions += ['pipesz']
2969 include_directories : includes,
2970 c_args : '-DTEST_CAL',
2971 link_with : [lib_common,
2973 dependencies : [curses_libs],
2974 build_by_default: program_tests)
2975 if not is_disabler(exe)
2982 include_directories : includes,
2983 link_with : [lib_common],
2984 install_dir : usrbin_exec_dir,
2986 if not is_disabler(exe)
2988 manadocs += ['misc-utils/fadvise.1.adoc']
2989 bashcompletions += ['fadvise']
2992 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
2996 include_directories : includes,
2997 link_with : [lib_common],
2998 install_dir : usrbin_exec_dir,
3000 if not is_disabler(exe)
3002 manadocs += ['misc-utils/waitpid.1.adoc']
3003 bashcompletions += ['waitpid']
3007 syscalls_h = custom_target('syscalls.h',
3008 input : 'tools/all_syscalls',
3009 output : 'syscalls.h',
3010 command : ['tools/all_syscalls', cc.cmd_array()]
3013 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3016 'misc-utils/enosys.c', syscalls_h,
3017 include_directories : includes,
3018 link_with : [lib_common],
3019 install_dir : usrbin_exec_dir,
3021 if not is_disabler(exe)
3023 manadocs += ['misc-utils/enosys.1.adoc']
3024 bashcompletions += ['enosys']
3031 include_directories : includes,
3032 link_with : [lib_common, lib_smartcols],
3033 install_dir : usrbin_exec_dir,
3035 if not is_disabler(exe)
3037 manadocs += ['misc-utils/lsclocks.1.adoc']
3038 bashcompletions += ['lsclocks']
3041 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3045 include_directories : includes,
3046 link_with : [lib_common],
3047 install_dir : usrbin_exec_dir,
3049 if not is_disabler(exe)
3051 manadocs += ['misc-utils/exch.1.adoc']
3052 bashcompletions += ['exch']
3056 ############################################################
3058 opt = not get_option('build-schedutils').disabled()
3061 'schedutils/chrt.c',
3062 include_directories : includes,
3063 link_with : lib_common,
3064 install_dir : usrbin_exec_dir,
3066 build_by_default : opt)
3070 'schedutils/ionice.c',
3071 include_directories : includes,
3072 link_with : lib_common,
3073 install_dir : usrbin_exec_dir,
3075 build_by_default : opt)
3079 'schedutils/taskset.c',
3080 include_directories : includes,
3081 link_with : lib_common,
3082 install_dir : usrbin_exec_dir,
3084 build_by_default : opt)
3088 'schedutils/uclampset.c',
3089 include_directories : includes,
3090 link_with : lib_common,
3091 install_dir : usrbin_exec_dir,
3093 build_by_default : opt)
3095 if opt and not is_disabler(exe)
3096 exes += [exe, exe2, exe3, exe4]
3097 manadocs += ['schedutils/chrt.1.adoc',
3098 'schedutils/ionice.1.adoc',
3099 'schedutils/taskset.1.adoc',
3100 'schedutils/uclampset.1.adoc']
3101 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3104 ############################################################
3106 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3111 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3112 include_directories : dir_include,
3113 link_with : lib_common,
3114 build_by_default: program_tests)
3120 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3121 include_directories : dir_include,
3122 link_with : lib_common,
3123 build_by_default: program_tests)
3129 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3130 include_directories : dir_include,
3131 link_with : lib_common,
3132 build_by_default: program_tests)
3138 c_args : ['-DTEST_PROGRAM_MANGLE'],
3139 include_directories : dir_include,
3140 build_by_default: program_tests)
3146 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3147 include_directories : dir_include,
3148 build_by_default: program_tests)
3154 'lib/color-names.c',
3155 c_args : ['-DTEST_PROGRAM_COLORS'],
3156 include_directories : dir_include,
3157 link_with : [lib_common, lib_tcolors],
3158 build_by_default: program_tests)
3164 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3165 include_directories : dir_include,
3166 build_by_default: program_tests)
3169 if conf.get('HAVE_OPENAT').to_string() == '1' \
3170 and conf.get('HAVE_DIRFD').to_string() == '1'
3174 c_args : ['-DTEST_PROGRAM_PROCFS'],
3175 include_directories : dir_include,
3176 link_with : lib_common,
3177 build_by_default: program_tests)
3184 have_cpu_set_t ? 'lib/cpuset.c' : [],
3185 c_args : ['-DTEST_PROGRAM_PATH'],
3186 include_directories : dir_include,
3187 link_with : lib_common,
3188 build_by_default: program_tests)
3192 if conf.get('HAVE_PTY').to_string() == '1'
3197 c_args : ['-DTEST_PROGRAM_PTY'],
3198 include_directories : dir_include,
3199 link_with : [lib_common],
3200 dependencies : [lib_m,
3203 build_by_default: program_tests)
3211 c_args : ['-DTEST_PROGRAM_CPUSET'],
3212 include_directories : dir_include,
3213 build_by_default: program_tests)
3224 have_cpu_set_t ? 'lib/cpuset.c' : [],
3225 c_args : ['-DTEST_PROGRAM_SYSFS'],
3226 include_directories : dir_include,
3227 build_by_default: program_tests)
3233 c_args : ['-DTEST_PROGRAM_PAGER'],
3234 include_directories : dir_include,
3235 build_by_default: program_tests)
3239 'test_linux_version',
3240 'lib/linux_version.c',
3241 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3242 include_directories : dir_include,
3243 build_by_default: program_tests)
3249 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3250 include_directories : dir_include,
3251 build_by_default: program_tests)
3255 'test_canonicalize',
3256 'lib/canonicalize.c',
3257 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3258 include_directories : dir_include,
3259 build_by_default: program_tests)
3266 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3267 include_directories : dir_include,
3268 build_by_default: program_tests)
3274 c_args : ['-DTEST_PROGRAM'],
3275 include_directories : dir_include,
3276 link_with : lib_common,
3277 build_by_default: program_tests)
3283 c_args : ['-DTEST_PROGRAM'],
3284 include_directories : dir_include,
3285 link_with : [lib_common, logindefs_c],
3286 build_by_default: program_tests)
3290 ############################################################
3294 'libuuid/src/test_uuid.c',
3295 include_directories : [dir_include, dir_libuuid],
3296 link_with : lib_uuid,
3297 dependencies : socket_libs,
3298 build_by_default: program_tests)
3299 if not is_disabler(exe)
3303 ############################################################
3305 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3306 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3310 'libfdisk/src/ask.c',
3311 c_args : libfdisk_tests_cflags,
3312 include_directories : lib_fdisk_includes,
3313 link_with : libfdisk_tests_ldadd,
3314 build_by_default: program_tests)
3315 if not is_disabler(exe)
3321 'libfdisk/src/gpt.c',
3322 c_args : libfdisk_tests_cflags,
3323 include_directories : lib_fdisk_includes,
3324 link_with : libfdisk_tests_ldadd,
3325 build_by_default: program_tests)
3326 if not is_disabler(exe)
3332 'libfdisk/src/utils.c',
3333 c_args : libfdisk_tests_cflags,
3334 include_directories : lib_fdisk_includes,
3335 link_with : libfdisk_tests_ldadd,
3336 build_by_default: program_tests)
3337 if not is_disabler(exe)
3342 'test_fdisk_script',
3343 'libfdisk/src/script.c',
3344 c_args : libfdisk_tests_cflags,
3345 include_directories : lib_fdisk_includes,
3346 link_with : libfdisk_tests_ldadd,
3347 build_by_default: program_tests)
3348 if not is_disabler(exe)
3353 'test_fdisk_version',
3354 'libfdisk/src/version.c',
3355 c_args : libfdisk_tests_cflags,
3356 include_directories : lib_fdisk_includes,
3357 link_with : libfdisk_tests_ldadd,
3358 build_by_default: program_tests)
3359 if not is_disabler(exe)
3365 'libfdisk/src/item.c',
3366 c_args : libfdisk_tests_cflags,
3367 include_directories : lib_fdisk_includes,
3368 link_with : libfdisk_tests_ldadd,
3369 build_by_default: program_tests)
3370 if not is_disabler(exe)
3374 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3377 'sample-fdisk-mkpart',
3378 'libfdisk/samples/mkpart.c',
3379 include_directories : lib_fdisk_includes,
3380 link_with : sample_fdisk_ldadd)
3381 if not is_disabler(exe)
3386 'sample-fdisk-mkpart-fullspec',
3387 'libfdisk/samples/mkpart-fullspec.c',
3388 include_directories : lib_fdisk_includes,
3389 link_with : sample_fdisk_ldadd)
3390 if not is_disabler(exe)
3394 ############################################################
3398 'tests/helpers/test_cap.c',
3399 include_directories : includes,
3400 dependencies : [lib_cap_ng],
3401 build_by_default: program_tests)
3402 if not is_disabler(exe)
3408 'tests/helpers/test_mbsencode.c',
3409 include_directories : includes,
3410 link_with : lib_common,
3411 build_by_default: program_tests)
3416 'tests/helpers/test_byteswap.c',
3417 include_directories : includes,
3418 build_by_default: program_tests)
3423 'tests/helpers/test_md5.c',
3425 include_directories : includes,
3426 build_by_default: program_tests)
3431 'tests/helpers/test_sha1.c',
3433 include_directories : includes,
3434 build_by_default: program_tests)
3439 'tests/helpers/test_pathnames.c',
3440 include_directories : includes,
3441 build_by_default: program_tests)
3446 'tests/helpers/test_strerror.c',
3447 include_directories : includes,
3448 build_by_default: program_tests)
3453 'tests/helpers/test_sysinfo.c',
3454 include_directories : includes,
3455 build_by_default: program_tests)
3460 'tests/helpers/test_sigreceive.c',
3461 include_directories : includes,
3462 link_with : lib_common,
3463 build_by_default: program_tests)
3468 'tests/helpers/test_tiocsti.c',
3469 include_directories : includes,
3470 build_by_default: program_tests)
3474 'test_uuid_namespace',
3475 'tests/helpers/test_uuid_namespace.c',
3479 include_directories : includes,
3480 build_by_default: program_tests)
3486 'tests/helpers/test_mkfds.c',
3487 'tests/helpers/test_mkfds.h',
3488 'tests/helpers/test_mkfds_ppoll.c',
3489 include_directories : includes,
3490 dependencies : mq_libs,
3491 build_by_default: program_tests)
3497 'tests/helpers/test_enosys.c',
3498 include_directories : includes,
3499 build_by_default: program_tests)
3502 ############################################################
3504 if conf.get('HAVE_OPENAT').to_string() == '1'
3506 'sample-scols-tree',
3507 'libsmartcols/samples/tree.c',
3508 include_directories : includes,
3509 link_with : [lib_smartcols, lib_common],
3510 build_by_default: program_tests)
3511 if not is_disabler(exe)
3517 'sample-scols-title',
3518 'libsmartcols/samples/title.c',
3519 include_directories : includes,
3520 link_with : [lib_smartcols, lib_common])
3521 if not is_disabler(exe)
3526 'sample-scols-wrap',
3527 'libsmartcols/samples/wrap.c',
3528 include_directories : includes,
3529 link_with : [lib_smartcols, lib_common])
3530 if not is_disabler(exe)
3535 'sample-scols-continuous',
3536 'libsmartcols/samples/continuous.c',
3537 include_directories : includes,
3538 link_with : [lib_smartcols, lib_common])
3539 if not is_disabler(exe)
3544 'sample-scols-continuous-json',
3545 'libsmartcols/samples/continuous-json.c',
3546 include_directories : includes,
3547 link_with : [lib_smartcols, lib_common])
3548 if not is_disabler(exe)
3553 'sample-scols-maxout',
3554 'libsmartcols/samples/maxout.c',
3555 include_directories : includes,
3556 link_with : [lib_smartcols, lib_common])
3557 if not is_disabler(exe)
3562 'sample-scols-fromfile',
3563 'libsmartcols/samples/fromfile.c',
3564 include_directories : includes,
3565 link_with : [lib_smartcols, lib_common])
3566 if not is_disabler(exe)
3571 'sample-scols-grouping-simple',
3572 'libsmartcols/samples/grouping-simple.c',
3573 include_directories : includes,
3574 link_with : [lib_smartcols, lib_common])
3575 if not is_disabler(exe)
3580 'sample-scols-grouping-overlay',
3581 'libsmartcols/samples/grouping-overlay.c',
3582 include_directories : includes,
3583 link_with : [lib_smartcols, lib_common])
3584 if not is_disabler(exe)
3590 'Documentation/boilerplate.c',
3591 include_directories : includes,
3592 build_by_default: program_tests)
3593 if not is_disabler(exe)
3597 ############################################################
3599 # Let the test runner know whether we're running under asan and export
3600 # some paths. We use a file on disk so that it is possible to run the
3601 # test scripts from commandline without setting any variables.
3602 configure_file(output : 'meson.conf',
3607 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3608 python.full_path())])
3610 run_sh = find_program('tests/run.sh')
3614 '--srcdir=' + meson.current_source_dir(),
3615 '--builddir=' + meson.current_build_dir(),
3621 manadocs += ['lib/terminal-colors.d.5.adoc']
3622 manadocs += ['libblkid/libblkid.3.adoc']
3626 'libuuid/man/uuid.3.adoc',
3627 'libuuid/man/uuid_clear.3.adoc',
3628 'libuuid/man/uuid_compare.3.adoc',
3629 'libuuid/man/uuid_copy.3.adoc',
3630 'libuuid/man/uuid_generate.3.adoc',
3631 'libuuid/man/uuid_is_null.3.adoc',
3632 'libuuid/man/uuid_parse.3.adoc',
3633 'libuuid/man/uuid_time.3.adoc',
3634 'libuuid/man/uuid_unparse.3.adoc']
3636 'uuid_generate_random.3': 'uuid_generate.3',
3637 'uuid_generate_time.3': 'uuid_generate.3',
3638 'uuid_generate_time_safe.3': 'uuid_generate.3',
3642 asciidoctor = find_program('asciidoctor', required : false)
3643 if asciidoctor.found()
3644 foreach adoc : manadocs
3645 name = adoc.split('/')[-1]
3646 page = name.split('.adoc')[0]
3647 section = page.split('.')[-1]
3648 mandirn = join_paths(mandir, 'man' + section)
3653 command : [ asciidoctor,
3655 '-a', 'VERSION=' + meson.project_version(),
3656 '-a', 'release-version=' + meson.project_version(),
3657 '-a', 'ADJTIME_PATH=/etc/adjtime',
3658 '-a', 'package-docdir=' + docdir,
3659 '--base-dir=' + meson.current_source_dir(),
3660 '--destination-dir=' + meson.current_build_dir(),
3661 '--load-path', '@SOURCE_ROOT@/tools',
3662 '--require', 'asciidoctor-includetracker',
3666 depfile : page + '.deps',
3668 install_dir : mandirn)
3671 foreach link_name, target : manlinks
3672 link_section = link_name.split('.')[-1]
3673 target_section = target.split('.')[-1]
3674 meson.add_install_script(meson_make_manpage_stub,
3675 join_paths('man' + target_section, target),
3676 join_paths(mandir, 'man' + link_section, link_name))
3680 if bash_completion.found()
3681 foreach completion : bashcompletions
3683 join_paths('bash-completion', completion),
3684 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3687 foreach link_name, target : bashcompletionslinks
3688 meson.add_install_script(meson_make_symlink,
3690 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))