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 libmount_version = '1.1.0'
17 libsmartcols_version = '1.1.0'
18 libfdisk_version = '1.1.0'
20 prefixdir = get_option('prefix')
21 if not prefixdir.startswith('/')
22 error('Prefix is not absolute: "@0@"'.format(prefixdir))
24 bindir = join_paths(prefixdir, get_option('bindir'))
25 sbindir = join_paths(prefixdir, get_option('sbindir'))
26 sysconfstaticdir = join_paths(prefixdir, 'lib')
27 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
28 mandir = join_paths(prefixdir, get_option('mandir'))
30 execprefixdir = prefixdir
31 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
32 usrbin_exec_dir = join_paths(execprefixdir, bindir)
33 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
34 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
36 vendordir = get_option('vendordir')
38 add_project_arguments('-D_GNU_SOURCE', language : 'c')
40 cc = meson.get_compiler('c')
42 conf = configuration_data()
43 conf.set_quoted('PACKAGE', meson.project_name())
44 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
45 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
46 conf.set_quoted('PACKAGE_STRING', package_string)
49 pc_version = meson.project_version().split('-')[0].split('.')
51 if pc_version.length() < 3
55 pc_version = '.'.join(pc_version)
57 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
58 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
60 conf.set('bindir', bindir)
61 conf.set('sbindir', sbindir)
62 conf.set('runstatedir', runstatedir)
63 conf.set('sysconfdir', sysconfdir)
64 conf.set('usrsbin_execdir', usrsbin_exec_dir)
65 conf.set('docdir', docdir)
66 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
67 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
68 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
69 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
71 conf.set_quoted('_PATH_VENDORDIR', vendordir)
72 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
74 build_libblkid = not get_option('build-libblkid').disabled()
75 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
76 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
78 build_libuuid = not get_option('build-libuuid').disabled()
79 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
80 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
82 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
83 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
84 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
86 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
87 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
89 build_libmount = not get_option('build-libmount').disabled()
90 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
91 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
92 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
93 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
95 build_libsmartcols = not get_option('build-libsmartcols').disabled()
96 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
97 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
99 build_libfdisk = not get_option('build-libfdisk').disabled()
100 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
101 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
103 build_uuidd = not get_option('build-uuidd').disabled()
104 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
105 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
107 static_programs = get_option('static-programs')
108 need_static_libs = static_programs.length() > 0 # a rough estimate...
109 summary('static programs', static_programs)
111 LINUX = host_machine.system() in ['linux']
112 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
114 ############################################################
132 have = cc.compiles(code, name : 'wchar_t support')
133 if not have and get_option('widechar').enabled()
134 error('widechar support requested but unavailable')
136 if get_option('ncurses').enabled() and get_option('widechar').enabled()
137 error('widechar support is incompatible with non-wide ncurses')
139 conf.set('HAVE_WIDECHAR', have ? 1 : false)
181 linux/net_namespace.h
227 lib_m = cc.find_library('m')
229 lib_tinfo = dependency(
231 required : get_option('tinfo'))
233 lib_ncursesw = dependency(
235 required : get_option('ncursesw'))
236 if lib_ncursesw.found()
237 headers += ['ncursesw/ncurses.h',
241 lib_ncurses = disabler()
243 lib_ncurses = dependency(
245 required : get_option('ncurses'))
246 headers += ['ncurses.h',
250 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
251 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
252 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
254 lib_slang = dependency(
256 required : get_option('slang'))
258 headers += ['slang.h',
263 conf.set('HAVE_SLANG', lib_slang.found())
265 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
266 if curses_libs.found()
267 have = cc.has_function('use_default_colors', dependencies : curses_libs)
268 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
269 have = cc.has_function('resizeterm', dependencies : curses_libs)
270 conf.set('HAVE_RESIZETERM', have ? 1 : false)
277 required : get_option('zlib'))
279 lib_readline = dependency(
281 required : get_option('readline'))
282 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
284 lib_readline_static = dependency(
287 required : need_static_libs ? get_option('readline') : disabler())
289 if meson.version().version_compare('>= 0.59.0')
290 lib_intl = dependency(
292 required : get_option('nls'))
293 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
295 if get_option('nls').enabled()
296 error('nls is not supported with meson before 0.59.0')
298 lib_intl = dependency('', required : false)
301 lib_user = dependency(
304 required : get_option('libuser'))
305 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
307 lib_util = cc.find_library(
309 required : get_option('libutil'))
310 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
312 lib_utempter = cc.find_library(
314 required : get_option('libutempter'))
315 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
317 systemd = dependency(
319 required : get_option('systemd'))
321 lib_systemd = dependency(
323 required : get_option('systemd'))
324 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
325 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
327 have = cc.has_function(
328 'sd_session_get_username',
329 dependencies : lib_systemd)
330 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
332 lib_udev = dependency(
334 required : get_option('systemd'))
335 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
337 lib_crypt = cc.find_library('crypt')
339 lib_pam = cc.find_library('pam', required : get_option('build-login'))
340 if not lib_pam.found()
341 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
343 if not lib_pam.found()
344 lib_pam = cc.find_library('pam', required : get_option('build-su'))
346 if not lib_pam.found()
347 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
350 lib_pam_misc = cc.find_library('pam_misc')
351 lib_pam = [lib_pam, lib_pam_misc]
353 lib_pam_misc = declare_dependency()
356 lib_cryptsetup = dependency(
358 required : get_option('cryptsetup'))
359 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
361 if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
362 if meson.version().version_compare('>= 0.62.0')
363 lib_dl = dependency('dl')
365 lib_dl = cc.find_library('dl')
367 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
368 summary('cryptsetup support (dlopen)',
370 section : 'components')
372 summary('cryptsetup support',
373 lib_cryptsetup.found() ? 'enabled' : 'disabled',
374 section : 'components')
377 have = cc.has_function(
378 'crypt_activate_by_signed_key',
379 dependencies : lib_cryptsetup)
380 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
382 lib_cap_ng = dependency(
384 required : get_option('build-setpriv'))
385 if not lib_cap_ng.found()
386 lib_cap_ng = disabler()
389 lib_selinux = dependency(
392 required : get_option('selinux'))
393 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
395 lib_magic = dependency(
397 required : get_option('magic'))
398 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
400 lib_econf = dependency(
402 required : get_option('econf'))
403 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
405 lib_audit = dependency(
407 required : get_option('audit'))
408 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
410 conf.set('HAVE_SMACK', not get_option('smack').disabled())
412 foreach header : headers
413 have = cc.has_header(header)
414 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
417 header = 'linux/btrfs.h'
418 enable_btrfs = cc.has_header(header,
419 required : get_option('btrfs'))
420 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
421 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
423 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
428 have = cc.has_header(header,
430 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
433 have = cc.has_header('sched.h')
434 conf.set10('HAVE_DECL_CPU_ALLOC', have)
435 # We get -1 if the size cannot be determined
436 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
437 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
439 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
440 conf.set10('HAVE_ENVIRON_DECL', have)
442 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
443 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
445 have = cc.has_function('strsignal')
446 conf.set10('HAVE_STRSIGNAL_DECL', have)
448 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
449 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
451 have = cc.has_type('loff_t', prefix : '#include <sys/types.h>')
452 conf.set('HAVE_LOFF_T', have ? 1 : false)
454 have = cc.compiles('''
455 #define _GNU_SOURCE 1
456 #include <langinfo.h>
459 str = nl_langinfo (ALTMON_1);
460 str = nl_langinfo (ALTMON_2);
461 str = nl_langinfo (ALTMON_3);
462 str = nl_langinfo (ALTMON_4);
463 str = nl_langinfo (ALTMON_5);
464 str = nl_langinfo (ALTMON_6);
465 str = nl_langinfo (ALTMON_7);
466 str = nl_langinfo (ALTMON_8);
467 str = nl_langinfo (ALTMON_9);
468 str = nl_langinfo (ALTMON_10);
469 str = nl_langinfo (ALTMON_11);
470 str = nl_langinfo (ALTMON_12);
474 name : 'langinfo.h defines ALTMON_x constants')
475 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
477 have = cc.compiles('''
478 #define _GNU_SOURCE 1
479 #include <langinfo.h>
482 str = nl_langinfo (_NL_ABALTMON_1);
483 str = nl_langinfo (_NL_ABALTMON_2);
484 str = nl_langinfo (_NL_ABALTMON_3);
485 str = nl_langinfo (_NL_ABALTMON_4);
486 str = nl_langinfo (_NL_ABALTMON_5);
487 str = nl_langinfo (_NL_ABALTMON_6);
488 str = nl_langinfo (_NL_ABALTMON_7);
489 str = nl_langinfo (_NL_ABALTMON_8);
490 str = nl_langinfo (_NL_ABALTMON_9);
491 str = nl_langinfo (_NL_ABALTMON_10);
492 str = nl_langinfo (_NL_ABALTMON_11);
493 str = nl_langinfo (_NL_ABALTMON_12);
497 name : 'langinfo.h defines _NL_ABALTMON_x constants')
498 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
500 have = cc.compiles('''
501 #define _GNU_SOURCE 1
502 #include <langinfo.h>
505 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
509 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
510 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
543 landlock_create_ruleset
545 landlock_restrict_self
609 have = cc.has_function(func)
610 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
611 # This makes little sense, but is necessary to avoid warnings about
612 # redefined macros from Python.h, which uses this convention.
613 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
616 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
617 conf.set('AGETTY_RELOAD', have ? 1 : false)
619 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
622 have_dirfd = (cc.has_function('dirfd') or
623 cc.has_header_symbol('dirent.h', 'dirfd',
624 prefix : '#include <sys/types.h>'))
625 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
627 have_ddfd = cc.has_member('DIR', 'dd_fd',
629 #include <sys/types.h>
632 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
634 have = cc.has_member('struct tm', 'tm_gmtoff',
639 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
643 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
644 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
646 have = cc.has_member('struct termios', 'c_line',
647 prefix : '#include <termios.h>')
648 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
650 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
651 prefix : '#include <sys/stat.h>')
652 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
654 have = cc.has_member('struct statx', 'stx_mnt_id',
655 prefix : '#include <sys/stat.h>')
656 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
658 # replacement for AC_STRUCT_TIMEZONE
659 have = cc.has_member('struct tm', 'tm_zone',
660 prefix : '#include <time.h>')
661 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
663 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
664 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
666 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
667 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
669 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
670 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
675 extern char *tzname[];
678 return tzname ? 0 : 1;
680 '''.format(have ? 1 : 0)
681 have = cc.compiles(code, name : 'using tzname[]')
682 conf.set('HAVE_TZNAME', have ? 1 : false)
684 have = cc.sizeof('time_t', prefix : '#include <time.h>')
686 add_global_arguments('-D_TIME_BITS=64', language : 'c')
687 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
689 if get_option('allow-32bit-time')
690 warning('Could not make time_t 64bits wide')
692 error('Could not make time_t 64bits wide')
698 if not cc.has_function('socket')
699 socket_libs += cc.find_library('socket', required : true)
700 have = cc.has_function('socket',
701 dependencies : socket_libs)
703 error('socket() function not available')
708 have = cc.has_function('clock_gettime')
710 realtime_libs += cc.find_library('rt', required : true)
711 have = cc.has_function('clock_gettime',
712 dependencies : realtime_libs)
714 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
716 thread_libs = dependency('threads')
718 have = cc.has_function('timer_create')
720 realtime_libs = [cc.find_library('rt', required : true)]
721 have = cc.has_function('timer_create',
722 dependencies : realtime_libs)
724 realtime_libs += thread_libs
725 have = cc.has_function('timer_create',
726 dependencies : realtime_libs)
729 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
731 have = cc.has_function('setitimer')
732 conf.set('HAVE_SETITIMER', have ? 1 : false)
735 rtas_libs = cc.find_library('rtas', required : false)
736 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
739 if not cc.has_header_symbol('math.h', 'isnan')
740 lib = cc.find_library('m', required : true)
741 if (cc.has_function('isnan', dependencies : lib) and
742 cc.has_function('__isnan', dependencies : lib))
747 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
748 args : '-D_GNU_SOURCE')
749 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
752 extern char *__progname;
754 return (*__progname != 0);
757 have = cc.compiles(code, name : 'using __progname')
758 conf.set('HAVE___PROGNAME', have ? 1 : false)
760 have = conf.get('HAVE_PTY_H').to_string() == '1' \
761 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
762 conf.set('HAVE_PTY', have ? 1 : false)
764 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
765 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
767 build_plymouth_support = get_option('build-plymouth-support')
768 have_tiocglcktrmios = cc.has_header_symbol(
769 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
770 required : build_plymouth_support.enabled())
771 have_sock_cloexec = cc.has_header_symbol(
772 'sys/socket.h', 'SOCK_CLOEXEC',
773 prefix : '#include <sys/types.h>',
774 required : build_plymouth_support.enabled())
775 have_sock_nonblock = cc.has_header_symbol(
776 'sys/socket.h', 'SOCK_NONBLOCK',
777 prefix : '#include <sys/types.h>',
778 required : build_plymouth_support.enabled())
779 have_so_passcred = cc.has_header_symbol(
780 'sys/socket.h', 'SO_PASSCRED',
781 prefix : '#include <sys/types.h>',
782 required : build_plymouth_support.enabled())
784 build_plymouth_support = (not build_plymouth_support.disabled() and
785 have_tiocglcktrmios and
786 have_sock_cloexec and
787 have_sock_nonblock and
789 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
790 summary('plymouth support',
791 build_plymouth_support ? 'enabled' : 'disabled',
792 section : 'components')
794 # check for valid fallocate() function
795 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
796 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
797 # and program can't be linked.
805 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
806 return ret == 0 ? 0 : 1;
809 have = cc.links(code, name : 'fallocate() function')
810 conf.set('HAVE_FALLOCATE', have ? 1 : false)
818 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
819 return ret == 0 ? 0 : 1;
822 have = cc.links(code, name : 'posix_fallocate() function')
823 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
825 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
826 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
827 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
829 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
830 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
831 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
833 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
835 ############################################################
838 fs_search_path = get_option('fs-search-path')
839 fs_search_path_extra = get_option('fs-search-path-extra')
840 if fs_search_path_extra != ''
841 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
843 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
845 systemdsystemunitdir = ''
847 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
850 sysvinit = get_option('sysvinit').enabled()
851 sysvinitrcdir = sysconfdir + '/init.d'
853 program_tests = get_option('program-tests')
855 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
856 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
858 have = get_option('chsh-only-listed')
859 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
861 have = get_option('use-tty-group')
862 conf.set('USE_TTY_GROUP', have ? 1 : false)
864 bison = find_program('bison')
865 flex = find_program('flex')
867 build_hwclock = not get_option('build-hwclock').disabled()
868 bison_gen = generator(
870 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
871 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
873 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
874 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
878 configuration : conf)
880 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
885 '-Waddress-of-packed-member',
886 '-Wdiscarded-qualifiers',
887 '-Wembedded-directive',
890 '-Wimplicit-function-declaration',
891 '-Wmissing-declarations',
892 '-Wmissing-parameter-type',
893 '-Wmissing-prototypes',
895 '-Wno-missing-field-initializers',
896 '-Wold-style-definition',
900 '-Wstrict-prototypes',
903 '-Wunused-but-set-parameter',
904 '-Wunused-but-set-variable',
905 '-Wunused-parameter',
911 foreach compiler_flag : compiler_flags
912 if cc.has_argument(compiler_flag)
913 add_project_arguments(compiler_flag, language : 'c')
921 bashcompletionslinks = {}
927 subdir('libsmartcols')
930 subdir('login-utils')
938 includes = [dir_include,
948 opt = not get_option('build-chfn-chsh').disabled()
953 include_directories : includes,
954 link_with : [lib_common, logindefs_c],
955 dependencies : chfn_chsh_deps,
956 install_dir : usrbin_exec_dir,
957 install_mode : 'rwsr-xr-x',
959 build_by_default : opt)
963 'login-utils/chsh.c',
966 include_directories : includes,
967 link_with : lib_common,
968 dependencies : chfn_chsh_deps,
969 install_dir : usrbin_exec_dir,
970 install_mode : 'rwsr-xr-x',
972 build_by_default : opt)
973 if opt and not is_disabler(exe)
975 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
976 bashcompletions += ['chfn', 'chsh']
981 test_islocal_sources,
982 include_directories : includes,
983 c_args : '-DTEST_PROGRAM',
984 build_by_default : program_tests)
989 test_consoles_sources,
990 c_args : ['-DTEST_PROGRAM'],
991 include_directories : includes,
992 link_with : lib_common,
993 build_by_default : program_tests)
996 opt = not get_option('build-last').disabled()
1000 include_directories : includes,
1001 link_with : [lib_common],
1002 install_dir : usrbin_exec_dir,
1004 build_by_default : opt)
1005 if opt and not is_disabler(exe)
1007 meson.add_install_script(meson_make_symlink,
1009 join_paths(usrbin_exec_dir, 'lastb'))
1010 manadocs += ['login-utils/last.1.adoc']
1011 manlinks += {'lastb.1': 'last.1'}
1012 bashcompletions += ['last']
1013 bashcompletionslinks += {'lastb': 'last'}
1016 opt = not get_option('build-nologin').disabled()
1019 'login-utils/nologin.c',
1020 include_directories : includes,
1021 install_dir : sbindir,
1022 link_with : [lib_common],
1024 build_by_default : opt)
1025 if opt and not is_disabler(exe)
1027 manadocs += ['login-utils/nologin.8.adoc']
1030 opt = not get_option('build-utmpdump').disabled()
1033 'login-utils/utmpdump.c',
1034 include_directories : includes,
1035 link_with : [lib_common],
1036 install_dir : usrbin_exec_dir,
1038 build_by_default : opt)
1039 if opt and not is_disabler(exe)
1041 manadocs += ['login-utils/utmpdump.1.adoc']
1042 bashcompletions += ['utmpdump']
1045 opt = not get_option('build-su').disabled()
1049 'login-utils/su-common.c',
1050 'login-utils/su-common.h',
1054 include_directories : includes,
1055 link_with : [lib_common, logindefs_c],
1056 dependencies : [lib_pam,
1060 install_mode : 'rwsr-xr-x',
1062 build_by_default : opt)
1063 if opt and not is_disabler(exe)
1065 manadocs += ['login-utils/su.1.adoc']
1066 bashcompletions += ['su']
1069 opt = not get_option('build-newgrp').disabled()
1072 'login-utils/newgrp.c',
1073 include_directories : includes,
1074 dependencies : [lib_crypt],
1075 install_dir : usrbin_exec_dir,
1076 install_mode : 'rwsr-xr-x',
1078 build_by_default : opt)
1079 if opt and not is_disabler(exe)
1081 manadocs += ['login-utils/newgrp.1.adoc']
1082 bashcompletions += ['newgrp']
1085 opt = not get_option('build-lslogins').disabled()
1088 'login-utils/lslogins.c',
1089 include_directories : includes,
1090 link_with : [lib_common,
1093 dependencies : [lib_selinux,
1095 install_dir : usrbin_exec_dir,
1097 build_by_default : opt)
1098 if opt and not is_disabler(exe)
1100 manadocs += ['login-utils/lslogins.1.adoc']
1101 bashcompletions += ['lslogins']
1104 opt = not get_option('build-vipw').disabled()
1107 'login-utils/vipw.c',
1108 'login-utils/setpwnam.h',
1109 include_directories : includes,
1110 link_with : [lib_common],
1111 dependencies : [lib_selinux],
1112 install_dir : usrbin_exec_dir,
1114 build_by_default : opt)
1115 if opt and not is_disabler(exe)
1117 meson.add_install_script(meson_make_symlink,
1119 join_paths(usrbin_exec_dir, 'vigr'))
1120 manadocs += ['login-utils/vipw.8.adoc']
1121 meson.add_install_script(meson_make_symlink,
1123 join_paths(mandir, 'man8/vigr.8'))
1126 opt = not get_option('build-runuser').disabled()
1129 'login-utils/runuser.c',
1130 'login-utils/su-common.c',
1131 'login-utils/su-common.h',
1135 include_directories : includes,
1136 link_with : [lib_common, logindefs_c],
1137 dependencies : [lib_pam,
1141 install_dir : sbindir,
1143 build_by_default : opt)
1144 if opt and not is_disabler(exe)
1146 manadocs += ['login-utils/runuser.1.adoc']
1147 bashcompletionslinks += {'runuser': 'su'}
1150 ############################################################
1156 include_directories : includes,
1157 link_with : lib_common,
1158 install_dir : usrbin_exec_dir,
1161 manadocs += ['text-utils/col.1.adoc']
1162 bashcompletions += ['col']
1168 include_directories : includes,
1169 install_dir : usrbin_exec_dir,
1172 manadocs += ['text-utils/colcrt.1.adoc']
1173 bashcompletions += ['colcrt']
1178 include_directories : includes,
1179 link_with : lib_common,
1180 install_dir : usrbin_exec_dir,
1183 manadocs += ['text-utils/colrm.1.adoc']
1184 bashcompletions += ['colrm']
1189 include_directories : includes,
1190 install_dir : usrbin_exec_dir,
1193 manadocs += ['text-utils/rev.1.adoc']
1194 bashcompletions += ['rev']
1199 include_directories : includes,
1200 link_with : [lib_common,
1202 install_dir : usrbin_exec_dir,
1204 if not is_disabler(exe)
1206 manadocs += ['text-utils/column.1.adoc']
1207 bashcompletions += ['column']
1210 opt = not get_option('build-line').disabled()
1214 include_directories : includes,
1215 install_dir : usrbin_exec_dir,
1217 build_by_default : opt)
1218 if opt and not is_disabler(exe)
1220 manadocs += ['text-utils/line.1.adoc']
1223 opt = not get_option('build-pg').disabled()
1227 link_with : lib_common,
1228 include_directories : includes,
1229 dependencies : [lib_tinfo,
1231 install_dir : usrbin_exec_dir,
1233 build_by_default : opt)
1234 if opt and not is_disabler(exe)
1236 manadocs += ['text-utils/pg.1.adoc']
1237 bashcompletions += ['pg']
1240 opt = not get_option('build-ul').disabled()
1244 include_directories : includes,
1245 dependencies : [lib_tinfo,
1247 install_dir : usrbin_exec_dir,
1249 build_by_default : opt)
1250 if opt and not is_disabler(exe)
1252 manadocs += ['text-utils/ul.1.adoc']
1253 bashcompletions += ['ul']
1256 opt = not get_option('build-more').disabled()
1260 link_with : [lib_common],
1261 include_directories : includes,
1262 dependencies : [lib_tinfo,
1266 build_by_default : opt)
1270 link_with : [lib_common],
1271 include_directories : includes,
1272 c_args : '-DTEST_PROGRAM',
1273 dependencies : [lib_tinfo,
1276 build_by_default : opt and program_tests)
1278 if opt and not is_disabler(exe)
1280 manadocs += ['text-utils/more.1.adoc']
1281 bashcompletions += ['more']
1287 include_directories : includes,
1288 link_with : [lib_common,
1290 install_dir : usrbin_exec_dir,
1292 if not is_disabler(exe)
1294 manadocs += ['text-utils/hexdump.1.adoc']
1295 bashcompletions += ['hexdump']
1298 opt = not get_option('build-lsmem').disabled()
1302 include_directories : includes,
1303 link_with : [lib_common,
1305 install_dir : usrbin_exec_dir,
1307 build_by_default : opt)
1308 if opt and not is_disabler(exe)
1310 manadocs += ['sys-utils/lsmem.1.adoc']
1311 bashcompletions += ['lsmem']
1314 opt = not get_option('build-chmem').disabled()
1318 include_directories : includes,
1319 link_with : [lib_common],
1320 install_dir : usrbin_exec_dir,
1322 build_by_default : opt)
1323 if opt and not is_disabler(exe)
1325 manadocs += ['sys-utils/chmem.8.adoc']
1326 bashcompletions += ['chmem']
1332 include_directories : includes,
1333 link_with : [lib_common],
1334 install_dir : usrbin_exec_dir,
1337 manadocs += ['sys-utils/choom.1.adoc']
1342 include_directories : includes,
1343 link_with : [lib_common],
1344 install_dir : usrbin_exec_dir,
1347 manadocs += ['sys-utils/ipcmk.1.adoc']
1348 bashcompletions += ['ipcmk']
1353 include_directories : includes,
1354 link_with : [lib_common],
1355 install_dir : usrbin_exec_dir,
1358 manadocs += ['sys-utils/ipcrm.1.adoc']
1359 bashcompletions += ['ipcrm']
1361 opt = not get_option('build-ipcs').disabled()
1365 include_directories : includes,
1366 link_with : [lib_common],
1367 install_dir : usrbin_exec_dir,
1369 build_by_default : opt)
1370 if opt and not is_disabler(exe)
1372 manadocs += ['sys-utils/ipcs.1.adoc']
1373 bashcompletions += ['ipcs']
1376 opt = not get_option('build-rfkill').disabled()
1380 include_directories : includes,
1381 link_with : [lib_common,
1383 install_dir : usrsbin_exec_dir,
1385 build_by_default : opt)
1386 if opt and not is_disabler(exe)
1388 manadocs += ['sys-utils/rfkill.8.adoc']
1389 bashcompletions += ['rfkill']
1395 include_directories : includes,
1396 link_with : [lib_common,
1398 install_dir : usrbin_exec_dir,
1400 if not is_disabler(exe)
1402 manadocs += ['sys-utils/renice.1.adoc']
1403 bashcompletions += ['renice']
1409 include_directories: includes,
1410 link_with : [lib_common,
1412 install_dir : usrbin_exec_dir,
1414 if opt and not is_disabler(exe)
1416 manadocs += ['sys-utils/setpgid.1.adoc']
1417 bashcompletions += ['setpgid']
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/setsid.1.adoc']
1431 bashcompletions += ['setsid']
1436 readprofile_sources,
1437 include_directories : includes,
1438 link_with : [lib_common,
1440 install_dir : usrsbin_exec_dir,
1442 if not is_disabler(exe)
1444 manadocs += ['sys-utils/readprofile.8.adoc']
1445 bashcompletions += ['readprofile']
1448 opt = not get_option('build-tunelp').disabled()
1452 include_directories : includes,
1453 link_with : [lib_common],
1454 install_dir : usrsbin_exec_dir,
1456 build_by_default : opt)
1457 if opt and not is_disabler(exe)
1459 manadocs += ['sys-utils/tunelp.8.adoc']
1460 bashcompletions += ['tunelp']
1466 include_directories : includes,
1467 link_with : [lib_common,
1469 install_dir : sbindir,
1471 if not is_disabler(exe)
1473 manadocs += ['sys-utils/fstrim.8.adoc']
1474 bashcompletions += ['fstrim']
1480 include_directories : includes,
1481 link_with : [lib_common,
1484 if not is_disabler(exe)
1486 manadocs += ['sys-utils/dmesg.1.adoc']
1487 bashcompletions += ['dmesg']
1493 include_directories : dir_include,
1494 c_args : '-DTEST_DMESG',
1495 link_with : [lib_common,
1497 build_by_default : program_tests)
1498 if not is_disabler(exe)
1505 include_directories : includes,
1506 link_with : [lib_common],
1507 install_dir : sbindir,
1510 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1511 bashcompletions += ['ctrlaltdel']
1516 include_directories : includes,
1517 install_dir : sbindir,
1520 manadocs += ['sys-utils/fsfreeze.8.adoc']
1521 bashcompletions += ['fsfreeze']
1526 include_directories : includes,
1527 link_with : [lib_common,
1529 install_dir : sbindir,
1532 manadocs += ['sys-utils/blkdiscard.8.adoc']
1533 bashcompletions += ['blkdiscard']
1538 include_directories : includes,
1539 link_with : [lib_common],
1540 install_dir : sbindir,
1543 manadocs += ['sys-utils/blkzone.8.adoc']
1544 bashcompletions += ['blkzone']
1549 include_directories : includes,
1550 link_with : [lib_common],
1551 install_dir : sbindir,
1554 manadocs += ['sys-utils/blkpr.8.adoc']
1559 include_directories : includes,
1560 link_with : [lib_common],
1561 install_dir : usrsbin_exec_dir,
1564 manadocs += ['sys-utils/ldattach.8.adoc']
1565 bashcompletions += ['ldattach']
1570 include_directories : includes,
1571 link_with : [lib_common],
1572 install_dir : usrsbin_exec_dir,
1575 manadocs += ['sys-utils/rtcwake.8.adoc']
1576 bashcompletions += ['rtcwake']
1581 include_directories : includes,
1582 link_with : [lib_common],
1583 install_dir : usrbin_exec_dir,
1586 manadocs += ['sys-utils/setarch.8.adoc']
1587 bashcompletions += ['setarch']
1589 setarch_links = ['uname26', 'linux32', 'linux64']
1590 setarch_links_arch = {
1591 's390x' : ['s390', 's390x'],
1593 'x86_64' : ['i386', 'x86_64'],
1594 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1595 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1596 'mips64' : ['mips', 'mips64', 'mips32'],
1597 'ia64' : ['i386', 'ia64'],
1598 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1600 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1602 foreach link: setarch_links
1603 meson.add_install_script(meson_make_symlink,
1605 join_paths(usrbin_exec_dir, link))
1606 manlinks += {link + '.8': 'setarch.8'}
1609 opt = not get_option('build-eject').disabled()
1613 include_directories : includes,
1614 link_with : [lib_common,
1616 install_dir : usrbin_exec_dir,
1618 build_by_default : opt)
1619 if opt and not is_disabler(exe)
1621 manadocs += ['sys-utils/eject.1.adoc']
1622 bashcompletions += ['eject']
1625 opt = not get_option('build-losetup').disabled()
1629 include_directories : includes,
1630 link_with : [lib_common,
1632 install_dir : sbindir,
1634 build_by_default : opt)
1635 if opt and not is_disabler(exe)
1636 manadocs += ['sys-utils/losetup.8.adoc']
1638 bashcompletions += ['losetup']
1641 opt = opt and 'losetup' in static_programs
1645 include_directories : includes,
1646 link_args : ['--static'],
1647 link_with : [lib_common,
1648 lib_smartcols.get_static_lib()],
1649 install_dir : sbindir,
1651 build_by_default : opt)
1652 if opt and not is_disabler(exe)
1656 opt = not get_option('build-zramctl').disabled()
1660 include_directories : includes,
1661 link_with : [lib_common,
1663 install_dir : sbindir,
1665 build_by_default : opt)
1666 if opt and not is_disabler(exe)
1668 manadocs += ['sys-utils/zramctl.8.adoc']
1669 bashcompletions += ['zramctl']
1675 include_directories : includes,
1676 link_with : [lib_common,
1678 install_dir : usrbin_exec_dir,
1680 if not is_disabler(exe)
1682 manadocs += ['sys-utils/prlimit.1.adoc']
1683 bashcompletions += ['prlimit']
1689 include_directories : includes,
1690 link_with : [lib_common,
1693 install_dir : usrbin_exec_dir,
1695 if not is_disabler(exe)
1697 manadocs += ['sys-utils/lsns.8.adoc']
1698 bashcompletions += ['lsns']
1701 opt = not get_option('build-mount').disabled()
1705 include_directories : includes,
1706 link_with : [lib_common,
1709 dependencies : lib_selinux,
1710 install_mode : 'rwsr-xr-x',
1712 build_by_default : opt)
1716 include_directories : includes,
1717 link_with : [lib_common,
1719 install_mode : 'rwsr-xr-x',
1721 build_by_default : opt)
1722 if opt and not is_disabler(exe)
1724 manadocs += ['sys-utils/fstab.5.adoc',
1725 'sys-utils/mount.8.adoc',
1726 'sys-utils/umount.8.adoc']
1727 bashcompletions += ['mount', 'umount']
1730 opt2 = opt and 'mount' in static_programs
1734 include_directories : includes,
1735 link_args : ['--static'],
1736 link_with : [lib_common,
1737 lib_smartcols_static,
1740 build_by_default : opt2)
1741 if opt2 and not is_disabler(exe)
1745 opt2 = opt and 'umount' in static_programs
1749 include_directories : includes,
1750 link_args : ['--static'],
1751 link_with : [lib_common,
1754 build_by_default : opt2)
1755 if opt2 and not is_disabler(exe)
1764 include_directories : includes,
1765 link_with : [lib_common,
1769 install_dir : sbindir,
1771 if not is_disabler(exe)
1773 manadocs += ['sys-utils/swapon.8.adoc']
1774 bashcompletions += ['swapon']
1780 include_directories : includes,
1781 link_with : [lib_common,
1784 install_dir : sbindir,
1786 if not is_disabler(exe)
1788 manlinks += {'swapoff.8': 'swapon.8'}
1789 bashcompletions += ['swapoff']
1795 include_directories : includes,
1796 link_with : [lib_common,
1798 dependencies : [rtas_libs],
1799 install_dir : usrbin_exec_dir,
1801 if not is_disabler(exe)
1803 manadocs += ['sys-utils/lscpu.1.adoc']
1804 bashcompletions += ['lscpu']
1810 include_directories : includes,
1811 link_with : [lib_common],
1812 install_dir : sbindir,
1815 manadocs += ['sys-utils/chcpu.8.adoc']
1816 bashcompletions += ['chcpu']
1821 include_directories : includes,
1822 link_with : [lib_common,
1825 if not is_disabler(exe)
1827 manadocs += ['sys-utils/wdctl.8.adoc']
1828 bashcompletions += ['wdctl']
1831 opt = not get_option('build-mountpoint').disabled()
1835 include_directories : includes,
1836 link_with : [lib_mount],
1838 build_by_default : opt)
1839 if opt and not is_disabler(exe)
1841 manadocs += ['sys-utils/mountpoint.1.adoc']
1842 bashcompletions += ['mountpoint']
1845 opt = not get_option('build-fallocate').disabled()
1849 include_directories : includes,
1850 link_with : [lib_common],
1851 install_dir : usrbin_exec_dir,
1853 build_by_default : opt)
1854 if opt and not is_disabler(exe)
1856 manadocs += ['sys-utils/fallocate.1.adoc']
1857 bashcompletions += ['fallocate']
1860 opt = not get_option('build-pivot_root').disabled()
1864 include_directories : includes,
1865 install_dir : sbindir,
1867 build_by_default : opt)
1868 if opt and not is_disabler(exe)
1870 manadocs += ['sys-utils/pivot_root.8.adoc']
1871 bashcompletions += ['pivot_root']
1874 opt = not get_option('build-switch_root').disabled()
1875 if opt and not have_dirfd and not have_ddfd
1876 error('neither dirfd nor ddfd are available')
1880 switch_root_sources,
1881 include_directories : includes,
1882 install_dir : sbindir,
1884 build_by_default : opt)
1885 if opt and not is_disabler(exe)
1887 manadocs += ['sys-utils/switch_root.8.adoc']
1890 opt = not get_option('build-unshare').disabled()
1894 include_directories : includes,
1895 link_with : [lib_common],
1896 install_dir : usrbin_exec_dir,
1898 build_by_default : opt)
1899 if opt and not is_disabler(exe)
1901 manadocs += ['sys-utils/unshare.1.adoc']
1902 bashcompletions += ['unshare']
1905 opt = opt and 'unshare' in static_programs
1909 include_directories : includes,
1910 link_with : [lib_common],
1911 install_dir : usrbin_exec_dir,
1913 build_by_default : opt)
1914 if opt and not is_disabler(exe)
1918 opt = not get_option('build-nsenter').disabled()
1922 include_directories : includes,
1923 link_with : [lib_common],
1924 dependencies : [lib_selinux],
1925 install_dir : usrbin_exec_dir,
1927 build_by_default : opt)
1928 if opt and not is_disabler(exe)
1930 manadocs += ['sys-utils/nsenter.1.adoc']
1931 bashcompletions += ['nsenter']
1934 opt = opt and 'nsenter' in static_programs
1938 include_directories : includes,
1939 link_with : [lib_common],
1940 dependencies : [lib_selinux],
1941 install_dir : usrbin_exec_dir,
1943 build_by_default : opt)
1944 if opt and not is_disabler(exe)
1948 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1952 include_directories : includes,
1953 link_with : [lib_common],
1954 dependencies : [lib_cap_ng],
1955 install_dir : usrbin_exec_dir,
1957 build_by_default : opt)
1958 if opt and not is_disabler(exe)
1960 manadocs += ['sys-utils/setpriv.1.adoc']
1961 bashcompletions += ['setpriv']
1967 include_directories : includes,
1968 link_with : [lib_common],
1969 dependencies : realtime_libs,
1970 install_dir : usrbin_exec_dir,
1973 manadocs += ['sys-utils/flock.1.adoc']
1974 bashcompletions += ['flock']
1976 opt = not get_option('build-lsirq').disabled()
1980 include_directories : includes,
1981 link_with : [lib_common,
1983 install_dir : usrbin_exec_dir,
1985 build_by_default : opt)
1986 if opt and not is_disabler(exe)
1988 manadocs += ['sys-utils/lsirq.1.adoc']
1989 bashcompletions += ['lsirq']
1992 opt = not get_option('build-irqtop').disabled()
1996 include_directories : includes,
1997 dependencies : [realtime_libs, curses_libs],
1998 link_with : [lib_common,
2001 install_dir : usrbin_exec_dir,
2003 build_by_default : opt)
2004 if opt and not is_disabler(exe)
2006 manadocs += ['sys-utils/irqtop.1.adoc']
2007 bashcompletions += ['irqtop']
2010 opt = not get_option('build-ipcs').disabled()
2014 include_directories : includes,
2015 link_with : [lib_common,
2017 install_dir : usrbin_exec_dir,
2019 build_by_default : opt)
2020 if opt and not is_disabler(exe)
2022 manadocs += ['sys-utils/lsipc.1.adoc']
2023 bashcompletions += ['lsipc']
2030 include_directories : includes,
2031 link_with : [lib_common],
2032 dependencies : [lib_m,
2034 install_dir : sbindir,
2036 build_by_default : opt)
2037 if opt and not is_disabler(exe)
2039 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2040 bashcompletions += ['hwclock']
2046 include_directories : includes,
2047 install_dir : sbindir,
2050 manadocs += ['disk-utils/mkfs.8.adoc']
2051 bashcompletions += ['mkfs']
2053 opt = not get_option('build-bfs').disabled()
2057 include_directories : includes,
2058 link_with : [lib_common],
2059 install_dir : sbindir,
2061 build_by_default : opt)
2062 if opt and not is_disabler(exe)
2064 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2065 bashcompletions += ['mkfs.bfs']
2071 include_directories : includes,
2072 link_with : [lib_common],
2073 install_dir : usrbin_exec_dir,
2076 manadocs += ['disk-utils/isosize.8.adoc']
2077 bashcompletions += ['isosize']
2082 include_directories : includes,
2083 link_with : [lib_common,
2086 dependencies: [lib_selinux],
2087 install_dir : sbindir,
2089 if opt and not is_disabler(exe)
2091 manadocs += ['disk-utils/mkswap.8.adoc']
2092 bashcompletions += ['mkswap']
2098 include_directories : includes,
2099 link_with : [lib_common,
2102 install_dir : sbindir,
2104 if opt and not is_disabler(exe)
2106 manadocs += ['disk-utils/swaplabel.8.adoc']
2107 bashcompletions += ['swaplabel']
2110 opt = not get_option('build-fsck').disabled()
2114 include_directories : includes,
2115 link_with : [lib_common,
2118 dependencies : realtime_libs,
2119 install_dir : sbindir,
2121 build_by_default : opt)
2122 if opt and not is_disabler(exe)
2124 manadocs += ['disk-utils/fsck.8.adoc']
2125 bashcompletions += ['fsck']
2128 opt = not get_option('build-minix').disabled()
2132 include_directories : includes,
2133 link_with : [lib_common],
2134 install_dir : sbindir,
2136 build_by_default : opt)
2140 include_directories : includes,
2141 c_args : '-DTEST_SCRIPT',
2142 link_with : [lib_common],
2143 build_by_default : opt and program_tests)
2147 include_directories : includes,
2148 link_with : [lib_common],
2149 install_dir : sbindir,
2151 build_by_default : opt)
2152 if opt and not is_disabler(exe)
2153 exes += [exe, exe2, exe3]
2154 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2155 bashcompletions += ['mkfs.minix', 'fsck.minix']
2158 opt = not get_option('build-cramfs').disabled()
2161 mkfs_cramfs_sources,
2162 include_directories : includes,
2163 link_with : [lib_common],
2164 dependencies : [lib_z],
2165 install_dir : sbindir,
2167 build_by_default : opt)
2170 fsck_cramfs_sources,
2171 include_directories : includes,
2172 link_with : [lib_common],
2173 dependencies : [lib_z],
2174 install_dir : sbindir,
2176 build_by_default : opt)
2177 if not is_disabler(exe)
2179 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2180 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2183 opt = not get_option('build-raw').disabled()
2185 cc.has_header('linux/raw.h', required: opt)
2190 include_directories : includes,
2191 install_dir : sbindir,
2193 build_by_default : opt)
2194 if opt and not is_disabler(exe)
2196 manadocs += ['disk-utils/raw.8.adoc']
2197 bashcompletions += ['raw']
2200 opt = not get_option('build-fdformat').disabled()
2204 include_directories : includes,
2205 link_with : [lib_common],
2206 install_dir : usrsbin_exec_dir,
2208 build_by_default : opt)
2209 if opt and not is_disabler(exe)
2211 manadocs += ['disk-utils/fdformat.8.adoc']
2217 include_directories : includes,
2218 link_with : [lib_common],
2219 install_dir : sbindir,
2221 manadocs += ['disk-utils/blockdev.8.adoc']
2222 bashcompletions += ['blockdev']
2224 opt = not get_option('build-fdisks').disabled()
2225 if opt and not have_dirfd and not have_ddfd
2226 error('neither dirfd nor ddfd are available')
2231 include_directories : includes,
2232 link_with : [lib_common,
2236 dependencies : [lib_readline],
2237 install_dir : sbindir,
2239 build_by_default : opt)
2240 if opt and not is_disabler(exe)
2242 bashcompletions += ['fdisk']
2245 opt2 = opt and 'fdisk' in static_programs
2249 link_args : ['--static'],
2250 include_directories : includes,
2251 link_with : [lib_common,
2254 lib_smartcols.get_static_lib()],
2255 dependencies : [lib_readline_static],
2256 install_dir : sbindir,
2258 build_by_default : opt2)
2259 if opt2 and not is_disabler(exe)
2266 include_directories : includes,
2267 link_with : [lib_common,
2271 dependencies : [lib_readline],
2272 install_dir : sbindir,
2274 build_by_default : opt)
2275 if opt and not is_disabler(exe)
2277 bashcompletions += ['sfdisk']
2280 opt2 = opt and 'sfdisk' in static_programs
2284 include_directories : includes,
2285 link_with : [lib_common,
2288 lib_smartcols.get_static_lib()],
2289 dependencies : [lib_readline_static],
2290 install_dir : sbindir,
2292 build_by_default : opt2)
2293 if opt2 and not is_disabler(exe)
2300 include_directories : includes,
2301 link_with : [lib_common,
2306 dependencies : [curses_libs],
2307 install_dir : sbindir,
2309 build_by_default : opt)
2310 if opt and not is_disabler(exe)
2312 manadocs += ['disk-utils/fdisk.8.adoc',
2313 'disk-utils/sfdisk.8.adoc',
2314 'disk-utils/cfdisk.8.adoc']
2315 bashcompletions += ['cfdisk']
2318 opt = not get_option('build-partx').disabled()
2322 include_directories : includes,
2323 link_with : [lib_common],
2324 install_dir : usrsbin_exec_dir,
2326 build_by_default : opt)
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,
2350 install_dir : usrsbin_exec_dir,
2352 build_by_default : opt)
2354 exes += [exe, exe2, exe3, exe4]
2355 manadocs += ['disk-utils/addpart.8.adoc',
2356 'disk-utils/delpart.8.adoc',
2357 'disk-utils/resizepart.8.adoc',
2358 'disk-utils/partx.8.adoc']
2359 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2362 ############################################################
2367 include_directories : includes,
2368 link_with : [lib_common],
2369 dependencies : [lib_util,
2373 install_dir : usrbin_exec_dir,
2376 manadocs += ['term-utils/script.1.adoc']
2377 bashcompletions += ['script']
2382 include_directories : includes,
2383 c_args : '-DTEST_SCRIPT',
2384 link_with : [lib_common],
2385 dependencies : [lib_util,
2389 build_by_default : program_tests)
2395 include_directories : includes,
2396 link_with : [lib_common],
2397 dependencies : [lib_util,
2400 install_dir : usrbin_exec_dir,
2403 manadocs += ['term-utils/scriptlive.1.adoc']
2404 bashcompletions += ['scriptlive']
2408 scriptreplay_sources,
2409 include_directories : includes,
2410 link_with : [lib_common],
2411 dependencies : [math_libs],
2412 install_dir : usrbin_exec_dir,
2415 manadocs += ['term-utils/scriptreplay.1.adoc']
2416 bashcompletions += ['scriptreplay']
2418 opt = not get_option('build-agetty').disabled()
2422 include_directories : includes,
2423 link_with : [lib_common, logindefs_c],
2424 dependencies : [BSD ? lib_util : [], lib_systemd],
2425 install_dir : sbindir,
2427 build_by_default : opt)
2430 manadocs += ['term-utils/agetty.8.adoc']
2433 opt = not get_option('build-setterm').disabled()
2437 include_directories : includes,
2438 link_with : [lib_common],
2439 dependencies : [curses_libs],
2440 install_dir : usrbin_exec_dir,
2442 build_by_default : opt)
2445 manadocs += ['term-utils/setterm.1.adoc']
2446 bashcompletions += ['setterm']
2449 opt = not get_option('build-mesg').disabled()
2453 include_directories : includes,
2454 link_with : [lib_common],
2455 install_dir : usrbin_exec_dir,
2457 build_by_default : opt)
2460 manadocs += ['term-utils/mesg.1.adoc']
2461 bashcompletions += ['mesg']
2464 opt = not get_option('build-wall').disabled()
2468 include_directories : includes,
2469 link_with : [lib_common],
2470 dependencies : [lib_systemd],
2471 install_dir : usrbin_exec_dir,
2472 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2474 build_by_default : opt)
2477 manadocs += ['term-utils/wall.1.adoc']
2478 bashcompletions += ['wall']
2481 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2482 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2484 opt = not get_option('build-write').disabled()
2488 include_directories : includes,
2489 link_with : [lib_common],
2490 dependencies : [lib_systemd],
2491 install_dir : usrbin_exec_dir,
2492 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2494 build_by_default : opt)
2497 manadocs += ['term-utils/write.1.adoc']
2498 bashcompletions += ['write']
2501 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2502 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2504 opt = not get_option('build-login').disabled()
2508 include_directories : includes,
2509 link_with : [lib_common, logindefs_c],
2510 dependencies : [lib_pam,
2514 build_by_default : opt)
2515 if not is_disabler(exe)
2517 manadocs += ['login-utils/login.1.adoc']
2520 opt = not get_option('build-sulogin').disabled()
2524 include_directories : includes,
2525 link_with : [lib_common],
2526 dependencies : [lib_crypt,
2528 install_dir : sbindir,
2530 build_by_default : opt)
2531 if not is_disabler(exe)
2533 manadocs += ['login-utils/sulogin.8.adoc']
2539 include_directories : includes,
2540 link_with : [lib_common,
2542 dependencies : [curses_libs],
2543 install_dir : usrbin_exec_dir,
2546 manadocs += ['misc-utils/cal.1.adoc']
2547 bashcompletions += ['cal']
2549 opt = not get_option('build-logger').disabled()
2553 include_directories : includes,
2554 link_with : [lib_common],
2555 dependencies : [lib_systemd],
2556 install_dir : usrbin_exec_dir,
2558 build_by_default : opt)
2559 if opt and not is_disabler(exe)
2561 manadocs += ['misc-utils/logger.1.adoc']
2562 bashcompletions += ['logger']
2568 include_directories : includes,
2569 c_args : '-DTEST_LOGGER',
2570 link_with : [lib_common],
2571 dependencies : [lib_systemd],
2572 build_by_default: program_tests)
2573 if not is_disabler(exe)
2580 include_directories : includes,
2581 install_dir : usrbin_exec_dir,
2584 manadocs += ['misc-utils/look.1.adoc']
2585 bashcompletions += ['look']
2590 include_directories : includes,
2591 link_with : [lib_common],
2592 install_dir : usrbin_exec_dir,
2595 manadocs += ['misc-utils/mcookie.1.adoc']
2596 bashcompletions += ['mcookie']
2601 include_directories : includes,
2602 dependencies : [lib_selinux],
2603 install_dir : usrbin_exec_dir,
2606 manadocs += ['misc-utils/namei.1.adoc']
2607 bashcompletions += ['namei']
2612 include_directories : includes,
2613 link_with : [lib_common],
2614 install_dir : usrbin_exec_dir,
2617 manadocs += ['misc-utils/whereis.1.adoc']
2618 bashcompletions += ['whereis']
2623 include_directories : includes,
2624 link_with : [lib_common,
2627 install_dir : usrbin_exec_dir,
2629 if not is_disabler(exe)
2631 manadocs += ['misc-utils/lslocks.8.adoc']
2632 bashcompletions += ['lslocks']
2638 include_directories : includes,
2639 link_with : [lib_common,
2644 dependencies : lib_udev,
2646 if not is_disabler(exe)
2648 manadocs += ['misc-utils/lsblk.8.adoc']
2649 bashcompletions += ['lsblk']
2653 mq_libs += cc.find_library('rt', required : true)
2658 include_directories : includes,
2659 link_with : [lib_common,
2661 dependencies : mq_libs,
2662 install_dir : usrbin_exec_dir,
2664 if not is_disabler(exe)
2666 manadocs += ['misc-utils/lsfd.1.adoc']
2672 include_directories : includes,
2673 link_with : [lib_common,
2675 install_dir : usrbin_exec_dir,
2677 if not is_disabler(exe)
2679 manadocs += ['misc-utils/uuidgen.1.adoc']
2680 bashcompletions += ['uuidgen']
2686 include_directories : includes,
2687 link_with : [lib_common,
2690 install_dir : usrbin_exec_dir,
2692 if not is_disabler(exe)
2694 manadocs += ['misc-utils/uuidparse.1.adoc']
2695 bashcompletions += ['uuidparse']
2702 include_directories : includes,
2703 link_with : [lib_common,
2705 dependencies : [realtime_libs,
2707 install_dir : usrsbin_exec_dir,
2709 build_by_default : opt)
2713 include_directories : includes,
2714 link_with : [lib_common,
2716 dependencies : thread_libs,
2717 build_by_default : opt and program_tests)
2718 if not is_disabler(exe)
2720 manadocs += ['misc-utils/uuidd.8.adoc']
2721 bashcompletions += ['uuidd']
2724 opt = build_libblkid
2728 include_directories : includes,
2729 link_with : [lib_common,
2731 install_dir : sbindir,
2733 build_by_default : opt)
2734 if opt and not is_disabler(exe)
2736 manadocs += ['misc-utils/blkid.8.adoc']
2737 bashcompletions += ['blkid']
2740 opt = opt and 'blkid' in static_programs
2744 include_directories : includes,
2745 link_with : [lib_common,
2747 install_dir : sbindir,
2749 build_by_default : opt)
2750 if opt and not is_disabler(exe)
2756 'libblkid/samples/mkfs.c',
2757 include_directories : includes,
2758 link_with : lib_blkid)
2759 if not is_disabler(exe)
2764 'sample-partitions',
2765 'libblkid/samples/partitions.c',
2766 include_directories : includes,
2767 link_with : lib_blkid)
2768 if not is_disabler(exe)
2773 'sample-superblocks',
2774 'libblkid/samples/superblocks.c',
2775 include_directories : includes,
2776 link_with : lib_blkid)
2777 if not is_disabler(exe)
2783 'libblkid/samples/topology.c',
2784 include_directories : includes,
2785 link_with : lib_blkid)
2786 if not is_disabler(exe)
2791 'test_blkid_fuzz_sample',
2792 'libblkid/src/fuzz.c',
2793 include_directories: includes,
2794 link_with: lib_blkid,
2795 build_by_default: program_tests)
2796 if not is_disabler(exe)
2800 ############################################################
2805 include_directories : includes,
2806 link_with : [lib_blkid],
2807 install_dir : sbindir,
2809 if not is_disabler(exe)
2811 manadocs += ['misc-utils/findfs.8.adoc']
2812 bashcompletions += ['findfs']
2818 include_directories : includes,
2819 link_with : [lib_common,
2822 install_dir : sbindir,
2824 if not is_disabler(exe)
2826 manadocs += ['misc-utils/wipefs.8.adoc']
2827 bashcompletions += ['wipefs']
2833 include_directories : includes,
2834 link_with : [lib_common,
2838 dependencies : [lib_udev],
2840 if not is_disabler(exe)
2842 manadocs += ['misc-utils/findmnt.8.adoc']
2843 bashcompletions += ['findmnt']
2849 include_directories : includes,
2850 link_with : [lib_common],
2852 if not is_disabler(exe)
2854 manadocs += ['misc-utils/kill.1.adoc']
2857 opt = not get_option('build-rename').disabled()
2861 include_directories : includes,
2862 install_dir : usrbin_exec_dir,
2864 build_by_default : opt)
2865 if opt and not is_disabler(exe)
2867 manadocs += ['misc-utils/rename.1.adoc']
2868 bashcompletions += ['rename']
2874 include_directories : includes,
2875 link_with : [lib_common],
2876 install_dir : usrbin_exec_dir,
2879 manadocs += ['misc-utils/getopt.1.adoc']
2880 bashcompletions += ['getopt']
2885 include_directories : includes,
2886 link_with : [lib_common,
2888 install_dir : usrbin_exec_dir,
2890 if not is_disabler(exe)
2892 manadocs += ['misc-utils/fincore.1.adoc']
2893 bashcompletions += ['fincore']
2899 include_directories : includes,
2900 link_with : [lib_common],
2901 install_dir : usrbin_exec_dir,
2903 if not is_disabler(exe)
2905 manadocs += ['misc-utils/hardlink.1.adoc']
2906 bashcompletions += ['hardlink']
2909 opt = not get_option('build-pipesz').disabled()
2913 include_directories : includes,
2914 link_with : [lib_common],
2915 install_dir : usrbin_exec_dir,
2917 if opt and not is_disabler(exe)
2919 manadocs += ['misc-utils/pipesz.1.adoc']
2920 bashcompletions += ['pipesz']
2926 include_directories : includes,
2927 c_args : '-DTEST_CAL',
2928 link_with : [lib_common,
2930 dependencies : [curses_libs],
2931 build_by_default: program_tests)
2932 if not is_disabler(exe)
2939 include_directories : includes,
2940 link_with : [lib_common],
2941 install_dir : usrbin_exec_dir,
2943 if not is_disabler(exe)
2945 manadocs += ['misc-utils/fadvise.1.adoc']
2946 bashcompletions += ['fadvise']
2949 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
2953 include_directories : includes,
2954 link_with : [lib_common],
2955 install_dir : usrbin_exec_dir,
2957 if not is_disabler(exe)
2959 manadocs += ['misc-utils/waitpid.1.adoc']
2960 bashcompletions += ['waitpid']
2964 syscalls_h = custom_target('syscalls.h',
2965 input : 'tools/all_syscalls',
2966 output : 'syscalls.h',
2967 command : ['tools/all_syscalls', cc.cmd_array()]
2970 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
2973 'misc-utils/enosys.c', syscalls_h,
2974 include_directories : includes,
2975 link_with : [lib_common],
2976 install_dir : usrbin_exec_dir,
2978 if not is_disabler(exe)
2980 manadocs += ['misc-utils/enosys.1.adoc']
2981 bashcompletions += ['enosys']
2988 include_directories : includes,
2989 link_with : [lib_common, lib_smartcols],
2990 install_dir : usrbin_exec_dir,
2992 if not is_disabler(exe)
2994 manadocs += ['misc-utils/lsclocks.1.adoc']
2995 bashcompletions += ['lsclocks']
2998 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3002 include_directories : includes,
3003 link_with : [lib_common],
3004 install_dir : usrbin_exec_dir,
3006 if not is_disabler(exe)
3008 manadocs += ['misc-utils/exch.1.adoc']
3009 bashcompletions += ['exch']
3013 ############################################################
3015 opt = not get_option('build-schedutils').disabled()
3018 'schedutils/chrt.c',
3019 include_directories : includes,
3020 link_with : lib_common,
3021 install_dir : usrbin_exec_dir,
3023 build_by_default : opt)
3027 'schedutils/ionice.c',
3028 include_directories : includes,
3029 link_with : lib_common,
3030 install_dir : usrbin_exec_dir,
3032 build_by_default : opt)
3036 'schedutils/taskset.c',
3037 include_directories : includes,
3038 link_with : lib_common,
3039 install_dir : usrbin_exec_dir,
3041 build_by_default : opt)
3045 'schedutils/uclampset.c',
3046 include_directories : includes,
3047 link_with : lib_common,
3048 install_dir : usrbin_exec_dir,
3050 build_by_default : opt)
3052 if opt and not is_disabler(exe)
3053 exes += [exe, exe2, exe3, exe4]
3054 manadocs += ['schedutils/chrt.1.adoc',
3055 'schedutils/ionice.1.adoc',
3056 'schedutils/taskset.1.adoc',
3057 'schedutils/uclampset.1.adoc']
3058 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3061 ############################################################
3063 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3068 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3069 include_directories : dir_include,
3070 link_with : lib_common,
3071 build_by_default: program_tests)
3077 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3078 include_directories : dir_include,
3079 link_with : lib_common,
3080 build_by_default: program_tests)
3086 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3087 include_directories : dir_include,
3088 link_with : lib_common,
3089 build_by_default: program_tests)
3095 c_args : ['-DTEST_PROGRAM_MANGLE'],
3096 include_directories : dir_include,
3097 build_by_default: program_tests)
3103 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3104 include_directories : dir_include,
3105 build_by_default: program_tests)
3111 'lib/color-names.c',
3112 c_args : ['-DTEST_PROGRAM_COLORS'],
3113 include_directories : dir_include,
3114 link_with : [lib_common, lib_tcolors],
3115 build_by_default: program_tests)
3121 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3122 include_directories : dir_include,
3123 build_by_default: program_tests)
3126 if conf.get('HAVE_OPENAT').to_string() == '1' \
3127 and conf.get('HAVE_DIRFD').to_string() == '1'
3131 c_args : ['-DTEST_PROGRAM_PROCFS'],
3132 include_directories : dir_include,
3133 link_with : lib_common,
3134 build_by_default: program_tests)
3141 have_cpu_set_t ? 'lib/cpuset.c' : [],
3142 c_args : ['-DTEST_PROGRAM_PATH'],
3143 include_directories : dir_include,
3144 link_with : lib_common,
3145 build_by_default: program_tests)
3149 if conf.get('HAVE_PTY').to_string() == '1'
3154 c_args : ['-DTEST_PROGRAM_PTY'],
3155 include_directories : dir_include,
3156 link_with : [lib_common],
3157 dependencies : [lib_m,
3160 build_by_default: program_tests)
3168 c_args : ['-DTEST_PROGRAM_CPUSET'],
3169 include_directories : dir_include,
3170 build_by_default: program_tests)
3181 have_cpu_set_t ? 'lib/cpuset.c' : [],
3182 c_args : ['-DTEST_PROGRAM_SYSFS'],
3183 include_directories : dir_include,
3184 build_by_default: program_tests)
3190 c_args : ['-DTEST_PROGRAM_PAGER'],
3191 include_directories : dir_include,
3192 build_by_default: program_tests)
3196 'test_linux_version',
3197 'lib/linux_version.c',
3198 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3199 include_directories : dir_include,
3200 build_by_default: program_tests)
3206 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3207 include_directories : dir_include,
3208 build_by_default: program_tests)
3212 'test_canonicalize',
3213 'lib/canonicalize.c',
3214 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3215 include_directories : dir_include,
3216 build_by_default: program_tests)
3223 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3224 include_directories : dir_include,
3225 build_by_default: program_tests)
3231 c_args : ['-DTEST_PROGRAM'],
3232 include_directories : dir_include,
3233 link_with : lib_common,
3234 build_by_default: program_tests)
3240 c_args : ['-DTEST_PROGRAM'],
3241 include_directories : dir_include,
3242 link_with : [lib_common, logindefs_c],
3243 build_by_default: program_tests)
3247 ############################################################
3251 'libuuid/src/test_uuid.c',
3252 include_directories : [dir_include, dir_libuuid],
3253 link_with : lib_uuid,
3254 dependencies : socket_libs,
3255 build_by_default: program_tests)
3256 if not is_disabler(exe)
3260 ############################################################
3262 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3263 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3267 'libfdisk/src/ask.c',
3268 c_args : libfdisk_tests_cflags,
3269 include_directories : lib_fdisk_includes,
3270 link_with : libfdisk_tests_ldadd,
3271 build_by_default: program_tests)
3272 if not is_disabler(exe)
3278 'libfdisk/src/gpt.c',
3279 c_args : libfdisk_tests_cflags,
3280 include_directories : lib_fdisk_includes,
3281 link_with : libfdisk_tests_ldadd,
3282 build_by_default: program_tests)
3283 if not is_disabler(exe)
3289 'libfdisk/src/utils.c',
3290 c_args : libfdisk_tests_cflags,
3291 include_directories : lib_fdisk_includes,
3292 link_with : libfdisk_tests_ldadd,
3293 build_by_default: program_tests)
3294 if not is_disabler(exe)
3299 'test_fdisk_script',
3300 'libfdisk/src/script.c',
3301 c_args : libfdisk_tests_cflags,
3302 include_directories : lib_fdisk_includes,
3303 link_with : libfdisk_tests_ldadd,
3304 build_by_default: program_tests)
3305 if not is_disabler(exe)
3310 'test_fdisk_version',
3311 'libfdisk/src/version.c',
3312 c_args : libfdisk_tests_cflags,
3313 include_directories : lib_fdisk_includes,
3314 link_with : libfdisk_tests_ldadd,
3315 build_by_default: program_tests)
3316 if not is_disabler(exe)
3322 'libfdisk/src/item.c',
3323 c_args : libfdisk_tests_cflags,
3324 include_directories : lib_fdisk_includes,
3325 link_with : libfdisk_tests_ldadd,
3326 build_by_default: program_tests)
3327 if not is_disabler(exe)
3331 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3334 'sample-fdisk-mkpart',
3335 'libfdisk/samples/mkpart.c',
3336 include_directories : lib_fdisk_includes,
3337 link_with : sample_fdisk_ldadd)
3338 if not is_disabler(exe)
3343 'sample-fdisk-mkpart-fullspec',
3344 'libfdisk/samples/mkpart-fullspec.c',
3345 include_directories : lib_fdisk_includes,
3346 link_with : sample_fdisk_ldadd)
3347 if not is_disabler(exe)
3351 ############################################################
3355 'tests/helpers/test_cap.c',
3356 include_directories : includes,
3357 dependencies : [lib_cap_ng],
3358 build_by_default: program_tests)
3359 if not is_disabler(exe)
3365 'tests/helpers/test_mbsencode.c',
3366 include_directories : includes,
3367 link_with : lib_common,
3368 build_by_default: program_tests)
3373 'tests/helpers/test_byteswap.c',
3374 include_directories : includes,
3375 build_by_default: program_tests)
3380 'tests/helpers/test_md5.c',
3382 include_directories : includes,
3383 build_by_default: program_tests)
3388 'tests/helpers/test_sha1.c',
3390 include_directories : includes,
3391 build_by_default: program_tests)
3396 'tests/helpers/test_pathnames.c',
3397 include_directories : includes,
3398 build_by_default: program_tests)
3403 'tests/helpers/test_strerror.c',
3404 include_directories : includes,
3405 build_by_default: program_tests)
3410 'tests/helpers/test_sysinfo.c',
3411 include_directories : includes,
3412 build_by_default: program_tests)
3417 'tests/helpers/test_sigreceive.c',
3418 include_directories : includes,
3419 link_with : lib_common,
3420 build_by_default: program_tests)
3425 'tests/helpers/test_tiocsti.c',
3426 include_directories : includes,
3427 build_by_default: program_tests)
3431 'test_uuid_namespace',
3432 'tests/helpers/test_uuid_namespace.c',
3436 include_directories : includes,
3437 build_by_default: program_tests)
3443 'tests/helpers/test_mkfds.c',
3444 'tests/helpers/test_mkfds.h',
3445 'tests/helpers/test_mkfds_ppoll.c',
3446 include_directories : includes,
3447 dependencies : mq_libs,
3448 build_by_default: program_tests)
3454 'tests/helpers/test_enosys.c',
3455 include_directories : includes,
3456 build_by_default: program_tests)
3459 ############################################################
3461 if conf.get('HAVE_OPENAT').to_string() == '1'
3463 'sample-scols-tree',
3464 'libsmartcols/samples/tree.c',
3465 include_directories : includes,
3466 link_with : [lib_smartcols, lib_common],
3467 build_by_default: program_tests)
3468 if not is_disabler(exe)
3474 'sample-scols-title',
3475 'libsmartcols/samples/title.c',
3476 include_directories : includes,
3477 link_with : [lib_smartcols, lib_common])
3478 if not is_disabler(exe)
3483 'sample-scols-wrap',
3484 'libsmartcols/samples/wrap.c',
3485 include_directories : includes,
3486 link_with : [lib_smartcols, lib_common])
3487 if not is_disabler(exe)
3492 'sample-scols-continuous',
3493 'libsmartcols/samples/continuous.c',
3494 include_directories : includes,
3495 link_with : [lib_smartcols, lib_common])
3496 if not is_disabler(exe)
3501 'sample-scols-continuous-json',
3502 'libsmartcols/samples/continuous-json.c',
3503 include_directories : includes,
3504 link_with : [lib_smartcols, lib_common])
3505 if not is_disabler(exe)
3510 'sample-scols-maxout',
3511 'libsmartcols/samples/maxout.c',
3512 include_directories : includes,
3513 link_with : [lib_smartcols, lib_common])
3514 if not is_disabler(exe)
3519 'sample-scols-fromfile',
3520 'libsmartcols/samples/fromfile.c',
3521 include_directories : includes,
3522 link_with : [lib_smartcols, lib_common])
3523 if not is_disabler(exe)
3528 'sample-scols-grouping-simple',
3529 'libsmartcols/samples/grouping-simple.c',
3530 include_directories : includes,
3531 link_with : [lib_smartcols, lib_common])
3532 if not is_disabler(exe)
3537 'sample-scols-grouping-overlay',
3538 'libsmartcols/samples/grouping-overlay.c',
3539 include_directories : includes,
3540 link_with : [lib_smartcols, lib_common])
3541 if not is_disabler(exe)
3545 ############################################################
3547 # Let the test runner know whether we're running under asan and export
3548 # some paths. We use a file on disk so that it is possible to run the
3549 # test scripts from commandline without setting any variables.
3550 configure_file(output : 'meson.conf',
3555 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3556 python.full_path())])
3558 run_sh = find_program('tests/run.sh')
3562 '--srcdir=' + meson.current_source_dir(),
3563 '--builddir=' + meson.current_build_dir(),
3569 manadocs += ['lib/terminal-colors.d.5.adoc']
3570 manadocs += ['libblkid/libblkid.3.adoc']
3574 'libuuid/man/uuid.3.adoc',
3575 'libuuid/man/uuid_clear.3.adoc',
3576 'libuuid/man/uuid_compare.3.adoc',
3577 'libuuid/man/uuid_copy.3.adoc',
3578 'libuuid/man/uuid_generate.3.adoc',
3579 'libuuid/man/uuid_is_null.3.adoc',
3580 'libuuid/man/uuid_parse.3.adoc',
3581 'libuuid/man/uuid_time.3.adoc',
3582 'libuuid/man/uuid_unparse.3.adoc']
3584 'uuid_generate_random.3': 'uuid_generate.3',
3585 'uuid_generate_time.3': 'uuid_generate.3',
3586 'uuid_generate_time_safe.3': 'uuid_generate.3',
3590 asciidoctor = find_program('asciidoctor', required : false)
3591 if asciidoctor.found()
3592 foreach adoc : manadocs
3593 name = adoc.split('/')[-1]
3594 page = name.split('.adoc')[0]
3595 section = page.split('.')[-1]
3596 mandirn = join_paths(mandir, 'man' + section)
3601 command : [ asciidoctor,
3603 '-a', 'VERSION=' + meson.project_version(),
3604 '-a', 'release-version=' + meson.project_version(),
3605 '-a', 'ADJTIME_PATH=/etc/adjtime',
3606 '-a', 'package-docdir=' + docdir,
3607 '--base-dir=' + meson.current_source_dir(),
3608 '--destination-dir=' + meson.current_build_dir(),
3609 '--load-path', '@SOURCE_ROOT@/tools',
3610 '--require', 'asciidoctor-includetracker',
3614 depfile : page + '.deps',
3616 install_dir : mandirn)
3619 foreach link_name, target : manlinks
3620 link_section = link_name.split('.')[-1]
3621 target_section = target.split('.')[-1]
3622 meson.add_install_script(meson_make_manpage_stub,
3623 join_paths('man' + target_section, target),
3624 join_paths(mandir, 'man' + link_section, link_name))
3628 if bash_completion.found()
3629 foreach completion : bashcompletions
3631 join_paths('bash-completion', completion),
3632 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3635 foreach link_name, target : bashcompletionslinks
3636 meson.add_install_script(meson_make_symlink,
3638 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))