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 fs.is_absolute(prefixdir)
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 if host_machine.system() == 'darwin'
45 add_project_arguments('-D_DARWIN_C_SOURCE', language : 'c')
48 cc = meson.get_compiler('c')
50 conf = configuration_data()
51 conf.set_quoted('PACKAGE', meson.project_name())
52 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
53 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
54 conf.set_quoted('PACKAGE_STRING', package_string)
57 pc_version = meson.project_version().split('-')[0].split('.')
59 if pc_version.length() < 3
63 pc_version = '.'.join(pc_version)
65 conf.set_quoted('LIBBLKID_VERSION', pc_version)
66 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
68 conf.set('bindir', bindir)
69 conf.set('sbindir', sbindir)
70 conf.set('runstatedir', runstatedir)
71 conf.set('localstatedir', localstatedir)
72 conf.set('sysconfdir', sysconfdir)
73 conf.set('usrbin_execdir', usrbin_exec_dir)
74 conf.set('usrsbin_execdir', usrsbin_exec_dir)
75 conf.set('docdir', docdir)
76 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
77 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
78 conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir)
79 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
80 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
82 conf.set_quoted('_PATH_VENDORDIR', vendordir)
83 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
85 build_libblkid = get_option('build-libblkid').allowed()
86 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
87 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
89 build_libuuid = not get_option('build-libuuid').disabled()
90 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
91 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
93 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
94 build_liblastlog2 = get_option('build-liblastlog2').require(lib_sqlite3.found()).allowed()
95 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
96 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
98 login_lastlogin = get_option('login-lastlogin')
99 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
100 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
102 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
103 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
104 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
106 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
107 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
109 have_sys_vfs_header = cc.has_header('sys/vfs.h')
111 build_libmount = get_option('build-libmount').require(
112 get_option('build-libblkid').allowed() \
113 and have_sys_vfs_header \
116 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
117 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
118 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
119 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
121 build_libsmartcols = not get_option('build-libsmartcols').disabled()
122 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
123 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
125 build_libfdisk = not get_option('build-libfdisk').require(get_option('build-libblkid').allowed()).disabled()
126 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
127 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
129 build_uuidd = not get_option('build-uuidd').disabled()
130 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
131 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
133 static_programs = get_option('static-programs')
134 need_static_libs = static_programs.length() > 0 # a rough estimate...
135 summary('static programs', static_programs)
137 LINUX = host_machine.system() in ['linux']
138 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
140 ############################################################
158 have = cc.compiles(code, name : 'wchar_t support')
159 if not have and get_option('widechar').enabled()
160 error('widechar support requested but unavailable')
162 if get_option('ncurses').enabled() and get_option('widechar').enabled()
163 error('widechar support is incompatible with non-wide ncurses')
165 conf.set('HAVE_WIDECHAR', have ? 1 : false)
207 linux/net_namespace.h
221 security/pam_modules.h
254 lib_m = cc.find_library('m')
256 lib_tinfo = dependency(
259 required : get_option('tinfo'))
261 lib_ncursesw = dependency(
263 required : get_option('ncursesw'))
264 if lib_ncursesw.found()
265 headers += ['ncursesw/ncurses.h',
269 lib_ncurses = disabler()
271 lib_ncurses = dependency(
274 required : get_option('ncurses'))
275 headers += ['ncurses.h',
279 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
280 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
281 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
283 lib_slang = dependency(
285 required : get_option('slang'))
287 headers += ['slang.h',
292 conf.set('HAVE_SLANG', lib_slang.found())
294 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
295 if curses_libs.found()
296 have = cc.has_function('use_default_colors', dependencies : curses_libs)
297 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
298 have = cc.has_function('resizeterm', dependencies : curses_libs)
299 conf.set('HAVE_RESIZETERM', have ? 1 : false)
307 required : get_option('zlib'))
309 lib_readline = dependency(
311 required : get_option('readline'))
312 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
314 lib_readline_static = dependency(
317 required : need_static_libs ? get_option('readline') : disabler())
319 if meson.version().version_compare('>= 0.59.0')
320 lib_intl = dependency(
322 required : get_option('nls'))
323 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
325 if get_option('nls').enabled()
326 error('nls is not supported with meson before 0.59.0')
328 lib_intl = dependency('', required : false)
331 lib_user = dependency(
334 required : get_option('libuser'))
335 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
337 lib_util = cc.find_library(
339 required : get_option('libutil'))
340 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
342 lib_utempter = cc.find_library(
344 required : get_option('libutempter'))
345 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
347 systemd = dependency(
349 required : get_option('systemd'))
351 lib_systemd = dependency(
353 required : get_option('systemd'))
354 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
355 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
357 have = cc.has_function(
358 'sd_session_get_username',
359 dependencies : lib_systemd)
360 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
362 lib_udev = dependency(
364 required : get_option('systemd'))
365 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
367 lib_crypt = cc.find_library('crypt', required : get_option('build-newgrp'))
368 if not lib_crypt.found()
369 lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin'))
372 lib_pam = cc.find_library(
375 required : get_option('build-login').enabled() or \
376 get_option('build-chfn-chsh').enabled() or \
377 get_option('build-su').enabled() or \
378 get_option('build-runuser').enabled())
380 lib_pam_misc = cc.find_library('pam_misc')
381 lib_pam = [lib_pam, lib_pam_misc]
383 lib_pam_misc = declare_dependency()
386 lib_cryptsetup = dependency(
388 required : get_option('cryptsetup'))
389 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
391 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
393 if meson.version().version_compare('>= 0.62.0')
394 lib_dl = dependency('dl')
396 lib_dl = cc.find_library('dl')
398 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
399 summary('cryptsetup support (dlopen)',
401 section : 'components')
403 summary('cryptsetup support',
404 lib_cryptsetup.found() ? 'enabled' : 'disabled',
405 section : 'components')
408 have = cc.has_function(
409 'crypt_activate_by_signed_key',
410 dependencies : lib_cryptsetup)
411 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
413 lib_cap_ng = dependency(
415 required : get_option('build-setpriv'))
416 if not lib_cap_ng.found()
417 lib_cap_ng = disabler()
420 lib_selinux = dependency(
423 required : get_option('selinux'))
424 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
426 lib_magic = dependency(
428 required : get_option('magic'))
429 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
431 lib_econf = dependency(
433 required : get_option('econf'))
434 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
436 lib_audit = dependency(
438 required : get_option('audit'))
439 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
441 conf.set('HAVE_SMACK', not get_option('smack').disabled())
444 foreach header : headers
445 have = cc.has_header(header)
446 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
449 header = 'linux/btrfs.h'
450 enable_btrfs = cc.has_header(header,
451 required : get_option('btrfs'))
452 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
453 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
455 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
460 have = cc.has_header(header,
462 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
465 have = cc.has_header('sched.h')
466 conf.set10('HAVE_DECL_CPU_ALLOC', have)
467 have_cpu_set_t = cc.has_type('cpu_set_t', args : '-D_GNU_SOURCE', prefix : '#include <sched.h>')
468 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
470 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
471 conf.set('HAVE_ENVIRON_DECL', have ? 1 : false)
473 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
474 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
476 have = cc.has_function('strsignal')
477 conf.set10('HAVE_STRSIGNAL_DECL', have)
479 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
480 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
482 have = cc.has_type('loff_t',
483 args : '-D_GNU_SOURCE',
484 prefix : '#include <sys/types.h>')
485 conf.set('HAVE_LOFF_T', have ? 1 : false)
487 have = cc.compiles('''
488 #define _GNU_SOURCE 1
489 #include <langinfo.h>
492 str = nl_langinfo (ALTMON_1);
493 str = nl_langinfo (ALTMON_2);
494 str = nl_langinfo (ALTMON_3);
495 str = nl_langinfo (ALTMON_4);
496 str = nl_langinfo (ALTMON_5);
497 str = nl_langinfo (ALTMON_6);
498 str = nl_langinfo (ALTMON_7);
499 str = nl_langinfo (ALTMON_8);
500 str = nl_langinfo (ALTMON_9);
501 str = nl_langinfo (ALTMON_10);
502 str = nl_langinfo (ALTMON_11);
503 str = nl_langinfo (ALTMON_12);
507 name : 'langinfo.h defines ALTMON_x constants')
508 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
510 have = cc.compiles('''
511 #define _GNU_SOURCE 1
512 #include <langinfo.h>
515 str = nl_langinfo (_NL_ABALTMON_1);
516 str = nl_langinfo (_NL_ABALTMON_2);
517 str = nl_langinfo (_NL_ABALTMON_3);
518 str = nl_langinfo (_NL_ABALTMON_4);
519 str = nl_langinfo (_NL_ABALTMON_5);
520 str = nl_langinfo (_NL_ABALTMON_6);
521 str = nl_langinfo (_NL_ABALTMON_7);
522 str = nl_langinfo (_NL_ABALTMON_8);
523 str = nl_langinfo (_NL_ABALTMON_9);
524 str = nl_langinfo (_NL_ABALTMON_10);
525 str = nl_langinfo (_NL_ABALTMON_11);
526 str = nl_langinfo (_NL_ABALTMON_12);
530 name : 'langinfo.h defines _NL_ABALTMON_x constants')
531 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
533 have = cc.compiles('''
534 #define _GNU_SOURCE 1
535 #include <langinfo.h>
538 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
542 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
543 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
576 landlock_create_ruleset
578 landlock_restrict_self
641 have = cc.has_function(func)
642 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
643 # This makes little sense, but is necessary to avoid warnings about
644 # redefined macros from Python.h, which uses this convention.
645 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
648 have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
649 conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false)
651 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
652 conf.set('AGETTY_RELOAD', have ? 1 : false)
654 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
657 have_dirfd = (cc.has_function('dirfd') or
658 cc.has_header_symbol('dirent.h', 'dirfd',
659 prefix : '#include <sys/types.h>'))
660 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
662 have_ddfd = cc.has_member('DIR', 'dd_fd',
664 #include <sys/types.h>
667 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
669 have = cc.has_member('struct tm', 'tm_gmtoff',
670 args : '-D_GNU_SOURCE',
675 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
679 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
680 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
682 have = cc.has_member('struct termios', 'c_line',
683 prefix : '#include <termios.h>')
684 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
686 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
687 args : '-D_GNU_SOURCE',
688 prefix : '#include <sys/stat.h>')
689 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
691 have = cc.has_member('struct statx', 'stx_mnt_id',
692 prefix : '#include <sys/stat.h>')
693 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
695 # replacement for AC_STRUCT_TIMEZONE
696 have = cc.has_member('struct tm', 'tm_zone',
697 args : '-D_GNU_SOURCE',
698 prefix : '#include <time.h>')
699 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
701 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
702 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
704 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
705 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
707 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
708 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
713 extern char *tzname[];
716 return tzname ? 0 : 1;
718 '''.format(have ? 1 : 0)
719 have = cc.compiles(code, name : 'using tzname[]')
720 conf.set('HAVE_TZNAME', have ? 1 : false)
722 have = cc.sizeof('time_t', prefix : '#include <time.h>')
724 add_global_arguments('-D_TIME_BITS=64', language : 'c')
725 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
727 if get_option('allow-32bit-time')
728 warning('Could not make time_t 64bits wide')
730 error('Could not make time_t 64bits wide')
736 if not cc.has_function('socket')
737 socket_libs += cc.find_library('socket', required : true)
738 have = cc.has_function('socket',
739 dependencies : socket_libs)
741 error('socket() function not available')
745 lib_rt = cc.find_library('rt', required : false)
747 have = cc.has_function('clock_gettime')
750 realtime_libs += lib_rt
751 have = cc.has_function('clock_gettime',
752 dependencies : realtime_libs)
755 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
757 thread_libs = dependency('threads')
759 have = cc.has_function('timer_create')
762 realtime_libs = [lib_rt]
763 have = cc.has_function('timer_create',
764 dependencies : realtime_libs)
767 realtime_libs += thread_libs
768 have = cc.has_function('timer_create',
769 dependencies : realtime_libs)
772 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
774 have = cc.has_function('setitimer')
775 conf.set('HAVE_SETITIMER', have ? 1 : false)
778 rtas_libs = cc.find_library('rtas', required : false)
779 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
782 if not cc.has_header_symbol('math.h', 'isnan')
783 lib = cc.find_library('m', required : true)
784 if (cc.has_function('isnan', dependencies : lib) and
785 cc.has_function('__isnan', dependencies : lib))
790 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
791 args : '-D_GNU_SOURCE')
792 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
795 extern char *__progname;
797 return (*__progname != 0);
800 have = cc.compiles(code, name : 'using __progname')
801 conf.set('HAVE___PROGNAME', have ? 1 : false)
803 have_pty = conf.get('HAVE_PTY_H').to_string() == '1' \
804 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
805 conf.set('HAVE_PTY', have_pty ? 1 : false)
807 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
808 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
810 build_plymouth_support = get_option('build-plymouth-support')
811 have_tiocglcktrmios = cc.has_header_symbol(
812 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
813 required : build_plymouth_support.enabled())
814 have_sock_cloexec = cc.has_header_symbol(
815 'sys/socket.h', 'SOCK_CLOEXEC',
816 prefix : '#include <sys/types.h>',
817 required : build_plymouth_support.enabled())
818 have_sock_nonblock = cc.has_header_symbol(
819 'sys/socket.h', 'SOCK_NONBLOCK',
820 prefix : '#include <sys/types.h>',
821 required : build_plymouth_support.enabled())
822 have_so_passcred = cc.has_header_symbol(
823 'sys/socket.h', 'SO_PASSCRED',
824 args : ['-D_GNU_SOURCE'],
825 prefix : '#include <sys/types.h>',
826 required : build_plymouth_support.enabled())
828 build_plymouth_support = (not build_plymouth_support.disabled() and
829 have_tiocglcktrmios and
830 have_sock_cloexec and
831 have_sock_nonblock and
833 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
834 summary('plymouth support',
835 build_plymouth_support ? 'enabled' : 'disabled',
836 section : 'components')
838 # check for valid fallocate() function
839 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
840 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
841 # and program can't be linked.
849 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
850 return ret == 0 ? 0 : 1;
853 have = cc.links(code, name : 'fallocate() function')
854 conf.set('HAVE_FALLOCATE', have ? 1 : false)
862 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
863 return ret == 0 ? 0 : 1;
866 have = cc.links(code, name : 'posix_fallocate() function')
867 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
869 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
870 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
871 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
873 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
874 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
875 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
877 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
879 ############################################################
882 fs_search_path = get_option('fs-search-path')
883 fs_search_path_extra = get_option('fs-search-path-extra')
884 if fs_search_path_extra != ''
885 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
887 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
889 systemdsystemunitdir = ''
891 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
894 sysvinit = get_option('sysvinit').enabled()
895 sysvinitrcdir = sysconfdir + '/init.d'
897 program_tests = get_option('program-tests')
899 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
900 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
902 have = get_option('chsh-only-listed')
903 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
905 have = get_option('use-tty-group')
906 conf.set('USE_TTY_GROUP', have ? 1 : false)
908 bison = find_program('bison')
909 flex = find_program('flex')
910 sed = find_program('sed')
912 build_hwclock = not get_option('build-hwclock').disabled()
913 bison_gen = generator(
915 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
916 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
918 python_module = import('python')
919 python = python_module.find_installation(
920 get_option('python'),
924 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
925 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
929 configuration : conf)
931 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
936 '-Waddress-of-packed-member',
937 '-Wdiscarded-qualifiers',
938 '-Wembedded-directive',
941 '-Wimplicit-function-declaration',
942 '-Wmissing-declarations',
943 '-Wmissing-parameter-type',
944 '-Wmissing-prototypes',
946 '-Wno-missing-field-initializers',
947 '-Wold-style-definition',
951 '-Wstrict-prototypes',
954 '-Wunused-but-set-parameter',
955 '-Wunused-but-set-variable',
956 '-Wunused-parameter',
962 foreach compiler_flag : compiler_flags
963 if cc.has_argument(compiler_flag)
964 add_project_arguments(compiler_flag, language : 'c')
972 bashcompletionslinks = {}
978 subdir('libsmartcols')
980 subdir('liblastlog2')
982 subdir('pam_lastlog2')
983 subdir('login-utils')
992 includes = [dir_include,
1001 opt = not get_option('build-chfn-chsh').disabled()
1006 include_directories : includes,
1007 link_with : [lib_common, logindefs_c],
1008 dependencies : chfn_chsh_deps,
1009 install_dir : usrbin_exec_dir,
1010 install_mode : 'rwsr-xr-x',
1012 build_by_default : opt)
1016 'login-utils/chsh.c',
1019 include_directories : includes,
1020 link_with : lib_common,
1021 dependencies : chfn_chsh_deps,
1022 install_dir : usrbin_exec_dir,
1023 install_mode : 'rwsr-xr-x',
1025 build_by_default : opt)
1026 if opt and not is_disabler(exe)
1028 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1029 bashcompletions += ['chfn', 'chsh']
1034 test_islocal_sources,
1035 include_directories : includes,
1036 c_args : '-DTEST_PROGRAM',
1037 build_by_default : program_tests)
1042 test_consoles_sources,
1043 c_args : ['-DTEST_PROGRAM'],
1044 include_directories : includes,
1045 link_with : lib_common,
1046 build_by_default : program_tests)
1049 opt = not get_option('build-last').disabled()
1053 include_directories : includes,
1054 link_with : [lib_common],
1055 install_dir : usrbin_exec_dir,
1057 build_by_default : opt)
1058 if opt and not is_disabler(exe)
1060 meson.add_install_script(meson_make_symlink,
1062 join_paths(usrbin_exec_dir, 'lastb'))
1063 manadocs += ['login-utils/last.1.adoc']
1064 manlinks += {'lastb.1': 'last.1'}
1065 bashcompletions += ['last']
1066 bashcompletionslinks += {'lastb': 'last'}
1069 opt = not get_option('build-nologin').disabled()
1072 'login-utils/nologin.c',
1073 include_directories : includes,
1074 install_dir : sbindir,
1075 link_with : [lib_common],
1077 build_by_default : opt)
1078 if opt and not is_disabler(exe)
1080 manadocs += ['login-utils/nologin.8.adoc']
1083 opt = not get_option('build-utmpdump').disabled()
1086 'login-utils/utmpdump.c',
1087 include_directories : includes,
1088 link_with : [lib_common],
1089 install_dir : usrbin_exec_dir,
1091 build_by_default : opt)
1092 if opt and not is_disabler(exe)
1094 manadocs += ['login-utils/utmpdump.1.adoc']
1095 bashcompletions += ['utmpdump']
1098 opt = get_option('build-su').require(have_pty).allowed()
1102 'login-utils/su-common.c',
1103 'login-utils/su-common.h',
1107 include_directories : includes,
1108 link_with : [lib_common, logindefs_c],
1109 dependencies : [lib_pam,
1113 install_mode : 'rwsr-xr-x',
1115 build_by_default : opt)
1116 if opt and not is_disabler(exe)
1118 manadocs += ['login-utils/su.1.adoc']
1119 bashcompletions += ['su']
1122 opt = not get_option('build-newgrp').disabled()
1125 'login-utils/newgrp.c',
1126 include_directories : includes,
1127 dependencies : [lib_crypt],
1128 install_dir : usrbin_exec_dir,
1129 install_mode : 'rwsr-xr-x',
1131 build_by_default : opt)
1132 if opt and not is_disabler(exe)
1134 manadocs += ['login-utils/newgrp.1.adoc']
1135 bashcompletions += ['newgrp']
1138 opt = not get_option('build-lslogins').disabled()
1141 'login-utils/lslogins.c',
1142 include_directories : includes,
1143 link_with : [lib_common,
1146 (build_liblastlog2 ? [lib_lastlog2] : []),
1147 dependencies : [lib_selinux,
1149 install_dir : usrbin_exec_dir,
1151 build_by_default : opt)
1152 if opt and not is_disabler(exe)
1154 manadocs += ['login-utils/lslogins.1.adoc']
1155 bashcompletions += ['lslogins']
1158 opt = not get_option('build-vipw').disabled()
1161 'login-utils/vipw.c',
1162 'login-utils/setpwnam.h',
1163 include_directories : includes,
1164 link_with : [lib_common],
1165 dependencies : [lib_selinux],
1166 install_dir : usrbin_exec_dir,
1168 build_by_default : opt)
1169 if opt and not is_disabler(exe)
1171 meson.add_install_script(meson_make_symlink,
1173 join_paths(usrbin_exec_dir, 'vigr'))
1174 manadocs += ['login-utils/vipw.8.adoc']
1175 meson.add_install_script(meson_make_symlink,
1177 join_paths(mandir, 'man8/vigr.8'))
1180 opt = get_option('build-runuser').require(have_pty).allowed()
1183 'login-utils/runuser.c',
1184 'login-utils/su-common.c',
1185 'login-utils/su-common.h',
1189 include_directories : includes,
1190 link_with : [lib_common, logindefs_c],
1191 dependencies : [lib_pam,
1195 install_dir : sbindir,
1197 build_by_default : opt)
1198 if opt and not is_disabler(exe)
1200 manadocs += ['login-utils/runuser.1.adoc']
1201 bashcompletionslinks += {'runuser': 'su'}
1204 ############################################################
1210 include_directories : includes,
1211 link_with : lib_common,
1212 install_dir : usrbin_exec_dir,
1215 manadocs += ['text-utils/col.1.adoc']
1216 bashcompletions += ['col']
1222 include_directories : includes,
1223 install_dir : usrbin_exec_dir,
1226 manadocs += ['text-utils/colcrt.1.adoc']
1227 bashcompletions += ['colcrt']
1232 include_directories : includes,
1233 link_with : lib_common,
1234 install_dir : usrbin_exec_dir,
1237 manadocs += ['text-utils/colrm.1.adoc']
1238 bashcompletions += ['colrm']
1243 include_directories : includes,
1244 install_dir : usrbin_exec_dir,
1247 manadocs += ['text-utils/rev.1.adoc']
1248 bashcompletions += ['rev']
1253 include_directories : includes,
1254 link_with : [lib_common,
1256 install_dir : usrbin_exec_dir,
1258 if not is_disabler(exe)
1260 manadocs += ['text-utils/column.1.adoc']
1261 bashcompletions += ['column']
1264 opt = not get_option('build-line').disabled()
1268 include_directories : includes,
1269 install_dir : usrbin_exec_dir,
1271 build_by_default : opt)
1272 if opt and not is_disabler(exe)
1274 manadocs += ['text-utils/line.1.adoc']
1277 opt = not get_option('build-pg').disabled()
1281 link_with : lib_common,
1282 include_directories : includes,
1283 dependencies : [lib_tinfo,
1285 install_dir : usrbin_exec_dir,
1287 build_by_default : opt)
1288 if opt and not is_disabler(exe)
1290 manadocs += ['text-utils/pg.1.adoc']
1291 bashcompletions += ['pg']
1294 opt = not get_option('build-ul').disabled()
1298 include_directories : includes,
1299 dependencies : [lib_tinfo,
1301 install_dir : usrbin_exec_dir,
1303 build_by_default : opt)
1304 if opt and not is_disabler(exe)
1306 manadocs += ['text-utils/ul.1.adoc']
1307 bashcompletions += ['ul']
1310 opt = not get_option('build-more').disabled()
1314 link_with : [lib_common],
1315 include_directories : includes,
1316 dependencies : [lib_tinfo,
1320 build_by_default : opt)
1324 link_with : [lib_common],
1325 include_directories : includes,
1326 c_args : '-DTEST_PROGRAM',
1327 dependencies : [lib_tinfo,
1330 build_by_default : opt and program_tests)
1332 if opt and not is_disabler(exe)
1334 manadocs += ['text-utils/more.1.adoc']
1335 bashcompletions += ['more']
1341 include_directories : includes,
1342 link_with : [lib_common,
1344 install_dir : usrbin_exec_dir,
1346 if not is_disabler(exe)
1348 manadocs += ['text-utils/hexdump.1.adoc']
1349 bashcompletions += ['hexdump']
1352 opt = not get_option('build-lsmem').disabled()
1356 include_directories : includes,
1357 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/lsmem.1.adoc']
1365 bashcompletions += ['lsmem']
1368 opt = not get_option('build-chmem').disabled()
1372 include_directories : includes,
1373 link_with : [lib_common],
1374 install_dir : usrbin_exec_dir,
1376 build_by_default : opt)
1377 if opt and not is_disabler(exe)
1379 manadocs += ['sys-utils/chmem.8.adoc']
1380 bashcompletions += ['chmem']
1386 include_directories : includes,
1387 link_with : [lib_common],
1388 install_dir : usrbin_exec_dir,
1391 manadocs += ['sys-utils/choom.1.adoc']
1393 has_seminfo_type = cc.has_type('struct seminfo', args : '-D_GNU_SOURCE', prefix : '#include <sys/sem.h>')
1395 opt = get_option('build-ipcmk').require(has_seminfo_type).allowed()
1399 include_directories : includes,
1400 link_with : [lib_common],
1401 install_dir : usrbin_exec_dir,
1403 build_by_default : opt)
1404 if opt and not is_disabler(exe)
1406 manadocs += ['sys-utils/ipcmk.1.adoc']
1407 bashcompletions += ['ipcmk']
1410 opt = get_option('build-ipcrm').require(has_seminfo_type).allowed()
1414 include_directories : includes,
1415 link_with : [lib_common],
1416 install_dir : usrbin_exec_dir,
1418 build_by_default : opt)
1419 if opt and not is_disabler(exe)
1421 manadocs += ['sys-utils/ipcrm.1.adoc']
1422 bashcompletions += ['ipcrm']
1425 opt = not get_option('build-ipcs').require(has_seminfo_type).disabled()
1429 include_directories : includes,
1430 link_with : [lib_common],
1431 install_dir : usrbin_exec_dir,
1433 build_by_default : opt)
1434 if opt and not is_disabler(exe)
1436 manadocs += ['sys-utils/ipcs.1.adoc']
1437 bashcompletions += ['ipcs']
1440 opt = not get_option('build-rfkill').disabled()
1444 include_directories : includes,
1445 link_with : [lib_common,
1447 install_dir : usrsbin_exec_dir,
1449 build_by_default : opt)
1450 if opt and not is_disabler(exe)
1452 manadocs += ['sys-utils/rfkill.8.adoc']
1453 bashcompletions += ['rfkill']
1459 include_directories : includes,
1460 link_with : [lib_common,
1462 install_dir : usrbin_exec_dir,
1464 if not is_disabler(exe)
1466 manadocs += ['sys-utils/renice.1.adoc']
1467 bashcompletions += ['renice']
1473 include_directories: includes,
1474 link_with : [lib_common,
1476 install_dir : usrbin_exec_dir,
1478 if opt and not is_disabler(exe)
1480 manadocs += ['sys-utils/setpgid.1.adoc']
1481 bashcompletions += ['setpgid']
1487 include_directories : includes,
1488 link_with : [lib_common,
1490 install_dir : usrbin_exec_dir,
1492 if opt and not is_disabler(exe)
1494 manadocs += ['sys-utils/setsid.1.adoc']
1495 bashcompletions += ['setsid']
1500 readprofile_sources,
1501 include_directories : includes,
1502 link_with : [lib_common,
1504 install_dir : usrsbin_exec_dir,
1506 if not is_disabler(exe)
1508 manadocs += ['sys-utils/readprofile.8.adoc']
1509 bashcompletions += ['readprofile']
1512 opt = not get_option('build-tunelp').disabled()
1516 include_directories : includes,
1517 link_with : [lib_common],
1518 install_dir : usrsbin_exec_dir,
1520 build_by_default : opt)
1521 if opt and not is_disabler(exe)
1523 manadocs += ['sys-utils/tunelp.8.adoc']
1524 bashcompletions += ['tunelp']
1527 opt = get_option('build-fstrim').require(have_sys_vfs_header).allowed()
1531 include_directories : includes,
1532 link_with : [lib_common],
1533 dependencies : [mount_dep],
1534 install_dir : sbindir,
1536 build_by_default : opt)
1537 if opt and not is_disabler(exe)
1539 manadocs += ['sys-utils/fstrim.8.adoc']
1540 bashcompletions += ['fstrim']
1543 opt = get_option('build-dmesg').require(cc.has_header('sys/klog.h')).allowed()
1547 include_directories : includes,
1548 link_with : [lib_common,
1551 build_by_default : opt)
1552 if opt and not is_disabler(exe)
1554 manadocs += ['sys-utils/dmesg.1.adoc']
1555 bashcompletions += ['dmesg']
1561 include_directories : dir_include,
1562 c_args : '-DTEST_DMESG',
1563 link_with : [lib_common,
1565 build_by_default : program_tests)
1566 if not is_disabler(exe)
1573 include_directories : includes,
1574 link_with : [lib_common],
1575 install_dir : sbindir,
1578 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1579 bashcompletions += ['ctrlaltdel']
1581 have_linux_fs_h = conf.get('HAVE_LINUX_FS_H').to_string() == '1'
1583 opt = get_option('build-fsfreeze').require(have_linux_fs_h).allowed()
1587 include_directories : includes,
1588 install_dir : sbindir,
1590 build_by_default : opt)
1591 if opt and not is_disabler(exe)
1593 manadocs += ['sys-utils/fsfreeze.8.adoc']
1594 bashcompletions += ['fsfreeze']
1597 opt = get_option('build-blkdiscard').require(have_linux_fs_h).allowed()
1601 include_directories : includes,
1602 link_with : [lib_common],
1603 dependencies : [blkid_dep],
1604 install_dir : sbindir,
1606 build_by_default : opt)
1607 if opt and not is_disabler(exe)
1609 manadocs += ['sys-utils/blkdiscard.8.adoc']
1610 bashcompletions += ['blkdiscard']
1613 opt = get_option('build-blkzone').require(have_linux_fs_h).allowed()
1617 include_directories : includes,
1618 link_with : [lib_common],
1619 install_dir : sbindir,
1621 build_by_default : opt)
1622 if opt and not is_disabler(exe)
1624 manadocs += ['sys-utils/blkzone.8.adoc']
1625 bashcompletions += ['blkzone']
1628 opt = get_option('build-blkpr').require(cc.has_header('linux/pr.h')).allowed()
1632 include_directories : includes,
1633 link_with : [lib_common],
1634 install_dir : sbindir,
1636 build_by_default : opt)
1637 if opt and not is_disabler(exe)
1639 manadocs += ['sys-utils/blkpr.8.adoc']
1642 opt = get_option('build-ldattach').require(cc.has_header('linux/if.h')).allowed()
1646 include_directories : includes,
1647 link_with : [lib_common],
1648 install_dir : usrsbin_exec_dir,
1650 build_by_default : opt)
1651 if opt and not is_disabler(exe)
1653 manadocs += ['sys-utils/ldattach.8.adoc']
1654 bashcompletions += ['ldattach']
1657 have_linux_rtc_h = cc.has_header('linux/rtc.h')
1659 opt = get_option('build-rtcwake').require(have_linux_rtc_h).allowed()
1663 include_directories : includes,
1664 link_with : [lib_common],
1665 install_dir : usrsbin_exec_dir,
1667 build_by_default : opt)
1668 if opt and not is_disabler(exe)
1670 manadocs += ['sys-utils/rtcwake.8.adoc']
1671 bashcompletions += ['rtcwake']
1674 opt = get_option('build-setarch').require(cc.has_header('sys/personality.h')).allowed()
1678 include_directories : includes,
1679 link_with : [lib_common],
1680 install_dir : usrbin_exec_dir,
1682 build_by_default : opt)
1683 if opt and not is_disabler(exe)
1685 manadocs += ['sys-utils/setarch.8.adoc']
1686 bashcompletions += ['setarch']
1690 setarch_links = ['uname26', 'linux32', 'linux64']
1691 setarch_links_arch = {
1692 's390x' : ['s390', 's390x'],
1694 'x86_64' : ['i386', 'x86_64'],
1695 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1696 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1697 'mips64' : ['mips', 'mips64', 'mips32'],
1698 'ia64' : ['i386', 'ia64'],
1699 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1701 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1703 foreach link: setarch_links
1704 meson.add_install_script(meson_make_symlink,
1706 join_paths(usrbin_exec_dir, link))
1707 manlinks += {link + '.8': 'setarch.8'}
1711 opt = not get_option('build-eject').disabled()
1715 include_directories : includes,
1716 link_with : [lib_common],
1717 dependencies : [mount_dep],
1718 install_dir : usrbin_exec_dir,
1720 build_by_default : opt)
1721 if opt and not is_disabler(exe)
1723 manadocs += ['sys-utils/eject.1.adoc']
1724 bashcompletions += ['eject']
1727 opt = not get_option('build-losetup').disabled()
1731 include_directories : includes,
1732 link_with : [lib_common,
1734 install_dir : sbindir,
1736 build_by_default : opt)
1737 if opt and not is_disabler(exe)
1738 manadocs += ['sys-utils/losetup.8.adoc']
1740 bashcompletions += ['losetup']
1743 opt = opt and 'losetup' in static_programs
1747 include_directories : includes,
1748 link_args : ['--static'],
1749 link_with : [lib_common,
1750 lib_smartcols.get_static_lib()],
1751 install_dir : sbindir,
1753 build_by_default : opt)
1754 if opt and not is_disabler(exe)
1758 opt = not get_option('build-zramctl').disabled()
1762 include_directories : includes,
1763 link_with : [lib_common,
1765 install_dir : sbindir,
1767 build_by_default : opt)
1768 if opt and not is_disabler(exe)
1770 manadocs += ['sys-utils/zramctl.8.adoc']
1771 bashcompletions += ['zramctl']
1777 include_directories : includes,
1778 link_with : [lib_common,
1780 install_dir : usrbin_exec_dir,
1782 if not is_disabler(exe)
1784 manadocs += ['sys-utils/prlimit.1.adoc']
1785 bashcompletions += ['prlimit']
1788 opt = not get_option('build-lsns').disabled()
1792 include_directories : includes,
1793 link_with : [lib_common,
1795 dependencies : [mount_dep],
1796 install_dir : usrbin_exec_dir,
1798 build_by_default : opt)
1799 if opt and not is_disabler(exe)
1801 manadocs += ['sys-utils/lsns.8.adoc']
1802 bashcompletions += ['lsns']
1805 opt = not get_option('build-mount').disabled()
1809 include_directories : includes,
1810 link_with : [lib_common,
1812 dependencies : [lib_selinux, mount_dep],
1813 install_mode : 'rwsr-xr-x',
1815 build_by_default : opt)
1819 include_directories : includes,
1820 link_with : [lib_common],
1821 dependencies : [mount_dep],
1822 install_mode : 'rwsr-xr-x',
1824 build_by_default : opt)
1825 if opt and not is_disabler(exe)
1827 manadocs += ['sys-utils/fstab.5.adoc',
1828 'sys-utils/mount.8.adoc',
1829 'sys-utils/umount.8.adoc']
1830 bashcompletions += ['mount', 'umount']
1833 opt2 = opt and 'mount' in static_programs
1837 include_directories : includes,
1838 link_args : ['--static'],
1839 link_with : [lib_common,
1840 lib_smartcols_static],
1841 dependencies : [mount_static_dep],
1843 build_by_default : opt2)
1844 if opt2 and not is_disabler(exe)
1848 opt2 = opt and 'umount' in static_programs
1852 include_directories : includes,
1853 link_args : ['--static'],
1854 link_with : [lib_common],
1855 dependencies : [mount_static_dep],
1857 build_by_default : opt2)
1858 if opt2 and not is_disabler(exe)
1864 opt = not get_option('build-swapon').disabled()
1868 include_directories : includes,
1869 link_with : [lib_common,
1871 dependencies : [blkid_dep, mount_dep],
1872 install_dir : sbindir,
1874 build_by_default : opt)
1875 if opt and not is_disabler(exe)
1877 manadocs += ['sys-utils/swapon.8.adoc']
1878 bashcompletions += ['swapon']
1881 opt = not get_option('build-swapoff').disabled()
1885 include_directories : includes,
1886 link_with : [lib_common],
1887 dependencies : [blkid_dep, mount_dep],
1888 install_dir : sbindir,
1890 build_by_default : opt)
1891 if opt and not is_disabler(exe)
1893 manlinks += {'swapoff.8': 'swapon.8'}
1894 bashcompletions += ['swapoff']
1900 include_directories : includes,
1901 link_with : [lib_common,
1903 dependencies : [rtas_libs],
1904 install_dir : usrbin_exec_dir,
1906 if not is_disabler(exe)
1908 manadocs += ['sys-utils/lscpu.1.adoc']
1909 bashcompletions += ['lscpu']
1912 opt = get_option('build-chcpu').require(have_cpu_set_t).allowed()
1916 include_directories : includes,
1917 link_with : [lib_common],
1918 install_dir : sbindir,
1920 build_by_default : opt)
1921 if opt and not is_disabler(exe)
1923 manadocs += ['sys-utils/chcpu.8.adoc']
1924 bashcompletions += ['chcpu']
1930 include_directories : includes,
1931 link_with : [lib_common,
1934 if not is_disabler(exe)
1936 manadocs += ['sys-utils/wdctl.8.adoc']
1937 bashcompletions += ['wdctl']
1940 opt = not get_option('build-mountpoint').disabled()
1944 include_directories : includes,
1945 dependencies : [mount_dep],
1947 build_by_default : opt)
1948 if opt and not is_disabler(exe)
1950 manadocs += ['sys-utils/mountpoint.1.adoc']
1951 bashcompletions += ['mountpoint']
1954 opt = not get_option('build-fallocate').disabled()
1958 include_directories : includes,
1959 link_with : [lib_common],
1960 install_dir : usrbin_exec_dir,
1962 build_by_default : opt)
1963 if opt and not is_disabler(exe)
1965 manadocs += ['sys-utils/fallocate.1.adoc']
1966 bashcompletions += ['fallocate']
1969 opt = not get_option('build-pivot_root').disabled()
1973 include_directories : includes,
1974 install_dir : sbindir,
1976 build_by_default : opt)
1977 if opt and not is_disabler(exe)
1979 manadocs += ['sys-utils/pivot_root.8.adoc']
1980 bashcompletions += ['pivot_root']
1983 opt = not get_option('build-switch_root').disabled()
1984 if opt and not have_dirfd and not have_ddfd
1985 error('neither dirfd nor ddfd are available')
1989 switch_root_sources,
1990 include_directories : includes,
1991 install_dir : sbindir,
1993 build_by_default : opt)
1994 if opt and not is_disabler(exe)
1996 manadocs += ['sys-utils/switch_root.8.adoc']
1999 opt = not get_option('build-unshare').disabled()
2003 include_directories : includes,
2004 link_with : [lib_common],
2005 dependencies : [mount_dep],
2006 install_dir : usrbin_exec_dir,
2008 build_by_default : opt)
2009 if opt and not is_disabler(exe)
2011 manadocs += ['sys-utils/unshare.1.adoc']
2012 bashcompletions += ['unshare']
2015 opt = opt and 'unshare' in static_programs
2019 include_directories : includes,
2020 link_with : [lib_common],
2021 dependencies : [mount_dep],
2022 install_dir : usrbin_exec_dir,
2024 build_by_default : opt)
2025 if opt and not is_disabler(exe)
2029 opt = not get_option('build-nsenter').disabled()
2033 include_directories : includes,
2034 link_with : [lib_common],
2035 dependencies : [lib_selinux],
2036 install_dir : usrbin_exec_dir,
2038 build_by_default : opt)
2039 if opt and not is_disabler(exe)
2041 manadocs += ['sys-utils/nsenter.1.adoc']
2042 bashcompletions += ['nsenter']
2045 opt = opt and 'nsenter' in static_programs
2049 include_directories : includes,
2050 link_with : [lib_common],
2051 dependencies : [lib_selinux],
2052 install_dir : usrbin_exec_dir,
2054 build_by_default : opt)
2055 if opt and not is_disabler(exe)
2059 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
2063 include_directories : includes,
2064 link_with : [lib_common],
2065 dependencies : [lib_cap_ng],
2066 install_dir : usrbin_exec_dir,
2068 build_by_default : opt)
2069 if opt and not is_disabler(exe)
2071 manadocs += ['sys-utils/setpriv.1.adoc']
2072 bashcompletions += ['setpriv']
2078 include_directories : includes,
2079 link_with : [lib_common],
2080 dependencies : realtime_libs,
2081 install_dir : usrbin_exec_dir,
2084 manadocs += ['sys-utils/flock.1.adoc']
2085 bashcompletions += ['flock']
2087 opt = not get_option('build-lsirq').disabled()
2091 include_directories : includes,
2092 link_with : [lib_common,
2094 install_dir : usrbin_exec_dir,
2096 build_by_default : opt)
2097 if opt and not is_disabler(exe)
2099 manadocs += ['sys-utils/lsirq.1.adoc']
2100 bashcompletions += ['lsirq']
2103 opt = not get_option('build-irqtop').disabled()
2107 include_directories : includes,
2108 dependencies : [realtime_libs, curses_libs],
2109 link_with : [lib_common,
2112 install_dir : usrbin_exec_dir,
2114 build_by_default : opt)
2115 if opt and not is_disabler(exe)
2117 manadocs += ['sys-utils/irqtop.1.adoc']
2118 bashcompletions += ['irqtop']
2121 opt = not get_option('build-ipcs').disabled()
2125 include_directories : includes,
2126 link_with : [lib_common,
2128 install_dir : usrbin_exec_dir,
2130 build_by_default : opt)
2131 if opt and not is_disabler(exe)
2133 manadocs += ['sys-utils/lsipc.1.adoc']
2134 bashcompletions += ['lsipc']
2141 include_directories : includes,
2142 link_with : [lib_common],
2143 dependencies : [lib_m,
2145 install_dir : sbindir,
2147 build_by_default : opt)
2148 if opt and not is_disabler(exe)
2150 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2151 bashcompletions += ['hwclock']
2157 include_directories : includes,
2158 install_dir : sbindir,
2161 manadocs += ['disk-utils/mkfs.8.adoc']
2162 bashcompletions += ['mkfs']
2164 opt = not get_option('build-bfs').disabled()
2168 include_directories : includes,
2169 link_with : [lib_common],
2170 install_dir : sbindir,
2172 build_by_default : opt)
2173 if opt and not is_disabler(exe)
2175 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2176 bashcompletions += ['mkfs.bfs']
2182 include_directories : includes,
2183 link_with : [lib_common],
2184 install_dir : usrbin_exec_dir,
2187 manadocs += ['disk-utils/isosize.8.adoc']
2188 bashcompletions += ['isosize']
2193 include_directories : includes,
2194 link_with : [lib_common,
2196 dependencies: [blkid_dep, lib_selinux],
2197 install_dir : sbindir,
2199 if not is_disabler(exe)
2201 manadocs += ['disk-utils/mkswap.8.adoc']
2202 bashcompletions += ['mkswap']
2208 include_directories : includes,
2209 link_with : [lib_common,
2211 dependencies : [blkid_dep],
2212 install_dir : sbindir,
2214 if not is_disabler(exe)
2216 manadocs += ['disk-utils/swaplabel.8.adoc']
2217 bashcompletions += ['swaplabel']
2220 opt = not get_option('build-fsck').disabled()
2224 include_directories : includes,
2225 link_with : [lib_common],
2226 dependencies : [blkid_dep, mount_dep, realtime_libs],
2227 install_dir : sbindir,
2229 build_by_default : opt)
2230 if opt and not is_disabler(exe)
2232 manadocs += ['disk-utils/fsck.8.adoc']
2233 bashcompletions += ['fsck']
2236 opt = not get_option('build-minix').disabled()
2240 include_directories : includes,
2241 link_with : [lib_common],
2242 install_dir : sbindir,
2244 build_by_default : opt)
2248 include_directories : includes,
2249 c_args : '-DTEST_SCRIPT',
2250 link_with : [lib_common],
2251 build_by_default : opt and program_tests)
2255 include_directories : includes,
2256 link_with : [lib_common],
2257 install_dir : sbindir,
2259 build_by_default : opt)
2260 if opt and not is_disabler(exe)
2261 exes += [exe, exe2, exe3]
2262 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2263 bashcompletions += ['mkfs.minix', 'fsck.minix']
2266 opt = not get_option('build-cramfs').disabled()
2269 mkfs_cramfs_sources,
2270 include_directories : includes,
2271 link_with : [lib_common],
2272 dependencies : [lib_z],
2273 install_dir : sbindir,
2275 build_by_default : opt)
2278 fsck_cramfs_sources,
2279 include_directories : includes,
2280 link_with : [lib_common],
2281 dependencies : [lib_z],
2282 install_dir : sbindir,
2284 build_by_default : opt)
2285 if not is_disabler(exe)
2287 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2288 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2291 opt = not get_option('build-raw').disabled()
2293 cc.has_header('linux/raw.h', required: opt)
2298 include_directories : includes,
2299 install_dir : sbindir,
2301 build_by_default : opt)
2302 if opt and not is_disabler(exe)
2304 manadocs += ['disk-utils/raw.8.adoc']
2305 bashcompletions += ['raw']
2308 opt = not get_option('build-fdformat').disabled()
2312 include_directories : includes,
2313 link_with : [lib_common],
2314 install_dir : usrsbin_exec_dir,
2316 build_by_default : opt)
2317 if opt and not is_disabler(exe)
2319 manadocs += ['disk-utils/fdformat.8.adoc']
2320 bashcompletions += ['fdformat']
2323 opt = get_option('build-blockdev').require(LINUX).allowed()
2327 include_directories : includes,
2328 link_with : [lib_common],
2329 install_dir : sbindir,
2331 build_by_default : opt)
2332 if opt and not is_disabler(exe)
2334 manadocs += ['disk-utils/blockdev.8.adoc']
2335 bashcompletions += ['blockdev']
2338 opt = not get_option('build-fdisks').disabled()
2339 if opt and not have_dirfd and not have_ddfd
2340 error('neither dirfd nor ddfd are available')
2345 include_directories : includes,
2346 link_with : [lib_common,
2350 dependencies : [lib_readline],
2351 install_dir : sbindir,
2353 build_by_default : opt)
2354 if opt and not is_disabler(exe)
2356 bashcompletions += ['fdisk']
2359 opt2 = opt and 'fdisk' in static_programs
2363 link_args : ['--static'],
2364 include_directories : includes,
2365 link_with : [lib_common,
2368 lib_smartcols.get_static_lib()],
2369 dependencies : [lib_readline_static],
2370 install_dir : sbindir,
2372 build_by_default : opt2)
2373 if opt2 and not is_disabler(exe)
2380 include_directories : includes,
2381 link_with : [lib_common,
2385 dependencies : [lib_readline],
2386 install_dir : sbindir,
2388 build_by_default : opt)
2389 if opt and not is_disabler(exe)
2391 bashcompletions += ['sfdisk']
2394 opt2 = opt and 'sfdisk' in static_programs
2398 include_directories : includes,
2399 link_with : [lib_common,
2402 lib_smartcols.get_static_lib()],
2403 dependencies : [lib_readline_static],
2404 install_dir : sbindir,
2406 build_by_default : opt2)
2407 if opt2 and not is_disabler(exe)
2414 include_directories : includes,
2415 link_with : [lib_common,
2419 dependencies : [curses_libs, mount_dep],
2420 install_dir : sbindir,
2422 build_by_default : opt)
2423 if opt and not is_disabler(exe)
2425 manadocs += ['disk-utils/fdisk.8.adoc',
2426 'disk-utils/sfdisk.8.adoc',
2427 'disk-utils/cfdisk.8.adoc']
2428 bashcompletions += ['cfdisk']
2431 opt = not get_option('build-partx').disabled()
2435 include_directories : includes,
2436 link_with : [lib_common],
2437 install_dir : usrsbin_exec_dir,
2439 build_by_default : opt)
2443 include_directories : includes,
2444 link_with : [lib_common],
2445 install_dir : usrsbin_exec_dir,
2447 build_by_default : opt)
2451 include_directories : includes,
2452 link_with : [lib_common],
2453 install_dir : usrsbin_exec_dir,
2455 build_by_default : opt)
2459 include_directories : includes,
2460 link_with : [lib_common,
2462 dependencies : [blkid_dep],
2463 install_dir : usrsbin_exec_dir,
2465 build_by_default : opt)
2467 exes += [exe, exe2, exe3, exe4]
2468 manadocs += ['disk-utils/addpart.8.adoc',
2469 'disk-utils/delpart.8.adoc',
2470 'disk-utils/resizepart.8.adoc',
2471 'disk-utils/partx.8.adoc']
2472 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2474 opt = opt and 'partx' in static_programs
2478 include_directories : includes,
2479 link_args : ['--static'],
2480 link_with : [lib_common],
2481 install_dir : usrsbin_exec_dir,
2483 build_by_default : opt)
2487 include_directories : includes,
2488 link_args : ['--static'],
2489 link_with : [lib_common],
2490 install_dir : usrsbin_exec_dir,
2492 build_by_default : opt)
2494 'resizepart.static',
2496 include_directories : includes,
2497 link_args : ['--static'],
2498 link_with : [lib_common],
2499 install_dir : usrsbin_exec_dir,
2501 build_by_default : opt)
2505 include_directories : includes,
2506 link_args : ['--static'],
2507 link_with : [lib_common,
2508 lib_smartcols.get_static_lib()],
2509 dependencies : [blkid_static_dep],
2510 install_dir : usrsbin_exec_dir,
2512 build_by_default : opt)
2515 exes += [exe, exe2, exe3, exe4]
2518 ############################################################
2520 opt = get_option('build-script').require(have_pty).allowed()
2524 include_directories : includes,
2525 link_with : [lib_common],
2526 dependencies : [lib_util,
2530 install_dir : usrbin_exec_dir,
2532 build_by_default : opt)
2533 if opt and not is_disabler(exe)
2535 manadocs += ['term-utils/script.1.adoc']
2536 bashcompletions += ['script']
2542 include_directories : includes,
2543 c_args : '-DTEST_SCRIPT',
2544 link_with : [lib_common],
2545 dependencies : [lib_util,
2549 build_by_default : opt and program_tests)
2550 if opt and not is_disabler(exe)
2554 opt = get_option('build-scriptlive').require(have_pty).allowed()
2558 include_directories : includes,
2559 link_with : [lib_common],
2560 dependencies : [lib_util,
2563 install_dir : usrbin_exec_dir,
2565 build_by_default : opt)
2566 if opt and not is_disabler(exe)
2568 manadocs += ['term-utils/scriptlive.1.adoc']
2569 bashcompletions += ['scriptlive']
2574 scriptreplay_sources,
2575 include_directories : includes,
2576 link_with : [lib_common],
2577 dependencies : [math_libs],
2578 install_dir : usrbin_exec_dir,
2581 manadocs += ['term-utils/scriptreplay.1.adoc']
2582 bashcompletions += ['scriptreplay']
2584 opt = not get_option('build-agetty').disabled()
2588 include_directories : includes,
2589 link_with : [lib_common, logindefs_c],
2590 dependencies : [BSD ? lib_util : [], lib_systemd],
2591 install_dir : sbindir,
2593 build_by_default : opt)
2596 manadocs += ['term-utils/agetty.8.adoc']
2599 opt = not get_option('build-setterm').disabled()
2603 include_directories : includes,
2604 link_with : [lib_common],
2605 dependencies : [curses_libs],
2606 install_dir : usrbin_exec_dir,
2608 build_by_default : opt)
2611 manadocs += ['term-utils/setterm.1.adoc']
2612 bashcompletions += ['setterm']
2615 opt = not get_option('build-mesg').disabled()
2619 include_directories : includes,
2620 link_with : [lib_common],
2621 install_dir : usrbin_exec_dir,
2623 build_by_default : opt)
2626 manadocs += ['term-utils/mesg.1.adoc']
2627 bashcompletions += ['mesg']
2630 opt = not get_option('build-wall').disabled()
2634 include_directories : includes,
2635 link_with : [lib_common],
2636 dependencies : [lib_systemd],
2637 install_dir : usrbin_exec_dir,
2638 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2640 build_by_default : opt)
2643 manadocs += ['term-utils/wall.1.adoc']
2644 bashcompletions += ['wall']
2647 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2648 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2650 opt = not get_option('build-write').disabled()
2654 include_directories : includes,
2655 link_with : [lib_common],
2656 dependencies : [lib_systemd],
2657 install_dir : usrbin_exec_dir,
2658 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2660 build_by_default : opt)
2663 manadocs += ['term-utils/write.1.adoc']
2664 bashcompletions += ['write']
2667 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2668 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2670 opt = not get_option('build-login').disabled()
2674 include_directories : includes,
2675 link_with : [lib_common, logindefs_c],
2676 dependencies : [lib_pam,
2680 build_by_default : opt)
2681 if not is_disabler(exe)
2683 manadocs += ['login-utils/login.1.adoc']
2686 opt = not get_option('build-sulogin').disabled()
2690 include_directories : includes,
2691 link_with : [lib_common],
2692 dependencies : [lib_crypt,
2694 install_dir : sbindir,
2696 build_by_default : opt)
2697 if not is_disabler(exe)
2699 manadocs += ['login-utils/sulogin.8.adoc']
2705 include_directories : includes,
2706 link_with : [lib_common,
2708 dependencies : [curses_libs],
2709 install_dir : usrbin_exec_dir,
2712 manadocs += ['misc-utils/cal.1.adoc']
2713 bashcompletions += ['cal']
2715 opt = not get_option('build-logger').disabled()
2719 include_directories : includes,
2720 link_with : [lib_common],
2721 dependencies : [lib_systemd],
2722 install_dir : usrbin_exec_dir,
2724 build_by_default : opt)
2725 if opt and not is_disabler(exe)
2727 manadocs += ['misc-utils/logger.1.adoc']
2728 bashcompletions += ['logger']
2734 include_directories : includes,
2735 c_args : '-DTEST_LOGGER',
2736 link_with : [lib_common],
2737 dependencies : [lib_systemd],
2738 build_by_default: program_tests)
2739 if not is_disabler(exe)
2746 include_directories : includes,
2747 install_dir : usrbin_exec_dir,
2750 manadocs += ['misc-utils/look.1.adoc']
2751 bashcompletions += ['look']
2756 include_directories : includes,
2757 link_with : [lib_common],
2758 install_dir : usrbin_exec_dir,
2761 manadocs += ['misc-utils/mcookie.1.adoc']
2762 bashcompletions += ['mcookie']
2764 if build_liblastlog2
2768 include_directories : includes,
2769 link_with : [lib_common, lib_lastlog2],
2770 install_dir : usrbin_exec_dir,
2773 manadocs += ['misc-utils/lastlog2.8.adoc']
2774 bashcompletions += ['lastlog2']
2775 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2776 'liblastlog2/man/ll2_write_entry.3.adoc',
2777 'liblastlog2/man/ll2_read_entry.3.adoc',
2778 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2779 'liblastlog2/man/ll2_read_all.3.adoc',
2780 'liblastlog2/man/ll2_remove_entry.3.adoc',
2781 'liblastlog2/man/ll2_rename_user.3.adoc',
2782 'liblastlog2/man/ll2_update_login_time.3.adoc'
2789 include_directories : includes,
2790 dependencies : [lib_selinux],
2791 install_dir : usrbin_exec_dir,
2794 manadocs += ['misc-utils/namei.1.adoc']
2795 bashcompletions += ['namei']
2800 include_directories : includes,
2801 link_with : [lib_common],
2802 install_dir : usrbin_exec_dir,
2805 manadocs += ['misc-utils/whereis.1.adoc']
2806 bashcompletions += ['whereis']
2808 opt = not get_option('build-lslocks').disabled()
2812 include_directories : includes,
2813 link_with : [lib_common,
2815 dependencies : [mount_dep],
2816 install_dir : usrbin_exec_dir,
2818 build_by_default : opt)
2819 if opt and not is_disabler(exe)
2821 manadocs += ['misc-utils/lslocks.8.adoc']
2822 bashcompletions += ['lslocks']
2825 opt = not get_option('build-lsblk').disabled()
2829 include_directories : includes,
2830 link_with : [lib_common,
2833 dependencies : [blkid_dep, lib_udev, mount_dep],
2835 build_by_default : opt)
2836 if opt and not is_disabler(exe)
2838 manadocs += ['misc-utils/lsblk.8.adoc']
2839 bashcompletions += ['lsblk']
2842 errnos_h = custom_target('errnos.h',
2843 input : 'tools/all_errnos',
2844 output : 'errnos.h',
2845 command : ['tools/all_errnos', sed.full_path(),
2846 cc.cmd_array(), get_option('c_args')],
2849 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2852 lsfd_sources, errnos_h,
2853 include_directories : includes,
2854 link_with : [lib_common,
2856 dependencies : [lib_rt],
2857 install_dir : usrbin_exec_dir,
2859 build_by_default : opt)
2860 if opt and not is_disabler(exe)
2862 manadocs += ['lsfd-cmd/lsfd.1.adoc']
2868 include_directories : includes,
2869 link_with : [lib_common,
2871 install_dir : usrbin_exec_dir,
2873 if not is_disabler(exe)
2875 manadocs += ['misc-utils/uuidgen.1.adoc']
2876 bashcompletions += ['uuidgen']
2882 include_directories : includes,
2883 link_with : [lib_common,
2886 install_dir : usrbin_exec_dir,
2888 if not is_disabler(exe)
2890 manadocs += ['misc-utils/uuidparse.1.adoc']
2891 bashcompletions += ['uuidparse']
2898 include_directories : includes,
2899 link_with : [lib_common,
2901 dependencies : [realtime_libs,
2903 install_dir : usrsbin_exec_dir,
2905 build_by_default : opt)
2909 include_directories : includes,
2910 link_with : [lib_common,
2912 dependencies : thread_libs,
2913 build_by_default : opt and program_tests)
2914 if not is_disabler(exe)
2916 manadocs += ['misc-utils/uuidd.8.adoc']
2917 bashcompletions += ['uuidd']
2920 opt = build_libblkid
2924 include_directories : includes,
2925 link_with : [lib_common],
2926 dependencies : [blkid_dep],
2927 install_dir : sbindir,
2929 build_by_default : opt)
2930 if opt and not is_disabler(exe)
2932 manadocs += ['misc-utils/blkid.8.adoc']
2933 bashcompletions += ['blkid']
2936 opt = opt and 'blkid' in static_programs
2940 include_directories : includes,
2941 link_with : [lib_common],
2942 dependencies : [blkid_static_dep],
2943 install_dir : sbindir,
2945 build_by_default : opt)
2946 if opt and not is_disabler(exe)
2952 'libblkid/samples/mkfs.c',
2953 include_directories : includes,
2954 dependencies : [blkid_dep])
2955 if not is_disabler(exe)
2960 'sample-partitions',
2961 'libblkid/samples/partitions.c',
2962 include_directories : includes,
2963 dependencies : [blkid_dep])
2964 if not is_disabler(exe)
2969 'sample-superblocks',
2970 'libblkid/samples/superblocks.c',
2971 include_directories : includes,
2972 dependencies : [blkid_dep])
2973 if not is_disabler(exe)
2979 'libblkid/samples/topology.c',
2980 include_directories : includes,
2981 dependencies : [blkid_dep])
2982 if not is_disabler(exe)
2987 'test_blkid_fuzz_sample',
2988 'libblkid/src/fuzz.c',
2989 include_directories: includes,
2990 dependencies : [blkid_dep],
2991 build_by_default: program_tests)
2992 if not is_disabler(exe)
2996 ############################################################
3001 include_directories : includes,
3002 dependencies : [blkid_dep],
3003 install_dir : sbindir,
3005 if not is_disabler(exe)
3007 manadocs += ['misc-utils/findfs.8.adoc']
3008 bashcompletions += ['findfs']
3014 include_directories : includes,
3015 link_with : [lib_common,
3017 dependencies : [blkid_dep],
3018 install_dir : sbindir,
3020 if not is_disabler(exe)
3022 manadocs += ['misc-utils/wipefs.8.adoc']
3023 bashcompletions += ['wipefs']
3026 opt = not get_option('build-findmnt').disabled()
3030 include_directories : includes,
3031 link_with : [lib_common,
3033 dependencies : [blkid_dep, lib_udev, mount_dep],
3035 build_by_default : opt)
3036 if opt and not is_disabler(exe)
3038 manadocs += ['misc-utils/findmnt.8.adoc']
3039 bashcompletions += ['findmnt']
3045 include_directories : includes,
3046 link_with : [lib_common],
3048 if not is_disabler(exe)
3050 manadocs += ['misc-utils/kill.1.adoc']
3053 opt = not get_option('build-rename').disabled()
3057 include_directories : includes,
3058 install_dir : usrbin_exec_dir,
3060 build_by_default : opt)
3061 if opt and not is_disabler(exe)
3063 manadocs += ['misc-utils/rename.1.adoc']
3064 bashcompletions += ['rename']
3070 include_directories : includes,
3071 link_with : [lib_common],
3072 install_dir : usrbin_exec_dir,
3075 manadocs += ['misc-utils/getopt.1.adoc']
3076 bashcompletions += ['getopt']
3081 include_directories : includes,
3082 link_with : [lib_common,
3084 install_dir : usrbin_exec_dir,
3086 if not is_disabler(exe)
3088 manadocs += ['misc-utils/fincore.1.adoc']
3089 bashcompletions += ['fincore']
3095 include_directories : includes,
3096 link_with : [lib_common],
3097 install_dir : usrbin_exec_dir,
3099 if not is_disabler(exe)
3101 manadocs += ['misc-utils/hardlink.1.adoc']
3102 bashcompletions += ['hardlink']
3105 opt = get_option('build-pipesz').allowed()
3109 include_directories : includes,
3110 link_with : [lib_common],
3111 install_dir : usrbin_exec_dir,
3113 build_by_default : opt)
3114 if opt and not is_disabler(exe)
3116 manadocs += ['misc-utils/pipesz.1.adoc']
3117 bashcompletions += ['pipesz']
3123 include_directories : includes,
3124 c_args : '-DTEST_CAL',
3125 link_with : [lib_common,
3127 dependencies : [curses_libs],
3128 build_by_default: program_tests)
3129 if not is_disabler(exe)
3133 have_posix_fadvise = conf.get('HAVE_POSIX_FADVISE').to_string() == '1'
3135 opt = get_option('build-fadvise').require(have_posix_fadvise).allowed()
3139 include_directories : includes,
3140 link_with : [lib_common],
3141 install_dir : usrbin_exec_dir,
3143 build_by_default : opt)
3144 if opt and not is_disabler(exe)
3146 manadocs += ['misc-utils/fadvise.1.adoc']
3147 bashcompletions += ['fadvise']
3150 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3154 include_directories : includes,
3155 link_with : [lib_common],
3156 install_dir : usrbin_exec_dir,
3158 if not is_disabler(exe)
3160 manadocs += ['misc-utils/waitpid.1.adoc']
3161 bashcompletions += ['waitpid']
3165 syscalls_h = custom_target('syscalls.h',
3166 input : 'tools/all_syscalls',
3167 output : 'syscalls.h',
3168 command : ['tools/all_syscalls', sed.full_path(),
3169 cc.cmd_array(), get_option('c_args')],
3172 have_linux_audit_h = cc.has_header('linux/audit.h')
3173 have_audit_arch_native = cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3175 opt = get_option('build-enosys').require(have_linux_audit_h and have_audit_arch_native).allowed()
3178 'misc-utils/enosys.c', syscalls_h, errnos_h,
3179 include_directories : includes,
3180 link_with : [lib_common],
3181 install_dir : usrbin_exec_dir,
3183 build_by_default : opt)
3184 if opt and not is_disabler(exe)
3186 manadocs += ['misc-utils/enosys.1.adoc']
3187 bashcompletions += ['enosys']
3190 opt = get_option('build-lsclocks').require(have_linux_rtc_h).allowed()
3194 include_directories : includes,
3195 link_with : [lib_common, lib_smartcols],
3196 install_dir : usrbin_exec_dir,
3198 build_by_default : opt)
3199 if opt and not is_disabler(exe)
3201 manadocs += ['misc-utils/lsclocks.1.adoc']
3202 bashcompletions += ['lsclocks']
3205 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3209 include_directories : includes,
3210 link_with : [lib_common],
3211 install_dir : usrbin_exec_dir,
3213 if not is_disabler(exe)
3215 manadocs += ['misc-utils/exch.1.adoc']
3216 bashcompletions += ['exch']
3220 ############################################################
3222 opt = not get_option('build-schedutils').disabled()
3225 'schedutils/chrt.c',
3226 include_directories : includes,
3227 link_with : lib_common,
3228 install_dir : usrbin_exec_dir,
3230 build_by_default : opt)
3234 'schedutils/ionice.c',
3235 include_directories : includes,
3236 link_with : lib_common,
3237 install_dir : usrbin_exec_dir,
3239 build_by_default : opt)
3243 'schedutils/taskset.c',
3244 include_directories : includes,
3245 link_with : lib_common,
3246 install_dir : usrbin_exec_dir,
3248 build_by_default : opt)
3252 'schedutils/uclampset.c',
3253 include_directories : includes,
3254 link_with : lib_common,
3255 install_dir : usrbin_exec_dir,
3257 build_by_default : opt)
3259 if opt and not is_disabler(exe)
3260 exes += [exe, exe2, exe3, exe4]
3261 manadocs += ['schedutils/chrt.1.adoc',
3262 'schedutils/ionice.1.adoc',
3263 'schedutils/taskset.1.adoc',
3264 'schedutils/uclampset.1.adoc']
3265 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3268 ############################################################
3270 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3275 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3276 include_directories : dir_include,
3277 link_with : lib_common,
3278 build_by_default: program_tests)
3284 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3285 include_directories : dir_include,
3286 link_with : lib_common,
3287 build_by_default: program_tests)
3293 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3294 include_directories : dir_include,
3295 link_with : lib_common,
3296 build_by_default: program_tests)
3302 c_args : ['-DTEST_PROGRAM_MANGLE'],
3303 include_directories : dir_include,
3304 build_by_default: program_tests)
3310 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3311 include_directories : dir_include,
3312 build_by_default: program_tests)
3318 'lib/color-names.c',
3319 c_args : ['-DTEST_PROGRAM_COLORS'],
3320 include_directories : dir_include,
3321 link_with : [lib_common, lib_tcolors],
3322 build_by_default: program_tests)
3328 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3329 include_directories : dir_include,
3330 build_by_default: program_tests)
3333 if conf.get('HAVE_OPENAT').to_string() == '1' \
3334 and conf.get('HAVE_DIRFD').to_string() == '1'
3338 c_args : ['-DTEST_PROGRAM_PROCFS'],
3339 include_directories : dir_include,
3340 link_with : lib_common,
3341 build_by_default: program_tests)
3348 have_cpu_set_t ? 'lib/cpuset.c' : [],
3349 c_args : ['-DTEST_PROGRAM_PATH'],
3350 include_directories : dir_include,
3351 link_with : lib_common,
3352 build_by_default: program_tests)
3361 c_args : ['-DTEST_PROGRAM_PTY'],
3362 include_directories : dir_include,
3363 link_with : [lib_common],
3364 dependencies : [lib_m,
3367 build_by_default: program_tests)
3375 c_args : ['-DTEST_PROGRAM_CPUSET'],
3376 include_directories : dir_include,
3377 build_by_default: program_tests)
3388 have_cpu_set_t ? 'lib/cpuset.c' : [],
3389 c_args : ['-DTEST_PROGRAM_SYSFS'],
3390 include_directories : dir_include,
3391 build_by_default: program_tests)
3397 c_args : ['-DTEST_PROGRAM_PAGER'],
3398 include_directories : dir_include,
3399 build_by_default: program_tests)
3403 'test_linux_version',
3404 'lib/linux_version.c',
3405 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3406 include_directories : dir_include,
3407 build_by_default: program_tests)
3413 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3414 include_directories : dir_include,
3415 build_by_default: program_tests)
3419 'test_canonicalize',
3420 'lib/canonicalize.c',
3421 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3422 include_directories : dir_include,
3423 build_by_default: program_tests)
3430 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3431 include_directories : dir_include,
3432 build_by_default: program_tests)
3438 c_args : ['-DTEST_PROGRAM'],
3439 include_directories : dir_include,
3440 link_with : lib_common,
3441 build_by_default: program_tests)
3447 c_args : ['-DTEST_PROGRAM'],
3448 include_directories : dir_include,
3449 link_with : [lib_common, logindefs_c],
3450 build_by_default: program_tests)
3454 ############################################################
3458 'libuuid/src/test_uuid.c',
3459 include_directories : [dir_include, dir_libuuid],
3460 link_with : lib_uuid,
3461 dependencies : socket_libs,
3462 build_by_default: program_tests)
3463 if not is_disabler(exe)
3467 ############################################################
3469 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3470 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid]
3471 libfdisk_tests_ldadd_deps = [blkid_dep]
3475 'libfdisk/src/ask.c',
3476 c_args : libfdisk_tests_cflags,
3477 include_directories : lib_fdisk_includes,
3478 link_with : libfdisk_tests_ldadd,
3479 dependencies : libfdisk_tests_ldadd_deps,
3480 build_by_default: program_tests)
3481 if not is_disabler(exe)
3487 'libfdisk/src/gpt.c',
3488 c_args : libfdisk_tests_cflags,
3489 include_directories : lib_fdisk_includes,
3490 link_with : libfdisk_tests_ldadd,
3491 dependencies : libfdisk_tests_ldadd_deps,
3492 build_by_default: program_tests)
3493 if not is_disabler(exe)
3499 'libfdisk/src/utils.c',
3500 c_args : libfdisk_tests_cflags,
3501 include_directories : lib_fdisk_includes,
3502 link_with : libfdisk_tests_ldadd,
3503 dependencies : libfdisk_tests_ldadd_deps,
3504 build_by_default: program_tests)
3505 if not is_disabler(exe)
3510 'test_fdisk_script',
3511 'libfdisk/src/script.c',
3512 c_args : libfdisk_tests_cflags,
3513 include_directories : lib_fdisk_includes,
3514 link_with : libfdisk_tests_ldadd,
3515 dependencies : libfdisk_tests_ldadd_deps,
3516 build_by_default: program_tests)
3517 if not is_disabler(exe)
3522 'test_fdisk_version',
3523 'libfdisk/src/version.c',
3524 c_args : libfdisk_tests_cflags,
3525 include_directories : lib_fdisk_includes,
3526 link_with : libfdisk_tests_ldadd,
3527 dependencies : libfdisk_tests_ldadd_deps,
3528 build_by_default: program_tests)
3529 if not is_disabler(exe)
3535 'libfdisk/src/item.c',
3536 c_args : libfdisk_tests_cflags,
3537 include_directories : lib_fdisk_includes,
3538 link_with : libfdisk_tests_ldadd,
3539 dependencies : libfdisk_tests_ldadd_deps,
3540 build_by_default: program_tests)
3541 if not is_disabler(exe)
3545 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3548 'sample-fdisk-mkpart',
3549 'libfdisk/samples/mkpart.c',
3550 include_directories : lib_fdisk_includes,
3551 link_with : sample_fdisk_ldadd)
3552 if not is_disabler(exe)
3557 'sample-fdisk-mkpart-fullspec',
3558 'libfdisk/samples/mkpart-fullspec.c',
3559 include_directories : lib_fdisk_includes,
3560 link_with : sample_fdisk_ldadd)
3561 if not is_disabler(exe)
3565 ############################################################
3569 'tests/helpers/test_cap.c',
3570 include_directories : includes,
3571 dependencies : [lib_cap_ng],
3572 build_by_default: program_tests)
3573 if not is_disabler(exe)
3579 'tests/helpers/test_mbsencode.c',
3580 include_directories : includes,
3581 link_with : lib_common,
3582 build_by_default: program_tests)
3587 'tests/helpers/test_byteswap.c',
3588 include_directories : includes,
3589 build_by_default: program_tests)
3594 'tests/helpers/test_md5.c',
3596 include_directories : includes,
3597 build_by_default: program_tests)
3602 'tests/helpers/test_sha1.c',
3604 include_directories : includes,
3605 build_by_default: program_tests)
3610 'tests/helpers/test_pathnames.c',
3611 include_directories : includes,
3612 build_by_default: program_tests)
3617 'tests/helpers/test_strerror.c',
3618 include_directories : includes,
3619 build_by_default: program_tests)
3624 'tests/helpers/test_sysinfo.c',
3625 include_directories : includes,
3626 build_by_default: program_tests)
3631 'tests/helpers/test_sigreceive.c',
3632 include_directories : includes,
3633 link_with : lib_common,
3634 build_by_default: program_tests)
3639 'tests/helpers/test_tiocsti.c',
3640 include_directories : includes,
3641 build_by_default: program_tests)
3645 'test_uuid_namespace',
3646 'tests/helpers/test_uuid_namespace.c',
3650 include_directories : includes,
3651 build_by_default: program_tests)
3654 if LINUX and lib_rt.found()
3657 'tests/helpers/test_mkfds.c',
3658 'tests/helpers/test_mkfds.h',
3659 'tests/helpers/test_mkfds_ppoll.c',
3660 include_directories : includes,
3661 dependencies : [lib_rt],
3662 build_by_default: program_tests)
3668 'tests/helpers/test_enosys.c',
3669 include_directories : includes,
3670 build_by_default: program_tests)
3673 ############################################################
3675 if conf.get('HAVE_OPENAT').to_string() == '1'
3677 'sample-scols-tree',
3678 'libsmartcols/samples/tree.c',
3679 include_directories : includes,
3680 link_with : [lib_smartcols, lib_common],
3681 build_by_default: program_tests)
3682 if not is_disabler(exe)
3688 'sample-scols-title',
3689 'libsmartcols/samples/title.c',
3690 include_directories : includes,
3691 link_with : [lib_smartcols, lib_common])
3692 if not is_disabler(exe)
3697 'sample-scols-wrap',
3698 'libsmartcols/samples/wrap.c',
3699 include_directories : includes,
3700 link_with : [lib_smartcols, lib_common])
3701 if not is_disabler(exe)
3706 'sample-scols-continuous',
3707 'libsmartcols/samples/continuous.c',
3708 include_directories : includes,
3709 link_with : [lib_smartcols, lib_common])
3710 if not is_disabler(exe)
3715 'sample-scols-continuous-json',
3716 'libsmartcols/samples/continuous-json.c',
3717 include_directories : includes,
3718 link_with : [lib_smartcols, lib_common])
3719 if not is_disabler(exe)
3724 'sample-scols-maxout',
3725 'libsmartcols/samples/maxout.c',
3726 include_directories : includes,
3727 link_with : [lib_smartcols, lib_common])
3728 if not is_disabler(exe)
3733 'sample-scols-fromfile',
3734 'libsmartcols/samples/fromfile.c',
3735 include_directories : includes,
3736 link_with : [lib_smartcols, lib_common])
3737 if not is_disabler(exe)
3742 'sample-scols-grouping-simple',
3743 'libsmartcols/samples/grouping-simple.c',
3744 include_directories : includes,
3745 link_with : [lib_smartcols, lib_common])
3746 if not is_disabler(exe)
3751 'sample-scols-grouping-overlay',
3752 'libsmartcols/samples/grouping-overlay.c',
3753 include_directories : includes,
3754 link_with : [lib_smartcols, lib_common])
3755 if not is_disabler(exe)
3761 'Documentation/boilerplate.c',
3762 include_directories : includes,
3763 build_by_default: program_tests)
3764 if not is_disabler(exe)
3768 ############################################################
3770 # Let the test runner know whether we're running under asan and export
3771 # some paths. We use a file on disk so that it is possible to run the
3772 # test scripts from commandline without setting any variables.
3773 configure_file(output : 'meson.conf',
3778 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3779 python.full_path())])
3781 run_sh = find_program('tests/run.sh')
3785 '--srcdir=' + meson.current_source_dir(),
3786 '--builddir=' + meson.current_build_dir(),
3792 manadocs += ['lib/terminal-colors.d.5.adoc']
3793 manadocs += ['libblkid/libblkid.3.adoc']
3797 'libuuid/man/uuid.3.adoc',
3798 'libuuid/man/uuid_clear.3.adoc',
3799 'libuuid/man/uuid_compare.3.adoc',
3800 'libuuid/man/uuid_copy.3.adoc',
3801 'libuuid/man/uuid_generate.3.adoc',
3802 'libuuid/man/uuid_is_null.3.adoc',
3803 'libuuid/man/uuid_parse.3.adoc',
3804 'libuuid/man/uuid_time.3.adoc',
3805 'libuuid/man/uuid_unparse.3.adoc']
3807 'uuid_generate_random.3': 'uuid_generate.3',
3808 'uuid_generate_time.3': 'uuid_generate.3',
3809 'uuid_generate_time_safe.3': 'uuid_generate.3',
3813 asciidoctor = find_program('asciidoctor', required : false)
3814 if asciidoctor.found()
3815 foreach adoc : manadocs
3816 name = adoc.split('/')[-1]
3817 page = name.split('.adoc')[0]
3818 section = page.split('.')[-1]
3819 mandirn = join_paths(mandir, 'man' + section)
3824 command : [ asciidoctor,
3826 '-a', 'VERSION=' + meson.project_version(),
3827 '-a', 'release-version=' + meson.project_version(),
3828 '-a', 'ADJTIME_PATH=/etc/adjtime',
3829 '-a', 'package-docdir=' + docdir,
3830 '--base-dir=' + meson.current_source_dir(),
3831 '--destination-dir=' + meson.current_build_dir(),
3832 '--load-path', '@SOURCE_ROOT@/tools',
3833 '--require', 'asciidoctor-includetracker',
3837 depfile : page + '.deps',
3839 install_dir : mandirn)
3842 foreach link_name, target : manlinks
3843 link_section = link_name.split('.')[-1]
3844 target_section = target.split('.')[-1]
3845 meson.add_install_script(meson_make_manpage_stub,
3846 join_paths('man' + target_section, target),
3847 join_paths(mandir, 'man' + link_section, link_name))
3851 if bash_completion.found()
3852 foreach completion : bashcompletions
3854 join_paths('bash-completion', completion),
3855 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3858 foreach link_name, target : bashcompletionslinks
3859 meson.add_install_script(meson_make_symlink,
3861 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))