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 = get_option('build-libblkid').allowed()
82 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
83 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
85 build_libuuid = not get_option('build-libuuid').disabled()
86 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
87 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
89 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
90 build_liblastlog2 = get_option('build-liblastlog2').require(lib_sqlite3.found()).allowed()
91 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
92 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
94 login_lastlogin = get_option('login-lastlogin')
95 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
96 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
98 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
99 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
100 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
102 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
103 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
105 have_sys_vfs_header = cc.has_header('sys/vfs.h')
107 build_libmount = get_option('build-libmount').require(
108 get_option('build-libblkid').allowed() \
109 and have_sys_vfs_header \
112 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
113 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
114 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
115 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
117 build_libsmartcols = not get_option('build-libsmartcols').disabled()
118 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
119 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
121 build_libfdisk = not get_option('build-libfdisk').require(get_option('build-libblkid').allowed()).disabled()
122 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
123 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
125 build_uuidd = not get_option('build-uuidd').disabled()
126 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
127 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
129 static_programs = get_option('static-programs')
130 need_static_libs = static_programs.length() > 0 # a rough estimate...
131 summary('static programs', static_programs)
133 LINUX = host_machine.system() in ['linux']
134 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
136 ############################################################
154 have = cc.compiles(code, name : 'wchar_t support')
155 if not have and get_option('widechar').enabled()
156 error('widechar support requested but unavailable')
158 if get_option('ncurses').enabled() and get_option('widechar').enabled()
159 error('widechar support is incompatible with non-wide ncurses')
161 conf.set('HAVE_WIDECHAR', have ? 1 : false)
203 linux/net_namespace.h
217 security/pam_modules.h
250 lib_m = cc.find_library('m')
252 lib_tinfo = dependency(
255 required : get_option('tinfo'))
257 lib_ncursesw = dependency(
259 required : get_option('ncursesw'))
260 if lib_ncursesw.found()
261 headers += ['ncursesw/ncurses.h',
265 lib_ncurses = disabler()
267 lib_ncurses = dependency(
270 required : get_option('ncurses'))
271 headers += ['ncurses.h',
275 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
276 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
277 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
279 lib_slang = dependency(
281 required : get_option('slang'))
283 headers += ['slang.h',
288 conf.set('HAVE_SLANG', lib_slang.found())
290 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
291 if curses_libs.found()
292 have = cc.has_function('use_default_colors', dependencies : curses_libs)
293 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
294 have = cc.has_function('resizeterm', dependencies : curses_libs)
295 conf.set('HAVE_RESIZETERM', have ? 1 : false)
303 required : get_option('zlib'))
305 lib_readline = dependency(
307 required : get_option('readline'))
308 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
310 lib_readline_static = dependency(
313 required : need_static_libs ? get_option('readline') : disabler())
315 if meson.version().version_compare('>= 0.59.0')
316 lib_intl = dependency(
318 required : get_option('nls'))
319 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
321 if get_option('nls').enabled()
322 error('nls is not supported with meson before 0.59.0')
324 lib_intl = dependency('', required : false)
327 lib_user = dependency(
330 required : get_option('libuser'))
331 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
333 lib_util = cc.find_library(
335 required : get_option('libutil'))
336 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
338 lib_utempter = cc.find_library(
340 required : get_option('libutempter'))
341 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
343 systemd = dependency(
345 required : get_option('systemd'))
347 lib_systemd = dependency(
349 required : get_option('systemd'))
350 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
351 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
353 have = cc.has_function(
354 'sd_session_get_username',
355 dependencies : lib_systemd)
356 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
358 lib_udev = dependency(
360 required : get_option('systemd'))
361 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
363 lib_crypt = cc.find_library('crypt', required : get_option('build-newgrp'))
364 if not lib_crypt.found()
365 lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin'))
368 lib_pam = cc.find_library(
371 required : get_option('build-login').enabled() or \
372 get_option('build-chfn-chsh').enabled() or \
373 get_option('build-su').enabled() or \
374 get_option('build-runuser').enabled())
376 lib_pam_misc = cc.find_library('pam_misc')
377 lib_pam = [lib_pam, lib_pam_misc]
379 lib_pam_misc = declare_dependency()
382 lib_cryptsetup = dependency(
384 required : get_option('cryptsetup'))
385 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
387 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
389 if meson.version().version_compare('>= 0.62.0')
390 lib_dl = dependency('dl')
392 lib_dl = cc.find_library('dl')
394 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
395 summary('cryptsetup support (dlopen)',
397 section : 'components')
399 summary('cryptsetup support',
400 lib_cryptsetup.found() ? 'enabled' : 'disabled',
401 section : 'components')
404 have = cc.has_function(
405 'crypt_activate_by_signed_key',
406 dependencies : lib_cryptsetup)
407 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
409 lib_cap_ng = dependency(
411 required : get_option('build-setpriv'))
412 if not lib_cap_ng.found()
413 lib_cap_ng = disabler()
416 lib_selinux = dependency(
419 required : get_option('selinux'))
420 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
422 lib_magic = dependency(
424 required : get_option('magic'))
425 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
427 lib_econf = dependency(
429 required : get_option('econf'))
430 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
432 lib_audit = dependency(
434 required : get_option('audit'))
435 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
437 conf.set('HAVE_SMACK', not get_option('smack').disabled())
440 foreach header : headers
441 have = cc.has_header(header)
442 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
445 header = 'linux/btrfs.h'
446 enable_btrfs = cc.has_header(header,
447 required : get_option('btrfs'))
448 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
449 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
451 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
456 have = cc.has_header(header,
458 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
461 have = cc.has_header('sched.h')
462 conf.set10('HAVE_DECL_CPU_ALLOC', have)
463 # We get -1 if the size cannot be determined
464 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
465 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
467 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
468 conf.set('HAVE_ENVIRON_DECL', have ? 1 : false)
470 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
471 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
473 have = cc.has_function('strsignal')
474 conf.set10('HAVE_STRSIGNAL_DECL', have)
476 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
477 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
479 have = cc.has_type('loff_t',
480 args : '-D_GNU_SOURCE',
481 prefix : '#include <sys/types.h>')
482 conf.set('HAVE_LOFF_T', have ? 1 : false)
484 have = cc.compiles('''
485 #define _GNU_SOURCE 1
486 #include <langinfo.h>
489 str = nl_langinfo (ALTMON_1);
490 str = nl_langinfo (ALTMON_2);
491 str = nl_langinfo (ALTMON_3);
492 str = nl_langinfo (ALTMON_4);
493 str = nl_langinfo (ALTMON_5);
494 str = nl_langinfo (ALTMON_6);
495 str = nl_langinfo (ALTMON_7);
496 str = nl_langinfo (ALTMON_8);
497 str = nl_langinfo (ALTMON_9);
498 str = nl_langinfo (ALTMON_10);
499 str = nl_langinfo (ALTMON_11);
500 str = nl_langinfo (ALTMON_12);
504 name : 'langinfo.h defines ALTMON_x constants')
505 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
507 have = cc.compiles('''
508 #define _GNU_SOURCE 1
509 #include <langinfo.h>
512 str = nl_langinfo (_NL_ABALTMON_1);
513 str = nl_langinfo (_NL_ABALTMON_2);
514 str = nl_langinfo (_NL_ABALTMON_3);
515 str = nl_langinfo (_NL_ABALTMON_4);
516 str = nl_langinfo (_NL_ABALTMON_5);
517 str = nl_langinfo (_NL_ABALTMON_6);
518 str = nl_langinfo (_NL_ABALTMON_7);
519 str = nl_langinfo (_NL_ABALTMON_8);
520 str = nl_langinfo (_NL_ABALTMON_9);
521 str = nl_langinfo (_NL_ABALTMON_10);
522 str = nl_langinfo (_NL_ABALTMON_11);
523 str = nl_langinfo (_NL_ABALTMON_12);
527 name : 'langinfo.h defines _NL_ABALTMON_x constants')
528 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
530 have = cc.compiles('''
531 #define _GNU_SOURCE 1
532 #include <langinfo.h>
535 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
539 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
540 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
573 landlock_create_ruleset
575 landlock_restrict_self
638 have = cc.has_function(func)
639 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
640 # This makes little sense, but is necessary to avoid warnings about
641 # redefined macros from Python.h, which uses this convention.
642 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
645 have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
646 conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false)
648 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
649 conf.set('AGETTY_RELOAD', have ? 1 : false)
651 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
654 have_dirfd = (cc.has_function('dirfd') or
655 cc.has_header_symbol('dirent.h', 'dirfd',
656 prefix : '#include <sys/types.h>'))
657 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
659 have_ddfd = cc.has_member('DIR', 'dd_fd',
661 #include <sys/types.h>
664 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
666 have = cc.has_member('struct tm', 'tm_gmtoff',
667 args : '-D_GNU_SOURCE',
672 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
676 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
677 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
679 have = cc.has_member('struct termios', 'c_line',
680 prefix : '#include <termios.h>')
681 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
683 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
684 args : '-D_GNU_SOURCE',
685 prefix : '#include <sys/stat.h>')
686 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
688 have = cc.has_member('struct statx', 'stx_mnt_id',
689 prefix : '#include <sys/stat.h>')
690 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
692 # replacement for AC_STRUCT_TIMEZONE
693 have = cc.has_member('struct tm', 'tm_zone',
694 args : '-D_GNU_SOURCE',
695 prefix : '#include <time.h>')
696 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
698 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
699 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
701 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
702 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
704 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
705 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
710 extern char *tzname[];
713 return tzname ? 0 : 1;
715 '''.format(have ? 1 : 0)
716 have = cc.compiles(code, name : 'using tzname[]')
717 conf.set('HAVE_TZNAME', have ? 1 : false)
719 have = cc.sizeof('time_t', prefix : '#include <time.h>')
721 add_global_arguments('-D_TIME_BITS=64', language : 'c')
722 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
724 if get_option('allow-32bit-time')
725 warning('Could not make time_t 64bits wide')
727 error('Could not make time_t 64bits wide')
733 if not cc.has_function('socket')
734 socket_libs += cc.find_library('socket', required : true)
735 have = cc.has_function('socket',
736 dependencies : socket_libs)
738 error('socket() function not available')
742 lib_rt = cc.find_library('rt', required : false)
744 have = cc.has_function('clock_gettime')
747 realtime_libs += lib_rt
748 have = cc.has_function('clock_gettime',
749 dependencies : realtime_libs)
752 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
754 thread_libs = dependency('threads')
756 have = cc.has_function('timer_create')
759 realtime_libs = [lib_rt]
760 have = cc.has_function('timer_create',
761 dependencies : realtime_libs)
764 realtime_libs += thread_libs
765 have = cc.has_function('timer_create',
766 dependencies : realtime_libs)
769 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
771 have = cc.has_function('setitimer')
772 conf.set('HAVE_SETITIMER', have ? 1 : false)
775 rtas_libs = cc.find_library('rtas', required : false)
776 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
779 if not cc.has_header_symbol('math.h', 'isnan')
780 lib = cc.find_library('m', required : true)
781 if (cc.has_function('isnan', dependencies : lib) and
782 cc.has_function('__isnan', dependencies : lib))
787 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
788 args : '-D_GNU_SOURCE')
789 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
792 extern char *__progname;
794 return (*__progname != 0);
797 have = cc.compiles(code, name : 'using __progname')
798 conf.set('HAVE___PROGNAME', have ? 1 : false)
800 have = conf.get('HAVE_PTY_H').to_string() == '1' \
801 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
802 conf.set('HAVE_PTY', have ? 1 : false)
804 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
805 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
807 build_plymouth_support = get_option('build-plymouth-support')
808 have_tiocglcktrmios = cc.has_header_symbol(
809 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
810 required : build_plymouth_support.enabled())
811 have_sock_cloexec = cc.has_header_symbol(
812 'sys/socket.h', 'SOCK_CLOEXEC',
813 prefix : '#include <sys/types.h>',
814 required : build_plymouth_support.enabled())
815 have_sock_nonblock = cc.has_header_symbol(
816 'sys/socket.h', 'SOCK_NONBLOCK',
817 prefix : '#include <sys/types.h>',
818 required : build_plymouth_support.enabled())
819 have_so_passcred = cc.has_header_symbol(
820 'sys/socket.h', 'SO_PASSCRED',
821 args : ['-D_GNU_SOURCE'],
822 prefix : '#include <sys/types.h>',
823 required : build_plymouth_support.enabled())
825 build_plymouth_support = (not build_plymouth_support.disabled() and
826 have_tiocglcktrmios and
827 have_sock_cloexec and
828 have_sock_nonblock and
830 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
831 summary('plymouth support',
832 build_plymouth_support ? 'enabled' : 'disabled',
833 section : 'components')
835 # check for valid fallocate() function
836 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
837 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
838 # and program can't be linked.
846 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
847 return ret == 0 ? 0 : 1;
850 have = cc.links(code, name : 'fallocate() function')
851 conf.set('HAVE_FALLOCATE', have ? 1 : false)
859 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
860 return ret == 0 ? 0 : 1;
863 have = cc.links(code, name : 'posix_fallocate() function')
864 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
866 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
867 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
868 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
870 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
871 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
872 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
874 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
876 ############################################################
879 fs_search_path = get_option('fs-search-path')
880 fs_search_path_extra = get_option('fs-search-path-extra')
881 if fs_search_path_extra != ''
882 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
884 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
886 systemdsystemunitdir = ''
888 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
891 sysvinit = get_option('sysvinit').enabled()
892 sysvinitrcdir = sysconfdir + '/init.d'
894 program_tests = get_option('program-tests')
896 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
897 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
899 have = get_option('chsh-only-listed')
900 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
902 have = get_option('use-tty-group')
903 conf.set('USE_TTY_GROUP', have ? 1 : false)
905 bison = find_program('bison')
906 flex = find_program('flex')
908 build_hwclock = not get_option('build-hwclock').disabled()
909 bison_gen = generator(
911 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
912 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
914 python_module = import('python')
915 python = python_module.find_installation(
916 get_option('python'),
920 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
921 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
925 configuration : conf)
927 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
932 '-Waddress-of-packed-member',
933 '-Wdiscarded-qualifiers',
934 '-Wembedded-directive',
937 '-Wimplicit-function-declaration',
938 '-Wmissing-declarations',
939 '-Wmissing-parameter-type',
940 '-Wmissing-prototypes',
942 '-Wno-missing-field-initializers',
943 '-Wold-style-definition',
947 '-Wstrict-prototypes',
950 '-Wunused-but-set-parameter',
951 '-Wunused-but-set-variable',
952 '-Wunused-parameter',
958 foreach compiler_flag : compiler_flags
959 if cc.has_argument(compiler_flag)
960 add_project_arguments(compiler_flag, language : 'c')
968 bashcompletionslinks = {}
974 subdir('libsmartcols')
976 subdir('liblastlog2')
978 subdir('pam_lastlog2')
979 subdir('login-utils')
987 includes = [dir_include,
996 opt = not get_option('build-chfn-chsh').disabled()
1001 include_directories : includes,
1002 link_with : [lib_common, logindefs_c],
1003 dependencies : chfn_chsh_deps,
1004 install_dir : usrbin_exec_dir,
1005 install_mode : 'rwsr-xr-x',
1007 build_by_default : opt)
1011 'login-utils/chsh.c',
1014 include_directories : includes,
1015 link_with : lib_common,
1016 dependencies : chfn_chsh_deps,
1017 install_dir : usrbin_exec_dir,
1018 install_mode : 'rwsr-xr-x',
1020 build_by_default : opt)
1021 if opt and not is_disabler(exe)
1023 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1024 bashcompletions += ['chfn', 'chsh']
1029 test_islocal_sources,
1030 include_directories : includes,
1031 c_args : '-DTEST_PROGRAM',
1032 build_by_default : program_tests)
1037 test_consoles_sources,
1038 c_args : ['-DTEST_PROGRAM'],
1039 include_directories : includes,
1040 link_with : lib_common,
1041 build_by_default : program_tests)
1044 opt = not get_option('build-last').disabled()
1048 include_directories : includes,
1049 link_with : [lib_common],
1050 install_dir : usrbin_exec_dir,
1052 build_by_default : opt)
1053 if opt and not is_disabler(exe)
1055 meson.add_install_script(meson_make_symlink,
1057 join_paths(usrbin_exec_dir, 'lastb'))
1058 manadocs += ['login-utils/last.1.adoc']
1059 manlinks += {'lastb.1': 'last.1'}
1060 bashcompletions += ['last']
1061 bashcompletionslinks += {'lastb': 'last'}
1064 opt = not get_option('build-nologin').disabled()
1067 'login-utils/nologin.c',
1068 include_directories : includes,
1069 install_dir : sbindir,
1070 link_with : [lib_common],
1072 build_by_default : opt)
1073 if opt and not is_disabler(exe)
1075 manadocs += ['login-utils/nologin.8.adoc']
1078 opt = not get_option('build-utmpdump').disabled()
1081 'login-utils/utmpdump.c',
1082 include_directories : includes,
1083 link_with : [lib_common],
1084 install_dir : usrbin_exec_dir,
1086 build_by_default : opt)
1087 if opt and not is_disabler(exe)
1089 manadocs += ['login-utils/utmpdump.1.adoc']
1090 bashcompletions += ['utmpdump']
1093 opt = not get_option('build-su').disabled()
1097 'login-utils/su-common.c',
1098 'login-utils/su-common.h',
1102 include_directories : includes,
1103 link_with : [lib_common, logindefs_c],
1104 dependencies : [lib_pam,
1108 install_mode : 'rwsr-xr-x',
1110 build_by_default : opt)
1111 if opt and not is_disabler(exe)
1113 manadocs += ['login-utils/su.1.adoc']
1114 bashcompletions += ['su']
1117 opt = not get_option('build-newgrp').disabled()
1120 'login-utils/newgrp.c',
1121 include_directories : includes,
1122 dependencies : [lib_crypt],
1123 install_dir : usrbin_exec_dir,
1124 install_mode : 'rwsr-xr-x',
1126 build_by_default : opt)
1127 if opt and not is_disabler(exe)
1129 manadocs += ['login-utils/newgrp.1.adoc']
1130 bashcompletions += ['newgrp']
1133 opt = not get_option('build-lslogins').disabled()
1136 'login-utils/lslogins.c',
1137 include_directories : includes,
1138 link_with : [lib_common,
1141 (build_liblastlog2 ? [lib_lastlog2] : []),
1142 dependencies : [lib_selinux,
1144 install_dir : usrbin_exec_dir,
1146 build_by_default : opt)
1147 if opt and not is_disabler(exe)
1149 manadocs += ['login-utils/lslogins.1.adoc']
1150 bashcompletions += ['lslogins']
1153 opt = not get_option('build-vipw').disabled()
1156 'login-utils/vipw.c',
1157 'login-utils/setpwnam.h',
1158 include_directories : includes,
1159 link_with : [lib_common],
1160 dependencies : [lib_selinux],
1161 install_dir : usrbin_exec_dir,
1163 build_by_default : opt)
1164 if opt and not is_disabler(exe)
1166 meson.add_install_script(meson_make_symlink,
1168 join_paths(usrbin_exec_dir, 'vigr'))
1169 manadocs += ['login-utils/vipw.8.adoc']
1170 meson.add_install_script(meson_make_symlink,
1172 join_paths(mandir, 'man8/vigr.8'))
1175 opt = not get_option('build-runuser').disabled()
1178 'login-utils/runuser.c',
1179 'login-utils/su-common.c',
1180 'login-utils/su-common.h',
1184 include_directories : includes,
1185 link_with : [lib_common, logindefs_c],
1186 dependencies : [lib_pam,
1190 install_dir : sbindir,
1192 build_by_default : opt)
1193 if opt and not is_disabler(exe)
1195 manadocs += ['login-utils/runuser.1.adoc']
1196 bashcompletionslinks += {'runuser': 'su'}
1199 ############################################################
1205 include_directories : includes,
1206 link_with : lib_common,
1207 install_dir : usrbin_exec_dir,
1210 manadocs += ['text-utils/col.1.adoc']
1211 bashcompletions += ['col']
1217 include_directories : includes,
1218 install_dir : usrbin_exec_dir,
1221 manadocs += ['text-utils/colcrt.1.adoc']
1222 bashcompletions += ['colcrt']
1227 include_directories : includes,
1228 link_with : lib_common,
1229 install_dir : usrbin_exec_dir,
1232 manadocs += ['text-utils/colrm.1.adoc']
1233 bashcompletions += ['colrm']
1238 include_directories : includes,
1239 install_dir : usrbin_exec_dir,
1242 manadocs += ['text-utils/rev.1.adoc']
1243 bashcompletions += ['rev']
1248 include_directories : includes,
1249 link_with : [lib_common,
1251 install_dir : usrbin_exec_dir,
1253 if not is_disabler(exe)
1255 manadocs += ['text-utils/column.1.adoc']
1256 bashcompletions += ['column']
1259 opt = not get_option('build-line').disabled()
1263 include_directories : includes,
1264 install_dir : usrbin_exec_dir,
1266 build_by_default : opt)
1267 if opt and not is_disabler(exe)
1269 manadocs += ['text-utils/line.1.adoc']
1272 opt = not get_option('build-pg').disabled()
1276 link_with : lib_common,
1277 include_directories : includes,
1278 dependencies : [lib_tinfo,
1280 install_dir : usrbin_exec_dir,
1282 build_by_default : opt)
1283 if opt and not is_disabler(exe)
1285 manadocs += ['text-utils/pg.1.adoc']
1286 bashcompletions += ['pg']
1289 opt = not get_option('build-ul').disabled()
1293 include_directories : includes,
1294 dependencies : [lib_tinfo,
1296 install_dir : usrbin_exec_dir,
1298 build_by_default : opt)
1299 if opt and not is_disabler(exe)
1301 manadocs += ['text-utils/ul.1.adoc']
1302 bashcompletions += ['ul']
1305 opt = not get_option('build-more').disabled()
1309 link_with : [lib_common],
1310 include_directories : includes,
1311 dependencies : [lib_tinfo,
1315 build_by_default : opt)
1319 link_with : [lib_common],
1320 include_directories : includes,
1321 c_args : '-DTEST_PROGRAM',
1322 dependencies : [lib_tinfo,
1325 build_by_default : opt and program_tests)
1327 if opt and not is_disabler(exe)
1329 manadocs += ['text-utils/more.1.adoc']
1330 bashcompletions += ['more']
1336 include_directories : includes,
1337 link_with : [lib_common,
1339 install_dir : usrbin_exec_dir,
1341 if not is_disabler(exe)
1343 manadocs += ['text-utils/hexdump.1.adoc']
1344 bashcompletions += ['hexdump']
1347 opt = not get_option('build-lsmem').disabled()
1351 include_directories : includes,
1352 link_with : [lib_common,
1354 install_dir : usrbin_exec_dir,
1356 build_by_default : opt)
1357 if opt and not is_disabler(exe)
1359 manadocs += ['sys-utils/lsmem.1.adoc']
1360 bashcompletions += ['lsmem']
1363 opt = not get_option('build-chmem').disabled()
1367 include_directories : includes,
1368 link_with : [lib_common],
1369 install_dir : usrbin_exec_dir,
1371 build_by_default : opt)
1372 if opt and not is_disabler(exe)
1374 manadocs += ['sys-utils/chmem.8.adoc']
1375 bashcompletions += ['chmem']
1381 include_directories : includes,
1382 link_with : [lib_common],
1383 install_dir : usrbin_exec_dir,
1386 manadocs += ['sys-utils/choom.1.adoc']
1391 include_directories : includes,
1392 link_with : [lib_common],
1393 install_dir : usrbin_exec_dir,
1396 manadocs += ['sys-utils/ipcmk.1.adoc']
1397 bashcompletions += ['ipcmk']
1402 include_directories : includes,
1403 link_with : [lib_common],
1404 install_dir : usrbin_exec_dir,
1407 manadocs += ['sys-utils/ipcrm.1.adoc']
1408 bashcompletions += ['ipcrm']
1410 opt = not get_option('build-ipcs').disabled()
1414 include_directories : includes,
1415 link_with : [lib_common],
1416 install_dir : usrbin_exec_dir,
1418 build_by_default : opt)
1419 if opt and not is_disabler(exe)
1421 manadocs += ['sys-utils/ipcs.1.adoc']
1422 bashcompletions += ['ipcs']
1425 opt = not get_option('build-rfkill').disabled()
1429 include_directories : includes,
1430 link_with : [lib_common,
1432 install_dir : usrsbin_exec_dir,
1434 build_by_default : opt)
1435 if opt and not is_disabler(exe)
1437 manadocs += ['sys-utils/rfkill.8.adoc']
1438 bashcompletions += ['rfkill']
1444 include_directories : includes,
1445 link_with : [lib_common,
1447 install_dir : usrbin_exec_dir,
1449 if not is_disabler(exe)
1451 manadocs += ['sys-utils/renice.1.adoc']
1452 bashcompletions += ['renice']
1458 include_directories: includes,
1459 link_with : [lib_common,
1461 install_dir : usrbin_exec_dir,
1463 if opt and not is_disabler(exe)
1465 manadocs += ['sys-utils/setpgid.1.adoc']
1466 bashcompletions += ['setpgid']
1472 include_directories : includes,
1473 link_with : [lib_common,
1475 install_dir : usrbin_exec_dir,
1477 if opt and not is_disabler(exe)
1479 manadocs += ['sys-utils/setsid.1.adoc']
1480 bashcompletions += ['setsid']
1485 readprofile_sources,
1486 include_directories : includes,
1487 link_with : [lib_common,
1489 install_dir : usrsbin_exec_dir,
1491 if not is_disabler(exe)
1493 manadocs += ['sys-utils/readprofile.8.adoc']
1494 bashcompletions += ['readprofile']
1497 opt = not get_option('build-tunelp').disabled()
1501 include_directories : includes,
1502 link_with : [lib_common],
1503 install_dir : usrsbin_exec_dir,
1505 build_by_default : opt)
1506 if opt and not is_disabler(exe)
1508 manadocs += ['sys-utils/tunelp.8.adoc']
1509 bashcompletions += ['tunelp']
1512 opt = get_option('build-fstrim').require(have_sys_vfs_header).allowed()
1516 include_directories : includes,
1517 link_with : [lib_common],
1518 dependencies : [mount_dep],
1519 install_dir : sbindir,
1521 build_by_default : opt)
1522 if opt and not is_disabler(exe)
1524 manadocs += ['sys-utils/fstrim.8.adoc']
1525 bashcompletions += ['fstrim']
1531 include_directories : includes,
1532 link_with : [lib_common,
1535 if not is_disabler(exe)
1537 manadocs += ['sys-utils/dmesg.1.adoc']
1538 bashcompletions += ['dmesg']
1544 include_directories : dir_include,
1545 c_args : '-DTEST_DMESG',
1546 link_with : [lib_common,
1548 build_by_default : program_tests)
1549 if not is_disabler(exe)
1556 include_directories : includes,
1557 link_with : [lib_common],
1558 install_dir : sbindir,
1561 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1562 bashcompletions += ['ctrlaltdel']
1567 include_directories : includes,
1568 install_dir : sbindir,
1571 manadocs += ['sys-utils/fsfreeze.8.adoc']
1572 bashcompletions += ['fsfreeze']
1577 include_directories : includes,
1578 link_with : [lib_common],
1579 dependencies : [blkid_dep],
1580 install_dir : sbindir,
1583 manadocs += ['sys-utils/blkdiscard.8.adoc']
1584 bashcompletions += ['blkdiscard']
1586 if cc.has_header('linux/blkzoned.h')
1590 include_directories : includes,
1591 link_with : [lib_common],
1592 install_dir : sbindir,
1595 manadocs += ['sys-utils/blkzone.8.adoc']
1596 bashcompletions += ['blkzone']
1599 if cc.has_header('linux/pr.h')
1603 include_directories : includes,
1604 link_with : [lib_common],
1605 install_dir : sbindir,
1608 manadocs += ['sys-utils/blkpr.8.adoc']
1614 include_directories : includes,
1615 link_with : [lib_common],
1616 install_dir : usrsbin_exec_dir,
1619 manadocs += ['sys-utils/ldattach.8.adoc']
1620 bashcompletions += ['ldattach']
1625 include_directories : includes,
1626 link_with : [lib_common],
1627 install_dir : usrsbin_exec_dir,
1630 manadocs += ['sys-utils/rtcwake.8.adoc']
1631 bashcompletions += ['rtcwake']
1636 include_directories : includes,
1637 link_with : [lib_common],
1638 install_dir : usrbin_exec_dir,
1641 manadocs += ['sys-utils/setarch.8.adoc']
1642 bashcompletions += ['setarch']
1644 setarch_links = ['uname26', 'linux32', 'linux64']
1645 setarch_links_arch = {
1646 's390x' : ['s390', 's390x'],
1648 'x86_64' : ['i386', 'x86_64'],
1649 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1650 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1651 'mips64' : ['mips', 'mips64', 'mips32'],
1652 'ia64' : ['i386', 'ia64'],
1653 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1655 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1657 foreach link: setarch_links
1658 meson.add_install_script(meson_make_symlink,
1660 join_paths(usrbin_exec_dir, link))
1661 manlinks += {link + '.8': 'setarch.8'}
1664 opt = not get_option('build-eject').disabled()
1668 include_directories : includes,
1669 link_with : [lib_common],
1670 dependencies : [mount_dep],
1671 install_dir : usrbin_exec_dir,
1673 build_by_default : opt)
1674 if opt and not is_disabler(exe)
1676 manadocs += ['sys-utils/eject.1.adoc']
1677 bashcompletions += ['eject']
1680 opt = not get_option('build-losetup').disabled()
1684 include_directories : includes,
1685 link_with : [lib_common,
1687 install_dir : sbindir,
1689 build_by_default : opt)
1690 if opt and not is_disabler(exe)
1691 manadocs += ['sys-utils/losetup.8.adoc']
1693 bashcompletions += ['losetup']
1696 opt = opt and 'losetup' in static_programs
1700 include_directories : includes,
1701 link_args : ['--static'],
1702 link_with : [lib_common,
1703 lib_smartcols.get_static_lib()],
1704 install_dir : sbindir,
1706 build_by_default : opt)
1707 if opt and not is_disabler(exe)
1711 opt = not get_option('build-zramctl').disabled()
1715 include_directories : includes,
1716 link_with : [lib_common,
1718 install_dir : sbindir,
1720 build_by_default : opt)
1721 if opt and not is_disabler(exe)
1723 manadocs += ['sys-utils/zramctl.8.adoc']
1724 bashcompletions += ['zramctl']
1730 include_directories : includes,
1731 link_with : [lib_common,
1733 install_dir : usrbin_exec_dir,
1735 if not is_disabler(exe)
1737 manadocs += ['sys-utils/prlimit.1.adoc']
1738 bashcompletions += ['prlimit']
1741 opt = not get_option('build-lsns').disabled()
1745 include_directories : includes,
1746 link_with : [lib_common,
1748 dependencies : [mount_dep],
1749 install_dir : usrbin_exec_dir,
1751 build_by_default : opt)
1752 if opt and not is_disabler(exe)
1754 manadocs += ['sys-utils/lsns.8.adoc']
1755 bashcompletions += ['lsns']
1758 opt = not get_option('build-mount').disabled()
1762 include_directories : includes,
1763 link_with : [lib_common,
1765 dependencies : [lib_selinux, mount_dep],
1766 install_mode : 'rwsr-xr-x',
1768 build_by_default : opt)
1772 include_directories : includes,
1773 link_with : [lib_common],
1774 dependencies : [mount_dep],
1775 install_mode : 'rwsr-xr-x',
1777 build_by_default : opt)
1778 if opt and not is_disabler(exe)
1780 manadocs += ['sys-utils/fstab.5.adoc',
1781 'sys-utils/mount.8.adoc',
1782 'sys-utils/umount.8.adoc']
1783 bashcompletions += ['mount', 'umount']
1786 opt2 = opt and 'mount' in static_programs
1790 include_directories : includes,
1791 link_args : ['--static'],
1792 link_with : [lib_common,
1793 lib_smartcols_static],
1794 dependencies : [mount_static_dep],
1796 build_by_default : opt2)
1797 if opt2 and not is_disabler(exe)
1801 opt2 = opt and 'umount' in static_programs
1805 include_directories : includes,
1806 link_args : ['--static'],
1807 link_with : [lib_common],
1808 dependencies : [mount_static_dep],
1810 build_by_default : opt2)
1811 if opt2 and not is_disabler(exe)
1817 opt = not get_option('build-swapon').disabled()
1821 include_directories : includes,
1822 link_with : [lib_common,
1824 dependencies : [blkid_dep, mount_dep],
1825 install_dir : sbindir,
1827 build_by_default : opt)
1828 if opt and not is_disabler(exe)
1830 manadocs += ['sys-utils/swapon.8.adoc']
1831 bashcompletions += ['swapon']
1834 opt = not get_option('build-swapoff').disabled()
1838 include_directories : includes,
1839 link_with : [lib_common],
1840 dependencies : [blkid_dep, mount_dep],
1841 install_dir : sbindir,
1843 build_by_default : opt)
1844 if opt and not is_disabler(exe)
1846 manlinks += {'swapoff.8': 'swapon.8'}
1847 bashcompletions += ['swapoff']
1853 include_directories : includes,
1854 link_with : [lib_common,
1856 dependencies : [rtas_libs],
1857 install_dir : usrbin_exec_dir,
1859 if not is_disabler(exe)
1861 manadocs += ['sys-utils/lscpu.1.adoc']
1862 bashcompletions += ['lscpu']
1868 include_directories : includes,
1869 link_with : [lib_common],
1870 install_dir : sbindir,
1873 manadocs += ['sys-utils/chcpu.8.adoc']
1874 bashcompletions += ['chcpu']
1879 include_directories : includes,
1880 link_with : [lib_common,
1883 if not is_disabler(exe)
1885 manadocs += ['sys-utils/wdctl.8.adoc']
1886 bashcompletions += ['wdctl']
1889 opt = not get_option('build-mountpoint').disabled()
1893 include_directories : includes,
1894 dependencies : [mount_dep],
1896 build_by_default : opt)
1897 if opt and not is_disabler(exe)
1899 manadocs += ['sys-utils/mountpoint.1.adoc']
1900 bashcompletions += ['mountpoint']
1903 opt = not get_option('build-fallocate').disabled()
1907 include_directories : includes,
1908 link_with : [lib_common],
1909 install_dir : usrbin_exec_dir,
1911 build_by_default : opt)
1912 if opt and not is_disabler(exe)
1914 manadocs += ['sys-utils/fallocate.1.adoc']
1915 bashcompletions += ['fallocate']
1918 opt = not get_option('build-pivot_root').disabled()
1922 include_directories : includes,
1923 install_dir : sbindir,
1925 build_by_default : opt)
1926 if opt and not is_disabler(exe)
1928 manadocs += ['sys-utils/pivot_root.8.adoc']
1929 bashcompletions += ['pivot_root']
1932 opt = not get_option('build-switch_root').disabled()
1933 if opt and not have_dirfd and not have_ddfd
1934 error('neither dirfd nor ddfd are available')
1938 switch_root_sources,
1939 include_directories : includes,
1940 install_dir : sbindir,
1942 build_by_default : opt)
1943 if opt and not is_disabler(exe)
1945 manadocs += ['sys-utils/switch_root.8.adoc']
1948 opt = not get_option('build-unshare').disabled()
1952 include_directories : includes,
1953 link_with : [lib_common],
1954 dependencies : [mount_dep],
1955 install_dir : usrbin_exec_dir,
1957 build_by_default : opt)
1958 if opt and not is_disabler(exe)
1960 manadocs += ['sys-utils/unshare.1.adoc']
1961 bashcompletions += ['unshare']
1964 opt = opt and 'unshare' in static_programs
1968 include_directories : includes,
1969 link_with : [lib_common],
1970 dependencies : [mount_dep],
1971 install_dir : usrbin_exec_dir,
1973 build_by_default : opt)
1974 if opt and not is_disabler(exe)
1978 opt = not get_option('build-nsenter').disabled()
1982 include_directories : includes,
1983 link_with : [lib_common],
1984 dependencies : [lib_selinux],
1985 install_dir : usrbin_exec_dir,
1987 build_by_default : opt)
1988 if opt and not is_disabler(exe)
1990 manadocs += ['sys-utils/nsenter.1.adoc']
1991 bashcompletions += ['nsenter']
1994 opt = opt and 'nsenter' in static_programs
1998 include_directories : includes,
1999 link_with : [lib_common],
2000 dependencies : [lib_selinux],
2001 install_dir : usrbin_exec_dir,
2003 build_by_default : opt)
2004 if opt and not is_disabler(exe)
2008 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
2012 include_directories : includes,
2013 link_with : [lib_common],
2014 dependencies : [lib_cap_ng],
2015 install_dir : usrbin_exec_dir,
2017 build_by_default : opt)
2018 if opt and not is_disabler(exe)
2020 manadocs += ['sys-utils/setpriv.1.adoc']
2021 bashcompletions += ['setpriv']
2027 include_directories : includes,
2028 link_with : [lib_common],
2029 dependencies : realtime_libs,
2030 install_dir : usrbin_exec_dir,
2033 manadocs += ['sys-utils/flock.1.adoc']
2034 bashcompletions += ['flock']
2036 opt = not get_option('build-lsirq').disabled()
2040 include_directories : includes,
2041 link_with : [lib_common,
2043 install_dir : usrbin_exec_dir,
2045 build_by_default : opt)
2046 if opt and not is_disabler(exe)
2048 manadocs += ['sys-utils/lsirq.1.adoc']
2049 bashcompletions += ['lsirq']
2052 opt = not get_option('build-irqtop').disabled()
2056 include_directories : includes,
2057 dependencies : [realtime_libs, curses_libs],
2058 link_with : [lib_common,
2061 install_dir : usrbin_exec_dir,
2063 build_by_default : opt)
2064 if opt and not is_disabler(exe)
2066 manadocs += ['sys-utils/irqtop.1.adoc']
2067 bashcompletions += ['irqtop']
2070 opt = not get_option('build-ipcs').disabled()
2074 include_directories : includes,
2075 link_with : [lib_common,
2077 install_dir : usrbin_exec_dir,
2079 build_by_default : opt)
2080 if opt and not is_disabler(exe)
2082 manadocs += ['sys-utils/lsipc.1.adoc']
2083 bashcompletions += ['lsipc']
2090 include_directories : includes,
2091 link_with : [lib_common],
2092 dependencies : [lib_m,
2094 install_dir : sbindir,
2096 build_by_default : opt)
2097 if opt and not is_disabler(exe)
2099 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2100 bashcompletions += ['hwclock']
2106 include_directories : includes,
2107 install_dir : sbindir,
2110 manadocs += ['disk-utils/mkfs.8.adoc']
2111 bashcompletions += ['mkfs']
2113 opt = not get_option('build-bfs').disabled()
2117 include_directories : includes,
2118 link_with : [lib_common],
2119 install_dir : sbindir,
2121 build_by_default : opt)
2122 if opt and not is_disabler(exe)
2124 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2125 bashcompletions += ['mkfs.bfs']
2131 include_directories : includes,
2132 link_with : [lib_common],
2133 install_dir : usrbin_exec_dir,
2136 manadocs += ['disk-utils/isosize.8.adoc']
2137 bashcompletions += ['isosize']
2142 include_directories : includes,
2143 link_with : [lib_common,
2145 dependencies: [blkid_dep, lib_selinux],
2146 install_dir : sbindir,
2148 if not is_disabler(exe)
2150 manadocs += ['disk-utils/mkswap.8.adoc']
2151 bashcompletions += ['mkswap']
2157 include_directories : includes,
2158 link_with : [lib_common,
2160 dependencies : [blkid_dep],
2161 install_dir : sbindir,
2163 if not is_disabler(exe)
2165 manadocs += ['disk-utils/swaplabel.8.adoc']
2166 bashcompletions += ['swaplabel']
2169 opt = not get_option('build-fsck').disabled()
2173 include_directories : includes,
2174 link_with : [lib_common],
2175 dependencies : [blkid_dep, mount_dep, realtime_libs],
2176 install_dir : sbindir,
2178 build_by_default : opt)
2179 if opt and not is_disabler(exe)
2181 manadocs += ['disk-utils/fsck.8.adoc']
2182 bashcompletions += ['fsck']
2185 opt = not get_option('build-minix').disabled()
2189 include_directories : includes,
2190 link_with : [lib_common],
2191 install_dir : sbindir,
2193 build_by_default : opt)
2197 include_directories : includes,
2198 c_args : '-DTEST_SCRIPT',
2199 link_with : [lib_common],
2200 build_by_default : opt and program_tests)
2204 include_directories : includes,
2205 link_with : [lib_common],
2206 install_dir : sbindir,
2208 build_by_default : opt)
2209 if opt and not is_disabler(exe)
2210 exes += [exe, exe2, exe3]
2211 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2212 bashcompletions += ['mkfs.minix', 'fsck.minix']
2215 opt = not get_option('build-cramfs').disabled()
2218 mkfs_cramfs_sources,
2219 include_directories : includes,
2220 link_with : [lib_common],
2221 dependencies : [lib_z],
2222 install_dir : sbindir,
2224 build_by_default : opt)
2227 fsck_cramfs_sources,
2228 include_directories : includes,
2229 link_with : [lib_common],
2230 dependencies : [lib_z],
2231 install_dir : sbindir,
2233 build_by_default : opt)
2234 if not is_disabler(exe)
2236 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2237 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2240 opt = not get_option('build-raw').disabled()
2242 cc.has_header('linux/raw.h', required: opt)
2247 include_directories : includes,
2248 install_dir : sbindir,
2250 build_by_default : opt)
2251 if opt and not is_disabler(exe)
2253 manadocs += ['disk-utils/raw.8.adoc']
2254 bashcompletions += ['raw']
2257 opt = not get_option('build-fdformat').disabled()
2261 include_directories : includes,
2262 link_with : [lib_common],
2263 install_dir : usrsbin_exec_dir,
2265 build_by_default : opt)
2266 if opt and not is_disabler(exe)
2268 manadocs += ['disk-utils/fdformat.8.adoc']
2269 bashcompletions += ['fdformat']
2275 include_directories : includes,
2276 link_with : [lib_common],
2277 install_dir : sbindir,
2279 manadocs += ['disk-utils/blockdev.8.adoc']
2280 bashcompletions += ['blockdev']
2282 opt = not get_option('build-fdisks').disabled()
2283 if opt and not have_dirfd and not have_ddfd
2284 error('neither dirfd nor ddfd are available')
2289 include_directories : includes,
2290 link_with : [lib_common,
2294 dependencies : [lib_readline],
2295 install_dir : sbindir,
2297 build_by_default : opt)
2298 if opt and not is_disabler(exe)
2300 bashcompletions += ['fdisk']
2303 opt2 = opt and 'fdisk' in static_programs
2307 link_args : ['--static'],
2308 include_directories : includes,
2309 link_with : [lib_common,
2312 lib_smartcols.get_static_lib()],
2313 dependencies : [lib_readline_static],
2314 install_dir : sbindir,
2316 build_by_default : opt2)
2317 if opt2 and not is_disabler(exe)
2324 include_directories : includes,
2325 link_with : [lib_common,
2329 dependencies : [lib_readline],
2330 install_dir : sbindir,
2332 build_by_default : opt)
2333 if opt and not is_disabler(exe)
2335 bashcompletions += ['sfdisk']
2338 opt2 = opt and 'sfdisk' in static_programs
2342 include_directories : includes,
2343 link_with : [lib_common,
2346 lib_smartcols.get_static_lib()],
2347 dependencies : [lib_readline_static],
2348 install_dir : sbindir,
2350 build_by_default : opt2)
2351 if opt2 and not is_disabler(exe)
2358 include_directories : includes,
2359 link_with : [lib_common,
2363 dependencies : [curses_libs, mount_dep],
2364 install_dir : sbindir,
2366 build_by_default : opt)
2367 if opt and not is_disabler(exe)
2369 manadocs += ['disk-utils/fdisk.8.adoc',
2370 'disk-utils/sfdisk.8.adoc',
2371 'disk-utils/cfdisk.8.adoc']
2372 bashcompletions += ['cfdisk']
2375 opt = not get_option('build-partx').disabled()
2379 include_directories : includes,
2380 link_with : [lib_common],
2381 install_dir : usrsbin_exec_dir,
2383 build_by_default : opt)
2387 include_directories : includes,
2388 link_with : [lib_common],
2389 install_dir : usrsbin_exec_dir,
2391 build_by_default : opt)
2395 include_directories : includes,
2396 link_with : [lib_common],
2397 install_dir : usrsbin_exec_dir,
2399 build_by_default : opt)
2403 include_directories : includes,
2404 link_with : [lib_common,
2406 dependencies : [blkid_dep],
2407 install_dir : usrsbin_exec_dir,
2409 build_by_default : opt)
2411 exes += [exe, exe2, exe3, exe4]
2412 manadocs += ['disk-utils/addpart.8.adoc',
2413 'disk-utils/delpart.8.adoc',
2414 'disk-utils/resizepart.8.adoc',
2415 'disk-utils/partx.8.adoc']
2416 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2418 opt = opt and 'partx' in static_programs
2422 include_directories : includes,
2423 link_args : ['--static'],
2424 link_with : [lib_common],
2425 install_dir : usrsbin_exec_dir,
2427 build_by_default : opt)
2431 include_directories : includes,
2432 link_args : ['--static'],
2433 link_with : [lib_common],
2434 install_dir : usrsbin_exec_dir,
2436 build_by_default : opt)
2438 'resizepart.static',
2440 include_directories : includes,
2441 link_args : ['--static'],
2442 link_with : [lib_common],
2443 install_dir : usrsbin_exec_dir,
2445 build_by_default : opt)
2449 include_directories : includes,
2450 link_args : ['--static'],
2451 link_with : [lib_common,
2452 lib_smartcols.get_static_lib()],
2453 dependencies : [blkid_static_dep],
2454 install_dir : usrsbin_exec_dir,
2456 build_by_default : opt)
2459 exes += [exe, exe2, exe3, exe4]
2462 ############################################################
2467 include_directories : includes,
2468 link_with : [lib_common],
2469 dependencies : [lib_util,
2473 install_dir : usrbin_exec_dir,
2476 manadocs += ['term-utils/script.1.adoc']
2477 bashcompletions += ['script']
2482 include_directories : includes,
2483 c_args : '-DTEST_SCRIPT',
2484 link_with : [lib_common],
2485 dependencies : [lib_util,
2489 build_by_default : program_tests)
2495 include_directories : includes,
2496 link_with : [lib_common],
2497 dependencies : [lib_util,
2500 install_dir : usrbin_exec_dir,
2503 manadocs += ['term-utils/scriptlive.1.adoc']
2504 bashcompletions += ['scriptlive']
2508 scriptreplay_sources,
2509 include_directories : includes,
2510 link_with : [lib_common],
2511 dependencies : [math_libs],
2512 install_dir : usrbin_exec_dir,
2515 manadocs += ['term-utils/scriptreplay.1.adoc']
2516 bashcompletions += ['scriptreplay']
2518 opt = not get_option('build-agetty').disabled()
2522 include_directories : includes,
2523 link_with : [lib_common, logindefs_c],
2524 dependencies : [BSD ? lib_util : [], lib_systemd],
2525 install_dir : sbindir,
2527 build_by_default : opt)
2530 manadocs += ['term-utils/agetty.8.adoc']
2533 opt = not get_option('build-setterm').disabled()
2537 include_directories : includes,
2538 link_with : [lib_common],
2539 dependencies : [curses_libs],
2540 install_dir : usrbin_exec_dir,
2542 build_by_default : opt)
2545 manadocs += ['term-utils/setterm.1.adoc']
2546 bashcompletions += ['setterm']
2549 opt = not get_option('build-mesg').disabled()
2553 include_directories : includes,
2554 link_with : [lib_common],
2555 install_dir : usrbin_exec_dir,
2557 build_by_default : opt)
2560 manadocs += ['term-utils/mesg.1.adoc']
2561 bashcompletions += ['mesg']
2564 opt = not get_option('build-wall').disabled()
2568 include_directories : includes,
2569 link_with : [lib_common],
2570 dependencies : [lib_systemd],
2571 install_dir : usrbin_exec_dir,
2572 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2574 build_by_default : opt)
2577 manadocs += ['term-utils/wall.1.adoc']
2578 bashcompletions += ['wall']
2581 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2582 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2584 opt = not get_option('build-write').disabled()
2588 include_directories : includes,
2589 link_with : [lib_common],
2590 dependencies : [lib_systemd],
2591 install_dir : usrbin_exec_dir,
2592 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2594 build_by_default : opt)
2597 manadocs += ['term-utils/write.1.adoc']
2598 bashcompletions += ['write']
2601 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2602 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2604 opt = not get_option('build-login').disabled()
2608 include_directories : includes,
2609 link_with : [lib_common, logindefs_c],
2610 dependencies : [lib_pam,
2614 build_by_default : opt)
2615 if not is_disabler(exe)
2617 manadocs += ['login-utils/login.1.adoc']
2620 opt = not get_option('build-sulogin').disabled()
2624 include_directories : includes,
2625 link_with : [lib_common],
2626 dependencies : [lib_crypt,
2628 install_dir : sbindir,
2630 build_by_default : opt)
2631 if not is_disabler(exe)
2633 manadocs += ['login-utils/sulogin.8.adoc']
2639 include_directories : includes,
2640 link_with : [lib_common,
2642 dependencies : [curses_libs],
2643 install_dir : usrbin_exec_dir,
2646 manadocs += ['misc-utils/cal.1.adoc']
2647 bashcompletions += ['cal']
2649 opt = not get_option('build-logger').disabled()
2653 include_directories : includes,
2654 link_with : [lib_common],
2655 dependencies : [lib_systemd],
2656 install_dir : usrbin_exec_dir,
2658 build_by_default : opt)
2659 if opt and not is_disabler(exe)
2661 manadocs += ['misc-utils/logger.1.adoc']
2662 bashcompletions += ['logger']
2668 include_directories : includes,
2669 c_args : '-DTEST_LOGGER',
2670 link_with : [lib_common],
2671 dependencies : [lib_systemd],
2672 build_by_default: program_tests)
2673 if not is_disabler(exe)
2680 include_directories : includes,
2681 install_dir : usrbin_exec_dir,
2684 manadocs += ['misc-utils/look.1.adoc']
2685 bashcompletions += ['look']
2690 include_directories : includes,
2691 link_with : [lib_common],
2692 install_dir : usrbin_exec_dir,
2695 manadocs += ['misc-utils/mcookie.1.adoc']
2696 bashcompletions += ['mcookie']
2698 if build_liblastlog2
2702 include_directories : includes,
2703 link_with : [lib_common, lib_lastlog2],
2704 install_dir : usrbin_exec_dir,
2707 manadocs += ['misc-utils/lastlog2.8.adoc']
2708 bashcompletions += ['lastlog2']
2709 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2710 'liblastlog2/man/ll2_write_entry.3.adoc',
2711 'liblastlog2/man/ll2_read_entry.3.adoc',
2712 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2713 'liblastlog2/man/ll2_read_all.3.adoc',
2714 'liblastlog2/man/ll2_remove_entry.3.adoc',
2715 'liblastlog2/man/ll2_rename_user.3.adoc',
2716 'liblastlog2/man/ll2_update_login_time.3.adoc'
2723 include_directories : includes,
2724 dependencies : [lib_selinux],
2725 install_dir : usrbin_exec_dir,
2728 manadocs += ['misc-utils/namei.1.adoc']
2729 bashcompletions += ['namei']
2734 include_directories : includes,
2735 link_with : [lib_common],
2736 install_dir : usrbin_exec_dir,
2739 manadocs += ['misc-utils/whereis.1.adoc']
2740 bashcompletions += ['whereis']
2742 opt = not get_option('build-lslocks').disabled()
2746 include_directories : includes,
2747 link_with : [lib_common,
2749 dependencies : [mount_dep],
2750 install_dir : usrbin_exec_dir,
2752 build_by_default : opt)
2753 if opt and not is_disabler(exe)
2755 manadocs += ['misc-utils/lslocks.8.adoc']
2756 bashcompletions += ['lslocks']
2759 opt = not get_option('build-lsblk').disabled()
2763 include_directories : includes,
2764 link_with : [lib_common,
2767 dependencies : [blkid_dep, lib_udev, mount_dep],
2769 build_by_default : opt)
2770 if opt and not is_disabler(exe)
2772 manadocs += ['misc-utils/lsblk.8.adoc']
2773 bashcompletions += ['lsblk']
2776 errnos_h = custom_target('errnos.h',
2777 input : 'tools/all_errnos',
2778 output : 'errnos.h',
2779 command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
2782 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2785 lsfd_sources, errnos_h,
2786 include_directories : includes,
2787 link_with : [lib_common,
2789 dependencies : [lib_rt],
2790 install_dir : usrbin_exec_dir,
2792 build_by_default : opt)
2793 if opt and not is_disabler(exe)
2795 manadocs += ['misc-utils/lsfd.1.adoc']
2801 include_directories : includes,
2802 link_with : [lib_common,
2804 install_dir : usrbin_exec_dir,
2806 if not is_disabler(exe)
2808 manadocs += ['misc-utils/uuidgen.1.adoc']
2809 bashcompletions += ['uuidgen']
2815 include_directories : includes,
2816 link_with : [lib_common,
2819 install_dir : usrbin_exec_dir,
2821 if not is_disabler(exe)
2823 manadocs += ['misc-utils/uuidparse.1.adoc']
2824 bashcompletions += ['uuidparse']
2831 include_directories : includes,
2832 link_with : [lib_common,
2834 dependencies : [realtime_libs,
2836 install_dir : usrsbin_exec_dir,
2838 build_by_default : opt)
2842 include_directories : includes,
2843 link_with : [lib_common,
2845 dependencies : thread_libs,
2846 build_by_default : opt and program_tests)
2847 if not is_disabler(exe)
2849 manadocs += ['misc-utils/uuidd.8.adoc']
2850 bashcompletions += ['uuidd']
2853 opt = build_libblkid
2857 include_directories : includes,
2858 link_with : [lib_common],
2859 dependencies : [blkid_dep],
2860 install_dir : sbindir,
2862 build_by_default : opt)
2863 if opt and not is_disabler(exe)
2865 manadocs += ['misc-utils/blkid.8.adoc']
2866 bashcompletions += ['blkid']
2869 opt = opt and 'blkid' in static_programs
2873 include_directories : includes,
2874 link_with : [lib_common],
2875 dependencies : [blkid_static_dep],
2876 install_dir : sbindir,
2878 build_by_default : opt)
2879 if opt and not is_disabler(exe)
2885 'libblkid/samples/mkfs.c',
2886 include_directories : includes,
2887 dependencies : [blkid_dep])
2888 if not is_disabler(exe)
2893 'sample-partitions',
2894 'libblkid/samples/partitions.c',
2895 include_directories : includes,
2896 dependencies : [blkid_dep])
2897 if not is_disabler(exe)
2902 'sample-superblocks',
2903 'libblkid/samples/superblocks.c',
2904 include_directories : includes,
2905 dependencies : [blkid_dep])
2906 if not is_disabler(exe)
2912 'libblkid/samples/topology.c',
2913 include_directories : includes,
2914 dependencies : [blkid_dep])
2915 if not is_disabler(exe)
2920 'test_blkid_fuzz_sample',
2921 'libblkid/src/fuzz.c',
2922 include_directories: includes,
2923 dependencies : [blkid_dep],
2924 build_by_default: program_tests)
2925 if not is_disabler(exe)
2929 ############################################################
2934 include_directories : includes,
2935 dependencies : [blkid_dep],
2936 install_dir : sbindir,
2938 if not is_disabler(exe)
2940 manadocs += ['misc-utils/findfs.8.adoc']
2941 bashcompletions += ['findfs']
2947 include_directories : includes,
2948 link_with : [lib_common,
2950 dependencies : [blkid_dep],
2951 install_dir : sbindir,
2953 if not is_disabler(exe)
2955 manadocs += ['misc-utils/wipefs.8.adoc']
2956 bashcompletions += ['wipefs']
2959 opt = not get_option('build-findmnt').disabled()
2963 include_directories : includes,
2964 link_with : [lib_common,
2966 dependencies : [blkid_dep, lib_udev, mount_dep],
2968 build_by_default : opt)
2969 if opt and not is_disabler(exe)
2971 manadocs += ['misc-utils/findmnt.8.adoc']
2972 bashcompletions += ['findmnt']
2978 include_directories : includes,
2979 link_with : [lib_common],
2981 if not is_disabler(exe)
2983 manadocs += ['misc-utils/kill.1.adoc']
2986 opt = not get_option('build-rename').disabled()
2990 include_directories : includes,
2991 install_dir : usrbin_exec_dir,
2993 build_by_default : opt)
2994 if opt and not is_disabler(exe)
2996 manadocs += ['misc-utils/rename.1.adoc']
2997 bashcompletions += ['rename']
3003 include_directories : includes,
3004 link_with : [lib_common],
3005 install_dir : usrbin_exec_dir,
3008 manadocs += ['misc-utils/getopt.1.adoc']
3009 bashcompletions += ['getopt']
3014 include_directories : includes,
3015 link_with : [lib_common,
3017 install_dir : usrbin_exec_dir,
3019 if not is_disabler(exe)
3021 manadocs += ['misc-utils/fincore.1.adoc']
3022 bashcompletions += ['fincore']
3028 include_directories : includes,
3029 link_with : [lib_common],
3030 install_dir : usrbin_exec_dir,
3032 if not is_disabler(exe)
3034 manadocs += ['misc-utils/hardlink.1.adoc']
3035 bashcompletions += ['hardlink']
3038 opt = not get_option('build-pipesz').disabled()
3042 include_directories : includes,
3043 link_with : [lib_common],
3044 install_dir : usrbin_exec_dir,
3046 if opt and not is_disabler(exe)
3048 manadocs += ['misc-utils/pipesz.1.adoc']
3049 bashcompletions += ['pipesz']
3055 include_directories : includes,
3056 c_args : '-DTEST_CAL',
3057 link_with : [lib_common,
3059 dependencies : [curses_libs],
3060 build_by_default: program_tests)
3061 if not is_disabler(exe)
3068 include_directories : includes,
3069 link_with : [lib_common],
3070 install_dir : usrbin_exec_dir,
3072 if not is_disabler(exe)
3074 manadocs += ['misc-utils/fadvise.1.adoc']
3075 bashcompletions += ['fadvise']
3078 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3082 include_directories : includes,
3083 link_with : [lib_common],
3084 install_dir : usrbin_exec_dir,
3086 if not is_disabler(exe)
3088 manadocs += ['misc-utils/waitpid.1.adoc']
3089 bashcompletions += ['waitpid']
3093 syscalls_h = custom_target('syscalls.h',
3094 input : 'tools/all_syscalls',
3095 output : 'syscalls.h',
3096 command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
3099 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3102 'misc-utils/enosys.c', syscalls_h, errnos_h,
3103 include_directories : includes,
3104 link_with : [lib_common],
3105 install_dir : usrbin_exec_dir,
3107 if not is_disabler(exe)
3109 manadocs += ['misc-utils/enosys.1.adoc']
3110 bashcompletions += ['enosys']
3117 include_directories : includes,
3118 link_with : [lib_common, lib_smartcols],
3119 install_dir : usrbin_exec_dir,
3121 if not is_disabler(exe)
3123 manadocs += ['misc-utils/lsclocks.1.adoc']
3124 bashcompletions += ['lsclocks']
3127 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3131 include_directories : includes,
3132 link_with : [lib_common],
3133 install_dir : usrbin_exec_dir,
3135 if not is_disabler(exe)
3137 manadocs += ['misc-utils/exch.1.adoc']
3138 bashcompletions += ['exch']
3142 ############################################################
3144 opt = not get_option('build-schedutils').disabled()
3147 'schedutils/chrt.c',
3148 include_directories : includes,
3149 link_with : lib_common,
3150 install_dir : usrbin_exec_dir,
3152 build_by_default : opt)
3156 'schedutils/ionice.c',
3157 include_directories : includes,
3158 link_with : lib_common,
3159 install_dir : usrbin_exec_dir,
3161 build_by_default : opt)
3165 'schedutils/taskset.c',
3166 include_directories : includes,
3167 link_with : lib_common,
3168 install_dir : usrbin_exec_dir,
3170 build_by_default : opt)
3174 'schedutils/uclampset.c',
3175 include_directories : includes,
3176 link_with : lib_common,
3177 install_dir : usrbin_exec_dir,
3179 build_by_default : opt)
3181 if opt and not is_disabler(exe)
3182 exes += [exe, exe2, exe3, exe4]
3183 manadocs += ['schedutils/chrt.1.adoc',
3184 'schedutils/ionice.1.adoc',
3185 'schedutils/taskset.1.adoc',
3186 'schedutils/uclampset.1.adoc']
3187 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3190 ############################################################
3192 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3197 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3198 include_directories : dir_include,
3199 link_with : lib_common,
3200 build_by_default: program_tests)
3206 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3207 include_directories : dir_include,
3208 link_with : lib_common,
3209 build_by_default: program_tests)
3215 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3216 include_directories : dir_include,
3217 link_with : lib_common,
3218 build_by_default: program_tests)
3224 c_args : ['-DTEST_PROGRAM_MANGLE'],
3225 include_directories : dir_include,
3226 build_by_default: program_tests)
3232 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3233 include_directories : dir_include,
3234 build_by_default: program_tests)
3240 'lib/color-names.c',
3241 c_args : ['-DTEST_PROGRAM_COLORS'],
3242 include_directories : dir_include,
3243 link_with : [lib_common, lib_tcolors],
3244 build_by_default: program_tests)
3250 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3251 include_directories : dir_include,
3252 build_by_default: program_tests)
3255 if conf.get('HAVE_OPENAT').to_string() == '1' \
3256 and conf.get('HAVE_DIRFD').to_string() == '1'
3260 c_args : ['-DTEST_PROGRAM_PROCFS'],
3261 include_directories : dir_include,
3262 link_with : lib_common,
3263 build_by_default: program_tests)
3270 have_cpu_set_t ? 'lib/cpuset.c' : [],
3271 c_args : ['-DTEST_PROGRAM_PATH'],
3272 include_directories : dir_include,
3273 link_with : lib_common,
3274 build_by_default: program_tests)
3278 if conf.get('HAVE_PTY').to_string() == '1'
3283 c_args : ['-DTEST_PROGRAM_PTY'],
3284 include_directories : dir_include,
3285 link_with : [lib_common],
3286 dependencies : [lib_m,
3289 build_by_default: program_tests)
3297 c_args : ['-DTEST_PROGRAM_CPUSET'],
3298 include_directories : dir_include,
3299 build_by_default: program_tests)
3310 have_cpu_set_t ? 'lib/cpuset.c' : [],
3311 c_args : ['-DTEST_PROGRAM_SYSFS'],
3312 include_directories : dir_include,
3313 build_by_default: program_tests)
3319 c_args : ['-DTEST_PROGRAM_PAGER'],
3320 include_directories : dir_include,
3321 build_by_default: program_tests)
3325 'test_linux_version',
3326 'lib/linux_version.c',
3327 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3328 include_directories : dir_include,
3329 build_by_default: program_tests)
3335 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3336 include_directories : dir_include,
3337 build_by_default: program_tests)
3341 'test_canonicalize',
3342 'lib/canonicalize.c',
3343 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3344 include_directories : dir_include,
3345 build_by_default: program_tests)
3352 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3353 include_directories : dir_include,
3354 build_by_default: program_tests)
3360 c_args : ['-DTEST_PROGRAM'],
3361 include_directories : dir_include,
3362 link_with : lib_common,
3363 build_by_default: program_tests)
3369 c_args : ['-DTEST_PROGRAM'],
3370 include_directories : dir_include,
3371 link_with : [lib_common, logindefs_c],
3372 build_by_default: program_tests)
3376 ############################################################
3380 'libuuid/src/test_uuid.c',
3381 include_directories : [dir_include, dir_libuuid],
3382 link_with : lib_uuid,
3383 dependencies : socket_libs,
3384 build_by_default: program_tests)
3385 if not is_disabler(exe)
3389 ############################################################
3391 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3392 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid]
3393 libfdisk_tests_ldadd_deps = [blkid_dep]
3397 'libfdisk/src/ask.c',
3398 c_args : libfdisk_tests_cflags,
3399 include_directories : lib_fdisk_includes,
3400 link_with : libfdisk_tests_ldadd,
3401 dependencies : libfdisk_tests_ldadd_deps,
3402 build_by_default: program_tests)
3403 if not is_disabler(exe)
3409 'libfdisk/src/gpt.c',
3410 c_args : libfdisk_tests_cflags,
3411 include_directories : lib_fdisk_includes,
3412 link_with : libfdisk_tests_ldadd,
3413 dependencies : libfdisk_tests_ldadd_deps,
3414 build_by_default: program_tests)
3415 if not is_disabler(exe)
3421 'libfdisk/src/utils.c',
3422 c_args : libfdisk_tests_cflags,
3423 include_directories : lib_fdisk_includes,
3424 link_with : libfdisk_tests_ldadd,
3425 dependencies : libfdisk_tests_ldadd_deps,
3426 build_by_default: program_tests)
3427 if not is_disabler(exe)
3432 'test_fdisk_script',
3433 'libfdisk/src/script.c',
3434 c_args : libfdisk_tests_cflags,
3435 include_directories : lib_fdisk_includes,
3436 link_with : libfdisk_tests_ldadd,
3437 dependencies : libfdisk_tests_ldadd_deps,
3438 build_by_default: program_tests)
3439 if not is_disabler(exe)
3444 'test_fdisk_version',
3445 'libfdisk/src/version.c',
3446 c_args : libfdisk_tests_cflags,
3447 include_directories : lib_fdisk_includes,
3448 link_with : libfdisk_tests_ldadd,
3449 dependencies : libfdisk_tests_ldadd_deps,
3450 build_by_default: program_tests)
3451 if not is_disabler(exe)
3457 'libfdisk/src/item.c',
3458 c_args : libfdisk_tests_cflags,
3459 include_directories : lib_fdisk_includes,
3460 link_with : libfdisk_tests_ldadd,
3461 dependencies : libfdisk_tests_ldadd_deps,
3462 build_by_default: program_tests)
3463 if not is_disabler(exe)
3467 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3470 'sample-fdisk-mkpart',
3471 'libfdisk/samples/mkpart.c',
3472 include_directories : lib_fdisk_includes,
3473 link_with : sample_fdisk_ldadd)
3474 if not is_disabler(exe)
3479 'sample-fdisk-mkpart-fullspec',
3480 'libfdisk/samples/mkpart-fullspec.c',
3481 include_directories : lib_fdisk_includes,
3482 link_with : sample_fdisk_ldadd)
3483 if not is_disabler(exe)
3487 ############################################################
3491 'tests/helpers/test_cap.c',
3492 include_directories : includes,
3493 dependencies : [lib_cap_ng],
3494 build_by_default: program_tests)
3495 if not is_disabler(exe)
3501 'tests/helpers/test_mbsencode.c',
3502 include_directories : includes,
3503 link_with : lib_common,
3504 build_by_default: program_tests)
3509 'tests/helpers/test_byteswap.c',
3510 include_directories : includes,
3511 build_by_default: program_tests)
3516 'tests/helpers/test_md5.c',
3518 include_directories : includes,
3519 build_by_default: program_tests)
3524 'tests/helpers/test_sha1.c',
3526 include_directories : includes,
3527 build_by_default: program_tests)
3532 'tests/helpers/test_pathnames.c',
3533 include_directories : includes,
3534 build_by_default: program_tests)
3539 'tests/helpers/test_strerror.c',
3540 include_directories : includes,
3541 build_by_default: program_tests)
3546 'tests/helpers/test_sysinfo.c',
3547 include_directories : includes,
3548 build_by_default: program_tests)
3553 'tests/helpers/test_sigreceive.c',
3554 include_directories : includes,
3555 link_with : lib_common,
3556 build_by_default: program_tests)
3561 'tests/helpers/test_tiocsti.c',
3562 include_directories : includes,
3563 build_by_default: program_tests)
3567 'test_uuid_namespace',
3568 'tests/helpers/test_uuid_namespace.c',
3572 include_directories : includes,
3573 build_by_default: program_tests)
3576 if LINUX and lib_rt.found()
3579 'tests/helpers/test_mkfds.c',
3580 'tests/helpers/test_mkfds.h',
3581 'tests/helpers/test_mkfds_ppoll.c',
3582 include_directories : includes,
3583 dependencies : [lib_rt],
3584 build_by_default: program_tests)
3590 'tests/helpers/test_enosys.c',
3591 include_directories : includes,
3592 build_by_default: program_tests)
3595 ############################################################
3597 if conf.get('HAVE_OPENAT').to_string() == '1'
3599 'sample-scols-tree',
3600 'libsmartcols/samples/tree.c',
3601 include_directories : includes,
3602 link_with : [lib_smartcols, lib_common],
3603 build_by_default: program_tests)
3604 if not is_disabler(exe)
3610 'sample-scols-title',
3611 'libsmartcols/samples/title.c',
3612 include_directories : includes,
3613 link_with : [lib_smartcols, lib_common])
3614 if not is_disabler(exe)
3619 'sample-scols-wrap',
3620 'libsmartcols/samples/wrap.c',
3621 include_directories : includes,
3622 link_with : [lib_smartcols, lib_common])
3623 if not is_disabler(exe)
3628 'sample-scols-continuous',
3629 'libsmartcols/samples/continuous.c',
3630 include_directories : includes,
3631 link_with : [lib_smartcols, lib_common])
3632 if not is_disabler(exe)
3637 'sample-scols-continuous-json',
3638 'libsmartcols/samples/continuous-json.c',
3639 include_directories : includes,
3640 link_with : [lib_smartcols, lib_common])
3641 if not is_disabler(exe)
3646 'sample-scols-maxout',
3647 'libsmartcols/samples/maxout.c',
3648 include_directories : includes,
3649 link_with : [lib_smartcols, lib_common])
3650 if not is_disabler(exe)
3655 'sample-scols-fromfile',
3656 'libsmartcols/samples/fromfile.c',
3657 include_directories : includes,
3658 link_with : [lib_smartcols, lib_common])
3659 if not is_disabler(exe)
3664 'sample-scols-grouping-simple',
3665 'libsmartcols/samples/grouping-simple.c',
3666 include_directories : includes,
3667 link_with : [lib_smartcols, lib_common])
3668 if not is_disabler(exe)
3673 'sample-scols-grouping-overlay',
3674 'libsmartcols/samples/grouping-overlay.c',
3675 include_directories : includes,
3676 link_with : [lib_smartcols, lib_common])
3677 if not is_disabler(exe)
3683 'Documentation/boilerplate.c',
3684 include_directories : includes,
3685 build_by_default: program_tests)
3686 if not is_disabler(exe)
3690 ############################################################
3692 # Let the test runner know whether we're running under asan and export
3693 # some paths. We use a file on disk so that it is possible to run the
3694 # test scripts from commandline without setting any variables.
3695 configure_file(output : 'meson.conf',
3700 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3701 python.full_path())])
3703 run_sh = find_program('tests/run.sh')
3707 '--srcdir=' + meson.current_source_dir(),
3708 '--builddir=' + meson.current_build_dir(),
3714 manadocs += ['lib/terminal-colors.d.5.adoc']
3715 manadocs += ['libblkid/libblkid.3.adoc']
3719 'libuuid/man/uuid.3.adoc',
3720 'libuuid/man/uuid_clear.3.adoc',
3721 'libuuid/man/uuid_compare.3.adoc',
3722 'libuuid/man/uuid_copy.3.adoc',
3723 'libuuid/man/uuid_generate.3.adoc',
3724 'libuuid/man/uuid_is_null.3.adoc',
3725 'libuuid/man/uuid_parse.3.adoc',
3726 'libuuid/man/uuid_time.3.adoc',
3727 'libuuid/man/uuid_unparse.3.adoc']
3729 'uuid_generate_random.3': 'uuid_generate.3',
3730 'uuid_generate_time.3': 'uuid_generate.3',
3731 'uuid_generate_time_safe.3': 'uuid_generate.3',
3735 asciidoctor = find_program('asciidoctor', required : false)
3736 if asciidoctor.found()
3737 foreach adoc : manadocs
3738 name = adoc.split('/')[-1]
3739 page = name.split('.adoc')[0]
3740 section = page.split('.')[-1]
3741 mandirn = join_paths(mandir, 'man' + section)
3746 command : [ asciidoctor,
3748 '-a', 'VERSION=' + meson.project_version(),
3749 '-a', 'release-version=' + meson.project_version(),
3750 '-a', 'ADJTIME_PATH=/etc/adjtime',
3751 '-a', 'package-docdir=' + docdir,
3752 '--base-dir=' + meson.current_source_dir(),
3753 '--destination-dir=' + meson.current_build_dir(),
3754 '--load-path', '@SOURCE_ROOT@/tools',
3755 '--require', 'asciidoctor-includetracker',
3759 depfile : page + '.deps',
3761 install_dir : mandirn)
3764 foreach link_name, target : manlinks
3765 link_section = link_name.split('.')[-1]
3766 target_section = target.split('.')[-1]
3767 meson.add_install_script(meson_make_manpage_stub,
3768 join_paths('man' + target_section, target),
3769 join_paths(mandir, 'man' + link_section, link_name))
3773 if bash_completion.found()
3774 foreach completion : bashcompletions
3776 join_paths('bash-completion', completion),
3777 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3780 foreach link_name, target : bashcompletionslinks
3781 meson.add_install_script(meson_make_symlink,
3783 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))