1 project('util-linux', 'c',
2 version : run_command('tools/git-version-gen', check: true).stdout(),
3 meson_version: '>=0.60.0',
11 pkgconfig = import('pkgconfig')
13 # soname versions; This never change because we use symbols versioing. There is also
14 # API version (LIB*_VERSION macros) and it follow package version.
15 libblkid_version = '1.1.0'
16 libblkid_date = '01-Jun-2021'
17 libuuid_version = '1.3.0'
18 liblastlog2_version = '2.0.0'
19 libmount_version = '1.1.0'
20 libsmartcols_version = '1.1.0'
21 libfdisk_version = '1.1.0'
23 prefixdir = get_option('prefix')
24 if not fs.is_absolute(prefixdir)
25 error('Prefix is not absolute: "@0@"'.format(prefixdir))
27 bindir = join_paths(prefixdir, get_option('bindir'))
28 sbindir = join_paths(prefixdir, get_option('sbindir'))
29 sysconfstaticdir = join_paths(prefixdir, 'lib')
30 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
31 mandir = join_paths(prefixdir, get_option('mandir'))
33 localstatedir = '/var'
34 execprefixdir = prefixdir
35 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
36 usrbin_exec_dir = join_paths(execprefixdir, bindir)
37 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
38 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
40 vendordir = get_option('vendordir')
42 add_project_arguments('-D_GNU_SOURCE', '-fsigned-char', language : 'c')
44 if host_machine.system() == 'darwin'
45 add_project_arguments('-D_DARWIN_C_SOURCE', language : 'c')
48 cc = meson.get_compiler('c')
50 conf = configuration_data()
51 conf.set_quoted('PACKAGE', meson.project_name())
52 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
53 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
54 conf.set_quoted('PACKAGE_STRING', package_string)
57 pc_version = meson.project_version().split('-')[0].split('.')
59 if pc_version.length() < 3
63 pc_version = '.'.join(pc_version)
65 conf.set_quoted('LIBBLKID_VERSION', pc_version)
66 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
68 conf.set('bindir', bindir)
69 conf.set('sbindir', sbindir)
70 conf.set('runstatedir', runstatedir)
71 conf.set('localstatedir', localstatedir)
72 conf.set('sysconfdir', sysconfdir)
73 conf.set('usrbin_execdir', usrbin_exec_dir)
74 conf.set('usrsbin_execdir', usrsbin_exec_dir)
75 conf.set('docdir', docdir)
76 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
77 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
78 conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir)
79 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
80 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
82 conf.set_quoted('_PATH_VENDORDIR', vendordir)
83 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
85 build_libblkid = get_option('build-libblkid').allowed()
86 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
87 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
89 build_libuuid = not get_option('build-libuuid').disabled()
90 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
91 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
93 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
94 build_liblastlog2 = get_option('build-liblastlog2').require(lib_sqlite3.found()).allowed()
95 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
96 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
98 login_lastlogin = get_option('login-lastlogin')
99 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
100 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
102 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
103 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
104 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
106 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
107 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
109 have_sys_vfs_header = cc.has_header('sys/vfs.h')
111 build_libmount = get_option('build-libmount').require(
112 get_option('build-libblkid').allowed() \
113 and have_sys_vfs_header \
116 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
117 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
118 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
119 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
121 build_libsmartcols = not get_option('build-libsmartcols').disabled()
122 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
123 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
125 build_libfdisk = not get_option('build-libfdisk').require(get_option('build-libblkid').allowed()).disabled()
126 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
127 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
129 build_uuidd = not get_option('build-uuidd').disabled()
130 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
131 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
133 static_programs = get_option('static-programs')
134 need_static_libs = static_programs.length() > 0 # a rough estimate...
135 summary('static programs', static_programs)
137 LINUX = host_machine.system() in ['linux']
138 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
140 ############################################################
158 have = cc.compiles(code, name : 'wchar_t support')
159 if not have and get_option('widechar').enabled()
160 error('widechar support requested but unavailable')
162 if get_option('ncurses').enabled() and get_option('widechar').enabled()
163 error('widechar support is incompatible with non-wide ncurses')
165 conf.set('HAVE_WIDECHAR', have ? 1 : false)
205 linux/net_namespace.h
219 security/pam_modules.h
252 lib_m = cc.find_library('m')
254 lib_tinfo = dependency(
257 required : get_option('tinfo'))
259 lib_ncursesw = dependency(
261 required : get_option('ncursesw'))
262 if lib_ncursesw.found()
263 headers += ['ncursesw/ncurses.h',
267 lib_ncurses = disabler()
269 lib_ncurses = dependency(
272 required : get_option('ncurses'))
273 headers += ['ncurses.h',
277 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
278 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
279 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
281 lib_slang = dependency(
283 required : get_option('slang'))
285 headers += ['slang.h',
290 conf.set('HAVE_SLANG', lib_slang.found())
292 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
293 if curses_libs.found()
294 have = cc.has_function('use_default_colors', dependencies : curses_libs)
295 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
296 have = cc.has_function('resizeterm', dependencies : curses_libs)
297 conf.set('HAVE_RESIZETERM', have ? 1 : false)
305 required : get_option('zlib'))
307 lib_readline = dependency(
309 required : get_option('readline'))
310 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
312 lib_readline_static = dependency(
315 required : need_static_libs ? get_option('readline') : disabler())
317 if meson.version().version_compare('>= 0.59.0')
318 lib_intl = dependency(
320 required : get_option('nls'))
321 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
323 if get_option('nls').enabled()
324 error('nls is not supported with meson before 0.59.0')
326 lib_intl = dependency('', required : false)
329 lib_user = dependency(
332 required : get_option('libuser'))
333 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
335 lib_util = cc.find_library(
337 required : get_option('libutil'))
338 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
340 lib_utempter = cc.find_library(
342 required : get_option('libutempter'))
343 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
345 systemd = dependency(
347 required : get_option('systemd'))
349 lib_systemd = dependency(
351 required : get_option('systemd'))
352 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
353 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
355 have = cc.has_function(
356 'sd_session_get_username',
357 dependencies : lib_systemd)
358 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
360 lib_udev = dependency(
362 required : get_option('systemd'))
363 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
365 lib_crypt = cc.find_library('crypt', required : get_option('build-newgrp'))
366 if not lib_crypt.found()
367 lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin'))
370 lib_pam = cc.find_library(
373 required : get_option('build-login').enabled() or \
374 get_option('build-chfn-chsh').enabled() or \
375 get_option('build-su').enabled() or \
376 get_option('build-runuser').enabled())
378 lib_pam_misc = cc.find_library('pam_misc')
379 lib_pam = [lib_pam, lib_pam_misc]
381 lib_pam_misc = declare_dependency()
384 lib_cryptsetup = dependency(
386 required : get_option('cryptsetup'))
387 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
389 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
391 if meson.version().version_compare('>= 0.62.0')
392 lib_dl = dependency('dl')
394 lib_dl = cc.find_library('dl')
396 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
397 summary('cryptsetup support (dlopen)',
399 section : 'components')
401 summary('cryptsetup support',
402 lib_cryptsetup.found() ? 'enabled' : 'disabled',
403 section : 'components')
406 have = cc.has_function(
407 'crypt_activate_by_signed_key',
408 dependencies : lib_cryptsetup)
409 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
411 lib_cap_ng = dependency(
413 required : get_option('build-setpriv'))
414 if not lib_cap_ng.found()
415 lib_cap_ng = disabler()
418 lib_selinux = dependency(
421 required : get_option('selinux'))
422 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
424 lib_magic = dependency(
426 required : get_option('magic'))
427 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
429 lib_econf = dependency(
431 required : get_option('econf'))
432 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
434 lib_audit = dependency(
436 required : get_option('audit'))
437 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
439 conf.set('HAVE_SMACK', not get_option('smack').disabled())
442 foreach header : headers
443 have = cc.has_header(header)
444 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
447 header = 'linux/btrfs.h'
448 enable_btrfs = cc.has_header(header,
449 required : get_option('btrfs'))
450 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
451 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
453 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
458 have = cc.has_header(header,
460 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
463 have = cc.has_header('sched.h')
464 conf.set10('HAVE_DECL_CPU_ALLOC', have)
465 have_cpu_set_t = cc.has_type('cpu_set_t', args : '-D_GNU_SOURCE', prefix : '#include <sched.h>')
466 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
468 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
469 conf.set('HAVE_ENVIRON_DECL', have ? 1 : false)
471 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
472 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
474 have = cc.has_function('strsignal')
475 conf.set10('HAVE_STRSIGNAL_DECL', have)
477 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
478 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
480 have = cc.has_type('loff_t',
481 args : '-D_GNU_SOURCE',
482 prefix : '#include <sys/types.h>')
483 conf.set('HAVE_LOFF_T', have ? 1 : false)
485 have = cc.compiles('''
486 #define _GNU_SOURCE 1
487 #include <langinfo.h>
490 str = nl_langinfo (ALTMON_1);
491 str = nl_langinfo (ALTMON_2);
492 str = nl_langinfo (ALTMON_3);
493 str = nl_langinfo (ALTMON_4);
494 str = nl_langinfo (ALTMON_5);
495 str = nl_langinfo (ALTMON_6);
496 str = nl_langinfo (ALTMON_7);
497 str = nl_langinfo (ALTMON_8);
498 str = nl_langinfo (ALTMON_9);
499 str = nl_langinfo (ALTMON_10);
500 str = nl_langinfo (ALTMON_11);
501 str = nl_langinfo (ALTMON_12);
505 name : 'langinfo.h defines ALTMON_x constants')
506 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
508 have = cc.compiles('''
509 #define _GNU_SOURCE 1
510 #include <langinfo.h>
513 str = nl_langinfo (_NL_ABALTMON_1);
514 str = nl_langinfo (_NL_ABALTMON_2);
515 str = nl_langinfo (_NL_ABALTMON_3);
516 str = nl_langinfo (_NL_ABALTMON_4);
517 str = nl_langinfo (_NL_ABALTMON_5);
518 str = nl_langinfo (_NL_ABALTMON_6);
519 str = nl_langinfo (_NL_ABALTMON_7);
520 str = nl_langinfo (_NL_ABALTMON_8);
521 str = nl_langinfo (_NL_ABALTMON_9);
522 str = nl_langinfo (_NL_ABALTMON_10);
523 str = nl_langinfo (_NL_ABALTMON_11);
524 str = nl_langinfo (_NL_ABALTMON_12);
528 name : 'langinfo.h defines _NL_ABALTMON_x constants')
529 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
531 have = cc.compiles('''
532 #define _GNU_SOURCE 1
533 #include <langinfo.h>
536 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
540 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
541 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
574 landlock_create_ruleset
576 landlock_restrict_self
639 have = cc.has_function(func)
640 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
641 # This makes little sense, but is necessary to avoid warnings about
642 # redefined macros from Python.h, which uses this convention.
643 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
646 have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
647 conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false)
649 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
650 conf.set('AGETTY_RELOAD', have ? 1 : false)
652 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
655 have_dirfd = (cc.has_function('dirfd') or
656 cc.has_header_symbol('dirent.h', 'dirfd',
657 prefix : '#include <sys/types.h>'))
658 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
660 have_ddfd = cc.has_member('DIR', 'dd_fd',
662 #include <sys/types.h>
665 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
667 have = cc.has_member('struct tm', 'tm_gmtoff',
668 args : '-D_GNU_SOURCE',
673 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
677 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
678 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
680 have = cc.has_member('struct termios', 'c_line',
681 prefix : '#include <termios.h>')
682 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
684 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
685 args : '-D_GNU_SOURCE',
686 prefix : '#include <sys/stat.h>')
687 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
689 have = cc.has_member('struct statx', 'stx_mnt_id',
690 prefix : '#include <sys/stat.h>')
691 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
693 # replacement for AC_STRUCT_TIMEZONE
694 have = cc.has_member('struct tm', 'tm_zone',
695 args : '-D_GNU_SOURCE',
696 prefix : '#include <time.h>')
697 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
699 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
700 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
702 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
703 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
705 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
706 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
711 extern char *tzname[];
714 return tzname ? 0 : 1;
716 '''.format(have ? 1 : 0)
717 have = cc.compiles(code, name : 'using tzname[]')
718 conf.set('HAVE_TZNAME', have ? 1 : false)
720 have = cc.sizeof('time_t', prefix : '#include <time.h>')
722 add_global_arguments('-D_TIME_BITS=64', language : 'c')
723 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
725 if get_option('allow-32bit-time')
726 warning('Could not make time_t 64bits wide')
728 error('Could not make time_t 64bits wide')
734 if not cc.has_function('socket')
735 socket_libs += cc.find_library('socket', required : true)
736 have = cc.has_function('socket',
737 dependencies : socket_libs)
739 error('socket() function not available')
743 lib_rt = cc.find_library('rt', required : false)
745 have = cc.has_function('clock_gettime')
748 realtime_libs += lib_rt
749 have = cc.has_function('clock_gettime',
750 dependencies : realtime_libs)
753 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
755 thread_libs = dependency('threads')
757 have = cc.has_function('timer_create')
760 realtime_libs = [lib_rt]
761 have = cc.has_function('timer_create',
762 dependencies : realtime_libs)
765 realtime_libs += thread_libs
766 have = cc.has_function('timer_create',
767 dependencies : realtime_libs)
770 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
772 have = cc.has_function('setitimer')
773 conf.set('HAVE_SETITIMER', have ? 1 : false)
776 rtas_libs = cc.find_library('rtas', required : false)
777 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
780 if not cc.has_header_symbol('math.h', 'isnan')
781 lib = cc.find_library('m', required : true)
782 if (cc.has_function('isnan', dependencies : lib) and
783 cc.has_function('__isnan', dependencies : lib))
788 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
789 args : '-D_GNU_SOURCE')
790 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
793 extern char *__progname;
795 return (*__progname != 0);
798 have = cc.compiles(code, name : 'using __progname')
799 conf.set('HAVE___PROGNAME', have ? 1 : false)
801 have_pty = conf.get('HAVE_PTY_H').to_string() == '1' \
802 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
803 conf.set('HAVE_PTY', have_pty ? 1 : false)
805 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
806 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
808 build_plymouth_support = get_option('build-plymouth-support')
809 have_tiocglcktrmios = cc.has_header_symbol(
810 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
811 required : build_plymouth_support.enabled())
812 have_sock_cloexec = cc.has_header_symbol(
813 'sys/socket.h', 'SOCK_CLOEXEC',
814 prefix : '#include <sys/types.h>',
815 required : build_plymouth_support.enabled())
816 have_sock_nonblock = cc.has_header_symbol(
817 'sys/socket.h', 'SOCK_NONBLOCK',
818 prefix : '#include <sys/types.h>',
819 required : build_plymouth_support.enabled())
820 have_so_passcred = cc.has_header_symbol(
821 'sys/socket.h', 'SO_PASSCRED',
822 args : ['-D_GNU_SOURCE'],
823 prefix : '#include <sys/types.h>',
824 required : build_plymouth_support.enabled())
826 build_plymouth_support = (not build_plymouth_support.disabled() and
827 have_tiocglcktrmios and
828 have_sock_cloexec and
829 have_sock_nonblock and
831 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
832 summary('plymouth support',
833 build_plymouth_support ? 'enabled' : 'disabled',
834 section : 'components')
836 # check for valid fallocate() function
837 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
838 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
839 # and program can't be linked.
847 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
848 return ret == 0 ? 0 : 1;
851 have = cc.links(code, name : 'fallocate() function')
852 conf.set('HAVE_FALLOCATE', have ? 1 : false)
860 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
861 return ret == 0 ? 0 : 1;
864 have = cc.links(code, name : 'posix_fallocate() function')
865 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
867 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
868 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
869 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
871 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
872 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
873 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
875 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
877 ############################################################
880 fs_search_path = get_option('fs-search-path')
881 fs_search_path_extra = get_option('fs-search-path-extra')
882 if fs_search_path_extra != ''
883 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
885 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
887 systemdsystemunitdir = ''
889 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
892 sysvinit = get_option('sysvinit').enabled()
893 sysvinitrcdir = sysconfdir + '/init.d'
895 program_tests = get_option('program-tests')
897 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
898 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
900 have = get_option('chsh-only-listed')
901 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
903 have = get_option('use-tty-group')
904 conf.set('USE_TTY_GROUP', have ? 1 : false)
906 bison = find_program('bison')
907 flex = find_program('flex')
908 sed = find_program('sed')
910 build_hwclock = not get_option('build-hwclock').disabled()
911 bison_gen = generator(
913 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
914 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
916 python_module = import('python')
917 python = python_module.find_installation(
918 get_option('python'),
922 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
923 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
927 configuration : conf)
929 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
934 '-Waddress-of-packed-member',
935 '-Wdiscarded-qualifiers',
936 '-Wembedded-directive',
939 '-Wimplicit-function-declaration',
940 '-Wmissing-declarations',
941 '-Wmissing-parameter-type',
942 '-Wmissing-prototypes',
944 '-Wno-missing-field-initializers',
945 '-Wold-style-definition',
949 '-Wstrict-prototypes',
952 '-Wunused-but-set-parameter',
953 '-Wunused-but-set-variable',
954 '-Wunused-parameter',
960 foreach compiler_flag : compiler_flags
961 if cc.has_argument(compiler_flag)
962 add_project_arguments(compiler_flag, language : 'c')
970 bashcompletionslinks = {}
976 subdir('libsmartcols')
978 subdir('liblastlog2')
980 subdir('pam_lastlog2')
981 subdir('login-utils')
990 includes = [dir_include,
999 opt = not get_option('build-chfn-chsh').disabled()
1004 include_directories : includes,
1005 link_with : [lib_common, logindefs_c],
1006 dependencies : chfn_chsh_deps,
1007 install_dir : usrbin_exec_dir,
1008 install_mode : 'rwsr-xr-x',
1010 build_by_default : opt)
1014 'login-utils/chsh.c',
1017 include_directories : includes,
1018 link_with : lib_common,
1019 dependencies : chfn_chsh_deps,
1020 install_dir : usrbin_exec_dir,
1021 install_mode : 'rwsr-xr-x',
1023 build_by_default : opt)
1024 if opt and not is_disabler(exe)
1026 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1027 bashcompletions += ['chfn', 'chsh']
1032 test_islocal_sources,
1033 include_directories : includes,
1034 c_args : '-DTEST_PROGRAM',
1035 build_by_default : program_tests)
1040 test_consoles_sources,
1041 c_args : ['-DTEST_PROGRAM'],
1042 include_directories : includes,
1043 link_with : lib_common,
1044 build_by_default : program_tests)
1047 opt = not get_option('build-last').disabled()
1051 include_directories : includes,
1052 link_with : [lib_common],
1053 install_dir : usrbin_exec_dir,
1055 build_by_default : opt)
1056 if opt and not is_disabler(exe)
1058 meson.add_install_script(meson_make_symlink,
1060 join_paths(usrbin_exec_dir, 'lastb'))
1061 manadocs += ['login-utils/last.1.adoc']
1062 manlinks += {'lastb.1': 'last.1'}
1063 bashcompletions += ['last']
1064 bashcompletionslinks += {'lastb': 'last'}
1067 opt = not get_option('build-nologin').disabled()
1070 'login-utils/nologin.c',
1071 include_directories : includes,
1072 install_dir : sbindir,
1073 link_with : [lib_common],
1075 build_by_default : opt)
1076 if opt and not is_disabler(exe)
1078 manadocs += ['login-utils/nologin.8.adoc']
1081 opt = not get_option('build-utmpdump').disabled()
1084 'login-utils/utmpdump.c',
1085 include_directories : includes,
1086 link_with : [lib_common],
1087 install_dir : usrbin_exec_dir,
1089 build_by_default : opt)
1090 if opt and not is_disabler(exe)
1092 manadocs += ['login-utils/utmpdump.1.adoc']
1093 bashcompletions += ['utmpdump']
1096 opt = get_option('build-su').require(have_pty).allowed()
1100 'login-utils/su-common.c',
1101 'login-utils/su-common.h',
1105 include_directories : includes,
1106 link_with : [lib_common, logindefs_c],
1107 dependencies : [lib_pam,
1111 install_mode : 'rwsr-xr-x',
1113 build_by_default : opt)
1114 if opt and not is_disabler(exe)
1116 manadocs += ['login-utils/su.1.adoc']
1117 bashcompletions += ['su']
1120 opt = not get_option('build-newgrp').disabled()
1123 'login-utils/newgrp.c',
1124 include_directories : includes,
1125 dependencies : [lib_crypt],
1126 install_dir : usrbin_exec_dir,
1127 install_mode : 'rwsr-xr-x',
1129 build_by_default : opt)
1130 if opt and not is_disabler(exe)
1132 manadocs += ['login-utils/newgrp.1.adoc']
1133 bashcompletions += ['newgrp']
1136 opt = not get_option('build-lslogins').disabled()
1139 'login-utils/lslogins.c',
1140 include_directories : includes,
1141 link_with : [lib_common,
1144 (build_liblastlog2 ? [lib_lastlog2] : []),
1145 dependencies : [lib_selinux,
1147 install_dir : usrbin_exec_dir,
1149 build_by_default : opt)
1150 if opt and not is_disabler(exe)
1152 manadocs += ['login-utils/lslogins.1.adoc']
1153 bashcompletions += ['lslogins']
1156 opt = not get_option('build-vipw').disabled()
1159 'login-utils/vipw.c',
1160 'login-utils/setpwnam.h',
1161 include_directories : includes,
1162 link_with : [lib_common],
1163 dependencies : [lib_selinux],
1164 install_dir : usrbin_exec_dir,
1166 build_by_default : opt)
1167 if opt and not is_disabler(exe)
1169 meson.add_install_script(meson_make_symlink,
1171 join_paths(usrbin_exec_dir, 'vigr'))
1172 manadocs += ['login-utils/vipw.8.adoc']
1173 meson.add_install_script(meson_make_symlink,
1175 join_paths(mandir, 'man8/vigr.8'))
1178 opt = get_option('build-runuser').require(have_pty).allowed()
1181 'login-utils/runuser.c',
1182 'login-utils/su-common.c',
1183 'login-utils/su-common.h',
1187 include_directories : includes,
1188 link_with : [lib_common, logindefs_c],
1189 dependencies : [lib_pam,
1193 install_dir : sbindir,
1195 build_by_default : opt)
1196 if opt and not is_disabler(exe)
1198 manadocs += ['login-utils/runuser.1.adoc']
1199 bashcompletionslinks += {'runuser': 'su'}
1202 ############################################################
1208 include_directories : includes,
1209 link_with : lib_common,
1210 install_dir : usrbin_exec_dir,
1213 manadocs += ['text-utils/col.1.adoc']
1214 bashcompletions += ['col']
1220 include_directories : includes,
1221 install_dir : usrbin_exec_dir,
1224 manadocs += ['text-utils/colcrt.1.adoc']
1225 bashcompletions += ['colcrt']
1230 include_directories : includes,
1231 link_with : lib_common,
1232 install_dir : usrbin_exec_dir,
1235 manadocs += ['text-utils/colrm.1.adoc']
1236 bashcompletions += ['colrm']
1241 include_directories : includes,
1242 install_dir : usrbin_exec_dir,
1245 manadocs += ['text-utils/rev.1.adoc']
1246 bashcompletions += ['rev']
1251 include_directories : includes,
1252 link_with : [lib_common,
1254 install_dir : usrbin_exec_dir,
1256 if not is_disabler(exe)
1258 manadocs += ['text-utils/column.1.adoc']
1259 bashcompletions += ['column']
1262 opt = not get_option('build-line').disabled()
1266 include_directories : includes,
1267 install_dir : usrbin_exec_dir,
1269 build_by_default : opt)
1270 if opt and not is_disabler(exe)
1272 manadocs += ['text-utils/line.1.adoc']
1275 opt = not get_option('build-pg').disabled()
1279 link_with : lib_common,
1280 include_directories : includes,
1281 dependencies : [lib_tinfo,
1283 install_dir : usrbin_exec_dir,
1285 build_by_default : opt)
1286 if opt and not is_disabler(exe)
1288 manadocs += ['text-utils/pg.1.adoc']
1289 bashcompletions += ['pg']
1292 opt = not get_option('build-ul').disabled()
1296 include_directories : includes,
1297 dependencies : [lib_tinfo,
1299 install_dir : usrbin_exec_dir,
1301 build_by_default : opt)
1302 if opt and not is_disabler(exe)
1304 manadocs += ['text-utils/ul.1.adoc']
1305 bashcompletions += ['ul']
1308 opt = not get_option('build-more').disabled()
1312 link_with : [lib_common],
1313 include_directories : includes,
1314 dependencies : [lib_tinfo,
1318 build_by_default : opt)
1322 link_with : [lib_common],
1323 include_directories : includes,
1324 c_args : '-DTEST_PROGRAM',
1325 dependencies : [lib_tinfo,
1328 build_by_default : opt and program_tests)
1330 if opt and not is_disabler(exe)
1332 manadocs += ['text-utils/more.1.adoc']
1333 bashcompletions += ['more']
1339 include_directories : includes,
1340 link_with : [lib_common,
1342 install_dir : usrbin_exec_dir,
1344 if not is_disabler(exe)
1346 manadocs += ['text-utils/hexdump.1.adoc']
1347 bashcompletions += ['hexdump']
1350 opt = not get_option('build-lsmem').disabled()
1354 include_directories : includes,
1355 link_with : [lib_common,
1357 install_dir : usrbin_exec_dir,
1359 build_by_default : opt)
1360 if opt and not is_disabler(exe)
1362 manadocs += ['sys-utils/lsmem.1.adoc']
1363 bashcompletions += ['lsmem']
1366 opt = not get_option('build-chmem').disabled()
1370 include_directories : includes,
1371 link_with : [lib_common],
1372 install_dir : usrbin_exec_dir,
1374 build_by_default : opt)
1375 if opt and not is_disabler(exe)
1377 manadocs += ['sys-utils/chmem.8.adoc']
1378 bashcompletions += ['chmem']
1384 include_directories : includes,
1385 link_with : [lib_common],
1386 install_dir : usrbin_exec_dir,
1389 manadocs += ['sys-utils/choom.1.adoc']
1391 has_seminfo_type = cc.has_type('struct seminfo', args : '-D_GNU_SOURCE', prefix : '#include <sys/sem.h>')
1393 opt = get_option('build-ipcmk').require(has_seminfo_type).allowed()
1397 include_directories : includes,
1398 link_with : [lib_common],
1399 install_dir : usrbin_exec_dir,
1401 build_by_default : opt)
1402 if opt and not is_disabler(exe)
1404 manadocs += ['sys-utils/ipcmk.1.adoc']
1405 bashcompletions += ['ipcmk']
1408 opt = get_option('build-ipcrm').require(has_seminfo_type).allowed()
1412 include_directories : includes,
1413 link_with : [lib_common],
1414 install_dir : usrbin_exec_dir,
1416 build_by_default : opt)
1417 if opt and not is_disabler(exe)
1419 manadocs += ['sys-utils/ipcrm.1.adoc']
1420 bashcompletions += ['ipcrm']
1423 opt = not get_option('build-ipcs').require(has_seminfo_type).disabled()
1427 include_directories : includes,
1428 link_with : [lib_common],
1429 install_dir : usrbin_exec_dir,
1431 build_by_default : opt)
1432 if opt and not is_disabler(exe)
1434 manadocs += ['sys-utils/ipcs.1.adoc']
1435 bashcompletions += ['ipcs']
1438 opt = not get_option('build-rfkill').disabled()
1442 include_directories : includes,
1443 link_with : [lib_common,
1445 install_dir : usrsbin_exec_dir,
1447 build_by_default : opt)
1448 if opt and not is_disabler(exe)
1450 manadocs += ['sys-utils/rfkill.8.adoc']
1451 bashcompletions += ['rfkill']
1457 include_directories : includes,
1458 link_with : [lib_common,
1460 install_dir : usrbin_exec_dir,
1462 if not is_disabler(exe)
1464 manadocs += ['sys-utils/renice.1.adoc']
1465 bashcompletions += ['renice']
1471 include_directories: includes,
1472 link_with : [lib_common,
1474 install_dir : usrbin_exec_dir,
1476 if opt and not is_disabler(exe)
1478 manadocs += ['sys-utils/setpgid.1.adoc']
1479 bashcompletions += ['setpgid']
1485 include_directories : includes,
1486 link_with : [lib_common,
1488 install_dir : usrbin_exec_dir,
1490 if opt and not is_disabler(exe)
1492 manadocs += ['sys-utils/setsid.1.adoc']
1493 bashcompletions += ['setsid']
1498 readprofile_sources,
1499 include_directories : includes,
1500 link_with : [lib_common,
1502 install_dir : usrsbin_exec_dir,
1504 if not is_disabler(exe)
1506 manadocs += ['sys-utils/readprofile.8.adoc']
1507 bashcompletions += ['readprofile']
1510 opt = not get_option('build-tunelp').disabled()
1514 include_directories : includes,
1515 link_with : [lib_common],
1516 install_dir : usrsbin_exec_dir,
1518 build_by_default : opt)
1519 if opt and not is_disabler(exe)
1521 manadocs += ['sys-utils/tunelp.8.adoc']
1522 bashcompletions += ['tunelp']
1525 opt = get_option('build-fstrim').require(have_sys_vfs_header).allowed()
1529 include_directories : includes,
1530 link_with : [lib_common],
1531 dependencies : [mount_dep],
1532 install_dir : sbindir,
1534 build_by_default : opt)
1535 if opt and not is_disabler(exe)
1537 manadocs += ['sys-utils/fstrim.8.adoc']
1538 bashcompletions += ['fstrim']
1541 opt = get_option('build-dmesg').require(cc.has_header('sys/klog.h')).allowed()
1545 include_directories : includes,
1546 link_with : [lib_common,
1549 build_by_default : opt)
1550 if opt and not is_disabler(exe)
1552 manadocs += ['sys-utils/dmesg.1.adoc']
1553 bashcompletions += ['dmesg']
1559 include_directories : dir_include,
1560 c_args : '-DTEST_DMESG',
1561 link_with : [lib_common,
1563 build_by_default : program_tests)
1564 if not is_disabler(exe)
1571 include_directories : includes,
1572 link_with : [lib_common],
1573 install_dir : sbindir,
1576 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1577 bashcompletions += ['ctrlaltdel']
1579 have_linux_fs_h = conf.get('HAVE_LINUX_FS_H').to_string() == '1'
1581 opt = get_option('build-fsfreeze').require(have_linux_fs_h).allowed()
1585 include_directories : includes,
1586 install_dir : sbindir,
1588 build_by_default : opt)
1589 if opt and not is_disabler(exe)
1591 manadocs += ['sys-utils/fsfreeze.8.adoc']
1592 bashcompletions += ['fsfreeze']
1595 opt = get_option('build-blkdiscard').require(have_linux_fs_h).allowed()
1599 include_directories : includes,
1600 link_with : [lib_common],
1601 dependencies : [blkid_dep],
1602 install_dir : sbindir,
1604 build_by_default : opt)
1605 if opt and not is_disabler(exe)
1607 manadocs += ['sys-utils/blkdiscard.8.adoc']
1608 bashcompletions += ['blkdiscard']
1611 opt = get_option('build-blkzone').require(have_linux_fs_h).allowed()
1615 include_directories : includes,
1616 link_with : [lib_common],
1617 install_dir : sbindir,
1619 build_by_default : opt)
1620 if opt and not is_disabler(exe)
1622 manadocs += ['sys-utils/blkzone.8.adoc']
1623 bashcompletions += ['blkzone']
1626 opt = get_option('build-blkpr').require(cc.has_header('linux/pr.h')).allowed()
1630 include_directories : includes,
1631 link_with : [lib_common],
1632 install_dir : sbindir,
1634 build_by_default : opt)
1635 if opt and not is_disabler(exe)
1637 manadocs += ['sys-utils/blkpr.8.adoc']
1640 opt = get_option('build-ldattach').require(cc.has_header('linux/if.h')).allowed()
1644 include_directories : includes,
1645 link_with : [lib_common],
1646 install_dir : usrsbin_exec_dir,
1648 build_by_default : opt)
1649 if opt and not is_disabler(exe)
1651 manadocs += ['sys-utils/ldattach.8.adoc']
1652 bashcompletions += ['ldattach']
1655 have_linux_rtc_h = cc.has_header('linux/rtc.h')
1657 opt = get_option('build-rtcwake').require(have_linux_rtc_h).allowed()
1661 include_directories : includes,
1662 link_with : [lib_common],
1663 install_dir : usrsbin_exec_dir,
1665 build_by_default : opt)
1666 if opt and not is_disabler(exe)
1668 manadocs += ['sys-utils/rtcwake.8.adoc']
1669 bashcompletions += ['rtcwake']
1672 opt = get_option('build-setarch').require(cc.has_header('sys/personality.h')).allowed()
1676 include_directories : includes,
1677 link_with : [lib_common],
1678 install_dir : usrbin_exec_dir,
1680 build_by_default : opt)
1681 if opt and not is_disabler(exe)
1683 manadocs += ['sys-utils/setarch.8.adoc']
1684 bashcompletions += ['setarch']
1688 setarch_links = ['uname26', 'linux32', 'linux64']
1689 setarch_links_arch = {
1690 's390x' : ['s390', 's390x'],
1692 'x86_64' : ['i386', 'x86_64'],
1693 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1694 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1695 'mips64' : ['mips', 'mips64', 'mips32'],
1696 'ia64' : ['i386', 'ia64'],
1697 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1699 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1701 foreach link: setarch_links
1702 meson.add_install_script(meson_make_symlink,
1704 join_paths(usrbin_exec_dir, link))
1705 manlinks += {link + '.8': 'setarch.8'}
1709 opt = not get_option('build-eject').disabled()
1713 include_directories : includes,
1714 link_with : [lib_common],
1715 dependencies : [mount_dep],
1716 install_dir : usrbin_exec_dir,
1718 build_by_default : opt)
1719 if opt and not is_disabler(exe)
1721 manadocs += ['sys-utils/eject.1.adoc']
1722 bashcompletions += ['eject']
1725 opt = not get_option('build-losetup').disabled()
1729 include_directories : includes,
1730 link_with : [lib_common,
1732 install_dir : sbindir,
1734 build_by_default : opt)
1735 if opt and not is_disabler(exe)
1736 manadocs += ['sys-utils/losetup.8.adoc']
1738 bashcompletions += ['losetup']
1741 opt = opt and 'losetup' in static_programs
1745 include_directories : includes,
1746 link_args : ['--static'],
1747 link_with : [lib_common,
1748 lib_smartcols.get_static_lib()],
1749 install_dir : sbindir,
1751 build_by_default : opt)
1752 if opt and not is_disabler(exe)
1756 opt = not get_option('build-zramctl').disabled()
1760 include_directories : includes,
1761 link_with : [lib_common,
1763 install_dir : sbindir,
1765 build_by_default : opt)
1766 if opt and not is_disabler(exe)
1768 manadocs += ['sys-utils/zramctl.8.adoc']
1769 bashcompletions += ['zramctl']
1775 include_directories : includes,
1776 link_with : [lib_common,
1778 install_dir : usrbin_exec_dir,
1780 if not is_disabler(exe)
1782 manadocs += ['sys-utils/prlimit.1.adoc']
1783 bashcompletions += ['prlimit']
1786 opt = not get_option('build-lsns').disabled()
1790 include_directories : includes,
1791 link_with : [lib_common,
1793 dependencies : [mount_dep],
1794 install_dir : usrbin_exec_dir,
1796 build_by_default : opt)
1797 if opt and not is_disabler(exe)
1799 manadocs += ['sys-utils/lsns.8.adoc']
1800 bashcompletions += ['lsns']
1803 opt = not get_option('build-mount').disabled()
1807 include_directories : includes,
1808 link_with : [lib_common,
1810 dependencies : [lib_selinux, mount_dep],
1811 install_mode : 'rwsr-xr-x',
1813 build_by_default : opt)
1817 include_directories : includes,
1818 link_with : [lib_common],
1819 dependencies : [mount_dep],
1820 install_mode : 'rwsr-xr-x',
1822 build_by_default : opt)
1823 if opt and not is_disabler(exe)
1825 manadocs += ['sys-utils/fstab.5.adoc',
1826 'sys-utils/mount.8.adoc',
1827 'sys-utils/umount.8.adoc']
1828 bashcompletions += ['mount', 'umount']
1831 opt2 = opt and 'mount' in static_programs
1835 include_directories : includes,
1836 link_args : ['--static'],
1837 link_with : [lib_common,
1838 lib_smartcols_static],
1839 dependencies : [mount_static_dep],
1841 build_by_default : opt2)
1842 if opt2 and not is_disabler(exe)
1846 opt2 = opt and 'umount' in static_programs
1850 include_directories : includes,
1851 link_args : ['--static'],
1852 link_with : [lib_common],
1853 dependencies : [mount_static_dep],
1855 build_by_default : opt2)
1856 if opt2 and not is_disabler(exe)
1862 opt = not get_option('build-swapon').disabled()
1866 include_directories : includes,
1867 link_with : [lib_common,
1869 dependencies : [blkid_dep, mount_dep],
1870 install_dir : sbindir,
1872 build_by_default : opt)
1873 if opt and not is_disabler(exe)
1875 manadocs += ['sys-utils/swapon.8.adoc']
1876 bashcompletions += ['swapon']
1879 opt = not get_option('build-swapoff').disabled()
1883 include_directories : includes,
1884 link_with : [lib_common],
1885 dependencies : [blkid_dep, mount_dep],
1886 install_dir : sbindir,
1888 build_by_default : opt)
1889 if opt and not is_disabler(exe)
1891 manlinks += {'swapoff.8': 'swapon.8'}
1892 bashcompletions += ['swapoff']
1898 include_directories : includes,
1899 link_with : [lib_common,
1901 dependencies : [rtas_libs],
1902 install_dir : usrbin_exec_dir,
1904 if not is_disabler(exe)
1906 manadocs += ['sys-utils/lscpu.1.adoc']
1907 bashcompletions += ['lscpu']
1910 opt = get_option('build-chcpu').require(have_cpu_set_t).allowed()
1914 include_directories : includes,
1915 link_with : [lib_common],
1916 install_dir : sbindir,
1918 build_by_default : opt)
1919 if opt and not is_disabler(exe)
1921 manadocs += ['sys-utils/chcpu.8.adoc']
1922 bashcompletions += ['chcpu']
1928 include_directories : includes,
1929 link_with : [lib_common,
1932 if not is_disabler(exe)
1934 manadocs += ['sys-utils/wdctl.8.adoc']
1935 bashcompletions += ['wdctl']
1938 opt = not get_option('build-mountpoint').disabled()
1942 include_directories : includes,
1943 dependencies : [mount_dep],
1945 build_by_default : opt)
1946 if opt and not is_disabler(exe)
1948 manadocs += ['sys-utils/mountpoint.1.adoc']
1949 bashcompletions += ['mountpoint']
1952 opt = not get_option('build-fallocate').disabled()
1956 include_directories : includes,
1957 link_with : [lib_common],
1958 install_dir : usrbin_exec_dir,
1960 build_by_default : opt)
1961 if opt and not is_disabler(exe)
1963 manadocs += ['sys-utils/fallocate.1.adoc']
1964 bashcompletions += ['fallocate']
1967 opt = not get_option('build-pivot_root').disabled()
1971 include_directories : includes,
1972 install_dir : sbindir,
1974 build_by_default : opt)
1975 if opt and not is_disabler(exe)
1977 manadocs += ['sys-utils/pivot_root.8.adoc']
1978 bashcompletions += ['pivot_root']
1981 opt = not get_option('build-switch_root').disabled()
1982 if opt and not have_dirfd and not have_ddfd
1983 error('neither dirfd nor ddfd are available')
1987 switch_root_sources,
1988 include_directories : includes,
1989 install_dir : sbindir,
1991 build_by_default : opt)
1992 if opt and not is_disabler(exe)
1994 manadocs += ['sys-utils/switch_root.8.adoc']
1997 opt = not get_option('build-unshare').disabled()
2001 include_directories : includes,
2002 link_with : [lib_common],
2003 dependencies : [mount_dep],
2004 install_dir : usrbin_exec_dir,
2006 build_by_default : opt)
2007 if opt and not is_disabler(exe)
2009 manadocs += ['sys-utils/unshare.1.adoc']
2010 bashcompletions += ['unshare']
2013 opt = opt and 'unshare' in static_programs
2017 include_directories : includes,
2018 link_with : [lib_common],
2019 dependencies : [mount_dep],
2020 install_dir : usrbin_exec_dir,
2022 build_by_default : opt)
2023 if opt and not is_disabler(exe)
2027 opt = not get_option('build-nsenter').disabled()
2031 include_directories : includes,
2032 link_with : [lib_common],
2033 dependencies : [lib_selinux],
2034 install_dir : usrbin_exec_dir,
2036 build_by_default : opt)
2037 if opt and not is_disabler(exe)
2039 manadocs += ['sys-utils/nsenter.1.adoc']
2040 bashcompletions += ['nsenter']
2043 opt = opt and 'nsenter' in static_programs
2047 include_directories : includes,
2048 link_with : [lib_common],
2049 dependencies : [lib_selinux],
2050 install_dir : usrbin_exec_dir,
2052 build_by_default : opt)
2053 if opt and not is_disabler(exe)
2057 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
2061 include_directories : includes,
2062 link_with : [lib_common],
2063 dependencies : [lib_cap_ng],
2064 install_dir : usrbin_exec_dir,
2066 build_by_default : opt)
2067 if opt and not is_disabler(exe)
2069 manadocs += ['sys-utils/setpriv.1.adoc']
2070 bashcompletions += ['setpriv']
2076 include_directories : includes,
2077 link_with : [lib_common],
2078 dependencies : realtime_libs,
2079 install_dir : usrbin_exec_dir,
2082 manadocs += ['sys-utils/flock.1.adoc']
2083 bashcompletions += ['flock']
2085 opt = not get_option('build-lsirq').disabled()
2089 include_directories : includes,
2090 link_with : [lib_common,
2092 install_dir : usrbin_exec_dir,
2094 build_by_default : opt)
2095 if opt and not is_disabler(exe)
2097 manadocs += ['sys-utils/lsirq.1.adoc']
2098 bashcompletions += ['lsirq']
2101 opt = not get_option('build-irqtop').disabled()
2105 include_directories : includes,
2106 dependencies : [realtime_libs, curses_libs],
2107 link_with : [lib_common,
2110 install_dir : usrbin_exec_dir,
2112 build_by_default : opt)
2113 if opt and not is_disabler(exe)
2115 manadocs += ['sys-utils/irqtop.1.adoc']
2116 bashcompletions += ['irqtop']
2119 opt = not get_option('build-ipcs').disabled()
2123 include_directories : includes,
2124 link_with : [lib_common,
2126 install_dir : usrbin_exec_dir,
2128 build_by_default : opt)
2129 if opt and not is_disabler(exe)
2131 manadocs += ['sys-utils/lsipc.1.adoc']
2132 bashcompletions += ['lsipc']
2139 include_directories : includes,
2140 link_with : [lib_common],
2141 dependencies : [lib_m,
2143 install_dir : sbindir,
2145 build_by_default : opt)
2146 if opt and not is_disabler(exe)
2148 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2149 bashcompletions += ['hwclock']
2155 include_directories : includes,
2156 install_dir : sbindir,
2159 manadocs += ['disk-utils/mkfs.8.adoc']
2160 bashcompletions += ['mkfs']
2162 opt = not get_option('build-bfs').disabled()
2166 include_directories : includes,
2167 link_with : [lib_common],
2168 install_dir : sbindir,
2170 build_by_default : opt)
2171 if opt and not is_disabler(exe)
2173 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2174 bashcompletions += ['mkfs.bfs']
2180 include_directories : includes,
2181 link_with : [lib_common],
2182 install_dir : usrbin_exec_dir,
2185 manadocs += ['disk-utils/isosize.8.adoc']
2186 bashcompletions += ['isosize']
2191 include_directories : includes,
2192 link_with : [lib_common,
2194 dependencies: [blkid_dep, lib_selinux],
2195 install_dir : sbindir,
2197 if not is_disabler(exe)
2199 manadocs += ['disk-utils/mkswap.8.adoc']
2200 bashcompletions += ['mkswap']
2206 include_directories : includes,
2207 link_with : [lib_common,
2209 dependencies : [blkid_dep],
2210 install_dir : sbindir,
2212 if not is_disabler(exe)
2214 manadocs += ['disk-utils/swaplabel.8.adoc']
2215 bashcompletions += ['swaplabel']
2218 opt = not get_option('build-fsck').disabled()
2222 include_directories : includes,
2223 link_with : [lib_common],
2224 dependencies : [blkid_dep, mount_dep, realtime_libs],
2225 install_dir : sbindir,
2227 build_by_default : opt)
2228 if opt and not is_disabler(exe)
2230 manadocs += ['disk-utils/fsck.8.adoc']
2231 bashcompletions += ['fsck']
2234 opt = not get_option('build-minix').disabled()
2238 include_directories : includes,
2239 link_with : [lib_common],
2240 install_dir : sbindir,
2242 build_by_default : opt)
2246 include_directories : includes,
2247 c_args : '-DTEST_SCRIPT',
2248 link_with : [lib_common],
2249 build_by_default : opt and program_tests)
2253 include_directories : includes,
2254 link_with : [lib_common],
2255 install_dir : sbindir,
2257 build_by_default : opt)
2258 if opt and not is_disabler(exe)
2259 exes += [exe, exe2, exe3]
2260 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2261 bashcompletions += ['mkfs.minix', 'fsck.minix']
2264 opt = not get_option('build-cramfs').disabled()
2267 mkfs_cramfs_sources,
2268 include_directories : includes,
2269 link_with : [lib_common],
2270 dependencies : [lib_z],
2271 install_dir : sbindir,
2273 build_by_default : opt)
2276 fsck_cramfs_sources,
2277 include_directories : includes,
2278 link_with : [lib_common],
2279 dependencies : [lib_z],
2280 install_dir : sbindir,
2282 build_by_default : opt)
2283 if not is_disabler(exe)
2285 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2286 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2289 opt = not get_option('build-raw').disabled()
2291 cc.has_header('linux/raw.h', required: opt)
2296 include_directories : includes,
2297 install_dir : sbindir,
2299 build_by_default : opt)
2300 if opt and not is_disabler(exe)
2302 manadocs += ['disk-utils/raw.8.adoc']
2303 bashcompletions += ['raw']
2306 opt = not get_option('build-fdformat').disabled()
2310 include_directories : includes,
2311 link_with : [lib_common],
2312 install_dir : usrsbin_exec_dir,
2314 build_by_default : opt)
2315 if opt and not is_disabler(exe)
2317 manadocs += ['disk-utils/fdformat.8.adoc']
2318 bashcompletions += ['fdformat']
2321 opt = get_option('build-blockdev').require(LINUX).allowed()
2325 include_directories : includes,
2326 link_with : [lib_common],
2327 install_dir : sbindir,
2329 build_by_default : opt)
2330 if opt and not is_disabler(exe)
2332 manadocs += ['disk-utils/blockdev.8.adoc']
2333 bashcompletions += ['blockdev']
2336 opt = not get_option('build-fdisks').disabled()
2337 if opt and not have_dirfd and not have_ddfd
2338 error('neither dirfd nor ddfd are available')
2343 include_directories : includes,
2344 link_with : [lib_common,
2348 dependencies : [lib_readline],
2349 install_dir : sbindir,
2351 build_by_default : opt)
2352 if opt and not is_disabler(exe)
2354 bashcompletions += ['fdisk']
2357 opt2 = opt and 'fdisk' in static_programs
2361 link_args : ['--static'],
2362 include_directories : includes,
2363 link_with : [lib_common,
2366 lib_smartcols.get_static_lib()],
2367 dependencies : [lib_readline_static],
2368 install_dir : sbindir,
2370 build_by_default : opt2)
2371 if opt2 and not is_disabler(exe)
2378 include_directories : includes,
2379 link_with : [lib_common,
2383 dependencies : [lib_readline],
2384 install_dir : sbindir,
2386 build_by_default : opt)
2387 if opt and not is_disabler(exe)
2389 bashcompletions += ['sfdisk']
2392 opt2 = opt and 'sfdisk' in static_programs
2396 include_directories : includes,
2397 link_with : [lib_common,
2400 lib_smartcols.get_static_lib()],
2401 dependencies : [lib_readline_static],
2402 install_dir : sbindir,
2404 build_by_default : opt2)
2405 if opt2 and not is_disabler(exe)
2412 include_directories : includes,
2413 link_with : [lib_common,
2417 dependencies : [curses_libs, mount_dep],
2418 install_dir : sbindir,
2420 build_by_default : opt)
2421 if opt and not is_disabler(exe)
2423 manadocs += ['disk-utils/fdisk.8.adoc',
2424 'disk-utils/sfdisk.8.adoc',
2425 'disk-utils/cfdisk.8.adoc']
2426 bashcompletions += ['cfdisk']
2429 opt = not get_option('build-partx').disabled()
2433 include_directories : includes,
2434 link_with : [lib_common],
2435 install_dir : usrsbin_exec_dir,
2437 build_by_default : opt)
2441 include_directories : includes,
2442 link_with : [lib_common],
2443 install_dir : usrsbin_exec_dir,
2445 build_by_default : opt)
2449 include_directories : includes,
2450 link_with : [lib_common],
2451 install_dir : usrsbin_exec_dir,
2453 build_by_default : opt)
2457 include_directories : includes,
2458 link_with : [lib_common,
2460 dependencies : [blkid_dep],
2461 install_dir : usrsbin_exec_dir,
2463 build_by_default : opt)
2465 exes += [exe, exe2, exe3, exe4]
2466 manadocs += ['disk-utils/addpart.8.adoc',
2467 'disk-utils/delpart.8.adoc',
2468 'disk-utils/resizepart.8.adoc',
2469 'disk-utils/partx.8.adoc']
2470 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2472 opt = opt and 'partx' in static_programs
2476 include_directories : includes,
2477 link_args : ['--static'],
2478 link_with : [lib_common],
2479 install_dir : usrsbin_exec_dir,
2481 build_by_default : opt)
2485 include_directories : includes,
2486 link_args : ['--static'],
2487 link_with : [lib_common],
2488 install_dir : usrsbin_exec_dir,
2490 build_by_default : opt)
2492 'resizepart.static',
2494 include_directories : includes,
2495 link_args : ['--static'],
2496 link_with : [lib_common],
2497 install_dir : usrsbin_exec_dir,
2499 build_by_default : opt)
2503 include_directories : includes,
2504 link_args : ['--static'],
2505 link_with : [lib_common,
2506 lib_smartcols.get_static_lib()],
2507 dependencies : [blkid_static_dep],
2508 install_dir : usrsbin_exec_dir,
2510 build_by_default : opt)
2513 exes += [exe, exe2, exe3, exe4]
2516 ############################################################
2518 opt = get_option('build-script').require(have_pty).allowed()
2522 include_directories : includes,
2523 link_with : [lib_common],
2524 dependencies : [lib_util,
2528 install_dir : usrbin_exec_dir,
2530 build_by_default : opt)
2531 if opt and not is_disabler(exe)
2533 manadocs += ['term-utils/script.1.adoc']
2534 bashcompletions += ['script']
2540 include_directories : includes,
2541 c_args : '-DTEST_SCRIPT',
2542 link_with : [lib_common],
2543 dependencies : [lib_util,
2547 build_by_default : opt and program_tests)
2548 if opt and not is_disabler(exe)
2552 opt = get_option('build-scriptlive').require(have_pty).allowed()
2556 include_directories : includes,
2557 link_with : [lib_common],
2558 dependencies : [lib_util,
2561 install_dir : usrbin_exec_dir,
2563 build_by_default : opt)
2564 if opt and not is_disabler(exe)
2566 manadocs += ['term-utils/scriptlive.1.adoc']
2567 bashcompletions += ['scriptlive']
2572 scriptreplay_sources,
2573 include_directories : includes,
2574 link_with : [lib_common],
2575 dependencies : [math_libs],
2576 install_dir : usrbin_exec_dir,
2579 manadocs += ['term-utils/scriptreplay.1.adoc']
2580 bashcompletions += ['scriptreplay']
2582 opt = not get_option('build-agetty').disabled()
2586 include_directories : includes,
2587 link_with : [lib_common, logindefs_c],
2588 dependencies : [BSD ? lib_util : [], lib_systemd],
2589 install_dir : sbindir,
2591 build_by_default : opt)
2594 manadocs += ['term-utils/agetty.8.adoc']
2597 opt = not get_option('build-setterm').disabled()
2601 include_directories : includes,
2602 link_with : [lib_common],
2603 dependencies : [curses_libs],
2604 install_dir : usrbin_exec_dir,
2606 build_by_default : opt)
2609 manadocs += ['term-utils/setterm.1.adoc']
2610 bashcompletions += ['setterm']
2613 opt = not get_option('build-mesg').disabled()
2617 include_directories : includes,
2618 link_with : [lib_common],
2619 install_dir : usrbin_exec_dir,
2621 build_by_default : opt)
2624 manadocs += ['term-utils/mesg.1.adoc']
2625 bashcompletions += ['mesg']
2628 opt = not get_option('build-wall').disabled()
2632 include_directories : includes,
2633 link_with : [lib_common],
2634 dependencies : [lib_systemd],
2635 install_dir : usrbin_exec_dir,
2636 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2638 build_by_default : opt)
2641 manadocs += ['term-utils/wall.1.adoc']
2642 bashcompletions += ['wall']
2645 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2646 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2648 opt = not get_option('build-write').disabled()
2652 include_directories : includes,
2653 link_with : [lib_common],
2654 dependencies : [lib_systemd],
2655 install_dir : usrbin_exec_dir,
2656 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2658 build_by_default : opt)
2661 manadocs += ['term-utils/write.1.adoc']
2662 bashcompletions += ['write']
2665 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2666 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2668 opt = not get_option('build-login').disabled()
2672 include_directories : includes,
2673 link_with : [lib_common, logindefs_c],
2674 dependencies : [lib_pam,
2678 build_by_default : opt)
2679 if not is_disabler(exe)
2681 manadocs += ['login-utils/login.1.adoc']
2684 opt = not get_option('build-sulogin').disabled()
2688 include_directories : includes,
2689 link_with : [lib_common],
2690 dependencies : [lib_crypt,
2692 install_dir : sbindir,
2694 build_by_default : opt)
2695 if not is_disabler(exe)
2697 manadocs += ['login-utils/sulogin.8.adoc']
2703 include_directories : includes,
2704 link_with : [lib_common,
2706 dependencies : [curses_libs],
2707 install_dir : usrbin_exec_dir,
2710 manadocs += ['misc-utils/cal.1.adoc']
2711 bashcompletions += ['cal']
2713 opt = not get_option('build-logger').disabled()
2717 include_directories : includes,
2718 link_with : [lib_common],
2719 dependencies : [lib_systemd],
2720 install_dir : usrbin_exec_dir,
2722 build_by_default : opt)
2723 if opt and not is_disabler(exe)
2725 manadocs += ['misc-utils/logger.1.adoc']
2726 bashcompletions += ['logger']
2732 include_directories : includes,
2733 c_args : '-DTEST_LOGGER',
2734 link_with : [lib_common],
2735 dependencies : [lib_systemd],
2736 build_by_default: program_tests)
2737 if not is_disabler(exe)
2744 include_directories : includes,
2745 install_dir : usrbin_exec_dir,
2748 manadocs += ['misc-utils/look.1.adoc']
2749 bashcompletions += ['look']
2754 include_directories : includes,
2755 link_with : [lib_common],
2756 install_dir : usrbin_exec_dir,
2759 manadocs += ['misc-utils/mcookie.1.adoc']
2760 bashcompletions += ['mcookie']
2762 if build_liblastlog2
2766 include_directories : includes,
2767 link_with : [lib_common, lib_lastlog2],
2768 install_dir : usrbin_exec_dir,
2771 manadocs += ['misc-utils/lastlog2.8.adoc']
2772 bashcompletions += ['lastlog2']
2773 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2774 'liblastlog2/man/ll2_write_entry.3.adoc',
2775 'liblastlog2/man/ll2_read_entry.3.adoc',
2776 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2777 'liblastlog2/man/ll2_read_all.3.adoc',
2778 'liblastlog2/man/ll2_remove_entry.3.adoc',
2779 'liblastlog2/man/ll2_rename_user.3.adoc',
2780 'liblastlog2/man/ll2_update_login_time.3.adoc'
2787 include_directories : includes,
2788 dependencies : [lib_selinux],
2789 install_dir : usrbin_exec_dir,
2792 manadocs += ['misc-utils/namei.1.adoc']
2793 bashcompletions += ['namei']
2798 include_directories : includes,
2799 link_with : [lib_common],
2800 install_dir : usrbin_exec_dir,
2803 manadocs += ['misc-utils/whereis.1.adoc']
2804 bashcompletions += ['whereis']
2806 opt = not get_option('build-lslocks').disabled()
2810 include_directories : includes,
2811 link_with : [lib_common,
2813 dependencies : [mount_dep],
2814 install_dir : usrbin_exec_dir,
2816 build_by_default : opt)
2817 if opt and not is_disabler(exe)
2819 manadocs += ['misc-utils/lslocks.8.adoc']
2820 bashcompletions += ['lslocks']
2823 opt = not get_option('build-lsblk').disabled()
2827 include_directories : includes,
2828 link_with : [lib_common,
2831 dependencies : [blkid_dep, lib_udev, mount_dep],
2833 build_by_default : opt)
2834 if opt and not is_disabler(exe)
2836 manadocs += ['misc-utils/lsblk.8.adoc']
2837 bashcompletions += ['lsblk']
2840 errnos_h = custom_target('errnos.h',
2841 input : 'tools/all_errnos',
2842 output : 'errnos.h',
2843 command : ['tools/all_errnos', sed.full_path(),
2844 cc.cmd_array(), get_option('c_args')],
2847 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2850 lsfd_sources, errnos_h,
2851 include_directories : includes,
2852 link_with : [lib_common,
2854 dependencies : [lib_rt],
2855 install_dir : usrbin_exec_dir,
2857 build_by_default : opt)
2858 if opt and not is_disabler(exe)
2860 manadocs += ['lsfd-cmd/lsfd.1.adoc']
2866 include_directories : includes,
2867 link_with : [lib_common,
2869 install_dir : usrbin_exec_dir,
2871 if not is_disabler(exe)
2873 manadocs += ['misc-utils/uuidgen.1.adoc']
2874 bashcompletions += ['uuidgen']
2880 include_directories : includes,
2881 link_with : [lib_common,
2884 install_dir : usrbin_exec_dir,
2886 if not is_disabler(exe)
2888 manadocs += ['misc-utils/uuidparse.1.adoc']
2889 bashcompletions += ['uuidparse']
2896 include_directories : includes,
2897 link_with : [lib_common,
2899 dependencies : [realtime_libs,
2901 install_dir : usrsbin_exec_dir,
2903 build_by_default : opt)
2907 include_directories : includes,
2908 link_with : [lib_common,
2910 dependencies : thread_libs,
2911 build_by_default : opt and program_tests)
2912 if not is_disabler(exe)
2914 manadocs += ['misc-utils/uuidd.8.adoc']
2915 bashcompletions += ['uuidd']
2918 opt = build_libblkid
2922 include_directories : includes,
2923 link_with : [lib_common],
2924 dependencies : [blkid_dep],
2925 install_dir : sbindir,
2927 build_by_default : opt)
2928 if opt and not is_disabler(exe)
2930 manadocs += ['misc-utils/blkid.8.adoc']
2931 bashcompletions += ['blkid']
2934 opt = opt and 'blkid' in static_programs
2938 include_directories : includes,
2939 link_with : [lib_common],
2940 dependencies : [blkid_static_dep],
2941 install_dir : sbindir,
2943 build_by_default : opt)
2944 if opt and not is_disabler(exe)
2950 'libblkid/samples/mkfs.c',
2951 include_directories : includes,
2952 dependencies : [blkid_dep])
2953 if not is_disabler(exe)
2958 'sample-partitions',
2959 'libblkid/samples/partitions.c',
2960 include_directories : includes,
2961 dependencies : [blkid_dep])
2962 if not is_disabler(exe)
2967 'sample-superblocks',
2968 'libblkid/samples/superblocks.c',
2969 include_directories : includes,
2970 dependencies : [blkid_dep])
2971 if not is_disabler(exe)
2977 'libblkid/samples/topology.c',
2978 include_directories : includes,
2979 dependencies : [blkid_dep])
2980 if not is_disabler(exe)
2985 'test_blkid_fuzz_sample',
2986 'libblkid/src/fuzz.c',
2987 include_directories: includes,
2988 dependencies : [blkid_dep],
2989 build_by_default: program_tests)
2990 if not is_disabler(exe)
2994 ############################################################
2999 include_directories : includes,
3000 dependencies : [blkid_dep],
3001 install_dir : sbindir,
3003 if not is_disabler(exe)
3005 manadocs += ['misc-utils/findfs.8.adoc']
3006 bashcompletions += ['findfs']
3012 include_directories : includes,
3013 link_with : [lib_common,
3015 dependencies : [blkid_dep],
3016 install_dir : sbindir,
3018 if not is_disabler(exe)
3020 manadocs += ['misc-utils/wipefs.8.adoc']
3021 bashcompletions += ['wipefs']
3024 opt = not get_option('build-findmnt').disabled()
3028 include_directories : includes,
3029 link_with : [lib_common,
3031 dependencies : [blkid_dep, lib_udev, mount_dep],
3033 build_by_default : opt)
3034 if opt and not is_disabler(exe)
3036 manadocs += ['misc-utils/findmnt.8.adoc']
3037 bashcompletions += ['findmnt']
3043 include_directories : includes,
3044 link_with : [lib_common],
3046 if not is_disabler(exe)
3048 manadocs += ['misc-utils/kill.1.adoc']
3051 opt = not get_option('build-rename').disabled()
3055 include_directories : includes,
3056 install_dir : usrbin_exec_dir,
3058 build_by_default : opt)
3059 if opt and not is_disabler(exe)
3061 manadocs += ['misc-utils/rename.1.adoc']
3062 bashcompletions += ['rename']
3068 include_directories : includes,
3069 link_with : [lib_common],
3070 install_dir : usrbin_exec_dir,
3073 manadocs += ['misc-utils/getopt.1.adoc']
3074 bashcompletions += ['getopt']
3079 include_directories : includes,
3080 link_with : [lib_common,
3082 install_dir : usrbin_exec_dir,
3084 if not is_disabler(exe)
3086 manadocs += ['misc-utils/fincore.1.adoc']
3087 bashcompletions += ['fincore']
3093 include_directories : includes,
3094 link_with : [lib_common],
3095 install_dir : usrbin_exec_dir,
3097 if not is_disabler(exe)
3099 manadocs += ['misc-utils/hardlink.1.adoc']
3100 bashcompletions += ['hardlink']
3103 opt = get_option('build-pipesz').allowed()
3107 include_directories : includes,
3108 link_with : [lib_common],
3109 install_dir : usrbin_exec_dir,
3111 build_by_default : opt)
3112 if opt and not is_disabler(exe)
3114 manadocs += ['misc-utils/pipesz.1.adoc']
3115 bashcompletions += ['pipesz']
3121 include_directories : includes,
3122 c_args : '-DTEST_CAL',
3123 link_with : [lib_common,
3125 dependencies : [curses_libs],
3126 build_by_default: program_tests)
3127 if not is_disabler(exe)
3131 have_posix_fadvise = conf.get('HAVE_POSIX_FADVISE').to_string() == '1'
3133 opt = get_option('build-fadvise').require(have_posix_fadvise).allowed()
3137 include_directories : includes,
3138 link_with : [lib_common],
3139 install_dir : usrbin_exec_dir,
3141 build_by_default : opt)
3142 if opt and not is_disabler(exe)
3144 manadocs += ['misc-utils/fadvise.1.adoc']
3145 bashcompletions += ['fadvise']
3148 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3152 include_directories : includes,
3153 link_with : [lib_common],
3154 install_dir : usrbin_exec_dir,
3156 if not is_disabler(exe)
3158 manadocs += ['misc-utils/waitpid.1.adoc']
3159 bashcompletions += ['waitpid']
3163 syscalls_h = custom_target('syscalls.h',
3164 input : 'tools/all_syscalls',
3165 output : 'syscalls.h',
3166 command : ['tools/all_syscalls', sed.full_path(),
3167 cc.cmd_array(), get_option('c_args')],
3170 have_linux_audit_h = cc.has_header('linux/audit.h')
3171 have_audit_arch_native = cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3173 opt = get_option('build-enosys').require(have_linux_audit_h and have_audit_arch_native).allowed()
3176 'misc-utils/enosys.c', syscalls_h, errnos_h,
3177 include_directories : includes,
3178 link_with : [lib_common],
3179 install_dir : usrbin_exec_dir,
3181 build_by_default : opt)
3182 if opt and not is_disabler(exe)
3184 manadocs += ['misc-utils/enosys.1.adoc']
3185 bashcompletions += ['enosys']
3188 opt = get_option('build-lsclocks').require(have_linux_rtc_h).allowed()
3192 include_directories : includes,
3193 link_with : [lib_common, lib_smartcols],
3194 install_dir : usrbin_exec_dir,
3196 build_by_default : opt)
3197 if opt and not is_disabler(exe)
3199 manadocs += ['misc-utils/lsclocks.1.adoc']
3200 bashcompletions += ['lsclocks']
3203 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3207 include_directories : includes,
3208 link_with : [lib_common],
3209 install_dir : usrbin_exec_dir,
3211 if not is_disabler(exe)
3213 manadocs += ['misc-utils/exch.1.adoc']
3214 bashcompletions += ['exch']
3218 ############################################################
3220 opt = not get_option('build-schedutils').disabled()
3223 'schedutils/chrt.c',
3224 include_directories : includes,
3225 link_with : lib_common,
3226 install_dir : usrbin_exec_dir,
3228 build_by_default : opt)
3232 'schedutils/ionice.c',
3233 include_directories : includes,
3234 link_with : lib_common,
3235 install_dir : usrbin_exec_dir,
3237 build_by_default : opt)
3241 'schedutils/taskset.c',
3242 include_directories : includes,
3243 link_with : lib_common,
3244 install_dir : usrbin_exec_dir,
3246 build_by_default : opt)
3250 'schedutils/uclampset.c',
3251 include_directories : includes,
3252 link_with : lib_common,
3253 install_dir : usrbin_exec_dir,
3255 build_by_default : opt)
3259 'schedutils/coresched.c',
3260 include_directories : includes,
3261 link_with : lib_common,
3262 install_dir : usrbin_exec_dir,
3264 build_by_default : opt)
3266 if opt and not is_disabler(exe)
3267 exes += [exe, exe2, exe3, exe4, exe5]
3268 manadocs += ['schedutils/chrt.1.adoc',
3269 'schedutils/ionice.1.adoc',
3270 'schedutils/taskset.1.adoc',
3271 'schedutils/uclampset.1.adoc',
3272 'schedutils/coresched.1.adoc']
3273 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset', 'coresched']
3276 ############################################################
3278 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3283 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3284 include_directories : dir_include,
3285 link_with : lib_common,
3286 build_by_default: program_tests)
3292 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3293 include_directories : dir_include,
3294 link_with : lib_common,
3295 build_by_default: program_tests)
3301 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3302 include_directories : dir_include,
3303 link_with : lib_common,
3304 build_by_default: program_tests)
3310 c_args : ['-DTEST_PROGRAM_MANGLE'],
3311 include_directories : dir_include,
3312 build_by_default: program_tests)
3318 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3319 include_directories : dir_include,
3320 build_by_default: program_tests)
3326 'lib/color-names.c',
3327 c_args : ['-DTEST_PROGRAM_COLORS'],
3328 include_directories : dir_include,
3329 link_with : [lib_common, lib_tcolors],
3330 build_by_default: program_tests)
3336 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3337 include_directories : dir_include,
3338 build_by_default: program_tests)
3341 if conf.get('HAVE_OPENAT').to_string() == '1' \
3342 and conf.get('HAVE_DIRFD').to_string() == '1'
3346 c_args : ['-DTEST_PROGRAM_PROCFS'],
3347 include_directories : dir_include,
3348 link_with : lib_common,
3349 build_by_default: program_tests)
3356 have_cpu_set_t ? 'lib/cpuset.c' : [],
3357 c_args : ['-DTEST_PROGRAM_PATH'],
3358 include_directories : dir_include,
3359 link_with : lib_common,
3360 build_by_default: program_tests)
3369 c_args : ['-DTEST_PROGRAM_PTY'],
3370 include_directories : dir_include,
3371 link_with : [lib_common],
3372 dependencies : [lib_m,
3375 build_by_default: program_tests)
3383 c_args : ['-DTEST_PROGRAM_CPUSET'],
3384 include_directories : dir_include,
3385 build_by_default: program_tests)
3396 have_cpu_set_t ? 'lib/cpuset.c' : [],
3397 c_args : ['-DTEST_PROGRAM_SYSFS'],
3398 include_directories : dir_include,
3399 build_by_default: program_tests)
3405 c_args : ['-DTEST_PROGRAM_PAGER'],
3406 include_directories : dir_include,
3407 build_by_default: program_tests)
3411 'test_linux_version',
3412 'lib/linux_version.c',
3413 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3414 include_directories : dir_include,
3415 build_by_default: program_tests)
3421 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3422 include_directories : dir_include,
3423 build_by_default: program_tests)
3427 'test_canonicalize',
3428 'lib/canonicalize.c',
3429 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3430 include_directories : dir_include,
3431 build_by_default: program_tests)
3438 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3439 include_directories : dir_include,
3440 build_by_default: program_tests)
3446 c_args : ['-DTEST_PROGRAM'],
3447 include_directories : dir_include,
3448 link_with : lib_common,
3449 build_by_default: program_tests)
3455 c_args : ['-DTEST_PROGRAM'],
3456 include_directories : dir_include,
3457 link_with : [lib_common, logindefs_c],
3458 build_by_default: program_tests)
3462 ############################################################
3466 'libuuid/src/test_uuid.c',
3467 include_directories : [dir_include, dir_libuuid],
3468 link_with : lib_uuid,
3469 dependencies : socket_libs,
3470 build_by_default: program_tests)
3471 if not is_disabler(exe)
3475 ############################################################
3477 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3478 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid]
3479 libfdisk_tests_ldadd_deps = [blkid_dep]
3483 'libfdisk/src/ask.c',
3484 c_args : libfdisk_tests_cflags,
3485 include_directories : lib_fdisk_includes,
3486 link_with : libfdisk_tests_ldadd,
3487 dependencies : libfdisk_tests_ldadd_deps,
3488 build_by_default: program_tests)
3489 if not is_disabler(exe)
3495 'libfdisk/src/gpt.c',
3496 c_args : libfdisk_tests_cflags,
3497 include_directories : lib_fdisk_includes,
3498 link_with : libfdisk_tests_ldadd,
3499 dependencies : libfdisk_tests_ldadd_deps,
3500 build_by_default: program_tests)
3501 if not is_disabler(exe)
3507 'libfdisk/src/utils.c',
3508 c_args : libfdisk_tests_cflags,
3509 include_directories : lib_fdisk_includes,
3510 link_with : libfdisk_tests_ldadd,
3511 dependencies : libfdisk_tests_ldadd_deps,
3512 build_by_default: program_tests)
3513 if not is_disabler(exe)
3518 'test_fdisk_script',
3519 'libfdisk/src/script.c',
3520 c_args : libfdisk_tests_cflags,
3521 include_directories : lib_fdisk_includes,
3522 link_with : libfdisk_tests_ldadd,
3523 dependencies : libfdisk_tests_ldadd_deps,
3524 build_by_default: program_tests)
3525 if not is_disabler(exe)
3530 'test_fdisk_version',
3531 'libfdisk/src/version.c',
3532 c_args : libfdisk_tests_cflags,
3533 include_directories : lib_fdisk_includes,
3534 link_with : libfdisk_tests_ldadd,
3535 dependencies : libfdisk_tests_ldadd_deps,
3536 build_by_default: program_tests)
3537 if not is_disabler(exe)
3543 'libfdisk/src/item.c',
3544 c_args : libfdisk_tests_cflags,
3545 include_directories : lib_fdisk_includes,
3546 link_with : libfdisk_tests_ldadd,
3547 dependencies : libfdisk_tests_ldadd_deps,
3548 build_by_default: program_tests)
3549 if not is_disabler(exe)
3553 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3556 'sample-fdisk-mkpart',
3557 'libfdisk/samples/mkpart.c',
3558 include_directories : lib_fdisk_includes,
3559 link_with : sample_fdisk_ldadd)
3560 if not is_disabler(exe)
3565 'sample-fdisk-mkpart-fullspec',
3566 'libfdisk/samples/mkpart-fullspec.c',
3567 include_directories : lib_fdisk_includes,
3568 link_with : sample_fdisk_ldadd)
3569 if not is_disabler(exe)
3573 ############################################################
3577 'tests/helpers/test_cap.c',
3578 include_directories : includes,
3579 dependencies : [lib_cap_ng],
3580 build_by_default: program_tests)
3581 if not is_disabler(exe)
3587 'tests/helpers/test_mbsencode.c',
3588 include_directories : includes,
3589 link_with : lib_common,
3590 build_by_default: program_tests)
3595 'tests/helpers/test_byteswap.c',
3596 include_directories : includes,
3597 build_by_default: program_tests)
3602 'tests/helpers/test_md5.c',
3604 include_directories : includes,
3605 build_by_default: program_tests)
3610 'tests/helpers/test_sha1.c',
3612 include_directories : includes,
3613 build_by_default: program_tests)
3618 'tests/helpers/test_pathnames.c',
3619 include_directories : includes,
3620 build_by_default: program_tests)
3625 'tests/helpers/test_strerror.c',
3626 include_directories : includes,
3627 build_by_default: program_tests)
3632 'tests/helpers/test_sysinfo.c',
3633 include_directories : includes,
3634 build_by_default: program_tests)
3639 'tests/helpers/test_sigreceive.c',
3640 include_directories : includes,
3641 link_with : lib_common,
3642 build_by_default: program_tests)
3647 'tests/helpers/test_tiocsti.c',
3648 include_directories : includes,
3649 build_by_default: program_tests)
3653 'test_uuid_namespace',
3654 'tests/helpers/test_uuid_namespace.c',
3658 include_directories : includes,
3659 build_by_default: program_tests)
3662 if LINUX and lib_rt.found()
3665 'tests/helpers/test_mkfds.c',
3666 'tests/helpers/test_mkfds.h',
3667 'tests/helpers/test_mkfds_ppoll.c',
3668 include_directories : includes,
3669 dependencies : [lib_rt],
3670 build_by_default: program_tests)
3676 'tests/helpers/test_enosys.c',
3677 include_directories : includes,
3678 build_by_default: program_tests)
3681 ############################################################
3683 if conf.get('HAVE_OPENAT').to_string() == '1'
3685 'sample-scols-tree',
3686 'libsmartcols/samples/tree.c',
3687 include_directories : includes,
3688 link_with : [lib_smartcols, lib_common],
3689 build_by_default: program_tests)
3690 if not is_disabler(exe)
3696 'sample-scols-title',
3697 'libsmartcols/samples/title.c',
3698 include_directories : includes,
3699 link_with : [lib_smartcols, lib_common])
3700 if not is_disabler(exe)
3705 'sample-scols-wrap',
3706 'libsmartcols/samples/wrap.c',
3707 include_directories : includes,
3708 link_with : [lib_smartcols, lib_common])
3709 if not is_disabler(exe)
3714 'sample-scols-continuous',
3715 'libsmartcols/samples/continuous.c',
3716 include_directories : includes,
3717 link_with : [lib_smartcols, lib_common])
3718 if not is_disabler(exe)
3723 'sample-scols-continuous-json',
3724 'libsmartcols/samples/continuous-json.c',
3725 include_directories : includes,
3726 link_with : [lib_smartcols, lib_common])
3727 if not is_disabler(exe)
3732 'sample-scols-maxout',
3733 'libsmartcols/samples/maxout.c',
3734 include_directories : includes,
3735 link_with : [lib_smartcols, lib_common])
3736 if not is_disabler(exe)
3741 'sample-scols-fromfile',
3742 'libsmartcols/samples/fromfile.c',
3743 include_directories : includes,
3744 link_with : [lib_smartcols, lib_common])
3745 if not is_disabler(exe)
3750 'sample-scols-grouping-simple',
3751 'libsmartcols/samples/grouping-simple.c',
3752 include_directories : includes,
3753 link_with : [lib_smartcols, lib_common])
3754 if not is_disabler(exe)
3759 'sample-scols-grouping-overlay',
3760 'libsmartcols/samples/grouping-overlay.c',
3761 include_directories : includes,
3762 link_with : [lib_smartcols, lib_common])
3763 if not is_disabler(exe)
3769 'Documentation/boilerplate.c',
3770 include_directories : includes,
3771 build_by_default: program_tests)
3772 if not is_disabler(exe)
3776 ############################################################
3778 # Let the test runner know whether we're running under asan and export
3779 # some paths. We use a file on disk so that it is possible to run the
3780 # test scripts from commandline without setting any variables.
3781 configure_file(output : 'meson.conf',
3786 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3787 python.full_path())])
3789 run_sh = find_program('tests/run.sh')
3793 '--srcdir=' + meson.current_source_dir(),
3794 '--builddir=' + meson.current_build_dir(),
3800 manadocs += ['lib/terminal-colors.d.5.adoc']
3801 manadocs += ['libblkid/libblkid.3.adoc']
3805 'libuuid/man/uuid.3.adoc',
3806 'libuuid/man/uuid_clear.3.adoc',
3807 'libuuid/man/uuid_compare.3.adoc',
3808 'libuuid/man/uuid_copy.3.adoc',
3809 'libuuid/man/uuid_generate.3.adoc',
3810 'libuuid/man/uuid_is_null.3.adoc',
3811 'libuuid/man/uuid_parse.3.adoc',
3812 'libuuid/man/uuid_time.3.adoc',
3813 'libuuid/man/uuid_unparse.3.adoc']
3815 'uuid_generate_random.3': 'uuid_generate.3',
3816 'uuid_generate_time.3': 'uuid_generate.3',
3817 'uuid_generate_time_safe.3': 'uuid_generate.3',
3821 asciidoctor = find_program('asciidoctor', required : false)
3822 if asciidoctor.found()
3823 foreach adoc : manadocs
3824 name = adoc.split('/')[-1]
3825 page = name.split('.adoc')[0]
3826 section = page.split('.')[-1]
3827 mandirn = join_paths(mandir, 'man' + section)
3832 command : [ asciidoctor,
3834 '-a', 'VERSION=' + meson.project_version(),
3835 '-a', 'release-version=' + meson.project_version(),
3836 '-a', 'ADJTIME_PATH=/etc/adjtime',
3837 '-a', 'package-docdir=' + docdir,
3838 '--base-dir=' + meson.current_source_dir(),
3839 '--destination-dir=' + meson.current_build_dir(),
3840 '--load-path', '@SOURCE_ROOT@/tools',
3841 '--require', 'asciidoctor-includetracker',
3845 depfile : page + '.deps',
3847 install_dir : mandirn)
3850 foreach link_name, target : manlinks
3851 link_section = link_name.split('.')[-1]
3852 target_section = target.split('.')[-1]
3853 meson.add_install_script(meson_make_manpage_stub,
3854 join_paths('man' + target_section, target),
3855 join_paths(mandir, 'man' + link_section, link_name))
3859 if bash_completion.found()
3860 foreach completion : bashcompletions
3862 join_paths('bash-completion', completion),
3863 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3866 foreach link_name, target : bashcompletionslinks
3867 meson.add_install_script(meson_make_symlink,
3869 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))