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)
685 if not cc.has_function('socket')
686 socket_libs += cc.find_library('socket', required : true)
687 have = cc.has_function('socket',
688 dependencies : socket_libs)
690 error('socket() function not available')
695 have = cc.has_function('clock_gettime')
697 realtime_libs += cc.find_library('rt', required : true)
698 have = cc.has_function('clock_gettime',
699 dependencies : realtime_libs)
701 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
703 thread_libs = dependency('threads')
705 have = cc.has_function('timer_create')
707 realtime_libs = [cc.find_library('rt', required : true)]
708 have = cc.has_function('timer_create',
709 dependencies : realtime_libs)
711 realtime_libs += thread_libs
712 have = cc.has_function('timer_create',
713 dependencies : realtime_libs)
716 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
718 have = cc.has_function('setitimer')
719 conf.set('HAVE_SETITIMER', have ? 1 : false)
722 rtas_libs = cc.find_library('rtas', required : false)
723 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
726 if not cc.has_header_symbol('math.h', 'isnan')
727 lib = cc.find_library('m', required : true)
728 if (cc.has_function('isnan', dependencies : lib) and
729 cc.has_function('__isnan', dependencies : lib))
734 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
735 args : '-D_GNU_SOURCE')
736 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
739 extern char *__progname;
741 return (*__progname != 0);
744 have = cc.compiles(code, name : 'using __progname')
745 conf.set('HAVE___PROGNAME', have ? 1 : false)
747 have = conf.get('HAVE_PTY_H').to_string() == '1' \
748 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
749 conf.set('HAVE_PTY', have ? 1 : false)
751 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
752 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
754 build_plymouth_support = get_option('build-plymouth-support')
755 have_tiocglcktrmios = cc.has_header_symbol(
756 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
757 required : build_plymouth_support.enabled())
758 have_sock_cloexec = cc.has_header_symbol(
759 'sys/socket.h', 'SOCK_CLOEXEC',
760 prefix : '#include <sys/types.h>',
761 required : build_plymouth_support.enabled())
762 have_sock_nonblock = cc.has_header_symbol(
763 'sys/socket.h', 'SOCK_NONBLOCK',
764 prefix : '#include <sys/types.h>',
765 required : build_plymouth_support.enabled())
766 have_so_passcred = cc.has_header_symbol(
767 'sys/socket.h', 'SO_PASSCRED',
768 prefix : '#include <sys/types.h>',
769 required : build_plymouth_support.enabled())
771 build_plymouth_support = (not build_plymouth_support.disabled() and
772 have_tiocglcktrmios and
773 have_sock_cloexec and
774 have_sock_nonblock and
776 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
777 summary('plymouth support',
778 build_plymouth_support ? 'enabled' : 'disabled',
779 section : 'components')
781 # check for valid fallocate() function
782 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
783 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
784 # and program can't be linked.
792 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
793 return ret == 0 ? 0 : 1;
796 have = cc.links(code, name : 'fallocate() function')
797 conf.set('HAVE_FALLOCATE', have ? 1 : false)
805 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
806 return ret == 0 ? 0 : 1;
809 have = cc.links(code, name : 'posix_fallocate() function')
810 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
812 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
813 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
814 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
816 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
817 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
818 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
820 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
822 ############################################################
825 fs_search_path = get_option('fs-search-path')
826 fs_search_path_extra = get_option('fs-search-path-extra')
827 if fs_search_path_extra != ''
828 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
830 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
832 systemdsystemunitdir = ''
834 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
837 sysvinit = get_option('sysvinit').enabled()
838 sysvinitrcdir = sysconfdir + '/init.d'
840 program_tests = get_option('program-tests')
842 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
843 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
845 have = get_option('chsh-only-listed')
846 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
848 have = get_option('use-tty-group')
849 conf.set('USE_TTY_GROUP', have ? 1 : false)
851 bison = find_program('bison')
852 flex = find_program('flex')
854 build_hwclock = not get_option('build-hwclock').disabled()
855 bison_gen = generator(
857 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
858 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
860 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
861 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
865 configuration : conf)
867 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
872 '-Waddress-of-packed-member',
873 '-Wdiscarded-qualifiers',
874 '-Wembedded-directive',
877 '-Wimplicit-function-declaration',
878 '-Wmissing-declarations',
879 '-Wmissing-parameter-type',
880 '-Wmissing-prototypes',
882 '-Wno-missing-field-initializers',
883 '-Wold-style-definition',
887 '-Wstrict-prototypes',
890 '-Wunused-but-set-parameter',
891 '-Wunused-but-set-variable',
892 '-Wunused-parameter',
898 foreach compiler_flag : compiler_flags
899 if cc.has_argument(compiler_flag)
900 add_project_arguments(compiler_flag, language : 'c')
908 bashcompletionslinks = {}
914 subdir('libsmartcols')
917 subdir('login-utils')
925 includes = [dir_include,
935 opt = not get_option('build-chfn-chsh').disabled()
940 include_directories : includes,
941 link_with : [lib_common, logindefs_c],
942 dependencies : chfn_chsh_deps,
943 install_dir : usrbin_exec_dir,
944 install_mode : 'rwsr-xr-x',
946 build_by_default : opt)
950 'login-utils/chsh.c',
953 include_directories : includes,
954 link_with : lib_common,
955 dependencies : chfn_chsh_deps,
956 install_dir : usrbin_exec_dir,
957 install_mode : 'rwsr-xr-x',
959 build_by_default : opt)
960 if opt and not is_disabler(exe)
962 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
963 bashcompletions += ['chfn', 'chsh']
968 test_islocal_sources,
969 include_directories : includes,
970 c_args : '-DTEST_PROGRAM',
971 build_by_default : program_tests)
976 test_consoles_sources,
977 c_args : ['-DTEST_PROGRAM'],
978 include_directories : includes,
979 link_with : lib_common,
980 build_by_default : program_tests)
983 opt = not get_option('build-last').disabled()
987 include_directories : includes,
988 link_with : [lib_common],
989 install_dir : usrbin_exec_dir,
991 build_by_default : opt)
992 if opt and not is_disabler(exe)
994 meson.add_install_script(meson_make_symlink,
996 join_paths(usrbin_exec_dir, 'lastb'))
997 manadocs += ['login-utils/last.1.adoc']
998 manlinks += {'lastb.1': 'last.1'}
999 bashcompletions += ['last']
1000 bashcompletionslinks += {'lastb': 'last'}
1003 opt = not get_option('build-nologin').disabled()
1006 'login-utils/nologin.c',
1007 include_directories : includes,
1008 install_dir : sbindir,
1009 link_with : [lib_common],
1011 build_by_default : opt)
1012 if opt and not is_disabler(exe)
1014 manadocs += ['login-utils/nologin.8.adoc']
1017 opt = not get_option('build-utmpdump').disabled()
1020 'login-utils/utmpdump.c',
1021 include_directories : includes,
1022 link_with : [lib_common],
1023 install_dir : usrbin_exec_dir,
1025 build_by_default : opt)
1026 if opt and not is_disabler(exe)
1028 manadocs += ['login-utils/utmpdump.1.adoc']
1029 bashcompletions += ['utmpdump']
1032 opt = not get_option('build-su').disabled()
1036 'login-utils/su-common.c',
1037 'login-utils/su-common.h',
1041 include_directories : includes,
1042 link_with : [lib_common, logindefs_c],
1043 dependencies : [lib_pam,
1047 install_mode : 'rwsr-xr-x',
1049 build_by_default : opt)
1050 if opt and not is_disabler(exe)
1052 manadocs += ['login-utils/su.1.adoc']
1053 bashcompletions += ['su']
1056 opt = not get_option('build-newgrp').disabled()
1059 'login-utils/newgrp.c',
1060 include_directories : includes,
1061 dependencies : [lib_crypt],
1062 install_dir : usrbin_exec_dir,
1063 install_mode : 'rwsr-xr-x',
1065 build_by_default : opt)
1066 if opt and not is_disabler(exe)
1068 manadocs += ['login-utils/newgrp.1.adoc']
1069 bashcompletions += ['newgrp']
1072 opt = not get_option('build-lslogins').disabled()
1075 'login-utils/lslogins.c',
1076 include_directories : includes,
1077 link_with : [lib_common,
1080 dependencies : [lib_selinux,
1082 install_dir : usrbin_exec_dir,
1084 build_by_default : opt)
1085 if opt and not is_disabler(exe)
1087 manadocs += ['login-utils/lslogins.1.adoc']
1088 bashcompletions += ['lslogins']
1091 opt = not get_option('build-vipw').disabled()
1094 'login-utils/vipw.c',
1095 'login-utils/setpwnam.h',
1096 include_directories : includes,
1097 link_with : [lib_common],
1098 dependencies : [lib_selinux],
1099 install_dir : usrbin_exec_dir,
1101 build_by_default : opt)
1102 if opt and not is_disabler(exe)
1104 meson.add_install_script(meson_make_symlink,
1106 join_paths(usrbin_exec_dir, 'vigr'))
1107 manadocs += ['login-utils/vipw.8.adoc']
1108 meson.add_install_script(meson_make_symlink,
1110 join_paths(mandir, 'man8/vigr.8'))
1113 opt = not get_option('build-runuser').disabled()
1116 'login-utils/runuser.c',
1117 'login-utils/su-common.c',
1118 'login-utils/su-common.h',
1122 include_directories : includes,
1123 link_with : [lib_common, logindefs_c],
1124 dependencies : [lib_pam,
1128 install_dir : sbindir,
1130 build_by_default : opt)
1131 if opt and not is_disabler(exe)
1133 manadocs += ['login-utils/runuser.1.adoc']
1134 bashcompletionslinks += {'runuser': 'su'}
1137 ############################################################
1143 include_directories : includes,
1144 link_with : lib_common,
1145 install_dir : usrbin_exec_dir,
1148 manadocs += ['text-utils/col.1.adoc']
1149 bashcompletions += ['col']
1155 include_directories : includes,
1156 install_dir : usrbin_exec_dir,
1159 manadocs += ['text-utils/colcrt.1.adoc']
1160 bashcompletions += ['colcrt']
1165 include_directories : includes,
1166 link_with : lib_common,
1167 install_dir : usrbin_exec_dir,
1170 manadocs += ['text-utils/colrm.1.adoc']
1171 bashcompletions += ['colrm']
1176 include_directories : includes,
1177 install_dir : usrbin_exec_dir,
1180 manadocs += ['text-utils/rev.1.adoc']
1181 bashcompletions += ['rev']
1186 include_directories : includes,
1187 link_with : [lib_common,
1189 install_dir : usrbin_exec_dir,
1191 if not is_disabler(exe)
1193 manadocs += ['text-utils/column.1.adoc']
1194 bashcompletions += ['column']
1197 opt = not get_option('build-line').disabled()
1201 include_directories : includes,
1202 install_dir : usrbin_exec_dir,
1204 build_by_default : opt)
1205 if opt and not is_disabler(exe)
1207 manadocs += ['text-utils/line.1.adoc']
1210 opt = not get_option('build-pg').disabled()
1214 link_with : lib_common,
1215 include_directories : includes,
1216 dependencies : [lib_tinfo,
1218 install_dir : usrbin_exec_dir,
1220 build_by_default : opt)
1221 if opt and not is_disabler(exe)
1223 manadocs += ['text-utils/pg.1.adoc']
1224 bashcompletions += ['pg']
1227 opt = not get_option('build-ul').disabled()
1231 include_directories : includes,
1232 dependencies : [lib_tinfo,
1234 install_dir : usrbin_exec_dir,
1236 build_by_default : opt)
1237 if opt and not is_disabler(exe)
1239 manadocs += ['text-utils/ul.1.adoc']
1240 bashcompletions += ['ul']
1243 opt = not get_option('build-more').disabled()
1247 link_with : [lib_common],
1248 include_directories : includes,
1249 dependencies : [lib_tinfo,
1253 build_by_default : opt)
1257 link_with : [lib_common],
1258 include_directories : includes,
1259 c_args : '-DTEST_PROGRAM',
1260 dependencies : [lib_tinfo,
1263 build_by_default : opt and program_tests)
1265 if opt and not is_disabler(exe)
1267 manadocs += ['text-utils/more.1.adoc']
1268 bashcompletions += ['more']
1274 include_directories : includes,
1275 link_with : [lib_common,
1277 install_dir : usrbin_exec_dir,
1279 if not is_disabler(exe)
1281 manadocs += ['text-utils/hexdump.1.adoc']
1282 bashcompletions += ['hexdump']
1285 opt = not get_option('build-lsmem').disabled()
1289 include_directories : includes,
1290 link_with : [lib_common,
1292 install_dir : usrbin_exec_dir,
1294 build_by_default : opt)
1295 if opt and not is_disabler(exe)
1297 manadocs += ['sys-utils/lsmem.1.adoc']
1298 bashcompletions += ['lsmem']
1301 opt = not get_option('build-chmem').disabled()
1305 include_directories : includes,
1306 link_with : [lib_common],
1307 install_dir : usrbin_exec_dir,
1309 build_by_default : opt)
1310 if opt and not is_disabler(exe)
1312 manadocs += ['sys-utils/chmem.8.adoc']
1313 bashcompletions += ['chmem']
1319 include_directories : includes,
1320 link_with : [lib_common],
1321 install_dir : usrbin_exec_dir,
1324 manadocs += ['sys-utils/choom.1.adoc']
1329 include_directories : includes,
1330 link_with : [lib_common],
1331 install_dir : usrbin_exec_dir,
1334 manadocs += ['sys-utils/ipcmk.1.adoc']
1335 bashcompletions += ['ipcmk']
1340 include_directories : includes,
1341 link_with : [lib_common],
1342 install_dir : usrbin_exec_dir,
1345 manadocs += ['sys-utils/ipcrm.1.adoc']
1346 bashcompletions += ['ipcrm']
1348 opt = not get_option('build-ipcs').disabled()
1352 include_directories : includes,
1353 link_with : [lib_common],
1354 install_dir : usrbin_exec_dir,
1356 build_by_default : opt)
1357 if opt and not is_disabler(exe)
1359 manadocs += ['sys-utils/ipcs.1.adoc']
1360 bashcompletions += ['ipcs']
1363 opt = not get_option('build-rfkill').disabled()
1367 include_directories : includes,
1368 link_with : [lib_common,
1370 install_dir : usrsbin_exec_dir,
1372 build_by_default : opt)
1373 if opt and not is_disabler(exe)
1375 manadocs += ['sys-utils/rfkill.8.adoc']
1376 bashcompletions += ['rfkill']
1382 include_directories : includes,
1383 link_with : [lib_common,
1385 install_dir : usrbin_exec_dir,
1387 if not is_disabler(exe)
1389 manadocs += ['sys-utils/renice.1.adoc']
1390 bashcompletions += ['renice']
1396 include_directories: includes,
1397 link_with : [lib_common,
1399 install_dir : usrbin_exec_dir,
1401 if opt and not is_disabler(exe)
1403 manadocs += ['sys-utils/setpgid.1.adoc']
1404 bashcompletions += ['setpgid']
1410 include_directories : includes,
1411 link_with : [lib_common,
1413 install_dir : usrbin_exec_dir,
1415 if opt and not is_disabler(exe)
1417 manadocs += ['sys-utils/setsid.1.adoc']
1418 bashcompletions += ['setsid']
1423 readprofile_sources,
1424 include_directories : includes,
1425 link_with : [lib_common,
1427 install_dir : usrsbin_exec_dir,
1429 if not is_disabler(exe)
1431 manadocs += ['sys-utils/readprofile.8.adoc']
1432 bashcompletions += ['readprofile']
1435 opt = not get_option('build-tunelp').disabled()
1439 include_directories : includes,
1440 link_with : [lib_common],
1441 install_dir : usrsbin_exec_dir,
1443 build_by_default : opt)
1444 if opt and not is_disabler(exe)
1446 manadocs += ['sys-utils/tunelp.8.adoc']
1447 bashcompletions += ['tunelp']
1453 include_directories : includes,
1454 link_with : [lib_common,
1456 install_dir : sbindir,
1458 if not is_disabler(exe)
1460 manadocs += ['sys-utils/fstrim.8.adoc']
1461 bashcompletions += ['fstrim']
1467 include_directories : includes,
1468 link_with : [lib_common,
1471 if not is_disabler(exe)
1473 manadocs += ['sys-utils/dmesg.1.adoc']
1474 bashcompletions += ['dmesg']
1480 include_directories : dir_include,
1481 c_args : '-DTEST_DMESG',
1482 link_with : [lib_common,
1484 build_by_default : program_tests)
1485 if not is_disabler(exe)
1492 include_directories : includes,
1493 link_with : [lib_common],
1494 install_dir : sbindir,
1497 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1498 bashcompletions += ['ctrlaltdel']
1503 include_directories : includes,
1504 install_dir : sbindir,
1507 manadocs += ['sys-utils/fsfreeze.8.adoc']
1508 bashcompletions += ['fsfreeze']
1513 include_directories : includes,
1514 link_with : [lib_common,
1516 install_dir : sbindir,
1519 manadocs += ['sys-utils/blkdiscard.8.adoc']
1520 bashcompletions += ['blkdiscard']
1525 include_directories : includes,
1526 link_with : [lib_common],
1527 install_dir : sbindir,
1530 manadocs += ['sys-utils/blkzone.8.adoc']
1531 bashcompletions += ['blkzone']
1536 include_directories : includes,
1537 link_with : [lib_common],
1538 install_dir : sbindir,
1541 manadocs += ['sys-utils/blkpr.8.adoc']
1546 include_directories : includes,
1547 link_with : [lib_common],
1548 install_dir : usrsbin_exec_dir,
1551 manadocs += ['sys-utils/ldattach.8.adoc']
1552 bashcompletions += ['ldattach']
1557 include_directories : includes,
1558 link_with : [lib_common],
1559 install_dir : usrsbin_exec_dir,
1562 manadocs += ['sys-utils/rtcwake.8.adoc']
1563 bashcompletions += ['rtcwake']
1568 include_directories : includes,
1569 link_with : [lib_common],
1570 install_dir : usrbin_exec_dir,
1573 manadocs += ['sys-utils/setarch.8.adoc']
1574 bashcompletions += ['setarch']
1576 setarch_links = ['uname26', 'linux32', 'linux64']
1577 setarch_links_arch = {
1578 's390x' : ['s390', 's390x'],
1580 'x86_64' : ['i386', 'x86_64'],
1581 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1582 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1583 'mips64' : ['mips', 'mips64', 'mips32'],
1584 'ia64' : ['i386', 'ia64'],
1585 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1587 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1589 foreach link: setarch_links
1590 meson.add_install_script(meson_make_symlink,
1592 join_paths(usrbin_exec_dir, link))
1593 manlinks += {link + '.8': 'setarch.8'}
1596 opt = not get_option('build-eject').disabled()
1600 include_directories : includes,
1601 link_with : [lib_common,
1603 install_dir : usrbin_exec_dir,
1605 build_by_default : opt)
1606 if opt and not is_disabler(exe)
1608 manadocs += ['sys-utils/eject.1.adoc']
1609 bashcompletions += ['eject']
1612 opt = not get_option('build-losetup').disabled()
1616 include_directories : includes,
1617 link_with : [lib_common,
1619 install_dir : sbindir,
1621 build_by_default : opt)
1622 if opt and not is_disabler(exe)
1623 manadocs += ['sys-utils/losetup.8.adoc']
1625 bashcompletions += ['losetup']
1628 opt = opt and 'losetup' in static_programs
1632 include_directories : includes,
1633 link_args : ['--static'],
1634 link_with : [lib_common,
1635 lib_smartcols.get_static_lib()],
1636 install_dir : sbindir,
1638 build_by_default : opt)
1639 if opt and not is_disabler(exe)
1643 opt = not get_option('build-zramctl').disabled()
1647 include_directories : includes,
1648 link_with : [lib_common,
1650 install_dir : sbindir,
1652 build_by_default : opt)
1653 if opt and not is_disabler(exe)
1655 manadocs += ['sys-utils/zramctl.8.adoc']
1656 bashcompletions += ['zramctl']
1662 include_directories : includes,
1663 link_with : [lib_common,
1665 install_dir : usrbin_exec_dir,
1667 if not is_disabler(exe)
1669 manadocs += ['sys-utils/prlimit.1.adoc']
1670 bashcompletions += ['prlimit']
1676 include_directories : includes,
1677 link_with : [lib_common,
1680 install_dir : usrbin_exec_dir,
1682 if not is_disabler(exe)
1684 manadocs += ['sys-utils/lsns.8.adoc']
1685 bashcompletions += ['lsns']
1688 opt = not get_option('build-mount').disabled()
1692 include_directories : includes,
1693 link_with : [lib_common,
1696 dependencies : lib_selinux,
1697 install_mode : 'rwsr-xr-x',
1699 build_by_default : opt)
1703 include_directories : includes,
1704 link_with : [lib_common,
1706 install_mode : 'rwsr-xr-x',
1708 build_by_default : opt)
1709 if opt and not is_disabler(exe)
1711 manadocs += ['sys-utils/fstab.5.adoc',
1712 'sys-utils/mount.8.adoc',
1713 'sys-utils/umount.8.adoc']
1714 bashcompletions += ['mount', 'umount']
1717 opt2 = opt and 'mount' in static_programs
1721 include_directories : includes,
1722 link_args : ['--static'],
1723 link_with : [lib_common,
1724 lib_smartcols_static,
1727 build_by_default : opt2)
1728 if opt2 and not is_disabler(exe)
1732 opt2 = opt and 'umount' in static_programs
1736 include_directories : includes,
1737 link_args : ['--static'],
1738 link_with : [lib_common,
1741 build_by_default : opt2)
1742 if opt2 and not is_disabler(exe)
1751 include_directories : includes,
1752 link_with : [lib_common,
1756 install_dir : sbindir,
1758 if not is_disabler(exe)
1760 manadocs += ['sys-utils/swapon.8.adoc']
1761 bashcompletions += ['swapon']
1767 include_directories : includes,
1768 link_with : [lib_common,
1771 install_dir : sbindir,
1773 if not is_disabler(exe)
1775 manlinks += {'swapoff.8': 'swapon.8'}
1776 bashcompletions += ['swapoff']
1782 include_directories : includes,
1783 link_with : [lib_common,
1785 dependencies : [rtas_libs],
1786 install_dir : usrbin_exec_dir,
1788 if not is_disabler(exe)
1790 manadocs += ['sys-utils/lscpu.1.adoc']
1791 bashcompletions += ['lscpu']
1797 include_directories : includes,
1798 link_with : [lib_common],
1799 install_dir : sbindir,
1802 manadocs += ['sys-utils/chcpu.8.adoc']
1803 bashcompletions += ['chcpu']
1808 include_directories : includes,
1809 link_with : [lib_common,
1812 if not is_disabler(exe)
1814 manadocs += ['sys-utils/wdctl.8.adoc']
1815 bashcompletions += ['wdctl']
1818 opt = not get_option('build-mountpoint').disabled()
1822 include_directories : includes,
1823 link_with : [lib_mount],
1825 build_by_default : opt)
1826 if opt and not is_disabler(exe)
1828 manadocs += ['sys-utils/mountpoint.1.adoc']
1829 bashcompletions += ['mountpoint']
1832 opt = not get_option('build-fallocate').disabled()
1836 include_directories : includes,
1837 link_with : [lib_common],
1838 install_dir : usrbin_exec_dir,
1840 build_by_default : opt)
1841 if opt and not is_disabler(exe)
1843 manadocs += ['sys-utils/fallocate.1.adoc']
1844 bashcompletions += ['fallocate']
1847 opt = not get_option('build-pivot_root').disabled()
1851 include_directories : includes,
1852 install_dir : sbindir,
1854 build_by_default : opt)
1855 if opt and not is_disabler(exe)
1857 manadocs += ['sys-utils/pivot_root.8.adoc']
1858 bashcompletions += ['pivot_root']
1861 opt = not get_option('build-switch_root').disabled()
1862 if opt and not have_dirfd and not have_ddfd
1863 error('neither dirfd nor ddfd are available')
1867 switch_root_sources,
1868 include_directories : includes,
1869 install_dir : sbindir,
1871 build_by_default : opt)
1872 if opt and not is_disabler(exe)
1874 manadocs += ['sys-utils/switch_root.8.adoc']
1877 opt = not get_option('build-unshare').disabled()
1881 include_directories : includes,
1882 link_with : [lib_common],
1883 install_dir : usrbin_exec_dir,
1885 build_by_default : opt)
1886 if opt and not is_disabler(exe)
1888 manadocs += ['sys-utils/unshare.1.adoc']
1889 bashcompletions += ['unshare']
1892 opt = opt and 'unshare' in static_programs
1896 include_directories : includes,
1897 link_with : [lib_common],
1898 install_dir : usrbin_exec_dir,
1900 build_by_default : opt)
1901 if opt and not is_disabler(exe)
1905 opt = not get_option('build-nsenter').disabled()
1909 include_directories : includes,
1910 link_with : [lib_common],
1911 dependencies : [lib_selinux],
1912 install_dir : usrbin_exec_dir,
1914 build_by_default : opt)
1915 if opt and not is_disabler(exe)
1917 manadocs += ['sys-utils/nsenter.1.adoc']
1918 bashcompletions += ['nsenter']
1921 opt = opt and 'nsenter' in static_programs
1925 include_directories : includes,
1926 link_with : [lib_common],
1927 dependencies : [lib_selinux],
1928 install_dir : usrbin_exec_dir,
1930 build_by_default : opt)
1931 if opt and not is_disabler(exe)
1935 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1939 include_directories : includes,
1940 link_with : [lib_common],
1941 dependencies : [lib_cap_ng],
1942 install_dir : usrbin_exec_dir,
1944 build_by_default : opt)
1945 if opt and not is_disabler(exe)
1947 manadocs += ['sys-utils/setpriv.1.adoc']
1948 bashcompletions += ['setpriv']
1954 include_directories : includes,
1955 link_with : [lib_common],
1956 dependencies : realtime_libs,
1957 install_dir : usrbin_exec_dir,
1960 manadocs += ['sys-utils/flock.1.adoc']
1961 bashcompletions += ['flock']
1963 opt = not get_option('build-lsirq').disabled()
1967 include_directories : includes,
1968 link_with : [lib_common,
1970 install_dir : usrbin_exec_dir,
1972 build_by_default : opt)
1973 if opt and not is_disabler(exe)
1975 manadocs += ['sys-utils/lsirq.1.adoc']
1976 bashcompletions += ['lsirq']
1979 opt = not get_option('build-irqtop').disabled()
1983 include_directories : includes,
1984 dependencies : [realtime_libs, curses_libs],
1985 link_with : [lib_common,
1988 install_dir : usrbin_exec_dir,
1990 build_by_default : opt)
1991 if opt and not is_disabler(exe)
1993 manadocs += ['sys-utils/irqtop.1.adoc']
1994 bashcompletions += ['irqtop']
1997 opt = not get_option('build-ipcs').disabled()
2001 include_directories : includes,
2002 link_with : [lib_common,
2004 install_dir : usrbin_exec_dir,
2006 build_by_default : opt)
2007 if opt and not is_disabler(exe)
2009 manadocs += ['sys-utils/lsipc.1.adoc']
2010 bashcompletions += ['lsipc']
2017 include_directories : includes,
2018 link_with : [lib_common],
2019 dependencies : [lib_m,
2021 install_dir : sbindir,
2023 build_by_default : opt)
2024 if opt and not is_disabler(exe)
2026 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2027 bashcompletions += ['hwclock']
2033 include_directories : includes,
2034 install_dir : sbindir,
2037 manadocs += ['disk-utils/mkfs.8.adoc']
2038 bashcompletions += ['mkfs']
2040 opt = not get_option('build-bfs').disabled()
2044 include_directories : includes,
2045 link_with : [lib_common],
2046 install_dir : sbindir,
2048 build_by_default : opt)
2049 if opt and not is_disabler(exe)
2051 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2052 bashcompletions += ['mkfs.bfs']
2058 include_directories : includes,
2059 link_with : [lib_common],
2060 install_dir : usrbin_exec_dir,
2063 manadocs += ['disk-utils/isosize.8.adoc']
2064 bashcompletions += ['isosize']
2069 include_directories : includes,
2070 link_with : [lib_common,
2073 dependencies: [lib_selinux],
2074 install_dir : sbindir,
2076 if opt and not is_disabler(exe)
2078 manadocs += ['disk-utils/mkswap.8.adoc']
2079 bashcompletions += ['mkswap']
2085 include_directories : includes,
2086 link_with : [lib_common,
2089 install_dir : sbindir,
2091 if opt and not is_disabler(exe)
2093 manadocs += ['disk-utils/swaplabel.8.adoc']
2094 bashcompletions += ['swaplabel']
2097 opt = not get_option('build-fsck').disabled()
2101 include_directories : includes,
2102 link_with : [lib_common,
2105 dependencies : realtime_libs,
2106 install_dir : sbindir,
2108 build_by_default : opt)
2109 if opt and not is_disabler(exe)
2111 manadocs += ['disk-utils/fsck.8.adoc']
2112 bashcompletions += ['fsck']
2115 opt = not get_option('build-minix').disabled()
2119 include_directories : includes,
2120 link_with : [lib_common],
2121 install_dir : sbindir,
2123 build_by_default : opt)
2127 include_directories : includes,
2128 c_args : '-DTEST_SCRIPT',
2129 link_with : [lib_common],
2130 build_by_default : opt and program_tests)
2134 include_directories : includes,
2135 link_with : [lib_common],
2136 install_dir : sbindir,
2138 build_by_default : opt)
2139 if opt and not is_disabler(exe)
2140 exes += [exe, exe2, exe3]
2141 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2142 bashcompletions += ['mkfs.minix', 'fsck.minix']
2145 opt = not get_option('build-cramfs').disabled()
2148 mkfs_cramfs_sources,
2149 include_directories : includes,
2150 link_with : [lib_common],
2151 dependencies : [lib_z],
2152 install_dir : sbindir,
2154 build_by_default : opt)
2157 fsck_cramfs_sources,
2158 include_directories : includes,
2159 link_with : [lib_common],
2160 dependencies : [lib_z],
2161 install_dir : sbindir,
2163 build_by_default : opt)
2164 if not is_disabler(exe)
2166 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2167 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2170 opt = not get_option('build-raw').disabled()
2172 cc.has_header('linux/raw.h', required: opt)
2177 include_directories : includes,
2178 install_dir : sbindir,
2180 build_by_default : opt)
2181 if opt and not is_disabler(exe)
2183 manadocs += ['disk-utils/raw.8.adoc']
2184 bashcompletions += ['raw']
2187 opt = not get_option('build-fdformat').disabled()
2191 include_directories : includes,
2192 link_with : [lib_common],
2193 install_dir : usrsbin_exec_dir,
2195 build_by_default : opt)
2196 if opt and not is_disabler(exe)
2198 manadocs += ['disk-utils/fdformat.8.adoc']
2204 include_directories : includes,
2205 link_with : [lib_common],
2206 install_dir : sbindir,
2208 manadocs += ['disk-utils/blockdev.8.adoc']
2209 bashcompletions += ['blockdev']
2211 opt = not get_option('build-fdisks').disabled()
2212 if opt and not have_dirfd and not have_ddfd
2213 error('neither dirfd nor ddfd are available')
2218 include_directories : includes,
2219 link_with : [lib_common,
2223 dependencies : [lib_readline],
2224 install_dir : sbindir,
2226 build_by_default : opt)
2227 if opt and not is_disabler(exe)
2229 bashcompletions += ['fdisk']
2232 opt2 = opt and 'fdisk' in static_programs
2236 link_args : ['--static'],
2237 include_directories : includes,
2238 link_with : [lib_common,
2241 lib_smartcols.get_static_lib()],
2242 dependencies : [lib_readline_static],
2243 install_dir : sbindir,
2245 build_by_default : opt2)
2246 if opt2 and not is_disabler(exe)
2253 include_directories : includes,
2254 link_with : [lib_common,
2258 dependencies : [lib_readline],
2259 install_dir : sbindir,
2261 build_by_default : opt)
2262 if opt and not is_disabler(exe)
2264 bashcompletions += ['sfdisk']
2267 opt2 = opt and 'sfdisk' in static_programs
2271 include_directories : includes,
2272 link_with : [lib_common,
2275 lib_smartcols.get_static_lib()],
2276 dependencies : [lib_readline_static],
2277 install_dir : sbindir,
2279 build_by_default : opt2)
2280 if opt2 and not is_disabler(exe)
2287 include_directories : includes,
2288 link_with : [lib_common,
2293 dependencies : [curses_libs],
2294 install_dir : sbindir,
2296 build_by_default : opt)
2297 if opt and not is_disabler(exe)
2299 manadocs += ['disk-utils/fdisk.8.adoc',
2300 'disk-utils/sfdisk.8.adoc',
2301 'disk-utils/cfdisk.8.adoc']
2302 bashcompletions += ['cfdisk']
2305 opt = not get_option('build-partx').disabled()
2309 include_directories : includes,
2310 link_with : [lib_common],
2311 install_dir : usrsbin_exec_dir,
2313 build_by_default : opt)
2317 include_directories : includes,
2318 link_with : [lib_common],
2319 install_dir : usrsbin_exec_dir,
2321 build_by_default : opt)
2325 include_directories : includes,
2326 link_with : [lib_common],
2327 install_dir : usrsbin_exec_dir,
2329 build_by_default : opt)
2333 include_directories : includes,
2334 link_with : [lib_common,
2337 install_dir : usrsbin_exec_dir,
2339 build_by_default : opt)
2341 exes += [exe, exe2, exe3, exe4]
2342 manadocs += ['disk-utils/addpart.8.adoc',
2343 'disk-utils/delpart.8.adoc',
2344 'disk-utils/resizepart.8.adoc',
2345 'disk-utils/partx.8.adoc']
2346 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2349 ############################################################
2354 include_directories : includes,
2355 link_with : [lib_common],
2356 dependencies : [lib_util,
2360 install_dir : usrbin_exec_dir,
2363 manadocs += ['term-utils/script.1.adoc']
2364 bashcompletions += ['script']
2369 include_directories : includes,
2370 c_args : '-DTEST_SCRIPT',
2371 link_with : [lib_common],
2372 dependencies : [lib_util,
2376 build_by_default : program_tests)
2382 include_directories : includes,
2383 link_with : [lib_common],
2384 dependencies : [lib_util,
2387 install_dir : usrbin_exec_dir,
2390 manadocs += ['term-utils/scriptlive.1.adoc']
2391 bashcompletions += ['scriptlive']
2395 scriptreplay_sources,
2396 include_directories : includes,
2397 link_with : [lib_common],
2398 dependencies : [math_libs],
2399 install_dir : usrbin_exec_dir,
2402 manadocs += ['term-utils/scriptreplay.1.adoc']
2403 bashcompletions += ['scriptreplay']
2405 opt = not get_option('build-agetty').disabled()
2409 include_directories : includes,
2410 link_with : [lib_common, logindefs_c],
2411 dependencies : [BSD ? lib_util : [], lib_systemd],
2412 install_dir : sbindir,
2414 build_by_default : opt)
2417 manadocs += ['term-utils/agetty.8.adoc']
2420 opt = not get_option('build-setterm').disabled()
2424 include_directories : includes,
2425 link_with : [lib_common],
2426 dependencies : [curses_libs],
2427 install_dir : usrbin_exec_dir,
2429 build_by_default : opt)
2432 manadocs += ['term-utils/setterm.1.adoc']
2433 bashcompletions += ['setterm']
2436 opt = not get_option('build-mesg').disabled()
2440 include_directories : includes,
2441 link_with : [lib_common],
2442 install_dir : usrbin_exec_dir,
2444 build_by_default : opt)
2447 manadocs += ['term-utils/mesg.1.adoc']
2448 bashcompletions += ['mesg']
2451 opt = not get_option('build-wall').disabled()
2455 include_directories : includes,
2456 link_with : [lib_common],
2457 dependencies : [lib_systemd],
2458 install_dir : usrbin_exec_dir,
2459 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2461 build_by_default : opt)
2464 manadocs += ['term-utils/wall.1.adoc']
2465 bashcompletions += ['wall']
2468 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2469 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2471 opt = not get_option('build-write').disabled()
2475 include_directories : includes,
2476 link_with : [lib_common],
2477 dependencies : [lib_systemd],
2478 install_dir : usrbin_exec_dir,
2479 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2481 build_by_default : opt)
2484 manadocs += ['term-utils/write.1.adoc']
2485 bashcompletions += ['write']
2488 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2489 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2491 opt = not get_option('build-login').disabled()
2495 include_directories : includes,
2496 link_with : [lib_common, logindefs_c],
2497 dependencies : [lib_pam,
2501 build_by_default : opt)
2502 if not is_disabler(exe)
2504 manadocs += ['login-utils/login.1.adoc']
2507 opt = not get_option('build-sulogin').disabled()
2511 include_directories : includes,
2512 link_with : [lib_common],
2513 dependencies : [lib_crypt,
2515 install_dir : sbindir,
2517 build_by_default : opt)
2518 if not is_disabler(exe)
2520 manadocs += ['login-utils/sulogin.8.adoc']
2526 include_directories : includes,
2527 link_with : [lib_common,
2529 dependencies : [curses_libs],
2530 install_dir : usrbin_exec_dir,
2533 manadocs += ['misc-utils/cal.1.adoc']
2534 bashcompletions += ['cal']
2536 opt = not get_option('build-logger').disabled()
2540 include_directories : includes,
2541 link_with : [lib_common],
2542 dependencies : [lib_systemd],
2543 install_dir : usrbin_exec_dir,
2545 build_by_default : opt)
2546 if opt and not is_disabler(exe)
2548 manadocs += ['misc-utils/logger.1.adoc']
2549 bashcompletions += ['logger']
2555 include_directories : includes,
2556 c_args : '-DTEST_LOGGER',
2557 link_with : [lib_common],
2558 dependencies : [lib_systemd],
2559 build_by_default: program_tests)
2560 if not is_disabler(exe)
2567 include_directories : includes,
2568 install_dir : usrbin_exec_dir,
2571 manadocs += ['misc-utils/look.1.adoc']
2572 bashcompletions += ['look']
2577 include_directories : includes,
2578 link_with : [lib_common],
2579 install_dir : usrbin_exec_dir,
2582 manadocs += ['misc-utils/mcookie.1.adoc']
2583 bashcompletions += ['mcookie']
2588 include_directories : includes,
2589 dependencies : [lib_selinux],
2590 install_dir : usrbin_exec_dir,
2593 manadocs += ['misc-utils/namei.1.adoc']
2594 bashcompletions += ['namei']
2599 include_directories : includes,
2600 link_with : [lib_common],
2601 install_dir : usrbin_exec_dir,
2604 manadocs += ['misc-utils/whereis.1.adoc']
2605 bashcompletions += ['whereis']
2610 include_directories : includes,
2611 link_with : [lib_common,
2614 install_dir : usrbin_exec_dir,
2616 if not is_disabler(exe)
2618 manadocs += ['misc-utils/lslocks.8.adoc']
2619 bashcompletions += ['lslocks']
2625 include_directories : includes,
2626 link_with : [lib_common,
2631 dependencies : lib_udev,
2633 if not is_disabler(exe)
2635 manadocs += ['misc-utils/lsblk.8.adoc']
2636 bashcompletions += ['lsblk']
2640 mq_libs += cc.find_library('rt', required : true)
2645 include_directories : includes,
2646 link_with : [lib_common,
2648 dependencies : mq_libs,
2649 install_dir : usrbin_exec_dir,
2651 if not is_disabler(exe)
2653 manadocs += ['misc-utils/lsfd.1.adoc']
2659 include_directories : includes,
2660 link_with : [lib_common,
2662 install_dir : usrbin_exec_dir,
2664 if not is_disabler(exe)
2666 manadocs += ['misc-utils/uuidgen.1.adoc']
2667 bashcompletions += ['uuidgen']
2673 include_directories : includes,
2674 link_with : [lib_common,
2677 install_dir : usrbin_exec_dir,
2679 if not is_disabler(exe)
2681 manadocs += ['misc-utils/uuidparse.1.adoc']
2682 bashcompletions += ['uuidparse']
2689 include_directories : includes,
2690 link_with : [lib_common,
2692 dependencies : [realtime_libs,
2694 install_dir : usrsbin_exec_dir,
2696 build_by_default : opt)
2700 include_directories : includes,
2701 link_with : [lib_common,
2703 dependencies : thread_libs,
2704 build_by_default : opt and program_tests)
2705 if not is_disabler(exe)
2707 manadocs += ['misc-utils/uuidd.8.adoc']
2708 bashcompletions += ['uuidd']
2711 opt = build_libblkid
2715 include_directories : includes,
2716 link_with : [lib_common,
2718 install_dir : sbindir,
2720 build_by_default : opt)
2721 if opt and not is_disabler(exe)
2723 manadocs += ['misc-utils/blkid.8.adoc']
2724 bashcompletions += ['blkid']
2727 opt = opt and 'blkid' in static_programs
2731 include_directories : includes,
2732 link_with : [lib_common,
2734 install_dir : sbindir,
2736 build_by_default : opt)
2737 if opt and not is_disabler(exe)
2743 'libblkid/samples/mkfs.c',
2744 include_directories : includes,
2745 link_with : lib_blkid)
2746 if not is_disabler(exe)
2751 'sample-partitions',
2752 'libblkid/samples/partitions.c',
2753 include_directories : includes,
2754 link_with : lib_blkid)
2755 if not is_disabler(exe)
2760 'sample-superblocks',
2761 'libblkid/samples/superblocks.c',
2762 include_directories : includes,
2763 link_with : lib_blkid)
2764 if not is_disabler(exe)
2770 'libblkid/samples/topology.c',
2771 include_directories : includes,
2772 link_with : lib_blkid)
2773 if not is_disabler(exe)
2778 'test_blkid_fuzz_sample',
2779 'libblkid/src/fuzz.c',
2780 include_directories: includes,
2781 link_with: lib_blkid,
2782 build_by_default: program_tests)
2783 if not is_disabler(exe)
2787 ############################################################
2792 include_directories : includes,
2793 link_with : [lib_blkid],
2794 install_dir : sbindir,
2796 if not is_disabler(exe)
2798 manadocs += ['misc-utils/findfs.8.adoc']
2799 bashcompletions += ['findfs']
2805 include_directories : includes,
2806 link_with : [lib_common,
2809 install_dir : sbindir,
2811 if not is_disabler(exe)
2813 manadocs += ['misc-utils/wipefs.8.adoc']
2814 bashcompletions += ['wipefs']
2820 include_directories : includes,
2821 link_with : [lib_common,
2825 dependencies : [lib_udev],
2827 if not is_disabler(exe)
2829 manadocs += ['misc-utils/findmnt.8.adoc']
2830 bashcompletions += ['findmnt']
2836 include_directories : includes,
2837 link_with : [lib_common],
2839 if not is_disabler(exe)
2841 manadocs += ['misc-utils/kill.1.adoc']
2844 opt = not get_option('build-rename').disabled()
2848 include_directories : includes,
2849 install_dir : usrbin_exec_dir,
2851 build_by_default : opt)
2852 if opt and not is_disabler(exe)
2854 manadocs += ['misc-utils/rename.1.adoc']
2855 bashcompletions += ['rename']
2861 include_directories : includes,
2862 link_with : [lib_common],
2863 install_dir : usrbin_exec_dir,
2866 manadocs += ['misc-utils/getopt.1.adoc']
2867 bashcompletions += ['getopt']
2872 include_directories : includes,
2873 link_with : [lib_common,
2875 install_dir : usrbin_exec_dir,
2877 if not is_disabler(exe)
2879 manadocs += ['misc-utils/fincore.1.adoc']
2880 bashcompletions += ['fincore']
2886 include_directories : includes,
2887 link_with : [lib_common],
2888 install_dir : usrbin_exec_dir,
2890 if not is_disabler(exe)
2892 manadocs += ['misc-utils/hardlink.1.adoc']
2893 bashcompletions += ['hardlink']
2896 opt = not get_option('build-pipesz').disabled()
2900 include_directories : includes,
2901 link_with : [lib_common],
2902 install_dir : usrbin_exec_dir,
2904 if opt and not is_disabler(exe)
2906 manadocs += ['misc-utils/pipesz.1.adoc']
2907 bashcompletions += ['pipesz']
2913 include_directories : includes,
2914 c_args : '-DTEST_CAL',
2915 link_with : [lib_common,
2917 dependencies : [curses_libs],
2918 build_by_default: program_tests)
2919 if not is_disabler(exe)
2926 include_directories : includes,
2927 link_with : [lib_common],
2928 install_dir : usrbin_exec_dir,
2930 if not is_disabler(exe)
2932 manadocs += ['misc-utils/fadvise.1.adoc']
2933 bashcompletions += ['fadvise']
2936 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
2940 include_directories : includes,
2941 link_with : [lib_common],
2942 install_dir : usrbin_exec_dir,
2944 if not is_disabler(exe)
2946 manadocs += ['misc-utils/waitpid.1.adoc']
2947 bashcompletions += ['waitpid']
2951 syscalls_h = custom_target('syscalls.h',
2952 input : 'tools/all_syscalls',
2953 output : 'syscalls.h',
2954 command : ['tools/all_syscalls', cc.cmd_array()]
2957 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
2960 'misc-utils/enosys.c', syscalls_h,
2961 include_directories : includes,
2962 link_with : [lib_common],
2963 install_dir : usrbin_exec_dir,
2965 if not is_disabler(exe)
2967 manadocs += ['misc-utils/enosys.1.adoc']
2968 bashcompletions += ['enosys']
2975 include_directories : includes,
2976 link_with : [lib_common, lib_smartcols],
2977 install_dir : usrbin_exec_dir,
2979 if not is_disabler(exe)
2981 manadocs += ['misc-utils/lsclocks.1.adoc']
2982 bashcompletions += ['lsclocks']
2985 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
2989 include_directories : includes,
2990 link_with : [lib_common],
2991 install_dir : usrbin_exec_dir,
2993 if not is_disabler(exe)
2995 manadocs += ['misc-utils/exch.1.adoc']
2996 bashcompletions += ['exch']
3000 ############################################################
3002 opt = not get_option('build-schedutils').disabled()
3005 'schedutils/chrt.c',
3006 include_directories : includes,
3007 link_with : lib_common,
3008 install_dir : usrbin_exec_dir,
3010 build_by_default : opt)
3014 'schedutils/ionice.c',
3015 include_directories : includes,
3016 link_with : lib_common,
3017 install_dir : usrbin_exec_dir,
3019 build_by_default : opt)
3023 'schedutils/taskset.c',
3024 include_directories : includes,
3025 link_with : lib_common,
3026 install_dir : usrbin_exec_dir,
3028 build_by_default : opt)
3032 'schedutils/uclampset.c',
3033 include_directories : includes,
3034 link_with : lib_common,
3035 install_dir : usrbin_exec_dir,
3037 build_by_default : opt)
3039 if opt and not is_disabler(exe)
3040 exes += [exe, exe2, exe3, exe4]
3041 manadocs += ['schedutils/chrt.1.adoc',
3042 'schedutils/ionice.1.adoc',
3043 'schedutils/taskset.1.adoc',
3044 'schedutils/uclampset.1.adoc']
3045 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3048 ############################################################
3050 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3055 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3056 include_directories : dir_include,
3057 link_with : lib_common,
3058 build_by_default: program_tests)
3064 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3065 include_directories : dir_include,
3066 link_with : lib_common,
3067 build_by_default: program_tests)
3073 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3074 include_directories : dir_include,
3075 link_with : lib_common,
3076 build_by_default: program_tests)
3082 c_args : ['-DTEST_PROGRAM_MANGLE'],
3083 include_directories : dir_include,
3084 build_by_default: program_tests)
3090 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3091 include_directories : dir_include,
3092 build_by_default: program_tests)
3098 'lib/color-names.c',
3099 c_args : ['-DTEST_PROGRAM_COLORS'],
3100 include_directories : dir_include,
3101 link_with : [lib_common, lib_tcolors],
3102 build_by_default: program_tests)
3108 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3109 include_directories : dir_include,
3110 build_by_default: program_tests)
3113 if conf.get('HAVE_OPENAT').to_string() == '1' \
3114 and conf.get('HAVE_DIRFD').to_string() == '1'
3118 c_args : ['-DTEST_PROGRAM_PROCFS'],
3119 include_directories : dir_include,
3120 link_with : lib_common,
3121 build_by_default: program_tests)
3128 have_cpu_set_t ? 'lib/cpuset.c' : [],
3129 c_args : ['-DTEST_PROGRAM_PATH'],
3130 include_directories : dir_include,
3131 link_with : lib_common,
3132 build_by_default: program_tests)
3136 if conf.get('HAVE_PTY').to_string() == '1'
3141 c_args : ['-DTEST_PROGRAM_PTY'],
3142 include_directories : dir_include,
3143 link_with : [lib_common],
3144 dependencies : [lib_m,
3147 build_by_default: program_tests)
3155 c_args : ['-DTEST_PROGRAM_CPUSET'],
3156 include_directories : dir_include,
3157 build_by_default: program_tests)
3168 have_cpu_set_t ? 'lib/cpuset.c' : [],
3169 c_args : ['-DTEST_PROGRAM_SYSFS'],
3170 include_directories : dir_include,
3171 build_by_default: program_tests)
3177 c_args : ['-DTEST_PROGRAM_PAGER'],
3178 include_directories : dir_include,
3179 build_by_default: program_tests)
3183 'test_linux_version',
3184 'lib/linux_version.c',
3185 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3186 include_directories : dir_include,
3187 build_by_default: program_tests)
3193 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3194 include_directories : dir_include,
3195 build_by_default: program_tests)
3199 'test_canonicalize',
3200 'lib/canonicalize.c',
3201 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3202 include_directories : dir_include,
3203 build_by_default: program_tests)
3210 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3211 include_directories : dir_include,
3212 build_by_default: program_tests)
3218 c_args : ['-DTEST_PROGRAM'],
3219 include_directories : dir_include,
3220 link_with : lib_common,
3221 build_by_default: program_tests)
3227 c_args : ['-DTEST_PROGRAM'],
3228 include_directories : dir_include,
3229 link_with : [lib_common, logindefs_c],
3230 build_by_default: program_tests)
3234 ############################################################
3238 'libuuid/src/test_uuid.c',
3239 include_directories : [dir_include, dir_libuuid],
3240 link_with : lib_uuid,
3241 dependencies : socket_libs,
3242 build_by_default: program_tests)
3243 if not is_disabler(exe)
3247 ############################################################
3249 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3250 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3254 'libfdisk/src/ask.c',
3255 c_args : libfdisk_tests_cflags,
3256 include_directories : lib_fdisk_includes,
3257 link_with : libfdisk_tests_ldadd,
3258 build_by_default: program_tests)
3259 if not is_disabler(exe)
3265 'libfdisk/src/gpt.c',
3266 c_args : libfdisk_tests_cflags,
3267 include_directories : lib_fdisk_includes,
3268 link_with : libfdisk_tests_ldadd,
3269 build_by_default: program_tests)
3270 if not is_disabler(exe)
3276 'libfdisk/src/utils.c',
3277 c_args : libfdisk_tests_cflags,
3278 include_directories : lib_fdisk_includes,
3279 link_with : libfdisk_tests_ldadd,
3280 build_by_default: program_tests)
3281 if not is_disabler(exe)
3286 'test_fdisk_script',
3287 'libfdisk/src/script.c',
3288 c_args : libfdisk_tests_cflags,
3289 include_directories : lib_fdisk_includes,
3290 link_with : libfdisk_tests_ldadd,
3291 build_by_default: program_tests)
3292 if not is_disabler(exe)
3297 'test_fdisk_version',
3298 'libfdisk/src/version.c',
3299 c_args : libfdisk_tests_cflags,
3300 include_directories : lib_fdisk_includes,
3301 link_with : libfdisk_tests_ldadd,
3302 build_by_default: program_tests)
3303 if not is_disabler(exe)
3309 'libfdisk/src/item.c',
3310 c_args : libfdisk_tests_cflags,
3311 include_directories : lib_fdisk_includes,
3312 link_with : libfdisk_tests_ldadd,
3313 build_by_default: program_tests)
3314 if not is_disabler(exe)
3318 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3321 'sample-fdisk-mkpart',
3322 'libfdisk/samples/mkpart.c',
3323 include_directories : lib_fdisk_includes,
3324 link_with : sample_fdisk_ldadd)
3325 if not is_disabler(exe)
3330 'sample-fdisk-mkpart-fullspec',
3331 'libfdisk/samples/mkpart-fullspec.c',
3332 include_directories : lib_fdisk_includes,
3333 link_with : sample_fdisk_ldadd)
3334 if not is_disabler(exe)
3338 ############################################################
3342 'tests/helpers/test_cap.c',
3343 include_directories : includes,
3344 dependencies : [lib_cap_ng],
3345 build_by_default: program_tests)
3346 if not is_disabler(exe)
3352 'tests/helpers/test_mbsencode.c',
3353 include_directories : includes,
3354 link_with : lib_common,
3355 build_by_default: program_tests)
3360 'tests/helpers/test_byteswap.c',
3361 include_directories : includes,
3362 build_by_default: program_tests)
3367 'tests/helpers/test_md5.c',
3369 include_directories : includes,
3370 build_by_default: program_tests)
3375 'tests/helpers/test_sha1.c',
3377 include_directories : includes,
3378 build_by_default: program_tests)
3383 'tests/helpers/test_pathnames.c',
3384 include_directories : includes,
3385 build_by_default: program_tests)
3390 'tests/helpers/test_strerror.c',
3391 include_directories : includes,
3392 build_by_default: program_tests)
3397 'tests/helpers/test_sysinfo.c',
3398 include_directories : includes,
3399 build_by_default: program_tests)
3404 'tests/helpers/test_sigreceive.c',
3405 include_directories : includes,
3406 link_with : lib_common,
3407 build_by_default: program_tests)
3412 'tests/helpers/test_tiocsti.c',
3413 include_directories : includes,
3414 build_by_default: program_tests)
3418 'test_uuid_namespace',
3419 'tests/helpers/test_uuid_namespace.c',
3423 include_directories : includes,
3424 build_by_default: program_tests)
3430 'tests/helpers/test_mkfds.c',
3431 'tests/helpers/test_mkfds.h',
3432 'tests/helpers/test_mkfds_ppoll.c',
3433 include_directories : includes,
3434 dependencies : mq_libs,
3435 build_by_default: program_tests)
3441 'tests/helpers/test_enosys.c',
3442 include_directories : includes,
3443 build_by_default: program_tests)
3446 ############################################################
3448 if conf.get('HAVE_OPENAT').to_string() == '1'
3450 'sample-scols-tree',
3451 'libsmartcols/samples/tree.c',
3452 include_directories : includes,
3453 link_with : [lib_smartcols, lib_common],
3454 build_by_default: program_tests)
3455 if not is_disabler(exe)
3461 'sample-scols-title',
3462 'libsmartcols/samples/title.c',
3463 include_directories : includes,
3464 link_with : [lib_smartcols, lib_common])
3465 if not is_disabler(exe)
3470 'sample-scols-wrap',
3471 'libsmartcols/samples/wrap.c',
3472 include_directories : includes,
3473 link_with : [lib_smartcols, lib_common])
3474 if not is_disabler(exe)
3479 'sample-scols-continuous',
3480 'libsmartcols/samples/continuous.c',
3481 include_directories : includes,
3482 link_with : [lib_smartcols, lib_common])
3483 if not is_disabler(exe)
3488 'sample-scols-continuous-json',
3489 'libsmartcols/samples/continuous-json.c',
3490 include_directories : includes,
3491 link_with : [lib_smartcols, lib_common])
3492 if not is_disabler(exe)
3497 'sample-scols-maxout',
3498 'libsmartcols/samples/maxout.c',
3499 include_directories : includes,
3500 link_with : [lib_smartcols, lib_common])
3501 if not is_disabler(exe)
3506 'sample-scols-fromfile',
3507 'libsmartcols/samples/fromfile.c',
3508 include_directories : includes,
3509 link_with : [lib_smartcols, lib_common])
3510 if not is_disabler(exe)
3515 'sample-scols-grouping-simple',
3516 'libsmartcols/samples/grouping-simple.c',
3517 include_directories : includes,
3518 link_with : [lib_smartcols, lib_common])
3519 if not is_disabler(exe)
3524 'sample-scols-grouping-overlay',
3525 'libsmartcols/samples/grouping-overlay.c',
3526 include_directories : includes,
3527 link_with : [lib_smartcols, lib_common])
3528 if not is_disabler(exe)
3532 ############################################################
3534 # Let the test runner know whether we're running under asan and export
3535 # some paths. We use a file on disk so that it is possible to run the
3536 # test scripts from commandline without setting any variables.
3537 configure_file(output : 'meson.conf',
3542 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3543 python.full_path())])
3545 run_sh = find_program('tests/run.sh')
3549 '--srcdir=' + meson.current_source_dir(),
3550 '--builddir=' + meson.current_build_dir(),
3556 manadocs += ['lib/terminal-colors.d.5.adoc']
3557 manadocs += ['libblkid/libblkid.3.adoc']
3561 'libuuid/man/uuid.3.adoc',
3562 'libuuid/man/uuid_clear.3.adoc',
3563 'libuuid/man/uuid_compare.3.adoc',
3564 'libuuid/man/uuid_copy.3.adoc',
3565 'libuuid/man/uuid_generate.3.adoc',
3566 'libuuid/man/uuid_is_null.3.adoc',
3567 'libuuid/man/uuid_parse.3.adoc',
3568 'libuuid/man/uuid_time.3.adoc',
3569 'libuuid/man/uuid_unparse.3.adoc']
3571 'uuid_generate_random.3': 'uuid_generate.3',
3572 'uuid_generate_time.3': 'uuid_generate.3',
3573 'uuid_generate_time_safe.3': 'uuid_generate.3',
3577 asciidoctor = find_program('asciidoctor', required : false)
3578 if asciidoctor.found()
3579 foreach adoc : manadocs
3580 name = adoc.split('/')[-1]
3581 page = name.split('.adoc')[0]
3582 section = page.split('.')[-1]
3583 mandirn = join_paths(mandir, 'man' + section)
3588 command : [ asciidoctor,
3590 '-a', 'VERSION=' + meson.project_version(),
3591 '-a', 'release-version=' + meson.project_version(),
3592 '-a', 'ADJTIME_PATH=/etc/adjtime',
3593 '-a', 'package-docdir=' + docdir,
3594 '--base-dir=' + meson.current_source_dir(),
3595 '--destination-dir=' + meson.current_build_dir(),
3596 '--load-path', '@SOURCE_ROOT@/tools',
3597 '--require', 'asciidoctor-includetracker',
3601 depfile : page + '.deps',
3603 install_dir : mandirn)
3606 foreach link_name, target : manlinks
3607 link_section = link_name.split('.')[-1]
3608 target_section = target.split('.')[-1]
3609 meson.add_install_script(meson_make_manpage_stub,
3610 join_paths('man' + target_section, target),
3611 join_paths(mandir, 'man' + link_section, link_name))
3615 if bash_completion.found()
3616 foreach completion : bashcompletions
3618 join_paths('bash-completion', completion),
3619 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3622 foreach link_name, target : bashcompletionslinks
3623 meson.add_install_script(meson_make_symlink,
3625 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))