1 project('util-linux', 'c',
2 version : run_command('tools/git-version-gen', check: true).stdout(),
3 meson_version: '>=0.60.0',
11 pkgconfig = import('pkgconfig')
13 # soname versions; This never change because we use symbols versioing. There is also
14 # API version (LIB*_VERSION macros) and it follow package version.
15 libblkid_version = '1.1.0'
16 libblkid_date = '01-Jun-2021'
17 libuuid_version = '1.3.0'
18 liblastlog2_version = '2.0.0'
19 libmount_version = '1.1.0'
20 libsmartcols_version = '1.1.0'
21 libfdisk_version = '1.1.0'
23 prefixdir = get_option('prefix')
24 if not prefixdir.startswith('/')
25 error('Prefix is not absolute: "@0@"'.format(prefixdir))
27 bindir = join_paths(prefixdir, get_option('bindir'))
28 sbindir = join_paths(prefixdir, get_option('sbindir'))
29 sysconfstaticdir = join_paths(prefixdir, 'lib')
30 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
31 mandir = join_paths(prefixdir, get_option('mandir'))
33 localstatedir = '/var'
34 execprefixdir = prefixdir
35 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
36 usrbin_exec_dir = join_paths(execprefixdir, bindir)
37 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
38 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
40 vendordir = get_option('vendordir')
42 add_project_arguments('-D_GNU_SOURCE', '-fsigned-char', language : 'c')
44 cc = meson.get_compiler('c')
46 conf = configuration_data()
47 conf.set_quoted('PACKAGE', meson.project_name())
48 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
49 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
50 conf.set_quoted('PACKAGE_STRING', package_string)
53 pc_version = meson.project_version().split('-')[0].split('.')
55 if pc_version.length() < 3
59 pc_version = '.'.join(pc_version)
61 conf.set_quoted('LIBBLKID_VERSION', pc_version)
62 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
64 conf.set('bindir', bindir)
65 conf.set('sbindir', sbindir)
66 conf.set('runstatedir', runstatedir)
67 conf.set('localstatedir', localstatedir)
68 conf.set('sysconfdir', sysconfdir)
69 conf.set('usrbin_execdir', usrbin_exec_dir)
70 conf.set('usrsbin_execdir', usrsbin_exec_dir)
71 conf.set('docdir', docdir)
72 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
73 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
74 conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir)
75 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
76 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
78 conf.set_quoted('_PATH_VENDORDIR', vendordir)
79 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
81 build_libblkid = not get_option('build-libblkid').require(get_option('build-libmount').allowed()).disabled()
82 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
83 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
85 build_libuuid = not get_option('build-libuuid').disabled()
86 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
87 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
89 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 build_libmount = get_option('build-libmount').require(get_option('build-libblkid').allowed()).allowed()
107 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
108 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
109 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
110 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
112 build_libsmartcols = not get_option('build-libsmartcols').disabled()
113 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
114 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
116 build_libfdisk = not get_option('build-libfdisk').require(get_option('build-libblkid').allowed()).disabled()
117 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
118 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
120 build_uuidd = not get_option('build-uuidd').disabled()
121 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
122 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
124 static_programs = get_option('static-programs')
125 need_static_libs = static_programs.length() > 0 # a rough estimate...
126 summary('static programs', static_programs)
128 LINUX = host_machine.system() in ['linux']
129 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
131 ############################################################
149 have = cc.compiles(code, name : 'wchar_t support')
150 if not have and get_option('widechar').enabled()
151 error('widechar support requested but unavailable')
153 if get_option('ncurses').enabled() and get_option('widechar').enabled()
154 error('widechar support is incompatible with non-wide ncurses')
156 conf.set('HAVE_WIDECHAR', have ? 1 : false)
198 linux/net_namespace.h
212 security/pam_modules.h
245 lib_m = cc.find_library('m')
247 lib_tinfo = dependency(
249 required : get_option('tinfo'))
251 lib_ncursesw = dependency(
253 required : get_option('ncursesw'))
254 if lib_ncursesw.found()
255 headers += ['ncursesw/ncurses.h',
259 lib_ncurses = disabler()
261 lib_ncurses = dependency(
263 required : get_option('ncurses'))
264 headers += ['ncurses.h',
268 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
269 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
270 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
272 lib_slang = dependency(
274 required : get_option('slang'))
276 headers += ['slang.h',
281 conf.set('HAVE_SLANG', lib_slang.found())
283 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
284 if curses_libs.found()
285 have = cc.has_function('use_default_colors', dependencies : curses_libs)
286 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
287 have = cc.has_function('resizeterm', dependencies : curses_libs)
288 conf.set('HAVE_RESIZETERM', have ? 1 : false)
295 required : get_option('zlib'))
297 lib_readline = dependency(
299 required : get_option('readline'))
300 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
302 lib_readline_static = dependency(
305 required : need_static_libs ? get_option('readline') : disabler())
307 if meson.version().version_compare('>= 0.59.0')
308 lib_intl = dependency(
310 required : get_option('nls'))
311 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
313 if get_option('nls').enabled()
314 error('nls is not supported with meson before 0.59.0')
316 lib_intl = dependency('', required : false)
319 lib_user = dependency(
322 required : get_option('libuser'))
323 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
325 lib_util = cc.find_library(
327 required : get_option('libutil'))
328 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
330 lib_utempter = cc.find_library(
332 required : get_option('libutempter'))
333 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
335 systemd = dependency(
337 required : get_option('systemd'))
339 lib_systemd = dependency(
341 required : get_option('systemd'))
342 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
343 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
345 have = cc.has_function(
346 'sd_session_get_username',
347 dependencies : lib_systemd)
348 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
350 lib_udev = dependency(
352 required : get_option('systemd'))
353 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
355 lib_crypt = cc.find_library('crypt', required : get_option('build-newgrp'))
356 if not lib_crypt.found()
357 lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin'))
360 lib_pam = cc.find_library('pam', required : get_option('build-login'))
361 if not lib_pam.found()
362 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
364 if not lib_pam.found()
365 lib_pam = cc.find_library('pam', required : get_option('build-su'))
367 if not lib_pam.found()
368 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
371 lib_pam_misc = cc.find_library('pam_misc')
372 lib_pam = [lib_pam, lib_pam_misc]
374 lib_pam_misc = declare_dependency()
377 lib_cryptsetup = dependency(
379 required : get_option('cryptsetup'))
380 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
382 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
384 if meson.version().version_compare('>= 0.62.0')
385 lib_dl = dependency('dl')
387 lib_dl = cc.find_library('dl')
389 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
390 summary('cryptsetup support (dlopen)',
392 section : 'components')
394 summary('cryptsetup support',
395 lib_cryptsetup.found() ? 'enabled' : 'disabled',
396 section : 'components')
399 have = cc.has_function(
400 'crypt_activate_by_signed_key',
401 dependencies : lib_cryptsetup)
402 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
404 lib_cap_ng = dependency(
406 required : get_option('build-setpriv'))
407 if not lib_cap_ng.found()
408 lib_cap_ng = disabler()
411 lib_selinux = dependency(
414 required : get_option('selinux'))
415 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
417 lib_magic = dependency(
419 required : get_option('magic'))
420 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
422 lib_econf = dependency(
424 required : get_option('econf'))
425 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
427 lib_audit = dependency(
429 required : get_option('audit'))
430 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
432 conf.set('HAVE_SMACK', not get_option('smack').disabled())
435 foreach header : headers
436 have = cc.has_header(header)
437 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
440 header = 'linux/btrfs.h'
441 enable_btrfs = cc.has_header(header,
442 required : get_option('btrfs'))
443 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
444 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
446 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
451 have = cc.has_header(header,
453 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
456 have = cc.has_header('sched.h')
457 conf.set10('HAVE_DECL_CPU_ALLOC', have)
458 # We get -1 if the size cannot be determined
459 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
460 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
462 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
463 conf.set('HAVE_ENVIRON_DECL', have ? 1 : false)
465 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
466 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
468 have = cc.has_function('strsignal')
469 conf.set10('HAVE_STRSIGNAL_DECL', have)
471 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
472 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
474 have = cc.has_type('loff_t',
475 args : '-D_GNU_SOURCE',
476 prefix : '#include <sys/types.h>')
477 conf.set('HAVE_LOFF_T', have ? 1 : false)
479 have = cc.compiles('''
480 #define _GNU_SOURCE 1
481 #include <langinfo.h>
484 str = nl_langinfo (ALTMON_1);
485 str = nl_langinfo (ALTMON_2);
486 str = nl_langinfo (ALTMON_3);
487 str = nl_langinfo (ALTMON_4);
488 str = nl_langinfo (ALTMON_5);
489 str = nl_langinfo (ALTMON_6);
490 str = nl_langinfo (ALTMON_7);
491 str = nl_langinfo (ALTMON_8);
492 str = nl_langinfo (ALTMON_9);
493 str = nl_langinfo (ALTMON_10);
494 str = nl_langinfo (ALTMON_11);
495 str = nl_langinfo (ALTMON_12);
499 name : 'langinfo.h defines ALTMON_x constants')
500 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
502 have = cc.compiles('''
503 #define _GNU_SOURCE 1
504 #include <langinfo.h>
507 str = nl_langinfo (_NL_ABALTMON_1);
508 str = nl_langinfo (_NL_ABALTMON_2);
509 str = nl_langinfo (_NL_ABALTMON_3);
510 str = nl_langinfo (_NL_ABALTMON_4);
511 str = nl_langinfo (_NL_ABALTMON_5);
512 str = nl_langinfo (_NL_ABALTMON_6);
513 str = nl_langinfo (_NL_ABALTMON_7);
514 str = nl_langinfo (_NL_ABALTMON_8);
515 str = nl_langinfo (_NL_ABALTMON_9);
516 str = nl_langinfo (_NL_ABALTMON_10);
517 str = nl_langinfo (_NL_ABALTMON_11);
518 str = nl_langinfo (_NL_ABALTMON_12);
522 name : 'langinfo.h defines _NL_ABALTMON_x constants')
523 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
525 have = cc.compiles('''
526 #define _GNU_SOURCE 1
527 #include <langinfo.h>
530 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
534 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
535 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
568 landlock_create_ruleset
570 landlock_restrict_self
633 have = cc.has_function(func)
634 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
635 # This makes little sense, but is necessary to avoid warnings about
636 # redefined macros from Python.h, which uses this convention.
637 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
640 have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
641 conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false)
643 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
644 conf.set('AGETTY_RELOAD', have ? 1 : false)
646 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
649 have_dirfd = (cc.has_function('dirfd') or
650 cc.has_header_symbol('dirent.h', 'dirfd',
651 prefix : '#include <sys/types.h>'))
652 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
654 have_ddfd = cc.has_member('DIR', 'dd_fd',
656 #include <sys/types.h>
659 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
661 have = cc.has_member('struct tm', 'tm_gmtoff',
662 args : '-D_GNU_SOURCE',
667 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
671 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
672 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
674 have = cc.has_member('struct termios', 'c_line',
675 prefix : '#include <termios.h>')
676 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
678 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
679 args : '-D_GNU_SOURCE',
680 prefix : '#include <sys/stat.h>')
681 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
683 have = cc.has_member('struct statx', 'stx_mnt_id',
684 prefix : '#include <sys/stat.h>')
685 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
687 # replacement for AC_STRUCT_TIMEZONE
688 have = cc.has_member('struct tm', 'tm_zone',
689 args : '-D_GNU_SOURCE',
690 prefix : '#include <time.h>')
691 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
693 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
694 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
696 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
697 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
699 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
700 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
705 extern char *tzname[];
708 return tzname ? 0 : 1;
710 '''.format(have ? 1 : 0)
711 have = cc.compiles(code, name : 'using tzname[]')
712 conf.set('HAVE_TZNAME', have ? 1 : false)
714 have = cc.sizeof('time_t', prefix : '#include <time.h>')
716 add_global_arguments('-D_TIME_BITS=64', language : 'c')
717 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
719 if get_option('allow-32bit-time')
720 warning('Could not make time_t 64bits wide')
722 error('Could not make time_t 64bits wide')
728 if not cc.has_function('socket')
729 socket_libs += cc.find_library('socket', required : true)
730 have = cc.has_function('socket',
731 dependencies : socket_libs)
733 error('socket() function not available')
737 lib_rt = cc.find_library('rt', required : false)
739 have = cc.has_function('clock_gettime')
742 realtime_libs += lib_rt
743 have = cc.has_function('clock_gettime',
744 dependencies : realtime_libs)
747 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
749 thread_libs = dependency('threads')
751 have = cc.has_function('timer_create')
754 realtime_libs = [lib_rt]
755 have = cc.has_function('timer_create',
756 dependencies : realtime_libs)
759 realtime_libs += thread_libs
760 have = cc.has_function('timer_create',
761 dependencies : realtime_libs)
764 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
766 have = cc.has_function('setitimer')
767 conf.set('HAVE_SETITIMER', have ? 1 : false)
770 rtas_libs = cc.find_library('rtas', required : false)
771 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
774 if not cc.has_header_symbol('math.h', 'isnan')
775 lib = cc.find_library('m', required : true)
776 if (cc.has_function('isnan', dependencies : lib) and
777 cc.has_function('__isnan', dependencies : lib))
782 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
783 args : '-D_GNU_SOURCE')
784 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
787 extern char *__progname;
789 return (*__progname != 0);
792 have = cc.compiles(code, name : 'using __progname')
793 conf.set('HAVE___PROGNAME', have ? 1 : false)
795 have = conf.get('HAVE_PTY_H').to_string() == '1' \
796 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
797 conf.set('HAVE_PTY', have ? 1 : false)
799 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
800 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
802 build_plymouth_support = get_option('build-plymouth-support')
803 have_tiocglcktrmios = cc.has_header_symbol(
804 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
805 required : build_plymouth_support.enabled())
806 have_sock_cloexec = cc.has_header_symbol(
807 'sys/socket.h', 'SOCK_CLOEXEC',
808 prefix : '#include <sys/types.h>',
809 required : build_plymouth_support.enabled())
810 have_sock_nonblock = cc.has_header_symbol(
811 'sys/socket.h', 'SOCK_NONBLOCK',
812 prefix : '#include <sys/types.h>',
813 required : build_plymouth_support.enabled())
814 have_so_passcred = cc.has_header_symbol(
815 'sys/socket.h', 'SO_PASSCRED',
816 args : ['-D_GNU_SOURCE'],
817 prefix : '#include <sys/types.h>',
818 required : build_plymouth_support.enabled())
820 build_plymouth_support = (not build_plymouth_support.disabled() and
821 have_tiocglcktrmios and
822 have_sock_cloexec and
823 have_sock_nonblock and
825 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
826 summary('plymouth support',
827 build_plymouth_support ? 'enabled' : 'disabled',
828 section : 'components')
830 # check for valid fallocate() function
831 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
832 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
833 # and program can't be linked.
841 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
842 return ret == 0 ? 0 : 1;
845 have = cc.links(code, name : 'fallocate() function')
846 conf.set('HAVE_FALLOCATE', have ? 1 : false)
854 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
855 return ret == 0 ? 0 : 1;
858 have = cc.links(code, name : 'posix_fallocate() function')
859 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
861 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
862 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
863 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
865 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
866 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
867 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
869 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
871 ############################################################
874 fs_search_path = get_option('fs-search-path')
875 fs_search_path_extra = get_option('fs-search-path-extra')
876 if fs_search_path_extra != ''
877 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
879 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
881 systemdsystemunitdir = ''
883 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
886 sysvinit = get_option('sysvinit').enabled()
887 sysvinitrcdir = sysconfdir + '/init.d'
889 program_tests = get_option('program-tests')
891 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
892 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
894 have = get_option('chsh-only-listed')
895 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
897 have = get_option('use-tty-group')
898 conf.set('USE_TTY_GROUP', have ? 1 : false)
900 bison = find_program('bison')
901 flex = find_program('flex')
903 build_hwclock = not get_option('build-hwclock').disabled()
904 bison_gen = generator(
906 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
907 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
909 python_module = import('python')
910 python = python_module.find_installation(
911 get_option('python'),
915 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
916 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
920 configuration : conf)
922 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
927 '-Waddress-of-packed-member',
928 '-Wdiscarded-qualifiers',
929 '-Wembedded-directive',
932 '-Wimplicit-function-declaration',
933 '-Wmissing-declarations',
934 '-Wmissing-parameter-type',
935 '-Wmissing-prototypes',
937 '-Wno-missing-field-initializers',
938 '-Wold-style-definition',
942 '-Wstrict-prototypes',
945 '-Wunused-but-set-parameter',
946 '-Wunused-but-set-variable',
947 '-Wunused-parameter',
953 foreach compiler_flag : compiler_flags
954 if cc.has_argument(compiler_flag)
955 add_project_arguments(compiler_flag, language : 'c')
963 bashcompletionslinks = {}
969 subdir('libsmartcols')
971 subdir('liblastlog2')
973 subdir('pam_lastlog2')
974 subdir('login-utils')
982 includes = [dir_include,
991 opt = not get_option('build-chfn-chsh').disabled()
996 include_directories : includes,
997 link_with : [lib_common, logindefs_c],
998 dependencies : chfn_chsh_deps,
999 install_dir : usrbin_exec_dir,
1000 install_mode : 'rwsr-xr-x',
1002 build_by_default : opt)
1006 'login-utils/chsh.c',
1009 include_directories : includes,
1010 link_with : lib_common,
1011 dependencies : chfn_chsh_deps,
1012 install_dir : usrbin_exec_dir,
1013 install_mode : 'rwsr-xr-x',
1015 build_by_default : opt)
1016 if opt and not is_disabler(exe)
1018 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1019 bashcompletions += ['chfn', 'chsh']
1024 test_islocal_sources,
1025 include_directories : includes,
1026 c_args : '-DTEST_PROGRAM',
1027 build_by_default : program_tests)
1032 test_consoles_sources,
1033 c_args : ['-DTEST_PROGRAM'],
1034 include_directories : includes,
1035 link_with : lib_common,
1036 build_by_default : program_tests)
1039 opt = not get_option('build-last').disabled()
1043 include_directories : includes,
1044 link_with : [lib_common],
1045 install_dir : usrbin_exec_dir,
1047 build_by_default : opt)
1048 if opt and not is_disabler(exe)
1050 meson.add_install_script(meson_make_symlink,
1052 join_paths(usrbin_exec_dir, 'lastb'))
1053 manadocs += ['login-utils/last.1.adoc']
1054 manlinks += {'lastb.1': 'last.1'}
1055 bashcompletions += ['last']
1056 bashcompletionslinks += {'lastb': 'last'}
1059 opt = not get_option('build-nologin').disabled()
1062 'login-utils/nologin.c',
1063 include_directories : includes,
1064 install_dir : sbindir,
1065 link_with : [lib_common],
1067 build_by_default : opt)
1068 if opt and not is_disabler(exe)
1070 manadocs += ['login-utils/nologin.8.adoc']
1073 opt = not get_option('build-utmpdump').disabled()
1076 'login-utils/utmpdump.c',
1077 include_directories : includes,
1078 link_with : [lib_common],
1079 install_dir : usrbin_exec_dir,
1081 build_by_default : opt)
1082 if opt and not is_disabler(exe)
1084 manadocs += ['login-utils/utmpdump.1.adoc']
1085 bashcompletions += ['utmpdump']
1088 opt = not get_option('build-su').disabled()
1092 'login-utils/su-common.c',
1093 'login-utils/su-common.h',
1097 include_directories : includes,
1098 link_with : [lib_common, logindefs_c],
1099 dependencies : [lib_pam,
1103 install_mode : 'rwsr-xr-x',
1105 build_by_default : opt)
1106 if opt and not is_disabler(exe)
1108 manadocs += ['login-utils/su.1.adoc']
1109 bashcompletions += ['su']
1112 opt = not get_option('build-newgrp').disabled()
1115 'login-utils/newgrp.c',
1116 include_directories : includes,
1117 dependencies : [lib_crypt],
1118 install_dir : usrbin_exec_dir,
1119 install_mode : 'rwsr-xr-x',
1121 build_by_default : opt)
1122 if opt and not is_disabler(exe)
1124 manadocs += ['login-utils/newgrp.1.adoc']
1125 bashcompletions += ['newgrp']
1128 opt = not get_option('build-lslogins').disabled()
1131 'login-utils/lslogins.c',
1132 include_directories : includes,
1133 link_with : [lib_common,
1136 (build_liblastlog2 ? [lib_lastlog2] : []),
1137 dependencies : [lib_selinux,
1139 install_dir : usrbin_exec_dir,
1141 build_by_default : opt)
1142 if opt and not is_disabler(exe)
1144 manadocs += ['login-utils/lslogins.1.adoc']
1145 bashcompletions += ['lslogins']
1148 opt = not get_option('build-vipw').disabled()
1151 'login-utils/vipw.c',
1152 'login-utils/setpwnam.h',
1153 include_directories : includes,
1154 link_with : [lib_common],
1155 dependencies : [lib_selinux],
1156 install_dir : usrbin_exec_dir,
1158 build_by_default : opt)
1159 if opt and not is_disabler(exe)
1161 meson.add_install_script(meson_make_symlink,
1163 join_paths(usrbin_exec_dir, 'vigr'))
1164 manadocs += ['login-utils/vipw.8.adoc']
1165 meson.add_install_script(meson_make_symlink,
1167 join_paths(mandir, 'man8/vigr.8'))
1170 opt = not get_option('build-runuser').disabled()
1173 'login-utils/runuser.c',
1174 'login-utils/su-common.c',
1175 'login-utils/su-common.h',
1179 include_directories : includes,
1180 link_with : [lib_common, logindefs_c],
1181 dependencies : [lib_pam,
1185 install_dir : sbindir,
1187 build_by_default : opt)
1188 if opt and not is_disabler(exe)
1190 manadocs += ['login-utils/runuser.1.adoc']
1191 bashcompletionslinks += {'runuser': 'su'}
1194 ############################################################
1200 include_directories : includes,
1201 link_with : lib_common,
1202 install_dir : usrbin_exec_dir,
1205 manadocs += ['text-utils/col.1.adoc']
1206 bashcompletions += ['col']
1212 include_directories : includes,
1213 install_dir : usrbin_exec_dir,
1216 manadocs += ['text-utils/colcrt.1.adoc']
1217 bashcompletions += ['colcrt']
1222 include_directories : includes,
1223 link_with : lib_common,
1224 install_dir : usrbin_exec_dir,
1227 manadocs += ['text-utils/colrm.1.adoc']
1228 bashcompletions += ['colrm']
1233 include_directories : includes,
1234 install_dir : usrbin_exec_dir,
1237 manadocs += ['text-utils/rev.1.adoc']
1238 bashcompletions += ['rev']
1243 include_directories : includes,
1244 link_with : [lib_common,
1246 install_dir : usrbin_exec_dir,
1248 if not is_disabler(exe)
1250 manadocs += ['text-utils/column.1.adoc']
1251 bashcompletions += ['column']
1254 opt = not get_option('build-line').disabled()
1258 include_directories : includes,
1259 install_dir : usrbin_exec_dir,
1261 build_by_default : opt)
1262 if opt and not is_disabler(exe)
1264 manadocs += ['text-utils/line.1.adoc']
1267 opt = not get_option('build-pg').disabled()
1271 link_with : lib_common,
1272 include_directories : includes,
1273 dependencies : [lib_tinfo,
1275 install_dir : usrbin_exec_dir,
1277 build_by_default : opt)
1278 if opt and not is_disabler(exe)
1280 manadocs += ['text-utils/pg.1.adoc']
1281 bashcompletions += ['pg']
1284 opt = not get_option('build-ul').disabled()
1288 include_directories : includes,
1289 dependencies : [lib_tinfo,
1291 install_dir : usrbin_exec_dir,
1293 build_by_default : opt)
1294 if opt and not is_disabler(exe)
1296 manadocs += ['text-utils/ul.1.adoc']
1297 bashcompletions += ['ul']
1300 opt = not get_option('build-more').disabled()
1304 link_with : [lib_common],
1305 include_directories : includes,
1306 dependencies : [lib_tinfo,
1310 build_by_default : opt)
1314 link_with : [lib_common],
1315 include_directories : includes,
1316 c_args : '-DTEST_PROGRAM',
1317 dependencies : [lib_tinfo,
1320 build_by_default : opt and program_tests)
1322 if opt and not is_disabler(exe)
1324 manadocs += ['text-utils/more.1.adoc']
1325 bashcompletions += ['more']
1331 include_directories : includes,
1332 link_with : [lib_common,
1334 install_dir : usrbin_exec_dir,
1336 if not is_disabler(exe)
1338 manadocs += ['text-utils/hexdump.1.adoc']
1339 bashcompletions += ['hexdump']
1342 opt = not get_option('build-lsmem').disabled()
1346 include_directories : includes,
1347 link_with : [lib_common,
1349 install_dir : usrbin_exec_dir,
1351 build_by_default : opt)
1352 if opt and not is_disabler(exe)
1354 manadocs += ['sys-utils/lsmem.1.adoc']
1355 bashcompletions += ['lsmem']
1358 opt = not get_option('build-chmem').disabled()
1362 include_directories : includes,
1363 link_with : [lib_common],
1364 install_dir : usrbin_exec_dir,
1366 build_by_default : opt)
1367 if opt and not is_disabler(exe)
1369 manadocs += ['sys-utils/chmem.8.adoc']
1370 bashcompletions += ['chmem']
1376 include_directories : includes,
1377 link_with : [lib_common],
1378 install_dir : usrbin_exec_dir,
1381 manadocs += ['sys-utils/choom.1.adoc']
1386 include_directories : includes,
1387 link_with : [lib_common],
1388 install_dir : usrbin_exec_dir,
1391 manadocs += ['sys-utils/ipcmk.1.adoc']
1392 bashcompletions += ['ipcmk']
1397 include_directories : includes,
1398 link_with : [lib_common],
1399 install_dir : usrbin_exec_dir,
1402 manadocs += ['sys-utils/ipcrm.1.adoc']
1403 bashcompletions += ['ipcrm']
1405 opt = not get_option('build-ipcs').disabled()
1409 include_directories : includes,
1410 link_with : [lib_common],
1411 install_dir : usrbin_exec_dir,
1413 build_by_default : opt)
1414 if opt and not is_disabler(exe)
1416 manadocs += ['sys-utils/ipcs.1.adoc']
1417 bashcompletions += ['ipcs']
1420 opt = not get_option('build-rfkill').disabled()
1424 include_directories : includes,
1425 link_with : [lib_common,
1427 install_dir : usrsbin_exec_dir,
1429 build_by_default : opt)
1430 if opt and not is_disabler(exe)
1432 manadocs += ['sys-utils/rfkill.8.adoc']
1433 bashcompletions += ['rfkill']
1439 include_directories : includes,
1440 link_with : [lib_common,
1442 install_dir : usrbin_exec_dir,
1444 if not is_disabler(exe)
1446 manadocs += ['sys-utils/renice.1.adoc']
1447 bashcompletions += ['renice']
1453 include_directories: includes,
1454 link_with : [lib_common,
1456 install_dir : usrbin_exec_dir,
1458 if opt and not is_disabler(exe)
1460 manadocs += ['sys-utils/setpgid.1.adoc']
1461 bashcompletions += ['setpgid']
1467 include_directories : includes,
1468 link_with : [lib_common,
1470 install_dir : usrbin_exec_dir,
1472 if opt and not is_disabler(exe)
1474 manadocs += ['sys-utils/setsid.1.adoc']
1475 bashcompletions += ['setsid']
1480 readprofile_sources,
1481 include_directories : includes,
1482 link_with : [lib_common,
1484 install_dir : usrsbin_exec_dir,
1486 if not is_disabler(exe)
1488 manadocs += ['sys-utils/readprofile.8.adoc']
1489 bashcompletions += ['readprofile']
1492 opt = not get_option('build-tunelp').disabled()
1496 include_directories : includes,
1497 link_with : [lib_common],
1498 install_dir : usrsbin_exec_dir,
1500 build_by_default : opt)
1501 if opt and not is_disabler(exe)
1503 manadocs += ['sys-utils/tunelp.8.adoc']
1504 bashcompletions += ['tunelp']
1507 opt = not get_option('build-fstrim').disabled()
1511 include_directories : includes,
1512 link_with : [lib_common],
1513 dependencies : [mount_dep],
1514 install_dir : sbindir,
1516 build_by_default : opt)
1517 if opt and not is_disabler(exe)
1519 manadocs += ['sys-utils/fstrim.8.adoc']
1520 bashcompletions += ['fstrim']
1526 include_directories : includes,
1527 link_with : [lib_common,
1530 if not is_disabler(exe)
1532 manadocs += ['sys-utils/dmesg.1.adoc']
1533 bashcompletions += ['dmesg']
1539 include_directories : dir_include,
1540 c_args : '-DTEST_DMESG',
1541 link_with : [lib_common,
1543 build_by_default : program_tests)
1544 if not is_disabler(exe)
1551 include_directories : includes,
1552 link_with : [lib_common],
1553 install_dir : sbindir,
1556 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1557 bashcompletions += ['ctrlaltdel']
1562 include_directories : includes,
1563 install_dir : sbindir,
1566 manadocs += ['sys-utils/fsfreeze.8.adoc']
1567 bashcompletions += ['fsfreeze']
1572 include_directories : includes,
1573 link_with : [lib_common],
1574 dependencies : [blkid_dep],
1575 install_dir : sbindir,
1578 manadocs += ['sys-utils/blkdiscard.8.adoc']
1579 bashcompletions += ['blkdiscard']
1581 if cc.has_header('linux/blkzoned.h')
1585 include_directories : includes,
1586 link_with : [lib_common],
1587 install_dir : sbindir,
1590 manadocs += ['sys-utils/blkzone.8.adoc']
1591 bashcompletions += ['blkzone']
1594 if cc.has_header('linux/pr.h')
1598 include_directories : includes,
1599 link_with : [lib_common],
1600 install_dir : sbindir,
1603 manadocs += ['sys-utils/blkpr.8.adoc']
1609 include_directories : includes,
1610 link_with : [lib_common],
1611 install_dir : usrsbin_exec_dir,
1614 manadocs += ['sys-utils/ldattach.8.adoc']
1615 bashcompletions += ['ldattach']
1620 include_directories : includes,
1621 link_with : [lib_common],
1622 install_dir : usrsbin_exec_dir,
1625 manadocs += ['sys-utils/rtcwake.8.adoc']
1626 bashcompletions += ['rtcwake']
1631 include_directories : includes,
1632 link_with : [lib_common],
1633 install_dir : usrbin_exec_dir,
1636 manadocs += ['sys-utils/setarch.8.adoc']
1637 bashcompletions += ['setarch']
1639 setarch_links = ['uname26', 'linux32', 'linux64']
1640 setarch_links_arch = {
1641 's390x' : ['s390', 's390x'],
1643 'x86_64' : ['i386', 'x86_64'],
1644 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1645 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1646 'mips64' : ['mips', 'mips64', 'mips32'],
1647 'ia64' : ['i386', 'ia64'],
1648 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1650 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1652 foreach link: setarch_links
1653 meson.add_install_script(meson_make_symlink,
1655 join_paths(usrbin_exec_dir, link))
1656 manlinks += {link + '.8': 'setarch.8'}
1659 opt = not get_option('build-eject').disabled()
1663 include_directories : includes,
1664 link_with : [lib_common],
1665 dependencies : [mount_dep],
1666 install_dir : usrbin_exec_dir,
1668 build_by_default : opt)
1669 if opt and not is_disabler(exe)
1671 manadocs += ['sys-utils/eject.1.adoc']
1672 bashcompletions += ['eject']
1675 opt = not get_option('build-losetup').disabled()
1679 include_directories : includes,
1680 link_with : [lib_common,
1682 install_dir : sbindir,
1684 build_by_default : opt)
1685 if opt and not is_disabler(exe)
1686 manadocs += ['sys-utils/losetup.8.adoc']
1688 bashcompletions += ['losetup']
1691 opt = opt and 'losetup' in static_programs
1695 include_directories : includes,
1696 link_args : ['--static'],
1697 link_with : [lib_common,
1698 lib_smartcols.get_static_lib()],
1699 install_dir : sbindir,
1701 build_by_default : opt)
1702 if opt and not is_disabler(exe)
1706 opt = not get_option('build-zramctl').disabled()
1710 include_directories : includes,
1711 link_with : [lib_common,
1713 install_dir : sbindir,
1715 build_by_default : opt)
1716 if opt and not is_disabler(exe)
1718 manadocs += ['sys-utils/zramctl.8.adoc']
1719 bashcompletions += ['zramctl']
1725 include_directories : includes,
1726 link_with : [lib_common,
1728 install_dir : usrbin_exec_dir,
1730 if not is_disabler(exe)
1732 manadocs += ['sys-utils/prlimit.1.adoc']
1733 bashcompletions += ['prlimit']
1736 opt = not get_option('build-lsns').disabled()
1740 include_directories : includes,
1741 link_with : [lib_common,
1743 dependencies : [mount_dep],
1744 install_dir : usrbin_exec_dir,
1746 build_by_default : opt)
1747 if opt and not is_disabler(exe)
1749 manadocs += ['sys-utils/lsns.8.adoc']
1750 bashcompletions += ['lsns']
1753 opt = not get_option('build-mount').disabled()
1757 include_directories : includes,
1758 link_with : [lib_common,
1760 dependencies : [lib_selinux, mount_dep],
1761 install_mode : 'rwsr-xr-x',
1763 build_by_default : opt)
1767 include_directories : includes,
1768 link_with : [lib_common],
1769 dependencies : [mount_dep],
1770 install_mode : 'rwsr-xr-x',
1772 build_by_default : opt)
1773 if opt and not is_disabler(exe)
1775 manadocs += ['sys-utils/fstab.5.adoc',
1776 'sys-utils/mount.8.adoc',
1777 'sys-utils/umount.8.adoc']
1778 bashcompletions += ['mount', 'umount']
1781 opt2 = opt and 'mount' in static_programs
1785 include_directories : includes,
1786 link_args : ['--static'],
1787 link_with : [lib_common,
1788 lib_smartcols_static],
1789 dependencies : [mount_static_dep],
1791 build_by_default : opt2)
1792 if opt2 and not is_disabler(exe)
1796 opt2 = opt and 'umount' in static_programs
1800 include_directories : includes,
1801 link_args : ['--static'],
1802 link_with : [lib_common],
1803 dependencies : [mount_static_dep],
1805 build_by_default : opt2)
1806 if opt2 and not is_disabler(exe)
1812 opt = not get_option('build-swapon').disabled()
1816 include_directories : includes,
1817 link_with : [lib_common,
1819 dependencies : [blkid_dep, mount_dep],
1820 install_dir : sbindir,
1822 build_by_default : opt)
1823 if opt and not is_disabler(exe)
1825 manadocs += ['sys-utils/swapon.8.adoc']
1826 bashcompletions += ['swapon']
1829 opt = not get_option('build-swapoff').disabled()
1833 include_directories : includes,
1834 link_with : [lib_common],
1835 dependencies : [blkid_dep, mount_dep],
1836 install_dir : sbindir,
1838 build_by_default : opt)
1839 if opt and not is_disabler(exe)
1841 manlinks += {'swapoff.8': 'swapon.8'}
1842 bashcompletions += ['swapoff']
1848 include_directories : includes,
1849 link_with : [lib_common,
1851 dependencies : [rtas_libs],
1852 install_dir : usrbin_exec_dir,
1854 if not is_disabler(exe)
1856 manadocs += ['sys-utils/lscpu.1.adoc']
1857 bashcompletions += ['lscpu']
1863 include_directories : includes,
1864 link_with : [lib_common],
1865 install_dir : sbindir,
1868 manadocs += ['sys-utils/chcpu.8.adoc']
1869 bashcompletions += ['chcpu']
1874 include_directories : includes,
1875 link_with : [lib_common,
1878 if not is_disabler(exe)
1880 manadocs += ['sys-utils/wdctl.8.adoc']
1881 bashcompletions += ['wdctl']
1884 opt = not get_option('build-mountpoint').disabled()
1888 include_directories : includes,
1889 dependencies : [mount_dep],
1891 build_by_default : opt)
1892 if opt and not is_disabler(exe)
1894 manadocs += ['sys-utils/mountpoint.1.adoc']
1895 bashcompletions += ['mountpoint']
1898 opt = not get_option('build-fallocate').disabled()
1902 include_directories : includes,
1903 link_with : [lib_common],
1904 install_dir : usrbin_exec_dir,
1906 build_by_default : opt)
1907 if opt and not is_disabler(exe)
1909 manadocs += ['sys-utils/fallocate.1.adoc']
1910 bashcompletions += ['fallocate']
1913 opt = not get_option('build-pivot_root').disabled()
1917 include_directories : includes,
1918 install_dir : sbindir,
1920 build_by_default : opt)
1921 if opt and not is_disabler(exe)
1923 manadocs += ['sys-utils/pivot_root.8.adoc']
1924 bashcompletions += ['pivot_root']
1927 opt = not get_option('build-switch_root').disabled()
1928 if opt and not have_dirfd and not have_ddfd
1929 error('neither dirfd nor ddfd are available')
1933 switch_root_sources,
1934 include_directories : includes,
1935 install_dir : sbindir,
1937 build_by_default : opt)
1938 if opt and not is_disabler(exe)
1940 manadocs += ['sys-utils/switch_root.8.adoc']
1943 opt = not get_option('build-unshare').disabled()
1947 include_directories : includes,
1948 link_with : [lib_common],
1949 dependencies : [mount_dep],
1950 install_dir : usrbin_exec_dir,
1952 build_by_default : opt)
1953 if opt and not is_disabler(exe)
1955 manadocs += ['sys-utils/unshare.1.adoc']
1956 bashcompletions += ['unshare']
1959 opt = opt and 'unshare' in static_programs
1963 include_directories : includes,
1964 link_with : [lib_common],
1965 dependencies : [mount_dep],
1966 install_dir : usrbin_exec_dir,
1968 build_by_default : opt)
1969 if opt and not is_disabler(exe)
1973 opt = not get_option('build-nsenter').disabled()
1977 include_directories : includes,
1978 link_with : [lib_common],
1979 dependencies : [lib_selinux],
1980 install_dir : usrbin_exec_dir,
1982 build_by_default : opt)
1983 if opt and not is_disabler(exe)
1985 manadocs += ['sys-utils/nsenter.1.adoc']
1986 bashcompletions += ['nsenter']
1989 opt = opt and 'nsenter' in static_programs
1993 include_directories : includes,
1994 link_with : [lib_common],
1995 dependencies : [lib_selinux],
1996 install_dir : usrbin_exec_dir,
1998 build_by_default : opt)
1999 if opt and not is_disabler(exe)
2003 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
2007 include_directories : includes,
2008 link_with : [lib_common],
2009 dependencies : [lib_cap_ng],
2010 install_dir : usrbin_exec_dir,
2012 build_by_default : opt)
2013 if opt and not is_disabler(exe)
2015 manadocs += ['sys-utils/setpriv.1.adoc']
2016 bashcompletions += ['setpriv']
2022 include_directories : includes,
2023 link_with : [lib_common],
2024 dependencies : realtime_libs,
2025 install_dir : usrbin_exec_dir,
2028 manadocs += ['sys-utils/flock.1.adoc']
2029 bashcompletions += ['flock']
2031 opt = not get_option('build-lsirq').disabled()
2035 include_directories : includes,
2036 link_with : [lib_common,
2038 install_dir : usrbin_exec_dir,
2040 build_by_default : opt)
2041 if opt and not is_disabler(exe)
2043 manadocs += ['sys-utils/lsirq.1.adoc']
2044 bashcompletions += ['lsirq']
2047 opt = not get_option('build-irqtop').disabled()
2051 include_directories : includes,
2052 dependencies : [realtime_libs, curses_libs],
2053 link_with : [lib_common,
2056 install_dir : usrbin_exec_dir,
2058 build_by_default : opt)
2059 if opt and not is_disabler(exe)
2061 manadocs += ['sys-utils/irqtop.1.adoc']
2062 bashcompletions += ['irqtop']
2065 opt = not get_option('build-ipcs').disabled()
2069 include_directories : includes,
2070 link_with : [lib_common,
2072 install_dir : usrbin_exec_dir,
2074 build_by_default : opt)
2075 if opt and not is_disabler(exe)
2077 manadocs += ['sys-utils/lsipc.1.adoc']
2078 bashcompletions += ['lsipc']
2085 include_directories : includes,
2086 link_with : [lib_common],
2087 dependencies : [lib_m,
2089 install_dir : sbindir,
2091 build_by_default : opt)
2092 if opt and not is_disabler(exe)
2094 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2095 bashcompletions += ['hwclock']
2101 include_directories : includes,
2102 install_dir : sbindir,
2105 manadocs += ['disk-utils/mkfs.8.adoc']
2106 bashcompletions += ['mkfs']
2108 opt = not get_option('build-bfs').disabled()
2112 include_directories : includes,
2113 link_with : [lib_common],
2114 install_dir : sbindir,
2116 build_by_default : opt)
2117 if opt and not is_disabler(exe)
2119 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2120 bashcompletions += ['mkfs.bfs']
2126 include_directories : includes,
2127 link_with : [lib_common],
2128 install_dir : usrbin_exec_dir,
2131 manadocs += ['disk-utils/isosize.8.adoc']
2132 bashcompletions += ['isosize']
2137 include_directories : includes,
2138 link_with : [lib_common,
2140 dependencies: [blkid_dep, lib_selinux],
2141 install_dir : sbindir,
2143 if not is_disabler(exe)
2145 manadocs += ['disk-utils/mkswap.8.adoc']
2146 bashcompletions += ['mkswap']
2152 include_directories : includes,
2153 link_with : [lib_common,
2155 dependencies : [blkid_dep],
2156 install_dir : sbindir,
2158 if not is_disabler(exe)
2160 manadocs += ['disk-utils/swaplabel.8.adoc']
2161 bashcompletions += ['swaplabel']
2164 opt = not get_option('build-fsck').disabled()
2168 include_directories : includes,
2169 link_with : [lib_common],
2170 dependencies : [blkid_dep, mount_dep, realtime_libs],
2171 install_dir : sbindir,
2173 build_by_default : opt)
2174 if opt and not is_disabler(exe)
2176 manadocs += ['disk-utils/fsck.8.adoc']
2177 bashcompletions += ['fsck']
2180 opt = not get_option('build-minix').disabled()
2184 include_directories : includes,
2185 link_with : [lib_common],
2186 install_dir : sbindir,
2188 build_by_default : opt)
2192 include_directories : includes,
2193 c_args : '-DTEST_SCRIPT',
2194 link_with : [lib_common],
2195 build_by_default : opt and program_tests)
2199 include_directories : includes,
2200 link_with : [lib_common],
2201 install_dir : sbindir,
2203 build_by_default : opt)
2204 if opt and not is_disabler(exe)
2205 exes += [exe, exe2, exe3]
2206 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2207 bashcompletions += ['mkfs.minix', 'fsck.minix']
2210 opt = not get_option('build-cramfs').disabled()
2213 mkfs_cramfs_sources,
2214 include_directories : includes,
2215 link_with : [lib_common],
2216 dependencies : [lib_z],
2217 install_dir : sbindir,
2219 build_by_default : opt)
2222 fsck_cramfs_sources,
2223 include_directories : includes,
2224 link_with : [lib_common],
2225 dependencies : [lib_z],
2226 install_dir : sbindir,
2228 build_by_default : opt)
2229 if not is_disabler(exe)
2231 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2232 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2235 opt = not get_option('build-raw').disabled()
2237 cc.has_header('linux/raw.h', required: opt)
2242 include_directories : includes,
2243 install_dir : sbindir,
2245 build_by_default : opt)
2246 if opt and not is_disabler(exe)
2248 manadocs += ['disk-utils/raw.8.adoc']
2249 bashcompletions += ['raw']
2252 opt = not get_option('build-fdformat').disabled()
2256 include_directories : includes,
2257 link_with : [lib_common],
2258 install_dir : usrsbin_exec_dir,
2260 build_by_default : opt)
2261 if opt and not is_disabler(exe)
2263 manadocs += ['disk-utils/fdformat.8.adoc']
2264 bashcompletions += ['fdformat']
2270 include_directories : includes,
2271 link_with : [lib_common],
2272 install_dir : sbindir,
2274 manadocs += ['disk-utils/blockdev.8.adoc']
2275 bashcompletions += ['blockdev']
2277 opt = not get_option('build-fdisks').disabled()
2278 if opt and not have_dirfd and not have_ddfd
2279 error('neither dirfd nor ddfd are available')
2284 include_directories : includes,
2285 link_with : [lib_common,
2289 dependencies : [lib_readline],
2290 install_dir : sbindir,
2292 build_by_default : opt)
2293 if opt and not is_disabler(exe)
2295 bashcompletions += ['fdisk']
2298 opt2 = opt and 'fdisk' in static_programs
2302 link_args : ['--static'],
2303 include_directories : includes,
2304 link_with : [lib_common,
2307 lib_smartcols.get_static_lib()],
2308 dependencies : [lib_readline_static],
2309 install_dir : sbindir,
2311 build_by_default : opt2)
2312 if opt2 and not is_disabler(exe)
2319 include_directories : includes,
2320 link_with : [lib_common,
2324 dependencies : [lib_readline],
2325 install_dir : sbindir,
2327 build_by_default : opt)
2328 if opt and not is_disabler(exe)
2330 bashcompletions += ['sfdisk']
2333 opt2 = opt and 'sfdisk' in static_programs
2337 include_directories : includes,
2338 link_with : [lib_common,
2341 lib_smartcols.get_static_lib()],
2342 dependencies : [lib_readline_static],
2343 install_dir : sbindir,
2345 build_by_default : opt2)
2346 if opt2 and not is_disabler(exe)
2353 include_directories : includes,
2354 link_with : [lib_common,
2358 dependencies : [curses_libs, mount_dep],
2359 install_dir : sbindir,
2361 build_by_default : opt)
2362 if opt and not is_disabler(exe)
2364 manadocs += ['disk-utils/fdisk.8.adoc',
2365 'disk-utils/sfdisk.8.adoc',
2366 'disk-utils/cfdisk.8.adoc']
2367 bashcompletions += ['cfdisk']
2370 opt = not get_option('build-partx').disabled()
2374 include_directories : includes,
2375 link_with : [lib_common],
2376 install_dir : usrsbin_exec_dir,
2378 build_by_default : opt)
2382 include_directories : includes,
2383 link_with : [lib_common],
2384 install_dir : usrsbin_exec_dir,
2386 build_by_default : opt)
2390 include_directories : includes,
2391 link_with : [lib_common],
2392 install_dir : usrsbin_exec_dir,
2394 build_by_default : opt)
2398 include_directories : includes,
2399 link_with : [lib_common,
2401 dependencies : [blkid_dep],
2402 install_dir : usrsbin_exec_dir,
2404 build_by_default : opt)
2406 exes += [exe, exe2, exe3, exe4]
2407 manadocs += ['disk-utils/addpart.8.adoc',
2408 'disk-utils/delpart.8.adoc',
2409 'disk-utils/resizepart.8.adoc',
2410 'disk-utils/partx.8.adoc']
2411 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2413 opt = opt and 'partx' in static_programs
2417 include_directories : includes,
2418 link_args : ['--static'],
2419 link_with : [lib_common],
2420 install_dir : usrsbin_exec_dir,
2422 build_by_default : opt)
2426 include_directories : includes,
2427 link_args : ['--static'],
2428 link_with : [lib_common],
2429 install_dir : usrsbin_exec_dir,
2431 build_by_default : opt)
2433 'resizepart.static',
2435 include_directories : includes,
2436 link_args : ['--static'],
2437 link_with : [lib_common],
2438 install_dir : usrsbin_exec_dir,
2440 build_by_default : opt)
2444 include_directories : includes,
2445 link_args : ['--static'],
2446 link_with : [lib_common,
2447 lib_smartcols.get_static_lib()],
2448 dependencies : [blkid_static_dep],
2449 install_dir : usrsbin_exec_dir,
2451 build_by_default : opt)
2454 exes += [exe, exe2, exe3, exe4]
2457 ############################################################
2462 include_directories : includes,
2463 link_with : [lib_common],
2464 dependencies : [lib_util,
2468 install_dir : usrbin_exec_dir,
2471 manadocs += ['term-utils/script.1.adoc']
2472 bashcompletions += ['script']
2477 include_directories : includes,
2478 c_args : '-DTEST_SCRIPT',
2479 link_with : [lib_common],
2480 dependencies : [lib_util,
2484 build_by_default : program_tests)
2490 include_directories : includes,
2491 link_with : [lib_common],
2492 dependencies : [lib_util,
2495 install_dir : usrbin_exec_dir,
2498 manadocs += ['term-utils/scriptlive.1.adoc']
2499 bashcompletions += ['scriptlive']
2503 scriptreplay_sources,
2504 include_directories : includes,
2505 link_with : [lib_common],
2506 dependencies : [math_libs],
2507 install_dir : usrbin_exec_dir,
2510 manadocs += ['term-utils/scriptreplay.1.adoc']
2511 bashcompletions += ['scriptreplay']
2513 opt = not get_option('build-agetty').disabled()
2517 include_directories : includes,
2518 link_with : [lib_common, logindefs_c],
2519 dependencies : [BSD ? lib_util : [], lib_systemd],
2520 install_dir : sbindir,
2522 build_by_default : opt)
2525 manadocs += ['term-utils/agetty.8.adoc']
2528 opt = not get_option('build-setterm').disabled()
2532 include_directories : includes,
2533 link_with : [lib_common],
2534 dependencies : [curses_libs],
2535 install_dir : usrbin_exec_dir,
2537 build_by_default : opt)
2540 manadocs += ['term-utils/setterm.1.adoc']
2541 bashcompletions += ['setterm']
2544 opt = not get_option('build-mesg').disabled()
2548 include_directories : includes,
2549 link_with : [lib_common],
2550 install_dir : usrbin_exec_dir,
2552 build_by_default : opt)
2555 manadocs += ['term-utils/mesg.1.adoc']
2556 bashcompletions += ['mesg']
2559 opt = not get_option('build-wall').disabled()
2563 include_directories : includes,
2564 link_with : [lib_common],
2565 dependencies : [lib_systemd],
2566 install_dir : usrbin_exec_dir,
2567 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2569 build_by_default : opt)
2572 manadocs += ['term-utils/wall.1.adoc']
2573 bashcompletions += ['wall']
2576 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2577 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2579 opt = not get_option('build-write').disabled()
2583 include_directories : includes,
2584 link_with : [lib_common],
2585 dependencies : [lib_systemd],
2586 install_dir : usrbin_exec_dir,
2587 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2589 build_by_default : opt)
2592 manadocs += ['term-utils/write.1.adoc']
2593 bashcompletions += ['write']
2596 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2597 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2599 opt = not get_option('build-login').disabled()
2603 include_directories : includes,
2604 link_with : [lib_common, logindefs_c],
2605 dependencies : [lib_pam,
2609 build_by_default : opt)
2610 if not is_disabler(exe)
2612 manadocs += ['login-utils/login.1.adoc']
2615 opt = not get_option('build-sulogin').disabled()
2619 include_directories : includes,
2620 link_with : [lib_common],
2621 dependencies : [lib_crypt,
2623 install_dir : sbindir,
2625 build_by_default : opt)
2626 if not is_disabler(exe)
2628 manadocs += ['login-utils/sulogin.8.adoc']
2634 include_directories : includes,
2635 link_with : [lib_common,
2637 dependencies : [curses_libs],
2638 install_dir : usrbin_exec_dir,
2641 manadocs += ['misc-utils/cal.1.adoc']
2642 bashcompletions += ['cal']
2644 opt = not get_option('build-logger').disabled()
2648 include_directories : includes,
2649 link_with : [lib_common],
2650 dependencies : [lib_systemd],
2651 install_dir : usrbin_exec_dir,
2653 build_by_default : opt)
2654 if opt and not is_disabler(exe)
2656 manadocs += ['misc-utils/logger.1.adoc']
2657 bashcompletions += ['logger']
2663 include_directories : includes,
2664 c_args : '-DTEST_LOGGER',
2665 link_with : [lib_common],
2666 dependencies : [lib_systemd],
2667 build_by_default: program_tests)
2668 if not is_disabler(exe)
2675 include_directories : includes,
2676 install_dir : usrbin_exec_dir,
2679 manadocs += ['misc-utils/look.1.adoc']
2680 bashcompletions += ['look']
2685 include_directories : includes,
2686 link_with : [lib_common],
2687 install_dir : usrbin_exec_dir,
2690 manadocs += ['misc-utils/mcookie.1.adoc']
2691 bashcompletions += ['mcookie']
2693 if build_liblastlog2
2697 include_directories : includes,
2698 link_with : [lib_common, lib_lastlog2],
2699 install_dir : usrbin_exec_dir,
2702 manadocs += ['misc-utils/lastlog2.8.adoc']
2703 bashcompletions += ['lastlog2']
2704 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2705 'liblastlog2/man/ll2_write_entry.3.adoc',
2706 'liblastlog2/man/ll2_read_entry.3.adoc',
2707 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2708 'liblastlog2/man/ll2_read_all.3.adoc',
2709 'liblastlog2/man/ll2_remove_entry.3.adoc',
2710 'liblastlog2/man/ll2_rename_user.3.adoc',
2711 'liblastlog2/man/ll2_update_login_time.3.adoc'
2718 include_directories : includes,
2719 dependencies : [lib_selinux],
2720 install_dir : usrbin_exec_dir,
2723 manadocs += ['misc-utils/namei.1.adoc']
2724 bashcompletions += ['namei']
2729 include_directories : includes,
2730 link_with : [lib_common],
2731 install_dir : usrbin_exec_dir,
2734 manadocs += ['misc-utils/whereis.1.adoc']
2735 bashcompletions += ['whereis']
2737 opt = not get_option('build-lslocks').disabled()
2741 include_directories : includes,
2742 link_with : [lib_common,
2744 dependencies : [mount_dep],
2745 install_dir : usrbin_exec_dir,
2747 build_by_default : opt)
2748 if opt and not is_disabler(exe)
2750 manadocs += ['misc-utils/lslocks.8.adoc']
2751 bashcompletions += ['lslocks']
2754 opt = not get_option('build-lsblk').disabled()
2758 include_directories : includes,
2759 link_with : [lib_common,
2762 dependencies : [blkid_dep, lib_udev, mount_dep],
2764 build_by_default : opt)
2765 if opt and not is_disabler(exe)
2767 manadocs += ['misc-utils/lsblk.8.adoc']
2768 bashcompletions += ['lsblk']
2771 errnos_h = custom_target('errnos.h',
2772 input : 'tools/all_errnos',
2773 output : 'errnos.h',
2774 command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
2777 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2780 lsfd_sources, errnos_h,
2781 include_directories : includes,
2782 link_with : [lib_common,
2784 dependencies : [lib_rt],
2785 install_dir : usrbin_exec_dir,
2787 build_by_default : opt)
2788 if opt and not is_disabler(exe)
2790 manadocs += ['misc-utils/lsfd.1.adoc']
2796 include_directories : includes,
2797 link_with : [lib_common,
2799 install_dir : usrbin_exec_dir,
2801 if not is_disabler(exe)
2803 manadocs += ['misc-utils/uuidgen.1.adoc']
2804 bashcompletions += ['uuidgen']
2810 include_directories : includes,
2811 link_with : [lib_common,
2814 install_dir : usrbin_exec_dir,
2816 if not is_disabler(exe)
2818 manadocs += ['misc-utils/uuidparse.1.adoc']
2819 bashcompletions += ['uuidparse']
2826 include_directories : includes,
2827 link_with : [lib_common,
2829 dependencies : [realtime_libs,
2831 install_dir : usrsbin_exec_dir,
2833 build_by_default : opt)
2837 include_directories : includes,
2838 link_with : [lib_common,
2840 dependencies : thread_libs,
2841 build_by_default : opt and program_tests)
2842 if not is_disabler(exe)
2844 manadocs += ['misc-utils/uuidd.8.adoc']
2845 bashcompletions += ['uuidd']
2848 opt = build_libblkid
2852 include_directories : includes,
2853 link_with : [lib_common],
2854 dependencies : [blkid_dep],
2855 install_dir : sbindir,
2857 build_by_default : opt)
2858 if opt and not is_disabler(exe)
2860 manadocs += ['misc-utils/blkid.8.adoc']
2861 bashcompletions += ['blkid']
2864 opt = opt and 'blkid' in static_programs
2868 include_directories : includes,
2869 link_with : [lib_common],
2870 dependencies : [blkid_static_dep],
2871 install_dir : sbindir,
2873 build_by_default : opt)
2874 if opt and not is_disabler(exe)
2880 'libblkid/samples/mkfs.c',
2881 include_directories : includes,
2882 dependencies : [blkid_dep])
2883 if not is_disabler(exe)
2888 'sample-partitions',
2889 'libblkid/samples/partitions.c',
2890 include_directories : includes,
2891 dependencies : [blkid_dep])
2892 if not is_disabler(exe)
2897 'sample-superblocks',
2898 'libblkid/samples/superblocks.c',
2899 include_directories : includes,
2900 dependencies : [blkid_dep])
2901 if not is_disabler(exe)
2907 'libblkid/samples/topology.c',
2908 include_directories : includes,
2909 dependencies : [blkid_dep])
2910 if not is_disabler(exe)
2915 'test_blkid_fuzz_sample',
2916 'libblkid/src/fuzz.c',
2917 include_directories: includes,
2918 dependencies : [blkid_dep],
2919 build_by_default: program_tests)
2920 if not is_disabler(exe)
2924 ############################################################
2929 include_directories : includes,
2930 dependencies : [blkid_dep],
2931 install_dir : sbindir,
2933 if not is_disabler(exe)
2935 manadocs += ['misc-utils/findfs.8.adoc']
2936 bashcompletions += ['findfs']
2942 include_directories : includes,
2943 link_with : [lib_common,
2945 dependencies : [blkid_dep],
2946 install_dir : sbindir,
2948 if not is_disabler(exe)
2950 manadocs += ['misc-utils/wipefs.8.adoc']
2951 bashcompletions += ['wipefs']
2954 opt = not get_option('build-findmnt').disabled()
2958 include_directories : includes,
2959 link_with : [lib_common,
2961 dependencies : [blkid_dep, lib_udev, mount_dep],
2963 build_by_default : opt)
2964 if opt and not is_disabler(exe)
2966 manadocs += ['misc-utils/findmnt.8.adoc']
2967 bashcompletions += ['findmnt']
2973 include_directories : includes,
2974 link_with : [lib_common],
2976 if not is_disabler(exe)
2978 manadocs += ['misc-utils/kill.1.adoc']
2981 opt = not get_option('build-rename').disabled()
2985 include_directories : includes,
2986 install_dir : usrbin_exec_dir,
2988 build_by_default : opt)
2989 if opt and not is_disabler(exe)
2991 manadocs += ['misc-utils/rename.1.adoc']
2992 bashcompletions += ['rename']
2998 include_directories : includes,
2999 link_with : [lib_common],
3000 install_dir : usrbin_exec_dir,
3003 manadocs += ['misc-utils/getopt.1.adoc']
3004 bashcompletions += ['getopt']
3009 include_directories : includes,
3010 link_with : [lib_common,
3012 install_dir : usrbin_exec_dir,
3014 if not is_disabler(exe)
3016 manadocs += ['misc-utils/fincore.1.adoc']
3017 bashcompletions += ['fincore']
3023 include_directories : includes,
3024 link_with : [lib_common],
3025 install_dir : usrbin_exec_dir,
3027 if not is_disabler(exe)
3029 manadocs += ['misc-utils/hardlink.1.adoc']
3030 bashcompletions += ['hardlink']
3033 opt = not get_option('build-pipesz').disabled()
3037 include_directories : includes,
3038 link_with : [lib_common],
3039 install_dir : usrbin_exec_dir,
3041 if opt and not is_disabler(exe)
3043 manadocs += ['misc-utils/pipesz.1.adoc']
3044 bashcompletions += ['pipesz']
3050 include_directories : includes,
3051 c_args : '-DTEST_CAL',
3052 link_with : [lib_common,
3054 dependencies : [curses_libs],
3055 build_by_default: program_tests)
3056 if not is_disabler(exe)
3063 include_directories : includes,
3064 link_with : [lib_common],
3065 install_dir : usrbin_exec_dir,
3067 if not is_disabler(exe)
3069 manadocs += ['misc-utils/fadvise.1.adoc']
3070 bashcompletions += ['fadvise']
3073 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3077 include_directories : includes,
3078 link_with : [lib_common],
3079 install_dir : usrbin_exec_dir,
3081 if not is_disabler(exe)
3083 manadocs += ['misc-utils/waitpid.1.adoc']
3084 bashcompletions += ['waitpid']
3088 syscalls_h = custom_target('syscalls.h',
3089 input : 'tools/all_syscalls',
3090 output : 'syscalls.h',
3091 command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
3094 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3097 'misc-utils/enosys.c', syscalls_h, errnos_h,
3098 include_directories : includes,
3099 link_with : [lib_common],
3100 install_dir : usrbin_exec_dir,
3102 if not is_disabler(exe)
3104 manadocs += ['misc-utils/enosys.1.adoc']
3105 bashcompletions += ['enosys']
3112 include_directories : includes,
3113 link_with : [lib_common, lib_smartcols],
3114 install_dir : usrbin_exec_dir,
3116 if not is_disabler(exe)
3118 manadocs += ['misc-utils/lsclocks.1.adoc']
3119 bashcompletions += ['lsclocks']
3122 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3126 include_directories : includes,
3127 link_with : [lib_common],
3128 install_dir : usrbin_exec_dir,
3130 if not is_disabler(exe)
3132 manadocs += ['misc-utils/exch.1.adoc']
3133 bashcompletions += ['exch']
3137 ############################################################
3139 opt = not get_option('build-schedutils').disabled()
3142 'schedutils/chrt.c',
3143 include_directories : includes,
3144 link_with : lib_common,
3145 install_dir : usrbin_exec_dir,
3147 build_by_default : opt)
3151 'schedutils/ionice.c',
3152 include_directories : includes,
3153 link_with : lib_common,
3154 install_dir : usrbin_exec_dir,
3156 build_by_default : opt)
3160 'schedutils/taskset.c',
3161 include_directories : includes,
3162 link_with : lib_common,
3163 install_dir : usrbin_exec_dir,
3165 build_by_default : opt)
3169 'schedutils/uclampset.c',
3170 include_directories : includes,
3171 link_with : lib_common,
3172 install_dir : usrbin_exec_dir,
3174 build_by_default : opt)
3176 if opt and not is_disabler(exe)
3177 exes += [exe, exe2, exe3, exe4]
3178 manadocs += ['schedutils/chrt.1.adoc',
3179 'schedutils/ionice.1.adoc',
3180 'schedutils/taskset.1.adoc',
3181 'schedutils/uclampset.1.adoc']
3182 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3185 ############################################################
3187 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3192 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3193 include_directories : dir_include,
3194 link_with : lib_common,
3195 build_by_default: program_tests)
3201 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3202 include_directories : dir_include,
3203 link_with : lib_common,
3204 build_by_default: program_tests)
3210 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3211 include_directories : dir_include,
3212 link_with : lib_common,
3213 build_by_default: program_tests)
3219 c_args : ['-DTEST_PROGRAM_MANGLE'],
3220 include_directories : dir_include,
3221 build_by_default: program_tests)
3227 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3228 include_directories : dir_include,
3229 build_by_default: program_tests)
3235 'lib/color-names.c',
3236 c_args : ['-DTEST_PROGRAM_COLORS'],
3237 include_directories : dir_include,
3238 link_with : [lib_common, lib_tcolors],
3239 build_by_default: program_tests)
3245 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3246 include_directories : dir_include,
3247 build_by_default: program_tests)
3250 if conf.get('HAVE_OPENAT').to_string() == '1' \
3251 and conf.get('HAVE_DIRFD').to_string() == '1'
3255 c_args : ['-DTEST_PROGRAM_PROCFS'],
3256 include_directories : dir_include,
3257 link_with : lib_common,
3258 build_by_default: program_tests)
3265 have_cpu_set_t ? 'lib/cpuset.c' : [],
3266 c_args : ['-DTEST_PROGRAM_PATH'],
3267 include_directories : dir_include,
3268 link_with : lib_common,
3269 build_by_default: program_tests)
3273 if conf.get('HAVE_PTY').to_string() == '1'
3278 c_args : ['-DTEST_PROGRAM_PTY'],
3279 include_directories : dir_include,
3280 link_with : [lib_common],
3281 dependencies : [lib_m,
3284 build_by_default: program_tests)
3292 c_args : ['-DTEST_PROGRAM_CPUSET'],
3293 include_directories : dir_include,
3294 build_by_default: program_tests)
3305 have_cpu_set_t ? 'lib/cpuset.c' : [],
3306 c_args : ['-DTEST_PROGRAM_SYSFS'],
3307 include_directories : dir_include,
3308 build_by_default: program_tests)
3314 c_args : ['-DTEST_PROGRAM_PAGER'],
3315 include_directories : dir_include,
3316 build_by_default: program_tests)
3320 'test_linux_version',
3321 'lib/linux_version.c',
3322 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3323 include_directories : dir_include,
3324 build_by_default: program_tests)
3330 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3331 include_directories : dir_include,
3332 build_by_default: program_tests)
3336 'test_canonicalize',
3337 'lib/canonicalize.c',
3338 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3339 include_directories : dir_include,
3340 build_by_default: program_tests)
3347 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3348 include_directories : dir_include,
3349 build_by_default: program_tests)
3355 c_args : ['-DTEST_PROGRAM'],
3356 include_directories : dir_include,
3357 link_with : lib_common,
3358 build_by_default: program_tests)
3364 c_args : ['-DTEST_PROGRAM'],
3365 include_directories : dir_include,
3366 link_with : [lib_common, logindefs_c],
3367 build_by_default: program_tests)
3371 ############################################################
3375 'libuuid/src/test_uuid.c',
3376 include_directories : [dir_include, dir_libuuid],
3377 link_with : lib_uuid,
3378 dependencies : socket_libs,
3379 build_by_default: program_tests)
3380 if not is_disabler(exe)
3384 ############################################################
3386 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3387 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid]
3388 libfdisk_tests_ldadd_deps = [blkid_dep]
3392 'libfdisk/src/ask.c',
3393 c_args : libfdisk_tests_cflags,
3394 include_directories : lib_fdisk_includes,
3395 link_with : libfdisk_tests_ldadd,
3396 dependencies : libfdisk_tests_ldadd_deps,
3397 build_by_default: program_tests)
3398 if not is_disabler(exe)
3404 'libfdisk/src/gpt.c',
3405 c_args : libfdisk_tests_cflags,
3406 include_directories : lib_fdisk_includes,
3407 link_with : libfdisk_tests_ldadd,
3408 dependencies : libfdisk_tests_ldadd_deps,
3409 build_by_default: program_tests)
3410 if not is_disabler(exe)
3416 'libfdisk/src/utils.c',
3417 c_args : libfdisk_tests_cflags,
3418 include_directories : lib_fdisk_includes,
3419 link_with : libfdisk_tests_ldadd,
3420 dependencies : libfdisk_tests_ldadd_deps,
3421 build_by_default: program_tests)
3422 if not is_disabler(exe)
3427 'test_fdisk_script',
3428 'libfdisk/src/script.c',
3429 c_args : libfdisk_tests_cflags,
3430 include_directories : lib_fdisk_includes,
3431 link_with : libfdisk_tests_ldadd,
3432 dependencies : libfdisk_tests_ldadd_deps,
3433 build_by_default: program_tests)
3434 if not is_disabler(exe)
3439 'test_fdisk_version',
3440 'libfdisk/src/version.c',
3441 c_args : libfdisk_tests_cflags,
3442 include_directories : lib_fdisk_includes,
3443 link_with : libfdisk_tests_ldadd,
3444 dependencies : libfdisk_tests_ldadd_deps,
3445 build_by_default: program_tests)
3446 if not is_disabler(exe)
3452 'libfdisk/src/item.c',
3453 c_args : libfdisk_tests_cflags,
3454 include_directories : lib_fdisk_includes,
3455 link_with : libfdisk_tests_ldadd,
3456 dependencies : libfdisk_tests_ldadd_deps,
3457 build_by_default: program_tests)
3458 if not is_disabler(exe)
3462 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3465 'sample-fdisk-mkpart',
3466 'libfdisk/samples/mkpart.c',
3467 include_directories : lib_fdisk_includes,
3468 link_with : sample_fdisk_ldadd)
3469 if not is_disabler(exe)
3474 'sample-fdisk-mkpart-fullspec',
3475 'libfdisk/samples/mkpart-fullspec.c',
3476 include_directories : lib_fdisk_includes,
3477 link_with : sample_fdisk_ldadd)
3478 if not is_disabler(exe)
3482 ############################################################
3486 'tests/helpers/test_cap.c',
3487 include_directories : includes,
3488 dependencies : [lib_cap_ng],
3489 build_by_default: program_tests)
3490 if not is_disabler(exe)
3496 'tests/helpers/test_mbsencode.c',
3497 include_directories : includes,
3498 link_with : lib_common,
3499 build_by_default: program_tests)
3504 'tests/helpers/test_byteswap.c',
3505 include_directories : includes,
3506 build_by_default: program_tests)
3511 'tests/helpers/test_md5.c',
3513 include_directories : includes,
3514 build_by_default: program_tests)
3519 'tests/helpers/test_sha1.c',
3521 include_directories : includes,
3522 build_by_default: program_tests)
3527 'tests/helpers/test_pathnames.c',
3528 include_directories : includes,
3529 build_by_default: program_tests)
3534 'tests/helpers/test_strerror.c',
3535 include_directories : includes,
3536 build_by_default: program_tests)
3541 'tests/helpers/test_sysinfo.c',
3542 include_directories : includes,
3543 build_by_default: program_tests)
3548 'tests/helpers/test_sigreceive.c',
3549 include_directories : includes,
3550 link_with : lib_common,
3551 build_by_default: program_tests)
3556 'tests/helpers/test_tiocsti.c',
3557 include_directories : includes,
3558 build_by_default: program_tests)
3562 'test_uuid_namespace',
3563 'tests/helpers/test_uuid_namespace.c',
3567 include_directories : includes,
3568 build_by_default: program_tests)
3571 if LINUX and lib_rt.found()
3574 'tests/helpers/test_mkfds.c',
3575 'tests/helpers/test_mkfds.h',
3576 'tests/helpers/test_mkfds_ppoll.c',
3577 include_directories : includes,
3578 dependencies : [lib_rt],
3579 build_by_default: program_tests)
3585 'tests/helpers/test_enosys.c',
3586 include_directories : includes,
3587 build_by_default: program_tests)
3590 ############################################################
3592 if conf.get('HAVE_OPENAT').to_string() == '1'
3594 'sample-scols-tree',
3595 'libsmartcols/samples/tree.c',
3596 include_directories : includes,
3597 link_with : [lib_smartcols, lib_common],
3598 build_by_default: program_tests)
3599 if not is_disabler(exe)
3605 'sample-scols-title',
3606 'libsmartcols/samples/title.c',
3607 include_directories : includes,
3608 link_with : [lib_smartcols, lib_common])
3609 if not is_disabler(exe)
3614 'sample-scols-wrap',
3615 'libsmartcols/samples/wrap.c',
3616 include_directories : includes,
3617 link_with : [lib_smartcols, lib_common])
3618 if not is_disabler(exe)
3623 'sample-scols-continuous',
3624 'libsmartcols/samples/continuous.c',
3625 include_directories : includes,
3626 link_with : [lib_smartcols, lib_common])
3627 if not is_disabler(exe)
3632 'sample-scols-continuous-json',
3633 'libsmartcols/samples/continuous-json.c',
3634 include_directories : includes,
3635 link_with : [lib_smartcols, lib_common])
3636 if not is_disabler(exe)
3641 'sample-scols-maxout',
3642 'libsmartcols/samples/maxout.c',
3643 include_directories : includes,
3644 link_with : [lib_smartcols, lib_common])
3645 if not is_disabler(exe)
3650 'sample-scols-fromfile',
3651 'libsmartcols/samples/fromfile.c',
3652 include_directories : includes,
3653 link_with : [lib_smartcols, lib_common])
3654 if not is_disabler(exe)
3659 'sample-scols-grouping-simple',
3660 'libsmartcols/samples/grouping-simple.c',
3661 include_directories : includes,
3662 link_with : [lib_smartcols, lib_common])
3663 if not is_disabler(exe)
3668 'sample-scols-grouping-overlay',
3669 'libsmartcols/samples/grouping-overlay.c',
3670 include_directories : includes,
3671 link_with : [lib_smartcols, lib_common])
3672 if not is_disabler(exe)
3678 'Documentation/boilerplate.c',
3679 include_directories : includes,
3680 build_by_default: program_tests)
3681 if not is_disabler(exe)
3685 ############################################################
3687 # Let the test runner know whether we're running under asan and export
3688 # some paths. We use a file on disk so that it is possible to run the
3689 # test scripts from commandline without setting any variables.
3690 configure_file(output : 'meson.conf',
3695 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3696 python.full_path())])
3698 run_sh = find_program('tests/run.sh')
3702 '--srcdir=' + meson.current_source_dir(),
3703 '--builddir=' + meson.current_build_dir(),
3709 manadocs += ['lib/terminal-colors.d.5.adoc']
3710 manadocs += ['libblkid/libblkid.3.adoc']
3714 'libuuid/man/uuid.3.adoc',
3715 'libuuid/man/uuid_clear.3.adoc',
3716 'libuuid/man/uuid_compare.3.adoc',
3717 'libuuid/man/uuid_copy.3.adoc',
3718 'libuuid/man/uuid_generate.3.adoc',
3719 'libuuid/man/uuid_is_null.3.adoc',
3720 'libuuid/man/uuid_parse.3.adoc',
3721 'libuuid/man/uuid_time.3.adoc',
3722 'libuuid/man/uuid_unparse.3.adoc']
3724 'uuid_generate_random.3': 'uuid_generate.3',
3725 'uuid_generate_time.3': 'uuid_generate.3',
3726 'uuid_generate_time_safe.3': 'uuid_generate.3',
3730 asciidoctor = find_program('asciidoctor', required : false)
3731 if asciidoctor.found()
3732 foreach adoc : manadocs
3733 name = adoc.split('/')[-1]
3734 page = name.split('.adoc')[0]
3735 section = page.split('.')[-1]
3736 mandirn = join_paths(mandir, 'man' + section)
3741 command : [ asciidoctor,
3743 '-a', 'VERSION=' + meson.project_version(),
3744 '-a', 'release-version=' + meson.project_version(),
3745 '-a', 'ADJTIME_PATH=/etc/adjtime',
3746 '-a', 'package-docdir=' + docdir,
3747 '--base-dir=' + meson.current_source_dir(),
3748 '--destination-dir=' + meson.current_build_dir(),
3749 '--load-path', '@SOURCE_ROOT@/tools',
3750 '--require', 'asciidoctor-includetracker',
3754 depfile : page + '.deps',
3756 install_dir : mandirn)
3759 foreach link_name, target : manlinks
3760 link_section = link_name.split('.')[-1]
3761 target_section = target.split('.')[-1]
3762 meson.add_install_script(meson_make_manpage_stub,
3763 join_paths('man' + target_section, target),
3764 join_paths(mandir, 'man' + link_section, link_name))
3768 if bash_completion.found()
3769 foreach completion : bashcompletions
3771 join_paths('bash-completion', completion),
3772 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3775 foreach link_name, target : bashcompletionslinks
3776 meson.add_install_script(meson_make_symlink,
3778 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))