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 # soname versions; This never change because we use symbols versioing. There is also
14 # API version (LIB*_VERSION macros) and it follow package version.
15 libblkid_version = '1.1.0'
16 libblkid_date = '01-Jun-2021'
17 libuuid_version = '1.3.0'
18 liblastlog2_version = '2.0.0'
19 libmount_version = '1.1.0'
20 libsmartcols_version = '1.1.0'
21 libfdisk_version = '1.1.0'
23 prefixdir = get_option('prefix')
24 if not prefixdir.startswith('/')
25 error('Prefix is not absolute: "@0@"'.format(prefixdir))
27 bindir = join_paths(prefixdir, get_option('bindir'))
28 sbindir = join_paths(prefixdir, get_option('sbindir'))
29 sysconfstaticdir = join_paths(prefixdir, 'lib')
30 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
31 mandir = join_paths(prefixdir, get_option('mandir'))
33 localstatedir = '/var'
34 execprefixdir = prefixdir
35 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
36 usrbin_exec_dir = join_paths(execprefixdir, bindir)
37 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
38 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
40 vendordir = get_option('vendordir')
42 add_project_arguments('-D_GNU_SOURCE', language : 'c')
44 cc = meson.get_compiler('c')
46 conf = configuration_data()
47 conf.set_quoted('PACKAGE', meson.project_name())
48 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
49 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
50 conf.set_quoted('PACKAGE_STRING', package_string)
53 pc_version = meson.project_version().split('-')[0].split('.')
55 if pc_version.length() < 3
59 pc_version = '.'.join(pc_version)
61 conf.set_quoted('LIBBLKID_VERSION', pc_version)
62 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
64 conf.set('bindir', bindir)
65 conf.set('sbindir', sbindir)
66 conf.set('runstatedir', runstatedir)
67 conf.set('localstatedir', localstatedir)
68 conf.set('sysconfdir', sysconfdir)
69 conf.set('usrbin_execdir', usrbin_exec_dir)
70 conf.set('usrsbin_execdir', usrsbin_exec_dir)
71 conf.set('docdir', docdir)
72 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
73 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
74 conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir)
75 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
76 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
78 conf.set_quoted('_PATH_VENDORDIR', vendordir)
79 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
81 build_libblkid = not get_option('build-libblkid').disabled()
82 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
83 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
85 build_libuuid = not get_option('build-libuuid').disabled()
86 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
87 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
89 build_liblastlog2 = not get_option('build-liblastlog2').disabled()
90 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
91 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
93 login_lastlogin = get_option('login-lastlogin')
94 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
95 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
97 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
98 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
99 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
101 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
102 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
104 build_libmount = not get_option('build-libmount').disabled()
105 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
106 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
107 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
108 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
110 build_libsmartcols = not get_option('build-libsmartcols').disabled()
111 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
112 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
114 build_libfdisk = not get_option('build-libfdisk').disabled()
115 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
116 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
118 build_uuidd = not get_option('build-uuidd').disabled()
119 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
120 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
122 static_programs = get_option('static-programs')
123 need_static_libs = static_programs.length() > 0 # a rough estimate...
124 summary('static programs', static_programs)
126 LINUX = host_machine.system() in ['linux']
127 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
129 ############################################################
147 have = cc.compiles(code, name : 'wchar_t support')
148 if not have and get_option('widechar').enabled()
149 error('widechar support requested but unavailable')
151 if get_option('ncurses').enabled() and get_option('widechar').enabled()
152 error('widechar support is incompatible with non-wide ncurses')
154 conf.set('HAVE_WIDECHAR', have ? 1 : false)
196 linux/net_namespace.h
210 security/pam_modules.h
243 lib_m = cc.find_library('m')
245 lib_tinfo = dependency(
247 required : get_option('tinfo'))
249 lib_ncursesw = dependency(
251 required : get_option('ncursesw'))
252 if lib_ncursesw.found()
253 headers += ['ncursesw/ncurses.h',
257 lib_ncurses = disabler()
259 lib_ncurses = dependency(
261 required : get_option('ncurses'))
262 headers += ['ncurses.h',
266 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
267 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
268 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
270 lib_slang = dependency(
272 required : get_option('slang'))
274 headers += ['slang.h',
279 conf.set('HAVE_SLANG', lib_slang.found())
281 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
282 if curses_libs.found()
283 have = cc.has_function('use_default_colors', dependencies : curses_libs)
284 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
285 have = cc.has_function('resizeterm', dependencies : curses_libs)
286 conf.set('HAVE_RESIZETERM', have ? 1 : false)
293 required : get_option('zlib'))
295 lib_readline = dependency(
297 required : get_option('readline'))
298 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
300 lib_readline_static = dependency(
303 required : need_static_libs ? get_option('readline') : disabler())
305 if meson.version().version_compare('>= 0.59.0')
306 lib_intl = dependency(
308 required : get_option('nls'))
309 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
311 if get_option('nls').enabled()
312 error('nls is not supported with meson before 0.59.0')
314 lib_intl = dependency('', required : false)
317 lib_user = dependency(
320 required : get_option('libuser'))
321 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
323 lib_util = cc.find_library(
325 required : get_option('libutil'))
326 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
328 lib_utempter = cc.find_library(
330 required : get_option('libutempter'))
331 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
333 systemd = dependency(
335 required : get_option('systemd'))
337 lib_systemd = dependency(
339 required : get_option('systemd'))
340 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
341 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
343 have = cc.has_function(
344 'sd_session_get_username',
345 dependencies : lib_systemd)
346 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
348 lib_udev = dependency(
350 required : get_option('systemd'))
351 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
353 lib_crypt = cc.find_library('crypt')
355 lib_pam = cc.find_library('pam', required : get_option('build-login'))
356 if not lib_pam.found()
357 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
359 if not lib_pam.found()
360 lib_pam = cc.find_library('pam', required : get_option('build-su'))
362 if not lib_pam.found()
363 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
366 lib_pam_misc = cc.find_library('pam_misc')
367 lib_pam = [lib_pam, lib_pam_misc]
369 lib_pam_misc = declare_dependency()
372 lib_cryptsetup = dependency(
374 required : get_option('cryptsetup'))
375 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
377 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
379 if meson.version().version_compare('>= 0.62.0')
380 lib_dl = dependency('dl')
382 lib_dl = cc.find_library('dl')
384 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
385 summary('cryptsetup support (dlopen)',
387 section : 'components')
389 summary('cryptsetup support',
390 lib_cryptsetup.found() ? 'enabled' : 'disabled',
391 section : 'components')
394 have = cc.has_function(
395 'crypt_activate_by_signed_key',
396 dependencies : lib_cryptsetup)
397 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
399 lib_cap_ng = dependency(
401 required : get_option('build-setpriv'))
402 if not lib_cap_ng.found()
403 lib_cap_ng = disabler()
406 lib_selinux = dependency(
409 required : get_option('selinux'))
410 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
412 lib_magic = dependency(
414 required : get_option('magic'))
415 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
417 lib_econf = dependency(
419 required : get_option('econf'))
420 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
422 lib_audit = dependency(
424 required : get_option('audit'))
425 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
427 conf.set('HAVE_SMACK', not get_option('smack').disabled())
429 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
431 foreach header : headers
432 have = cc.has_header(header)
433 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
436 header = 'linux/btrfs.h'
437 enable_btrfs = cc.has_header(header,
438 required : get_option('btrfs'))
439 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
440 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
442 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
447 have = cc.has_header(header,
449 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
452 have = cc.has_header('sched.h')
453 conf.set10('HAVE_DECL_CPU_ALLOC', have)
454 # We get -1 if the size cannot be determined
455 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
456 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
458 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
459 conf.set('HAVE_ENVIRON_DECL', have ? 1 : false)
461 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
462 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
464 have = cc.has_function('strsignal')
465 conf.set10('HAVE_STRSIGNAL_DECL', have)
467 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
468 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
470 have = cc.has_type('loff_t',
471 args : '-D_GNU_SOURCE',
472 prefix : '#include <sys/types.h>')
473 conf.set('HAVE_LOFF_T', have ? 1 : false)
475 have = cc.compiles('''
476 #define _GNU_SOURCE 1
477 #include <langinfo.h>
480 str = nl_langinfo (ALTMON_1);
481 str = nl_langinfo (ALTMON_2);
482 str = nl_langinfo (ALTMON_3);
483 str = nl_langinfo (ALTMON_4);
484 str = nl_langinfo (ALTMON_5);
485 str = nl_langinfo (ALTMON_6);
486 str = nl_langinfo (ALTMON_7);
487 str = nl_langinfo (ALTMON_8);
488 str = nl_langinfo (ALTMON_9);
489 str = nl_langinfo (ALTMON_10);
490 str = nl_langinfo (ALTMON_11);
491 str = nl_langinfo (ALTMON_12);
495 name : 'langinfo.h defines ALTMON_x constants')
496 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
498 have = cc.compiles('''
499 #define _GNU_SOURCE 1
500 #include <langinfo.h>
503 str = nl_langinfo (_NL_ABALTMON_1);
504 str = nl_langinfo (_NL_ABALTMON_2);
505 str = nl_langinfo (_NL_ABALTMON_3);
506 str = nl_langinfo (_NL_ABALTMON_4);
507 str = nl_langinfo (_NL_ABALTMON_5);
508 str = nl_langinfo (_NL_ABALTMON_6);
509 str = nl_langinfo (_NL_ABALTMON_7);
510 str = nl_langinfo (_NL_ABALTMON_8);
511 str = nl_langinfo (_NL_ABALTMON_9);
512 str = nl_langinfo (_NL_ABALTMON_10);
513 str = nl_langinfo (_NL_ABALTMON_11);
514 str = nl_langinfo (_NL_ABALTMON_12);
518 name : 'langinfo.h defines _NL_ABALTMON_x constants')
519 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
521 have = cc.compiles('''
522 #define _GNU_SOURCE 1
523 #include <langinfo.h>
526 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
530 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
531 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
564 landlock_create_ruleset
566 landlock_restrict_self
630 have = cc.has_function(func)
631 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
632 # This makes little sense, but is necessary to avoid warnings about
633 # redefined macros from Python.h, which uses this convention.
634 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
637 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
638 conf.set('AGETTY_RELOAD', have ? 1 : false)
640 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
643 have_dirfd = (cc.has_function('dirfd') or
644 cc.has_header_symbol('dirent.h', 'dirfd',
645 prefix : '#include <sys/types.h>'))
646 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
648 have_ddfd = cc.has_member('DIR', 'dd_fd',
650 #include <sys/types.h>
653 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
655 have = cc.has_member('struct tm', 'tm_gmtoff',
656 args : '-D_GNU_SOURCE',
661 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
665 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
666 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
668 have = cc.has_member('struct termios', 'c_line',
669 prefix : '#include <termios.h>')
670 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
672 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
673 args : '-D_GNU_SOURCE',
674 prefix : '#include <sys/stat.h>')
675 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
677 have = cc.has_member('struct statx', 'stx_mnt_id',
678 prefix : '#include <sys/stat.h>')
679 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
681 # replacement for AC_STRUCT_TIMEZONE
682 have = cc.has_member('struct tm', 'tm_zone',
683 args : '-D_GNU_SOURCE',
684 prefix : '#include <time.h>')
685 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
687 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
688 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
690 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
691 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
693 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
694 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
699 extern char *tzname[];
702 return tzname ? 0 : 1;
704 '''.format(have ? 1 : 0)
705 have = cc.compiles(code, name : 'using tzname[]')
706 conf.set('HAVE_TZNAME', have ? 1 : false)
708 have = cc.sizeof('time_t', prefix : '#include <time.h>')
710 add_global_arguments('-D_TIME_BITS=64', language : 'c')
711 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
713 if get_option('allow-32bit-time')
714 warning('Could not make time_t 64bits wide')
716 error('Could not make time_t 64bits wide')
722 if not cc.has_function('socket')
723 socket_libs += cc.find_library('socket', required : true)
724 have = cc.has_function('socket',
725 dependencies : socket_libs)
727 error('socket() function not available')
731 lib_rt = cc.find_library('rt', required : false)
733 have = cc.has_function('clock_gettime')
736 realtime_libs += lib_rt
737 have = cc.has_function('clock_gettime',
738 dependencies : realtime_libs)
741 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
743 thread_libs = dependency('threads')
745 have = cc.has_function('timer_create')
748 realtime_libs = [lib_rt]
749 have = cc.has_function('timer_create',
750 dependencies : realtime_libs)
753 realtime_libs += thread_libs
754 have = cc.has_function('timer_create',
755 dependencies : realtime_libs)
758 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
760 have = cc.has_function('setitimer')
761 conf.set('HAVE_SETITIMER', have ? 1 : false)
764 rtas_libs = cc.find_library('rtas', required : false)
765 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
768 if not cc.has_header_symbol('math.h', 'isnan')
769 lib = cc.find_library('m', required : true)
770 if (cc.has_function('isnan', dependencies : lib) and
771 cc.has_function('__isnan', dependencies : lib))
776 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
777 args : '-D_GNU_SOURCE')
778 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
781 extern char *__progname;
783 return (*__progname != 0);
786 have = cc.compiles(code, name : 'using __progname')
787 conf.set('HAVE___PROGNAME', have ? 1 : false)
789 have = conf.get('HAVE_PTY_H').to_string() == '1' \
790 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
791 conf.set('HAVE_PTY', have ? 1 : false)
793 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
794 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
796 build_plymouth_support = get_option('build-plymouth-support')
797 have_tiocglcktrmios = cc.has_header_symbol(
798 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
799 required : build_plymouth_support.enabled())
800 have_sock_cloexec = cc.has_header_symbol(
801 'sys/socket.h', 'SOCK_CLOEXEC',
802 prefix : '#include <sys/types.h>',
803 required : build_plymouth_support.enabled())
804 have_sock_nonblock = cc.has_header_symbol(
805 'sys/socket.h', 'SOCK_NONBLOCK',
806 prefix : '#include <sys/types.h>',
807 required : build_plymouth_support.enabled())
808 have_so_passcred = cc.has_header_symbol(
809 'sys/socket.h', 'SO_PASSCRED',
810 args : ['-D_GNU_SOURCE'],
811 prefix : '#include <sys/types.h>',
812 required : build_plymouth_support.enabled())
814 build_plymouth_support = (not build_plymouth_support.disabled() and
815 have_tiocglcktrmios and
816 have_sock_cloexec and
817 have_sock_nonblock and
819 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
820 summary('plymouth support',
821 build_plymouth_support ? 'enabled' : 'disabled',
822 section : 'components')
824 # check for valid fallocate() function
825 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
826 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
827 # and program can't be linked.
835 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
836 return ret == 0 ? 0 : 1;
839 have = cc.links(code, name : 'fallocate() function')
840 conf.set('HAVE_FALLOCATE', have ? 1 : false)
848 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
849 return ret == 0 ? 0 : 1;
852 have = cc.links(code, name : 'posix_fallocate() function')
853 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
855 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
856 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
857 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
859 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
860 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
861 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
863 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
865 ############################################################
868 fs_search_path = get_option('fs-search-path')
869 fs_search_path_extra = get_option('fs-search-path-extra')
870 if fs_search_path_extra != ''
871 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
873 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
875 systemdsystemunitdir = ''
877 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
880 sysvinit = get_option('sysvinit').enabled()
881 sysvinitrcdir = sysconfdir + '/init.d'
883 program_tests = get_option('program-tests')
885 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
886 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
888 have = get_option('chsh-only-listed')
889 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
891 have = get_option('use-tty-group')
892 conf.set('USE_TTY_GROUP', have ? 1 : false)
894 bison = find_program('bison')
895 flex = find_program('flex')
897 build_hwclock = not get_option('build-hwclock').disabled()
898 bison_gen = generator(
900 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
901 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
903 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
904 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
908 configuration : conf)
910 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
915 '-Waddress-of-packed-member',
916 '-Wdiscarded-qualifiers',
917 '-Wembedded-directive',
920 '-Wimplicit-function-declaration',
921 '-Wmissing-declarations',
922 '-Wmissing-parameter-type',
923 '-Wmissing-prototypes',
925 '-Wno-missing-field-initializers',
926 '-Wold-style-definition',
930 '-Wstrict-prototypes',
933 '-Wunused-but-set-parameter',
934 '-Wunused-but-set-variable',
935 '-Wunused-parameter',
941 foreach compiler_flag : compiler_flags
942 if cc.has_argument(compiler_flag)
943 add_project_arguments(compiler_flag, language : 'c')
951 bashcompletionslinks = {}
957 subdir('libsmartcols')
959 subdir('liblastlog2')
961 subdir('pam_lastlog2')
962 subdir('login-utils')
970 includes = [dir_include,
981 opt = not get_option('build-chfn-chsh').disabled()
986 include_directories : includes,
987 link_with : [lib_common, logindefs_c],
988 dependencies : chfn_chsh_deps,
989 install_dir : usrbin_exec_dir,
990 install_mode : 'rwsr-xr-x',
992 build_by_default : opt)
996 'login-utils/chsh.c',
999 include_directories : includes,
1000 link_with : lib_common,
1001 dependencies : chfn_chsh_deps,
1002 install_dir : usrbin_exec_dir,
1003 install_mode : 'rwsr-xr-x',
1005 build_by_default : opt)
1006 if opt and not is_disabler(exe)
1008 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1009 bashcompletions += ['chfn', 'chsh']
1014 test_islocal_sources,
1015 include_directories : includes,
1016 c_args : '-DTEST_PROGRAM',
1017 build_by_default : program_tests)
1022 test_consoles_sources,
1023 c_args : ['-DTEST_PROGRAM'],
1024 include_directories : includes,
1025 link_with : lib_common,
1026 build_by_default : program_tests)
1029 opt = not get_option('build-last').disabled()
1033 include_directories : includes,
1034 link_with : [lib_common],
1035 install_dir : usrbin_exec_dir,
1037 build_by_default : opt)
1038 if opt and not is_disabler(exe)
1040 meson.add_install_script(meson_make_symlink,
1042 join_paths(usrbin_exec_dir, 'lastb'))
1043 manadocs += ['login-utils/last.1.adoc']
1044 manlinks += {'lastb.1': 'last.1'}
1045 bashcompletions += ['last']
1046 bashcompletionslinks += {'lastb': 'last'}
1049 opt = not get_option('build-nologin').disabled()
1052 'login-utils/nologin.c',
1053 include_directories : includes,
1054 install_dir : sbindir,
1055 link_with : [lib_common],
1057 build_by_default : opt)
1058 if opt and not is_disabler(exe)
1060 manadocs += ['login-utils/nologin.8.adoc']
1063 opt = not get_option('build-utmpdump').disabled()
1066 'login-utils/utmpdump.c',
1067 include_directories : includes,
1068 link_with : [lib_common],
1069 install_dir : usrbin_exec_dir,
1071 build_by_default : opt)
1072 if opt and not is_disabler(exe)
1074 manadocs += ['login-utils/utmpdump.1.adoc']
1075 bashcompletions += ['utmpdump']
1078 opt = not get_option('build-su').disabled()
1082 'login-utils/su-common.c',
1083 'login-utils/su-common.h',
1087 include_directories : includes,
1088 link_with : [lib_common, logindefs_c],
1089 dependencies : [lib_pam,
1093 install_mode : 'rwsr-xr-x',
1095 build_by_default : opt)
1096 if opt and not is_disabler(exe)
1098 manadocs += ['login-utils/su.1.adoc']
1099 bashcompletions += ['su']
1102 opt = not get_option('build-newgrp').disabled()
1105 'login-utils/newgrp.c',
1106 include_directories : includes,
1107 dependencies : [lib_crypt],
1108 install_dir : usrbin_exec_dir,
1109 install_mode : 'rwsr-xr-x',
1111 build_by_default : opt)
1112 if opt and not is_disabler(exe)
1114 manadocs += ['login-utils/newgrp.1.adoc']
1115 bashcompletions += ['newgrp']
1118 opt = not get_option('build-lslogins').disabled()
1121 'login-utils/lslogins.c',
1122 include_directories : includes,
1123 link_with : [lib_common,
1126 (build_liblastlog2 ? [lib_lastlog2] : []),
1127 dependencies : [lib_selinux,
1129 install_dir : usrbin_exec_dir,
1131 build_by_default : opt)
1132 if opt and not is_disabler(exe)
1134 manadocs += ['login-utils/lslogins.1.adoc']
1135 bashcompletions += ['lslogins']
1138 opt = not get_option('build-vipw').disabled()
1141 'login-utils/vipw.c',
1142 'login-utils/setpwnam.h',
1143 include_directories : includes,
1144 link_with : [lib_common],
1145 dependencies : [lib_selinux],
1146 install_dir : usrbin_exec_dir,
1148 build_by_default : opt)
1149 if opt and not is_disabler(exe)
1151 meson.add_install_script(meson_make_symlink,
1153 join_paths(usrbin_exec_dir, 'vigr'))
1154 manadocs += ['login-utils/vipw.8.adoc']
1155 meson.add_install_script(meson_make_symlink,
1157 join_paths(mandir, 'man8/vigr.8'))
1160 opt = not get_option('build-runuser').disabled()
1163 'login-utils/runuser.c',
1164 'login-utils/su-common.c',
1165 'login-utils/su-common.h',
1169 include_directories : includes,
1170 link_with : [lib_common, logindefs_c],
1171 dependencies : [lib_pam,
1175 install_dir : sbindir,
1177 build_by_default : opt)
1178 if opt and not is_disabler(exe)
1180 manadocs += ['login-utils/runuser.1.adoc']
1181 bashcompletionslinks += {'runuser': 'su'}
1184 ############################################################
1190 include_directories : includes,
1191 link_with : lib_common,
1192 install_dir : usrbin_exec_dir,
1195 manadocs += ['text-utils/col.1.adoc']
1196 bashcompletions += ['col']
1202 include_directories : includes,
1203 install_dir : usrbin_exec_dir,
1206 manadocs += ['text-utils/colcrt.1.adoc']
1207 bashcompletions += ['colcrt']
1212 include_directories : includes,
1213 link_with : lib_common,
1214 install_dir : usrbin_exec_dir,
1217 manadocs += ['text-utils/colrm.1.adoc']
1218 bashcompletions += ['colrm']
1223 include_directories : includes,
1224 install_dir : usrbin_exec_dir,
1227 manadocs += ['text-utils/rev.1.adoc']
1228 bashcompletions += ['rev']
1233 include_directories : includes,
1234 link_with : [lib_common,
1236 install_dir : usrbin_exec_dir,
1238 if not is_disabler(exe)
1240 manadocs += ['text-utils/column.1.adoc']
1241 bashcompletions += ['column']
1244 opt = not get_option('build-line').disabled()
1248 include_directories : includes,
1249 install_dir : usrbin_exec_dir,
1251 build_by_default : opt)
1252 if opt and not is_disabler(exe)
1254 manadocs += ['text-utils/line.1.adoc']
1257 opt = not get_option('build-pg').disabled()
1261 link_with : lib_common,
1262 include_directories : includes,
1263 dependencies : [lib_tinfo,
1265 install_dir : usrbin_exec_dir,
1267 build_by_default : opt)
1268 if opt and not is_disabler(exe)
1270 manadocs += ['text-utils/pg.1.adoc']
1271 bashcompletions += ['pg']
1274 opt = not get_option('build-ul').disabled()
1278 include_directories : includes,
1279 dependencies : [lib_tinfo,
1281 install_dir : usrbin_exec_dir,
1283 build_by_default : opt)
1284 if opt and not is_disabler(exe)
1286 manadocs += ['text-utils/ul.1.adoc']
1287 bashcompletions += ['ul']
1290 opt = not get_option('build-more').disabled()
1294 link_with : [lib_common],
1295 include_directories : includes,
1296 dependencies : [lib_tinfo,
1300 build_by_default : opt)
1304 link_with : [lib_common],
1305 include_directories : includes,
1306 c_args : '-DTEST_PROGRAM',
1307 dependencies : [lib_tinfo,
1310 build_by_default : opt and program_tests)
1312 if opt and not is_disabler(exe)
1314 manadocs += ['text-utils/more.1.adoc']
1315 bashcompletions += ['more']
1321 include_directories : includes,
1322 link_with : [lib_common,
1324 install_dir : usrbin_exec_dir,
1326 if not is_disabler(exe)
1328 manadocs += ['text-utils/hexdump.1.adoc']
1329 bashcompletions += ['hexdump']
1332 opt = not get_option('build-lsmem').disabled()
1336 include_directories : includes,
1337 link_with : [lib_common,
1339 install_dir : usrbin_exec_dir,
1341 build_by_default : opt)
1342 if opt and not is_disabler(exe)
1344 manadocs += ['sys-utils/lsmem.1.adoc']
1345 bashcompletions += ['lsmem']
1348 opt = not get_option('build-chmem').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/chmem.8.adoc']
1360 bashcompletions += ['chmem']
1366 include_directories : includes,
1367 link_with : [lib_common],
1368 install_dir : usrbin_exec_dir,
1371 manadocs += ['sys-utils/choom.1.adoc']
1376 include_directories : includes,
1377 link_with : [lib_common],
1378 install_dir : usrbin_exec_dir,
1381 manadocs += ['sys-utils/ipcmk.1.adoc']
1382 bashcompletions += ['ipcmk']
1387 include_directories : includes,
1388 link_with : [lib_common],
1389 install_dir : usrbin_exec_dir,
1392 manadocs += ['sys-utils/ipcrm.1.adoc']
1393 bashcompletions += ['ipcrm']
1395 opt = not get_option('build-ipcs').disabled()
1399 include_directories : includes,
1400 link_with : [lib_common],
1401 install_dir : usrbin_exec_dir,
1403 build_by_default : opt)
1404 if opt and not is_disabler(exe)
1406 manadocs += ['sys-utils/ipcs.1.adoc']
1407 bashcompletions += ['ipcs']
1410 opt = not get_option('build-rfkill').disabled()
1414 include_directories : includes,
1415 link_with : [lib_common,
1417 install_dir : usrsbin_exec_dir,
1419 build_by_default : opt)
1420 if opt and not is_disabler(exe)
1422 manadocs += ['sys-utils/rfkill.8.adoc']
1423 bashcompletions += ['rfkill']
1429 include_directories : includes,
1430 link_with : [lib_common,
1432 install_dir : usrbin_exec_dir,
1434 if not is_disabler(exe)
1436 manadocs += ['sys-utils/renice.1.adoc']
1437 bashcompletions += ['renice']
1443 include_directories: includes,
1444 link_with : [lib_common,
1446 install_dir : usrbin_exec_dir,
1448 if opt and not is_disabler(exe)
1450 manadocs += ['sys-utils/setpgid.1.adoc']
1451 bashcompletions += ['setpgid']
1457 include_directories : includes,
1458 link_with : [lib_common,
1460 install_dir : usrbin_exec_dir,
1462 if opt and not is_disabler(exe)
1464 manadocs += ['sys-utils/setsid.1.adoc']
1465 bashcompletions += ['setsid']
1470 readprofile_sources,
1471 include_directories : includes,
1472 link_with : [lib_common,
1474 install_dir : usrsbin_exec_dir,
1476 if not is_disabler(exe)
1478 manadocs += ['sys-utils/readprofile.8.adoc']
1479 bashcompletions += ['readprofile']
1482 opt = not get_option('build-tunelp').disabled()
1486 include_directories : includes,
1487 link_with : [lib_common],
1488 install_dir : usrsbin_exec_dir,
1490 build_by_default : opt)
1491 if opt and not is_disabler(exe)
1493 manadocs += ['sys-utils/tunelp.8.adoc']
1494 bashcompletions += ['tunelp']
1500 include_directories : includes,
1501 link_with : [lib_common,
1503 install_dir : sbindir,
1505 if not is_disabler(exe)
1507 manadocs += ['sys-utils/fstrim.8.adoc']
1508 bashcompletions += ['fstrim']
1514 include_directories : includes,
1515 link_with : [lib_common,
1518 if not is_disabler(exe)
1520 manadocs += ['sys-utils/dmesg.1.adoc']
1521 bashcompletions += ['dmesg']
1527 include_directories : dir_include,
1528 c_args : '-DTEST_DMESG',
1529 link_with : [lib_common,
1531 build_by_default : program_tests)
1532 if not is_disabler(exe)
1539 include_directories : includes,
1540 link_with : [lib_common],
1541 install_dir : sbindir,
1544 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1545 bashcompletions += ['ctrlaltdel']
1550 include_directories : includes,
1551 install_dir : sbindir,
1554 manadocs += ['sys-utils/fsfreeze.8.adoc']
1555 bashcompletions += ['fsfreeze']
1560 include_directories : includes,
1561 link_with : [lib_common,
1563 install_dir : sbindir,
1566 manadocs += ['sys-utils/blkdiscard.8.adoc']
1567 bashcompletions += ['blkdiscard']
1569 if cc.has_header('linux/blkzoned.h')
1573 include_directories : includes,
1574 link_with : [lib_common],
1575 install_dir : sbindir,
1578 manadocs += ['sys-utils/blkzone.8.adoc']
1579 bashcompletions += ['blkzone']
1582 if cc.has_header('linux/pr.h')
1586 include_directories : includes,
1587 link_with : [lib_common],
1588 install_dir : sbindir,
1591 manadocs += ['sys-utils/blkpr.8.adoc']
1597 include_directories : includes,
1598 link_with : [lib_common],
1599 install_dir : usrsbin_exec_dir,
1602 manadocs += ['sys-utils/ldattach.8.adoc']
1603 bashcompletions += ['ldattach']
1608 include_directories : includes,
1609 link_with : [lib_common],
1610 install_dir : usrsbin_exec_dir,
1613 manadocs += ['sys-utils/rtcwake.8.adoc']
1614 bashcompletions += ['rtcwake']
1619 include_directories : includes,
1620 link_with : [lib_common],
1621 install_dir : usrbin_exec_dir,
1624 manadocs += ['sys-utils/setarch.8.adoc']
1625 bashcompletions += ['setarch']
1627 setarch_links = ['uname26', 'linux32', 'linux64']
1628 setarch_links_arch = {
1629 's390x' : ['s390', 's390x'],
1631 'x86_64' : ['i386', 'x86_64'],
1632 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1633 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1634 'mips64' : ['mips', 'mips64', 'mips32'],
1635 'ia64' : ['i386', 'ia64'],
1636 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1638 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1640 foreach link: setarch_links
1641 meson.add_install_script(meson_make_symlink,
1643 join_paths(usrbin_exec_dir, link))
1644 manlinks += {link + '.8': 'setarch.8'}
1647 opt = not get_option('build-eject').disabled()
1651 include_directories : includes,
1652 link_with : [lib_common,
1654 install_dir : usrbin_exec_dir,
1656 build_by_default : opt)
1657 if opt and not is_disabler(exe)
1659 manadocs += ['sys-utils/eject.1.adoc']
1660 bashcompletions += ['eject']
1663 opt = not get_option('build-losetup').disabled()
1667 include_directories : includes,
1668 link_with : [lib_common,
1670 install_dir : sbindir,
1672 build_by_default : opt)
1673 if opt and not is_disabler(exe)
1674 manadocs += ['sys-utils/losetup.8.adoc']
1676 bashcompletions += ['losetup']
1679 opt = opt and 'losetup' in static_programs
1683 include_directories : includes,
1684 link_args : ['--static'],
1685 link_with : [lib_common,
1686 lib_smartcols.get_static_lib()],
1687 install_dir : sbindir,
1689 build_by_default : opt)
1690 if opt and not is_disabler(exe)
1694 opt = not get_option('build-zramctl').disabled()
1698 include_directories : includes,
1699 link_with : [lib_common,
1701 install_dir : sbindir,
1703 build_by_default : opt)
1704 if opt and not is_disabler(exe)
1706 manadocs += ['sys-utils/zramctl.8.adoc']
1707 bashcompletions += ['zramctl']
1713 include_directories : includes,
1714 link_with : [lib_common,
1716 install_dir : usrbin_exec_dir,
1718 if not is_disabler(exe)
1720 manadocs += ['sys-utils/prlimit.1.adoc']
1721 bashcompletions += ['prlimit']
1727 include_directories : includes,
1728 link_with : [lib_common,
1731 install_dir : usrbin_exec_dir,
1733 if not is_disabler(exe)
1735 manadocs += ['sys-utils/lsns.8.adoc']
1736 bashcompletions += ['lsns']
1739 opt = not get_option('build-mount').disabled()
1743 include_directories : includes,
1744 link_with : [lib_common,
1747 dependencies : lib_selinux,
1748 install_mode : 'rwsr-xr-x',
1750 build_by_default : opt)
1754 include_directories : includes,
1755 link_with : [lib_common,
1757 install_mode : 'rwsr-xr-x',
1759 build_by_default : opt)
1760 if opt and not is_disabler(exe)
1762 manadocs += ['sys-utils/fstab.5.adoc',
1763 'sys-utils/mount.8.adoc',
1764 'sys-utils/umount.8.adoc']
1765 bashcompletions += ['mount', 'umount']
1768 opt2 = opt and 'mount' in static_programs
1772 include_directories : includes,
1773 link_args : ['--static'],
1774 link_with : [lib_common,
1775 lib_smartcols_static,
1778 build_by_default : opt2)
1779 if opt2 and not is_disabler(exe)
1783 opt2 = opt and 'umount' in static_programs
1787 include_directories : includes,
1788 link_args : ['--static'],
1789 link_with : [lib_common,
1792 build_by_default : opt2)
1793 if opt2 and not is_disabler(exe)
1802 include_directories : includes,
1803 link_with : [lib_common,
1807 install_dir : sbindir,
1809 if not is_disabler(exe)
1811 manadocs += ['sys-utils/swapon.8.adoc']
1812 bashcompletions += ['swapon']
1818 include_directories : includes,
1819 link_with : [lib_common,
1822 install_dir : sbindir,
1824 if not is_disabler(exe)
1826 manlinks += {'swapoff.8': 'swapon.8'}
1827 bashcompletions += ['swapoff']
1833 include_directories : includes,
1834 link_with : [lib_common,
1836 dependencies : [rtas_libs],
1837 install_dir : usrbin_exec_dir,
1839 if not is_disabler(exe)
1841 manadocs += ['sys-utils/lscpu.1.adoc']
1842 bashcompletions += ['lscpu']
1848 include_directories : includes,
1849 link_with : [lib_common],
1850 install_dir : sbindir,
1853 manadocs += ['sys-utils/chcpu.8.adoc']
1854 bashcompletions += ['chcpu']
1859 include_directories : includes,
1860 link_with : [lib_common,
1863 if not is_disabler(exe)
1865 manadocs += ['sys-utils/wdctl.8.adoc']
1866 bashcompletions += ['wdctl']
1869 opt = not get_option('build-mountpoint').disabled()
1873 include_directories : includes,
1874 link_with : [lib_mount],
1876 build_by_default : opt)
1877 if opt and not is_disabler(exe)
1879 manadocs += ['sys-utils/mountpoint.1.adoc']
1880 bashcompletions += ['mountpoint']
1883 opt = not get_option('build-fallocate').disabled()
1887 include_directories : includes,
1888 link_with : [lib_common],
1889 install_dir : usrbin_exec_dir,
1891 build_by_default : opt)
1892 if opt and not is_disabler(exe)
1894 manadocs += ['sys-utils/fallocate.1.adoc']
1895 bashcompletions += ['fallocate']
1898 opt = not get_option('build-pivot_root').disabled()
1902 include_directories : includes,
1903 install_dir : sbindir,
1905 build_by_default : opt)
1906 if opt and not is_disabler(exe)
1908 manadocs += ['sys-utils/pivot_root.8.adoc']
1909 bashcompletions += ['pivot_root']
1912 opt = not get_option('build-switch_root').disabled()
1913 if opt and not have_dirfd and not have_ddfd
1914 error('neither dirfd nor ddfd are available')
1918 switch_root_sources,
1919 include_directories : includes,
1920 install_dir : sbindir,
1922 build_by_default : opt)
1923 if opt and not is_disabler(exe)
1925 manadocs += ['sys-utils/switch_root.8.adoc']
1928 opt = not get_option('build-unshare').disabled()
1932 include_directories : includes,
1933 link_with : [lib_common],
1934 install_dir : usrbin_exec_dir,
1936 build_by_default : opt)
1937 if opt and not is_disabler(exe)
1939 manadocs += ['sys-utils/unshare.1.adoc']
1940 bashcompletions += ['unshare']
1943 opt = opt and 'unshare' in static_programs
1947 include_directories : includes,
1948 link_with : [lib_common],
1949 install_dir : usrbin_exec_dir,
1951 build_by_default : opt)
1952 if opt and not is_disabler(exe)
1956 opt = not get_option('build-nsenter').disabled()
1960 include_directories : includes,
1961 link_with : [lib_common],
1962 dependencies : [lib_selinux],
1963 install_dir : usrbin_exec_dir,
1965 build_by_default : opt)
1966 if opt and not is_disabler(exe)
1968 manadocs += ['sys-utils/nsenter.1.adoc']
1969 bashcompletions += ['nsenter']
1972 opt = opt and 'nsenter' in static_programs
1976 include_directories : includes,
1977 link_with : [lib_common],
1978 dependencies : [lib_selinux],
1979 install_dir : usrbin_exec_dir,
1981 build_by_default : opt)
1982 if opt and not is_disabler(exe)
1986 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1990 include_directories : includes,
1991 link_with : [lib_common],
1992 dependencies : [lib_cap_ng],
1993 install_dir : usrbin_exec_dir,
1995 build_by_default : opt)
1996 if opt and not is_disabler(exe)
1998 manadocs += ['sys-utils/setpriv.1.adoc']
1999 bashcompletions += ['setpriv']
2005 include_directories : includes,
2006 link_with : [lib_common],
2007 dependencies : realtime_libs,
2008 install_dir : usrbin_exec_dir,
2011 manadocs += ['sys-utils/flock.1.adoc']
2012 bashcompletions += ['flock']
2014 opt = not get_option('build-lsirq').disabled()
2018 include_directories : includes,
2019 link_with : [lib_common,
2021 install_dir : usrbin_exec_dir,
2023 build_by_default : opt)
2024 if opt and not is_disabler(exe)
2026 manadocs += ['sys-utils/lsirq.1.adoc']
2027 bashcompletions += ['lsirq']
2030 opt = not get_option('build-irqtop').disabled()
2034 include_directories : includes,
2035 dependencies : [realtime_libs, curses_libs],
2036 link_with : [lib_common,
2039 install_dir : usrbin_exec_dir,
2041 build_by_default : opt)
2042 if opt and not is_disabler(exe)
2044 manadocs += ['sys-utils/irqtop.1.adoc']
2045 bashcompletions += ['irqtop']
2048 opt = not get_option('build-ipcs').disabled()
2052 include_directories : includes,
2053 link_with : [lib_common,
2055 install_dir : usrbin_exec_dir,
2057 build_by_default : opt)
2058 if opt and not is_disabler(exe)
2060 manadocs += ['sys-utils/lsipc.1.adoc']
2061 bashcompletions += ['lsipc']
2068 include_directories : includes,
2069 link_with : [lib_common],
2070 dependencies : [lib_m,
2072 install_dir : sbindir,
2074 build_by_default : opt)
2075 if opt and not is_disabler(exe)
2077 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2078 bashcompletions += ['hwclock']
2084 include_directories : includes,
2085 install_dir : sbindir,
2088 manadocs += ['disk-utils/mkfs.8.adoc']
2089 bashcompletions += ['mkfs']
2091 opt = not get_option('build-bfs').disabled()
2095 include_directories : includes,
2096 link_with : [lib_common],
2097 install_dir : sbindir,
2099 build_by_default : opt)
2100 if opt and not is_disabler(exe)
2102 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2103 bashcompletions += ['mkfs.bfs']
2109 include_directories : includes,
2110 link_with : [lib_common],
2111 install_dir : usrbin_exec_dir,
2114 manadocs += ['disk-utils/isosize.8.adoc']
2115 bashcompletions += ['isosize']
2120 include_directories : includes,
2121 link_with : [lib_common,
2124 dependencies: [lib_selinux],
2125 install_dir : sbindir,
2127 if not is_disabler(exe)
2129 manadocs += ['disk-utils/mkswap.8.adoc']
2130 bashcompletions += ['mkswap']
2136 include_directories : includes,
2137 link_with : [lib_common,
2140 install_dir : sbindir,
2142 if not is_disabler(exe)
2144 manadocs += ['disk-utils/swaplabel.8.adoc']
2145 bashcompletions += ['swaplabel']
2148 opt = not get_option('build-fsck').disabled()
2152 include_directories : includes,
2153 link_with : [lib_common,
2156 dependencies : realtime_libs,
2157 install_dir : sbindir,
2159 build_by_default : opt)
2160 if opt and not is_disabler(exe)
2162 manadocs += ['disk-utils/fsck.8.adoc']
2163 bashcompletions += ['fsck']
2166 opt = not get_option('build-minix').disabled()
2170 include_directories : includes,
2171 link_with : [lib_common],
2172 install_dir : sbindir,
2174 build_by_default : opt)
2178 include_directories : includes,
2179 c_args : '-DTEST_SCRIPT',
2180 link_with : [lib_common],
2181 build_by_default : opt and program_tests)
2185 include_directories : includes,
2186 link_with : [lib_common],
2187 install_dir : sbindir,
2189 build_by_default : opt)
2190 if opt and not is_disabler(exe)
2191 exes += [exe, exe2, exe3]
2192 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2193 bashcompletions += ['mkfs.minix', 'fsck.minix']
2196 opt = not get_option('build-cramfs').disabled()
2199 mkfs_cramfs_sources,
2200 include_directories : includes,
2201 link_with : [lib_common],
2202 dependencies : [lib_z],
2203 install_dir : sbindir,
2205 build_by_default : opt)
2208 fsck_cramfs_sources,
2209 include_directories : includes,
2210 link_with : [lib_common],
2211 dependencies : [lib_z],
2212 install_dir : sbindir,
2214 build_by_default : opt)
2215 if not is_disabler(exe)
2217 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2218 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2221 opt = not get_option('build-raw').disabled()
2223 cc.has_header('linux/raw.h', required: opt)
2228 include_directories : includes,
2229 install_dir : sbindir,
2231 build_by_default : opt)
2232 if opt and not is_disabler(exe)
2234 manadocs += ['disk-utils/raw.8.adoc']
2235 bashcompletions += ['raw']
2238 opt = not get_option('build-fdformat').disabled()
2242 include_directories : includes,
2243 link_with : [lib_common],
2244 install_dir : usrsbin_exec_dir,
2246 build_by_default : opt)
2247 if opt and not is_disabler(exe)
2249 manadocs += ['disk-utils/fdformat.8.adoc']
2250 bashcompletions += ['fdformat']
2256 include_directories : includes,
2257 link_with : [lib_common],
2258 install_dir : sbindir,
2260 manadocs += ['disk-utils/blockdev.8.adoc']
2261 bashcompletions += ['blockdev']
2263 opt = not get_option('build-fdisks').disabled()
2264 if opt and not have_dirfd and not have_ddfd
2265 error('neither dirfd nor ddfd are available')
2270 include_directories : includes,
2271 link_with : [lib_common,
2275 dependencies : [lib_readline],
2276 install_dir : sbindir,
2278 build_by_default : opt)
2279 if opt and not is_disabler(exe)
2281 bashcompletions += ['fdisk']
2284 opt2 = opt and 'fdisk' in static_programs
2288 link_args : ['--static'],
2289 include_directories : includes,
2290 link_with : [lib_common,
2293 lib_smartcols.get_static_lib()],
2294 dependencies : [lib_readline_static],
2295 install_dir : sbindir,
2297 build_by_default : opt2)
2298 if opt2 and not is_disabler(exe)
2305 include_directories : includes,
2306 link_with : [lib_common,
2310 dependencies : [lib_readline],
2311 install_dir : sbindir,
2313 build_by_default : opt)
2314 if opt and not is_disabler(exe)
2316 bashcompletions += ['sfdisk']
2319 opt2 = opt and 'sfdisk' in static_programs
2323 include_directories : includes,
2324 link_with : [lib_common,
2327 lib_smartcols.get_static_lib()],
2328 dependencies : [lib_readline_static],
2329 install_dir : sbindir,
2331 build_by_default : opt2)
2332 if opt2 and not is_disabler(exe)
2339 include_directories : includes,
2340 link_with : [lib_common,
2345 dependencies : [curses_libs],
2346 install_dir : sbindir,
2348 build_by_default : opt)
2349 if opt and not is_disabler(exe)
2351 manadocs += ['disk-utils/fdisk.8.adoc',
2352 'disk-utils/sfdisk.8.adoc',
2353 'disk-utils/cfdisk.8.adoc']
2354 bashcompletions += ['cfdisk']
2357 opt = not get_option('build-partx').disabled()
2361 include_directories : includes,
2362 link_with : [lib_common],
2363 install_dir : usrsbin_exec_dir,
2365 build_by_default : opt)
2369 include_directories : includes,
2370 link_with : [lib_common],
2371 install_dir : usrsbin_exec_dir,
2373 build_by_default : opt)
2377 include_directories : includes,
2378 link_with : [lib_common],
2379 install_dir : usrsbin_exec_dir,
2381 build_by_default : opt)
2385 include_directories : includes,
2386 link_with : [lib_common,
2389 install_dir : usrsbin_exec_dir,
2391 build_by_default : opt)
2393 exes += [exe, exe2, exe3, exe4]
2394 manadocs += ['disk-utils/addpart.8.adoc',
2395 'disk-utils/delpart.8.adoc',
2396 'disk-utils/resizepart.8.adoc',
2397 'disk-utils/partx.8.adoc']
2398 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2401 ############################################################
2406 include_directories : includes,
2407 link_with : [lib_common],
2408 dependencies : [lib_util,
2412 install_dir : usrbin_exec_dir,
2415 manadocs += ['term-utils/script.1.adoc']
2416 bashcompletions += ['script']
2421 include_directories : includes,
2422 c_args : '-DTEST_SCRIPT',
2423 link_with : [lib_common],
2424 dependencies : [lib_util,
2428 build_by_default : program_tests)
2434 include_directories : includes,
2435 link_with : [lib_common],
2436 dependencies : [lib_util,
2439 install_dir : usrbin_exec_dir,
2442 manadocs += ['term-utils/scriptlive.1.adoc']
2443 bashcompletions += ['scriptlive']
2447 scriptreplay_sources,
2448 include_directories : includes,
2449 link_with : [lib_common],
2450 dependencies : [math_libs],
2451 install_dir : usrbin_exec_dir,
2454 manadocs += ['term-utils/scriptreplay.1.adoc']
2455 bashcompletions += ['scriptreplay']
2457 opt = not get_option('build-agetty').disabled()
2461 include_directories : includes,
2462 link_with : [lib_common, logindefs_c],
2463 dependencies : [BSD ? lib_util : [], lib_systemd],
2464 install_dir : sbindir,
2466 build_by_default : opt)
2469 manadocs += ['term-utils/agetty.8.adoc']
2472 opt = not get_option('build-setterm').disabled()
2476 include_directories : includes,
2477 link_with : [lib_common],
2478 dependencies : [curses_libs],
2479 install_dir : usrbin_exec_dir,
2481 build_by_default : opt)
2484 manadocs += ['term-utils/setterm.1.adoc']
2485 bashcompletions += ['setterm']
2488 opt = not get_option('build-mesg').disabled()
2492 include_directories : includes,
2493 link_with : [lib_common],
2494 install_dir : usrbin_exec_dir,
2496 build_by_default : opt)
2499 manadocs += ['term-utils/mesg.1.adoc']
2500 bashcompletions += ['mesg']
2503 opt = not get_option('build-wall').disabled()
2507 include_directories : includes,
2508 link_with : [lib_common],
2509 dependencies : [lib_systemd],
2510 install_dir : usrbin_exec_dir,
2511 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2513 build_by_default : opt)
2516 manadocs += ['term-utils/wall.1.adoc']
2517 bashcompletions += ['wall']
2520 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2521 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2523 opt = not get_option('build-write').disabled()
2527 include_directories : includes,
2528 link_with : [lib_common],
2529 dependencies : [lib_systemd],
2530 install_dir : usrbin_exec_dir,
2531 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2533 build_by_default : opt)
2536 manadocs += ['term-utils/write.1.adoc']
2537 bashcompletions += ['write']
2540 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2541 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2543 opt = not get_option('build-login').disabled()
2547 include_directories : includes,
2548 link_with : [lib_common, logindefs_c],
2549 dependencies : [lib_pam,
2553 build_by_default : opt)
2554 if not is_disabler(exe)
2556 manadocs += ['login-utils/login.1.adoc']
2559 opt = not get_option('build-sulogin').disabled()
2563 include_directories : includes,
2564 link_with : [lib_common],
2565 dependencies : [lib_crypt,
2567 install_dir : sbindir,
2569 build_by_default : opt)
2570 if not is_disabler(exe)
2572 manadocs += ['login-utils/sulogin.8.adoc']
2578 include_directories : includes,
2579 link_with : [lib_common,
2581 dependencies : [curses_libs],
2582 install_dir : usrbin_exec_dir,
2585 manadocs += ['misc-utils/cal.1.adoc']
2586 bashcompletions += ['cal']
2588 opt = not get_option('build-logger').disabled()
2592 include_directories : includes,
2593 link_with : [lib_common],
2594 dependencies : [lib_systemd],
2595 install_dir : usrbin_exec_dir,
2597 build_by_default : opt)
2598 if opt and not is_disabler(exe)
2600 manadocs += ['misc-utils/logger.1.adoc']
2601 bashcompletions += ['logger']
2607 include_directories : includes,
2608 c_args : '-DTEST_LOGGER',
2609 link_with : [lib_common],
2610 dependencies : [lib_systemd],
2611 build_by_default: program_tests)
2612 if not is_disabler(exe)
2619 include_directories : includes,
2620 install_dir : usrbin_exec_dir,
2623 manadocs += ['misc-utils/look.1.adoc']
2624 bashcompletions += ['look']
2629 include_directories : includes,
2630 link_with : [lib_common],
2631 install_dir : usrbin_exec_dir,
2634 manadocs += ['misc-utils/mcookie.1.adoc']
2635 bashcompletions += ['mcookie']
2637 if build_liblastlog2
2641 include_directories : includes,
2642 link_with : [lib_common, lib_lastlog2],
2643 install_dir : usrbin_exec_dir,
2646 manadocs += ['misc-utils/lastlog2.8.adoc']
2647 bashcompletions += ['lastlog2']
2648 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2649 'liblastlog2/man/ll2_write_entry.3.adoc',
2650 'liblastlog2/man/ll2_read_entry.3.adoc',
2651 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2652 'liblastlog2/man/ll2_read_all.3.adoc',
2653 'liblastlog2/man/ll2_remove_entry.3.adoc',
2654 'liblastlog2/man/ll2_rename_user.3.adoc',
2655 'liblastlog2/man/ll2_update_login_time.3.adoc'
2662 include_directories : includes,
2663 dependencies : [lib_selinux],
2664 install_dir : usrbin_exec_dir,
2667 manadocs += ['misc-utils/namei.1.adoc']
2668 bashcompletions += ['namei']
2673 include_directories : includes,
2674 link_with : [lib_common],
2675 install_dir : usrbin_exec_dir,
2678 manadocs += ['misc-utils/whereis.1.adoc']
2679 bashcompletions += ['whereis']
2684 include_directories : includes,
2685 link_with : [lib_common,
2688 install_dir : usrbin_exec_dir,
2690 if not is_disabler(exe)
2692 manadocs += ['misc-utils/lslocks.8.adoc']
2693 bashcompletions += ['lslocks']
2699 include_directories : includes,
2700 link_with : [lib_common,
2705 dependencies : lib_udev,
2707 if not is_disabler(exe)
2709 manadocs += ['misc-utils/lsblk.8.adoc']
2710 bashcompletions += ['lsblk']
2713 errnos_h = custom_target('errnos.h',
2714 input : 'tools/all_errnos',
2715 output : 'errnos.h',
2716 command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
2719 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2722 lsfd_sources, errnos_h,
2723 include_directories : includes,
2724 link_with : [lib_common,
2726 dependencies : [lib_rt],
2727 install_dir : usrbin_exec_dir,
2729 build_by_default : opt)
2730 if opt and not is_disabler(exe)
2732 manadocs += ['misc-utils/lsfd.1.adoc']
2738 include_directories : includes,
2739 link_with : [lib_common,
2741 install_dir : usrbin_exec_dir,
2743 if not is_disabler(exe)
2745 manadocs += ['misc-utils/uuidgen.1.adoc']
2746 bashcompletions += ['uuidgen']
2752 include_directories : includes,
2753 link_with : [lib_common,
2756 install_dir : usrbin_exec_dir,
2758 if not is_disabler(exe)
2760 manadocs += ['misc-utils/uuidparse.1.adoc']
2761 bashcompletions += ['uuidparse']
2768 include_directories : includes,
2769 link_with : [lib_common,
2771 dependencies : [realtime_libs,
2773 install_dir : usrsbin_exec_dir,
2775 build_by_default : opt)
2779 include_directories : includes,
2780 link_with : [lib_common,
2782 dependencies : thread_libs,
2783 build_by_default : opt and program_tests)
2784 if not is_disabler(exe)
2786 manadocs += ['misc-utils/uuidd.8.adoc']
2787 bashcompletions += ['uuidd']
2790 opt = build_libblkid
2794 include_directories : includes,
2795 link_with : [lib_common,
2797 install_dir : sbindir,
2799 build_by_default : opt)
2800 if opt and not is_disabler(exe)
2802 manadocs += ['misc-utils/blkid.8.adoc']
2803 bashcompletions += ['blkid']
2806 opt = opt and 'blkid' in static_programs
2810 include_directories : includes,
2811 link_with : [lib_common,
2813 install_dir : sbindir,
2815 build_by_default : opt)
2816 if opt and not is_disabler(exe)
2822 'libblkid/samples/mkfs.c',
2823 include_directories : includes,
2824 link_with : lib_blkid)
2825 if not is_disabler(exe)
2830 'sample-partitions',
2831 'libblkid/samples/partitions.c',
2832 include_directories : includes,
2833 link_with : lib_blkid)
2834 if not is_disabler(exe)
2839 'sample-superblocks',
2840 'libblkid/samples/superblocks.c',
2841 include_directories : includes,
2842 link_with : lib_blkid)
2843 if not is_disabler(exe)
2849 'libblkid/samples/topology.c',
2850 include_directories : includes,
2851 link_with : lib_blkid)
2852 if not is_disabler(exe)
2857 'test_blkid_fuzz_sample',
2858 'libblkid/src/fuzz.c',
2859 include_directories: includes,
2860 link_with: lib_blkid,
2861 build_by_default: program_tests)
2862 if not is_disabler(exe)
2866 ############################################################
2871 include_directories : includes,
2872 link_with : [lib_blkid],
2873 install_dir : sbindir,
2875 if not is_disabler(exe)
2877 manadocs += ['misc-utils/findfs.8.adoc']
2878 bashcompletions += ['findfs']
2884 include_directories : includes,
2885 link_with : [lib_common,
2888 install_dir : sbindir,
2890 if not is_disabler(exe)
2892 manadocs += ['misc-utils/wipefs.8.adoc']
2893 bashcompletions += ['wipefs']
2899 include_directories : includes,
2900 link_with : [lib_common,
2904 dependencies : [lib_udev],
2906 if not is_disabler(exe)
2908 manadocs += ['misc-utils/findmnt.8.adoc']
2909 bashcompletions += ['findmnt']
2915 include_directories : includes,
2916 link_with : [lib_common],
2918 if not is_disabler(exe)
2920 manadocs += ['misc-utils/kill.1.adoc']
2923 opt = not get_option('build-rename').disabled()
2927 include_directories : includes,
2928 install_dir : usrbin_exec_dir,
2930 build_by_default : opt)
2931 if opt and not is_disabler(exe)
2933 manadocs += ['misc-utils/rename.1.adoc']
2934 bashcompletions += ['rename']
2940 include_directories : includes,
2941 link_with : [lib_common],
2942 install_dir : usrbin_exec_dir,
2945 manadocs += ['misc-utils/getopt.1.adoc']
2946 bashcompletions += ['getopt']
2951 include_directories : includes,
2952 link_with : [lib_common,
2954 install_dir : usrbin_exec_dir,
2956 if not is_disabler(exe)
2958 manadocs += ['misc-utils/fincore.1.adoc']
2959 bashcompletions += ['fincore']
2965 include_directories : includes,
2966 link_with : [lib_common],
2967 install_dir : usrbin_exec_dir,
2969 if not is_disabler(exe)
2971 manadocs += ['misc-utils/hardlink.1.adoc']
2972 bashcompletions += ['hardlink']
2975 opt = not get_option('build-pipesz').disabled()
2979 include_directories : includes,
2980 link_with : [lib_common],
2981 install_dir : usrbin_exec_dir,
2983 if opt and not is_disabler(exe)
2985 manadocs += ['misc-utils/pipesz.1.adoc']
2986 bashcompletions += ['pipesz']
2992 include_directories : includes,
2993 c_args : '-DTEST_CAL',
2994 link_with : [lib_common,
2996 dependencies : [curses_libs],
2997 build_by_default: program_tests)
2998 if not is_disabler(exe)
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/fadvise.1.adoc']
3012 bashcompletions += ['fadvise']
3015 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3019 include_directories : includes,
3020 link_with : [lib_common],
3021 install_dir : usrbin_exec_dir,
3023 if not is_disabler(exe)
3025 manadocs += ['misc-utils/waitpid.1.adoc']
3026 bashcompletions += ['waitpid']
3030 syscalls_h = custom_target('syscalls.h',
3031 input : 'tools/all_syscalls',
3032 output : 'syscalls.h',
3033 command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
3036 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3039 'misc-utils/enosys.c', syscalls_h, errnos_h,
3040 include_directories : includes,
3041 link_with : [lib_common],
3042 install_dir : usrbin_exec_dir,
3044 if not is_disabler(exe)
3046 manadocs += ['misc-utils/enosys.1.adoc']
3047 bashcompletions += ['enosys']
3054 include_directories : includes,
3055 link_with : [lib_common, lib_smartcols],
3056 install_dir : usrbin_exec_dir,
3058 if not is_disabler(exe)
3060 manadocs += ['misc-utils/lsclocks.1.adoc']
3061 bashcompletions += ['lsclocks']
3064 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3068 include_directories : includes,
3069 link_with : [lib_common],
3070 install_dir : usrbin_exec_dir,
3072 if not is_disabler(exe)
3074 manadocs += ['misc-utils/exch.1.adoc']
3075 bashcompletions += ['exch']
3079 ############################################################
3081 opt = not get_option('build-schedutils').disabled()
3084 'schedutils/chrt.c',
3085 include_directories : includes,
3086 link_with : lib_common,
3087 install_dir : usrbin_exec_dir,
3089 build_by_default : opt)
3093 'schedutils/ionice.c',
3094 include_directories : includes,
3095 link_with : lib_common,
3096 install_dir : usrbin_exec_dir,
3098 build_by_default : opt)
3102 'schedutils/taskset.c',
3103 include_directories : includes,
3104 link_with : lib_common,
3105 install_dir : usrbin_exec_dir,
3107 build_by_default : opt)
3111 'schedutils/uclampset.c',
3112 include_directories : includes,
3113 link_with : lib_common,
3114 install_dir : usrbin_exec_dir,
3116 build_by_default : opt)
3118 if opt and not is_disabler(exe)
3119 exes += [exe, exe2, exe3, exe4]
3120 manadocs += ['schedutils/chrt.1.adoc',
3121 'schedutils/ionice.1.adoc',
3122 'schedutils/taskset.1.adoc',
3123 'schedutils/uclampset.1.adoc']
3124 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3127 ############################################################
3129 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3134 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3135 include_directories : dir_include,
3136 link_with : lib_common,
3137 build_by_default: program_tests)
3143 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3144 include_directories : dir_include,
3145 link_with : lib_common,
3146 build_by_default: program_tests)
3152 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3153 include_directories : dir_include,
3154 link_with : lib_common,
3155 build_by_default: program_tests)
3161 c_args : ['-DTEST_PROGRAM_MANGLE'],
3162 include_directories : dir_include,
3163 build_by_default: program_tests)
3169 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3170 include_directories : dir_include,
3171 build_by_default: program_tests)
3177 'lib/color-names.c',
3178 c_args : ['-DTEST_PROGRAM_COLORS'],
3179 include_directories : dir_include,
3180 link_with : [lib_common, lib_tcolors],
3181 build_by_default: program_tests)
3187 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3188 include_directories : dir_include,
3189 build_by_default: program_tests)
3192 if conf.get('HAVE_OPENAT').to_string() == '1' \
3193 and conf.get('HAVE_DIRFD').to_string() == '1'
3197 c_args : ['-DTEST_PROGRAM_PROCFS'],
3198 include_directories : dir_include,
3199 link_with : lib_common,
3200 build_by_default: program_tests)
3207 have_cpu_set_t ? 'lib/cpuset.c' : [],
3208 c_args : ['-DTEST_PROGRAM_PATH'],
3209 include_directories : dir_include,
3210 link_with : lib_common,
3211 build_by_default: program_tests)
3215 if conf.get('HAVE_PTY').to_string() == '1'
3220 c_args : ['-DTEST_PROGRAM_PTY'],
3221 include_directories : dir_include,
3222 link_with : [lib_common],
3223 dependencies : [lib_m,
3226 build_by_default: program_tests)
3234 c_args : ['-DTEST_PROGRAM_CPUSET'],
3235 include_directories : dir_include,
3236 build_by_default: program_tests)
3247 have_cpu_set_t ? 'lib/cpuset.c' : [],
3248 c_args : ['-DTEST_PROGRAM_SYSFS'],
3249 include_directories : dir_include,
3250 build_by_default: program_tests)
3256 c_args : ['-DTEST_PROGRAM_PAGER'],
3257 include_directories : dir_include,
3258 build_by_default: program_tests)
3262 'test_linux_version',
3263 'lib/linux_version.c',
3264 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3265 include_directories : dir_include,
3266 build_by_default: program_tests)
3272 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3273 include_directories : dir_include,
3274 build_by_default: program_tests)
3278 'test_canonicalize',
3279 'lib/canonicalize.c',
3280 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3281 include_directories : dir_include,
3282 build_by_default: program_tests)
3289 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3290 include_directories : dir_include,
3291 build_by_default: program_tests)
3297 c_args : ['-DTEST_PROGRAM'],
3298 include_directories : dir_include,
3299 link_with : lib_common,
3300 build_by_default: program_tests)
3306 c_args : ['-DTEST_PROGRAM'],
3307 include_directories : dir_include,
3308 link_with : [lib_common, logindefs_c],
3309 build_by_default: program_tests)
3313 ############################################################
3317 'libuuid/src/test_uuid.c',
3318 include_directories : [dir_include, dir_libuuid],
3319 link_with : lib_uuid,
3320 dependencies : socket_libs,
3321 build_by_default: program_tests)
3322 if not is_disabler(exe)
3326 ############################################################
3328 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3329 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3333 'libfdisk/src/ask.c',
3334 c_args : libfdisk_tests_cflags,
3335 include_directories : lib_fdisk_includes,
3336 link_with : libfdisk_tests_ldadd,
3337 build_by_default: program_tests)
3338 if not is_disabler(exe)
3344 'libfdisk/src/gpt.c',
3345 c_args : libfdisk_tests_cflags,
3346 include_directories : lib_fdisk_includes,
3347 link_with : libfdisk_tests_ldadd,
3348 build_by_default: program_tests)
3349 if not is_disabler(exe)
3355 'libfdisk/src/utils.c',
3356 c_args : libfdisk_tests_cflags,
3357 include_directories : lib_fdisk_includes,
3358 link_with : libfdisk_tests_ldadd,
3359 build_by_default: program_tests)
3360 if not is_disabler(exe)
3365 'test_fdisk_script',
3366 'libfdisk/src/script.c',
3367 c_args : libfdisk_tests_cflags,
3368 include_directories : lib_fdisk_includes,
3369 link_with : libfdisk_tests_ldadd,
3370 build_by_default: program_tests)
3371 if not is_disabler(exe)
3376 'test_fdisk_version',
3377 'libfdisk/src/version.c',
3378 c_args : libfdisk_tests_cflags,
3379 include_directories : lib_fdisk_includes,
3380 link_with : libfdisk_tests_ldadd,
3381 build_by_default: program_tests)
3382 if not is_disabler(exe)
3388 'libfdisk/src/item.c',
3389 c_args : libfdisk_tests_cflags,
3390 include_directories : lib_fdisk_includes,
3391 link_with : libfdisk_tests_ldadd,
3392 build_by_default: program_tests)
3393 if not is_disabler(exe)
3397 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3400 'sample-fdisk-mkpart',
3401 'libfdisk/samples/mkpart.c',
3402 include_directories : lib_fdisk_includes,
3403 link_with : sample_fdisk_ldadd)
3404 if not is_disabler(exe)
3409 'sample-fdisk-mkpart-fullspec',
3410 'libfdisk/samples/mkpart-fullspec.c',
3411 include_directories : lib_fdisk_includes,
3412 link_with : sample_fdisk_ldadd)
3413 if not is_disabler(exe)
3417 ############################################################
3421 'tests/helpers/test_cap.c',
3422 include_directories : includes,
3423 dependencies : [lib_cap_ng],
3424 build_by_default: program_tests)
3425 if not is_disabler(exe)
3431 'tests/helpers/test_mbsencode.c',
3432 include_directories : includes,
3433 link_with : lib_common,
3434 build_by_default: program_tests)
3439 'tests/helpers/test_byteswap.c',
3440 include_directories : includes,
3441 build_by_default: program_tests)
3446 'tests/helpers/test_md5.c',
3448 include_directories : includes,
3449 build_by_default: program_tests)
3454 'tests/helpers/test_sha1.c',
3456 include_directories : includes,
3457 build_by_default: program_tests)
3462 'tests/helpers/test_pathnames.c',
3463 include_directories : includes,
3464 build_by_default: program_tests)
3469 'tests/helpers/test_strerror.c',
3470 include_directories : includes,
3471 build_by_default: program_tests)
3476 'tests/helpers/test_sysinfo.c',
3477 include_directories : includes,
3478 build_by_default: program_tests)
3483 'tests/helpers/test_sigreceive.c',
3484 include_directories : includes,
3485 link_with : lib_common,
3486 build_by_default: program_tests)
3491 'tests/helpers/test_tiocsti.c',
3492 include_directories : includes,
3493 build_by_default: program_tests)
3497 'test_uuid_namespace',
3498 'tests/helpers/test_uuid_namespace.c',
3502 include_directories : includes,
3503 build_by_default: program_tests)
3506 if LINUX and lib_rt.found()
3509 'tests/helpers/test_mkfds.c',
3510 'tests/helpers/test_mkfds.h',
3511 'tests/helpers/test_mkfds_ppoll.c',
3512 include_directories : includes,
3513 dependencies : [lib_rt],
3514 build_by_default: program_tests)
3520 'tests/helpers/test_enosys.c',
3521 include_directories : includes,
3522 build_by_default: program_tests)
3525 ############################################################
3527 if conf.get('HAVE_OPENAT').to_string() == '1'
3529 'sample-scols-tree',
3530 'libsmartcols/samples/tree.c',
3531 include_directories : includes,
3532 link_with : [lib_smartcols, lib_common],
3533 build_by_default: program_tests)
3534 if not is_disabler(exe)
3540 'sample-scols-title',
3541 'libsmartcols/samples/title.c',
3542 include_directories : includes,
3543 link_with : [lib_smartcols, lib_common])
3544 if not is_disabler(exe)
3549 'sample-scols-wrap',
3550 'libsmartcols/samples/wrap.c',
3551 include_directories : includes,
3552 link_with : [lib_smartcols, lib_common])
3553 if not is_disabler(exe)
3558 'sample-scols-continuous',
3559 'libsmartcols/samples/continuous.c',
3560 include_directories : includes,
3561 link_with : [lib_smartcols, lib_common])
3562 if not is_disabler(exe)
3567 'sample-scols-continuous-json',
3568 'libsmartcols/samples/continuous-json.c',
3569 include_directories : includes,
3570 link_with : [lib_smartcols, lib_common])
3571 if not is_disabler(exe)
3576 'sample-scols-maxout',
3577 'libsmartcols/samples/maxout.c',
3578 include_directories : includes,
3579 link_with : [lib_smartcols, lib_common])
3580 if not is_disabler(exe)
3585 'sample-scols-fromfile',
3586 'libsmartcols/samples/fromfile.c',
3587 include_directories : includes,
3588 link_with : [lib_smartcols, lib_common])
3589 if not is_disabler(exe)
3594 'sample-scols-grouping-simple',
3595 'libsmartcols/samples/grouping-simple.c',
3596 include_directories : includes,
3597 link_with : [lib_smartcols, lib_common])
3598 if not is_disabler(exe)
3603 'sample-scols-grouping-overlay',
3604 'libsmartcols/samples/grouping-overlay.c',
3605 include_directories : includes,
3606 link_with : [lib_smartcols, lib_common])
3607 if not is_disabler(exe)
3613 'Documentation/boilerplate.c',
3614 include_directories : includes,
3615 build_by_default: program_tests)
3616 if not is_disabler(exe)
3620 ############################################################
3622 # Let the test runner know whether we're running under asan and export
3623 # some paths. We use a file on disk so that it is possible to run the
3624 # test scripts from commandline without setting any variables.
3625 configure_file(output : 'meson.conf',
3630 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3631 python.full_path())])
3633 run_sh = find_program('tests/run.sh')
3637 '--srcdir=' + meson.current_source_dir(),
3638 '--builddir=' + meson.current_build_dir(),
3644 manadocs += ['lib/terminal-colors.d.5.adoc']
3645 manadocs += ['libblkid/libblkid.3.adoc']
3649 'libuuid/man/uuid.3.adoc',
3650 'libuuid/man/uuid_clear.3.adoc',
3651 'libuuid/man/uuid_compare.3.adoc',
3652 'libuuid/man/uuid_copy.3.adoc',
3653 'libuuid/man/uuid_generate.3.adoc',
3654 'libuuid/man/uuid_is_null.3.adoc',
3655 'libuuid/man/uuid_parse.3.adoc',
3656 'libuuid/man/uuid_time.3.adoc',
3657 'libuuid/man/uuid_unparse.3.adoc']
3659 'uuid_generate_random.3': 'uuid_generate.3',
3660 'uuid_generate_time.3': 'uuid_generate.3',
3661 'uuid_generate_time_safe.3': 'uuid_generate.3',
3665 asciidoctor = find_program('asciidoctor', required : false)
3666 if asciidoctor.found()
3667 foreach adoc : manadocs
3668 name = adoc.split('/')[-1]
3669 page = name.split('.adoc')[0]
3670 section = page.split('.')[-1]
3671 mandirn = join_paths(mandir, 'man' + section)
3676 command : [ asciidoctor,
3678 '-a', 'VERSION=' + meson.project_version(),
3679 '-a', 'release-version=' + meson.project_version(),
3680 '-a', 'ADJTIME_PATH=/etc/adjtime',
3681 '-a', 'package-docdir=' + docdir,
3682 '--base-dir=' + meson.current_source_dir(),
3683 '--destination-dir=' + meson.current_build_dir(),
3684 '--load-path', '@SOURCE_ROOT@/tools',
3685 '--require', 'asciidoctor-includetracker',
3689 depfile : page + '.deps',
3691 install_dir : mandirn)
3694 foreach link_name, target : manlinks
3695 link_section = link_name.split('.')[-1]
3696 target_section = target.split('.')[-1]
3697 meson.add_install_script(meson_make_manpage_stub,
3698 join_paths('man' + target_section, target),
3699 join_paths(mandir, 'man' + link_section, link_name))
3703 if bash_completion.found()
3704 foreach completion : bashcompletions
3706 join_paths('bash-completion', completion),
3707 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3710 foreach link_name, target : bashcompletionslinks
3711 meson.add_install_script(meson_make_symlink,
3713 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))