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 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 = get_option('build-libblkid').allowed()
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 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
90 build_liblastlog2 = get_option('build-liblastlog2').require(lib_sqlite3.found()).allowed()
91 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
92 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
94 login_lastlogin = get_option('login-lastlogin')
95 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
96 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
98 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
99 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
100 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
102 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
103 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
105 have_sys_vfs_header = cc.has_header('sys/vfs.h')
107 build_libmount = get_option('build-libmount').require(
108 get_option('build-libblkid').allowed() \
109 and have_sys_vfs_header \
112 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
113 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
114 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
115 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
117 build_libsmartcols = not get_option('build-libsmartcols').disabled()
118 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
119 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
121 build_libfdisk = not get_option('build-libfdisk').require(get_option('build-libblkid').allowed()).disabled()
122 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
123 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
125 build_uuidd = not get_option('build-uuidd').disabled()
126 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
127 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
129 static_programs = get_option('static-programs')
130 need_static_libs = static_programs.length() > 0 # a rough estimate...
131 summary('static programs', static_programs)
133 LINUX = host_machine.system() in ['linux']
134 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
136 ############################################################
154 have = cc.compiles(code, name : 'wchar_t support')
155 if not have and get_option('widechar').enabled()
156 error('widechar support requested but unavailable')
158 if get_option('ncurses').enabled() and get_option('widechar').enabled()
159 error('widechar support is incompatible with non-wide ncurses')
161 conf.set('HAVE_WIDECHAR', have ? 1 : false)
203 linux/net_namespace.h
217 security/pam_modules.h
250 lib_m = cc.find_library('m')
252 lib_tinfo = dependency(
255 required : get_option('tinfo'))
257 lib_ncursesw = dependency(
259 required : get_option('ncursesw'))
260 if lib_ncursesw.found()
261 headers += ['ncursesw/ncurses.h',
265 lib_ncurses = disabler()
267 lib_ncurses = dependency(
270 required : get_option('ncurses'))
271 headers += ['ncurses.h',
275 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
276 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
277 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
279 lib_slang = dependency(
281 required : get_option('slang'))
283 headers += ['slang.h',
288 conf.set('HAVE_SLANG', lib_slang.found())
290 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
291 if curses_libs.found()
292 have = cc.has_function('use_default_colors', dependencies : curses_libs)
293 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
294 have = cc.has_function('resizeterm', dependencies : curses_libs)
295 conf.set('HAVE_RESIZETERM', have ? 1 : false)
303 required : get_option('zlib'))
305 lib_readline = dependency(
307 required : get_option('readline'))
308 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
310 lib_readline_static = dependency(
313 required : need_static_libs ? get_option('readline') : disabler())
315 if meson.version().version_compare('>= 0.59.0')
316 lib_intl = dependency(
318 required : get_option('nls'))
319 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
321 if get_option('nls').enabled()
322 error('nls is not supported with meson before 0.59.0')
324 lib_intl = dependency('', required : false)
327 lib_user = dependency(
330 required : get_option('libuser'))
331 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
333 lib_util = cc.find_library(
335 required : get_option('libutil'))
336 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
338 lib_utempter = cc.find_library(
340 required : get_option('libutempter'))
341 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
343 systemd = dependency(
345 required : get_option('systemd'))
347 lib_systemd = dependency(
349 required : get_option('systemd'))
350 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
351 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
353 have = cc.has_function(
354 'sd_session_get_username',
355 dependencies : lib_systemd)
356 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
358 lib_udev = dependency(
360 required : get_option('systemd'))
361 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
363 lib_crypt = cc.find_library('crypt', required : get_option('build-newgrp'))
364 if not lib_crypt.found()
365 lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin'))
368 lib_pam = cc.find_library(
371 required : get_option('build-login').enabled() or \
372 get_option('build-chfn-chsh').enabled() or \
373 get_option('build-su').enabled() or \
374 get_option('build-runuser').enabled())
376 lib_pam_misc = cc.find_library('pam_misc')
377 lib_pam = [lib_pam, lib_pam_misc]
379 lib_pam_misc = declare_dependency()
382 lib_cryptsetup = dependency(
384 required : get_option('cryptsetup'))
385 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
387 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
389 if meson.version().version_compare('>= 0.62.0')
390 lib_dl = dependency('dl')
392 lib_dl = cc.find_library('dl')
394 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
395 summary('cryptsetup support (dlopen)',
397 section : 'components')
399 summary('cryptsetup support',
400 lib_cryptsetup.found() ? 'enabled' : 'disabled',
401 section : 'components')
404 have = cc.has_function(
405 'crypt_activate_by_signed_key',
406 dependencies : lib_cryptsetup)
407 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
409 lib_cap_ng = dependency(
411 required : get_option('build-setpriv'))
412 if not lib_cap_ng.found()
413 lib_cap_ng = disabler()
416 lib_selinux = dependency(
419 required : get_option('selinux'))
420 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
422 lib_magic = dependency(
424 required : get_option('magic'))
425 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
427 lib_econf = dependency(
429 required : get_option('econf'))
430 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
432 lib_audit = dependency(
434 required : get_option('audit'))
435 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
437 conf.set('HAVE_SMACK', not get_option('smack').disabled())
440 foreach header : headers
441 have = cc.has_header(header)
442 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
445 header = 'linux/btrfs.h'
446 enable_btrfs = cc.has_header(header,
447 required : get_option('btrfs'))
448 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
449 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
451 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
456 have = cc.has_header(header,
458 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
461 have = cc.has_header('sched.h')
462 conf.set10('HAVE_DECL_CPU_ALLOC', have)
463 have_cpu_set_t = cc.has_type('cpu_set_t', args : '-D_GNU_SOURCE', prefix : '#include <sched.h>')
464 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
466 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
467 conf.set('HAVE_ENVIRON_DECL', have ? 1 : false)
469 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
470 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
472 have = cc.has_function('strsignal')
473 conf.set10('HAVE_STRSIGNAL_DECL', have)
475 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
476 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
478 have = cc.has_type('loff_t',
479 args : '-D_GNU_SOURCE',
480 prefix : '#include <sys/types.h>')
481 conf.set('HAVE_LOFF_T', have ? 1 : false)
483 have = cc.compiles('''
484 #define _GNU_SOURCE 1
485 #include <langinfo.h>
488 str = nl_langinfo (ALTMON_1);
489 str = nl_langinfo (ALTMON_2);
490 str = nl_langinfo (ALTMON_3);
491 str = nl_langinfo (ALTMON_4);
492 str = nl_langinfo (ALTMON_5);
493 str = nl_langinfo (ALTMON_6);
494 str = nl_langinfo (ALTMON_7);
495 str = nl_langinfo (ALTMON_8);
496 str = nl_langinfo (ALTMON_9);
497 str = nl_langinfo (ALTMON_10);
498 str = nl_langinfo (ALTMON_11);
499 str = nl_langinfo (ALTMON_12);
503 name : 'langinfo.h defines ALTMON_x constants')
504 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
506 have = cc.compiles('''
507 #define _GNU_SOURCE 1
508 #include <langinfo.h>
511 str = nl_langinfo (_NL_ABALTMON_1);
512 str = nl_langinfo (_NL_ABALTMON_2);
513 str = nl_langinfo (_NL_ABALTMON_3);
514 str = nl_langinfo (_NL_ABALTMON_4);
515 str = nl_langinfo (_NL_ABALTMON_5);
516 str = nl_langinfo (_NL_ABALTMON_6);
517 str = nl_langinfo (_NL_ABALTMON_7);
518 str = nl_langinfo (_NL_ABALTMON_8);
519 str = nl_langinfo (_NL_ABALTMON_9);
520 str = nl_langinfo (_NL_ABALTMON_10);
521 str = nl_langinfo (_NL_ABALTMON_11);
522 str = nl_langinfo (_NL_ABALTMON_12);
526 name : 'langinfo.h defines _NL_ABALTMON_x constants')
527 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
529 have = cc.compiles('''
530 #define _GNU_SOURCE 1
531 #include <langinfo.h>
534 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
538 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
539 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
572 landlock_create_ruleset
574 landlock_restrict_self
637 have = cc.has_function(func)
638 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
639 # This makes little sense, but is necessary to avoid warnings about
640 # redefined macros from Python.h, which uses this convention.
641 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
644 have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
645 conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false)
647 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
648 conf.set('AGETTY_RELOAD', have ? 1 : false)
650 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
653 have_dirfd = (cc.has_function('dirfd') or
654 cc.has_header_symbol('dirent.h', 'dirfd',
655 prefix : '#include <sys/types.h>'))
656 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
658 have_ddfd = cc.has_member('DIR', 'dd_fd',
660 #include <sys/types.h>
663 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
665 have = cc.has_member('struct tm', 'tm_gmtoff',
666 args : '-D_GNU_SOURCE',
671 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
675 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
676 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
678 have = cc.has_member('struct termios', 'c_line',
679 prefix : '#include <termios.h>')
680 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
682 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
683 args : '-D_GNU_SOURCE',
684 prefix : '#include <sys/stat.h>')
685 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
687 have = cc.has_member('struct statx', 'stx_mnt_id',
688 prefix : '#include <sys/stat.h>')
689 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
691 # replacement for AC_STRUCT_TIMEZONE
692 have = cc.has_member('struct tm', 'tm_zone',
693 args : '-D_GNU_SOURCE',
694 prefix : '#include <time.h>')
695 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
697 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
698 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
700 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
701 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
703 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
704 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
709 extern char *tzname[];
712 return tzname ? 0 : 1;
714 '''.format(have ? 1 : 0)
715 have = cc.compiles(code, name : 'using tzname[]')
716 conf.set('HAVE_TZNAME', have ? 1 : false)
718 have = cc.sizeof('time_t', prefix : '#include <time.h>')
720 add_global_arguments('-D_TIME_BITS=64', language : 'c')
721 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
723 if get_option('allow-32bit-time')
724 warning('Could not make time_t 64bits wide')
726 error('Could not make time_t 64bits wide')
732 if not cc.has_function('socket')
733 socket_libs += cc.find_library('socket', required : true)
734 have = cc.has_function('socket',
735 dependencies : socket_libs)
737 error('socket() function not available')
741 lib_rt = cc.find_library('rt', required : false)
743 have = cc.has_function('clock_gettime')
746 realtime_libs += lib_rt
747 have = cc.has_function('clock_gettime',
748 dependencies : realtime_libs)
751 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
753 thread_libs = dependency('threads')
755 have = cc.has_function('timer_create')
758 realtime_libs = [lib_rt]
759 have = cc.has_function('timer_create',
760 dependencies : realtime_libs)
763 realtime_libs += thread_libs
764 have = cc.has_function('timer_create',
765 dependencies : realtime_libs)
768 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
770 have = cc.has_function('setitimer')
771 conf.set('HAVE_SETITIMER', have ? 1 : false)
774 rtas_libs = cc.find_library('rtas', required : false)
775 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
778 if not cc.has_header_symbol('math.h', 'isnan')
779 lib = cc.find_library('m', required : true)
780 if (cc.has_function('isnan', dependencies : lib) and
781 cc.has_function('__isnan', dependencies : lib))
786 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
787 args : '-D_GNU_SOURCE')
788 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
791 extern char *__progname;
793 return (*__progname != 0);
796 have = cc.compiles(code, name : 'using __progname')
797 conf.set('HAVE___PROGNAME', have ? 1 : false)
799 have = conf.get('HAVE_PTY_H').to_string() == '1' \
800 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
801 conf.set('HAVE_PTY', have ? 1 : false)
803 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
804 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
806 build_plymouth_support = get_option('build-plymouth-support')
807 have_tiocglcktrmios = cc.has_header_symbol(
808 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
809 required : build_plymouth_support.enabled())
810 have_sock_cloexec = cc.has_header_symbol(
811 'sys/socket.h', 'SOCK_CLOEXEC',
812 prefix : '#include <sys/types.h>',
813 required : build_plymouth_support.enabled())
814 have_sock_nonblock = cc.has_header_symbol(
815 'sys/socket.h', 'SOCK_NONBLOCK',
816 prefix : '#include <sys/types.h>',
817 required : build_plymouth_support.enabled())
818 have_so_passcred = cc.has_header_symbol(
819 'sys/socket.h', 'SO_PASSCRED',
820 args : ['-D_GNU_SOURCE'],
821 prefix : '#include <sys/types.h>',
822 required : build_plymouth_support.enabled())
824 build_plymouth_support = (not build_plymouth_support.disabled() and
825 have_tiocglcktrmios and
826 have_sock_cloexec and
827 have_sock_nonblock and
829 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
830 summary('plymouth support',
831 build_plymouth_support ? 'enabled' : 'disabled',
832 section : 'components')
834 # check for valid fallocate() function
835 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
836 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
837 # and program can't be linked.
845 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
846 return ret == 0 ? 0 : 1;
849 have = cc.links(code, name : 'fallocate() function')
850 conf.set('HAVE_FALLOCATE', have ? 1 : false)
858 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
859 return ret == 0 ? 0 : 1;
862 have = cc.links(code, name : 'posix_fallocate() function')
863 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
865 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
866 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
867 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
869 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
870 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
871 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
873 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
875 ############################################################
878 fs_search_path = get_option('fs-search-path')
879 fs_search_path_extra = get_option('fs-search-path-extra')
880 if fs_search_path_extra != ''
881 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
883 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
885 systemdsystemunitdir = ''
887 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
890 sysvinit = get_option('sysvinit').enabled()
891 sysvinitrcdir = sysconfdir + '/init.d'
893 program_tests = get_option('program-tests')
895 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
896 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
898 have = get_option('chsh-only-listed')
899 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
901 have = get_option('use-tty-group')
902 conf.set('USE_TTY_GROUP', have ? 1 : false)
904 bison = find_program('bison')
905 flex = find_program('flex')
906 sed = find_program('sed')
908 build_hwclock = not get_option('build-hwclock').disabled()
909 bison_gen = generator(
911 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
912 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
914 python_module = import('python')
915 python = python_module.find_installation(
916 get_option('python'),
920 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
921 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
925 configuration : conf)
927 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
932 '-Waddress-of-packed-member',
933 '-Wdiscarded-qualifiers',
934 '-Wembedded-directive',
937 '-Wimplicit-function-declaration',
938 '-Wmissing-declarations',
939 '-Wmissing-parameter-type',
940 '-Wmissing-prototypes',
942 '-Wno-missing-field-initializers',
943 '-Wold-style-definition',
947 '-Wstrict-prototypes',
950 '-Wunused-but-set-parameter',
951 '-Wunused-but-set-variable',
952 '-Wunused-parameter',
958 foreach compiler_flag : compiler_flags
959 if cc.has_argument(compiler_flag)
960 add_project_arguments(compiler_flag, language : 'c')
968 bashcompletionslinks = {}
974 subdir('libsmartcols')
976 subdir('liblastlog2')
978 subdir('pam_lastlog2')
979 subdir('login-utils')
988 includes = [dir_include,
997 opt = not get_option('build-chfn-chsh').disabled()
1002 include_directories : includes,
1003 link_with : [lib_common, logindefs_c],
1004 dependencies : chfn_chsh_deps,
1005 install_dir : usrbin_exec_dir,
1006 install_mode : 'rwsr-xr-x',
1008 build_by_default : opt)
1012 'login-utils/chsh.c',
1015 include_directories : includes,
1016 link_with : lib_common,
1017 dependencies : chfn_chsh_deps,
1018 install_dir : usrbin_exec_dir,
1019 install_mode : 'rwsr-xr-x',
1021 build_by_default : opt)
1022 if opt and not is_disabler(exe)
1024 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1025 bashcompletions += ['chfn', 'chsh']
1030 test_islocal_sources,
1031 include_directories : includes,
1032 c_args : '-DTEST_PROGRAM',
1033 build_by_default : program_tests)
1038 test_consoles_sources,
1039 c_args : ['-DTEST_PROGRAM'],
1040 include_directories : includes,
1041 link_with : lib_common,
1042 build_by_default : program_tests)
1045 opt = not get_option('build-last').disabled()
1049 include_directories : includes,
1050 link_with : [lib_common],
1051 install_dir : usrbin_exec_dir,
1053 build_by_default : opt)
1054 if opt and not is_disabler(exe)
1056 meson.add_install_script(meson_make_symlink,
1058 join_paths(usrbin_exec_dir, 'lastb'))
1059 manadocs += ['login-utils/last.1.adoc']
1060 manlinks += {'lastb.1': 'last.1'}
1061 bashcompletions += ['last']
1062 bashcompletionslinks += {'lastb': 'last'}
1065 opt = not get_option('build-nologin').disabled()
1068 'login-utils/nologin.c',
1069 include_directories : includes,
1070 install_dir : sbindir,
1071 link_with : [lib_common],
1073 build_by_default : opt)
1074 if opt and not is_disabler(exe)
1076 manadocs += ['login-utils/nologin.8.adoc']
1079 opt = not get_option('build-utmpdump').disabled()
1082 'login-utils/utmpdump.c',
1083 include_directories : includes,
1084 link_with : [lib_common],
1085 install_dir : usrbin_exec_dir,
1087 build_by_default : opt)
1088 if opt and not is_disabler(exe)
1090 manadocs += ['login-utils/utmpdump.1.adoc']
1091 bashcompletions += ['utmpdump']
1094 opt = not get_option('build-su').disabled()
1098 'login-utils/su-common.c',
1099 'login-utils/su-common.h',
1103 include_directories : includes,
1104 link_with : [lib_common, logindefs_c],
1105 dependencies : [lib_pam,
1109 install_mode : 'rwsr-xr-x',
1111 build_by_default : opt)
1112 if opt and not is_disabler(exe)
1114 manadocs += ['login-utils/su.1.adoc']
1115 bashcompletions += ['su']
1118 opt = not get_option('build-newgrp').disabled()
1121 'login-utils/newgrp.c',
1122 include_directories : includes,
1123 dependencies : [lib_crypt],
1124 install_dir : usrbin_exec_dir,
1125 install_mode : 'rwsr-xr-x',
1127 build_by_default : opt)
1128 if opt and not is_disabler(exe)
1130 manadocs += ['login-utils/newgrp.1.adoc']
1131 bashcompletions += ['newgrp']
1134 opt = not get_option('build-lslogins').disabled()
1137 'login-utils/lslogins.c',
1138 include_directories : includes,
1139 link_with : [lib_common,
1142 (build_liblastlog2 ? [lib_lastlog2] : []),
1143 dependencies : [lib_selinux,
1145 install_dir : usrbin_exec_dir,
1147 build_by_default : opt)
1148 if opt and not is_disabler(exe)
1150 manadocs += ['login-utils/lslogins.1.adoc']
1151 bashcompletions += ['lslogins']
1154 opt = not get_option('build-vipw').disabled()
1157 'login-utils/vipw.c',
1158 'login-utils/setpwnam.h',
1159 include_directories : includes,
1160 link_with : [lib_common],
1161 dependencies : [lib_selinux],
1162 install_dir : usrbin_exec_dir,
1164 build_by_default : opt)
1165 if opt and not is_disabler(exe)
1167 meson.add_install_script(meson_make_symlink,
1169 join_paths(usrbin_exec_dir, 'vigr'))
1170 manadocs += ['login-utils/vipw.8.adoc']
1171 meson.add_install_script(meson_make_symlink,
1173 join_paths(mandir, 'man8/vigr.8'))
1176 opt = not get_option('build-runuser').disabled()
1179 'login-utils/runuser.c',
1180 'login-utils/su-common.c',
1181 'login-utils/su-common.h',
1185 include_directories : includes,
1186 link_with : [lib_common, logindefs_c],
1187 dependencies : [lib_pam,
1191 install_dir : sbindir,
1193 build_by_default : opt)
1194 if opt and not is_disabler(exe)
1196 manadocs += ['login-utils/runuser.1.adoc']
1197 bashcompletionslinks += {'runuser': 'su'}
1200 ############################################################
1206 include_directories : includes,
1207 link_with : lib_common,
1208 install_dir : usrbin_exec_dir,
1211 manadocs += ['text-utils/col.1.adoc']
1212 bashcompletions += ['col']
1218 include_directories : includes,
1219 install_dir : usrbin_exec_dir,
1222 manadocs += ['text-utils/colcrt.1.adoc']
1223 bashcompletions += ['colcrt']
1228 include_directories : includes,
1229 link_with : lib_common,
1230 install_dir : usrbin_exec_dir,
1233 manadocs += ['text-utils/colrm.1.adoc']
1234 bashcompletions += ['colrm']
1239 include_directories : includes,
1240 install_dir : usrbin_exec_dir,
1243 manadocs += ['text-utils/rev.1.adoc']
1244 bashcompletions += ['rev']
1249 include_directories : includes,
1250 link_with : [lib_common,
1252 install_dir : usrbin_exec_dir,
1254 if not is_disabler(exe)
1256 manadocs += ['text-utils/column.1.adoc']
1257 bashcompletions += ['column']
1260 opt = not get_option('build-line').disabled()
1264 include_directories : includes,
1265 install_dir : usrbin_exec_dir,
1267 build_by_default : opt)
1268 if opt and not is_disabler(exe)
1270 manadocs += ['text-utils/line.1.adoc']
1273 opt = not get_option('build-pg').disabled()
1277 link_with : lib_common,
1278 include_directories : includes,
1279 dependencies : [lib_tinfo,
1281 install_dir : usrbin_exec_dir,
1283 build_by_default : opt)
1284 if opt and not is_disabler(exe)
1286 manadocs += ['text-utils/pg.1.adoc']
1287 bashcompletions += ['pg']
1290 opt = not get_option('build-ul').disabled()
1294 include_directories : includes,
1295 dependencies : [lib_tinfo,
1297 install_dir : usrbin_exec_dir,
1299 build_by_default : opt)
1300 if opt and not is_disabler(exe)
1302 manadocs += ['text-utils/ul.1.adoc']
1303 bashcompletions += ['ul']
1306 opt = not get_option('build-more').disabled()
1310 link_with : [lib_common],
1311 include_directories : includes,
1312 dependencies : [lib_tinfo,
1316 build_by_default : opt)
1320 link_with : [lib_common],
1321 include_directories : includes,
1322 c_args : '-DTEST_PROGRAM',
1323 dependencies : [lib_tinfo,
1326 build_by_default : opt and program_tests)
1328 if opt and not is_disabler(exe)
1330 manadocs += ['text-utils/more.1.adoc']
1331 bashcompletions += ['more']
1337 include_directories : includes,
1338 link_with : [lib_common,
1340 install_dir : usrbin_exec_dir,
1342 if not is_disabler(exe)
1344 manadocs += ['text-utils/hexdump.1.adoc']
1345 bashcompletions += ['hexdump']
1348 opt = not get_option('build-lsmem').disabled()
1352 include_directories : includes,
1353 link_with : [lib_common,
1355 install_dir : usrbin_exec_dir,
1357 build_by_default : opt)
1358 if opt and not is_disabler(exe)
1360 manadocs += ['sys-utils/lsmem.1.adoc']
1361 bashcompletions += ['lsmem']
1364 opt = not get_option('build-chmem').disabled()
1368 include_directories : includes,
1369 link_with : [lib_common],
1370 install_dir : usrbin_exec_dir,
1372 build_by_default : opt)
1373 if opt and not is_disabler(exe)
1375 manadocs += ['sys-utils/chmem.8.adoc']
1376 bashcompletions += ['chmem']
1382 include_directories : includes,
1383 link_with : [lib_common],
1384 install_dir : usrbin_exec_dir,
1387 manadocs += ['sys-utils/choom.1.adoc']
1389 has_seminfo_type = cc.has_type('struct seminfo', args : '-D_GNU_SOURCE', prefix : '#include <sys/sem.h>')
1391 opt = get_option('build-ipcmk').require(has_seminfo_type).allowed()
1395 include_directories : includes,
1396 link_with : [lib_common],
1397 install_dir : usrbin_exec_dir,
1399 build_by_default : opt)
1400 if opt and not is_disabler(exe)
1402 manadocs += ['sys-utils/ipcmk.1.adoc']
1403 bashcompletions += ['ipcmk']
1406 opt = get_option('build-ipcrm').require(has_seminfo_type).allowed()
1410 include_directories : includes,
1411 link_with : [lib_common],
1412 install_dir : usrbin_exec_dir,
1414 build_by_default : opt)
1415 if opt and not is_disabler(exe)
1417 manadocs += ['sys-utils/ipcrm.1.adoc']
1418 bashcompletions += ['ipcrm']
1421 opt = not get_option('build-ipcs').require(has_seminfo_type).disabled()
1425 include_directories : includes,
1426 link_with : [lib_common],
1427 install_dir : usrbin_exec_dir,
1429 build_by_default : opt)
1430 if opt and not is_disabler(exe)
1432 manadocs += ['sys-utils/ipcs.1.adoc']
1433 bashcompletions += ['ipcs']
1436 opt = not get_option('build-rfkill').disabled()
1440 include_directories : includes,
1441 link_with : [lib_common,
1443 install_dir : usrsbin_exec_dir,
1445 build_by_default : opt)
1446 if opt and not is_disabler(exe)
1448 manadocs += ['sys-utils/rfkill.8.adoc']
1449 bashcompletions += ['rfkill']
1455 include_directories : includes,
1456 link_with : [lib_common,
1458 install_dir : usrbin_exec_dir,
1460 if not is_disabler(exe)
1462 manadocs += ['sys-utils/renice.1.adoc']
1463 bashcompletions += ['renice']
1469 include_directories: includes,
1470 link_with : [lib_common,
1472 install_dir : usrbin_exec_dir,
1474 if opt and not is_disabler(exe)
1476 manadocs += ['sys-utils/setpgid.1.adoc']
1477 bashcompletions += ['setpgid']
1483 include_directories : includes,
1484 link_with : [lib_common,
1486 install_dir : usrbin_exec_dir,
1488 if opt and not is_disabler(exe)
1490 manadocs += ['sys-utils/setsid.1.adoc']
1491 bashcompletions += ['setsid']
1496 readprofile_sources,
1497 include_directories : includes,
1498 link_with : [lib_common,
1500 install_dir : usrsbin_exec_dir,
1502 if not is_disabler(exe)
1504 manadocs += ['sys-utils/readprofile.8.adoc']
1505 bashcompletions += ['readprofile']
1508 opt = not get_option('build-tunelp').disabled()
1512 include_directories : includes,
1513 link_with : [lib_common],
1514 install_dir : usrsbin_exec_dir,
1516 build_by_default : opt)
1517 if opt and not is_disabler(exe)
1519 manadocs += ['sys-utils/tunelp.8.adoc']
1520 bashcompletions += ['tunelp']
1523 opt = get_option('build-fstrim').require(have_sys_vfs_header).allowed()
1527 include_directories : includes,
1528 link_with : [lib_common],
1529 dependencies : [mount_dep],
1530 install_dir : sbindir,
1532 build_by_default : opt)
1533 if opt and not is_disabler(exe)
1535 manadocs += ['sys-utils/fstrim.8.adoc']
1536 bashcompletions += ['fstrim']
1539 opt = get_option('build-dmesg').require(cc.has_header('sys/klog.h')).allowed()
1543 include_directories : includes,
1544 link_with : [lib_common,
1547 build_by_default : opt)
1548 if opt and not is_disabler(exe)
1550 manadocs += ['sys-utils/dmesg.1.adoc']
1551 bashcompletions += ['dmesg']
1557 include_directories : dir_include,
1558 c_args : '-DTEST_DMESG',
1559 link_with : [lib_common,
1561 build_by_default : program_tests)
1562 if not is_disabler(exe)
1569 include_directories : includes,
1570 link_with : [lib_common],
1571 install_dir : sbindir,
1574 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1575 bashcompletions += ['ctrlaltdel']
1577 have_linux_fs_h = conf.get('HAVE_LINUX_FS_H').to_string() == '1'
1579 opt = get_option('build-fsfreeze').require(have_linux_fs_h).allowed()
1583 include_directories : includes,
1584 install_dir : sbindir,
1586 build_by_default : opt)
1587 if opt and not is_disabler(exe)
1589 manadocs += ['sys-utils/fsfreeze.8.adoc']
1590 bashcompletions += ['fsfreeze']
1593 opt = get_option('build-blkdiscard').require(have_linux_fs_h).allowed()
1597 include_directories : includes,
1598 link_with : [lib_common],
1599 dependencies : [blkid_dep],
1600 install_dir : sbindir,
1602 build_by_default : opt)
1603 if opt and not is_disabler(exe)
1605 manadocs += ['sys-utils/blkdiscard.8.adoc']
1606 bashcompletions += ['blkdiscard']
1609 opt = get_option('build-blkzone').require(have_linux_fs_h).allowed()
1613 include_directories : includes,
1614 link_with : [lib_common],
1615 install_dir : sbindir,
1617 build_by_default : opt)
1618 if opt and not is_disabler(exe)
1620 manadocs += ['sys-utils/blkzone.8.adoc']
1621 bashcompletions += ['blkzone']
1624 opt = get_option('build-blkpr').require(cc.has_header('linux/pr.h')).allowed()
1628 include_directories : includes,
1629 link_with : [lib_common],
1630 install_dir : sbindir,
1632 build_by_default : opt)
1633 if opt and not is_disabler(exe)
1635 manadocs += ['sys-utils/blkpr.8.adoc']
1638 opt = get_option('build-ldattach').require(cc.has_header('linux/if.h')).allowed()
1642 include_directories : includes,
1643 link_with : [lib_common],
1644 install_dir : usrsbin_exec_dir,
1646 build_by_default : opt)
1647 if opt and not is_disabler(exe)
1649 manadocs += ['sys-utils/ldattach.8.adoc']
1650 bashcompletions += ['ldattach']
1653 opt = get_option('build-rtcwake').require(cc.has_header('linux/rtc.h')).allowed()
1657 include_directories : includes,
1658 link_with : [lib_common],
1659 install_dir : usrsbin_exec_dir,
1661 build_by_default : opt)
1662 if opt and not is_disabler(exe)
1664 manadocs += ['sys-utils/rtcwake.8.adoc']
1665 bashcompletions += ['rtcwake']
1668 opt = get_option('build-setarch').require(cc.has_header('sys/personality.h')).allowed()
1672 include_directories : includes,
1673 link_with : [lib_common],
1674 install_dir : usrbin_exec_dir,
1676 build_by_default : opt)
1677 if opt and not is_disabler(exe)
1679 manadocs += ['sys-utils/setarch.8.adoc']
1680 bashcompletions += ['setarch']
1684 setarch_links = ['uname26', 'linux32', 'linux64']
1685 setarch_links_arch = {
1686 's390x' : ['s390', 's390x'],
1688 'x86_64' : ['i386', 'x86_64'],
1689 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1690 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1691 'mips64' : ['mips', 'mips64', 'mips32'],
1692 'ia64' : ['i386', 'ia64'],
1693 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1695 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1697 foreach link: setarch_links
1698 meson.add_install_script(meson_make_symlink,
1700 join_paths(usrbin_exec_dir, link))
1701 manlinks += {link + '.8': 'setarch.8'}
1705 opt = not get_option('build-eject').disabled()
1709 include_directories : includes,
1710 link_with : [lib_common],
1711 dependencies : [mount_dep],
1712 install_dir : usrbin_exec_dir,
1714 build_by_default : opt)
1715 if opt and not is_disabler(exe)
1717 manadocs += ['sys-utils/eject.1.adoc']
1718 bashcompletions += ['eject']
1721 opt = not get_option('build-losetup').disabled()
1725 include_directories : includes,
1726 link_with : [lib_common,
1728 install_dir : sbindir,
1730 build_by_default : opt)
1731 if opt and not is_disabler(exe)
1732 manadocs += ['sys-utils/losetup.8.adoc']
1734 bashcompletions += ['losetup']
1737 opt = opt and 'losetup' in static_programs
1741 include_directories : includes,
1742 link_args : ['--static'],
1743 link_with : [lib_common,
1744 lib_smartcols.get_static_lib()],
1745 install_dir : sbindir,
1747 build_by_default : opt)
1748 if opt and not is_disabler(exe)
1752 opt = not get_option('build-zramctl').disabled()
1756 include_directories : includes,
1757 link_with : [lib_common,
1759 install_dir : sbindir,
1761 build_by_default : opt)
1762 if opt and not is_disabler(exe)
1764 manadocs += ['sys-utils/zramctl.8.adoc']
1765 bashcompletions += ['zramctl']
1771 include_directories : includes,
1772 link_with : [lib_common,
1774 install_dir : usrbin_exec_dir,
1776 if not is_disabler(exe)
1778 manadocs += ['sys-utils/prlimit.1.adoc']
1779 bashcompletions += ['prlimit']
1782 opt = not get_option('build-lsns').disabled()
1786 include_directories : includes,
1787 link_with : [lib_common,
1789 dependencies : [mount_dep],
1790 install_dir : usrbin_exec_dir,
1792 build_by_default : opt)
1793 if opt and not is_disabler(exe)
1795 manadocs += ['sys-utils/lsns.8.adoc']
1796 bashcompletions += ['lsns']
1799 opt = not get_option('build-mount').disabled()
1803 include_directories : includes,
1804 link_with : [lib_common,
1806 dependencies : [lib_selinux, mount_dep],
1807 install_mode : 'rwsr-xr-x',
1809 build_by_default : opt)
1813 include_directories : includes,
1814 link_with : [lib_common],
1815 dependencies : [mount_dep],
1816 install_mode : 'rwsr-xr-x',
1818 build_by_default : opt)
1819 if opt and not is_disabler(exe)
1821 manadocs += ['sys-utils/fstab.5.adoc',
1822 'sys-utils/mount.8.adoc',
1823 'sys-utils/umount.8.adoc']
1824 bashcompletions += ['mount', 'umount']
1827 opt2 = opt and 'mount' in static_programs
1831 include_directories : includes,
1832 link_args : ['--static'],
1833 link_with : [lib_common,
1834 lib_smartcols_static],
1835 dependencies : [mount_static_dep],
1837 build_by_default : opt2)
1838 if opt2 and not is_disabler(exe)
1842 opt2 = opt and 'umount' in static_programs
1846 include_directories : includes,
1847 link_args : ['--static'],
1848 link_with : [lib_common],
1849 dependencies : [mount_static_dep],
1851 build_by_default : opt2)
1852 if opt2 and not is_disabler(exe)
1858 opt = not get_option('build-swapon').disabled()
1862 include_directories : includes,
1863 link_with : [lib_common,
1865 dependencies : [blkid_dep, mount_dep],
1866 install_dir : sbindir,
1868 build_by_default : opt)
1869 if opt and not is_disabler(exe)
1871 manadocs += ['sys-utils/swapon.8.adoc']
1872 bashcompletions += ['swapon']
1875 opt = not get_option('build-swapoff').disabled()
1879 include_directories : includes,
1880 link_with : [lib_common],
1881 dependencies : [blkid_dep, mount_dep],
1882 install_dir : sbindir,
1884 build_by_default : opt)
1885 if opt and not is_disabler(exe)
1887 manlinks += {'swapoff.8': 'swapon.8'}
1888 bashcompletions += ['swapoff']
1894 include_directories : includes,
1895 link_with : [lib_common,
1897 dependencies : [rtas_libs],
1898 install_dir : usrbin_exec_dir,
1900 if not is_disabler(exe)
1902 manadocs += ['sys-utils/lscpu.1.adoc']
1903 bashcompletions += ['lscpu']
1909 include_directories : includes,
1910 link_with : [lib_common],
1911 install_dir : sbindir,
1914 manadocs += ['sys-utils/chcpu.8.adoc']
1915 bashcompletions += ['chcpu']
1920 include_directories : includes,
1921 link_with : [lib_common,
1924 if not is_disabler(exe)
1926 manadocs += ['sys-utils/wdctl.8.adoc']
1927 bashcompletions += ['wdctl']
1930 opt = not get_option('build-mountpoint').disabled()
1934 include_directories : includes,
1935 dependencies : [mount_dep],
1937 build_by_default : opt)
1938 if opt and not is_disabler(exe)
1940 manadocs += ['sys-utils/mountpoint.1.adoc']
1941 bashcompletions += ['mountpoint']
1944 opt = not get_option('build-fallocate').disabled()
1948 include_directories : includes,
1949 link_with : [lib_common],
1950 install_dir : usrbin_exec_dir,
1952 build_by_default : opt)
1953 if opt and not is_disabler(exe)
1955 manadocs += ['sys-utils/fallocate.1.adoc']
1956 bashcompletions += ['fallocate']
1959 opt = not get_option('build-pivot_root').disabled()
1963 include_directories : includes,
1964 install_dir : sbindir,
1966 build_by_default : opt)
1967 if opt and not is_disabler(exe)
1969 manadocs += ['sys-utils/pivot_root.8.adoc']
1970 bashcompletions += ['pivot_root']
1973 opt = not get_option('build-switch_root').disabled()
1974 if opt and not have_dirfd and not have_ddfd
1975 error('neither dirfd nor ddfd are available')
1979 switch_root_sources,
1980 include_directories : includes,
1981 install_dir : sbindir,
1983 build_by_default : opt)
1984 if opt and not is_disabler(exe)
1986 manadocs += ['sys-utils/switch_root.8.adoc']
1989 opt = not get_option('build-unshare').disabled()
1993 include_directories : includes,
1994 link_with : [lib_common],
1995 dependencies : [mount_dep],
1996 install_dir : usrbin_exec_dir,
1998 build_by_default : opt)
1999 if opt and not is_disabler(exe)
2001 manadocs += ['sys-utils/unshare.1.adoc']
2002 bashcompletions += ['unshare']
2005 opt = opt and 'unshare' in static_programs
2009 include_directories : includes,
2010 link_with : [lib_common],
2011 dependencies : [mount_dep],
2012 install_dir : usrbin_exec_dir,
2014 build_by_default : opt)
2015 if opt and not is_disabler(exe)
2019 opt = not get_option('build-nsenter').disabled()
2023 include_directories : includes,
2024 link_with : [lib_common],
2025 dependencies : [lib_selinux],
2026 install_dir : usrbin_exec_dir,
2028 build_by_default : opt)
2029 if opt and not is_disabler(exe)
2031 manadocs += ['sys-utils/nsenter.1.adoc']
2032 bashcompletions += ['nsenter']
2035 opt = opt and 'nsenter' in static_programs
2039 include_directories : includes,
2040 link_with : [lib_common],
2041 dependencies : [lib_selinux],
2042 install_dir : usrbin_exec_dir,
2044 build_by_default : opt)
2045 if opt and not is_disabler(exe)
2049 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
2053 include_directories : includes,
2054 link_with : [lib_common],
2055 dependencies : [lib_cap_ng],
2056 install_dir : usrbin_exec_dir,
2058 build_by_default : opt)
2059 if opt and not is_disabler(exe)
2061 manadocs += ['sys-utils/setpriv.1.adoc']
2062 bashcompletions += ['setpriv']
2068 include_directories : includes,
2069 link_with : [lib_common],
2070 dependencies : realtime_libs,
2071 install_dir : usrbin_exec_dir,
2074 manadocs += ['sys-utils/flock.1.adoc']
2075 bashcompletions += ['flock']
2077 opt = not get_option('build-lsirq').disabled()
2081 include_directories : includes,
2082 link_with : [lib_common,
2084 install_dir : usrbin_exec_dir,
2086 build_by_default : opt)
2087 if opt and not is_disabler(exe)
2089 manadocs += ['sys-utils/lsirq.1.adoc']
2090 bashcompletions += ['lsirq']
2093 opt = not get_option('build-irqtop').disabled()
2097 include_directories : includes,
2098 dependencies : [realtime_libs, curses_libs],
2099 link_with : [lib_common,
2102 install_dir : usrbin_exec_dir,
2104 build_by_default : opt)
2105 if opt and not is_disabler(exe)
2107 manadocs += ['sys-utils/irqtop.1.adoc']
2108 bashcompletions += ['irqtop']
2111 opt = not get_option('build-ipcs').disabled()
2115 include_directories : includes,
2116 link_with : [lib_common,
2118 install_dir : usrbin_exec_dir,
2120 build_by_default : opt)
2121 if opt and not is_disabler(exe)
2123 manadocs += ['sys-utils/lsipc.1.adoc']
2124 bashcompletions += ['lsipc']
2131 include_directories : includes,
2132 link_with : [lib_common],
2133 dependencies : [lib_m,
2135 install_dir : sbindir,
2137 build_by_default : opt)
2138 if opt and not is_disabler(exe)
2140 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2141 bashcompletions += ['hwclock']
2147 include_directories : includes,
2148 install_dir : sbindir,
2151 manadocs += ['disk-utils/mkfs.8.adoc']
2152 bashcompletions += ['mkfs']
2154 opt = not get_option('build-bfs').disabled()
2158 include_directories : includes,
2159 link_with : [lib_common],
2160 install_dir : sbindir,
2162 build_by_default : opt)
2163 if opt and not is_disabler(exe)
2165 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2166 bashcompletions += ['mkfs.bfs']
2172 include_directories : includes,
2173 link_with : [lib_common],
2174 install_dir : usrbin_exec_dir,
2177 manadocs += ['disk-utils/isosize.8.adoc']
2178 bashcompletions += ['isosize']
2183 include_directories : includes,
2184 link_with : [lib_common,
2186 dependencies: [blkid_dep, lib_selinux],
2187 install_dir : sbindir,
2189 if not is_disabler(exe)
2191 manadocs += ['disk-utils/mkswap.8.adoc']
2192 bashcompletions += ['mkswap']
2198 include_directories : includes,
2199 link_with : [lib_common,
2201 dependencies : [blkid_dep],
2202 install_dir : sbindir,
2204 if not is_disabler(exe)
2206 manadocs += ['disk-utils/swaplabel.8.adoc']
2207 bashcompletions += ['swaplabel']
2210 opt = not get_option('build-fsck').disabled()
2214 include_directories : includes,
2215 link_with : [lib_common],
2216 dependencies : [blkid_dep, mount_dep, realtime_libs],
2217 install_dir : sbindir,
2219 build_by_default : opt)
2220 if opt and not is_disabler(exe)
2222 manadocs += ['disk-utils/fsck.8.adoc']
2223 bashcompletions += ['fsck']
2226 opt = not get_option('build-minix').disabled()
2230 include_directories : includes,
2231 link_with : [lib_common],
2232 install_dir : sbindir,
2234 build_by_default : opt)
2238 include_directories : includes,
2239 c_args : '-DTEST_SCRIPT',
2240 link_with : [lib_common],
2241 build_by_default : opt and program_tests)
2245 include_directories : includes,
2246 link_with : [lib_common],
2247 install_dir : sbindir,
2249 build_by_default : opt)
2250 if opt and not is_disabler(exe)
2251 exes += [exe, exe2, exe3]
2252 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2253 bashcompletions += ['mkfs.minix', 'fsck.minix']
2256 opt = not get_option('build-cramfs').disabled()
2259 mkfs_cramfs_sources,
2260 include_directories : includes,
2261 link_with : [lib_common],
2262 dependencies : [lib_z],
2263 install_dir : sbindir,
2265 build_by_default : opt)
2268 fsck_cramfs_sources,
2269 include_directories : includes,
2270 link_with : [lib_common],
2271 dependencies : [lib_z],
2272 install_dir : sbindir,
2274 build_by_default : opt)
2275 if not is_disabler(exe)
2277 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2278 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2281 opt = not get_option('build-raw').disabled()
2283 cc.has_header('linux/raw.h', required: opt)
2288 include_directories : includes,
2289 install_dir : sbindir,
2291 build_by_default : opt)
2292 if opt and not is_disabler(exe)
2294 manadocs += ['disk-utils/raw.8.adoc']
2295 bashcompletions += ['raw']
2298 opt = not get_option('build-fdformat').disabled()
2302 include_directories : includes,
2303 link_with : [lib_common],
2304 install_dir : usrsbin_exec_dir,
2306 build_by_default : opt)
2307 if opt and not is_disabler(exe)
2309 manadocs += ['disk-utils/fdformat.8.adoc']
2310 bashcompletions += ['fdformat']
2316 include_directories : includes,
2317 link_with : [lib_common],
2318 install_dir : sbindir,
2320 manadocs += ['disk-utils/blockdev.8.adoc']
2321 bashcompletions += ['blockdev']
2323 opt = not get_option('build-fdisks').disabled()
2324 if opt and not have_dirfd and not have_ddfd
2325 error('neither dirfd nor ddfd are available')
2330 include_directories : includes,
2331 link_with : [lib_common,
2335 dependencies : [lib_readline],
2336 install_dir : sbindir,
2338 build_by_default : opt)
2339 if opt and not is_disabler(exe)
2341 bashcompletions += ['fdisk']
2344 opt2 = opt and 'fdisk' in static_programs
2348 link_args : ['--static'],
2349 include_directories : includes,
2350 link_with : [lib_common,
2353 lib_smartcols.get_static_lib()],
2354 dependencies : [lib_readline_static],
2355 install_dir : sbindir,
2357 build_by_default : opt2)
2358 if opt2 and not is_disabler(exe)
2365 include_directories : includes,
2366 link_with : [lib_common,
2370 dependencies : [lib_readline],
2371 install_dir : sbindir,
2373 build_by_default : opt)
2374 if opt and not is_disabler(exe)
2376 bashcompletions += ['sfdisk']
2379 opt2 = opt and 'sfdisk' in static_programs
2383 include_directories : includes,
2384 link_with : [lib_common,
2387 lib_smartcols.get_static_lib()],
2388 dependencies : [lib_readline_static],
2389 install_dir : sbindir,
2391 build_by_default : opt2)
2392 if opt2 and not is_disabler(exe)
2399 include_directories : includes,
2400 link_with : [lib_common,
2404 dependencies : [curses_libs, mount_dep],
2405 install_dir : sbindir,
2407 build_by_default : opt)
2408 if opt and not is_disabler(exe)
2410 manadocs += ['disk-utils/fdisk.8.adoc',
2411 'disk-utils/sfdisk.8.adoc',
2412 'disk-utils/cfdisk.8.adoc']
2413 bashcompletions += ['cfdisk']
2416 opt = not get_option('build-partx').disabled()
2420 include_directories : includes,
2421 link_with : [lib_common],
2422 install_dir : usrsbin_exec_dir,
2424 build_by_default : opt)
2428 include_directories : includes,
2429 link_with : [lib_common],
2430 install_dir : usrsbin_exec_dir,
2432 build_by_default : opt)
2436 include_directories : includes,
2437 link_with : [lib_common],
2438 install_dir : usrsbin_exec_dir,
2440 build_by_default : opt)
2444 include_directories : includes,
2445 link_with : [lib_common,
2447 dependencies : [blkid_dep],
2448 install_dir : usrsbin_exec_dir,
2450 build_by_default : opt)
2452 exes += [exe, exe2, exe3, exe4]
2453 manadocs += ['disk-utils/addpart.8.adoc',
2454 'disk-utils/delpart.8.adoc',
2455 'disk-utils/resizepart.8.adoc',
2456 'disk-utils/partx.8.adoc']
2457 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2459 opt = opt and 'partx' in static_programs
2463 include_directories : includes,
2464 link_args : ['--static'],
2465 link_with : [lib_common],
2466 install_dir : usrsbin_exec_dir,
2468 build_by_default : opt)
2472 include_directories : includes,
2473 link_args : ['--static'],
2474 link_with : [lib_common],
2475 install_dir : usrsbin_exec_dir,
2477 build_by_default : opt)
2479 'resizepart.static',
2481 include_directories : includes,
2482 link_args : ['--static'],
2483 link_with : [lib_common],
2484 install_dir : usrsbin_exec_dir,
2486 build_by_default : opt)
2490 include_directories : includes,
2491 link_args : ['--static'],
2492 link_with : [lib_common,
2493 lib_smartcols.get_static_lib()],
2494 dependencies : [blkid_static_dep],
2495 install_dir : usrsbin_exec_dir,
2497 build_by_default : opt)
2500 exes += [exe, exe2, exe3, exe4]
2503 ############################################################
2508 include_directories : includes,
2509 link_with : [lib_common],
2510 dependencies : [lib_util,
2514 install_dir : usrbin_exec_dir,
2517 manadocs += ['term-utils/script.1.adoc']
2518 bashcompletions += ['script']
2523 include_directories : includes,
2524 c_args : '-DTEST_SCRIPT',
2525 link_with : [lib_common],
2526 dependencies : [lib_util,
2530 build_by_default : program_tests)
2536 include_directories : includes,
2537 link_with : [lib_common],
2538 dependencies : [lib_util,
2541 install_dir : usrbin_exec_dir,
2544 manadocs += ['term-utils/scriptlive.1.adoc']
2545 bashcompletions += ['scriptlive']
2549 scriptreplay_sources,
2550 include_directories : includes,
2551 link_with : [lib_common],
2552 dependencies : [math_libs],
2553 install_dir : usrbin_exec_dir,
2556 manadocs += ['term-utils/scriptreplay.1.adoc']
2557 bashcompletions += ['scriptreplay']
2559 opt = not get_option('build-agetty').disabled()
2563 include_directories : includes,
2564 link_with : [lib_common, logindefs_c],
2565 dependencies : [BSD ? lib_util : [], lib_systemd],
2566 install_dir : sbindir,
2568 build_by_default : opt)
2571 manadocs += ['term-utils/agetty.8.adoc']
2574 opt = not get_option('build-setterm').disabled()
2578 include_directories : includes,
2579 link_with : [lib_common],
2580 dependencies : [curses_libs],
2581 install_dir : usrbin_exec_dir,
2583 build_by_default : opt)
2586 manadocs += ['term-utils/setterm.1.adoc']
2587 bashcompletions += ['setterm']
2590 opt = not get_option('build-mesg').disabled()
2594 include_directories : includes,
2595 link_with : [lib_common],
2596 install_dir : usrbin_exec_dir,
2598 build_by_default : opt)
2601 manadocs += ['term-utils/mesg.1.adoc']
2602 bashcompletions += ['mesg']
2605 opt = not get_option('build-wall').disabled()
2609 include_directories : includes,
2610 link_with : [lib_common],
2611 dependencies : [lib_systemd],
2612 install_dir : usrbin_exec_dir,
2613 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2615 build_by_default : opt)
2618 manadocs += ['term-utils/wall.1.adoc']
2619 bashcompletions += ['wall']
2622 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2623 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2625 opt = not get_option('build-write').disabled()
2629 include_directories : includes,
2630 link_with : [lib_common],
2631 dependencies : [lib_systemd],
2632 install_dir : usrbin_exec_dir,
2633 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2635 build_by_default : opt)
2638 manadocs += ['term-utils/write.1.adoc']
2639 bashcompletions += ['write']
2642 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2643 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2645 opt = not get_option('build-login').disabled()
2649 include_directories : includes,
2650 link_with : [lib_common, logindefs_c],
2651 dependencies : [lib_pam,
2655 build_by_default : opt)
2656 if not is_disabler(exe)
2658 manadocs += ['login-utils/login.1.adoc']
2661 opt = not get_option('build-sulogin').disabled()
2665 include_directories : includes,
2666 link_with : [lib_common],
2667 dependencies : [lib_crypt,
2669 install_dir : sbindir,
2671 build_by_default : opt)
2672 if not is_disabler(exe)
2674 manadocs += ['login-utils/sulogin.8.adoc']
2680 include_directories : includes,
2681 link_with : [lib_common,
2683 dependencies : [curses_libs],
2684 install_dir : usrbin_exec_dir,
2687 manadocs += ['misc-utils/cal.1.adoc']
2688 bashcompletions += ['cal']
2690 opt = not get_option('build-logger').disabled()
2694 include_directories : includes,
2695 link_with : [lib_common],
2696 dependencies : [lib_systemd],
2697 install_dir : usrbin_exec_dir,
2699 build_by_default : opt)
2700 if opt and not is_disabler(exe)
2702 manadocs += ['misc-utils/logger.1.adoc']
2703 bashcompletions += ['logger']
2709 include_directories : includes,
2710 c_args : '-DTEST_LOGGER',
2711 link_with : [lib_common],
2712 dependencies : [lib_systemd],
2713 build_by_default: program_tests)
2714 if not is_disabler(exe)
2721 include_directories : includes,
2722 install_dir : usrbin_exec_dir,
2725 manadocs += ['misc-utils/look.1.adoc']
2726 bashcompletions += ['look']
2731 include_directories : includes,
2732 link_with : [lib_common],
2733 install_dir : usrbin_exec_dir,
2736 manadocs += ['misc-utils/mcookie.1.adoc']
2737 bashcompletions += ['mcookie']
2739 if build_liblastlog2
2743 include_directories : includes,
2744 link_with : [lib_common, lib_lastlog2],
2745 install_dir : usrbin_exec_dir,
2748 manadocs += ['misc-utils/lastlog2.8.adoc']
2749 bashcompletions += ['lastlog2']
2750 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2751 'liblastlog2/man/ll2_write_entry.3.adoc',
2752 'liblastlog2/man/ll2_read_entry.3.adoc',
2753 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2754 'liblastlog2/man/ll2_read_all.3.adoc',
2755 'liblastlog2/man/ll2_remove_entry.3.adoc',
2756 'liblastlog2/man/ll2_rename_user.3.adoc',
2757 'liblastlog2/man/ll2_update_login_time.3.adoc'
2764 include_directories : includes,
2765 dependencies : [lib_selinux],
2766 install_dir : usrbin_exec_dir,
2769 manadocs += ['misc-utils/namei.1.adoc']
2770 bashcompletions += ['namei']
2775 include_directories : includes,
2776 link_with : [lib_common],
2777 install_dir : usrbin_exec_dir,
2780 manadocs += ['misc-utils/whereis.1.adoc']
2781 bashcompletions += ['whereis']
2783 opt = not get_option('build-lslocks').disabled()
2787 include_directories : includes,
2788 link_with : [lib_common,
2790 dependencies : [mount_dep],
2791 install_dir : usrbin_exec_dir,
2793 build_by_default : opt)
2794 if opt and not is_disabler(exe)
2796 manadocs += ['misc-utils/lslocks.8.adoc']
2797 bashcompletions += ['lslocks']
2800 opt = not get_option('build-lsblk').disabled()
2804 include_directories : includes,
2805 link_with : [lib_common,
2808 dependencies : [blkid_dep, lib_udev, mount_dep],
2810 build_by_default : opt)
2811 if opt and not is_disabler(exe)
2813 manadocs += ['misc-utils/lsblk.8.adoc']
2814 bashcompletions += ['lsblk']
2817 errnos_h = custom_target('errnos.h',
2818 input : 'tools/all_errnos',
2819 output : 'errnos.h',
2820 command : ['tools/all_errnos', sed.full_path(),
2821 cc.cmd_array(), get_option('c_args')],
2824 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2827 lsfd_sources, errnos_h,
2828 include_directories : includes,
2829 link_with : [lib_common,
2831 dependencies : [lib_rt],
2832 install_dir : usrbin_exec_dir,
2834 build_by_default : opt)
2835 if opt and not is_disabler(exe)
2837 manadocs += ['lsfd-cmd/lsfd.1.adoc']
2843 include_directories : includes,
2844 link_with : [lib_common,
2846 install_dir : usrbin_exec_dir,
2848 if not is_disabler(exe)
2850 manadocs += ['misc-utils/uuidgen.1.adoc']
2851 bashcompletions += ['uuidgen']
2857 include_directories : includes,
2858 link_with : [lib_common,
2861 install_dir : usrbin_exec_dir,
2863 if not is_disabler(exe)
2865 manadocs += ['misc-utils/uuidparse.1.adoc']
2866 bashcompletions += ['uuidparse']
2873 include_directories : includes,
2874 link_with : [lib_common,
2876 dependencies : [realtime_libs,
2878 install_dir : usrsbin_exec_dir,
2880 build_by_default : opt)
2884 include_directories : includes,
2885 link_with : [lib_common,
2887 dependencies : thread_libs,
2888 build_by_default : opt and program_tests)
2889 if not is_disabler(exe)
2891 manadocs += ['misc-utils/uuidd.8.adoc']
2892 bashcompletions += ['uuidd']
2895 opt = build_libblkid
2899 include_directories : includes,
2900 link_with : [lib_common],
2901 dependencies : [blkid_dep],
2902 install_dir : sbindir,
2904 build_by_default : opt)
2905 if opt and not is_disabler(exe)
2907 manadocs += ['misc-utils/blkid.8.adoc']
2908 bashcompletions += ['blkid']
2911 opt = opt and 'blkid' in static_programs
2915 include_directories : includes,
2916 link_with : [lib_common],
2917 dependencies : [blkid_static_dep],
2918 install_dir : sbindir,
2920 build_by_default : opt)
2921 if opt and not is_disabler(exe)
2927 'libblkid/samples/mkfs.c',
2928 include_directories : includes,
2929 dependencies : [blkid_dep])
2930 if not is_disabler(exe)
2935 'sample-partitions',
2936 'libblkid/samples/partitions.c',
2937 include_directories : includes,
2938 dependencies : [blkid_dep])
2939 if not is_disabler(exe)
2944 'sample-superblocks',
2945 'libblkid/samples/superblocks.c',
2946 include_directories : includes,
2947 dependencies : [blkid_dep])
2948 if not is_disabler(exe)
2954 'libblkid/samples/topology.c',
2955 include_directories : includes,
2956 dependencies : [blkid_dep])
2957 if not is_disabler(exe)
2962 'test_blkid_fuzz_sample',
2963 'libblkid/src/fuzz.c',
2964 include_directories: includes,
2965 dependencies : [blkid_dep],
2966 build_by_default: program_tests)
2967 if not is_disabler(exe)
2971 ############################################################
2976 include_directories : includes,
2977 dependencies : [blkid_dep],
2978 install_dir : sbindir,
2980 if not is_disabler(exe)
2982 manadocs += ['misc-utils/findfs.8.adoc']
2983 bashcompletions += ['findfs']
2989 include_directories : includes,
2990 link_with : [lib_common,
2992 dependencies : [blkid_dep],
2993 install_dir : sbindir,
2995 if not is_disabler(exe)
2997 manadocs += ['misc-utils/wipefs.8.adoc']
2998 bashcompletions += ['wipefs']
3001 opt = not get_option('build-findmnt').disabled()
3005 include_directories : includes,
3006 link_with : [lib_common,
3008 dependencies : [blkid_dep, lib_udev, mount_dep],
3010 build_by_default : opt)
3011 if opt and not is_disabler(exe)
3013 manadocs += ['misc-utils/findmnt.8.adoc']
3014 bashcompletions += ['findmnt']
3020 include_directories : includes,
3021 link_with : [lib_common],
3023 if not is_disabler(exe)
3025 manadocs += ['misc-utils/kill.1.adoc']
3028 opt = not get_option('build-rename').disabled()
3032 include_directories : includes,
3033 install_dir : usrbin_exec_dir,
3035 build_by_default : opt)
3036 if opt and not is_disabler(exe)
3038 manadocs += ['misc-utils/rename.1.adoc']
3039 bashcompletions += ['rename']
3045 include_directories : includes,
3046 link_with : [lib_common],
3047 install_dir : usrbin_exec_dir,
3050 manadocs += ['misc-utils/getopt.1.adoc']
3051 bashcompletions += ['getopt']
3056 include_directories : includes,
3057 link_with : [lib_common,
3059 install_dir : usrbin_exec_dir,
3061 if not is_disabler(exe)
3063 manadocs += ['misc-utils/fincore.1.adoc']
3064 bashcompletions += ['fincore']
3070 include_directories : includes,
3071 link_with : [lib_common],
3072 install_dir : usrbin_exec_dir,
3074 if not is_disabler(exe)
3076 manadocs += ['misc-utils/hardlink.1.adoc']
3077 bashcompletions += ['hardlink']
3080 opt = not get_option('build-pipesz').disabled()
3084 include_directories : includes,
3085 link_with : [lib_common],
3086 install_dir : usrbin_exec_dir,
3088 if opt and not is_disabler(exe)
3090 manadocs += ['misc-utils/pipesz.1.adoc']
3091 bashcompletions += ['pipesz']
3097 include_directories : includes,
3098 c_args : '-DTEST_CAL',
3099 link_with : [lib_common,
3101 dependencies : [curses_libs],
3102 build_by_default: program_tests)
3103 if not is_disabler(exe)
3110 include_directories : includes,
3111 link_with : [lib_common],
3112 install_dir : usrbin_exec_dir,
3114 if not is_disabler(exe)
3116 manadocs += ['misc-utils/fadvise.1.adoc']
3117 bashcompletions += ['fadvise']
3120 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3124 include_directories : includes,
3125 link_with : [lib_common],
3126 install_dir : usrbin_exec_dir,
3128 if not is_disabler(exe)
3130 manadocs += ['misc-utils/waitpid.1.adoc']
3131 bashcompletions += ['waitpid']
3135 syscalls_h = custom_target('syscalls.h',
3136 input : 'tools/all_syscalls',
3137 output : 'syscalls.h',
3138 command : ['tools/all_syscalls', sed.full_path(),
3139 cc.cmd_array(), get_option('c_args')],
3142 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3145 'misc-utils/enosys.c', syscalls_h, errnos_h,
3146 include_directories : includes,
3147 link_with : [lib_common],
3148 install_dir : usrbin_exec_dir,
3150 if not is_disabler(exe)
3152 manadocs += ['misc-utils/enosys.1.adoc']
3153 bashcompletions += ['enosys']
3160 include_directories : includes,
3161 link_with : [lib_common, lib_smartcols],
3162 install_dir : usrbin_exec_dir,
3164 if not is_disabler(exe)
3166 manadocs += ['misc-utils/lsclocks.1.adoc']
3167 bashcompletions += ['lsclocks']
3170 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3174 include_directories : includes,
3175 link_with : [lib_common],
3176 install_dir : usrbin_exec_dir,
3178 if not is_disabler(exe)
3180 manadocs += ['misc-utils/exch.1.adoc']
3181 bashcompletions += ['exch']
3185 ############################################################
3187 opt = not get_option('build-schedutils').disabled()
3190 'schedutils/chrt.c',
3191 include_directories : includes,
3192 link_with : lib_common,
3193 install_dir : usrbin_exec_dir,
3195 build_by_default : opt)
3199 'schedutils/ionice.c',
3200 include_directories : includes,
3201 link_with : lib_common,
3202 install_dir : usrbin_exec_dir,
3204 build_by_default : opt)
3208 'schedutils/taskset.c',
3209 include_directories : includes,
3210 link_with : lib_common,
3211 install_dir : usrbin_exec_dir,
3213 build_by_default : opt)
3217 'schedutils/uclampset.c',
3218 include_directories : includes,
3219 link_with : lib_common,
3220 install_dir : usrbin_exec_dir,
3222 build_by_default : opt)
3224 if opt and not is_disabler(exe)
3225 exes += [exe, exe2, exe3, exe4]
3226 manadocs += ['schedutils/chrt.1.adoc',
3227 'schedutils/ionice.1.adoc',
3228 'schedutils/taskset.1.adoc',
3229 'schedutils/uclampset.1.adoc']
3230 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3233 ############################################################
3235 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3240 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3241 include_directories : dir_include,
3242 link_with : lib_common,
3243 build_by_default: program_tests)
3249 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3250 include_directories : dir_include,
3251 link_with : lib_common,
3252 build_by_default: program_tests)
3258 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3259 include_directories : dir_include,
3260 link_with : lib_common,
3261 build_by_default: program_tests)
3267 c_args : ['-DTEST_PROGRAM_MANGLE'],
3268 include_directories : dir_include,
3269 build_by_default: program_tests)
3275 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3276 include_directories : dir_include,
3277 build_by_default: program_tests)
3283 'lib/color-names.c',
3284 c_args : ['-DTEST_PROGRAM_COLORS'],
3285 include_directories : dir_include,
3286 link_with : [lib_common, lib_tcolors],
3287 build_by_default: program_tests)
3293 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3294 include_directories : dir_include,
3295 build_by_default: program_tests)
3298 if conf.get('HAVE_OPENAT').to_string() == '1' \
3299 and conf.get('HAVE_DIRFD').to_string() == '1'
3303 c_args : ['-DTEST_PROGRAM_PROCFS'],
3304 include_directories : dir_include,
3305 link_with : lib_common,
3306 build_by_default: program_tests)
3313 have_cpu_set_t ? 'lib/cpuset.c' : [],
3314 c_args : ['-DTEST_PROGRAM_PATH'],
3315 include_directories : dir_include,
3316 link_with : lib_common,
3317 build_by_default: program_tests)
3321 if conf.get('HAVE_PTY').to_string() == '1'
3326 c_args : ['-DTEST_PROGRAM_PTY'],
3327 include_directories : dir_include,
3328 link_with : [lib_common],
3329 dependencies : [lib_m,
3332 build_by_default: program_tests)
3340 c_args : ['-DTEST_PROGRAM_CPUSET'],
3341 include_directories : dir_include,
3342 build_by_default: program_tests)
3353 have_cpu_set_t ? 'lib/cpuset.c' : [],
3354 c_args : ['-DTEST_PROGRAM_SYSFS'],
3355 include_directories : dir_include,
3356 build_by_default: program_tests)
3362 c_args : ['-DTEST_PROGRAM_PAGER'],
3363 include_directories : dir_include,
3364 build_by_default: program_tests)
3368 'test_linux_version',
3369 'lib/linux_version.c',
3370 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3371 include_directories : dir_include,
3372 build_by_default: program_tests)
3378 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3379 include_directories : dir_include,
3380 build_by_default: program_tests)
3384 'test_canonicalize',
3385 'lib/canonicalize.c',
3386 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3387 include_directories : dir_include,
3388 build_by_default: program_tests)
3395 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3396 include_directories : dir_include,
3397 build_by_default: program_tests)
3403 c_args : ['-DTEST_PROGRAM'],
3404 include_directories : dir_include,
3405 link_with : lib_common,
3406 build_by_default: program_tests)
3412 c_args : ['-DTEST_PROGRAM'],
3413 include_directories : dir_include,
3414 link_with : [lib_common, logindefs_c],
3415 build_by_default: program_tests)
3419 ############################################################
3423 'libuuid/src/test_uuid.c',
3424 include_directories : [dir_include, dir_libuuid],
3425 link_with : lib_uuid,
3426 dependencies : socket_libs,
3427 build_by_default: program_tests)
3428 if not is_disabler(exe)
3432 ############################################################
3434 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3435 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid]
3436 libfdisk_tests_ldadd_deps = [blkid_dep]
3440 'libfdisk/src/ask.c',
3441 c_args : libfdisk_tests_cflags,
3442 include_directories : lib_fdisk_includes,
3443 link_with : libfdisk_tests_ldadd,
3444 dependencies : libfdisk_tests_ldadd_deps,
3445 build_by_default: program_tests)
3446 if not is_disabler(exe)
3452 'libfdisk/src/gpt.c',
3453 c_args : libfdisk_tests_cflags,
3454 include_directories : lib_fdisk_includes,
3455 link_with : libfdisk_tests_ldadd,
3456 dependencies : libfdisk_tests_ldadd_deps,
3457 build_by_default: program_tests)
3458 if not is_disabler(exe)
3464 'libfdisk/src/utils.c',
3465 c_args : libfdisk_tests_cflags,
3466 include_directories : lib_fdisk_includes,
3467 link_with : libfdisk_tests_ldadd,
3468 dependencies : libfdisk_tests_ldadd_deps,
3469 build_by_default: program_tests)
3470 if not is_disabler(exe)
3475 'test_fdisk_script',
3476 'libfdisk/src/script.c',
3477 c_args : libfdisk_tests_cflags,
3478 include_directories : lib_fdisk_includes,
3479 link_with : libfdisk_tests_ldadd,
3480 dependencies : libfdisk_tests_ldadd_deps,
3481 build_by_default: program_tests)
3482 if not is_disabler(exe)
3487 'test_fdisk_version',
3488 'libfdisk/src/version.c',
3489 c_args : libfdisk_tests_cflags,
3490 include_directories : lib_fdisk_includes,
3491 link_with : libfdisk_tests_ldadd,
3492 dependencies : libfdisk_tests_ldadd_deps,
3493 build_by_default: program_tests)
3494 if not is_disabler(exe)
3500 'libfdisk/src/item.c',
3501 c_args : libfdisk_tests_cflags,
3502 include_directories : lib_fdisk_includes,
3503 link_with : libfdisk_tests_ldadd,
3504 dependencies : libfdisk_tests_ldadd_deps,
3505 build_by_default: program_tests)
3506 if not is_disabler(exe)
3510 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3513 'sample-fdisk-mkpart',
3514 'libfdisk/samples/mkpart.c',
3515 include_directories : lib_fdisk_includes,
3516 link_with : sample_fdisk_ldadd)
3517 if not is_disabler(exe)
3522 'sample-fdisk-mkpart-fullspec',
3523 'libfdisk/samples/mkpart-fullspec.c',
3524 include_directories : lib_fdisk_includes,
3525 link_with : sample_fdisk_ldadd)
3526 if not is_disabler(exe)
3530 ############################################################
3534 'tests/helpers/test_cap.c',
3535 include_directories : includes,
3536 dependencies : [lib_cap_ng],
3537 build_by_default: program_tests)
3538 if not is_disabler(exe)
3544 'tests/helpers/test_mbsencode.c',
3545 include_directories : includes,
3546 link_with : lib_common,
3547 build_by_default: program_tests)
3552 'tests/helpers/test_byteswap.c',
3553 include_directories : includes,
3554 build_by_default: program_tests)
3559 'tests/helpers/test_md5.c',
3561 include_directories : includes,
3562 build_by_default: program_tests)
3567 'tests/helpers/test_sha1.c',
3569 include_directories : includes,
3570 build_by_default: program_tests)
3575 'tests/helpers/test_pathnames.c',
3576 include_directories : includes,
3577 build_by_default: program_tests)
3582 'tests/helpers/test_strerror.c',
3583 include_directories : includes,
3584 build_by_default: program_tests)
3589 'tests/helpers/test_sysinfo.c',
3590 include_directories : includes,
3591 build_by_default: program_tests)
3596 'tests/helpers/test_sigreceive.c',
3597 include_directories : includes,
3598 link_with : lib_common,
3599 build_by_default: program_tests)
3604 'tests/helpers/test_tiocsti.c',
3605 include_directories : includes,
3606 build_by_default: program_tests)
3610 'test_uuid_namespace',
3611 'tests/helpers/test_uuid_namespace.c',
3615 include_directories : includes,
3616 build_by_default: program_tests)
3619 if LINUX and lib_rt.found()
3622 'tests/helpers/test_mkfds.c',
3623 'tests/helpers/test_mkfds.h',
3624 'tests/helpers/test_mkfds_ppoll.c',
3625 include_directories : includes,
3626 dependencies : [lib_rt],
3627 build_by_default: program_tests)
3633 'tests/helpers/test_enosys.c',
3634 include_directories : includes,
3635 build_by_default: program_tests)
3638 ############################################################
3640 if conf.get('HAVE_OPENAT').to_string() == '1'
3642 'sample-scols-tree',
3643 'libsmartcols/samples/tree.c',
3644 include_directories : includes,
3645 link_with : [lib_smartcols, lib_common],
3646 build_by_default: program_tests)
3647 if not is_disabler(exe)
3653 'sample-scols-title',
3654 'libsmartcols/samples/title.c',
3655 include_directories : includes,
3656 link_with : [lib_smartcols, lib_common])
3657 if not is_disabler(exe)
3662 'sample-scols-wrap',
3663 'libsmartcols/samples/wrap.c',
3664 include_directories : includes,
3665 link_with : [lib_smartcols, lib_common])
3666 if not is_disabler(exe)
3671 'sample-scols-continuous',
3672 'libsmartcols/samples/continuous.c',
3673 include_directories : includes,
3674 link_with : [lib_smartcols, lib_common])
3675 if not is_disabler(exe)
3680 'sample-scols-continuous-json',
3681 'libsmartcols/samples/continuous-json.c',
3682 include_directories : includes,
3683 link_with : [lib_smartcols, lib_common])
3684 if not is_disabler(exe)
3689 'sample-scols-maxout',
3690 'libsmartcols/samples/maxout.c',
3691 include_directories : includes,
3692 link_with : [lib_smartcols, lib_common])
3693 if not is_disabler(exe)
3698 'sample-scols-fromfile',
3699 'libsmartcols/samples/fromfile.c',
3700 include_directories : includes,
3701 link_with : [lib_smartcols, lib_common])
3702 if not is_disabler(exe)
3707 'sample-scols-grouping-simple',
3708 'libsmartcols/samples/grouping-simple.c',
3709 include_directories : includes,
3710 link_with : [lib_smartcols, lib_common])
3711 if not is_disabler(exe)
3716 'sample-scols-grouping-overlay',
3717 'libsmartcols/samples/grouping-overlay.c',
3718 include_directories : includes,
3719 link_with : [lib_smartcols, lib_common])
3720 if not is_disabler(exe)
3726 'Documentation/boilerplate.c',
3727 include_directories : includes,
3728 build_by_default: program_tests)
3729 if not is_disabler(exe)
3733 ############################################################
3735 # Let the test runner know whether we're running under asan and export
3736 # some paths. We use a file on disk so that it is possible to run the
3737 # test scripts from commandline without setting any variables.
3738 configure_file(output : 'meson.conf',
3743 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3744 python.full_path())])
3746 run_sh = find_program('tests/run.sh')
3750 '--srcdir=' + meson.current_source_dir(),
3751 '--builddir=' + meson.current_build_dir(),
3757 manadocs += ['lib/terminal-colors.d.5.adoc']
3758 manadocs += ['libblkid/libblkid.3.adoc']
3762 'libuuid/man/uuid.3.adoc',
3763 'libuuid/man/uuid_clear.3.adoc',
3764 'libuuid/man/uuid_compare.3.adoc',
3765 'libuuid/man/uuid_copy.3.adoc',
3766 'libuuid/man/uuid_generate.3.adoc',
3767 'libuuid/man/uuid_is_null.3.adoc',
3768 'libuuid/man/uuid_parse.3.adoc',
3769 'libuuid/man/uuid_time.3.adoc',
3770 'libuuid/man/uuid_unparse.3.adoc']
3772 'uuid_generate_random.3': 'uuid_generate.3',
3773 'uuid_generate_time.3': 'uuid_generate.3',
3774 'uuid_generate_time_safe.3': 'uuid_generate.3',
3778 asciidoctor = find_program('asciidoctor', required : false)
3779 if asciidoctor.found()
3780 foreach adoc : manadocs
3781 name = adoc.split('/')[-1]
3782 page = name.split('.adoc')[0]
3783 section = page.split('.')[-1]
3784 mandirn = join_paths(mandir, 'man' + section)
3789 command : [ asciidoctor,
3791 '-a', 'VERSION=' + meson.project_version(),
3792 '-a', 'release-version=' + meson.project_version(),
3793 '-a', 'ADJTIME_PATH=/etc/adjtime',
3794 '-a', 'package-docdir=' + docdir,
3795 '--base-dir=' + meson.current_source_dir(),
3796 '--destination-dir=' + meson.current_build_dir(),
3797 '--load-path', '@SOURCE_ROOT@/tools',
3798 '--require', 'asciidoctor-includetracker',
3802 depfile : page + '.deps',
3804 install_dir : mandirn)
3807 foreach link_name, target : manlinks
3808 link_section = link_name.split('.')[-1]
3809 target_section = target.split('.')[-1]
3810 meson.add_install_script(meson_make_manpage_stub,
3811 join_paths('man' + target_section, target),
3812 join_paths(mandir, 'man' + link_section, link_name))
3816 if bash_completion.found()
3817 foreach completion : bashcompletions
3819 join_paths('bash-completion', completion),
3820 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3823 foreach link_name, target : bashcompletionslinks
3824 meson.add_install_script(meson_make_symlink,
3826 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))