1 project('util-linux', 'c',
2 version : run_command('tools/git-version-gen', check: true).stdout(),
3 meson_version: '>=0.60.0',
11 pkgconfig = import('pkgconfig')
13 libblkid_version = '1.1.0'
14 libblkid_date = '01-Jun-2021'
15 libuuid_version = '1.3.0'
16 liblastlog2_version = '2.0.0'
17 libmount_version = '1.1.0'
18 libsmartcols_version = '1.1.0'
19 libfdisk_version = '1.1.0'
21 prefixdir = get_option('prefix')
22 if not prefixdir.startswith('/')
23 error('Prefix is not absolute: "@0@"'.format(prefixdir))
25 bindir = join_paths(prefixdir, get_option('bindir'))
26 sbindir = join_paths(prefixdir, get_option('sbindir'))
27 sysconfstaticdir = join_paths(prefixdir, 'lib')
28 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
29 mandir = join_paths(prefixdir, get_option('mandir'))
31 execprefixdir = prefixdir
32 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
33 usrbin_exec_dir = join_paths(execprefixdir, bindir)
34 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
35 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
37 vendordir = get_option('vendordir')
39 add_project_arguments('-D_GNU_SOURCE', language : 'c')
41 cc = meson.get_compiler('c')
43 conf = configuration_data()
44 conf.set_quoted('PACKAGE', meson.project_name())
45 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
46 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
47 conf.set_quoted('PACKAGE_STRING', package_string)
50 pc_version = meson.project_version().split('-')[0].split('.')
52 if pc_version.length() < 3
56 pc_version = '.'.join(pc_version)
58 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
59 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
61 conf.set('bindir', bindir)
62 conf.set('sbindir', sbindir)
63 conf.set('runstatedir', runstatedir)
64 conf.set('sysconfdir', sysconfdir)
65 conf.set('usrsbin_execdir', usrsbin_exec_dir)
66 conf.set('docdir', docdir)
67 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
68 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
69 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
70 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
72 conf.set_quoted('_PATH_VENDORDIR', vendordir)
73 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
75 build_libblkid = not get_option('build-libblkid').disabled()
76 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
77 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
79 build_libuuid = not get_option('build-libuuid').disabled()
80 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
81 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
83 build_liblastlog2 = not get_option('build-liblastlog2').disabled()
84 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
85 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
87 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
88 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
89 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
91 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
92 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
94 build_libmount = not get_option('build-libmount').disabled()
95 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
96 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
97 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
98 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
100 build_libsmartcols = not get_option('build-libsmartcols').disabled()
101 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
102 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
104 build_libfdisk = not get_option('build-libfdisk').disabled()
105 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
106 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
108 build_uuidd = not get_option('build-uuidd').disabled()
109 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
110 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
112 static_programs = get_option('static-programs')
113 need_static_libs = static_programs.length() > 0 # a rough estimate...
114 summary('static programs', static_programs)
116 LINUX = host_machine.system() in ['linux']
117 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
119 ############################################################
137 have = cc.compiles(code, name : 'wchar_t support')
138 if not have and get_option('widechar').enabled()
139 error('widechar support requested but unavailable')
141 if get_option('ncurses').enabled() and get_option('widechar').enabled()
142 error('widechar support is incompatible with non-wide ncurses')
144 conf.set('HAVE_WIDECHAR', have ? 1 : false)
186 linux/net_namespace.h
232 lib_m = cc.find_library('m')
234 lib_tinfo = dependency(
236 required : get_option('tinfo'))
238 lib_ncursesw = dependency(
240 required : get_option('ncursesw'))
241 if lib_ncursesw.found()
242 headers += ['ncursesw/ncurses.h',
246 lib_ncurses = disabler()
248 lib_ncurses = dependency(
250 required : get_option('ncurses'))
251 headers += ['ncurses.h',
255 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
256 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
257 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
259 lib_slang = dependency(
261 required : get_option('slang'))
263 headers += ['slang.h',
268 conf.set('HAVE_SLANG', lib_slang.found())
270 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
271 if curses_libs.found()
272 have = cc.has_function('use_default_colors', dependencies : curses_libs)
273 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
274 have = cc.has_function('resizeterm', dependencies : curses_libs)
275 conf.set('HAVE_RESIZETERM', have ? 1 : false)
282 required : get_option('zlib'))
284 lib_readline = dependency(
286 required : get_option('readline'))
287 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
289 lib_readline_static = dependency(
292 required : need_static_libs ? get_option('readline') : disabler())
294 if meson.version().version_compare('>= 0.59.0')
295 lib_intl = dependency(
297 required : get_option('nls'))
298 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
300 if get_option('nls').enabled()
301 error('nls is not supported with meson before 0.59.0')
303 lib_intl = dependency('', required : false)
306 lib_user = dependency(
309 required : get_option('libuser'))
310 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
312 lib_util = cc.find_library(
314 required : get_option('libutil'))
315 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
317 lib_utempter = cc.find_library(
319 required : get_option('libutempter'))
320 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
322 systemd = dependency(
324 required : get_option('systemd'))
326 lib_systemd = dependency(
328 required : get_option('systemd'))
329 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
330 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
332 have = cc.has_function(
333 'sd_session_get_username',
334 dependencies : lib_systemd)
335 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
337 lib_udev = dependency(
339 required : get_option('systemd'))
340 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
342 lib_crypt = cc.find_library('crypt')
344 lib_pam = cc.find_library('pam', required : get_option('build-login'))
345 if not lib_pam.found()
346 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
348 if not lib_pam.found()
349 lib_pam = cc.find_library('pam', required : get_option('build-su'))
351 if not lib_pam.found()
352 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
355 lib_pam_misc = cc.find_library('pam_misc')
356 lib_pam = [lib_pam, lib_pam_misc]
358 lib_pam_misc = declare_dependency()
361 lib_cryptsetup = dependency(
363 required : get_option('cryptsetup'))
364 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
366 if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
367 if meson.version().version_compare('>= 0.62.0')
368 lib_dl = dependency('dl')
370 lib_dl = cc.find_library('dl')
372 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
373 summary('cryptsetup support (dlopen)',
375 section : 'components')
377 summary('cryptsetup support',
378 lib_cryptsetup.found() ? 'enabled' : 'disabled',
379 section : 'components')
382 have = cc.has_function(
383 'crypt_activate_by_signed_key',
384 dependencies : lib_cryptsetup)
385 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
387 lib_cap_ng = dependency(
389 required : get_option('build-setpriv'))
390 if not lib_cap_ng.found()
391 lib_cap_ng = disabler()
394 lib_selinux = dependency(
397 required : get_option('selinux'))
398 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
400 lib_magic = dependency(
402 required : get_option('magic'))
403 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
405 lib_econf = dependency(
407 required : get_option('econf'))
408 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
410 lib_audit = dependency(
412 required : get_option('audit'))
413 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
415 conf.set('HAVE_SMACK', not get_option('smack').disabled())
417 foreach header : headers
418 have = cc.has_header(header)
419 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
422 header = 'linux/btrfs.h'
423 enable_btrfs = cc.has_header(header,
424 required : get_option('btrfs'))
425 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
426 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
428 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
433 have = cc.has_header(header,
435 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
438 have = cc.has_header('sched.h')
439 conf.set10('HAVE_DECL_CPU_ALLOC', have)
440 # We get -1 if the size cannot be determined
441 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
442 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
444 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
445 conf.set10('HAVE_ENVIRON_DECL', have)
447 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
448 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
450 have = cc.has_function('strsignal')
451 conf.set10('HAVE_STRSIGNAL_DECL', have)
453 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
454 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
456 have = cc.has_type('loff_t', prefix : '#include <sys/types.h>')
457 conf.set('HAVE_LOFF_T', have ? 1 : false)
459 have = cc.compiles('''
460 #define _GNU_SOURCE 1
461 #include <langinfo.h>
464 str = nl_langinfo (ALTMON_1);
465 str = nl_langinfo (ALTMON_2);
466 str = nl_langinfo (ALTMON_3);
467 str = nl_langinfo (ALTMON_4);
468 str = nl_langinfo (ALTMON_5);
469 str = nl_langinfo (ALTMON_6);
470 str = nl_langinfo (ALTMON_7);
471 str = nl_langinfo (ALTMON_8);
472 str = nl_langinfo (ALTMON_9);
473 str = nl_langinfo (ALTMON_10);
474 str = nl_langinfo (ALTMON_11);
475 str = nl_langinfo (ALTMON_12);
479 name : 'langinfo.h defines ALTMON_x constants')
480 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
482 have = cc.compiles('''
483 #define _GNU_SOURCE 1
484 #include <langinfo.h>
487 str = nl_langinfo (_NL_ABALTMON_1);
488 str = nl_langinfo (_NL_ABALTMON_2);
489 str = nl_langinfo (_NL_ABALTMON_3);
490 str = nl_langinfo (_NL_ABALTMON_4);
491 str = nl_langinfo (_NL_ABALTMON_5);
492 str = nl_langinfo (_NL_ABALTMON_6);
493 str = nl_langinfo (_NL_ABALTMON_7);
494 str = nl_langinfo (_NL_ABALTMON_8);
495 str = nl_langinfo (_NL_ABALTMON_9);
496 str = nl_langinfo (_NL_ABALTMON_10);
497 str = nl_langinfo (_NL_ABALTMON_11);
498 str = nl_langinfo (_NL_ABALTMON_12);
502 name : 'langinfo.h defines _NL_ABALTMON_x constants')
503 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
505 have = cc.compiles('''
506 #define _GNU_SOURCE 1
507 #include <langinfo.h>
510 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
514 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
515 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
548 landlock_create_ruleset
550 landlock_restrict_self
614 have = cc.has_function(func)
615 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
616 # This makes little sense, but is necessary to avoid warnings about
617 # redefined macros from Python.h, which uses this convention.
618 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
621 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
622 conf.set('AGETTY_RELOAD', have ? 1 : false)
624 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
627 have_dirfd = (cc.has_function('dirfd') or
628 cc.has_header_symbol('dirent.h', 'dirfd',
629 prefix : '#include <sys/types.h>'))
630 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
632 have_ddfd = cc.has_member('DIR', 'dd_fd',
634 #include <sys/types.h>
637 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
639 have = cc.has_member('struct tm', 'tm_gmtoff',
644 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
648 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
649 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
651 have = cc.has_member('struct termios', 'c_line',
652 prefix : '#include <termios.h>')
653 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
655 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
656 prefix : '#include <sys/stat.h>')
657 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
659 have = cc.has_member('struct statx', 'stx_mnt_id',
660 prefix : '#include <sys/stat.h>')
661 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
663 # replacement for AC_STRUCT_TIMEZONE
664 have = cc.has_member('struct tm', 'tm_zone',
665 prefix : '#include <time.h>')
666 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
668 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
669 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
671 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
672 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
674 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
675 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
680 extern char *tzname[];
683 return tzname ? 0 : 1;
685 '''.format(have ? 1 : 0)
686 have = cc.compiles(code, name : 'using tzname[]')
687 conf.set('HAVE_TZNAME', have ? 1 : false)
689 have = cc.sizeof('time_t', prefix : '#include <time.h>')
691 add_global_arguments('-D_TIME_BITS=64', language : 'c')
692 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
694 if get_option('allow-32bit-time')
695 warning('Could not make time_t 64bits wide')
697 error('Could not make time_t 64bits wide')
703 if not cc.has_function('socket')
704 socket_libs += cc.find_library('socket', required : true)
705 have = cc.has_function('socket',
706 dependencies : socket_libs)
708 error('socket() function not available')
713 have = cc.has_function('clock_gettime')
715 realtime_libs += cc.find_library('rt', required : true)
716 have = cc.has_function('clock_gettime',
717 dependencies : realtime_libs)
719 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
721 thread_libs = dependency('threads')
723 have = cc.has_function('timer_create')
725 realtime_libs = [cc.find_library('rt', required : true)]
726 have = cc.has_function('timer_create',
727 dependencies : realtime_libs)
729 realtime_libs += thread_libs
730 have = cc.has_function('timer_create',
731 dependencies : realtime_libs)
734 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
736 have = cc.has_function('setitimer')
737 conf.set('HAVE_SETITIMER', have ? 1 : false)
740 rtas_libs = cc.find_library('rtas', required : false)
741 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
744 if not cc.has_header_symbol('math.h', 'isnan')
745 lib = cc.find_library('m', required : true)
746 if (cc.has_function('isnan', dependencies : lib) and
747 cc.has_function('__isnan', dependencies : lib))
752 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
753 args : '-D_GNU_SOURCE')
754 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
757 extern char *__progname;
759 return (*__progname != 0);
762 have = cc.compiles(code, name : 'using __progname')
763 conf.set('HAVE___PROGNAME', have ? 1 : false)
765 have = conf.get('HAVE_PTY_H').to_string() == '1' \
766 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
767 conf.set('HAVE_PTY', have ? 1 : false)
769 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
770 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
772 build_plymouth_support = get_option('build-plymouth-support')
773 have_tiocglcktrmios = cc.has_header_symbol(
774 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
775 required : build_plymouth_support.enabled())
776 have_sock_cloexec = cc.has_header_symbol(
777 'sys/socket.h', 'SOCK_CLOEXEC',
778 prefix : '#include <sys/types.h>',
779 required : build_plymouth_support.enabled())
780 have_sock_nonblock = cc.has_header_symbol(
781 'sys/socket.h', 'SOCK_NONBLOCK',
782 prefix : '#include <sys/types.h>',
783 required : build_plymouth_support.enabled())
784 have_so_passcred = cc.has_header_symbol(
785 'sys/socket.h', 'SO_PASSCRED',
786 args : ['-D_GNU_SOURCE'],
787 prefix : '#include <sys/types.h>',
788 required : build_plymouth_support.enabled())
790 build_plymouth_support = (not build_plymouth_support.disabled() and
791 have_tiocglcktrmios and
792 have_sock_cloexec and
793 have_sock_nonblock and
795 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
796 summary('plymouth support',
797 build_plymouth_support ? 'enabled' : 'disabled',
798 section : 'components')
800 # check for valid fallocate() function
801 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
802 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
803 # and program can't be linked.
811 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
812 return ret == 0 ? 0 : 1;
815 have = cc.links(code, name : 'fallocate() function')
816 conf.set('HAVE_FALLOCATE', have ? 1 : false)
824 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
825 return ret == 0 ? 0 : 1;
828 have = cc.links(code, name : 'posix_fallocate() function')
829 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
831 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
832 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
833 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
835 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
836 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
837 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
839 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
841 ############################################################
844 fs_search_path = get_option('fs-search-path')
845 fs_search_path_extra = get_option('fs-search-path-extra')
846 if fs_search_path_extra != ''
847 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
849 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
851 systemdsystemunitdir = ''
853 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
856 sysvinit = get_option('sysvinit').enabled()
857 sysvinitrcdir = sysconfdir + '/init.d'
859 program_tests = get_option('program-tests')
861 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
862 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
864 have = get_option('chsh-only-listed')
865 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
867 have = get_option('use-tty-group')
868 conf.set('USE_TTY_GROUP', have ? 1 : false)
870 bison = find_program('bison')
871 flex = find_program('flex')
873 build_hwclock = not get_option('build-hwclock').disabled()
874 bison_gen = generator(
876 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
877 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
879 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
880 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
884 configuration : conf)
886 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
891 '-Waddress-of-packed-member',
892 '-Wdiscarded-qualifiers',
893 '-Wembedded-directive',
896 '-Wimplicit-function-declaration',
897 '-Wmissing-declarations',
898 '-Wmissing-parameter-type',
899 '-Wmissing-prototypes',
901 '-Wno-missing-field-initializers',
902 '-Wold-style-definition',
906 '-Wstrict-prototypes',
909 '-Wunused-but-set-parameter',
910 '-Wunused-but-set-variable',
911 '-Wunused-parameter',
917 foreach compiler_flag : compiler_flags
918 if cc.has_argument(compiler_flag)
919 add_project_arguments(compiler_flag, language : 'c')
927 bashcompletionslinks = {}
933 subdir('libsmartcols')
935 subdir('liblastlog2')
937 subdir('pam_lastlog2')
938 subdir('login-utils')
946 includes = [dir_include,
957 opt = not get_option('build-chfn-chsh').disabled()
962 include_directories : includes,
963 link_with : [lib_common, logindefs_c],
964 dependencies : chfn_chsh_deps,
965 install_dir : usrbin_exec_dir,
966 install_mode : 'rwsr-xr-x',
968 build_by_default : opt)
972 'login-utils/chsh.c',
975 include_directories : includes,
976 link_with : lib_common,
977 dependencies : chfn_chsh_deps,
978 install_dir : usrbin_exec_dir,
979 install_mode : 'rwsr-xr-x',
981 build_by_default : opt)
982 if opt and not is_disabler(exe)
984 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
985 bashcompletions += ['chfn', 'chsh']
990 test_islocal_sources,
991 include_directories : includes,
992 c_args : '-DTEST_PROGRAM',
993 build_by_default : program_tests)
998 test_consoles_sources,
999 c_args : ['-DTEST_PROGRAM'],
1000 include_directories : includes,
1001 link_with : lib_common,
1002 build_by_default : program_tests)
1005 opt = not get_option('build-last').disabled()
1009 include_directories : includes,
1010 link_with : [lib_common],
1011 install_dir : usrbin_exec_dir,
1013 build_by_default : opt)
1014 if opt and not is_disabler(exe)
1016 meson.add_install_script(meson_make_symlink,
1018 join_paths(usrbin_exec_dir, 'lastb'))
1019 manadocs += ['login-utils/last.1.adoc']
1020 manlinks += {'lastb.1': 'last.1'}
1021 bashcompletions += ['last']
1022 bashcompletionslinks += {'lastb': 'last'}
1025 opt = not get_option('build-nologin').disabled()
1028 'login-utils/nologin.c',
1029 include_directories : includes,
1030 install_dir : sbindir,
1031 link_with : [lib_common],
1033 build_by_default : opt)
1034 if opt and not is_disabler(exe)
1036 manadocs += ['login-utils/nologin.8.adoc']
1039 opt = not get_option('build-utmpdump').disabled()
1042 'login-utils/utmpdump.c',
1043 include_directories : includes,
1044 link_with : [lib_common],
1045 install_dir : usrbin_exec_dir,
1047 build_by_default : opt)
1048 if opt and not is_disabler(exe)
1050 manadocs += ['login-utils/utmpdump.1.adoc']
1051 bashcompletions += ['utmpdump']
1054 opt = not get_option('build-su').disabled()
1058 'login-utils/su-common.c',
1059 'login-utils/su-common.h',
1063 include_directories : includes,
1064 link_with : [lib_common, logindefs_c],
1065 dependencies : [lib_pam,
1069 install_mode : 'rwsr-xr-x',
1071 build_by_default : opt)
1072 if opt and not is_disabler(exe)
1074 manadocs += ['login-utils/su.1.adoc']
1075 bashcompletions += ['su']
1078 opt = not get_option('build-newgrp').disabled()
1081 'login-utils/newgrp.c',
1082 include_directories : includes,
1083 dependencies : [lib_crypt],
1084 install_dir : usrbin_exec_dir,
1085 install_mode : 'rwsr-xr-x',
1087 build_by_default : opt)
1088 if opt and not is_disabler(exe)
1090 manadocs += ['login-utils/newgrp.1.adoc']
1091 bashcompletions += ['newgrp']
1094 opt = not get_option('build-lslogins').disabled()
1097 'login-utils/lslogins.c',
1098 include_directories : includes,
1099 link_with : [lib_common,
1102 dependencies : [lib_selinux,
1104 install_dir : usrbin_exec_dir,
1106 build_by_default : opt)
1107 if opt and not is_disabler(exe)
1109 manadocs += ['login-utils/lslogins.1.adoc']
1110 bashcompletions += ['lslogins']
1113 opt = not get_option('build-vipw').disabled()
1116 'login-utils/vipw.c',
1117 'login-utils/setpwnam.h',
1118 include_directories : includes,
1119 link_with : [lib_common],
1120 dependencies : [lib_selinux],
1121 install_dir : usrbin_exec_dir,
1123 build_by_default : opt)
1124 if opt and not is_disabler(exe)
1126 meson.add_install_script(meson_make_symlink,
1128 join_paths(usrbin_exec_dir, 'vigr'))
1129 manadocs += ['login-utils/vipw.8.adoc']
1130 meson.add_install_script(meson_make_symlink,
1132 join_paths(mandir, 'man8/vigr.8'))
1135 opt = not get_option('build-runuser').disabled()
1138 'login-utils/runuser.c',
1139 'login-utils/su-common.c',
1140 'login-utils/su-common.h',
1144 include_directories : includes,
1145 link_with : [lib_common, logindefs_c],
1146 dependencies : [lib_pam,
1150 install_dir : sbindir,
1152 build_by_default : opt)
1153 if opt and not is_disabler(exe)
1155 manadocs += ['login-utils/runuser.1.adoc']
1156 bashcompletionslinks += {'runuser': 'su'}
1159 ############################################################
1165 include_directories : includes,
1166 link_with : lib_common,
1167 install_dir : usrbin_exec_dir,
1170 manadocs += ['text-utils/col.1.adoc']
1171 bashcompletions += ['col']
1177 include_directories : includes,
1178 install_dir : usrbin_exec_dir,
1181 manadocs += ['text-utils/colcrt.1.adoc']
1182 bashcompletions += ['colcrt']
1187 include_directories : includes,
1188 link_with : lib_common,
1189 install_dir : usrbin_exec_dir,
1192 manadocs += ['text-utils/colrm.1.adoc']
1193 bashcompletions += ['colrm']
1198 include_directories : includes,
1199 install_dir : usrbin_exec_dir,
1202 manadocs += ['text-utils/rev.1.adoc']
1203 bashcompletions += ['rev']
1208 include_directories : includes,
1209 link_with : [lib_common,
1211 install_dir : usrbin_exec_dir,
1213 if not is_disabler(exe)
1215 manadocs += ['text-utils/column.1.adoc']
1216 bashcompletions += ['column']
1219 opt = not get_option('build-line').disabled()
1223 include_directories : includes,
1224 install_dir : usrbin_exec_dir,
1226 build_by_default : opt)
1227 if opt and not is_disabler(exe)
1229 manadocs += ['text-utils/line.1.adoc']
1232 opt = not get_option('build-pg').disabled()
1236 link_with : lib_common,
1237 include_directories : includes,
1238 dependencies : [lib_tinfo,
1240 install_dir : usrbin_exec_dir,
1242 build_by_default : opt)
1243 if opt and not is_disabler(exe)
1245 manadocs += ['text-utils/pg.1.adoc']
1246 bashcompletions += ['pg']
1249 opt = not get_option('build-ul').disabled()
1253 include_directories : includes,
1254 dependencies : [lib_tinfo,
1256 install_dir : usrbin_exec_dir,
1258 build_by_default : opt)
1259 if opt and not is_disabler(exe)
1261 manadocs += ['text-utils/ul.1.adoc']
1262 bashcompletions += ['ul']
1265 opt = not get_option('build-more').disabled()
1269 link_with : [lib_common],
1270 include_directories : includes,
1271 dependencies : [lib_tinfo,
1275 build_by_default : opt)
1279 link_with : [lib_common],
1280 include_directories : includes,
1281 c_args : '-DTEST_PROGRAM',
1282 dependencies : [lib_tinfo,
1285 build_by_default : opt and program_tests)
1287 if opt and not is_disabler(exe)
1289 manadocs += ['text-utils/more.1.adoc']
1290 bashcompletions += ['more']
1296 include_directories : includes,
1297 link_with : [lib_common,
1299 install_dir : usrbin_exec_dir,
1301 if not is_disabler(exe)
1303 manadocs += ['text-utils/hexdump.1.adoc']
1304 bashcompletions += ['hexdump']
1307 opt = not get_option('build-lsmem').disabled()
1311 include_directories : includes,
1312 link_with : [lib_common,
1314 install_dir : usrbin_exec_dir,
1316 build_by_default : opt)
1317 if opt and not is_disabler(exe)
1319 manadocs += ['sys-utils/lsmem.1.adoc']
1320 bashcompletions += ['lsmem']
1323 opt = not get_option('build-chmem').disabled()
1327 include_directories : includes,
1328 link_with : [lib_common],
1329 install_dir : usrbin_exec_dir,
1331 build_by_default : opt)
1332 if opt and not is_disabler(exe)
1334 manadocs += ['sys-utils/chmem.8.adoc']
1335 bashcompletions += ['chmem']
1341 include_directories : includes,
1342 link_with : [lib_common],
1343 install_dir : usrbin_exec_dir,
1346 manadocs += ['sys-utils/choom.1.adoc']
1351 include_directories : includes,
1352 link_with : [lib_common],
1353 install_dir : usrbin_exec_dir,
1356 manadocs += ['sys-utils/ipcmk.1.adoc']
1357 bashcompletions += ['ipcmk']
1362 include_directories : includes,
1363 link_with : [lib_common],
1364 install_dir : usrbin_exec_dir,
1367 manadocs += ['sys-utils/ipcrm.1.adoc']
1368 bashcompletions += ['ipcrm']
1370 opt = not get_option('build-ipcs').disabled()
1374 include_directories : includes,
1375 link_with : [lib_common],
1376 install_dir : usrbin_exec_dir,
1378 build_by_default : opt)
1379 if opt and not is_disabler(exe)
1381 manadocs += ['sys-utils/ipcs.1.adoc']
1382 bashcompletions += ['ipcs']
1385 opt = not get_option('build-rfkill').disabled()
1389 include_directories : includes,
1390 link_with : [lib_common,
1392 install_dir : usrsbin_exec_dir,
1394 build_by_default : opt)
1395 if opt and not is_disabler(exe)
1397 manadocs += ['sys-utils/rfkill.8.adoc']
1398 bashcompletions += ['rfkill']
1404 include_directories : includes,
1405 link_with : [lib_common,
1407 install_dir : usrbin_exec_dir,
1409 if not is_disabler(exe)
1411 manadocs += ['sys-utils/renice.1.adoc']
1412 bashcompletions += ['renice']
1418 include_directories: includes,
1419 link_with : [lib_common,
1421 install_dir : usrbin_exec_dir,
1423 if opt and not is_disabler(exe)
1425 manadocs += ['sys-utils/setpgid.1.adoc']
1426 bashcompletions += ['setpgid']
1432 include_directories : includes,
1433 link_with : [lib_common,
1435 install_dir : usrbin_exec_dir,
1437 if opt and not is_disabler(exe)
1439 manadocs += ['sys-utils/setsid.1.adoc']
1440 bashcompletions += ['setsid']
1445 readprofile_sources,
1446 include_directories : includes,
1447 link_with : [lib_common,
1449 install_dir : usrsbin_exec_dir,
1451 if not is_disabler(exe)
1453 manadocs += ['sys-utils/readprofile.8.adoc']
1454 bashcompletions += ['readprofile']
1457 opt = not get_option('build-tunelp').disabled()
1461 include_directories : includes,
1462 link_with : [lib_common],
1463 install_dir : usrsbin_exec_dir,
1465 build_by_default : opt)
1466 if opt and not is_disabler(exe)
1468 manadocs += ['sys-utils/tunelp.8.adoc']
1469 bashcompletions += ['tunelp']
1475 include_directories : includes,
1476 link_with : [lib_common,
1478 install_dir : sbindir,
1480 if not is_disabler(exe)
1482 manadocs += ['sys-utils/fstrim.8.adoc']
1483 bashcompletions += ['fstrim']
1489 include_directories : includes,
1490 link_with : [lib_common,
1493 if not is_disabler(exe)
1495 manadocs += ['sys-utils/dmesg.1.adoc']
1496 bashcompletions += ['dmesg']
1502 include_directories : dir_include,
1503 c_args : '-DTEST_DMESG',
1504 link_with : [lib_common,
1506 build_by_default : program_tests)
1507 if not is_disabler(exe)
1514 include_directories : includes,
1515 link_with : [lib_common],
1516 install_dir : sbindir,
1519 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1520 bashcompletions += ['ctrlaltdel']
1525 include_directories : includes,
1526 install_dir : sbindir,
1529 manadocs += ['sys-utils/fsfreeze.8.adoc']
1530 bashcompletions += ['fsfreeze']
1535 include_directories : includes,
1536 link_with : [lib_common,
1538 install_dir : sbindir,
1541 manadocs += ['sys-utils/blkdiscard.8.adoc']
1542 bashcompletions += ['blkdiscard']
1547 include_directories : includes,
1548 link_with : [lib_common],
1549 install_dir : sbindir,
1552 manadocs += ['sys-utils/blkzone.8.adoc']
1553 bashcompletions += ['blkzone']
1558 include_directories : includes,
1559 link_with : [lib_common],
1560 install_dir : sbindir,
1563 manadocs += ['sys-utils/blkpr.8.adoc']
1568 include_directories : includes,
1569 link_with : [lib_common],
1570 install_dir : usrsbin_exec_dir,
1573 manadocs += ['sys-utils/ldattach.8.adoc']
1574 bashcompletions += ['ldattach']
1579 include_directories : includes,
1580 link_with : [lib_common],
1581 install_dir : usrsbin_exec_dir,
1584 manadocs += ['sys-utils/rtcwake.8.adoc']
1585 bashcompletions += ['rtcwake']
1590 include_directories : includes,
1591 link_with : [lib_common],
1592 install_dir : usrbin_exec_dir,
1595 manadocs += ['sys-utils/setarch.8.adoc']
1596 bashcompletions += ['setarch']
1598 setarch_links = ['uname26', 'linux32', 'linux64']
1599 setarch_links_arch = {
1600 's390x' : ['s390', 's390x'],
1602 'x86_64' : ['i386', 'x86_64'],
1603 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1604 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1605 'mips64' : ['mips', 'mips64', 'mips32'],
1606 'ia64' : ['i386', 'ia64'],
1607 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1609 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1611 foreach link: setarch_links
1612 meson.add_install_script(meson_make_symlink,
1614 join_paths(usrbin_exec_dir, link))
1615 manlinks += {link + '.8': 'setarch.8'}
1618 opt = not get_option('build-eject').disabled()
1622 include_directories : includes,
1623 link_with : [lib_common,
1625 install_dir : usrbin_exec_dir,
1627 build_by_default : opt)
1628 if opt and not is_disabler(exe)
1630 manadocs += ['sys-utils/eject.1.adoc']
1631 bashcompletions += ['eject']
1634 opt = not get_option('build-losetup').disabled()
1638 include_directories : includes,
1639 link_with : [lib_common,
1641 install_dir : sbindir,
1643 build_by_default : opt)
1644 if opt and not is_disabler(exe)
1645 manadocs += ['sys-utils/losetup.8.adoc']
1647 bashcompletions += ['losetup']
1650 opt = opt and 'losetup' in static_programs
1654 include_directories : includes,
1655 link_args : ['--static'],
1656 link_with : [lib_common,
1657 lib_smartcols.get_static_lib()],
1658 install_dir : sbindir,
1660 build_by_default : opt)
1661 if opt and not is_disabler(exe)
1665 opt = not get_option('build-zramctl').disabled()
1669 include_directories : includes,
1670 link_with : [lib_common,
1672 install_dir : sbindir,
1674 build_by_default : opt)
1675 if opt and not is_disabler(exe)
1677 manadocs += ['sys-utils/zramctl.8.adoc']
1678 bashcompletions += ['zramctl']
1684 include_directories : includes,
1685 link_with : [lib_common,
1687 install_dir : usrbin_exec_dir,
1689 if not is_disabler(exe)
1691 manadocs += ['sys-utils/prlimit.1.adoc']
1692 bashcompletions += ['prlimit']
1698 include_directories : includes,
1699 link_with : [lib_common,
1702 install_dir : usrbin_exec_dir,
1704 if not is_disabler(exe)
1706 manadocs += ['sys-utils/lsns.8.adoc']
1707 bashcompletions += ['lsns']
1710 opt = not get_option('build-mount').disabled()
1714 include_directories : includes,
1715 link_with : [lib_common,
1718 dependencies : lib_selinux,
1719 install_mode : 'rwsr-xr-x',
1721 build_by_default : opt)
1725 include_directories : includes,
1726 link_with : [lib_common,
1728 install_mode : 'rwsr-xr-x',
1730 build_by_default : opt)
1731 if opt and not is_disabler(exe)
1733 manadocs += ['sys-utils/fstab.5.adoc',
1734 'sys-utils/mount.8.adoc',
1735 'sys-utils/umount.8.adoc']
1736 bashcompletions += ['mount', 'umount']
1739 opt2 = opt and 'mount' in static_programs
1743 include_directories : includes,
1744 link_args : ['--static'],
1745 link_with : [lib_common,
1746 lib_smartcols_static,
1749 build_by_default : opt2)
1750 if opt2 and not is_disabler(exe)
1754 opt2 = opt and 'umount' in static_programs
1758 include_directories : includes,
1759 link_args : ['--static'],
1760 link_with : [lib_common,
1763 build_by_default : opt2)
1764 if opt2 and not is_disabler(exe)
1773 include_directories : includes,
1774 link_with : [lib_common,
1778 install_dir : sbindir,
1780 if not is_disabler(exe)
1782 manadocs += ['sys-utils/swapon.8.adoc']
1783 bashcompletions += ['swapon']
1789 include_directories : includes,
1790 link_with : [lib_common,
1793 install_dir : sbindir,
1795 if not is_disabler(exe)
1797 manlinks += {'swapoff.8': 'swapon.8'}
1798 bashcompletions += ['swapoff']
1804 include_directories : includes,
1805 link_with : [lib_common,
1807 dependencies : [rtas_libs],
1808 install_dir : usrbin_exec_dir,
1810 if not is_disabler(exe)
1812 manadocs += ['sys-utils/lscpu.1.adoc']
1813 bashcompletions += ['lscpu']
1819 include_directories : includes,
1820 link_with : [lib_common],
1821 install_dir : sbindir,
1824 manadocs += ['sys-utils/chcpu.8.adoc']
1825 bashcompletions += ['chcpu']
1830 include_directories : includes,
1831 link_with : [lib_common,
1834 if not is_disabler(exe)
1836 manadocs += ['sys-utils/wdctl.8.adoc']
1837 bashcompletions += ['wdctl']
1840 opt = not get_option('build-mountpoint').disabled()
1844 include_directories : includes,
1845 link_with : [lib_mount],
1847 build_by_default : opt)
1848 if opt and not is_disabler(exe)
1850 manadocs += ['sys-utils/mountpoint.1.adoc']
1851 bashcompletions += ['mountpoint']
1854 opt = not get_option('build-fallocate').disabled()
1858 include_directories : includes,
1859 link_with : [lib_common],
1860 install_dir : usrbin_exec_dir,
1862 build_by_default : opt)
1863 if opt and not is_disabler(exe)
1865 manadocs += ['sys-utils/fallocate.1.adoc']
1866 bashcompletions += ['fallocate']
1869 opt = not get_option('build-pivot_root').disabled()
1873 include_directories : includes,
1874 install_dir : sbindir,
1876 build_by_default : opt)
1877 if opt and not is_disabler(exe)
1879 manadocs += ['sys-utils/pivot_root.8.adoc']
1880 bashcompletions += ['pivot_root']
1883 opt = not get_option('build-switch_root').disabled()
1884 if opt and not have_dirfd and not have_ddfd
1885 error('neither dirfd nor ddfd are available')
1889 switch_root_sources,
1890 include_directories : includes,
1891 install_dir : sbindir,
1893 build_by_default : opt)
1894 if opt and not is_disabler(exe)
1896 manadocs += ['sys-utils/switch_root.8.adoc']
1899 opt = not get_option('build-unshare').disabled()
1903 include_directories : includes,
1904 link_with : [lib_common],
1905 install_dir : usrbin_exec_dir,
1907 build_by_default : opt)
1908 if opt and not is_disabler(exe)
1910 manadocs += ['sys-utils/unshare.1.adoc']
1911 bashcompletions += ['unshare']
1914 opt = opt and 'unshare' in static_programs
1918 include_directories : includes,
1919 link_with : [lib_common],
1920 install_dir : usrbin_exec_dir,
1922 build_by_default : opt)
1923 if opt and not is_disabler(exe)
1927 opt = not get_option('build-nsenter').disabled()
1931 include_directories : includes,
1932 link_with : [lib_common],
1933 dependencies : [lib_selinux],
1934 install_dir : usrbin_exec_dir,
1936 build_by_default : opt)
1937 if opt and not is_disabler(exe)
1939 manadocs += ['sys-utils/nsenter.1.adoc']
1940 bashcompletions += ['nsenter']
1943 opt = opt and 'nsenter' in static_programs
1947 include_directories : includes,
1948 link_with : [lib_common],
1949 dependencies : [lib_selinux],
1950 install_dir : usrbin_exec_dir,
1952 build_by_default : opt)
1953 if opt and not is_disabler(exe)
1957 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1961 include_directories : includes,
1962 link_with : [lib_common],
1963 dependencies : [lib_cap_ng],
1964 install_dir : usrbin_exec_dir,
1966 build_by_default : opt)
1967 if opt and not is_disabler(exe)
1969 manadocs += ['sys-utils/setpriv.1.adoc']
1970 bashcompletions += ['setpriv']
1976 include_directories : includes,
1977 link_with : [lib_common],
1978 dependencies : realtime_libs,
1979 install_dir : usrbin_exec_dir,
1982 manadocs += ['sys-utils/flock.1.adoc']
1983 bashcompletions += ['flock']
1985 opt = not get_option('build-lsirq').disabled()
1989 include_directories : includes,
1990 link_with : [lib_common,
1992 install_dir : usrbin_exec_dir,
1994 build_by_default : opt)
1995 if opt and not is_disabler(exe)
1997 manadocs += ['sys-utils/lsirq.1.adoc']
1998 bashcompletions += ['lsirq']
2001 opt = not get_option('build-irqtop').disabled()
2005 include_directories : includes,
2006 dependencies : [realtime_libs, curses_libs],
2007 link_with : [lib_common,
2010 install_dir : usrbin_exec_dir,
2012 build_by_default : opt)
2013 if opt and not is_disabler(exe)
2015 manadocs += ['sys-utils/irqtop.1.adoc']
2016 bashcompletions += ['irqtop']
2019 opt = not get_option('build-ipcs').disabled()
2023 include_directories : includes,
2024 link_with : [lib_common,
2026 install_dir : usrbin_exec_dir,
2028 build_by_default : opt)
2029 if opt and not is_disabler(exe)
2031 manadocs += ['sys-utils/lsipc.1.adoc']
2032 bashcompletions += ['lsipc']
2039 include_directories : includes,
2040 link_with : [lib_common],
2041 dependencies : [lib_m,
2043 install_dir : sbindir,
2045 build_by_default : opt)
2046 if opt and not is_disabler(exe)
2048 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2049 bashcompletions += ['hwclock']
2055 include_directories : includes,
2056 install_dir : sbindir,
2059 manadocs += ['disk-utils/mkfs.8.adoc']
2060 bashcompletions += ['mkfs']
2062 opt = not get_option('build-bfs').disabled()
2066 include_directories : includes,
2067 link_with : [lib_common],
2068 install_dir : sbindir,
2070 build_by_default : opt)
2071 if opt and not is_disabler(exe)
2073 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2074 bashcompletions += ['mkfs.bfs']
2080 include_directories : includes,
2081 link_with : [lib_common],
2082 install_dir : usrbin_exec_dir,
2085 manadocs += ['disk-utils/isosize.8.adoc']
2086 bashcompletions += ['isosize']
2091 include_directories : includes,
2092 link_with : [lib_common,
2095 dependencies: [lib_selinux],
2096 install_dir : sbindir,
2098 if opt and not is_disabler(exe)
2100 manadocs += ['disk-utils/mkswap.8.adoc']
2101 bashcompletions += ['mkswap']
2107 include_directories : includes,
2108 link_with : [lib_common,
2111 install_dir : sbindir,
2113 if opt and not is_disabler(exe)
2115 manadocs += ['disk-utils/swaplabel.8.adoc']
2116 bashcompletions += ['swaplabel']
2119 opt = not get_option('build-fsck').disabled()
2123 include_directories : includes,
2124 link_with : [lib_common,
2127 dependencies : realtime_libs,
2128 install_dir : sbindir,
2130 build_by_default : opt)
2131 if opt and not is_disabler(exe)
2133 manadocs += ['disk-utils/fsck.8.adoc']
2134 bashcompletions += ['fsck']
2137 opt = not get_option('build-minix').disabled()
2141 include_directories : includes,
2142 link_with : [lib_common],
2143 install_dir : sbindir,
2145 build_by_default : opt)
2149 include_directories : includes,
2150 c_args : '-DTEST_SCRIPT',
2151 link_with : [lib_common],
2152 build_by_default : opt and program_tests)
2156 include_directories : includes,
2157 link_with : [lib_common],
2158 install_dir : sbindir,
2160 build_by_default : opt)
2161 if opt and not is_disabler(exe)
2162 exes += [exe, exe2, exe3]
2163 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2164 bashcompletions += ['mkfs.minix', 'fsck.minix']
2167 opt = not get_option('build-cramfs').disabled()
2170 mkfs_cramfs_sources,
2171 include_directories : includes,
2172 link_with : [lib_common],
2173 dependencies : [lib_z],
2174 install_dir : sbindir,
2176 build_by_default : opt)
2179 fsck_cramfs_sources,
2180 include_directories : includes,
2181 link_with : [lib_common],
2182 dependencies : [lib_z],
2183 install_dir : sbindir,
2185 build_by_default : opt)
2186 if not is_disabler(exe)
2188 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2189 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2192 opt = not get_option('build-raw').disabled()
2194 cc.has_header('linux/raw.h', required: opt)
2199 include_directories : includes,
2200 install_dir : sbindir,
2202 build_by_default : opt)
2203 if opt and not is_disabler(exe)
2205 manadocs += ['disk-utils/raw.8.adoc']
2206 bashcompletions += ['raw']
2209 opt = not get_option('build-fdformat').disabled()
2213 include_directories : includes,
2214 link_with : [lib_common],
2215 install_dir : usrsbin_exec_dir,
2217 build_by_default : opt)
2218 if opt and not is_disabler(exe)
2220 manadocs += ['disk-utils/fdformat.8.adoc']
2226 include_directories : includes,
2227 link_with : [lib_common],
2228 install_dir : sbindir,
2230 manadocs += ['disk-utils/blockdev.8.adoc']
2231 bashcompletions += ['blockdev']
2233 opt = not get_option('build-fdisks').disabled()
2234 if opt and not have_dirfd and not have_ddfd
2235 error('neither dirfd nor ddfd are available')
2240 include_directories : includes,
2241 link_with : [lib_common,
2245 dependencies : [lib_readline],
2246 install_dir : sbindir,
2248 build_by_default : opt)
2249 if opt and not is_disabler(exe)
2251 bashcompletions += ['fdisk']
2254 opt2 = opt and 'fdisk' in static_programs
2258 link_args : ['--static'],
2259 include_directories : includes,
2260 link_with : [lib_common,
2263 lib_smartcols.get_static_lib()],
2264 dependencies : [lib_readline_static],
2265 install_dir : sbindir,
2267 build_by_default : opt2)
2268 if opt2 and not is_disabler(exe)
2275 include_directories : includes,
2276 link_with : [lib_common,
2280 dependencies : [lib_readline],
2281 install_dir : sbindir,
2283 build_by_default : opt)
2284 if opt and not is_disabler(exe)
2286 bashcompletions += ['sfdisk']
2289 opt2 = opt and 'sfdisk' in static_programs
2293 include_directories : includes,
2294 link_with : [lib_common,
2297 lib_smartcols.get_static_lib()],
2298 dependencies : [lib_readline_static],
2299 install_dir : sbindir,
2301 build_by_default : opt2)
2302 if opt2 and not is_disabler(exe)
2309 include_directories : includes,
2310 link_with : [lib_common,
2315 dependencies : [curses_libs],
2316 install_dir : sbindir,
2318 build_by_default : opt)
2319 if opt and not is_disabler(exe)
2321 manadocs += ['disk-utils/fdisk.8.adoc',
2322 'disk-utils/sfdisk.8.adoc',
2323 'disk-utils/cfdisk.8.adoc']
2324 bashcompletions += ['cfdisk']
2327 opt = not get_option('build-partx').disabled()
2331 include_directories : includes,
2332 link_with : [lib_common],
2333 install_dir : usrsbin_exec_dir,
2335 build_by_default : opt)
2339 include_directories : includes,
2340 link_with : [lib_common],
2341 install_dir : usrsbin_exec_dir,
2343 build_by_default : opt)
2347 include_directories : includes,
2348 link_with : [lib_common],
2349 install_dir : usrsbin_exec_dir,
2351 build_by_default : opt)
2355 include_directories : includes,
2356 link_with : [lib_common,
2359 install_dir : usrsbin_exec_dir,
2361 build_by_default : opt)
2363 exes += [exe, exe2, exe3, exe4]
2364 manadocs += ['disk-utils/addpart.8.adoc',
2365 'disk-utils/delpart.8.adoc',
2366 'disk-utils/resizepart.8.adoc',
2367 'disk-utils/partx.8.adoc']
2368 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2371 ############################################################
2376 include_directories : includes,
2377 link_with : [lib_common],
2378 dependencies : [lib_util,
2382 install_dir : usrbin_exec_dir,
2385 manadocs += ['term-utils/script.1.adoc']
2386 bashcompletions += ['script']
2391 include_directories : includes,
2392 c_args : '-DTEST_SCRIPT',
2393 link_with : [lib_common],
2394 dependencies : [lib_util,
2398 build_by_default : program_tests)
2404 include_directories : includes,
2405 link_with : [lib_common],
2406 dependencies : [lib_util,
2409 install_dir : usrbin_exec_dir,
2412 manadocs += ['term-utils/scriptlive.1.adoc']
2413 bashcompletions += ['scriptlive']
2417 scriptreplay_sources,
2418 include_directories : includes,
2419 link_with : [lib_common],
2420 dependencies : [math_libs],
2421 install_dir : usrbin_exec_dir,
2424 manadocs += ['term-utils/scriptreplay.1.adoc']
2425 bashcompletions += ['scriptreplay']
2427 opt = not get_option('build-agetty').disabled()
2431 include_directories : includes,
2432 link_with : [lib_common, logindefs_c],
2433 dependencies : [BSD ? lib_util : [], lib_systemd],
2434 install_dir : sbindir,
2436 build_by_default : opt)
2439 manadocs += ['term-utils/agetty.8.adoc']
2442 opt = not get_option('build-setterm').disabled()
2446 include_directories : includes,
2447 link_with : [lib_common],
2448 dependencies : [curses_libs],
2449 install_dir : usrbin_exec_dir,
2451 build_by_default : opt)
2454 manadocs += ['term-utils/setterm.1.adoc']
2455 bashcompletions += ['setterm']
2458 opt = not get_option('build-mesg').disabled()
2462 include_directories : includes,
2463 link_with : [lib_common],
2464 install_dir : usrbin_exec_dir,
2466 build_by_default : opt)
2469 manadocs += ['term-utils/mesg.1.adoc']
2470 bashcompletions += ['mesg']
2473 opt = not get_option('build-wall').disabled()
2477 include_directories : includes,
2478 link_with : [lib_common],
2479 dependencies : [lib_systemd],
2480 install_dir : usrbin_exec_dir,
2481 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2483 build_by_default : opt)
2486 manadocs += ['term-utils/wall.1.adoc']
2487 bashcompletions += ['wall']
2490 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2491 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2493 opt = not get_option('build-write').disabled()
2497 include_directories : includes,
2498 link_with : [lib_common],
2499 dependencies : [lib_systemd],
2500 install_dir : usrbin_exec_dir,
2501 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2503 build_by_default : opt)
2506 manadocs += ['term-utils/write.1.adoc']
2507 bashcompletions += ['write']
2510 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2511 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2513 opt = not get_option('build-login').disabled()
2517 include_directories : includes,
2518 link_with : [lib_common, logindefs_c],
2519 dependencies : [lib_pam,
2523 build_by_default : opt)
2524 if not is_disabler(exe)
2526 manadocs += ['login-utils/login.1.adoc']
2529 opt = not get_option('build-sulogin').disabled()
2533 include_directories : includes,
2534 link_with : [lib_common],
2535 dependencies : [lib_crypt,
2537 install_dir : sbindir,
2539 build_by_default : opt)
2540 if not is_disabler(exe)
2542 manadocs += ['login-utils/sulogin.8.adoc']
2548 include_directories : includes,
2549 link_with : [lib_common,
2551 dependencies : [curses_libs],
2552 install_dir : usrbin_exec_dir,
2555 manadocs += ['misc-utils/cal.1.adoc']
2556 bashcompletions += ['cal']
2558 opt = not get_option('build-logger').disabled()
2562 include_directories : includes,
2563 link_with : [lib_common],
2564 dependencies : [lib_systemd],
2565 install_dir : usrbin_exec_dir,
2567 build_by_default : opt)
2568 if opt and not is_disabler(exe)
2570 manadocs += ['misc-utils/logger.1.adoc']
2571 bashcompletions += ['logger']
2577 include_directories : includes,
2578 c_args : '-DTEST_LOGGER',
2579 link_with : [lib_common],
2580 dependencies : [lib_systemd],
2581 build_by_default: program_tests)
2582 if not is_disabler(exe)
2589 include_directories : includes,
2590 install_dir : usrbin_exec_dir,
2593 manadocs += ['misc-utils/look.1.adoc']
2594 bashcompletions += ['look']
2599 include_directories : includes,
2600 link_with : [lib_common],
2601 install_dir : usrbin_exec_dir,
2604 manadocs += ['misc-utils/mcookie.1.adoc']
2605 bashcompletions += ['mcookie']
2607 if build_liblastlog2
2611 include_directories : includes,
2612 link_with : [lib_common, lib_lastlog2],
2613 install_dir : usrbin_exec_dir,
2616 manadocs += ['misc-utils/lastlog2.8.adoc']
2617 bashcompletions += ['lastlog2']
2618 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2619 'liblastlog2/man/ll2_write_entry.3.adoc',
2620 'liblastlog2/man/ll2_read_entry.3.adoc',
2621 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2622 'liblastlog2/man/ll2_read_all.3.adoc',
2623 'liblastlog2/man/ll2_remove_entry.3.adoc',
2624 'liblastlog2/man/ll2_rename_user.3.adoc',
2625 'liblastlog2/man/ll2_update_login_time.3.adoc'
2632 include_directories : includes,
2633 dependencies : [lib_selinux],
2634 install_dir : usrbin_exec_dir,
2637 manadocs += ['misc-utils/namei.1.adoc']
2638 bashcompletions += ['namei']
2643 include_directories : includes,
2644 link_with : [lib_common],
2645 install_dir : usrbin_exec_dir,
2648 manadocs += ['misc-utils/whereis.1.adoc']
2649 bashcompletions += ['whereis']
2654 include_directories : includes,
2655 link_with : [lib_common,
2658 install_dir : usrbin_exec_dir,
2660 if not is_disabler(exe)
2662 manadocs += ['misc-utils/lslocks.8.adoc']
2663 bashcompletions += ['lslocks']
2669 include_directories : includes,
2670 link_with : [lib_common,
2675 dependencies : lib_udev,
2677 if not is_disabler(exe)
2679 manadocs += ['misc-utils/lsblk.8.adoc']
2680 bashcompletions += ['lsblk']
2684 mq_libs += cc.find_library('rt', required : true)
2689 include_directories : includes,
2690 link_with : [lib_common,
2692 dependencies : mq_libs,
2693 install_dir : usrbin_exec_dir,
2695 if not is_disabler(exe)
2697 manadocs += ['misc-utils/lsfd.1.adoc']
2703 include_directories : includes,
2704 link_with : [lib_common,
2706 install_dir : usrbin_exec_dir,
2708 if not is_disabler(exe)
2710 manadocs += ['misc-utils/uuidgen.1.adoc']
2711 bashcompletions += ['uuidgen']
2717 include_directories : includes,
2718 link_with : [lib_common,
2721 install_dir : usrbin_exec_dir,
2723 if not is_disabler(exe)
2725 manadocs += ['misc-utils/uuidparse.1.adoc']
2726 bashcompletions += ['uuidparse']
2733 include_directories : includes,
2734 link_with : [lib_common,
2736 dependencies : [realtime_libs,
2738 install_dir : usrsbin_exec_dir,
2740 build_by_default : opt)
2744 include_directories : includes,
2745 link_with : [lib_common,
2747 dependencies : thread_libs,
2748 build_by_default : opt and program_tests)
2749 if not is_disabler(exe)
2751 manadocs += ['misc-utils/uuidd.8.adoc']
2752 bashcompletions += ['uuidd']
2755 opt = build_libblkid
2759 include_directories : includes,
2760 link_with : [lib_common,
2762 install_dir : sbindir,
2764 build_by_default : opt)
2765 if opt and not is_disabler(exe)
2767 manadocs += ['misc-utils/blkid.8.adoc']
2768 bashcompletions += ['blkid']
2771 opt = opt and 'blkid' in static_programs
2775 include_directories : includes,
2776 link_with : [lib_common,
2778 install_dir : sbindir,
2780 build_by_default : opt)
2781 if opt and not is_disabler(exe)
2787 'libblkid/samples/mkfs.c',
2788 include_directories : includes,
2789 link_with : lib_blkid)
2790 if not is_disabler(exe)
2795 'sample-partitions',
2796 'libblkid/samples/partitions.c',
2797 include_directories : includes,
2798 link_with : lib_blkid)
2799 if not is_disabler(exe)
2804 'sample-superblocks',
2805 'libblkid/samples/superblocks.c',
2806 include_directories : includes,
2807 link_with : lib_blkid)
2808 if not is_disabler(exe)
2814 'libblkid/samples/topology.c',
2815 include_directories : includes,
2816 link_with : lib_blkid)
2817 if not is_disabler(exe)
2822 'test_blkid_fuzz_sample',
2823 'libblkid/src/fuzz.c',
2824 include_directories: includes,
2825 link_with: lib_blkid,
2826 build_by_default: program_tests)
2827 if not is_disabler(exe)
2831 ############################################################
2836 include_directories : includes,
2837 link_with : [lib_blkid],
2838 install_dir : sbindir,
2840 if not is_disabler(exe)
2842 manadocs += ['misc-utils/findfs.8.adoc']
2843 bashcompletions += ['findfs']
2849 include_directories : includes,
2850 link_with : [lib_common,
2853 install_dir : sbindir,
2855 if not is_disabler(exe)
2857 manadocs += ['misc-utils/wipefs.8.adoc']
2858 bashcompletions += ['wipefs']
2864 include_directories : includes,
2865 link_with : [lib_common,
2869 dependencies : [lib_udev],
2871 if not is_disabler(exe)
2873 manadocs += ['misc-utils/findmnt.8.adoc']
2874 bashcompletions += ['findmnt']
2880 include_directories : includes,
2881 link_with : [lib_common],
2883 if not is_disabler(exe)
2885 manadocs += ['misc-utils/kill.1.adoc']
2888 opt = not get_option('build-rename').disabled()
2892 include_directories : includes,
2893 install_dir : usrbin_exec_dir,
2895 build_by_default : opt)
2896 if opt and not is_disabler(exe)
2898 manadocs += ['misc-utils/rename.1.adoc']
2899 bashcompletions += ['rename']
2905 include_directories : includes,
2906 link_with : [lib_common],
2907 install_dir : usrbin_exec_dir,
2910 manadocs += ['misc-utils/getopt.1.adoc']
2911 bashcompletions += ['getopt']
2916 include_directories : includes,
2917 link_with : [lib_common,
2919 install_dir : usrbin_exec_dir,
2921 if not is_disabler(exe)
2923 manadocs += ['misc-utils/fincore.1.adoc']
2924 bashcompletions += ['fincore']
2930 include_directories : includes,
2931 link_with : [lib_common],
2932 install_dir : usrbin_exec_dir,
2934 if not is_disabler(exe)
2936 manadocs += ['misc-utils/hardlink.1.adoc']
2937 bashcompletions += ['hardlink']
2940 opt = not get_option('build-pipesz').disabled()
2944 include_directories : includes,
2945 link_with : [lib_common],
2946 install_dir : usrbin_exec_dir,
2948 if opt and not is_disabler(exe)
2950 manadocs += ['misc-utils/pipesz.1.adoc']
2951 bashcompletions += ['pipesz']
2957 include_directories : includes,
2958 c_args : '-DTEST_CAL',
2959 link_with : [lib_common,
2961 dependencies : [curses_libs],
2962 build_by_default: program_tests)
2963 if not is_disabler(exe)
2970 include_directories : includes,
2971 link_with : [lib_common],
2972 install_dir : usrbin_exec_dir,
2974 if not is_disabler(exe)
2976 manadocs += ['misc-utils/fadvise.1.adoc']
2977 bashcompletions += ['fadvise']
2980 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
2984 include_directories : includes,
2985 link_with : [lib_common],
2986 install_dir : usrbin_exec_dir,
2988 if not is_disabler(exe)
2990 manadocs += ['misc-utils/waitpid.1.adoc']
2991 bashcompletions += ['waitpid']
2995 syscalls_h = custom_target('syscalls.h',
2996 input : 'tools/all_syscalls',
2997 output : 'syscalls.h',
2998 command : ['tools/all_syscalls', cc.cmd_array()]
3001 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3004 'misc-utils/enosys.c', syscalls_h,
3005 include_directories : includes,
3006 link_with : [lib_common],
3007 install_dir : usrbin_exec_dir,
3009 if not is_disabler(exe)
3011 manadocs += ['misc-utils/enosys.1.adoc']
3012 bashcompletions += ['enosys']
3019 include_directories : includes,
3020 link_with : [lib_common, lib_smartcols],
3021 install_dir : usrbin_exec_dir,
3023 if not is_disabler(exe)
3025 manadocs += ['misc-utils/lsclocks.1.adoc']
3026 bashcompletions += ['lsclocks']
3029 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3033 include_directories : includes,
3034 link_with : [lib_common],
3035 install_dir : usrbin_exec_dir,
3037 if not is_disabler(exe)
3039 manadocs += ['misc-utils/exch.1.adoc']
3040 bashcompletions += ['exch']
3044 ############################################################
3046 opt = not get_option('build-schedutils').disabled()
3049 'schedutils/chrt.c',
3050 include_directories : includes,
3051 link_with : lib_common,
3052 install_dir : usrbin_exec_dir,
3054 build_by_default : opt)
3058 'schedutils/ionice.c',
3059 include_directories : includes,
3060 link_with : lib_common,
3061 install_dir : usrbin_exec_dir,
3063 build_by_default : opt)
3067 'schedutils/taskset.c',
3068 include_directories : includes,
3069 link_with : lib_common,
3070 install_dir : usrbin_exec_dir,
3072 build_by_default : opt)
3076 'schedutils/uclampset.c',
3077 include_directories : includes,
3078 link_with : lib_common,
3079 install_dir : usrbin_exec_dir,
3081 build_by_default : opt)
3083 if opt and not is_disabler(exe)
3084 exes += [exe, exe2, exe3, exe4]
3085 manadocs += ['schedutils/chrt.1.adoc',
3086 'schedutils/ionice.1.adoc',
3087 'schedutils/taskset.1.adoc',
3088 'schedutils/uclampset.1.adoc']
3089 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3092 ############################################################
3094 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3099 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3100 include_directories : dir_include,
3101 link_with : lib_common,
3102 build_by_default: program_tests)
3108 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3109 include_directories : dir_include,
3110 link_with : lib_common,
3111 build_by_default: program_tests)
3117 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3118 include_directories : dir_include,
3119 link_with : lib_common,
3120 build_by_default: program_tests)
3126 c_args : ['-DTEST_PROGRAM_MANGLE'],
3127 include_directories : dir_include,
3128 build_by_default: program_tests)
3134 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3135 include_directories : dir_include,
3136 build_by_default: program_tests)
3142 'lib/color-names.c',
3143 c_args : ['-DTEST_PROGRAM_COLORS'],
3144 include_directories : dir_include,
3145 link_with : [lib_common, lib_tcolors],
3146 build_by_default: program_tests)
3152 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3153 include_directories : dir_include,
3154 build_by_default: program_tests)
3157 if conf.get('HAVE_OPENAT').to_string() == '1' \
3158 and conf.get('HAVE_DIRFD').to_string() == '1'
3162 c_args : ['-DTEST_PROGRAM_PROCFS'],
3163 include_directories : dir_include,
3164 link_with : lib_common,
3165 build_by_default: program_tests)
3172 have_cpu_set_t ? 'lib/cpuset.c' : [],
3173 c_args : ['-DTEST_PROGRAM_PATH'],
3174 include_directories : dir_include,
3175 link_with : lib_common,
3176 build_by_default: program_tests)
3180 if conf.get('HAVE_PTY').to_string() == '1'
3185 c_args : ['-DTEST_PROGRAM_PTY'],
3186 include_directories : dir_include,
3187 link_with : [lib_common],
3188 dependencies : [lib_m,
3191 build_by_default: program_tests)
3199 c_args : ['-DTEST_PROGRAM_CPUSET'],
3200 include_directories : dir_include,
3201 build_by_default: program_tests)
3212 have_cpu_set_t ? 'lib/cpuset.c' : [],
3213 c_args : ['-DTEST_PROGRAM_SYSFS'],
3214 include_directories : dir_include,
3215 build_by_default: program_tests)
3221 c_args : ['-DTEST_PROGRAM_PAGER'],
3222 include_directories : dir_include,
3223 build_by_default: program_tests)
3227 'test_linux_version',
3228 'lib/linux_version.c',
3229 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3230 include_directories : dir_include,
3231 build_by_default: program_tests)
3237 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3238 include_directories : dir_include,
3239 build_by_default: program_tests)
3243 'test_canonicalize',
3244 'lib/canonicalize.c',
3245 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3246 include_directories : dir_include,
3247 build_by_default: program_tests)
3254 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3255 include_directories : dir_include,
3256 build_by_default: program_tests)
3262 c_args : ['-DTEST_PROGRAM'],
3263 include_directories : dir_include,
3264 link_with : lib_common,
3265 build_by_default: program_tests)
3271 c_args : ['-DTEST_PROGRAM'],
3272 include_directories : dir_include,
3273 link_with : [lib_common, logindefs_c],
3274 build_by_default: program_tests)
3278 ############################################################
3282 'libuuid/src/test_uuid.c',
3283 include_directories : [dir_include, dir_libuuid],
3284 link_with : lib_uuid,
3285 dependencies : socket_libs,
3286 build_by_default: program_tests)
3287 if not is_disabler(exe)
3291 ############################################################
3293 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3294 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3298 'libfdisk/src/ask.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/gpt.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)
3320 'libfdisk/src/utils.c',
3321 c_args : libfdisk_tests_cflags,
3322 include_directories : lib_fdisk_includes,
3323 link_with : libfdisk_tests_ldadd,
3324 build_by_default: program_tests)
3325 if not is_disabler(exe)
3330 'test_fdisk_script',
3331 'libfdisk/src/script.c',
3332 c_args : libfdisk_tests_cflags,
3333 include_directories : lib_fdisk_includes,
3334 link_with : libfdisk_tests_ldadd,
3335 build_by_default: program_tests)
3336 if not is_disabler(exe)
3341 'test_fdisk_version',
3342 'libfdisk/src/version.c',
3343 c_args : libfdisk_tests_cflags,
3344 include_directories : lib_fdisk_includes,
3345 link_with : libfdisk_tests_ldadd,
3346 build_by_default: program_tests)
3347 if not is_disabler(exe)
3353 'libfdisk/src/item.c',
3354 c_args : libfdisk_tests_cflags,
3355 include_directories : lib_fdisk_includes,
3356 link_with : libfdisk_tests_ldadd,
3357 build_by_default: program_tests)
3358 if not is_disabler(exe)
3362 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3365 'sample-fdisk-mkpart',
3366 'libfdisk/samples/mkpart.c',
3367 include_directories : lib_fdisk_includes,
3368 link_with : sample_fdisk_ldadd)
3369 if not is_disabler(exe)
3374 'sample-fdisk-mkpart-fullspec',
3375 'libfdisk/samples/mkpart-fullspec.c',
3376 include_directories : lib_fdisk_includes,
3377 link_with : sample_fdisk_ldadd)
3378 if not is_disabler(exe)
3382 ############################################################
3386 'tests/helpers/test_cap.c',
3387 include_directories : includes,
3388 dependencies : [lib_cap_ng],
3389 build_by_default: program_tests)
3390 if not is_disabler(exe)
3396 'tests/helpers/test_mbsencode.c',
3397 include_directories : includes,
3398 link_with : lib_common,
3399 build_by_default: program_tests)
3404 'tests/helpers/test_byteswap.c',
3405 include_directories : includes,
3406 build_by_default: program_tests)
3411 'tests/helpers/test_md5.c',
3413 include_directories : includes,
3414 build_by_default: program_tests)
3419 'tests/helpers/test_sha1.c',
3421 include_directories : includes,
3422 build_by_default: program_tests)
3427 'tests/helpers/test_pathnames.c',
3428 include_directories : includes,
3429 build_by_default: program_tests)
3434 'tests/helpers/test_strerror.c',
3435 include_directories : includes,
3436 build_by_default: program_tests)
3441 'tests/helpers/test_sysinfo.c',
3442 include_directories : includes,
3443 build_by_default: program_tests)
3448 'tests/helpers/test_sigreceive.c',
3449 include_directories : includes,
3450 link_with : lib_common,
3451 build_by_default: program_tests)
3456 'tests/helpers/test_tiocsti.c',
3457 include_directories : includes,
3458 build_by_default: program_tests)
3462 'test_uuid_namespace',
3463 'tests/helpers/test_uuid_namespace.c',
3467 include_directories : includes,
3468 build_by_default: program_tests)
3474 'tests/helpers/test_mkfds.c',
3475 'tests/helpers/test_mkfds.h',
3476 'tests/helpers/test_mkfds_ppoll.c',
3477 include_directories : includes,
3478 dependencies : mq_libs,
3479 build_by_default: program_tests)
3485 'tests/helpers/test_enosys.c',
3486 include_directories : includes,
3487 build_by_default: program_tests)
3490 ############################################################
3492 if conf.get('HAVE_OPENAT').to_string() == '1'
3494 'sample-scols-tree',
3495 'libsmartcols/samples/tree.c',
3496 include_directories : includes,
3497 link_with : [lib_smartcols, lib_common],
3498 build_by_default: program_tests)
3499 if not is_disabler(exe)
3505 'sample-scols-title',
3506 'libsmartcols/samples/title.c',
3507 include_directories : includes,
3508 link_with : [lib_smartcols, lib_common])
3509 if not is_disabler(exe)
3514 'sample-scols-wrap',
3515 'libsmartcols/samples/wrap.c',
3516 include_directories : includes,
3517 link_with : [lib_smartcols, lib_common])
3518 if not is_disabler(exe)
3523 'sample-scols-continuous',
3524 'libsmartcols/samples/continuous.c',
3525 include_directories : includes,
3526 link_with : [lib_smartcols, lib_common])
3527 if not is_disabler(exe)
3532 'sample-scols-continuous-json',
3533 'libsmartcols/samples/continuous-json.c',
3534 include_directories : includes,
3535 link_with : [lib_smartcols, lib_common])
3536 if not is_disabler(exe)
3541 'sample-scols-maxout',
3542 'libsmartcols/samples/maxout.c',
3543 include_directories : includes,
3544 link_with : [lib_smartcols, lib_common])
3545 if not is_disabler(exe)
3550 'sample-scols-fromfile',
3551 'libsmartcols/samples/fromfile.c',
3552 include_directories : includes,
3553 link_with : [lib_smartcols, lib_common])
3554 if not is_disabler(exe)
3559 'sample-scols-grouping-simple',
3560 'libsmartcols/samples/grouping-simple.c',
3561 include_directories : includes,
3562 link_with : [lib_smartcols, lib_common])
3563 if not is_disabler(exe)
3568 'sample-scols-grouping-overlay',
3569 'libsmartcols/samples/grouping-overlay.c',
3570 include_directories : includes,
3571 link_with : [lib_smartcols, lib_common])
3572 if not is_disabler(exe)
3578 'Documentation/boilerplate.c',
3579 include_directories : includes,
3580 build_by_default: program_tests)
3581 if not is_disabler(exe)
3585 ############################################################
3587 # Let the test runner know whether we're running under asan and export
3588 # some paths. We use a file on disk so that it is possible to run the
3589 # test scripts from commandline without setting any variables.
3590 configure_file(output : 'meson.conf',
3595 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3596 python.full_path())])
3598 run_sh = find_program('tests/run.sh')
3602 '--srcdir=' + meson.current_source_dir(),
3603 '--builddir=' + meson.current_build_dir(),
3609 manadocs += ['lib/terminal-colors.d.5.adoc']
3610 manadocs += ['libblkid/libblkid.3.adoc']
3614 'libuuid/man/uuid.3.adoc',
3615 'libuuid/man/uuid_clear.3.adoc',
3616 'libuuid/man/uuid_compare.3.adoc',
3617 'libuuid/man/uuid_copy.3.adoc',
3618 'libuuid/man/uuid_generate.3.adoc',
3619 'libuuid/man/uuid_is_null.3.adoc',
3620 'libuuid/man/uuid_parse.3.adoc',
3621 'libuuid/man/uuid_time.3.adoc',
3622 'libuuid/man/uuid_unparse.3.adoc']
3624 'uuid_generate_random.3': 'uuid_generate.3',
3625 'uuid_generate_time.3': 'uuid_generate.3',
3626 'uuid_generate_time_safe.3': 'uuid_generate.3',
3630 asciidoctor = find_program('asciidoctor', required : false)
3631 if asciidoctor.found()
3632 foreach adoc : manadocs
3633 name = adoc.split('/')[-1]
3634 page = name.split('.adoc')[0]
3635 section = page.split('.')[-1]
3636 mandirn = join_paths(mandir, 'man' + section)
3641 command : [ asciidoctor,
3643 '-a', 'VERSION=' + meson.project_version(),
3644 '-a', 'release-version=' + meson.project_version(),
3645 '-a', 'ADJTIME_PATH=/etc/adjtime',
3646 '-a', 'package-docdir=' + docdir,
3647 '--base-dir=' + meson.current_source_dir(),
3648 '--destination-dir=' + meson.current_build_dir(),
3649 '--load-path', '@SOURCE_ROOT@/tools',
3650 '--require', 'asciidoctor-includetracker',
3654 depfile : page + '.deps',
3656 install_dir : mandirn)
3659 foreach link_name, target : manlinks
3660 link_section = link_name.split('.')[-1]
3661 target_section = target.split('.')[-1]
3662 meson.add_install_script(meson_make_manpage_stub,
3663 join_paths('man' + target_section, target),
3664 join_paths(mandir, 'man' + link_section, link_name))
3668 if bash_completion.found()
3669 foreach completion : bashcompletions
3671 join_paths('bash-completion', completion),
3672 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3675 foreach link_name, target : bashcompletionslinks
3676 meson.add_install_script(meson_make_symlink,
3678 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))