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']
1906 opt = get_option('build-chcpu').require(have_cpu_set_t).allowed()
1910 include_directories : includes,
1911 link_with : [lib_common],
1912 install_dir : sbindir,
1914 build_by_default : opt)
1915 if opt and not is_disabler(exe)
1917 manadocs += ['sys-utils/chcpu.8.adoc']
1918 bashcompletions += ['chcpu']
1924 include_directories : includes,
1925 link_with : [lib_common,
1928 if not is_disabler(exe)
1930 manadocs += ['sys-utils/wdctl.8.adoc']
1931 bashcompletions += ['wdctl']
1934 opt = not get_option('build-mountpoint').disabled()
1938 include_directories : includes,
1939 dependencies : [mount_dep],
1941 build_by_default : opt)
1942 if opt and not is_disabler(exe)
1944 manadocs += ['sys-utils/mountpoint.1.adoc']
1945 bashcompletions += ['mountpoint']
1948 opt = not get_option('build-fallocate').disabled()
1952 include_directories : includes,
1953 link_with : [lib_common],
1954 install_dir : usrbin_exec_dir,
1956 build_by_default : opt)
1957 if opt and not is_disabler(exe)
1959 manadocs += ['sys-utils/fallocate.1.adoc']
1960 bashcompletions += ['fallocate']
1963 opt = not get_option('build-pivot_root').disabled()
1967 include_directories : includes,
1968 install_dir : sbindir,
1970 build_by_default : opt)
1971 if opt and not is_disabler(exe)
1973 manadocs += ['sys-utils/pivot_root.8.adoc']
1974 bashcompletions += ['pivot_root']
1977 opt = not get_option('build-switch_root').disabled()
1978 if opt and not have_dirfd and not have_ddfd
1979 error('neither dirfd nor ddfd are available')
1983 switch_root_sources,
1984 include_directories : includes,
1985 install_dir : sbindir,
1987 build_by_default : opt)
1988 if opt and not is_disabler(exe)
1990 manadocs += ['sys-utils/switch_root.8.adoc']
1993 opt = not get_option('build-unshare').disabled()
1997 include_directories : includes,
1998 link_with : [lib_common],
1999 dependencies : [mount_dep],
2000 install_dir : usrbin_exec_dir,
2002 build_by_default : opt)
2003 if opt and not is_disabler(exe)
2005 manadocs += ['sys-utils/unshare.1.adoc']
2006 bashcompletions += ['unshare']
2009 opt = opt and 'unshare' in static_programs
2013 include_directories : includes,
2014 link_with : [lib_common],
2015 dependencies : [mount_dep],
2016 install_dir : usrbin_exec_dir,
2018 build_by_default : opt)
2019 if opt and not is_disabler(exe)
2023 opt = not get_option('build-nsenter').disabled()
2027 include_directories : includes,
2028 link_with : [lib_common],
2029 dependencies : [lib_selinux],
2030 install_dir : usrbin_exec_dir,
2032 build_by_default : opt)
2033 if opt and not is_disabler(exe)
2035 manadocs += ['sys-utils/nsenter.1.adoc']
2036 bashcompletions += ['nsenter']
2039 opt = opt and 'nsenter' in static_programs
2043 include_directories : includes,
2044 link_with : [lib_common],
2045 dependencies : [lib_selinux],
2046 install_dir : usrbin_exec_dir,
2048 build_by_default : opt)
2049 if opt and not is_disabler(exe)
2053 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
2057 include_directories : includes,
2058 link_with : [lib_common],
2059 dependencies : [lib_cap_ng],
2060 install_dir : usrbin_exec_dir,
2062 build_by_default : opt)
2063 if opt and not is_disabler(exe)
2065 manadocs += ['sys-utils/setpriv.1.adoc']
2066 bashcompletions += ['setpriv']
2072 include_directories : includes,
2073 link_with : [lib_common],
2074 dependencies : realtime_libs,
2075 install_dir : usrbin_exec_dir,
2078 manadocs += ['sys-utils/flock.1.adoc']
2079 bashcompletions += ['flock']
2081 opt = not get_option('build-lsirq').disabled()
2085 include_directories : includes,
2086 link_with : [lib_common,
2088 install_dir : usrbin_exec_dir,
2090 build_by_default : opt)
2091 if opt and not is_disabler(exe)
2093 manadocs += ['sys-utils/lsirq.1.adoc']
2094 bashcompletions += ['lsirq']
2097 opt = not get_option('build-irqtop').disabled()
2101 include_directories : includes,
2102 dependencies : [realtime_libs, curses_libs],
2103 link_with : [lib_common,
2106 install_dir : usrbin_exec_dir,
2108 build_by_default : opt)
2109 if opt and not is_disabler(exe)
2111 manadocs += ['sys-utils/irqtop.1.adoc']
2112 bashcompletions += ['irqtop']
2115 opt = not get_option('build-ipcs').disabled()
2119 include_directories : includes,
2120 link_with : [lib_common,
2122 install_dir : usrbin_exec_dir,
2124 build_by_default : opt)
2125 if opt and not is_disabler(exe)
2127 manadocs += ['sys-utils/lsipc.1.adoc']
2128 bashcompletions += ['lsipc']
2135 include_directories : includes,
2136 link_with : [lib_common],
2137 dependencies : [lib_m,
2139 install_dir : sbindir,
2141 build_by_default : opt)
2142 if opt and not is_disabler(exe)
2144 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2145 bashcompletions += ['hwclock']
2151 include_directories : includes,
2152 install_dir : sbindir,
2155 manadocs += ['disk-utils/mkfs.8.adoc']
2156 bashcompletions += ['mkfs']
2158 opt = not get_option('build-bfs').disabled()
2162 include_directories : includes,
2163 link_with : [lib_common],
2164 install_dir : sbindir,
2166 build_by_default : opt)
2167 if opt and not is_disabler(exe)
2169 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2170 bashcompletions += ['mkfs.bfs']
2176 include_directories : includes,
2177 link_with : [lib_common],
2178 install_dir : usrbin_exec_dir,
2181 manadocs += ['disk-utils/isosize.8.adoc']
2182 bashcompletions += ['isosize']
2187 include_directories : includes,
2188 link_with : [lib_common,
2190 dependencies: [blkid_dep, lib_selinux],
2191 install_dir : sbindir,
2193 if not is_disabler(exe)
2195 manadocs += ['disk-utils/mkswap.8.adoc']
2196 bashcompletions += ['mkswap']
2202 include_directories : includes,
2203 link_with : [lib_common,
2205 dependencies : [blkid_dep],
2206 install_dir : sbindir,
2208 if not is_disabler(exe)
2210 manadocs += ['disk-utils/swaplabel.8.adoc']
2211 bashcompletions += ['swaplabel']
2214 opt = not get_option('build-fsck').disabled()
2218 include_directories : includes,
2219 link_with : [lib_common],
2220 dependencies : [blkid_dep, mount_dep, realtime_libs],
2221 install_dir : sbindir,
2223 build_by_default : opt)
2224 if opt and not is_disabler(exe)
2226 manadocs += ['disk-utils/fsck.8.adoc']
2227 bashcompletions += ['fsck']
2230 opt = not get_option('build-minix').disabled()
2234 include_directories : includes,
2235 link_with : [lib_common],
2236 install_dir : sbindir,
2238 build_by_default : opt)
2242 include_directories : includes,
2243 c_args : '-DTEST_SCRIPT',
2244 link_with : [lib_common],
2245 build_by_default : opt and program_tests)
2249 include_directories : includes,
2250 link_with : [lib_common],
2251 install_dir : sbindir,
2253 build_by_default : opt)
2254 if opt and not is_disabler(exe)
2255 exes += [exe, exe2, exe3]
2256 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2257 bashcompletions += ['mkfs.minix', 'fsck.minix']
2260 opt = not get_option('build-cramfs').disabled()
2263 mkfs_cramfs_sources,
2264 include_directories : includes,
2265 link_with : [lib_common],
2266 dependencies : [lib_z],
2267 install_dir : sbindir,
2269 build_by_default : opt)
2272 fsck_cramfs_sources,
2273 include_directories : includes,
2274 link_with : [lib_common],
2275 dependencies : [lib_z],
2276 install_dir : sbindir,
2278 build_by_default : opt)
2279 if not is_disabler(exe)
2281 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2282 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2285 opt = not get_option('build-raw').disabled()
2287 cc.has_header('linux/raw.h', required: opt)
2292 include_directories : includes,
2293 install_dir : sbindir,
2295 build_by_default : opt)
2296 if opt and not is_disabler(exe)
2298 manadocs += ['disk-utils/raw.8.adoc']
2299 bashcompletions += ['raw']
2302 opt = not get_option('build-fdformat').disabled()
2306 include_directories : includes,
2307 link_with : [lib_common],
2308 install_dir : usrsbin_exec_dir,
2310 build_by_default : opt)
2311 if opt and not is_disabler(exe)
2313 manadocs += ['disk-utils/fdformat.8.adoc']
2314 bashcompletions += ['fdformat']
2320 include_directories : includes,
2321 link_with : [lib_common],
2322 install_dir : sbindir,
2324 manadocs += ['disk-utils/blockdev.8.adoc']
2325 bashcompletions += ['blockdev']
2327 opt = not get_option('build-fdisks').disabled()
2328 if opt and not have_dirfd and not have_ddfd
2329 error('neither dirfd nor ddfd are available')
2334 include_directories : includes,
2335 link_with : [lib_common,
2339 dependencies : [lib_readline],
2340 install_dir : sbindir,
2342 build_by_default : opt)
2343 if opt and not is_disabler(exe)
2345 bashcompletions += ['fdisk']
2348 opt2 = opt and 'fdisk' in static_programs
2352 link_args : ['--static'],
2353 include_directories : includes,
2354 link_with : [lib_common,
2357 lib_smartcols.get_static_lib()],
2358 dependencies : [lib_readline_static],
2359 install_dir : sbindir,
2361 build_by_default : opt2)
2362 if opt2 and not is_disabler(exe)
2369 include_directories : includes,
2370 link_with : [lib_common,
2374 dependencies : [lib_readline],
2375 install_dir : sbindir,
2377 build_by_default : opt)
2378 if opt and not is_disabler(exe)
2380 bashcompletions += ['sfdisk']
2383 opt2 = opt and 'sfdisk' in static_programs
2387 include_directories : includes,
2388 link_with : [lib_common,
2391 lib_smartcols.get_static_lib()],
2392 dependencies : [lib_readline_static],
2393 install_dir : sbindir,
2395 build_by_default : opt2)
2396 if opt2 and not is_disabler(exe)
2403 include_directories : includes,
2404 link_with : [lib_common,
2408 dependencies : [curses_libs, mount_dep],
2409 install_dir : sbindir,
2411 build_by_default : opt)
2412 if opt and not is_disabler(exe)
2414 manadocs += ['disk-utils/fdisk.8.adoc',
2415 'disk-utils/sfdisk.8.adoc',
2416 'disk-utils/cfdisk.8.adoc']
2417 bashcompletions += ['cfdisk']
2420 opt = not get_option('build-partx').disabled()
2424 include_directories : includes,
2425 link_with : [lib_common],
2426 install_dir : usrsbin_exec_dir,
2428 build_by_default : opt)
2432 include_directories : includes,
2433 link_with : [lib_common],
2434 install_dir : usrsbin_exec_dir,
2436 build_by_default : opt)
2440 include_directories : includes,
2441 link_with : [lib_common],
2442 install_dir : usrsbin_exec_dir,
2444 build_by_default : opt)
2448 include_directories : includes,
2449 link_with : [lib_common,
2451 dependencies : [blkid_dep],
2452 install_dir : usrsbin_exec_dir,
2454 build_by_default : opt)
2456 exes += [exe, exe2, exe3, exe4]
2457 manadocs += ['disk-utils/addpart.8.adoc',
2458 'disk-utils/delpart.8.adoc',
2459 'disk-utils/resizepart.8.adoc',
2460 'disk-utils/partx.8.adoc']
2461 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2463 opt = opt and 'partx' in static_programs
2467 include_directories : includes,
2468 link_args : ['--static'],
2469 link_with : [lib_common],
2470 install_dir : usrsbin_exec_dir,
2472 build_by_default : opt)
2476 include_directories : includes,
2477 link_args : ['--static'],
2478 link_with : [lib_common],
2479 install_dir : usrsbin_exec_dir,
2481 build_by_default : opt)
2483 'resizepart.static',
2485 include_directories : includes,
2486 link_args : ['--static'],
2487 link_with : [lib_common],
2488 install_dir : usrsbin_exec_dir,
2490 build_by_default : opt)
2494 include_directories : includes,
2495 link_args : ['--static'],
2496 link_with : [lib_common,
2497 lib_smartcols.get_static_lib()],
2498 dependencies : [blkid_static_dep],
2499 install_dir : usrsbin_exec_dir,
2501 build_by_default : opt)
2504 exes += [exe, exe2, exe3, exe4]
2507 ############################################################
2512 include_directories : includes,
2513 link_with : [lib_common],
2514 dependencies : [lib_util,
2518 install_dir : usrbin_exec_dir,
2521 manadocs += ['term-utils/script.1.adoc']
2522 bashcompletions += ['script']
2527 include_directories : includes,
2528 c_args : '-DTEST_SCRIPT',
2529 link_with : [lib_common],
2530 dependencies : [lib_util,
2534 build_by_default : program_tests)
2540 include_directories : includes,
2541 link_with : [lib_common],
2542 dependencies : [lib_util,
2545 install_dir : usrbin_exec_dir,
2548 manadocs += ['term-utils/scriptlive.1.adoc']
2549 bashcompletions += ['scriptlive']
2553 scriptreplay_sources,
2554 include_directories : includes,
2555 link_with : [lib_common],
2556 dependencies : [math_libs],
2557 install_dir : usrbin_exec_dir,
2560 manadocs += ['term-utils/scriptreplay.1.adoc']
2561 bashcompletions += ['scriptreplay']
2563 opt = not get_option('build-agetty').disabled()
2567 include_directories : includes,
2568 link_with : [lib_common, logindefs_c],
2569 dependencies : [BSD ? lib_util : [], lib_systemd],
2570 install_dir : sbindir,
2572 build_by_default : opt)
2575 manadocs += ['term-utils/agetty.8.adoc']
2578 opt = not get_option('build-setterm').disabled()
2582 include_directories : includes,
2583 link_with : [lib_common],
2584 dependencies : [curses_libs],
2585 install_dir : usrbin_exec_dir,
2587 build_by_default : opt)
2590 manadocs += ['term-utils/setterm.1.adoc']
2591 bashcompletions += ['setterm']
2594 opt = not get_option('build-mesg').disabled()
2598 include_directories : includes,
2599 link_with : [lib_common],
2600 install_dir : usrbin_exec_dir,
2602 build_by_default : opt)
2605 manadocs += ['term-utils/mesg.1.adoc']
2606 bashcompletions += ['mesg']
2609 opt = not get_option('build-wall').disabled()
2613 include_directories : includes,
2614 link_with : [lib_common],
2615 dependencies : [lib_systemd],
2616 install_dir : usrbin_exec_dir,
2617 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2619 build_by_default : opt)
2622 manadocs += ['term-utils/wall.1.adoc']
2623 bashcompletions += ['wall']
2626 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2627 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2629 opt = not get_option('build-write').disabled()
2633 include_directories : includes,
2634 link_with : [lib_common],
2635 dependencies : [lib_systemd],
2636 install_dir : usrbin_exec_dir,
2637 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2639 build_by_default : opt)
2642 manadocs += ['term-utils/write.1.adoc']
2643 bashcompletions += ['write']
2646 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2647 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2649 opt = not get_option('build-login').disabled()
2653 include_directories : includes,
2654 link_with : [lib_common, logindefs_c],
2655 dependencies : [lib_pam,
2659 build_by_default : opt)
2660 if not is_disabler(exe)
2662 manadocs += ['login-utils/login.1.adoc']
2665 opt = not get_option('build-sulogin').disabled()
2669 include_directories : includes,
2670 link_with : [lib_common],
2671 dependencies : [lib_crypt,
2673 install_dir : sbindir,
2675 build_by_default : opt)
2676 if not is_disabler(exe)
2678 manadocs += ['login-utils/sulogin.8.adoc']
2684 include_directories : includes,
2685 link_with : [lib_common,
2687 dependencies : [curses_libs],
2688 install_dir : usrbin_exec_dir,
2691 manadocs += ['misc-utils/cal.1.adoc']
2692 bashcompletions += ['cal']
2694 opt = not get_option('build-logger').disabled()
2698 include_directories : includes,
2699 link_with : [lib_common],
2700 dependencies : [lib_systemd],
2701 install_dir : usrbin_exec_dir,
2703 build_by_default : opt)
2704 if opt and not is_disabler(exe)
2706 manadocs += ['misc-utils/logger.1.adoc']
2707 bashcompletions += ['logger']
2713 include_directories : includes,
2714 c_args : '-DTEST_LOGGER',
2715 link_with : [lib_common],
2716 dependencies : [lib_systemd],
2717 build_by_default: program_tests)
2718 if not is_disabler(exe)
2725 include_directories : includes,
2726 install_dir : usrbin_exec_dir,
2729 manadocs += ['misc-utils/look.1.adoc']
2730 bashcompletions += ['look']
2735 include_directories : includes,
2736 link_with : [lib_common],
2737 install_dir : usrbin_exec_dir,
2740 manadocs += ['misc-utils/mcookie.1.adoc']
2741 bashcompletions += ['mcookie']
2743 if build_liblastlog2
2747 include_directories : includes,
2748 link_with : [lib_common, lib_lastlog2],
2749 install_dir : usrbin_exec_dir,
2752 manadocs += ['misc-utils/lastlog2.8.adoc']
2753 bashcompletions += ['lastlog2']
2754 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2755 'liblastlog2/man/ll2_write_entry.3.adoc',
2756 'liblastlog2/man/ll2_read_entry.3.adoc',
2757 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2758 'liblastlog2/man/ll2_read_all.3.adoc',
2759 'liblastlog2/man/ll2_remove_entry.3.adoc',
2760 'liblastlog2/man/ll2_rename_user.3.adoc',
2761 'liblastlog2/man/ll2_update_login_time.3.adoc'
2768 include_directories : includes,
2769 dependencies : [lib_selinux],
2770 install_dir : usrbin_exec_dir,
2773 manadocs += ['misc-utils/namei.1.adoc']
2774 bashcompletions += ['namei']
2779 include_directories : includes,
2780 link_with : [lib_common],
2781 install_dir : usrbin_exec_dir,
2784 manadocs += ['misc-utils/whereis.1.adoc']
2785 bashcompletions += ['whereis']
2787 opt = not get_option('build-lslocks').disabled()
2791 include_directories : includes,
2792 link_with : [lib_common,
2794 dependencies : [mount_dep],
2795 install_dir : usrbin_exec_dir,
2797 build_by_default : opt)
2798 if opt and not is_disabler(exe)
2800 manadocs += ['misc-utils/lslocks.8.adoc']
2801 bashcompletions += ['lslocks']
2804 opt = not get_option('build-lsblk').disabled()
2808 include_directories : includes,
2809 link_with : [lib_common,
2812 dependencies : [blkid_dep, lib_udev, mount_dep],
2814 build_by_default : opt)
2815 if opt and not is_disabler(exe)
2817 manadocs += ['misc-utils/lsblk.8.adoc']
2818 bashcompletions += ['lsblk']
2821 errnos_h = custom_target('errnos.h',
2822 input : 'tools/all_errnos',
2823 output : 'errnos.h',
2824 command : ['tools/all_errnos', sed.full_path(),
2825 cc.cmd_array(), get_option('c_args')],
2828 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2831 lsfd_sources, errnos_h,
2832 include_directories : includes,
2833 link_with : [lib_common,
2835 dependencies : [lib_rt],
2836 install_dir : usrbin_exec_dir,
2838 build_by_default : opt)
2839 if opt and not is_disabler(exe)
2841 manadocs += ['lsfd-cmd/lsfd.1.adoc']
2847 include_directories : includes,
2848 link_with : [lib_common,
2850 install_dir : usrbin_exec_dir,
2852 if not is_disabler(exe)
2854 manadocs += ['misc-utils/uuidgen.1.adoc']
2855 bashcompletions += ['uuidgen']
2861 include_directories : includes,
2862 link_with : [lib_common,
2865 install_dir : usrbin_exec_dir,
2867 if not is_disabler(exe)
2869 manadocs += ['misc-utils/uuidparse.1.adoc']
2870 bashcompletions += ['uuidparse']
2877 include_directories : includes,
2878 link_with : [lib_common,
2880 dependencies : [realtime_libs,
2882 install_dir : usrsbin_exec_dir,
2884 build_by_default : opt)
2888 include_directories : includes,
2889 link_with : [lib_common,
2891 dependencies : thread_libs,
2892 build_by_default : opt and program_tests)
2893 if not is_disabler(exe)
2895 manadocs += ['misc-utils/uuidd.8.adoc']
2896 bashcompletions += ['uuidd']
2899 opt = build_libblkid
2903 include_directories : includes,
2904 link_with : [lib_common],
2905 dependencies : [blkid_dep],
2906 install_dir : sbindir,
2908 build_by_default : opt)
2909 if opt and not is_disabler(exe)
2911 manadocs += ['misc-utils/blkid.8.adoc']
2912 bashcompletions += ['blkid']
2915 opt = opt and 'blkid' in static_programs
2919 include_directories : includes,
2920 link_with : [lib_common],
2921 dependencies : [blkid_static_dep],
2922 install_dir : sbindir,
2924 build_by_default : opt)
2925 if opt and not is_disabler(exe)
2931 'libblkid/samples/mkfs.c',
2932 include_directories : includes,
2933 dependencies : [blkid_dep])
2934 if not is_disabler(exe)
2939 'sample-partitions',
2940 'libblkid/samples/partitions.c',
2941 include_directories : includes,
2942 dependencies : [blkid_dep])
2943 if not is_disabler(exe)
2948 'sample-superblocks',
2949 'libblkid/samples/superblocks.c',
2950 include_directories : includes,
2951 dependencies : [blkid_dep])
2952 if not is_disabler(exe)
2958 'libblkid/samples/topology.c',
2959 include_directories : includes,
2960 dependencies : [blkid_dep])
2961 if not is_disabler(exe)
2966 'test_blkid_fuzz_sample',
2967 'libblkid/src/fuzz.c',
2968 include_directories: includes,
2969 dependencies : [blkid_dep],
2970 build_by_default: program_tests)
2971 if not is_disabler(exe)
2975 ############################################################
2980 include_directories : includes,
2981 dependencies : [blkid_dep],
2982 install_dir : sbindir,
2984 if not is_disabler(exe)
2986 manadocs += ['misc-utils/findfs.8.adoc']
2987 bashcompletions += ['findfs']
2993 include_directories : includes,
2994 link_with : [lib_common,
2996 dependencies : [blkid_dep],
2997 install_dir : sbindir,
2999 if not is_disabler(exe)
3001 manadocs += ['misc-utils/wipefs.8.adoc']
3002 bashcompletions += ['wipefs']
3005 opt = not get_option('build-findmnt').disabled()
3009 include_directories : includes,
3010 link_with : [lib_common,
3012 dependencies : [blkid_dep, lib_udev, mount_dep],
3014 build_by_default : opt)
3015 if opt and not is_disabler(exe)
3017 manadocs += ['misc-utils/findmnt.8.adoc']
3018 bashcompletions += ['findmnt']
3024 include_directories : includes,
3025 link_with : [lib_common],
3027 if not is_disabler(exe)
3029 manadocs += ['misc-utils/kill.1.adoc']
3032 opt = not get_option('build-rename').disabled()
3036 include_directories : includes,
3037 install_dir : usrbin_exec_dir,
3039 build_by_default : opt)
3040 if opt and not is_disabler(exe)
3042 manadocs += ['misc-utils/rename.1.adoc']
3043 bashcompletions += ['rename']
3049 include_directories : includes,
3050 link_with : [lib_common],
3051 install_dir : usrbin_exec_dir,
3054 manadocs += ['misc-utils/getopt.1.adoc']
3055 bashcompletions += ['getopt']
3060 include_directories : includes,
3061 link_with : [lib_common,
3063 install_dir : usrbin_exec_dir,
3065 if not is_disabler(exe)
3067 manadocs += ['misc-utils/fincore.1.adoc']
3068 bashcompletions += ['fincore']
3074 include_directories : includes,
3075 link_with : [lib_common],
3076 install_dir : usrbin_exec_dir,
3078 if not is_disabler(exe)
3080 manadocs += ['misc-utils/hardlink.1.adoc']
3081 bashcompletions += ['hardlink']
3084 opt = not get_option('build-pipesz').disabled()
3088 include_directories : includes,
3089 link_with : [lib_common],
3090 install_dir : usrbin_exec_dir,
3092 if opt and not is_disabler(exe)
3094 manadocs += ['misc-utils/pipesz.1.adoc']
3095 bashcompletions += ['pipesz']
3101 include_directories : includes,
3102 c_args : '-DTEST_CAL',
3103 link_with : [lib_common,
3105 dependencies : [curses_libs],
3106 build_by_default: program_tests)
3107 if not is_disabler(exe)
3114 include_directories : includes,
3115 link_with : [lib_common],
3116 install_dir : usrbin_exec_dir,
3118 if not is_disabler(exe)
3120 manadocs += ['misc-utils/fadvise.1.adoc']
3121 bashcompletions += ['fadvise']
3124 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3128 include_directories : includes,
3129 link_with : [lib_common],
3130 install_dir : usrbin_exec_dir,
3132 if not is_disabler(exe)
3134 manadocs += ['misc-utils/waitpid.1.adoc']
3135 bashcompletions += ['waitpid']
3139 syscalls_h = custom_target('syscalls.h',
3140 input : 'tools/all_syscalls',
3141 output : 'syscalls.h',
3142 command : ['tools/all_syscalls', sed.full_path(),
3143 cc.cmd_array(), get_option('c_args')],
3146 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3149 'misc-utils/enosys.c', syscalls_h, errnos_h,
3150 include_directories : includes,
3151 link_with : [lib_common],
3152 install_dir : usrbin_exec_dir,
3154 if not is_disabler(exe)
3156 manadocs += ['misc-utils/enosys.1.adoc']
3157 bashcompletions += ['enosys']
3164 include_directories : includes,
3165 link_with : [lib_common, lib_smartcols],
3166 install_dir : usrbin_exec_dir,
3168 if not is_disabler(exe)
3170 manadocs += ['misc-utils/lsclocks.1.adoc']
3171 bashcompletions += ['lsclocks']
3174 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3178 include_directories : includes,
3179 link_with : [lib_common],
3180 install_dir : usrbin_exec_dir,
3182 if not is_disabler(exe)
3184 manadocs += ['misc-utils/exch.1.adoc']
3185 bashcompletions += ['exch']
3189 ############################################################
3191 opt = not get_option('build-schedutils').disabled()
3194 'schedutils/chrt.c',
3195 include_directories : includes,
3196 link_with : lib_common,
3197 install_dir : usrbin_exec_dir,
3199 build_by_default : opt)
3203 'schedutils/ionice.c',
3204 include_directories : includes,
3205 link_with : lib_common,
3206 install_dir : usrbin_exec_dir,
3208 build_by_default : opt)
3212 'schedutils/taskset.c',
3213 include_directories : includes,
3214 link_with : lib_common,
3215 install_dir : usrbin_exec_dir,
3217 build_by_default : opt)
3221 'schedutils/uclampset.c',
3222 include_directories : includes,
3223 link_with : lib_common,
3224 install_dir : usrbin_exec_dir,
3226 build_by_default : opt)
3228 if opt and not is_disabler(exe)
3229 exes += [exe, exe2, exe3, exe4]
3230 manadocs += ['schedutils/chrt.1.adoc',
3231 'schedutils/ionice.1.adoc',
3232 'schedutils/taskset.1.adoc',
3233 'schedutils/uclampset.1.adoc']
3234 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3237 ############################################################
3239 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3244 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3245 include_directories : dir_include,
3246 link_with : lib_common,
3247 build_by_default: program_tests)
3253 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3254 include_directories : dir_include,
3255 link_with : lib_common,
3256 build_by_default: program_tests)
3262 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3263 include_directories : dir_include,
3264 link_with : lib_common,
3265 build_by_default: program_tests)
3271 c_args : ['-DTEST_PROGRAM_MANGLE'],
3272 include_directories : dir_include,
3273 build_by_default: program_tests)
3279 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3280 include_directories : dir_include,
3281 build_by_default: program_tests)
3287 'lib/color-names.c',
3288 c_args : ['-DTEST_PROGRAM_COLORS'],
3289 include_directories : dir_include,
3290 link_with : [lib_common, lib_tcolors],
3291 build_by_default: program_tests)
3297 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3298 include_directories : dir_include,
3299 build_by_default: program_tests)
3302 if conf.get('HAVE_OPENAT').to_string() == '1' \
3303 and conf.get('HAVE_DIRFD').to_string() == '1'
3307 c_args : ['-DTEST_PROGRAM_PROCFS'],
3308 include_directories : dir_include,
3309 link_with : lib_common,
3310 build_by_default: program_tests)
3317 have_cpu_set_t ? 'lib/cpuset.c' : [],
3318 c_args : ['-DTEST_PROGRAM_PATH'],
3319 include_directories : dir_include,
3320 link_with : lib_common,
3321 build_by_default: program_tests)
3325 if conf.get('HAVE_PTY').to_string() == '1'
3330 c_args : ['-DTEST_PROGRAM_PTY'],
3331 include_directories : dir_include,
3332 link_with : [lib_common],
3333 dependencies : [lib_m,
3336 build_by_default: program_tests)
3344 c_args : ['-DTEST_PROGRAM_CPUSET'],
3345 include_directories : dir_include,
3346 build_by_default: program_tests)
3357 have_cpu_set_t ? 'lib/cpuset.c' : [],
3358 c_args : ['-DTEST_PROGRAM_SYSFS'],
3359 include_directories : dir_include,
3360 build_by_default: program_tests)
3366 c_args : ['-DTEST_PROGRAM_PAGER'],
3367 include_directories : dir_include,
3368 build_by_default: program_tests)
3372 'test_linux_version',
3373 'lib/linux_version.c',
3374 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3375 include_directories : dir_include,
3376 build_by_default: program_tests)
3382 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3383 include_directories : dir_include,
3384 build_by_default: program_tests)
3388 'test_canonicalize',
3389 'lib/canonicalize.c',
3390 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3391 include_directories : dir_include,
3392 build_by_default: program_tests)
3399 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3400 include_directories : dir_include,
3401 build_by_default: program_tests)
3407 c_args : ['-DTEST_PROGRAM'],
3408 include_directories : dir_include,
3409 link_with : lib_common,
3410 build_by_default: program_tests)
3416 c_args : ['-DTEST_PROGRAM'],
3417 include_directories : dir_include,
3418 link_with : [lib_common, logindefs_c],
3419 build_by_default: program_tests)
3423 ############################################################
3427 'libuuid/src/test_uuid.c',
3428 include_directories : [dir_include, dir_libuuid],
3429 link_with : lib_uuid,
3430 dependencies : socket_libs,
3431 build_by_default: program_tests)
3432 if not is_disabler(exe)
3436 ############################################################
3438 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3439 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid]
3440 libfdisk_tests_ldadd_deps = [blkid_dep]
3444 'libfdisk/src/ask.c',
3445 c_args : libfdisk_tests_cflags,
3446 include_directories : lib_fdisk_includes,
3447 link_with : libfdisk_tests_ldadd,
3448 dependencies : libfdisk_tests_ldadd_deps,
3449 build_by_default: program_tests)
3450 if not is_disabler(exe)
3456 'libfdisk/src/gpt.c',
3457 c_args : libfdisk_tests_cflags,
3458 include_directories : lib_fdisk_includes,
3459 link_with : libfdisk_tests_ldadd,
3460 dependencies : libfdisk_tests_ldadd_deps,
3461 build_by_default: program_tests)
3462 if not is_disabler(exe)
3468 'libfdisk/src/utils.c',
3469 c_args : libfdisk_tests_cflags,
3470 include_directories : lib_fdisk_includes,
3471 link_with : libfdisk_tests_ldadd,
3472 dependencies : libfdisk_tests_ldadd_deps,
3473 build_by_default: program_tests)
3474 if not is_disabler(exe)
3479 'test_fdisk_script',
3480 'libfdisk/src/script.c',
3481 c_args : libfdisk_tests_cflags,
3482 include_directories : lib_fdisk_includes,
3483 link_with : libfdisk_tests_ldadd,
3484 dependencies : libfdisk_tests_ldadd_deps,
3485 build_by_default: program_tests)
3486 if not is_disabler(exe)
3491 'test_fdisk_version',
3492 'libfdisk/src/version.c',
3493 c_args : libfdisk_tests_cflags,
3494 include_directories : lib_fdisk_includes,
3495 link_with : libfdisk_tests_ldadd,
3496 dependencies : libfdisk_tests_ldadd_deps,
3497 build_by_default: program_tests)
3498 if not is_disabler(exe)
3504 'libfdisk/src/item.c',
3505 c_args : libfdisk_tests_cflags,
3506 include_directories : lib_fdisk_includes,
3507 link_with : libfdisk_tests_ldadd,
3508 dependencies : libfdisk_tests_ldadd_deps,
3509 build_by_default: program_tests)
3510 if not is_disabler(exe)
3514 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3517 'sample-fdisk-mkpart',
3518 'libfdisk/samples/mkpart.c',
3519 include_directories : lib_fdisk_includes,
3520 link_with : sample_fdisk_ldadd)
3521 if not is_disabler(exe)
3526 'sample-fdisk-mkpart-fullspec',
3527 'libfdisk/samples/mkpart-fullspec.c',
3528 include_directories : lib_fdisk_includes,
3529 link_with : sample_fdisk_ldadd)
3530 if not is_disabler(exe)
3534 ############################################################
3538 'tests/helpers/test_cap.c',
3539 include_directories : includes,
3540 dependencies : [lib_cap_ng],
3541 build_by_default: program_tests)
3542 if not is_disabler(exe)
3548 'tests/helpers/test_mbsencode.c',
3549 include_directories : includes,
3550 link_with : lib_common,
3551 build_by_default: program_tests)
3556 'tests/helpers/test_byteswap.c',
3557 include_directories : includes,
3558 build_by_default: program_tests)
3563 'tests/helpers/test_md5.c',
3565 include_directories : includes,
3566 build_by_default: program_tests)
3571 'tests/helpers/test_sha1.c',
3573 include_directories : includes,
3574 build_by_default: program_tests)
3579 'tests/helpers/test_pathnames.c',
3580 include_directories : includes,
3581 build_by_default: program_tests)
3586 'tests/helpers/test_strerror.c',
3587 include_directories : includes,
3588 build_by_default: program_tests)
3593 'tests/helpers/test_sysinfo.c',
3594 include_directories : includes,
3595 build_by_default: program_tests)
3600 'tests/helpers/test_sigreceive.c',
3601 include_directories : includes,
3602 link_with : lib_common,
3603 build_by_default: program_tests)
3608 'tests/helpers/test_tiocsti.c',
3609 include_directories : includes,
3610 build_by_default: program_tests)
3614 'test_uuid_namespace',
3615 'tests/helpers/test_uuid_namespace.c',
3619 include_directories : includes,
3620 build_by_default: program_tests)
3623 if LINUX and lib_rt.found()
3626 'tests/helpers/test_mkfds.c',
3627 'tests/helpers/test_mkfds.h',
3628 'tests/helpers/test_mkfds_ppoll.c',
3629 include_directories : includes,
3630 dependencies : [lib_rt],
3631 build_by_default: program_tests)
3637 'tests/helpers/test_enosys.c',
3638 include_directories : includes,
3639 build_by_default: program_tests)
3642 ############################################################
3644 if conf.get('HAVE_OPENAT').to_string() == '1'
3646 'sample-scols-tree',
3647 'libsmartcols/samples/tree.c',
3648 include_directories : includes,
3649 link_with : [lib_smartcols, lib_common],
3650 build_by_default: program_tests)
3651 if not is_disabler(exe)
3657 'sample-scols-title',
3658 'libsmartcols/samples/title.c',
3659 include_directories : includes,
3660 link_with : [lib_smartcols, lib_common])
3661 if not is_disabler(exe)
3666 'sample-scols-wrap',
3667 'libsmartcols/samples/wrap.c',
3668 include_directories : includes,
3669 link_with : [lib_smartcols, lib_common])
3670 if not is_disabler(exe)
3675 'sample-scols-continuous',
3676 'libsmartcols/samples/continuous.c',
3677 include_directories : includes,
3678 link_with : [lib_smartcols, lib_common])
3679 if not is_disabler(exe)
3684 'sample-scols-continuous-json',
3685 'libsmartcols/samples/continuous-json.c',
3686 include_directories : includes,
3687 link_with : [lib_smartcols, lib_common])
3688 if not is_disabler(exe)
3693 'sample-scols-maxout',
3694 'libsmartcols/samples/maxout.c',
3695 include_directories : includes,
3696 link_with : [lib_smartcols, lib_common])
3697 if not is_disabler(exe)
3702 'sample-scols-fromfile',
3703 'libsmartcols/samples/fromfile.c',
3704 include_directories : includes,
3705 link_with : [lib_smartcols, lib_common])
3706 if not is_disabler(exe)
3711 'sample-scols-grouping-simple',
3712 'libsmartcols/samples/grouping-simple.c',
3713 include_directories : includes,
3714 link_with : [lib_smartcols, lib_common])
3715 if not is_disabler(exe)
3720 'sample-scols-grouping-overlay',
3721 'libsmartcols/samples/grouping-overlay.c',
3722 include_directories : includes,
3723 link_with : [lib_smartcols, lib_common])
3724 if not is_disabler(exe)
3730 'Documentation/boilerplate.c',
3731 include_directories : includes,
3732 build_by_default: program_tests)
3733 if not is_disabler(exe)
3737 ############################################################
3739 # Let the test runner know whether we're running under asan and export
3740 # some paths. We use a file on disk so that it is possible to run the
3741 # test scripts from commandline without setting any variables.
3742 configure_file(output : 'meson.conf',
3747 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3748 python.full_path())])
3750 run_sh = find_program('tests/run.sh')
3754 '--srcdir=' + meson.current_source_dir(),
3755 '--builddir=' + meson.current_build_dir(),
3761 manadocs += ['lib/terminal-colors.d.5.adoc']
3762 manadocs += ['libblkid/libblkid.3.adoc']
3766 'libuuid/man/uuid.3.adoc',
3767 'libuuid/man/uuid_clear.3.adoc',
3768 'libuuid/man/uuid_compare.3.adoc',
3769 'libuuid/man/uuid_copy.3.adoc',
3770 'libuuid/man/uuid_generate.3.adoc',
3771 'libuuid/man/uuid_is_null.3.adoc',
3772 'libuuid/man/uuid_parse.3.adoc',
3773 'libuuid/man/uuid_time.3.adoc',
3774 'libuuid/man/uuid_unparse.3.adoc']
3776 'uuid_generate_random.3': 'uuid_generate.3',
3777 'uuid_generate_time.3': 'uuid_generate.3',
3778 'uuid_generate_time_safe.3': 'uuid_generate.3',
3782 asciidoctor = find_program('asciidoctor', required : false)
3783 if asciidoctor.found()
3784 foreach adoc : manadocs
3785 name = adoc.split('/')[-1]
3786 page = name.split('.adoc')[0]
3787 section = page.split('.')[-1]
3788 mandirn = join_paths(mandir, 'man' + section)
3793 command : [ asciidoctor,
3795 '-a', 'VERSION=' + meson.project_version(),
3796 '-a', 'release-version=' + meson.project_version(),
3797 '-a', 'ADJTIME_PATH=/etc/adjtime',
3798 '-a', 'package-docdir=' + docdir,
3799 '--base-dir=' + meson.current_source_dir(),
3800 '--destination-dir=' + meson.current_build_dir(),
3801 '--load-path', '@SOURCE_ROOT@/tools',
3802 '--require', 'asciidoctor-includetracker',
3806 depfile : page + '.deps',
3808 install_dir : mandirn)
3811 foreach link_name, target : manlinks
3812 link_section = link_name.split('.')[-1]
3813 target_section = target.split('.')[-1]
3814 meson.add_install_script(meson_make_manpage_stub,
3815 join_paths('man' + target_section, target),
3816 join_paths(mandir, 'man' + link_section, link_name))
3820 if bash_completion.found()
3821 foreach completion : bashcompletions
3823 join_paths('bash-completion', completion),
3824 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3827 foreach link_name, target : bashcompletionslinks
3828 meson.add_install_script(meson_make_symlink,
3830 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))