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 localstatedir = '/var'
32 execprefixdir = prefixdir
33 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
34 usrbin_exec_dir = join_paths(execprefixdir, bindir)
35 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
36 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
38 vendordir = get_option('vendordir')
40 add_project_arguments('-D_GNU_SOURCE', language : 'c')
42 cc = meson.get_compiler('c')
44 conf = configuration_data()
45 conf.set_quoted('PACKAGE', meson.project_name())
46 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
47 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
48 conf.set_quoted('PACKAGE_STRING', package_string)
51 pc_version = meson.project_version().split('-')[0].split('.')
53 if pc_version.length() < 3
57 pc_version = '.'.join(pc_version)
59 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
60 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
62 conf.set('bindir', bindir)
63 conf.set('sbindir', sbindir)
64 conf.set('runstatedir', runstatedir)
65 conf.set('localstatedir', localstatedir)
66 conf.set('sysconfdir', sysconfdir)
67 conf.set('usrbin_execdir', usrbin_exec_dir)
68 conf.set('usrsbin_execdir', usrsbin_exec_dir)
69 conf.set('docdir', docdir)
70 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
71 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
72 conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir)
73 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
74 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
76 conf.set_quoted('_PATH_VENDORDIR', vendordir)
77 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
79 build_libblkid = not get_option('build-libblkid').disabled()
80 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
81 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
83 build_libuuid = not get_option('build-libuuid').disabled()
84 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
85 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
87 build_liblastlog2 = not get_option('build-liblastlog2').disabled()
88 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
89 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
91 login_lastlogin = get_option('login-lastlogin')
92 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
93 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
95 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
96 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
97 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
99 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
100 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
102 build_libmount = not get_option('build-libmount').disabled()
103 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
104 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
105 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
106 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
108 build_libsmartcols = not get_option('build-libsmartcols').disabled()
109 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
110 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
112 build_libfdisk = not get_option('build-libfdisk').disabled()
113 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
114 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
116 build_uuidd = not get_option('build-uuidd').disabled()
117 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
118 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
120 static_programs = get_option('static-programs')
121 need_static_libs = static_programs.length() > 0 # a rough estimate...
122 summary('static programs', static_programs)
124 LINUX = host_machine.system() in ['linux']
125 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
127 ############################################################
145 have = cc.compiles(code, name : 'wchar_t support')
146 if not have and get_option('widechar').enabled()
147 error('widechar support requested but unavailable')
149 if get_option('ncurses').enabled() and get_option('widechar').enabled()
150 error('widechar support is incompatible with non-wide ncurses')
152 conf.set('HAVE_WIDECHAR', have ? 1 : false)
194 linux/net_namespace.h
208 security/pam_modules.h
241 lib_m = cc.find_library('m')
243 lib_tinfo = dependency(
245 required : get_option('tinfo'))
247 lib_ncursesw = dependency(
249 required : get_option('ncursesw'))
250 if lib_ncursesw.found()
251 headers += ['ncursesw/ncurses.h',
255 lib_ncurses = disabler()
257 lib_ncurses = dependency(
259 required : get_option('ncurses'))
260 headers += ['ncurses.h',
264 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
265 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
266 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
268 lib_slang = dependency(
270 required : get_option('slang'))
272 headers += ['slang.h',
277 conf.set('HAVE_SLANG', lib_slang.found())
279 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
280 if curses_libs.found()
281 have = cc.has_function('use_default_colors', dependencies : curses_libs)
282 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
283 have = cc.has_function('resizeterm', dependencies : curses_libs)
284 conf.set('HAVE_RESIZETERM', have ? 1 : false)
291 required : get_option('zlib'))
293 lib_readline = dependency(
295 required : get_option('readline'))
296 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
298 lib_readline_static = dependency(
301 required : need_static_libs ? get_option('readline') : disabler())
303 if meson.version().version_compare('>= 0.59.0')
304 lib_intl = dependency(
306 required : get_option('nls'))
307 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
309 if get_option('nls').enabled()
310 error('nls is not supported with meson before 0.59.0')
312 lib_intl = dependency('', required : false)
315 lib_user = dependency(
318 required : get_option('libuser'))
319 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
321 lib_util = cc.find_library(
323 required : get_option('libutil'))
324 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
326 lib_utempter = cc.find_library(
328 required : get_option('libutempter'))
329 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
331 systemd = dependency(
333 required : get_option('systemd'))
335 lib_systemd = dependency(
337 required : get_option('systemd'))
338 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
339 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
341 have = cc.has_function(
342 'sd_session_get_username',
343 dependencies : lib_systemd)
344 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
346 lib_udev = dependency(
348 required : get_option('systemd'))
349 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
351 lib_crypt = cc.find_library('crypt')
353 lib_pam = cc.find_library('pam', required : get_option('build-login'))
354 if not lib_pam.found()
355 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
357 if not lib_pam.found()
358 lib_pam = cc.find_library('pam', required : get_option('build-su'))
360 if not lib_pam.found()
361 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
364 lib_pam_misc = cc.find_library('pam_misc')
365 lib_pam = [lib_pam, lib_pam_misc]
367 lib_pam_misc = declare_dependency()
370 lib_cryptsetup = dependency(
372 required : get_option('cryptsetup'))
373 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
375 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
377 if meson.version().version_compare('>= 0.62.0')
378 lib_dl = dependency('dl')
380 lib_dl = cc.find_library('dl')
382 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
383 summary('cryptsetup support (dlopen)',
385 section : 'components')
387 summary('cryptsetup support',
388 lib_cryptsetup.found() ? 'enabled' : 'disabled',
389 section : 'components')
392 have = cc.has_function(
393 'crypt_activate_by_signed_key',
394 dependencies : lib_cryptsetup)
395 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
397 lib_cap_ng = dependency(
399 required : get_option('build-setpriv'))
400 if not lib_cap_ng.found()
401 lib_cap_ng = disabler()
404 lib_selinux = dependency(
407 required : get_option('selinux'))
408 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
410 lib_magic = dependency(
412 required : get_option('magic'))
413 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
415 lib_econf = dependency(
417 required : get_option('econf'))
418 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
420 lib_audit = dependency(
422 required : get_option('audit'))
423 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
425 conf.set('HAVE_SMACK', not get_option('smack').disabled())
427 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
429 foreach header : headers
430 have = cc.has_header(header)
431 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
434 header = 'linux/btrfs.h'
435 enable_btrfs = cc.has_header(header,
436 required : get_option('btrfs'))
437 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
438 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
440 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
445 have = cc.has_header(header,
447 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
450 have = cc.has_header('sched.h')
451 conf.set10('HAVE_DECL_CPU_ALLOC', have)
452 # We get -1 if the size cannot be determined
453 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
454 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
456 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
457 conf.set10('HAVE_ENVIRON_DECL', have)
459 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
460 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
462 have = cc.has_function('strsignal')
463 conf.set10('HAVE_STRSIGNAL_DECL', have)
465 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
466 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
468 have = cc.has_type('loff_t',
469 args : '-D_GNU_SOURCE',
470 prefix : '#include <sys/types.h>')
471 conf.set('HAVE_LOFF_T', have ? 1 : false)
473 have = cc.compiles('''
474 #define _GNU_SOURCE 1
475 #include <langinfo.h>
478 str = nl_langinfo (ALTMON_1);
479 str = nl_langinfo (ALTMON_2);
480 str = nl_langinfo (ALTMON_3);
481 str = nl_langinfo (ALTMON_4);
482 str = nl_langinfo (ALTMON_5);
483 str = nl_langinfo (ALTMON_6);
484 str = nl_langinfo (ALTMON_7);
485 str = nl_langinfo (ALTMON_8);
486 str = nl_langinfo (ALTMON_9);
487 str = nl_langinfo (ALTMON_10);
488 str = nl_langinfo (ALTMON_11);
489 str = nl_langinfo (ALTMON_12);
493 name : 'langinfo.h defines ALTMON_x constants')
494 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
496 have = cc.compiles('''
497 #define _GNU_SOURCE 1
498 #include <langinfo.h>
501 str = nl_langinfo (_NL_ABALTMON_1);
502 str = nl_langinfo (_NL_ABALTMON_2);
503 str = nl_langinfo (_NL_ABALTMON_3);
504 str = nl_langinfo (_NL_ABALTMON_4);
505 str = nl_langinfo (_NL_ABALTMON_5);
506 str = nl_langinfo (_NL_ABALTMON_6);
507 str = nl_langinfo (_NL_ABALTMON_7);
508 str = nl_langinfo (_NL_ABALTMON_8);
509 str = nl_langinfo (_NL_ABALTMON_9);
510 str = nl_langinfo (_NL_ABALTMON_10);
511 str = nl_langinfo (_NL_ABALTMON_11);
512 str = nl_langinfo (_NL_ABALTMON_12);
516 name : 'langinfo.h defines _NL_ABALTMON_x constants')
517 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
519 have = cc.compiles('''
520 #define _GNU_SOURCE 1
521 #include <langinfo.h>
524 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
528 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
529 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
562 landlock_create_ruleset
564 landlock_restrict_self
628 have = cc.has_function(func)
629 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
630 # This makes little sense, but is necessary to avoid warnings about
631 # redefined macros from Python.h, which uses this convention.
632 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
635 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
636 conf.set('AGETTY_RELOAD', have ? 1 : false)
638 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
641 have_dirfd = (cc.has_function('dirfd') or
642 cc.has_header_symbol('dirent.h', 'dirfd',
643 prefix : '#include <sys/types.h>'))
644 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
646 have_ddfd = cc.has_member('DIR', 'dd_fd',
648 #include <sys/types.h>
651 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
653 have = cc.has_member('struct tm', 'tm_gmtoff',
654 args : '-D_GNU_SOURCE',
659 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
663 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
664 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
666 have = cc.has_member('struct termios', 'c_line',
667 prefix : '#include <termios.h>')
668 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
670 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
671 args : '-D_GNU_SOURCE',
672 prefix : '#include <sys/stat.h>')
673 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
675 have = cc.has_member('struct statx', 'stx_mnt_id',
676 prefix : '#include <sys/stat.h>')
677 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
679 # replacement for AC_STRUCT_TIMEZONE
680 have = cc.has_member('struct tm', 'tm_zone',
681 args : '-D_GNU_SOURCE',
682 prefix : '#include <time.h>')
683 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
685 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
686 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
688 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
689 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
691 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
692 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
697 extern char *tzname[];
700 return tzname ? 0 : 1;
702 '''.format(have ? 1 : 0)
703 have = cc.compiles(code, name : 'using tzname[]')
704 conf.set('HAVE_TZNAME', have ? 1 : false)
706 have = cc.sizeof('time_t', prefix : '#include <time.h>')
708 add_global_arguments('-D_TIME_BITS=64', language : 'c')
709 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
711 if get_option('allow-32bit-time')
712 warning('Could not make time_t 64bits wide')
714 error('Could not make time_t 64bits wide')
720 if not cc.has_function('socket')
721 socket_libs += cc.find_library('socket', required : true)
722 have = cc.has_function('socket',
723 dependencies : socket_libs)
725 error('socket() function not available')
730 have = cc.has_function('clock_gettime')
732 realtime_libs += cc.find_library('rt', required : true)
733 have = cc.has_function('clock_gettime',
734 dependencies : realtime_libs)
736 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
738 thread_libs = dependency('threads')
740 have = cc.has_function('timer_create')
742 realtime_libs = [cc.find_library('rt', required : true)]
743 have = cc.has_function('timer_create',
744 dependencies : realtime_libs)
746 realtime_libs += thread_libs
747 have = cc.has_function('timer_create',
748 dependencies : realtime_libs)
751 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
753 have = cc.has_function('setitimer')
754 conf.set('HAVE_SETITIMER', have ? 1 : false)
757 rtas_libs = cc.find_library('rtas', required : false)
758 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
761 if not cc.has_header_symbol('math.h', 'isnan')
762 lib = cc.find_library('m', required : true)
763 if (cc.has_function('isnan', dependencies : lib) and
764 cc.has_function('__isnan', dependencies : lib))
769 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
770 args : '-D_GNU_SOURCE')
771 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
774 extern char *__progname;
776 return (*__progname != 0);
779 have = cc.compiles(code, name : 'using __progname')
780 conf.set('HAVE___PROGNAME', have ? 1 : false)
782 have = conf.get('HAVE_PTY_H').to_string() == '1' \
783 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
784 conf.set('HAVE_PTY', have ? 1 : false)
786 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
787 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
789 build_plymouth_support = get_option('build-plymouth-support')
790 have_tiocglcktrmios = cc.has_header_symbol(
791 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
792 required : build_plymouth_support.enabled())
793 have_sock_cloexec = cc.has_header_symbol(
794 'sys/socket.h', 'SOCK_CLOEXEC',
795 prefix : '#include <sys/types.h>',
796 required : build_plymouth_support.enabled())
797 have_sock_nonblock = cc.has_header_symbol(
798 'sys/socket.h', 'SOCK_NONBLOCK',
799 prefix : '#include <sys/types.h>',
800 required : build_plymouth_support.enabled())
801 have_so_passcred = cc.has_header_symbol(
802 'sys/socket.h', 'SO_PASSCRED',
803 args : ['-D_GNU_SOURCE'],
804 prefix : '#include <sys/types.h>',
805 required : build_plymouth_support.enabled())
807 build_plymouth_support = (not build_plymouth_support.disabled() and
808 have_tiocglcktrmios and
809 have_sock_cloexec and
810 have_sock_nonblock and
812 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
813 summary('plymouth support',
814 build_plymouth_support ? 'enabled' : 'disabled',
815 section : 'components')
817 # check for valid fallocate() function
818 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
819 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
820 # and program can't be linked.
828 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
829 return ret == 0 ? 0 : 1;
832 have = cc.links(code, name : 'fallocate() function')
833 conf.set('HAVE_FALLOCATE', have ? 1 : false)
841 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
842 return ret == 0 ? 0 : 1;
845 have = cc.links(code, name : 'posix_fallocate() function')
846 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
848 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
849 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
850 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
852 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
853 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
854 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
856 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
858 ############################################################
861 fs_search_path = get_option('fs-search-path')
862 fs_search_path_extra = get_option('fs-search-path-extra')
863 if fs_search_path_extra != ''
864 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
866 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
868 systemdsystemunitdir = ''
870 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
873 sysvinit = get_option('sysvinit').enabled()
874 sysvinitrcdir = sysconfdir + '/init.d'
876 program_tests = get_option('program-tests')
878 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
879 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
881 have = get_option('chsh-only-listed')
882 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
884 have = get_option('use-tty-group')
885 conf.set('USE_TTY_GROUP', have ? 1 : false)
887 bison = find_program('bison')
888 flex = find_program('flex')
890 build_hwclock = not get_option('build-hwclock').disabled()
891 bison_gen = generator(
893 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
894 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
896 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
897 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
901 configuration : conf)
903 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
908 '-Waddress-of-packed-member',
909 '-Wdiscarded-qualifiers',
910 '-Wembedded-directive',
913 '-Wimplicit-function-declaration',
914 '-Wmissing-declarations',
915 '-Wmissing-parameter-type',
916 '-Wmissing-prototypes',
918 '-Wno-missing-field-initializers',
919 '-Wold-style-definition',
923 '-Wstrict-prototypes',
926 '-Wunused-but-set-parameter',
927 '-Wunused-but-set-variable',
928 '-Wunused-parameter',
934 foreach compiler_flag : compiler_flags
935 if cc.has_argument(compiler_flag)
936 add_project_arguments(compiler_flag, language : 'c')
944 bashcompletionslinks = {}
950 subdir('libsmartcols')
952 subdir('liblastlog2')
954 subdir('pam_lastlog2')
955 subdir('login-utils')
963 includes = [dir_include,
974 opt = not get_option('build-chfn-chsh').disabled()
979 include_directories : includes,
980 link_with : [lib_common, logindefs_c],
981 dependencies : chfn_chsh_deps,
982 install_dir : usrbin_exec_dir,
983 install_mode : 'rwsr-xr-x',
985 build_by_default : opt)
989 'login-utils/chsh.c',
992 include_directories : includes,
993 link_with : lib_common,
994 dependencies : chfn_chsh_deps,
995 install_dir : usrbin_exec_dir,
996 install_mode : 'rwsr-xr-x',
998 build_by_default : opt)
999 if opt and not is_disabler(exe)
1001 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1002 bashcompletions += ['chfn', 'chsh']
1007 test_islocal_sources,
1008 include_directories : includes,
1009 c_args : '-DTEST_PROGRAM',
1010 build_by_default : program_tests)
1015 test_consoles_sources,
1016 c_args : ['-DTEST_PROGRAM'],
1017 include_directories : includes,
1018 link_with : lib_common,
1019 build_by_default : program_tests)
1022 opt = not get_option('build-last').disabled()
1026 include_directories : includes,
1027 link_with : [lib_common],
1028 install_dir : usrbin_exec_dir,
1030 build_by_default : opt)
1031 if opt and not is_disabler(exe)
1033 meson.add_install_script(meson_make_symlink,
1035 join_paths(usrbin_exec_dir, 'lastb'))
1036 manadocs += ['login-utils/last.1.adoc']
1037 manlinks += {'lastb.1': 'last.1'}
1038 bashcompletions += ['last']
1039 bashcompletionslinks += {'lastb': 'last'}
1042 opt = not get_option('build-nologin').disabled()
1045 'login-utils/nologin.c',
1046 include_directories : includes,
1047 install_dir : sbindir,
1048 link_with : [lib_common],
1050 build_by_default : opt)
1051 if opt and not is_disabler(exe)
1053 manadocs += ['login-utils/nologin.8.adoc']
1056 opt = not get_option('build-utmpdump').disabled()
1059 'login-utils/utmpdump.c',
1060 include_directories : includes,
1061 link_with : [lib_common],
1062 install_dir : usrbin_exec_dir,
1064 build_by_default : opt)
1065 if opt and not is_disabler(exe)
1067 manadocs += ['login-utils/utmpdump.1.adoc']
1068 bashcompletions += ['utmpdump']
1071 opt = not get_option('build-su').disabled()
1075 'login-utils/su-common.c',
1076 'login-utils/su-common.h',
1080 include_directories : includes,
1081 link_with : [lib_common, logindefs_c],
1082 dependencies : [lib_pam,
1086 install_mode : 'rwsr-xr-x',
1088 build_by_default : opt)
1089 if opt and not is_disabler(exe)
1091 manadocs += ['login-utils/su.1.adoc']
1092 bashcompletions += ['su']
1095 opt = not get_option('build-newgrp').disabled()
1098 'login-utils/newgrp.c',
1099 include_directories : includes,
1100 dependencies : [lib_crypt],
1101 install_dir : usrbin_exec_dir,
1102 install_mode : 'rwsr-xr-x',
1104 build_by_default : opt)
1105 if opt and not is_disabler(exe)
1107 manadocs += ['login-utils/newgrp.1.adoc']
1108 bashcompletions += ['newgrp']
1111 opt = not get_option('build-lslogins').disabled()
1114 'login-utils/lslogins.c',
1115 include_directories : includes,
1116 link_with : [lib_common,
1119 (build_liblastlog2 ? [lib_lastlog2] : []),
1120 dependencies : [lib_selinux,
1122 install_dir : usrbin_exec_dir,
1124 build_by_default : opt)
1125 if opt and not is_disabler(exe)
1127 manadocs += ['login-utils/lslogins.1.adoc']
1128 bashcompletions += ['lslogins']
1131 opt = not get_option('build-vipw').disabled()
1134 'login-utils/vipw.c',
1135 'login-utils/setpwnam.h',
1136 include_directories : includes,
1137 link_with : [lib_common],
1138 dependencies : [lib_selinux],
1139 install_dir : usrbin_exec_dir,
1141 build_by_default : opt)
1142 if opt and not is_disabler(exe)
1144 meson.add_install_script(meson_make_symlink,
1146 join_paths(usrbin_exec_dir, 'vigr'))
1147 manadocs += ['login-utils/vipw.8.adoc']
1148 meson.add_install_script(meson_make_symlink,
1150 join_paths(mandir, 'man8/vigr.8'))
1153 opt = not get_option('build-runuser').disabled()
1156 'login-utils/runuser.c',
1157 'login-utils/su-common.c',
1158 'login-utils/su-common.h',
1162 include_directories : includes,
1163 link_with : [lib_common, logindefs_c],
1164 dependencies : [lib_pam,
1168 install_dir : sbindir,
1170 build_by_default : opt)
1171 if opt and not is_disabler(exe)
1173 manadocs += ['login-utils/runuser.1.adoc']
1174 bashcompletionslinks += {'runuser': 'su'}
1177 ############################################################
1183 include_directories : includes,
1184 link_with : lib_common,
1185 install_dir : usrbin_exec_dir,
1188 manadocs += ['text-utils/col.1.adoc']
1189 bashcompletions += ['col']
1195 include_directories : includes,
1196 install_dir : usrbin_exec_dir,
1199 manadocs += ['text-utils/colcrt.1.adoc']
1200 bashcompletions += ['colcrt']
1205 include_directories : includes,
1206 link_with : lib_common,
1207 install_dir : usrbin_exec_dir,
1210 manadocs += ['text-utils/colrm.1.adoc']
1211 bashcompletions += ['colrm']
1216 include_directories : includes,
1217 install_dir : usrbin_exec_dir,
1220 manadocs += ['text-utils/rev.1.adoc']
1221 bashcompletions += ['rev']
1226 include_directories : includes,
1227 link_with : [lib_common,
1229 install_dir : usrbin_exec_dir,
1231 if not is_disabler(exe)
1233 manadocs += ['text-utils/column.1.adoc']
1234 bashcompletions += ['column']
1237 opt = not get_option('build-line').disabled()
1241 include_directories : includes,
1242 install_dir : usrbin_exec_dir,
1244 build_by_default : opt)
1245 if opt and not is_disabler(exe)
1247 manadocs += ['text-utils/line.1.adoc']
1250 opt = not get_option('build-pg').disabled()
1254 link_with : lib_common,
1255 include_directories : includes,
1256 dependencies : [lib_tinfo,
1258 install_dir : usrbin_exec_dir,
1260 build_by_default : opt)
1261 if opt and not is_disabler(exe)
1263 manadocs += ['text-utils/pg.1.adoc']
1264 bashcompletions += ['pg']
1267 opt = not get_option('build-ul').disabled()
1271 include_directories : includes,
1272 dependencies : [lib_tinfo,
1274 install_dir : usrbin_exec_dir,
1276 build_by_default : opt)
1277 if opt and not is_disabler(exe)
1279 manadocs += ['text-utils/ul.1.adoc']
1280 bashcompletions += ['ul']
1283 opt = not get_option('build-more').disabled()
1287 link_with : [lib_common],
1288 include_directories : includes,
1289 dependencies : [lib_tinfo,
1293 build_by_default : opt)
1297 link_with : [lib_common],
1298 include_directories : includes,
1299 c_args : '-DTEST_PROGRAM',
1300 dependencies : [lib_tinfo,
1303 build_by_default : opt and program_tests)
1305 if opt and not is_disabler(exe)
1307 manadocs += ['text-utils/more.1.adoc']
1308 bashcompletions += ['more']
1314 include_directories : includes,
1315 link_with : [lib_common,
1317 install_dir : usrbin_exec_dir,
1319 if not is_disabler(exe)
1321 manadocs += ['text-utils/hexdump.1.adoc']
1322 bashcompletions += ['hexdump']
1325 opt = not get_option('build-lsmem').disabled()
1329 include_directories : includes,
1330 link_with : [lib_common,
1332 install_dir : usrbin_exec_dir,
1334 build_by_default : opt)
1335 if opt and not is_disabler(exe)
1337 manadocs += ['sys-utils/lsmem.1.adoc']
1338 bashcompletions += ['lsmem']
1341 opt = not get_option('build-chmem').disabled()
1345 include_directories : includes,
1346 link_with : [lib_common],
1347 install_dir : usrbin_exec_dir,
1349 build_by_default : opt)
1350 if opt and not is_disabler(exe)
1352 manadocs += ['sys-utils/chmem.8.adoc']
1353 bashcompletions += ['chmem']
1359 include_directories : includes,
1360 link_with : [lib_common],
1361 install_dir : usrbin_exec_dir,
1364 manadocs += ['sys-utils/choom.1.adoc']
1369 include_directories : includes,
1370 link_with : [lib_common],
1371 install_dir : usrbin_exec_dir,
1374 manadocs += ['sys-utils/ipcmk.1.adoc']
1375 bashcompletions += ['ipcmk']
1380 include_directories : includes,
1381 link_with : [lib_common],
1382 install_dir : usrbin_exec_dir,
1385 manadocs += ['sys-utils/ipcrm.1.adoc']
1386 bashcompletions += ['ipcrm']
1388 opt = not get_option('build-ipcs').disabled()
1392 include_directories : includes,
1393 link_with : [lib_common],
1394 install_dir : usrbin_exec_dir,
1396 build_by_default : opt)
1397 if opt and not is_disabler(exe)
1399 manadocs += ['sys-utils/ipcs.1.adoc']
1400 bashcompletions += ['ipcs']
1403 opt = not get_option('build-rfkill').disabled()
1407 include_directories : includes,
1408 link_with : [lib_common,
1410 install_dir : usrsbin_exec_dir,
1412 build_by_default : opt)
1413 if opt and not is_disabler(exe)
1415 manadocs += ['sys-utils/rfkill.8.adoc']
1416 bashcompletions += ['rfkill']
1422 include_directories : includes,
1423 link_with : [lib_common,
1425 install_dir : usrbin_exec_dir,
1427 if not is_disabler(exe)
1429 manadocs += ['sys-utils/renice.1.adoc']
1430 bashcompletions += ['renice']
1436 include_directories: includes,
1437 link_with : [lib_common,
1439 install_dir : usrbin_exec_dir,
1441 if opt and not is_disabler(exe)
1443 manadocs += ['sys-utils/setpgid.1.adoc']
1444 bashcompletions += ['setpgid']
1450 include_directories : includes,
1451 link_with : [lib_common,
1453 install_dir : usrbin_exec_dir,
1455 if opt and not is_disabler(exe)
1457 manadocs += ['sys-utils/setsid.1.adoc']
1458 bashcompletions += ['setsid']
1463 readprofile_sources,
1464 include_directories : includes,
1465 link_with : [lib_common,
1467 install_dir : usrsbin_exec_dir,
1469 if not is_disabler(exe)
1471 manadocs += ['sys-utils/readprofile.8.adoc']
1472 bashcompletions += ['readprofile']
1475 opt = not get_option('build-tunelp').disabled()
1479 include_directories : includes,
1480 link_with : [lib_common],
1481 install_dir : usrsbin_exec_dir,
1483 build_by_default : opt)
1484 if opt and not is_disabler(exe)
1486 manadocs += ['sys-utils/tunelp.8.adoc']
1487 bashcompletions += ['tunelp']
1493 include_directories : includes,
1494 link_with : [lib_common,
1496 install_dir : sbindir,
1498 if not is_disabler(exe)
1500 manadocs += ['sys-utils/fstrim.8.adoc']
1501 bashcompletions += ['fstrim']
1507 include_directories : includes,
1508 link_with : [lib_common,
1511 if not is_disabler(exe)
1513 manadocs += ['sys-utils/dmesg.1.adoc']
1514 bashcompletions += ['dmesg']
1520 include_directories : dir_include,
1521 c_args : '-DTEST_DMESG',
1522 link_with : [lib_common,
1524 build_by_default : program_tests)
1525 if not is_disabler(exe)
1532 include_directories : includes,
1533 link_with : [lib_common],
1534 install_dir : sbindir,
1537 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1538 bashcompletions += ['ctrlaltdel']
1543 include_directories : includes,
1544 install_dir : sbindir,
1547 manadocs += ['sys-utils/fsfreeze.8.adoc']
1548 bashcompletions += ['fsfreeze']
1553 include_directories : includes,
1554 link_with : [lib_common,
1556 install_dir : sbindir,
1559 manadocs += ['sys-utils/blkdiscard.8.adoc']
1560 bashcompletions += ['blkdiscard']
1565 include_directories : includes,
1566 link_with : [lib_common],
1567 install_dir : sbindir,
1570 manadocs += ['sys-utils/blkzone.8.adoc']
1571 bashcompletions += ['blkzone']
1576 include_directories : includes,
1577 link_with : [lib_common],
1578 install_dir : sbindir,
1581 manadocs += ['sys-utils/blkpr.8.adoc']
1586 include_directories : includes,
1587 link_with : [lib_common],
1588 install_dir : usrsbin_exec_dir,
1591 manadocs += ['sys-utils/ldattach.8.adoc']
1592 bashcompletions += ['ldattach']
1597 include_directories : includes,
1598 link_with : [lib_common],
1599 install_dir : usrsbin_exec_dir,
1602 manadocs += ['sys-utils/rtcwake.8.adoc']
1603 bashcompletions += ['rtcwake']
1608 include_directories : includes,
1609 link_with : [lib_common],
1610 install_dir : usrbin_exec_dir,
1613 manadocs += ['sys-utils/setarch.8.adoc']
1614 bashcompletions += ['setarch']
1616 setarch_links = ['uname26', 'linux32', 'linux64']
1617 setarch_links_arch = {
1618 's390x' : ['s390', 's390x'],
1620 'x86_64' : ['i386', 'x86_64'],
1621 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1622 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1623 'mips64' : ['mips', 'mips64', 'mips32'],
1624 'ia64' : ['i386', 'ia64'],
1625 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1627 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1629 foreach link: setarch_links
1630 meson.add_install_script(meson_make_symlink,
1632 join_paths(usrbin_exec_dir, link))
1633 manlinks += {link + '.8': 'setarch.8'}
1636 opt = not get_option('build-eject').disabled()
1640 include_directories : includes,
1641 link_with : [lib_common,
1643 install_dir : usrbin_exec_dir,
1645 build_by_default : opt)
1646 if opt and not is_disabler(exe)
1648 manadocs += ['sys-utils/eject.1.adoc']
1649 bashcompletions += ['eject']
1652 opt = not get_option('build-losetup').disabled()
1656 include_directories : includes,
1657 link_with : [lib_common,
1659 install_dir : sbindir,
1661 build_by_default : opt)
1662 if opt and not is_disabler(exe)
1663 manadocs += ['sys-utils/losetup.8.adoc']
1665 bashcompletions += ['losetup']
1668 opt = opt and 'losetup' in static_programs
1672 include_directories : includes,
1673 link_args : ['--static'],
1674 link_with : [lib_common,
1675 lib_smartcols.get_static_lib()],
1676 install_dir : sbindir,
1678 build_by_default : opt)
1679 if opt and not is_disabler(exe)
1683 opt = not get_option('build-zramctl').disabled()
1687 include_directories : includes,
1688 link_with : [lib_common,
1690 install_dir : sbindir,
1692 build_by_default : opt)
1693 if opt and not is_disabler(exe)
1695 manadocs += ['sys-utils/zramctl.8.adoc']
1696 bashcompletions += ['zramctl']
1702 include_directories : includes,
1703 link_with : [lib_common,
1705 install_dir : usrbin_exec_dir,
1707 if not is_disabler(exe)
1709 manadocs += ['sys-utils/prlimit.1.adoc']
1710 bashcompletions += ['prlimit']
1716 include_directories : includes,
1717 link_with : [lib_common,
1720 install_dir : usrbin_exec_dir,
1722 if not is_disabler(exe)
1724 manadocs += ['sys-utils/lsns.8.adoc']
1725 bashcompletions += ['lsns']
1728 opt = not get_option('build-mount').disabled()
1732 include_directories : includes,
1733 link_with : [lib_common,
1736 dependencies : lib_selinux,
1737 install_mode : 'rwsr-xr-x',
1739 build_by_default : opt)
1743 include_directories : includes,
1744 link_with : [lib_common,
1746 install_mode : 'rwsr-xr-x',
1748 build_by_default : opt)
1749 if opt and not is_disabler(exe)
1751 manadocs += ['sys-utils/fstab.5.adoc',
1752 'sys-utils/mount.8.adoc',
1753 'sys-utils/umount.8.adoc']
1754 bashcompletions += ['mount', 'umount']
1757 opt2 = opt and 'mount' in static_programs
1761 include_directories : includes,
1762 link_args : ['--static'],
1763 link_with : [lib_common,
1764 lib_smartcols_static,
1767 build_by_default : opt2)
1768 if opt2 and not is_disabler(exe)
1772 opt2 = opt and 'umount' in static_programs
1776 include_directories : includes,
1777 link_args : ['--static'],
1778 link_with : [lib_common,
1781 build_by_default : opt2)
1782 if opt2 and not is_disabler(exe)
1791 include_directories : includes,
1792 link_with : [lib_common,
1796 install_dir : sbindir,
1798 if not is_disabler(exe)
1800 manadocs += ['sys-utils/swapon.8.adoc']
1801 bashcompletions += ['swapon']
1807 include_directories : includes,
1808 link_with : [lib_common,
1811 install_dir : sbindir,
1813 if not is_disabler(exe)
1815 manlinks += {'swapoff.8': 'swapon.8'}
1816 bashcompletions += ['swapoff']
1822 include_directories : includes,
1823 link_with : [lib_common,
1825 dependencies : [rtas_libs],
1826 install_dir : usrbin_exec_dir,
1828 if not is_disabler(exe)
1830 manadocs += ['sys-utils/lscpu.1.adoc']
1831 bashcompletions += ['lscpu']
1837 include_directories : includes,
1838 link_with : [lib_common],
1839 install_dir : sbindir,
1842 manadocs += ['sys-utils/chcpu.8.adoc']
1843 bashcompletions += ['chcpu']
1848 include_directories : includes,
1849 link_with : [lib_common,
1852 if not is_disabler(exe)
1854 manadocs += ['sys-utils/wdctl.8.adoc']
1855 bashcompletions += ['wdctl']
1858 opt = not get_option('build-mountpoint').disabled()
1862 include_directories : includes,
1863 link_with : [lib_mount],
1865 build_by_default : opt)
1866 if opt and not is_disabler(exe)
1868 manadocs += ['sys-utils/mountpoint.1.adoc']
1869 bashcompletions += ['mountpoint']
1872 opt = not get_option('build-fallocate').disabled()
1876 include_directories : includes,
1877 link_with : [lib_common],
1878 install_dir : usrbin_exec_dir,
1880 build_by_default : opt)
1881 if opt and not is_disabler(exe)
1883 manadocs += ['sys-utils/fallocate.1.adoc']
1884 bashcompletions += ['fallocate']
1887 opt = not get_option('build-pivot_root').disabled()
1891 include_directories : includes,
1892 install_dir : sbindir,
1894 build_by_default : opt)
1895 if opt and not is_disabler(exe)
1897 manadocs += ['sys-utils/pivot_root.8.adoc']
1898 bashcompletions += ['pivot_root']
1901 opt = not get_option('build-switch_root').disabled()
1902 if opt and not have_dirfd and not have_ddfd
1903 error('neither dirfd nor ddfd are available')
1907 switch_root_sources,
1908 include_directories : includes,
1909 install_dir : sbindir,
1911 build_by_default : opt)
1912 if opt and not is_disabler(exe)
1914 manadocs += ['sys-utils/switch_root.8.adoc']
1917 opt = not get_option('build-unshare').disabled()
1921 include_directories : includes,
1922 link_with : [lib_common],
1923 install_dir : usrbin_exec_dir,
1925 build_by_default : opt)
1926 if opt and not is_disabler(exe)
1928 manadocs += ['sys-utils/unshare.1.adoc']
1929 bashcompletions += ['unshare']
1932 opt = opt and 'unshare' in static_programs
1936 include_directories : includes,
1937 link_with : [lib_common],
1938 install_dir : usrbin_exec_dir,
1940 build_by_default : opt)
1941 if opt and not is_disabler(exe)
1945 opt = not get_option('build-nsenter').disabled()
1949 include_directories : includes,
1950 link_with : [lib_common],
1951 dependencies : [lib_selinux],
1952 install_dir : usrbin_exec_dir,
1954 build_by_default : opt)
1955 if opt and not is_disabler(exe)
1957 manadocs += ['sys-utils/nsenter.1.adoc']
1958 bashcompletions += ['nsenter']
1961 opt = opt and 'nsenter' in static_programs
1965 include_directories : includes,
1966 link_with : [lib_common],
1967 dependencies : [lib_selinux],
1968 install_dir : usrbin_exec_dir,
1970 build_by_default : opt)
1971 if opt and not is_disabler(exe)
1975 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1979 include_directories : includes,
1980 link_with : [lib_common],
1981 dependencies : [lib_cap_ng],
1982 install_dir : usrbin_exec_dir,
1984 build_by_default : opt)
1985 if opt and not is_disabler(exe)
1987 manadocs += ['sys-utils/setpriv.1.adoc']
1988 bashcompletions += ['setpriv']
1994 include_directories : includes,
1995 link_with : [lib_common],
1996 dependencies : realtime_libs,
1997 install_dir : usrbin_exec_dir,
2000 manadocs += ['sys-utils/flock.1.adoc']
2001 bashcompletions += ['flock']
2003 opt = not get_option('build-lsirq').disabled()
2007 include_directories : includes,
2008 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/lsirq.1.adoc']
2016 bashcompletions += ['lsirq']
2019 opt = not get_option('build-irqtop').disabled()
2023 include_directories : includes,
2024 dependencies : [realtime_libs, curses_libs],
2025 link_with : [lib_common,
2028 install_dir : usrbin_exec_dir,
2030 build_by_default : opt)
2031 if opt and not is_disabler(exe)
2033 manadocs += ['sys-utils/irqtop.1.adoc']
2034 bashcompletions += ['irqtop']
2037 opt = not get_option('build-ipcs').disabled()
2041 include_directories : includes,
2042 link_with : [lib_common,
2044 install_dir : usrbin_exec_dir,
2046 build_by_default : opt)
2047 if opt and not is_disabler(exe)
2049 manadocs += ['sys-utils/lsipc.1.adoc']
2050 bashcompletions += ['lsipc']
2057 include_directories : includes,
2058 link_with : [lib_common],
2059 dependencies : [lib_m,
2061 install_dir : sbindir,
2063 build_by_default : opt)
2064 if opt and not is_disabler(exe)
2066 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2067 bashcompletions += ['hwclock']
2073 include_directories : includes,
2074 install_dir : sbindir,
2077 manadocs += ['disk-utils/mkfs.8.adoc']
2078 bashcompletions += ['mkfs']
2080 opt = not get_option('build-bfs').disabled()
2084 include_directories : includes,
2085 link_with : [lib_common],
2086 install_dir : sbindir,
2088 build_by_default : opt)
2089 if opt and not is_disabler(exe)
2091 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2092 bashcompletions += ['mkfs.bfs']
2098 include_directories : includes,
2099 link_with : [lib_common],
2100 install_dir : usrbin_exec_dir,
2103 manadocs += ['disk-utils/isosize.8.adoc']
2104 bashcompletions += ['isosize']
2109 include_directories : includes,
2110 link_with : [lib_common,
2113 dependencies: [lib_selinux],
2114 install_dir : sbindir,
2116 if not is_disabler(exe)
2118 manadocs += ['disk-utils/mkswap.8.adoc']
2119 bashcompletions += ['mkswap']
2125 include_directories : includes,
2126 link_with : [lib_common,
2129 install_dir : sbindir,
2131 if not is_disabler(exe)
2133 manadocs += ['disk-utils/swaplabel.8.adoc']
2134 bashcompletions += ['swaplabel']
2137 opt = not get_option('build-fsck').disabled()
2141 include_directories : includes,
2142 link_with : [lib_common,
2145 dependencies : realtime_libs,
2146 install_dir : sbindir,
2148 build_by_default : opt)
2149 if opt and not is_disabler(exe)
2151 manadocs += ['disk-utils/fsck.8.adoc']
2152 bashcompletions += ['fsck']
2155 opt = not get_option('build-minix').disabled()
2159 include_directories : includes,
2160 link_with : [lib_common],
2161 install_dir : sbindir,
2163 build_by_default : opt)
2167 include_directories : includes,
2168 c_args : '-DTEST_SCRIPT',
2169 link_with : [lib_common],
2170 build_by_default : opt and program_tests)
2174 include_directories : includes,
2175 link_with : [lib_common],
2176 install_dir : sbindir,
2178 build_by_default : opt)
2179 if opt and not is_disabler(exe)
2180 exes += [exe, exe2, exe3]
2181 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2182 bashcompletions += ['mkfs.minix', 'fsck.minix']
2185 opt = not get_option('build-cramfs').disabled()
2188 mkfs_cramfs_sources,
2189 include_directories : includes,
2190 link_with : [lib_common],
2191 dependencies : [lib_z],
2192 install_dir : sbindir,
2194 build_by_default : opt)
2197 fsck_cramfs_sources,
2198 include_directories : includes,
2199 link_with : [lib_common],
2200 dependencies : [lib_z],
2201 install_dir : sbindir,
2203 build_by_default : opt)
2204 if not is_disabler(exe)
2206 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2207 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2210 opt = not get_option('build-raw').disabled()
2212 cc.has_header('linux/raw.h', required: opt)
2217 include_directories : includes,
2218 install_dir : sbindir,
2220 build_by_default : opt)
2221 if opt and not is_disabler(exe)
2223 manadocs += ['disk-utils/raw.8.adoc']
2224 bashcompletions += ['raw']
2227 opt = not get_option('build-fdformat').disabled()
2231 include_directories : includes,
2232 link_with : [lib_common],
2233 install_dir : usrsbin_exec_dir,
2235 build_by_default : opt)
2236 if opt and not is_disabler(exe)
2238 manadocs += ['disk-utils/fdformat.8.adoc']
2239 bashcompletions += ['fdformat']
2245 include_directories : includes,
2246 link_with : [lib_common],
2247 install_dir : sbindir,
2249 manadocs += ['disk-utils/blockdev.8.adoc']
2250 bashcompletions += ['blockdev']
2252 opt = not get_option('build-fdisks').disabled()
2253 if opt and not have_dirfd and not have_ddfd
2254 error('neither dirfd nor ddfd are available')
2259 include_directories : includes,
2260 link_with : [lib_common,
2264 dependencies : [lib_readline],
2265 install_dir : sbindir,
2267 build_by_default : opt)
2268 if opt and not is_disabler(exe)
2270 bashcompletions += ['fdisk']
2273 opt2 = opt and 'fdisk' in static_programs
2277 link_args : ['--static'],
2278 include_directories : includes,
2279 link_with : [lib_common,
2282 lib_smartcols.get_static_lib()],
2283 dependencies : [lib_readline_static],
2284 install_dir : sbindir,
2286 build_by_default : opt2)
2287 if opt2 and not is_disabler(exe)
2294 include_directories : includes,
2295 link_with : [lib_common,
2299 dependencies : [lib_readline],
2300 install_dir : sbindir,
2302 build_by_default : opt)
2303 if opt and not is_disabler(exe)
2305 bashcompletions += ['sfdisk']
2308 opt2 = opt and 'sfdisk' in static_programs
2312 include_directories : includes,
2313 link_with : [lib_common,
2316 lib_smartcols.get_static_lib()],
2317 dependencies : [lib_readline_static],
2318 install_dir : sbindir,
2320 build_by_default : opt2)
2321 if opt2 and not is_disabler(exe)
2328 include_directories : includes,
2329 link_with : [lib_common,
2334 dependencies : [curses_libs],
2335 install_dir : sbindir,
2337 build_by_default : opt)
2338 if opt and not is_disabler(exe)
2340 manadocs += ['disk-utils/fdisk.8.adoc',
2341 'disk-utils/sfdisk.8.adoc',
2342 'disk-utils/cfdisk.8.adoc']
2343 bashcompletions += ['cfdisk']
2346 opt = not get_option('build-partx').disabled()
2350 include_directories : includes,
2351 link_with : [lib_common],
2352 install_dir : usrsbin_exec_dir,
2354 build_by_default : opt)
2358 include_directories : includes,
2359 link_with : [lib_common],
2360 install_dir : usrsbin_exec_dir,
2362 build_by_default : opt)
2366 include_directories : includes,
2367 link_with : [lib_common],
2368 install_dir : usrsbin_exec_dir,
2370 build_by_default : opt)
2374 include_directories : includes,
2375 link_with : [lib_common,
2378 install_dir : usrsbin_exec_dir,
2380 build_by_default : opt)
2382 exes += [exe, exe2, exe3, exe4]
2383 manadocs += ['disk-utils/addpart.8.adoc',
2384 'disk-utils/delpart.8.adoc',
2385 'disk-utils/resizepart.8.adoc',
2386 'disk-utils/partx.8.adoc']
2387 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2390 ############################################################
2395 include_directories : includes,
2396 link_with : [lib_common],
2397 dependencies : [lib_util,
2401 install_dir : usrbin_exec_dir,
2404 manadocs += ['term-utils/script.1.adoc']
2405 bashcompletions += ['script']
2410 include_directories : includes,
2411 c_args : '-DTEST_SCRIPT',
2412 link_with : [lib_common],
2413 dependencies : [lib_util,
2417 build_by_default : program_tests)
2423 include_directories : includes,
2424 link_with : [lib_common],
2425 dependencies : [lib_util,
2428 install_dir : usrbin_exec_dir,
2431 manadocs += ['term-utils/scriptlive.1.adoc']
2432 bashcompletions += ['scriptlive']
2436 scriptreplay_sources,
2437 include_directories : includes,
2438 link_with : [lib_common],
2439 dependencies : [math_libs],
2440 install_dir : usrbin_exec_dir,
2443 manadocs += ['term-utils/scriptreplay.1.adoc']
2444 bashcompletions += ['scriptreplay']
2446 opt = not get_option('build-agetty').disabled()
2450 include_directories : includes,
2451 link_with : [lib_common, logindefs_c],
2452 dependencies : [BSD ? lib_util : [], lib_systemd],
2453 install_dir : sbindir,
2455 build_by_default : opt)
2458 manadocs += ['term-utils/agetty.8.adoc']
2461 opt = not get_option('build-setterm').disabled()
2465 include_directories : includes,
2466 link_with : [lib_common],
2467 dependencies : [curses_libs],
2468 install_dir : usrbin_exec_dir,
2470 build_by_default : opt)
2473 manadocs += ['term-utils/setterm.1.adoc']
2474 bashcompletions += ['setterm']
2477 opt = not get_option('build-mesg').disabled()
2481 include_directories : includes,
2482 link_with : [lib_common],
2483 install_dir : usrbin_exec_dir,
2485 build_by_default : opt)
2488 manadocs += ['term-utils/mesg.1.adoc']
2489 bashcompletions += ['mesg']
2492 opt = not get_option('build-wall').disabled()
2496 include_directories : includes,
2497 link_with : [lib_common],
2498 dependencies : [lib_systemd],
2499 install_dir : usrbin_exec_dir,
2500 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2502 build_by_default : opt)
2505 manadocs += ['term-utils/wall.1.adoc']
2506 bashcompletions += ['wall']
2509 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2510 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2512 opt = not get_option('build-write').disabled()
2516 include_directories : includes,
2517 link_with : [lib_common],
2518 dependencies : [lib_systemd],
2519 install_dir : usrbin_exec_dir,
2520 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2522 build_by_default : opt)
2525 manadocs += ['term-utils/write.1.adoc']
2526 bashcompletions += ['write']
2529 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2530 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2532 opt = not get_option('build-login').disabled()
2536 include_directories : includes,
2537 link_with : [lib_common, logindefs_c],
2538 dependencies : [lib_pam,
2542 build_by_default : opt)
2543 if not is_disabler(exe)
2545 manadocs += ['login-utils/login.1.adoc']
2548 opt = not get_option('build-sulogin').disabled()
2552 include_directories : includes,
2553 link_with : [lib_common],
2554 dependencies : [lib_crypt,
2556 install_dir : sbindir,
2558 build_by_default : opt)
2559 if not is_disabler(exe)
2561 manadocs += ['login-utils/sulogin.8.adoc']
2567 include_directories : includes,
2568 link_with : [lib_common,
2570 dependencies : [curses_libs],
2571 install_dir : usrbin_exec_dir,
2574 manadocs += ['misc-utils/cal.1.adoc']
2575 bashcompletions += ['cal']
2577 opt = not get_option('build-logger').disabled()
2581 include_directories : includes,
2582 link_with : [lib_common],
2583 dependencies : [lib_systemd],
2584 install_dir : usrbin_exec_dir,
2586 build_by_default : opt)
2587 if opt and not is_disabler(exe)
2589 manadocs += ['misc-utils/logger.1.adoc']
2590 bashcompletions += ['logger']
2596 include_directories : includes,
2597 c_args : '-DTEST_LOGGER',
2598 link_with : [lib_common],
2599 dependencies : [lib_systemd],
2600 build_by_default: program_tests)
2601 if not is_disabler(exe)
2608 include_directories : includes,
2609 install_dir : usrbin_exec_dir,
2612 manadocs += ['misc-utils/look.1.adoc']
2613 bashcompletions += ['look']
2618 include_directories : includes,
2619 link_with : [lib_common],
2620 install_dir : usrbin_exec_dir,
2623 manadocs += ['misc-utils/mcookie.1.adoc']
2624 bashcompletions += ['mcookie']
2626 if build_liblastlog2
2630 include_directories : includes,
2631 link_with : [lib_common, lib_lastlog2],
2632 install_dir : usrbin_exec_dir,
2635 manadocs += ['misc-utils/lastlog2.8.adoc']
2636 bashcompletions += ['lastlog2']
2637 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2638 'liblastlog2/man/ll2_write_entry.3.adoc',
2639 'liblastlog2/man/ll2_read_entry.3.adoc',
2640 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2641 'liblastlog2/man/ll2_read_all.3.adoc',
2642 'liblastlog2/man/ll2_remove_entry.3.adoc',
2643 'liblastlog2/man/ll2_rename_user.3.adoc',
2644 'liblastlog2/man/ll2_update_login_time.3.adoc'
2651 include_directories : includes,
2652 dependencies : [lib_selinux],
2653 install_dir : usrbin_exec_dir,
2656 manadocs += ['misc-utils/namei.1.adoc']
2657 bashcompletions += ['namei']
2662 include_directories : includes,
2663 link_with : [lib_common],
2664 install_dir : usrbin_exec_dir,
2667 manadocs += ['misc-utils/whereis.1.adoc']
2668 bashcompletions += ['whereis']
2673 include_directories : includes,
2674 link_with : [lib_common,
2677 install_dir : usrbin_exec_dir,
2679 if not is_disabler(exe)
2681 manadocs += ['misc-utils/lslocks.8.adoc']
2682 bashcompletions += ['lslocks']
2688 include_directories : includes,
2689 link_with : [lib_common,
2694 dependencies : lib_udev,
2696 if not is_disabler(exe)
2698 manadocs += ['misc-utils/lsblk.8.adoc']
2699 bashcompletions += ['lsblk']
2702 errnos_h = custom_target('errnos.h',
2703 input : 'tools/all_errnos',
2704 output : 'errnos.h',
2705 command : ['tools/all_errnos', cc.cmd_array()]
2709 mq_libs += cc.find_library('rt', required : true)
2713 lsfd_sources, errnos_h,
2714 include_directories : includes,
2715 link_with : [lib_common,
2717 dependencies : mq_libs,
2718 install_dir : usrbin_exec_dir,
2720 if not is_disabler(exe)
2722 manadocs += ['misc-utils/lsfd.1.adoc']
2728 include_directories : includes,
2729 link_with : [lib_common,
2731 install_dir : usrbin_exec_dir,
2733 if not is_disabler(exe)
2735 manadocs += ['misc-utils/uuidgen.1.adoc']
2736 bashcompletions += ['uuidgen']
2742 include_directories : includes,
2743 link_with : [lib_common,
2746 install_dir : usrbin_exec_dir,
2748 if not is_disabler(exe)
2750 manadocs += ['misc-utils/uuidparse.1.adoc']
2751 bashcompletions += ['uuidparse']
2758 include_directories : includes,
2759 link_with : [lib_common,
2761 dependencies : [realtime_libs,
2763 install_dir : usrsbin_exec_dir,
2765 build_by_default : opt)
2769 include_directories : includes,
2770 link_with : [lib_common,
2772 dependencies : thread_libs,
2773 build_by_default : opt and program_tests)
2774 if not is_disabler(exe)
2776 manadocs += ['misc-utils/uuidd.8.adoc']
2777 bashcompletions += ['uuidd']
2780 opt = build_libblkid
2784 include_directories : includes,
2785 link_with : [lib_common,
2787 install_dir : sbindir,
2789 build_by_default : opt)
2790 if opt and not is_disabler(exe)
2792 manadocs += ['misc-utils/blkid.8.adoc']
2793 bashcompletions += ['blkid']
2796 opt = opt and 'blkid' in static_programs
2800 include_directories : includes,
2801 link_with : [lib_common,
2803 install_dir : sbindir,
2805 build_by_default : opt)
2806 if opt and not is_disabler(exe)
2812 'libblkid/samples/mkfs.c',
2813 include_directories : includes,
2814 link_with : lib_blkid)
2815 if not is_disabler(exe)
2820 'sample-partitions',
2821 'libblkid/samples/partitions.c',
2822 include_directories : includes,
2823 link_with : lib_blkid)
2824 if not is_disabler(exe)
2829 'sample-superblocks',
2830 'libblkid/samples/superblocks.c',
2831 include_directories : includes,
2832 link_with : lib_blkid)
2833 if not is_disabler(exe)
2839 'libblkid/samples/topology.c',
2840 include_directories : includes,
2841 link_with : lib_blkid)
2842 if not is_disabler(exe)
2847 'test_blkid_fuzz_sample',
2848 'libblkid/src/fuzz.c',
2849 include_directories: includes,
2850 link_with: lib_blkid,
2851 build_by_default: program_tests)
2852 if not is_disabler(exe)
2856 ############################################################
2861 include_directories : includes,
2862 link_with : [lib_blkid],
2863 install_dir : sbindir,
2865 if not is_disabler(exe)
2867 manadocs += ['misc-utils/findfs.8.adoc']
2868 bashcompletions += ['findfs']
2874 include_directories : includes,
2875 link_with : [lib_common,
2878 install_dir : sbindir,
2880 if not is_disabler(exe)
2882 manadocs += ['misc-utils/wipefs.8.adoc']
2883 bashcompletions += ['wipefs']
2889 include_directories : includes,
2890 link_with : [lib_common,
2894 dependencies : [lib_udev],
2896 if not is_disabler(exe)
2898 manadocs += ['misc-utils/findmnt.8.adoc']
2899 bashcompletions += ['findmnt']
2905 include_directories : includes,
2906 link_with : [lib_common],
2908 if not is_disabler(exe)
2910 manadocs += ['misc-utils/kill.1.adoc']
2913 opt = not get_option('build-rename').disabled()
2917 include_directories : includes,
2918 install_dir : usrbin_exec_dir,
2920 build_by_default : opt)
2921 if opt and not is_disabler(exe)
2923 manadocs += ['misc-utils/rename.1.adoc']
2924 bashcompletions += ['rename']
2930 include_directories : includes,
2931 link_with : [lib_common],
2932 install_dir : usrbin_exec_dir,
2935 manadocs += ['misc-utils/getopt.1.adoc']
2936 bashcompletions += ['getopt']
2941 include_directories : includes,
2942 link_with : [lib_common,
2944 install_dir : usrbin_exec_dir,
2946 if not is_disabler(exe)
2948 manadocs += ['misc-utils/fincore.1.adoc']
2949 bashcompletions += ['fincore']
2955 include_directories : includes,
2956 link_with : [lib_common],
2957 install_dir : usrbin_exec_dir,
2959 if not is_disabler(exe)
2961 manadocs += ['misc-utils/hardlink.1.adoc']
2962 bashcompletions += ['hardlink']
2965 opt = not get_option('build-pipesz').disabled()
2969 include_directories : includes,
2970 link_with : [lib_common],
2971 install_dir : usrbin_exec_dir,
2973 if opt and not is_disabler(exe)
2975 manadocs += ['misc-utils/pipesz.1.adoc']
2976 bashcompletions += ['pipesz']
2982 include_directories : includes,
2983 c_args : '-DTEST_CAL',
2984 link_with : [lib_common,
2986 dependencies : [curses_libs],
2987 build_by_default: program_tests)
2988 if not is_disabler(exe)
2995 include_directories : includes,
2996 link_with : [lib_common],
2997 install_dir : usrbin_exec_dir,
2999 if not is_disabler(exe)
3001 manadocs += ['misc-utils/fadvise.1.adoc']
3002 bashcompletions += ['fadvise']
3005 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3009 include_directories : includes,
3010 link_with : [lib_common],
3011 install_dir : usrbin_exec_dir,
3013 if not is_disabler(exe)
3015 manadocs += ['misc-utils/waitpid.1.adoc']
3016 bashcompletions += ['waitpid']
3020 syscalls_h = custom_target('syscalls.h',
3021 input : 'tools/all_syscalls',
3022 output : 'syscalls.h',
3023 command : ['tools/all_syscalls', cc.cmd_array()]
3026 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3029 'misc-utils/enosys.c', syscalls_h, errnos_h,
3030 include_directories : includes,
3031 link_with : [lib_common],
3032 install_dir : usrbin_exec_dir,
3034 if not is_disabler(exe)
3036 manadocs += ['misc-utils/enosys.1.adoc']
3037 bashcompletions += ['enosys']
3044 include_directories : includes,
3045 link_with : [lib_common, lib_smartcols],
3046 install_dir : usrbin_exec_dir,
3048 if not is_disabler(exe)
3050 manadocs += ['misc-utils/lsclocks.1.adoc']
3051 bashcompletions += ['lsclocks']
3054 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3058 include_directories : includes,
3059 link_with : [lib_common],
3060 install_dir : usrbin_exec_dir,
3062 if not is_disabler(exe)
3064 manadocs += ['misc-utils/exch.1.adoc']
3065 bashcompletions += ['exch']
3069 ############################################################
3071 opt = not get_option('build-schedutils').disabled()
3074 'schedutils/chrt.c',
3075 include_directories : includes,
3076 link_with : lib_common,
3077 install_dir : usrbin_exec_dir,
3079 build_by_default : opt)
3083 'schedutils/ionice.c',
3084 include_directories : includes,
3085 link_with : lib_common,
3086 install_dir : usrbin_exec_dir,
3088 build_by_default : opt)
3092 'schedutils/taskset.c',
3093 include_directories : includes,
3094 link_with : lib_common,
3095 install_dir : usrbin_exec_dir,
3097 build_by_default : opt)
3101 'schedutils/uclampset.c',
3102 include_directories : includes,
3103 link_with : lib_common,
3104 install_dir : usrbin_exec_dir,
3106 build_by_default : opt)
3108 if opt and not is_disabler(exe)
3109 exes += [exe, exe2, exe3, exe4]
3110 manadocs += ['schedutils/chrt.1.adoc',
3111 'schedutils/ionice.1.adoc',
3112 'schedutils/taskset.1.adoc',
3113 'schedutils/uclampset.1.adoc']
3114 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3117 ############################################################
3119 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3124 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3125 include_directories : dir_include,
3126 link_with : lib_common,
3127 build_by_default: program_tests)
3133 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3134 include_directories : dir_include,
3135 link_with : lib_common,
3136 build_by_default: program_tests)
3142 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3143 include_directories : dir_include,
3144 link_with : lib_common,
3145 build_by_default: program_tests)
3151 c_args : ['-DTEST_PROGRAM_MANGLE'],
3152 include_directories : dir_include,
3153 build_by_default: program_tests)
3159 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3160 include_directories : dir_include,
3161 build_by_default: program_tests)
3167 'lib/color-names.c',
3168 c_args : ['-DTEST_PROGRAM_COLORS'],
3169 include_directories : dir_include,
3170 link_with : [lib_common, lib_tcolors],
3171 build_by_default: program_tests)
3177 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3178 include_directories : dir_include,
3179 build_by_default: program_tests)
3182 if conf.get('HAVE_OPENAT').to_string() == '1' \
3183 and conf.get('HAVE_DIRFD').to_string() == '1'
3187 c_args : ['-DTEST_PROGRAM_PROCFS'],
3188 include_directories : dir_include,
3189 link_with : lib_common,
3190 build_by_default: program_tests)
3197 have_cpu_set_t ? 'lib/cpuset.c' : [],
3198 c_args : ['-DTEST_PROGRAM_PATH'],
3199 include_directories : dir_include,
3200 link_with : lib_common,
3201 build_by_default: program_tests)
3205 if conf.get('HAVE_PTY').to_string() == '1'
3210 c_args : ['-DTEST_PROGRAM_PTY'],
3211 include_directories : dir_include,
3212 link_with : [lib_common],
3213 dependencies : [lib_m,
3216 build_by_default: program_tests)
3224 c_args : ['-DTEST_PROGRAM_CPUSET'],
3225 include_directories : dir_include,
3226 build_by_default: program_tests)
3237 have_cpu_set_t ? 'lib/cpuset.c' : [],
3238 c_args : ['-DTEST_PROGRAM_SYSFS'],
3239 include_directories : dir_include,
3240 build_by_default: program_tests)
3246 c_args : ['-DTEST_PROGRAM_PAGER'],
3247 include_directories : dir_include,
3248 build_by_default: program_tests)
3252 'test_linux_version',
3253 'lib/linux_version.c',
3254 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3255 include_directories : dir_include,
3256 build_by_default: program_tests)
3262 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3263 include_directories : dir_include,
3264 build_by_default: program_tests)
3268 'test_canonicalize',
3269 'lib/canonicalize.c',
3270 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3271 include_directories : dir_include,
3272 build_by_default: program_tests)
3279 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3280 include_directories : dir_include,
3281 build_by_default: program_tests)
3287 c_args : ['-DTEST_PROGRAM'],
3288 include_directories : dir_include,
3289 link_with : lib_common,
3290 build_by_default: program_tests)
3296 c_args : ['-DTEST_PROGRAM'],
3297 include_directories : dir_include,
3298 link_with : [lib_common, logindefs_c],
3299 build_by_default: program_tests)
3303 ############################################################
3307 'libuuid/src/test_uuid.c',
3308 include_directories : [dir_include, dir_libuuid],
3309 link_with : lib_uuid,
3310 dependencies : socket_libs,
3311 build_by_default: program_tests)
3312 if not is_disabler(exe)
3316 ############################################################
3318 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3319 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3323 'libfdisk/src/ask.c',
3324 c_args : libfdisk_tests_cflags,
3325 include_directories : lib_fdisk_includes,
3326 link_with : libfdisk_tests_ldadd,
3327 build_by_default: program_tests)
3328 if not is_disabler(exe)
3334 'libfdisk/src/gpt.c',
3335 c_args : libfdisk_tests_cflags,
3336 include_directories : lib_fdisk_includes,
3337 link_with : libfdisk_tests_ldadd,
3338 build_by_default: program_tests)
3339 if not is_disabler(exe)
3345 'libfdisk/src/utils.c',
3346 c_args : libfdisk_tests_cflags,
3347 include_directories : lib_fdisk_includes,
3348 link_with : libfdisk_tests_ldadd,
3349 build_by_default: program_tests)
3350 if not is_disabler(exe)
3355 'test_fdisk_script',
3356 'libfdisk/src/script.c',
3357 c_args : libfdisk_tests_cflags,
3358 include_directories : lib_fdisk_includes,
3359 link_with : libfdisk_tests_ldadd,
3360 build_by_default: program_tests)
3361 if not is_disabler(exe)
3366 'test_fdisk_version',
3367 'libfdisk/src/version.c',
3368 c_args : libfdisk_tests_cflags,
3369 include_directories : lib_fdisk_includes,
3370 link_with : libfdisk_tests_ldadd,
3371 build_by_default: program_tests)
3372 if not is_disabler(exe)
3378 'libfdisk/src/item.c',
3379 c_args : libfdisk_tests_cflags,
3380 include_directories : lib_fdisk_includes,
3381 link_with : libfdisk_tests_ldadd,
3382 build_by_default: program_tests)
3383 if not is_disabler(exe)
3387 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3390 'sample-fdisk-mkpart',
3391 'libfdisk/samples/mkpart.c',
3392 include_directories : lib_fdisk_includes,
3393 link_with : sample_fdisk_ldadd)
3394 if not is_disabler(exe)
3399 'sample-fdisk-mkpart-fullspec',
3400 'libfdisk/samples/mkpart-fullspec.c',
3401 include_directories : lib_fdisk_includes,
3402 link_with : sample_fdisk_ldadd)
3403 if not is_disabler(exe)
3407 ############################################################
3411 'tests/helpers/test_cap.c',
3412 include_directories : includes,
3413 dependencies : [lib_cap_ng],
3414 build_by_default: program_tests)
3415 if not is_disabler(exe)
3421 'tests/helpers/test_mbsencode.c',
3422 include_directories : includes,
3423 link_with : lib_common,
3424 build_by_default: program_tests)
3429 'tests/helpers/test_byteswap.c',
3430 include_directories : includes,
3431 build_by_default: program_tests)
3436 'tests/helpers/test_md5.c',
3438 include_directories : includes,
3439 build_by_default: program_tests)
3444 'tests/helpers/test_sha1.c',
3446 include_directories : includes,
3447 build_by_default: program_tests)
3452 'tests/helpers/test_pathnames.c',
3453 include_directories : includes,
3454 build_by_default: program_tests)
3459 'tests/helpers/test_strerror.c',
3460 include_directories : includes,
3461 build_by_default: program_tests)
3466 'tests/helpers/test_sysinfo.c',
3467 include_directories : includes,
3468 build_by_default: program_tests)
3473 'tests/helpers/test_sigreceive.c',
3474 include_directories : includes,
3475 link_with : lib_common,
3476 build_by_default: program_tests)
3481 'tests/helpers/test_tiocsti.c',
3482 include_directories : includes,
3483 build_by_default: program_tests)
3487 'test_uuid_namespace',
3488 'tests/helpers/test_uuid_namespace.c',
3492 include_directories : includes,
3493 build_by_default: program_tests)
3499 'tests/helpers/test_mkfds.c',
3500 'tests/helpers/test_mkfds.h',
3501 'tests/helpers/test_mkfds_ppoll.c',
3502 include_directories : includes,
3503 dependencies : mq_libs,
3504 build_by_default: program_tests)
3510 'tests/helpers/test_enosys.c',
3511 include_directories : includes,
3512 build_by_default: program_tests)
3515 ############################################################
3517 if conf.get('HAVE_OPENAT').to_string() == '1'
3519 'sample-scols-tree',
3520 'libsmartcols/samples/tree.c',
3521 include_directories : includes,
3522 link_with : [lib_smartcols, lib_common],
3523 build_by_default: program_tests)
3524 if not is_disabler(exe)
3530 'sample-scols-title',
3531 'libsmartcols/samples/title.c',
3532 include_directories : includes,
3533 link_with : [lib_smartcols, lib_common])
3534 if not is_disabler(exe)
3539 'sample-scols-wrap',
3540 'libsmartcols/samples/wrap.c',
3541 include_directories : includes,
3542 link_with : [lib_smartcols, lib_common])
3543 if not is_disabler(exe)
3548 'sample-scols-continuous',
3549 'libsmartcols/samples/continuous.c',
3550 include_directories : includes,
3551 link_with : [lib_smartcols, lib_common])
3552 if not is_disabler(exe)
3557 'sample-scols-continuous-json',
3558 'libsmartcols/samples/continuous-json.c',
3559 include_directories : includes,
3560 link_with : [lib_smartcols, lib_common])
3561 if not is_disabler(exe)
3566 'sample-scols-maxout',
3567 'libsmartcols/samples/maxout.c',
3568 include_directories : includes,
3569 link_with : [lib_smartcols, lib_common])
3570 if not is_disabler(exe)
3575 'sample-scols-fromfile',
3576 'libsmartcols/samples/fromfile.c',
3577 include_directories : includes,
3578 link_with : [lib_smartcols, lib_common])
3579 if not is_disabler(exe)
3584 'sample-scols-grouping-simple',
3585 'libsmartcols/samples/grouping-simple.c',
3586 include_directories : includes,
3587 link_with : [lib_smartcols, lib_common])
3588 if not is_disabler(exe)
3593 'sample-scols-grouping-overlay',
3594 'libsmartcols/samples/grouping-overlay.c',
3595 include_directories : includes,
3596 link_with : [lib_smartcols, lib_common])
3597 if not is_disabler(exe)
3603 'Documentation/boilerplate.c',
3604 include_directories : includes,
3605 build_by_default: program_tests)
3606 if not is_disabler(exe)
3610 ############################################################
3612 # Let the test runner know whether we're running under asan and export
3613 # some paths. We use a file on disk so that it is possible to run the
3614 # test scripts from commandline without setting any variables.
3615 configure_file(output : 'meson.conf',
3620 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3621 python.full_path())])
3623 run_sh = find_program('tests/run.sh')
3627 '--srcdir=' + meson.current_source_dir(),
3628 '--builddir=' + meson.current_build_dir(),
3634 manadocs += ['lib/terminal-colors.d.5.adoc']
3635 manadocs += ['libblkid/libblkid.3.adoc']
3639 'libuuid/man/uuid.3.adoc',
3640 'libuuid/man/uuid_clear.3.adoc',
3641 'libuuid/man/uuid_compare.3.adoc',
3642 'libuuid/man/uuid_copy.3.adoc',
3643 'libuuid/man/uuid_generate.3.adoc',
3644 'libuuid/man/uuid_is_null.3.adoc',
3645 'libuuid/man/uuid_parse.3.adoc',
3646 'libuuid/man/uuid_time.3.adoc',
3647 'libuuid/man/uuid_unparse.3.adoc']
3649 'uuid_generate_random.3': 'uuid_generate.3',
3650 'uuid_generate_time.3': 'uuid_generate.3',
3651 'uuid_generate_time_safe.3': 'uuid_generate.3',
3655 asciidoctor = find_program('asciidoctor', required : false)
3656 if asciidoctor.found()
3657 foreach adoc : manadocs
3658 name = adoc.split('/')[-1]
3659 page = name.split('.adoc')[0]
3660 section = page.split('.')[-1]
3661 mandirn = join_paths(mandir, 'man' + section)
3666 command : [ asciidoctor,
3668 '-a', 'VERSION=' + meson.project_version(),
3669 '-a', 'release-version=' + meson.project_version(),
3670 '-a', 'ADJTIME_PATH=/etc/adjtime',
3671 '-a', 'package-docdir=' + docdir,
3672 '--base-dir=' + meson.current_source_dir(),
3673 '--destination-dir=' + meson.current_build_dir(),
3674 '--load-path', '@SOURCE_ROOT@/tools',
3675 '--require', 'asciidoctor-includetracker',
3679 depfile : page + '.deps',
3681 install_dir : mandirn)
3684 foreach link_name, target : manlinks
3685 link_section = link_name.split('.')[-1]
3686 target_section = target.split('.')[-1]
3687 meson.add_install_script(meson_make_manpage_stub,
3688 join_paths('man' + target_section, target),
3689 join_paths(mandir, 'man' + link_section, link_name))
3693 if bash_completion.found()
3694 foreach completion : bashcompletions
3696 join_paths('bash-completion', completion),
3697 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3700 foreach link_name, target : bashcompletionslinks
3701 meson.add_install_script(meson_make_symlink,
3703 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))