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', '-fsigned-char', 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', required : get_option('build-newgrp'))
354 if not lib_crypt.found()
355 lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin'))
358 lib_pam = cc.find_library('pam', required : get_option('build-login'))
359 if not lib_pam.found()
360 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
362 if not lib_pam.found()
363 lib_pam = cc.find_library('pam', required : get_option('build-su'))
365 if not lib_pam.found()
366 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
369 lib_pam_misc = cc.find_library('pam_misc')
370 lib_pam = [lib_pam, lib_pam_misc]
372 lib_pam_misc = declare_dependency()
375 lib_cryptsetup = dependency(
377 required : get_option('cryptsetup'))
378 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
380 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
382 if meson.version().version_compare('>= 0.62.0')
383 lib_dl = dependency('dl')
385 lib_dl = cc.find_library('dl')
387 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
388 summary('cryptsetup support (dlopen)',
390 section : 'components')
392 summary('cryptsetup support',
393 lib_cryptsetup.found() ? 'enabled' : 'disabled',
394 section : 'components')
397 have = cc.has_function(
398 'crypt_activate_by_signed_key',
399 dependencies : lib_cryptsetup)
400 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
402 lib_cap_ng = dependency(
404 required : get_option('build-setpriv'))
405 if not lib_cap_ng.found()
406 lib_cap_ng = disabler()
409 lib_selinux = dependency(
412 required : get_option('selinux'))
413 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
415 lib_magic = dependency(
417 required : get_option('magic'))
418 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
420 lib_econf = dependency(
422 required : get_option('econf'))
423 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
425 lib_audit = dependency(
427 required : get_option('audit'))
428 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
430 conf.set('HAVE_SMACK', not get_option('smack').disabled())
432 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
434 foreach header : headers
435 have = cc.has_header(header)
436 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
439 header = 'linux/btrfs.h'
440 enable_btrfs = cc.has_header(header,
441 required : get_option('btrfs'))
442 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
443 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
445 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
450 have = cc.has_header(header,
452 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
455 have = cc.has_header('sched.h')
456 conf.set10('HAVE_DECL_CPU_ALLOC', have)
457 # We get -1 if the size cannot be determined
458 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
459 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
461 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
462 conf.set('HAVE_ENVIRON_DECL', have ? 1 : false)
464 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
465 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
467 have = cc.has_function('strsignal')
468 conf.set10('HAVE_STRSIGNAL_DECL', have)
470 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
471 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
473 have = cc.has_type('loff_t',
474 args : '-D_GNU_SOURCE',
475 prefix : '#include <sys/types.h>')
476 conf.set('HAVE_LOFF_T', have ? 1 : false)
478 have = cc.compiles('''
479 #define _GNU_SOURCE 1
480 #include <langinfo.h>
483 str = nl_langinfo (ALTMON_1);
484 str = nl_langinfo (ALTMON_2);
485 str = nl_langinfo (ALTMON_3);
486 str = nl_langinfo (ALTMON_4);
487 str = nl_langinfo (ALTMON_5);
488 str = nl_langinfo (ALTMON_6);
489 str = nl_langinfo (ALTMON_7);
490 str = nl_langinfo (ALTMON_8);
491 str = nl_langinfo (ALTMON_9);
492 str = nl_langinfo (ALTMON_10);
493 str = nl_langinfo (ALTMON_11);
494 str = nl_langinfo (ALTMON_12);
498 name : 'langinfo.h defines ALTMON_x constants')
499 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
501 have = cc.compiles('''
502 #define _GNU_SOURCE 1
503 #include <langinfo.h>
506 str = nl_langinfo (_NL_ABALTMON_1);
507 str = nl_langinfo (_NL_ABALTMON_2);
508 str = nl_langinfo (_NL_ABALTMON_3);
509 str = nl_langinfo (_NL_ABALTMON_4);
510 str = nl_langinfo (_NL_ABALTMON_5);
511 str = nl_langinfo (_NL_ABALTMON_6);
512 str = nl_langinfo (_NL_ABALTMON_7);
513 str = nl_langinfo (_NL_ABALTMON_8);
514 str = nl_langinfo (_NL_ABALTMON_9);
515 str = nl_langinfo (_NL_ABALTMON_10);
516 str = nl_langinfo (_NL_ABALTMON_11);
517 str = nl_langinfo (_NL_ABALTMON_12);
521 name : 'langinfo.h defines _NL_ABALTMON_x constants')
522 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
524 have = cc.compiles('''
525 #define _GNU_SOURCE 1
526 #include <langinfo.h>
529 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
533 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
534 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
567 landlock_create_ruleset
569 landlock_restrict_self
632 have = cc.has_function(func)
633 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
634 # This makes little sense, but is necessary to avoid warnings about
635 # redefined macros from Python.h, which uses this convention.
636 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
639 have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
640 conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false)
642 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
643 conf.set('AGETTY_RELOAD', have ? 1 : false)
645 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
648 have_dirfd = (cc.has_function('dirfd') or
649 cc.has_header_symbol('dirent.h', 'dirfd',
650 prefix : '#include <sys/types.h>'))
651 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
653 have_ddfd = cc.has_member('DIR', 'dd_fd',
655 #include <sys/types.h>
658 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
660 have = cc.has_member('struct tm', 'tm_gmtoff',
661 args : '-D_GNU_SOURCE',
666 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
670 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
671 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
673 have = cc.has_member('struct termios', 'c_line',
674 prefix : '#include <termios.h>')
675 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
677 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
678 args : '-D_GNU_SOURCE',
679 prefix : '#include <sys/stat.h>')
680 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
682 have = cc.has_member('struct statx', 'stx_mnt_id',
683 prefix : '#include <sys/stat.h>')
684 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
686 # replacement for AC_STRUCT_TIMEZONE
687 have = cc.has_member('struct tm', 'tm_zone',
688 args : '-D_GNU_SOURCE',
689 prefix : '#include <time.h>')
690 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
692 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
693 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
695 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
696 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
698 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
699 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
704 extern char *tzname[];
707 return tzname ? 0 : 1;
709 '''.format(have ? 1 : 0)
710 have = cc.compiles(code, name : 'using tzname[]')
711 conf.set('HAVE_TZNAME', have ? 1 : false)
713 have = cc.sizeof('time_t', prefix : '#include <time.h>')
715 add_global_arguments('-D_TIME_BITS=64', language : 'c')
716 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
718 if get_option('allow-32bit-time')
719 warning('Could not make time_t 64bits wide')
721 error('Could not make time_t 64bits wide')
727 if not cc.has_function('socket')
728 socket_libs += cc.find_library('socket', required : true)
729 have = cc.has_function('socket',
730 dependencies : socket_libs)
732 error('socket() function not available')
736 lib_rt = cc.find_library('rt', required : false)
738 have = cc.has_function('clock_gettime')
741 realtime_libs += lib_rt
742 have = cc.has_function('clock_gettime',
743 dependencies : realtime_libs)
746 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
748 thread_libs = dependency('threads')
750 have = cc.has_function('timer_create')
753 realtime_libs = [lib_rt]
754 have = cc.has_function('timer_create',
755 dependencies : realtime_libs)
758 realtime_libs += thread_libs
759 have = cc.has_function('timer_create',
760 dependencies : realtime_libs)
763 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
765 have = cc.has_function('setitimer')
766 conf.set('HAVE_SETITIMER', have ? 1 : false)
769 rtas_libs = cc.find_library('rtas', required : false)
770 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
773 if not cc.has_header_symbol('math.h', 'isnan')
774 lib = cc.find_library('m', required : true)
775 if (cc.has_function('isnan', dependencies : lib) and
776 cc.has_function('__isnan', dependencies : lib))
781 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
782 args : '-D_GNU_SOURCE')
783 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
786 extern char *__progname;
788 return (*__progname != 0);
791 have = cc.compiles(code, name : 'using __progname')
792 conf.set('HAVE___PROGNAME', have ? 1 : false)
794 have = conf.get('HAVE_PTY_H').to_string() == '1' \
795 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
796 conf.set('HAVE_PTY', have ? 1 : false)
798 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
799 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
801 build_plymouth_support = get_option('build-plymouth-support')
802 have_tiocglcktrmios = cc.has_header_symbol(
803 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
804 required : build_plymouth_support.enabled())
805 have_sock_cloexec = cc.has_header_symbol(
806 'sys/socket.h', 'SOCK_CLOEXEC',
807 prefix : '#include <sys/types.h>',
808 required : build_plymouth_support.enabled())
809 have_sock_nonblock = cc.has_header_symbol(
810 'sys/socket.h', 'SOCK_NONBLOCK',
811 prefix : '#include <sys/types.h>',
812 required : build_plymouth_support.enabled())
813 have_so_passcred = cc.has_header_symbol(
814 'sys/socket.h', 'SO_PASSCRED',
815 args : ['-D_GNU_SOURCE'],
816 prefix : '#include <sys/types.h>',
817 required : build_plymouth_support.enabled())
819 build_plymouth_support = (not build_plymouth_support.disabled() and
820 have_tiocglcktrmios and
821 have_sock_cloexec and
822 have_sock_nonblock and
824 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
825 summary('plymouth support',
826 build_plymouth_support ? 'enabled' : 'disabled',
827 section : 'components')
829 # check for valid fallocate() function
830 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
831 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
832 # and program can't be linked.
840 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
841 return ret == 0 ? 0 : 1;
844 have = cc.links(code, name : 'fallocate() function')
845 conf.set('HAVE_FALLOCATE', have ? 1 : false)
853 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
854 return ret == 0 ? 0 : 1;
857 have = cc.links(code, name : 'posix_fallocate() function')
858 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
860 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
861 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
862 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
864 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
865 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
866 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
868 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
870 ############################################################
873 fs_search_path = get_option('fs-search-path')
874 fs_search_path_extra = get_option('fs-search-path-extra')
875 if fs_search_path_extra != ''
876 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
878 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
880 systemdsystemunitdir = ''
882 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
885 sysvinit = get_option('sysvinit').enabled()
886 sysvinitrcdir = sysconfdir + '/init.d'
888 program_tests = get_option('program-tests')
890 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
891 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
893 have = get_option('chsh-only-listed')
894 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
896 have = get_option('use-tty-group')
897 conf.set('USE_TTY_GROUP', have ? 1 : false)
899 bison = find_program('bison')
900 flex = find_program('flex')
902 build_hwclock = not get_option('build-hwclock').disabled()
903 bison_gen = generator(
905 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
906 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
908 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
909 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
913 configuration : conf)
915 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
920 '-Waddress-of-packed-member',
921 '-Wdiscarded-qualifiers',
922 '-Wembedded-directive',
925 '-Wimplicit-function-declaration',
926 '-Wmissing-declarations',
927 '-Wmissing-parameter-type',
928 '-Wmissing-prototypes',
930 '-Wno-missing-field-initializers',
931 '-Wold-style-definition',
935 '-Wstrict-prototypes',
938 '-Wunused-but-set-parameter',
939 '-Wunused-but-set-variable',
940 '-Wunused-parameter',
946 foreach compiler_flag : compiler_flags
947 if cc.has_argument(compiler_flag)
948 add_project_arguments(compiler_flag, language : 'c')
956 bashcompletionslinks = {}
962 subdir('libsmartcols')
964 subdir('liblastlog2')
966 subdir('pam_lastlog2')
967 subdir('login-utils')
975 includes = [dir_include,
986 opt = not get_option('build-chfn-chsh').disabled()
991 include_directories : includes,
992 link_with : [lib_common, logindefs_c],
993 dependencies : chfn_chsh_deps,
994 install_dir : usrbin_exec_dir,
995 install_mode : 'rwsr-xr-x',
997 build_by_default : opt)
1001 'login-utils/chsh.c',
1004 include_directories : includes,
1005 link_with : lib_common,
1006 dependencies : chfn_chsh_deps,
1007 install_dir : usrbin_exec_dir,
1008 install_mode : 'rwsr-xr-x',
1010 build_by_default : opt)
1011 if opt and not is_disabler(exe)
1013 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1014 bashcompletions += ['chfn', 'chsh']
1019 test_islocal_sources,
1020 include_directories : includes,
1021 c_args : '-DTEST_PROGRAM',
1022 build_by_default : program_tests)
1027 test_consoles_sources,
1028 c_args : ['-DTEST_PROGRAM'],
1029 include_directories : includes,
1030 link_with : lib_common,
1031 build_by_default : program_tests)
1034 opt = not get_option('build-last').disabled()
1038 include_directories : includes,
1039 link_with : [lib_common],
1040 install_dir : usrbin_exec_dir,
1042 build_by_default : opt)
1043 if opt and not is_disabler(exe)
1045 meson.add_install_script(meson_make_symlink,
1047 join_paths(usrbin_exec_dir, 'lastb'))
1048 manadocs += ['login-utils/last.1.adoc']
1049 manlinks += {'lastb.1': 'last.1'}
1050 bashcompletions += ['last']
1051 bashcompletionslinks += {'lastb': 'last'}
1054 opt = not get_option('build-nologin').disabled()
1057 'login-utils/nologin.c',
1058 include_directories : includes,
1059 install_dir : sbindir,
1060 link_with : [lib_common],
1062 build_by_default : opt)
1063 if opt and not is_disabler(exe)
1065 manadocs += ['login-utils/nologin.8.adoc']
1068 opt = not get_option('build-utmpdump').disabled()
1071 'login-utils/utmpdump.c',
1072 include_directories : includes,
1073 link_with : [lib_common],
1074 install_dir : usrbin_exec_dir,
1076 build_by_default : opt)
1077 if opt and not is_disabler(exe)
1079 manadocs += ['login-utils/utmpdump.1.adoc']
1080 bashcompletions += ['utmpdump']
1083 opt = not get_option('build-su').disabled()
1087 'login-utils/su-common.c',
1088 'login-utils/su-common.h',
1092 include_directories : includes,
1093 link_with : [lib_common, logindefs_c],
1094 dependencies : [lib_pam,
1098 install_mode : 'rwsr-xr-x',
1100 build_by_default : opt)
1101 if opt and not is_disabler(exe)
1103 manadocs += ['login-utils/su.1.adoc']
1104 bashcompletions += ['su']
1107 opt = not get_option('build-newgrp').disabled()
1110 'login-utils/newgrp.c',
1111 include_directories : includes,
1112 dependencies : [lib_crypt],
1113 install_dir : usrbin_exec_dir,
1114 install_mode : 'rwsr-xr-x',
1116 build_by_default : opt)
1117 if opt and not is_disabler(exe)
1119 manadocs += ['login-utils/newgrp.1.adoc']
1120 bashcompletions += ['newgrp']
1123 opt = not get_option('build-lslogins').disabled()
1126 'login-utils/lslogins.c',
1127 include_directories : includes,
1128 link_with : [lib_common,
1131 (build_liblastlog2 ? [lib_lastlog2] : []),
1132 dependencies : [lib_selinux,
1134 install_dir : usrbin_exec_dir,
1136 build_by_default : opt)
1137 if opt and not is_disabler(exe)
1139 manadocs += ['login-utils/lslogins.1.adoc']
1140 bashcompletions += ['lslogins']
1143 opt = not get_option('build-vipw').disabled()
1146 'login-utils/vipw.c',
1147 'login-utils/setpwnam.h',
1148 include_directories : includes,
1149 link_with : [lib_common],
1150 dependencies : [lib_selinux],
1151 install_dir : usrbin_exec_dir,
1153 build_by_default : opt)
1154 if opt and not is_disabler(exe)
1156 meson.add_install_script(meson_make_symlink,
1158 join_paths(usrbin_exec_dir, 'vigr'))
1159 manadocs += ['login-utils/vipw.8.adoc']
1160 meson.add_install_script(meson_make_symlink,
1162 join_paths(mandir, 'man8/vigr.8'))
1165 opt = not get_option('build-runuser').disabled()
1168 'login-utils/runuser.c',
1169 'login-utils/su-common.c',
1170 'login-utils/su-common.h',
1174 include_directories : includes,
1175 link_with : [lib_common, logindefs_c],
1176 dependencies : [lib_pam,
1180 install_dir : sbindir,
1182 build_by_default : opt)
1183 if opt and not is_disabler(exe)
1185 manadocs += ['login-utils/runuser.1.adoc']
1186 bashcompletionslinks += {'runuser': 'su'}
1189 ############################################################
1195 include_directories : includes,
1196 link_with : lib_common,
1197 install_dir : usrbin_exec_dir,
1200 manadocs += ['text-utils/col.1.adoc']
1201 bashcompletions += ['col']
1207 include_directories : includes,
1208 install_dir : usrbin_exec_dir,
1211 manadocs += ['text-utils/colcrt.1.adoc']
1212 bashcompletions += ['colcrt']
1217 include_directories : includes,
1218 link_with : lib_common,
1219 install_dir : usrbin_exec_dir,
1222 manadocs += ['text-utils/colrm.1.adoc']
1223 bashcompletions += ['colrm']
1228 include_directories : includes,
1229 install_dir : usrbin_exec_dir,
1232 manadocs += ['text-utils/rev.1.adoc']
1233 bashcompletions += ['rev']
1238 include_directories : includes,
1239 link_with : [lib_common,
1241 install_dir : usrbin_exec_dir,
1243 if not is_disabler(exe)
1245 manadocs += ['text-utils/column.1.adoc']
1246 bashcompletions += ['column']
1249 opt = not get_option('build-line').disabled()
1253 include_directories : includes,
1254 install_dir : usrbin_exec_dir,
1256 build_by_default : opt)
1257 if opt and not is_disabler(exe)
1259 manadocs += ['text-utils/line.1.adoc']
1262 opt = not get_option('build-pg').disabled()
1266 link_with : lib_common,
1267 include_directories : includes,
1268 dependencies : [lib_tinfo,
1270 install_dir : usrbin_exec_dir,
1272 build_by_default : opt)
1273 if opt and not is_disabler(exe)
1275 manadocs += ['text-utils/pg.1.adoc']
1276 bashcompletions += ['pg']
1279 opt = not get_option('build-ul').disabled()
1283 include_directories : includes,
1284 dependencies : [lib_tinfo,
1286 install_dir : usrbin_exec_dir,
1288 build_by_default : opt)
1289 if opt and not is_disabler(exe)
1291 manadocs += ['text-utils/ul.1.adoc']
1292 bashcompletions += ['ul']
1295 opt = not get_option('build-more').disabled()
1299 link_with : [lib_common],
1300 include_directories : includes,
1301 dependencies : [lib_tinfo,
1305 build_by_default : opt)
1309 link_with : [lib_common],
1310 include_directories : includes,
1311 c_args : '-DTEST_PROGRAM',
1312 dependencies : [lib_tinfo,
1315 build_by_default : opt and program_tests)
1317 if opt and not is_disabler(exe)
1319 manadocs += ['text-utils/more.1.adoc']
1320 bashcompletions += ['more']
1326 include_directories : includes,
1327 link_with : [lib_common,
1329 install_dir : usrbin_exec_dir,
1331 if not is_disabler(exe)
1333 manadocs += ['text-utils/hexdump.1.adoc']
1334 bashcompletions += ['hexdump']
1337 opt = not get_option('build-lsmem').disabled()
1341 include_directories : includes,
1342 link_with : [lib_common,
1344 install_dir : usrbin_exec_dir,
1346 build_by_default : opt)
1347 if opt and not is_disabler(exe)
1349 manadocs += ['sys-utils/lsmem.1.adoc']
1350 bashcompletions += ['lsmem']
1353 opt = not get_option('build-chmem').disabled()
1357 include_directories : includes,
1358 link_with : [lib_common],
1359 install_dir : usrbin_exec_dir,
1361 build_by_default : opt)
1362 if opt and not is_disabler(exe)
1364 manadocs += ['sys-utils/chmem.8.adoc']
1365 bashcompletions += ['chmem']
1371 include_directories : includes,
1372 link_with : [lib_common],
1373 install_dir : usrbin_exec_dir,
1376 manadocs += ['sys-utils/choom.1.adoc']
1381 include_directories : includes,
1382 link_with : [lib_common],
1383 install_dir : usrbin_exec_dir,
1386 manadocs += ['sys-utils/ipcmk.1.adoc']
1387 bashcompletions += ['ipcmk']
1392 include_directories : includes,
1393 link_with : [lib_common],
1394 install_dir : usrbin_exec_dir,
1397 manadocs += ['sys-utils/ipcrm.1.adoc']
1398 bashcompletions += ['ipcrm']
1400 opt = not get_option('build-ipcs').disabled()
1404 include_directories : includes,
1405 link_with : [lib_common],
1406 install_dir : usrbin_exec_dir,
1408 build_by_default : opt)
1409 if opt and not is_disabler(exe)
1411 manadocs += ['sys-utils/ipcs.1.adoc']
1412 bashcompletions += ['ipcs']
1415 opt = not get_option('build-rfkill').disabled()
1419 include_directories : includes,
1420 link_with : [lib_common,
1422 install_dir : usrsbin_exec_dir,
1424 build_by_default : opt)
1425 if opt and not is_disabler(exe)
1427 manadocs += ['sys-utils/rfkill.8.adoc']
1428 bashcompletions += ['rfkill']
1434 include_directories : includes,
1435 link_with : [lib_common,
1437 install_dir : usrbin_exec_dir,
1439 if not is_disabler(exe)
1441 manadocs += ['sys-utils/renice.1.adoc']
1442 bashcompletions += ['renice']
1448 include_directories: includes,
1449 link_with : [lib_common,
1451 install_dir : usrbin_exec_dir,
1453 if opt and not is_disabler(exe)
1455 manadocs += ['sys-utils/setpgid.1.adoc']
1456 bashcompletions += ['setpgid']
1462 include_directories : includes,
1463 link_with : [lib_common,
1465 install_dir : usrbin_exec_dir,
1467 if opt and not is_disabler(exe)
1469 manadocs += ['sys-utils/setsid.1.adoc']
1470 bashcompletions += ['setsid']
1475 readprofile_sources,
1476 include_directories : includes,
1477 link_with : [lib_common,
1479 install_dir : usrsbin_exec_dir,
1481 if not is_disabler(exe)
1483 manadocs += ['sys-utils/readprofile.8.adoc']
1484 bashcompletions += ['readprofile']
1487 opt = not get_option('build-tunelp').disabled()
1491 include_directories : includes,
1492 link_with : [lib_common],
1493 install_dir : usrsbin_exec_dir,
1495 build_by_default : opt)
1496 if opt and not is_disabler(exe)
1498 manadocs += ['sys-utils/tunelp.8.adoc']
1499 bashcompletions += ['tunelp']
1505 include_directories : includes,
1506 link_with : [lib_common,
1508 install_dir : sbindir,
1510 if not is_disabler(exe)
1512 manadocs += ['sys-utils/fstrim.8.adoc']
1513 bashcompletions += ['fstrim']
1519 include_directories : includes,
1520 link_with : [lib_common,
1523 if not is_disabler(exe)
1525 manadocs += ['sys-utils/dmesg.1.adoc']
1526 bashcompletions += ['dmesg']
1532 include_directories : dir_include,
1533 c_args : '-DTEST_DMESG',
1534 link_with : [lib_common,
1536 build_by_default : program_tests)
1537 if not is_disabler(exe)
1544 include_directories : includes,
1545 link_with : [lib_common],
1546 install_dir : sbindir,
1549 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1550 bashcompletions += ['ctrlaltdel']
1555 include_directories : includes,
1556 install_dir : sbindir,
1559 manadocs += ['sys-utils/fsfreeze.8.adoc']
1560 bashcompletions += ['fsfreeze']
1565 include_directories : includes,
1566 link_with : [lib_common,
1568 install_dir : sbindir,
1571 manadocs += ['sys-utils/blkdiscard.8.adoc']
1572 bashcompletions += ['blkdiscard']
1574 if cc.has_header('linux/blkzoned.h')
1578 include_directories : includes,
1579 link_with : [lib_common],
1580 install_dir : sbindir,
1583 manadocs += ['sys-utils/blkzone.8.adoc']
1584 bashcompletions += ['blkzone']
1587 if cc.has_header('linux/pr.h')
1591 include_directories : includes,
1592 link_with : [lib_common],
1593 install_dir : sbindir,
1596 manadocs += ['sys-utils/blkpr.8.adoc']
1602 include_directories : includes,
1603 link_with : [lib_common],
1604 install_dir : usrsbin_exec_dir,
1607 manadocs += ['sys-utils/ldattach.8.adoc']
1608 bashcompletions += ['ldattach']
1613 include_directories : includes,
1614 link_with : [lib_common],
1615 install_dir : usrsbin_exec_dir,
1618 manadocs += ['sys-utils/rtcwake.8.adoc']
1619 bashcompletions += ['rtcwake']
1624 include_directories : includes,
1625 link_with : [lib_common],
1626 install_dir : usrbin_exec_dir,
1629 manadocs += ['sys-utils/setarch.8.adoc']
1630 bashcompletions += ['setarch']
1632 setarch_links = ['uname26', 'linux32', 'linux64']
1633 setarch_links_arch = {
1634 's390x' : ['s390', 's390x'],
1636 'x86_64' : ['i386', 'x86_64'],
1637 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1638 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1639 'mips64' : ['mips', 'mips64', 'mips32'],
1640 'ia64' : ['i386', 'ia64'],
1641 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1643 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1645 foreach link: setarch_links
1646 meson.add_install_script(meson_make_symlink,
1648 join_paths(usrbin_exec_dir, link))
1649 manlinks += {link + '.8': 'setarch.8'}
1652 opt = not get_option('build-eject').disabled()
1656 include_directories : includes,
1657 link_with : [lib_common,
1659 install_dir : usrbin_exec_dir,
1661 build_by_default : opt)
1662 if opt and not is_disabler(exe)
1664 manadocs += ['sys-utils/eject.1.adoc']
1665 bashcompletions += ['eject']
1668 opt = not get_option('build-losetup').disabled()
1672 include_directories : includes,
1673 link_with : [lib_common,
1675 install_dir : sbindir,
1677 build_by_default : opt)
1678 if opt and not is_disabler(exe)
1679 manadocs += ['sys-utils/losetup.8.adoc']
1681 bashcompletions += ['losetup']
1684 opt = opt and 'losetup' in static_programs
1688 include_directories : includes,
1689 link_args : ['--static'],
1690 link_with : [lib_common,
1691 lib_smartcols.get_static_lib()],
1692 install_dir : sbindir,
1694 build_by_default : opt)
1695 if opt and not is_disabler(exe)
1699 opt = not get_option('build-zramctl').disabled()
1703 include_directories : includes,
1704 link_with : [lib_common,
1706 install_dir : sbindir,
1708 build_by_default : opt)
1709 if opt and not is_disabler(exe)
1711 manadocs += ['sys-utils/zramctl.8.adoc']
1712 bashcompletions += ['zramctl']
1718 include_directories : includes,
1719 link_with : [lib_common,
1721 install_dir : usrbin_exec_dir,
1723 if not is_disabler(exe)
1725 manadocs += ['sys-utils/prlimit.1.adoc']
1726 bashcompletions += ['prlimit']
1732 include_directories : includes,
1733 link_with : [lib_common,
1736 install_dir : usrbin_exec_dir,
1738 if not is_disabler(exe)
1740 manadocs += ['sys-utils/lsns.8.adoc']
1741 bashcompletions += ['lsns']
1744 opt = not get_option('build-mount').disabled()
1748 include_directories : includes,
1749 link_with : [lib_common,
1752 dependencies : lib_selinux,
1753 install_mode : 'rwsr-xr-x',
1755 build_by_default : opt)
1759 include_directories : includes,
1760 link_with : [lib_common,
1762 install_mode : 'rwsr-xr-x',
1764 build_by_default : opt)
1765 if opt and not is_disabler(exe)
1767 manadocs += ['sys-utils/fstab.5.adoc',
1768 'sys-utils/mount.8.adoc',
1769 'sys-utils/umount.8.adoc']
1770 bashcompletions += ['mount', 'umount']
1773 opt2 = opt and 'mount' in static_programs
1777 include_directories : includes,
1778 link_args : ['--static'],
1779 link_with : [lib_common,
1780 lib_smartcols_static,
1783 build_by_default : opt2)
1784 if opt2 and not is_disabler(exe)
1788 opt2 = opt and 'umount' in static_programs
1792 include_directories : includes,
1793 link_args : ['--static'],
1794 link_with : [lib_common,
1797 build_by_default : opt2)
1798 if opt2 and not is_disabler(exe)
1807 include_directories : includes,
1808 link_with : [lib_common,
1812 install_dir : sbindir,
1814 if not is_disabler(exe)
1816 manadocs += ['sys-utils/swapon.8.adoc']
1817 bashcompletions += ['swapon']
1823 include_directories : includes,
1824 link_with : [lib_common,
1827 install_dir : sbindir,
1829 if not is_disabler(exe)
1831 manlinks += {'swapoff.8': 'swapon.8'}
1832 bashcompletions += ['swapoff']
1838 include_directories : includes,
1839 link_with : [lib_common,
1841 dependencies : [rtas_libs],
1842 install_dir : usrbin_exec_dir,
1844 if not is_disabler(exe)
1846 manadocs += ['sys-utils/lscpu.1.adoc']
1847 bashcompletions += ['lscpu']
1853 include_directories : includes,
1854 link_with : [lib_common],
1855 install_dir : sbindir,
1858 manadocs += ['sys-utils/chcpu.8.adoc']
1859 bashcompletions += ['chcpu']
1864 include_directories : includes,
1865 link_with : [lib_common,
1868 if not is_disabler(exe)
1870 manadocs += ['sys-utils/wdctl.8.adoc']
1871 bashcompletions += ['wdctl']
1874 opt = not get_option('build-mountpoint').disabled()
1878 include_directories : includes,
1879 link_with : [lib_mount],
1881 build_by_default : opt)
1882 if opt and not is_disabler(exe)
1884 manadocs += ['sys-utils/mountpoint.1.adoc']
1885 bashcompletions += ['mountpoint']
1888 opt = not get_option('build-fallocate').disabled()
1892 include_directories : includes,
1893 link_with : [lib_common],
1894 install_dir : usrbin_exec_dir,
1896 build_by_default : opt)
1897 if opt and not is_disabler(exe)
1899 manadocs += ['sys-utils/fallocate.1.adoc']
1900 bashcompletions += ['fallocate']
1903 opt = not get_option('build-pivot_root').disabled()
1907 include_directories : includes,
1908 install_dir : sbindir,
1910 build_by_default : opt)
1911 if opt and not is_disabler(exe)
1913 manadocs += ['sys-utils/pivot_root.8.adoc']
1914 bashcompletions += ['pivot_root']
1917 opt = not get_option('build-switch_root').disabled()
1918 if opt and not have_dirfd and not have_ddfd
1919 error('neither dirfd nor ddfd are available')
1923 switch_root_sources,
1924 include_directories : includes,
1925 install_dir : sbindir,
1927 build_by_default : opt)
1928 if opt and not is_disabler(exe)
1930 manadocs += ['sys-utils/switch_root.8.adoc']
1933 opt = not get_option('build-unshare').disabled()
1937 include_directories : includes,
1938 link_with : [lib_common],
1939 install_dir : usrbin_exec_dir,
1941 build_by_default : opt)
1942 if opt and not is_disabler(exe)
1944 manadocs += ['sys-utils/unshare.1.adoc']
1945 bashcompletions += ['unshare']
1948 opt = opt and 'unshare' in static_programs
1952 include_directories : includes,
1953 link_with : [lib_common],
1954 install_dir : usrbin_exec_dir,
1956 build_by_default : opt)
1957 if opt and not is_disabler(exe)
1961 opt = not get_option('build-nsenter').disabled()
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)
1973 manadocs += ['sys-utils/nsenter.1.adoc']
1974 bashcompletions += ['nsenter']
1977 opt = opt and 'nsenter' in static_programs
1981 include_directories : includes,
1982 link_with : [lib_common],
1983 dependencies : [lib_selinux],
1984 install_dir : usrbin_exec_dir,
1986 build_by_default : opt)
1987 if opt and not is_disabler(exe)
1991 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1995 include_directories : includes,
1996 link_with : [lib_common],
1997 dependencies : [lib_cap_ng],
1998 install_dir : usrbin_exec_dir,
2000 build_by_default : opt)
2001 if opt and not is_disabler(exe)
2003 manadocs += ['sys-utils/setpriv.1.adoc']
2004 bashcompletions += ['setpriv']
2010 include_directories : includes,
2011 link_with : [lib_common],
2012 dependencies : realtime_libs,
2013 install_dir : usrbin_exec_dir,
2016 manadocs += ['sys-utils/flock.1.adoc']
2017 bashcompletions += ['flock']
2019 opt = not get_option('build-lsirq').disabled()
2023 include_directories : includes,
2024 link_with : [lib_common,
2026 install_dir : usrbin_exec_dir,
2028 build_by_default : opt)
2029 if opt and not is_disabler(exe)
2031 manadocs += ['sys-utils/lsirq.1.adoc']
2032 bashcompletions += ['lsirq']
2035 opt = not get_option('build-irqtop').disabled()
2039 include_directories : includes,
2040 dependencies : [realtime_libs, curses_libs],
2041 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/irqtop.1.adoc']
2050 bashcompletions += ['irqtop']
2053 opt = not get_option('build-ipcs').disabled()
2057 include_directories : includes,
2058 link_with : [lib_common,
2060 install_dir : usrbin_exec_dir,
2062 build_by_default : opt)
2063 if opt and not is_disabler(exe)
2065 manadocs += ['sys-utils/lsipc.1.adoc']
2066 bashcompletions += ['lsipc']
2073 include_directories : includes,
2074 link_with : [lib_common],
2075 dependencies : [lib_m,
2077 install_dir : sbindir,
2079 build_by_default : opt)
2080 if opt and not is_disabler(exe)
2082 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2083 bashcompletions += ['hwclock']
2089 include_directories : includes,
2090 install_dir : sbindir,
2093 manadocs += ['disk-utils/mkfs.8.adoc']
2094 bashcompletions += ['mkfs']
2096 opt = not get_option('build-bfs').disabled()
2100 include_directories : includes,
2101 link_with : [lib_common],
2102 install_dir : sbindir,
2104 build_by_default : opt)
2105 if opt and not is_disabler(exe)
2107 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2108 bashcompletions += ['mkfs.bfs']
2114 include_directories : includes,
2115 link_with : [lib_common],
2116 install_dir : usrbin_exec_dir,
2119 manadocs += ['disk-utils/isosize.8.adoc']
2120 bashcompletions += ['isosize']
2125 include_directories : includes,
2126 link_with : [lib_common,
2129 dependencies: [lib_selinux],
2130 install_dir : sbindir,
2132 if not is_disabler(exe)
2134 manadocs += ['disk-utils/mkswap.8.adoc']
2135 bashcompletions += ['mkswap']
2141 include_directories : includes,
2142 link_with : [lib_common,
2145 install_dir : sbindir,
2147 if not is_disabler(exe)
2149 manadocs += ['disk-utils/swaplabel.8.adoc']
2150 bashcompletions += ['swaplabel']
2153 opt = not get_option('build-fsck').disabled()
2157 include_directories : includes,
2158 link_with : [lib_common,
2161 dependencies : realtime_libs,
2162 install_dir : sbindir,
2164 build_by_default : opt)
2165 if opt and not is_disabler(exe)
2167 manadocs += ['disk-utils/fsck.8.adoc']
2168 bashcompletions += ['fsck']
2171 opt = not get_option('build-minix').disabled()
2175 include_directories : includes,
2176 link_with : [lib_common],
2177 install_dir : sbindir,
2179 build_by_default : opt)
2183 include_directories : includes,
2184 c_args : '-DTEST_SCRIPT',
2185 link_with : [lib_common],
2186 build_by_default : opt and program_tests)
2190 include_directories : includes,
2191 link_with : [lib_common],
2192 install_dir : sbindir,
2194 build_by_default : opt)
2195 if opt and not is_disabler(exe)
2196 exes += [exe, exe2, exe3]
2197 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2198 bashcompletions += ['mkfs.minix', 'fsck.minix']
2201 opt = not get_option('build-cramfs').disabled()
2204 mkfs_cramfs_sources,
2205 include_directories : includes,
2206 link_with : [lib_common],
2207 dependencies : [lib_z],
2208 install_dir : sbindir,
2210 build_by_default : opt)
2213 fsck_cramfs_sources,
2214 include_directories : includes,
2215 link_with : [lib_common],
2216 dependencies : [lib_z],
2217 install_dir : sbindir,
2219 build_by_default : opt)
2220 if not is_disabler(exe)
2222 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2223 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2226 opt = not get_option('build-raw').disabled()
2228 cc.has_header('linux/raw.h', required: opt)
2233 include_directories : includes,
2234 install_dir : sbindir,
2236 build_by_default : opt)
2237 if opt and not is_disabler(exe)
2239 manadocs += ['disk-utils/raw.8.adoc']
2240 bashcompletions += ['raw']
2243 opt = not get_option('build-fdformat').disabled()
2247 include_directories : includes,
2248 link_with : [lib_common],
2249 install_dir : usrsbin_exec_dir,
2251 build_by_default : opt)
2252 if opt and not is_disabler(exe)
2254 manadocs += ['disk-utils/fdformat.8.adoc']
2255 bashcompletions += ['fdformat']
2261 include_directories : includes,
2262 link_with : [lib_common],
2263 install_dir : sbindir,
2265 manadocs += ['disk-utils/blockdev.8.adoc']
2266 bashcompletions += ['blockdev']
2268 opt = not get_option('build-fdisks').disabled()
2269 if opt and not have_dirfd and not have_ddfd
2270 error('neither dirfd nor ddfd are available')
2275 include_directories : includes,
2276 link_with : [lib_common,
2280 dependencies : [lib_readline],
2281 install_dir : sbindir,
2283 build_by_default : opt)
2284 if opt and not is_disabler(exe)
2286 bashcompletions += ['fdisk']
2289 opt2 = opt and 'fdisk' in static_programs
2293 link_args : ['--static'],
2294 include_directories : includes,
2295 link_with : [lib_common,
2298 lib_smartcols.get_static_lib()],
2299 dependencies : [lib_readline_static],
2300 install_dir : sbindir,
2302 build_by_default : opt2)
2303 if opt2 and not is_disabler(exe)
2310 include_directories : includes,
2311 link_with : [lib_common,
2315 dependencies : [lib_readline],
2316 install_dir : sbindir,
2318 build_by_default : opt)
2319 if opt and not is_disabler(exe)
2321 bashcompletions += ['sfdisk']
2324 opt2 = opt and 'sfdisk' in static_programs
2328 include_directories : includes,
2329 link_with : [lib_common,
2332 lib_smartcols.get_static_lib()],
2333 dependencies : [lib_readline_static],
2334 install_dir : sbindir,
2336 build_by_default : opt2)
2337 if opt2 and not is_disabler(exe)
2344 include_directories : includes,
2345 link_with : [lib_common,
2350 dependencies : [curses_libs],
2351 install_dir : sbindir,
2353 build_by_default : opt)
2354 if opt and not is_disabler(exe)
2356 manadocs += ['disk-utils/fdisk.8.adoc',
2357 'disk-utils/sfdisk.8.adoc',
2358 'disk-utils/cfdisk.8.adoc']
2359 bashcompletions += ['cfdisk']
2362 opt = not get_option('build-partx').disabled()
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],
2376 install_dir : usrsbin_exec_dir,
2378 build_by_default : opt)
2382 include_directories : includes,
2383 link_with : [lib_common],
2384 install_dir : usrsbin_exec_dir,
2386 build_by_default : opt)
2390 include_directories : includes,
2391 link_with : [lib_common,
2394 install_dir : usrsbin_exec_dir,
2396 build_by_default : opt)
2398 exes += [exe, exe2, exe3, exe4]
2399 manadocs += ['disk-utils/addpart.8.adoc',
2400 'disk-utils/delpart.8.adoc',
2401 'disk-utils/resizepart.8.adoc',
2402 'disk-utils/partx.8.adoc']
2403 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2405 opt = opt and 'partx' in static_programs
2409 include_directories : includes,
2410 link_args : ['--static'],
2411 link_with : [lib_common],
2412 install_dir : usrsbin_exec_dir,
2414 build_by_default : opt)
2418 include_directories : includes,
2419 link_args : ['--static'],
2420 link_with : [lib_common],
2421 install_dir : usrsbin_exec_dir,
2423 build_by_default : opt)
2425 'resizepart.static',
2427 include_directories : includes,
2428 link_args : ['--static'],
2429 link_with : [lib_common],
2430 install_dir : usrsbin_exec_dir,
2432 build_by_default : opt)
2436 include_directories : includes,
2437 link_args : ['--static'],
2438 link_with : [lib_common,
2439 lib_blkid.get_static_lib(),
2440 lib_smartcols.get_static_lib()],
2441 install_dir : usrsbin_exec_dir,
2443 build_by_default : opt)
2446 exes += [exe, exe2, exe3, exe4]
2449 ############################################################
2454 include_directories : includes,
2455 link_with : [lib_common],
2456 dependencies : [lib_util,
2460 install_dir : usrbin_exec_dir,
2463 manadocs += ['term-utils/script.1.adoc']
2464 bashcompletions += ['script']
2469 include_directories : includes,
2470 c_args : '-DTEST_SCRIPT',
2471 link_with : [lib_common],
2472 dependencies : [lib_util,
2476 build_by_default : program_tests)
2482 include_directories : includes,
2483 link_with : [lib_common],
2484 dependencies : [lib_util,
2487 install_dir : usrbin_exec_dir,
2490 manadocs += ['term-utils/scriptlive.1.adoc']
2491 bashcompletions += ['scriptlive']
2495 scriptreplay_sources,
2496 include_directories : includes,
2497 link_with : [lib_common],
2498 dependencies : [math_libs],
2499 install_dir : usrbin_exec_dir,
2502 manadocs += ['term-utils/scriptreplay.1.adoc']
2503 bashcompletions += ['scriptreplay']
2505 opt = not get_option('build-agetty').disabled()
2509 include_directories : includes,
2510 link_with : [lib_common, logindefs_c],
2511 dependencies : [BSD ? lib_util : [], lib_systemd],
2512 install_dir : sbindir,
2514 build_by_default : opt)
2517 manadocs += ['term-utils/agetty.8.adoc']
2520 opt = not get_option('build-setterm').disabled()
2524 include_directories : includes,
2525 link_with : [lib_common],
2526 dependencies : [curses_libs],
2527 install_dir : usrbin_exec_dir,
2529 build_by_default : opt)
2532 manadocs += ['term-utils/setterm.1.adoc']
2533 bashcompletions += ['setterm']
2536 opt = not get_option('build-mesg').disabled()
2540 include_directories : includes,
2541 link_with : [lib_common],
2542 install_dir : usrbin_exec_dir,
2544 build_by_default : opt)
2547 manadocs += ['term-utils/mesg.1.adoc']
2548 bashcompletions += ['mesg']
2551 opt = not get_option('build-wall').disabled()
2555 include_directories : includes,
2556 link_with : [lib_common],
2557 dependencies : [lib_systemd],
2558 install_dir : usrbin_exec_dir,
2559 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2561 build_by_default : opt)
2564 manadocs += ['term-utils/wall.1.adoc']
2565 bashcompletions += ['wall']
2568 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2569 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2571 opt = not get_option('build-write').disabled()
2575 include_directories : includes,
2576 link_with : [lib_common],
2577 dependencies : [lib_systemd],
2578 install_dir : usrbin_exec_dir,
2579 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2581 build_by_default : opt)
2584 manadocs += ['term-utils/write.1.adoc']
2585 bashcompletions += ['write']
2588 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2589 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2591 opt = not get_option('build-login').disabled()
2595 include_directories : includes,
2596 link_with : [lib_common, logindefs_c],
2597 dependencies : [lib_pam,
2601 build_by_default : opt)
2602 if not is_disabler(exe)
2604 manadocs += ['login-utils/login.1.adoc']
2607 opt = not get_option('build-sulogin').disabled()
2611 include_directories : includes,
2612 link_with : [lib_common],
2613 dependencies : [lib_crypt,
2615 install_dir : sbindir,
2617 build_by_default : opt)
2618 if not is_disabler(exe)
2620 manadocs += ['login-utils/sulogin.8.adoc']
2626 include_directories : includes,
2627 link_with : [lib_common,
2629 dependencies : [curses_libs],
2630 install_dir : usrbin_exec_dir,
2633 manadocs += ['misc-utils/cal.1.adoc']
2634 bashcompletions += ['cal']
2636 opt = not get_option('build-logger').disabled()
2640 include_directories : includes,
2641 link_with : [lib_common],
2642 dependencies : [lib_systemd],
2643 install_dir : usrbin_exec_dir,
2645 build_by_default : opt)
2646 if opt and not is_disabler(exe)
2648 manadocs += ['misc-utils/logger.1.adoc']
2649 bashcompletions += ['logger']
2655 include_directories : includes,
2656 c_args : '-DTEST_LOGGER',
2657 link_with : [lib_common],
2658 dependencies : [lib_systemd],
2659 build_by_default: program_tests)
2660 if not is_disabler(exe)
2667 include_directories : includes,
2668 install_dir : usrbin_exec_dir,
2671 manadocs += ['misc-utils/look.1.adoc']
2672 bashcompletions += ['look']
2677 include_directories : includes,
2678 link_with : [lib_common],
2679 install_dir : usrbin_exec_dir,
2682 manadocs += ['misc-utils/mcookie.1.adoc']
2683 bashcompletions += ['mcookie']
2685 if build_liblastlog2
2689 include_directories : includes,
2690 link_with : [lib_common, lib_lastlog2],
2691 install_dir : usrbin_exec_dir,
2694 manadocs += ['misc-utils/lastlog2.8.adoc']
2695 bashcompletions += ['lastlog2']
2696 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2697 'liblastlog2/man/ll2_write_entry.3.adoc',
2698 'liblastlog2/man/ll2_read_entry.3.adoc',
2699 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2700 'liblastlog2/man/ll2_read_all.3.adoc',
2701 'liblastlog2/man/ll2_remove_entry.3.adoc',
2702 'liblastlog2/man/ll2_rename_user.3.adoc',
2703 'liblastlog2/man/ll2_update_login_time.3.adoc'
2710 include_directories : includes,
2711 dependencies : [lib_selinux],
2712 install_dir : usrbin_exec_dir,
2715 manadocs += ['misc-utils/namei.1.adoc']
2716 bashcompletions += ['namei']
2721 include_directories : includes,
2722 link_with : [lib_common],
2723 install_dir : usrbin_exec_dir,
2726 manadocs += ['misc-utils/whereis.1.adoc']
2727 bashcompletions += ['whereis']
2732 include_directories : includes,
2733 link_with : [lib_common,
2736 install_dir : usrbin_exec_dir,
2738 if not is_disabler(exe)
2740 manadocs += ['misc-utils/lslocks.8.adoc']
2741 bashcompletions += ['lslocks']
2747 include_directories : includes,
2748 link_with : [lib_common,
2753 dependencies : lib_udev,
2755 if not is_disabler(exe)
2757 manadocs += ['misc-utils/lsblk.8.adoc']
2758 bashcompletions += ['lsblk']
2761 errnos_h = custom_target('errnos.h',
2762 input : 'tools/all_errnos',
2763 output : 'errnos.h',
2764 command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
2767 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2770 lsfd_sources, errnos_h,
2771 include_directories : includes,
2772 link_with : [lib_common,
2774 dependencies : [lib_rt],
2775 install_dir : usrbin_exec_dir,
2777 build_by_default : opt)
2778 if opt and not is_disabler(exe)
2780 manadocs += ['misc-utils/lsfd.1.adoc']
2786 include_directories : includes,
2787 link_with : [lib_common,
2789 install_dir : usrbin_exec_dir,
2791 if not is_disabler(exe)
2793 manadocs += ['misc-utils/uuidgen.1.adoc']
2794 bashcompletions += ['uuidgen']
2800 include_directories : includes,
2801 link_with : [lib_common,
2804 install_dir : usrbin_exec_dir,
2806 if not is_disabler(exe)
2808 manadocs += ['misc-utils/uuidparse.1.adoc']
2809 bashcompletions += ['uuidparse']
2816 include_directories : includes,
2817 link_with : [lib_common,
2819 dependencies : [realtime_libs,
2821 install_dir : usrsbin_exec_dir,
2823 build_by_default : opt)
2827 include_directories : includes,
2828 link_with : [lib_common,
2830 dependencies : thread_libs,
2831 build_by_default : opt and program_tests)
2832 if not is_disabler(exe)
2834 manadocs += ['misc-utils/uuidd.8.adoc']
2835 bashcompletions += ['uuidd']
2838 opt = build_libblkid
2842 include_directories : includes,
2843 link_with : [lib_common,
2845 install_dir : sbindir,
2847 build_by_default : opt)
2848 if opt and not is_disabler(exe)
2850 manadocs += ['misc-utils/blkid.8.adoc']
2851 bashcompletions += ['blkid']
2854 opt = opt and 'blkid' in static_programs
2858 include_directories : includes,
2859 link_with : [lib_common,
2861 install_dir : sbindir,
2863 build_by_default : opt)
2864 if opt and not is_disabler(exe)
2870 'libblkid/samples/mkfs.c',
2871 include_directories : includes,
2872 link_with : lib_blkid)
2873 if not is_disabler(exe)
2878 'sample-partitions',
2879 'libblkid/samples/partitions.c',
2880 include_directories : includes,
2881 link_with : lib_blkid)
2882 if not is_disabler(exe)
2887 'sample-superblocks',
2888 'libblkid/samples/superblocks.c',
2889 include_directories : includes,
2890 link_with : lib_blkid)
2891 if not is_disabler(exe)
2897 'libblkid/samples/topology.c',
2898 include_directories : includes,
2899 link_with : lib_blkid)
2900 if not is_disabler(exe)
2905 'test_blkid_fuzz_sample',
2906 'libblkid/src/fuzz.c',
2907 include_directories: includes,
2908 link_with: lib_blkid,
2909 build_by_default: program_tests)
2910 if not is_disabler(exe)
2914 ############################################################
2919 include_directories : includes,
2920 link_with : [lib_blkid],
2921 install_dir : sbindir,
2923 if not is_disabler(exe)
2925 manadocs += ['misc-utils/findfs.8.adoc']
2926 bashcompletions += ['findfs']
2932 include_directories : includes,
2933 link_with : [lib_common,
2936 install_dir : sbindir,
2938 if not is_disabler(exe)
2940 manadocs += ['misc-utils/wipefs.8.adoc']
2941 bashcompletions += ['wipefs']
2947 include_directories : includes,
2948 link_with : [lib_common,
2952 dependencies : [lib_udev],
2954 if not is_disabler(exe)
2956 manadocs += ['misc-utils/findmnt.8.adoc']
2957 bashcompletions += ['findmnt']
2963 include_directories : includes,
2964 link_with : [lib_common],
2966 if not is_disabler(exe)
2968 manadocs += ['misc-utils/kill.1.adoc']
2971 opt = not get_option('build-rename').disabled()
2975 include_directories : includes,
2976 install_dir : usrbin_exec_dir,
2978 build_by_default : opt)
2979 if opt and not is_disabler(exe)
2981 manadocs += ['misc-utils/rename.1.adoc']
2982 bashcompletions += ['rename']
2988 include_directories : includes,
2989 link_with : [lib_common],
2990 install_dir : usrbin_exec_dir,
2993 manadocs += ['misc-utils/getopt.1.adoc']
2994 bashcompletions += ['getopt']
2999 include_directories : includes,
3000 link_with : [lib_common,
3002 install_dir : usrbin_exec_dir,
3004 if not is_disabler(exe)
3006 manadocs += ['misc-utils/fincore.1.adoc']
3007 bashcompletions += ['fincore']
3013 include_directories : includes,
3014 link_with : [lib_common],
3015 install_dir : usrbin_exec_dir,
3017 if not is_disabler(exe)
3019 manadocs += ['misc-utils/hardlink.1.adoc']
3020 bashcompletions += ['hardlink']
3023 opt = not get_option('build-pipesz').disabled()
3027 include_directories : includes,
3028 link_with : [lib_common],
3029 install_dir : usrbin_exec_dir,
3031 if opt and not is_disabler(exe)
3033 manadocs += ['misc-utils/pipesz.1.adoc']
3034 bashcompletions += ['pipesz']
3040 include_directories : includes,
3041 c_args : '-DTEST_CAL',
3042 link_with : [lib_common,
3044 dependencies : [curses_libs],
3045 build_by_default: program_tests)
3046 if not is_disabler(exe)
3053 include_directories : includes,
3054 link_with : [lib_common],
3055 install_dir : usrbin_exec_dir,
3057 if not is_disabler(exe)
3059 manadocs += ['misc-utils/fadvise.1.adoc']
3060 bashcompletions += ['fadvise']
3063 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3067 include_directories : includes,
3068 link_with : [lib_common],
3069 install_dir : usrbin_exec_dir,
3071 if not is_disabler(exe)
3073 manadocs += ['misc-utils/waitpid.1.adoc']
3074 bashcompletions += ['waitpid']
3078 syscalls_h = custom_target('syscalls.h',
3079 input : 'tools/all_syscalls',
3080 output : 'syscalls.h',
3081 command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
3084 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3087 'misc-utils/enosys.c', syscalls_h, errnos_h,
3088 include_directories : includes,
3089 link_with : [lib_common],
3090 install_dir : usrbin_exec_dir,
3092 if not is_disabler(exe)
3094 manadocs += ['misc-utils/enosys.1.adoc']
3095 bashcompletions += ['enosys']
3102 include_directories : includes,
3103 link_with : [lib_common, lib_smartcols],
3104 install_dir : usrbin_exec_dir,
3106 if not is_disabler(exe)
3108 manadocs += ['misc-utils/lsclocks.1.adoc']
3109 bashcompletions += ['lsclocks']
3112 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3116 include_directories : includes,
3117 link_with : [lib_common],
3118 install_dir : usrbin_exec_dir,
3120 if not is_disabler(exe)
3122 manadocs += ['misc-utils/exch.1.adoc']
3123 bashcompletions += ['exch']
3127 ############################################################
3129 opt = not get_option('build-schedutils').disabled()
3132 'schedutils/chrt.c',
3133 include_directories : includes,
3134 link_with : lib_common,
3135 install_dir : usrbin_exec_dir,
3137 build_by_default : opt)
3141 'schedutils/ionice.c',
3142 include_directories : includes,
3143 link_with : lib_common,
3144 install_dir : usrbin_exec_dir,
3146 build_by_default : opt)
3150 'schedutils/taskset.c',
3151 include_directories : includes,
3152 link_with : lib_common,
3153 install_dir : usrbin_exec_dir,
3155 build_by_default : opt)
3159 'schedutils/uclampset.c',
3160 include_directories : includes,
3161 link_with : lib_common,
3162 install_dir : usrbin_exec_dir,
3164 build_by_default : opt)
3166 if opt and not is_disabler(exe)
3167 exes += [exe, exe2, exe3, exe4]
3168 manadocs += ['schedutils/chrt.1.adoc',
3169 'schedutils/ionice.1.adoc',
3170 'schedutils/taskset.1.adoc',
3171 'schedutils/uclampset.1.adoc']
3172 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3175 ############################################################
3177 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3182 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3183 include_directories : dir_include,
3184 link_with : lib_common,
3185 build_by_default: program_tests)
3191 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3192 include_directories : dir_include,
3193 link_with : lib_common,
3194 build_by_default: program_tests)
3200 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3201 include_directories : dir_include,
3202 link_with : lib_common,
3203 build_by_default: program_tests)
3209 c_args : ['-DTEST_PROGRAM_MANGLE'],
3210 include_directories : dir_include,
3211 build_by_default: program_tests)
3217 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3218 include_directories : dir_include,
3219 build_by_default: program_tests)
3225 'lib/color-names.c',
3226 c_args : ['-DTEST_PROGRAM_COLORS'],
3227 include_directories : dir_include,
3228 link_with : [lib_common, lib_tcolors],
3229 build_by_default: program_tests)
3235 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3236 include_directories : dir_include,
3237 build_by_default: program_tests)
3240 if conf.get('HAVE_OPENAT').to_string() == '1' \
3241 and conf.get('HAVE_DIRFD').to_string() == '1'
3245 c_args : ['-DTEST_PROGRAM_PROCFS'],
3246 include_directories : dir_include,
3247 link_with : lib_common,
3248 build_by_default: program_tests)
3255 have_cpu_set_t ? 'lib/cpuset.c' : [],
3256 c_args : ['-DTEST_PROGRAM_PATH'],
3257 include_directories : dir_include,
3258 link_with : lib_common,
3259 build_by_default: program_tests)
3263 if conf.get('HAVE_PTY').to_string() == '1'
3268 c_args : ['-DTEST_PROGRAM_PTY'],
3269 include_directories : dir_include,
3270 link_with : [lib_common],
3271 dependencies : [lib_m,
3274 build_by_default: program_tests)
3282 c_args : ['-DTEST_PROGRAM_CPUSET'],
3283 include_directories : dir_include,
3284 build_by_default: program_tests)
3295 have_cpu_set_t ? 'lib/cpuset.c' : [],
3296 c_args : ['-DTEST_PROGRAM_SYSFS'],
3297 include_directories : dir_include,
3298 build_by_default: program_tests)
3304 c_args : ['-DTEST_PROGRAM_PAGER'],
3305 include_directories : dir_include,
3306 build_by_default: program_tests)
3310 'test_linux_version',
3311 'lib/linux_version.c',
3312 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3313 include_directories : dir_include,
3314 build_by_default: program_tests)
3320 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3321 include_directories : dir_include,
3322 build_by_default: program_tests)
3326 'test_canonicalize',
3327 'lib/canonicalize.c',
3328 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3329 include_directories : dir_include,
3330 build_by_default: program_tests)
3337 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3338 include_directories : dir_include,
3339 build_by_default: program_tests)
3345 c_args : ['-DTEST_PROGRAM'],
3346 include_directories : dir_include,
3347 link_with : lib_common,
3348 build_by_default: program_tests)
3354 c_args : ['-DTEST_PROGRAM'],
3355 include_directories : dir_include,
3356 link_with : [lib_common, logindefs_c],
3357 build_by_default: program_tests)
3361 ############################################################
3365 'libuuid/src/test_uuid.c',
3366 include_directories : [dir_include, dir_libuuid],
3367 link_with : lib_uuid,
3368 dependencies : socket_libs,
3369 build_by_default: program_tests)
3370 if not is_disabler(exe)
3374 ############################################################
3376 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3377 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3381 'libfdisk/src/ask.c',
3382 c_args : libfdisk_tests_cflags,
3383 include_directories : lib_fdisk_includes,
3384 link_with : libfdisk_tests_ldadd,
3385 build_by_default: program_tests)
3386 if not is_disabler(exe)
3392 'libfdisk/src/gpt.c',
3393 c_args : libfdisk_tests_cflags,
3394 include_directories : lib_fdisk_includes,
3395 link_with : libfdisk_tests_ldadd,
3396 build_by_default: program_tests)
3397 if not is_disabler(exe)
3403 'libfdisk/src/utils.c',
3404 c_args : libfdisk_tests_cflags,
3405 include_directories : lib_fdisk_includes,
3406 link_with : libfdisk_tests_ldadd,
3407 build_by_default: program_tests)
3408 if not is_disabler(exe)
3413 'test_fdisk_script',
3414 'libfdisk/src/script.c',
3415 c_args : libfdisk_tests_cflags,
3416 include_directories : lib_fdisk_includes,
3417 link_with : libfdisk_tests_ldadd,
3418 build_by_default: program_tests)
3419 if not is_disabler(exe)
3424 'test_fdisk_version',
3425 'libfdisk/src/version.c',
3426 c_args : libfdisk_tests_cflags,
3427 include_directories : lib_fdisk_includes,
3428 link_with : libfdisk_tests_ldadd,
3429 build_by_default: program_tests)
3430 if not is_disabler(exe)
3436 'libfdisk/src/item.c',
3437 c_args : libfdisk_tests_cflags,
3438 include_directories : lib_fdisk_includes,
3439 link_with : libfdisk_tests_ldadd,
3440 build_by_default: program_tests)
3441 if not is_disabler(exe)
3445 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3448 'sample-fdisk-mkpart',
3449 'libfdisk/samples/mkpart.c',
3450 include_directories : lib_fdisk_includes,
3451 link_with : sample_fdisk_ldadd)
3452 if not is_disabler(exe)
3457 'sample-fdisk-mkpart-fullspec',
3458 'libfdisk/samples/mkpart-fullspec.c',
3459 include_directories : lib_fdisk_includes,
3460 link_with : sample_fdisk_ldadd)
3461 if not is_disabler(exe)
3465 ############################################################
3469 'tests/helpers/test_cap.c',
3470 include_directories : includes,
3471 dependencies : [lib_cap_ng],
3472 build_by_default: program_tests)
3473 if not is_disabler(exe)
3479 'tests/helpers/test_mbsencode.c',
3480 include_directories : includes,
3481 link_with : lib_common,
3482 build_by_default: program_tests)
3487 'tests/helpers/test_byteswap.c',
3488 include_directories : includes,
3489 build_by_default: program_tests)
3494 'tests/helpers/test_md5.c',
3496 include_directories : includes,
3497 build_by_default: program_tests)
3502 'tests/helpers/test_sha1.c',
3504 include_directories : includes,
3505 build_by_default: program_tests)
3510 'tests/helpers/test_pathnames.c',
3511 include_directories : includes,
3512 build_by_default: program_tests)
3517 'tests/helpers/test_strerror.c',
3518 include_directories : includes,
3519 build_by_default: program_tests)
3524 'tests/helpers/test_sysinfo.c',
3525 include_directories : includes,
3526 build_by_default: program_tests)
3531 'tests/helpers/test_sigreceive.c',
3532 include_directories : includes,
3533 link_with : lib_common,
3534 build_by_default: program_tests)
3539 'tests/helpers/test_tiocsti.c',
3540 include_directories : includes,
3541 build_by_default: program_tests)
3545 'test_uuid_namespace',
3546 'tests/helpers/test_uuid_namespace.c',
3550 include_directories : includes,
3551 build_by_default: program_tests)
3554 if LINUX and lib_rt.found()
3557 'tests/helpers/test_mkfds.c',
3558 'tests/helpers/test_mkfds.h',
3559 'tests/helpers/test_mkfds_ppoll.c',
3560 include_directories : includes,
3561 dependencies : [lib_rt],
3562 build_by_default: program_tests)
3568 'tests/helpers/test_enosys.c',
3569 include_directories : includes,
3570 build_by_default: program_tests)
3573 ############################################################
3575 if conf.get('HAVE_OPENAT').to_string() == '1'
3577 'sample-scols-tree',
3578 'libsmartcols/samples/tree.c',
3579 include_directories : includes,
3580 link_with : [lib_smartcols, lib_common],
3581 build_by_default: program_tests)
3582 if not is_disabler(exe)
3588 'sample-scols-title',
3589 'libsmartcols/samples/title.c',
3590 include_directories : includes,
3591 link_with : [lib_smartcols, lib_common])
3592 if not is_disabler(exe)
3597 'sample-scols-wrap',
3598 'libsmartcols/samples/wrap.c',
3599 include_directories : includes,
3600 link_with : [lib_smartcols, lib_common])
3601 if not is_disabler(exe)
3606 'sample-scols-continuous',
3607 'libsmartcols/samples/continuous.c',
3608 include_directories : includes,
3609 link_with : [lib_smartcols, lib_common])
3610 if not is_disabler(exe)
3615 'sample-scols-continuous-json',
3616 'libsmartcols/samples/continuous-json.c',
3617 include_directories : includes,
3618 link_with : [lib_smartcols, lib_common])
3619 if not is_disabler(exe)
3624 'sample-scols-maxout',
3625 'libsmartcols/samples/maxout.c',
3626 include_directories : includes,
3627 link_with : [lib_smartcols, lib_common])
3628 if not is_disabler(exe)
3633 'sample-scols-fromfile',
3634 'libsmartcols/samples/fromfile.c',
3635 include_directories : includes,
3636 link_with : [lib_smartcols, lib_common])
3637 if not is_disabler(exe)
3642 'sample-scols-grouping-simple',
3643 'libsmartcols/samples/grouping-simple.c',
3644 include_directories : includes,
3645 link_with : [lib_smartcols, lib_common])
3646 if not is_disabler(exe)
3651 'sample-scols-grouping-overlay',
3652 'libsmartcols/samples/grouping-overlay.c',
3653 include_directories : includes,
3654 link_with : [lib_smartcols, lib_common])
3655 if not is_disabler(exe)
3661 'Documentation/boilerplate.c',
3662 include_directories : includes,
3663 build_by_default: program_tests)
3664 if not is_disabler(exe)
3668 ############################################################
3670 # Let the test runner know whether we're running under asan and export
3671 # some paths. We use a file on disk so that it is possible to run the
3672 # test scripts from commandline without setting any variables.
3673 configure_file(output : 'meson.conf',
3678 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3679 python.full_path())])
3681 run_sh = find_program('tests/run.sh')
3685 '--srcdir=' + meson.current_source_dir(),
3686 '--builddir=' + meson.current_build_dir(),
3692 manadocs += ['lib/terminal-colors.d.5.adoc']
3693 manadocs += ['libblkid/libblkid.3.adoc']
3697 'libuuid/man/uuid.3.adoc',
3698 'libuuid/man/uuid_clear.3.adoc',
3699 'libuuid/man/uuid_compare.3.adoc',
3700 'libuuid/man/uuid_copy.3.adoc',
3701 'libuuid/man/uuid_generate.3.adoc',
3702 'libuuid/man/uuid_is_null.3.adoc',
3703 'libuuid/man/uuid_parse.3.adoc',
3704 'libuuid/man/uuid_time.3.adoc',
3705 'libuuid/man/uuid_unparse.3.adoc']
3707 'uuid_generate_random.3': 'uuid_generate.3',
3708 'uuid_generate_time.3': 'uuid_generate.3',
3709 'uuid_generate_time_safe.3': 'uuid_generate.3',
3713 asciidoctor = find_program('asciidoctor', required : false)
3714 if asciidoctor.found()
3715 foreach adoc : manadocs
3716 name = adoc.split('/')[-1]
3717 page = name.split('.adoc')[0]
3718 section = page.split('.')[-1]
3719 mandirn = join_paths(mandir, 'man' + section)
3724 command : [ asciidoctor,
3726 '-a', 'VERSION=' + meson.project_version(),
3727 '-a', 'release-version=' + meson.project_version(),
3728 '-a', 'ADJTIME_PATH=/etc/adjtime',
3729 '-a', 'package-docdir=' + docdir,
3730 '--base-dir=' + meson.current_source_dir(),
3731 '--destination-dir=' + meson.current_build_dir(),
3732 '--load-path', '@SOURCE_ROOT@/tools',
3733 '--require', 'asciidoctor-includetracker',
3737 depfile : page + '.deps',
3739 install_dir : mandirn)
3742 foreach link_name, target : manlinks
3743 link_section = link_name.split('.')[-1]
3744 target_section = target.split('.')[-1]
3745 meson.add_install_script(meson_make_manpage_stub,
3746 join_paths('man' + target_section, target),
3747 join_paths(mandir, 'man' + link_section, link_name))
3751 if bash_completion.found()
3752 foreach completion : bashcompletions
3754 join_paths('bash-completion', completion),
3755 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3758 foreach link_name, target : bashcompletionslinks
3759 meson.add_install_script(meson_make_symlink,
3761 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))