1 project('util-linux', 'c',
2 version : run_command('tools/git-version-gen', check: true).stdout(),
3 meson_version: '>=0.60.0',
11 pkgconfig = import('pkgconfig')
13 # soname versions; This never change because we use symbols versioing. There is also
14 # API version (LIB*_VERSION macros) and it follow package version.
15 libblkid_version = '1.1.0'
16 libblkid_date = '01-Jun-2021'
17 libuuid_version = '1.3.0'
18 liblastlog2_version = '2.0.0'
19 libmount_version = '1.1.0'
20 libsmartcols_version = '1.1.0'
21 libfdisk_version = '1.1.0'
23 prefixdir = get_option('prefix')
24 if not fs.is_absolute(prefixdir)
25 error('Prefix is not absolute: "@0@"'.format(prefixdir))
27 bindir = join_paths(prefixdir, get_option('bindir'))
28 sbindir = join_paths(prefixdir, get_option('sbindir'))
29 sysconfstaticdir = join_paths(prefixdir, 'lib')
30 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
31 mandir = join_paths(prefixdir, get_option('mandir'))
33 localstatedir = '/var'
34 execprefixdir = prefixdir
35 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
36 usrbin_exec_dir = join_paths(execprefixdir, bindir)
37 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
38 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
40 vendordir = get_option('vendordir')
42 add_project_arguments('-D_GNU_SOURCE', '-fsigned-char', language : 'c')
44 cc = meson.get_compiler('c')
46 conf = configuration_data()
47 conf.set_quoted('PACKAGE', meson.project_name())
48 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
49 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
50 conf.set_quoted('PACKAGE_STRING', package_string)
53 pc_version = meson.project_version().split('-')[0].split('.')
55 if pc_version.length() < 3
59 pc_version = '.'.join(pc_version)
61 conf.set_quoted('LIBBLKID_VERSION', pc_version)
62 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
64 conf.set('bindir', bindir)
65 conf.set('sbindir', sbindir)
66 conf.set('runstatedir', runstatedir)
67 conf.set('localstatedir', localstatedir)
68 conf.set('sysconfdir', sysconfdir)
69 conf.set('usrbin_execdir', usrbin_exec_dir)
70 conf.set('usrsbin_execdir', usrsbin_exec_dir)
71 conf.set('docdir', docdir)
72 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
73 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
74 conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir)
75 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
76 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
78 conf.set_quoted('_PATH_VENDORDIR', vendordir)
79 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
81 build_libblkid = get_option('build-libblkid').allowed()
82 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
83 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
85 build_libuuid = not get_option('build-libuuid').disabled()
86 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
87 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
89 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
90 build_liblastlog2 = get_option('build-liblastlog2').require(lib_sqlite3.found()).allowed()
91 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
92 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
94 login_lastlogin = get_option('login-lastlogin')
95 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
96 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
98 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
99 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
100 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
102 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
103 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
105 have_sys_vfs_header = cc.has_header('sys/vfs.h')
107 build_libmount = get_option('build-libmount').require(
108 get_option('build-libblkid').allowed() \
109 and have_sys_vfs_header \
112 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
113 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
114 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
115 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
117 build_libsmartcols = not get_option('build-libsmartcols').disabled()
118 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
119 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
121 build_libfdisk = not get_option('build-libfdisk').require(get_option('build-libblkid').allowed()).disabled()
122 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
123 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
125 build_uuidd = not get_option('build-uuidd').disabled()
126 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
127 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
129 static_programs = get_option('static-programs')
130 need_static_libs = static_programs.length() > 0 # a rough estimate...
131 summary('static programs', static_programs)
133 LINUX = host_machine.system() in ['linux']
134 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
136 ############################################################
154 have = cc.compiles(code, name : 'wchar_t support')
155 if not have and get_option('widechar').enabled()
156 error('widechar support requested but unavailable')
158 if get_option('ncurses').enabled() and get_option('widechar').enabled()
159 error('widechar support is incompatible with non-wide ncurses')
161 conf.set('HAVE_WIDECHAR', have ? 1 : false)
203 linux/net_namespace.h
217 security/pam_modules.h
250 lib_m = cc.find_library('m')
252 lib_tinfo = dependency(
255 required : get_option('tinfo'))
257 lib_ncursesw = dependency(
259 required : get_option('ncursesw'))
260 if lib_ncursesw.found()
261 headers += ['ncursesw/ncurses.h',
265 lib_ncurses = disabler()
267 lib_ncurses = dependency(
270 required : get_option('ncurses'))
271 headers += ['ncurses.h',
275 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
276 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
277 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
279 lib_slang = dependency(
281 required : get_option('slang'))
283 headers += ['slang.h',
288 conf.set('HAVE_SLANG', lib_slang.found())
290 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
291 if curses_libs.found()
292 have = cc.has_function('use_default_colors', dependencies : curses_libs)
293 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
294 have = cc.has_function('resizeterm', dependencies : curses_libs)
295 conf.set('HAVE_RESIZETERM', have ? 1 : false)
303 required : get_option('zlib'))
305 lib_readline = dependency(
307 required : get_option('readline'))
308 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
310 lib_readline_static = dependency(
313 required : need_static_libs ? get_option('readline') : disabler())
315 if meson.version().version_compare('>= 0.59.0')
316 lib_intl = dependency(
318 required : get_option('nls'))
319 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
321 if get_option('nls').enabled()
322 error('nls is not supported with meson before 0.59.0')
324 lib_intl = dependency('', required : false)
327 lib_user = dependency(
330 required : get_option('libuser'))
331 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
333 lib_util = cc.find_library(
335 required : get_option('libutil'))
336 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
338 lib_utempter = cc.find_library(
340 required : get_option('libutempter'))
341 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
343 systemd = dependency(
345 required : get_option('systemd'))
347 lib_systemd = dependency(
349 required : get_option('systemd'))
350 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
351 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
353 have = cc.has_function(
354 'sd_session_get_username',
355 dependencies : lib_systemd)
356 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
358 lib_udev = dependency(
360 required : get_option('systemd'))
361 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
363 lib_crypt = cc.find_library('crypt', required : get_option('build-newgrp'))
364 if not lib_crypt.found()
365 lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin'))
368 lib_pam = cc.find_library(
371 required : get_option('build-login').enabled() or \
372 get_option('build-chfn-chsh').enabled() or \
373 get_option('build-su').enabled() or \
374 get_option('build-runuser').enabled())
376 lib_pam_misc = cc.find_library('pam_misc')
377 lib_pam = [lib_pam, lib_pam_misc]
379 lib_pam_misc = declare_dependency()
382 lib_cryptsetup = dependency(
384 required : get_option('cryptsetup'))
385 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
387 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
389 if meson.version().version_compare('>= 0.62.0')
390 lib_dl = dependency('dl')
392 lib_dl = cc.find_library('dl')
394 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
395 summary('cryptsetup support (dlopen)',
397 section : 'components')
399 summary('cryptsetup support',
400 lib_cryptsetup.found() ? 'enabled' : 'disabled',
401 section : 'components')
404 have = cc.has_function(
405 'crypt_activate_by_signed_key',
406 dependencies : lib_cryptsetup)
407 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
409 lib_cap_ng = dependency(
411 required : get_option('build-setpriv'))
412 if not lib_cap_ng.found()
413 lib_cap_ng = disabler()
416 lib_selinux = dependency(
419 required : get_option('selinux'))
420 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
422 lib_magic = dependency(
424 required : get_option('magic'))
425 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
427 lib_econf = dependency(
429 required : get_option('econf'))
430 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
432 lib_audit = dependency(
434 required : get_option('audit'))
435 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
437 conf.set('HAVE_SMACK', not get_option('smack').disabled())
440 foreach header : headers
441 have = cc.has_header(header)
442 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
445 header = 'linux/btrfs.h'
446 enable_btrfs = cc.has_header(header,
447 required : get_option('btrfs'))
448 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
449 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
451 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
456 have = cc.has_header(header,
458 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
461 have = cc.has_header('sched.h')
462 conf.set10('HAVE_DECL_CPU_ALLOC', have)
463 # 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')
907 sed = find_program('sed')
909 build_hwclock = not get_option('build-hwclock').disabled()
910 bison_gen = generator(
912 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
913 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
915 python_module = import('python')
916 python = python_module.find_installation(
917 get_option('python'),
921 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
922 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
926 configuration : conf)
928 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
933 '-Waddress-of-packed-member',
934 '-Wdiscarded-qualifiers',
935 '-Wembedded-directive',
938 '-Wimplicit-function-declaration',
939 '-Wmissing-declarations',
940 '-Wmissing-parameter-type',
941 '-Wmissing-prototypes',
943 '-Wno-missing-field-initializers',
944 '-Wold-style-definition',
948 '-Wstrict-prototypes',
951 '-Wunused-but-set-parameter',
952 '-Wunused-but-set-variable',
953 '-Wunused-parameter',
959 foreach compiler_flag : compiler_flags
960 if cc.has_argument(compiler_flag)
961 add_project_arguments(compiler_flag, language : 'c')
969 bashcompletionslinks = {}
975 subdir('libsmartcols')
977 subdir('liblastlog2')
979 subdir('pam_lastlog2')
980 subdir('login-utils')
989 includes = [dir_include,
998 opt = not get_option('build-chfn-chsh').disabled()
1003 include_directories : includes,
1004 link_with : [lib_common, logindefs_c],
1005 dependencies : chfn_chsh_deps,
1006 install_dir : usrbin_exec_dir,
1007 install_mode : 'rwsr-xr-x',
1009 build_by_default : opt)
1013 'login-utils/chsh.c',
1016 include_directories : includes,
1017 link_with : lib_common,
1018 dependencies : chfn_chsh_deps,
1019 install_dir : usrbin_exec_dir,
1020 install_mode : 'rwsr-xr-x',
1022 build_by_default : opt)
1023 if opt and not is_disabler(exe)
1025 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1026 bashcompletions += ['chfn', 'chsh']
1031 test_islocal_sources,
1032 include_directories : includes,
1033 c_args : '-DTEST_PROGRAM',
1034 build_by_default : program_tests)
1039 test_consoles_sources,
1040 c_args : ['-DTEST_PROGRAM'],
1041 include_directories : includes,
1042 link_with : lib_common,
1043 build_by_default : program_tests)
1046 opt = not get_option('build-last').disabled()
1050 include_directories : includes,
1051 link_with : [lib_common],
1052 install_dir : usrbin_exec_dir,
1054 build_by_default : opt)
1055 if opt and not is_disabler(exe)
1057 meson.add_install_script(meson_make_symlink,
1059 join_paths(usrbin_exec_dir, 'lastb'))
1060 manadocs += ['login-utils/last.1.adoc']
1061 manlinks += {'lastb.1': 'last.1'}
1062 bashcompletions += ['last']
1063 bashcompletionslinks += {'lastb': 'last'}
1066 opt = not get_option('build-nologin').disabled()
1069 'login-utils/nologin.c',
1070 include_directories : includes,
1071 install_dir : sbindir,
1072 link_with : [lib_common],
1074 build_by_default : opt)
1075 if opt and not is_disabler(exe)
1077 manadocs += ['login-utils/nologin.8.adoc']
1080 opt = not get_option('build-utmpdump').disabled()
1083 'login-utils/utmpdump.c',
1084 include_directories : includes,
1085 link_with : [lib_common],
1086 install_dir : usrbin_exec_dir,
1088 build_by_default : opt)
1089 if opt and not is_disabler(exe)
1091 manadocs += ['login-utils/utmpdump.1.adoc']
1092 bashcompletions += ['utmpdump']
1095 opt = not get_option('build-su').disabled()
1099 'login-utils/su-common.c',
1100 'login-utils/su-common.h',
1104 include_directories : includes,
1105 link_with : [lib_common, logindefs_c],
1106 dependencies : [lib_pam,
1110 install_mode : 'rwsr-xr-x',
1112 build_by_default : opt)
1113 if opt and not is_disabler(exe)
1115 manadocs += ['login-utils/su.1.adoc']
1116 bashcompletions += ['su']
1119 opt = not get_option('build-newgrp').disabled()
1122 'login-utils/newgrp.c',
1123 include_directories : includes,
1124 dependencies : [lib_crypt],
1125 install_dir : usrbin_exec_dir,
1126 install_mode : 'rwsr-xr-x',
1128 build_by_default : opt)
1129 if opt and not is_disabler(exe)
1131 manadocs += ['login-utils/newgrp.1.adoc']
1132 bashcompletions += ['newgrp']
1135 opt = not get_option('build-lslogins').disabled()
1138 'login-utils/lslogins.c',
1139 include_directories : includes,
1140 link_with : [lib_common,
1143 (build_liblastlog2 ? [lib_lastlog2] : []),
1144 dependencies : [lib_selinux,
1146 install_dir : usrbin_exec_dir,
1148 build_by_default : opt)
1149 if opt and not is_disabler(exe)
1151 manadocs += ['login-utils/lslogins.1.adoc']
1152 bashcompletions += ['lslogins']
1155 opt = not get_option('build-vipw').disabled()
1158 'login-utils/vipw.c',
1159 'login-utils/setpwnam.h',
1160 include_directories : includes,
1161 link_with : [lib_common],
1162 dependencies : [lib_selinux],
1163 install_dir : usrbin_exec_dir,
1165 build_by_default : opt)
1166 if opt and not is_disabler(exe)
1168 meson.add_install_script(meson_make_symlink,
1170 join_paths(usrbin_exec_dir, 'vigr'))
1171 manadocs += ['login-utils/vipw.8.adoc']
1172 meson.add_install_script(meson_make_symlink,
1174 join_paths(mandir, 'man8/vigr.8'))
1177 opt = not get_option('build-runuser').disabled()
1180 'login-utils/runuser.c',
1181 'login-utils/su-common.c',
1182 'login-utils/su-common.h',
1186 include_directories : includes,
1187 link_with : [lib_common, logindefs_c],
1188 dependencies : [lib_pam,
1192 install_dir : sbindir,
1194 build_by_default : opt)
1195 if opt and not is_disabler(exe)
1197 manadocs += ['login-utils/runuser.1.adoc']
1198 bashcompletionslinks += {'runuser': 'su'}
1201 ############################################################
1207 include_directories : includes,
1208 link_with : lib_common,
1209 install_dir : usrbin_exec_dir,
1212 manadocs += ['text-utils/col.1.adoc']
1213 bashcompletions += ['col']
1219 include_directories : includes,
1220 install_dir : usrbin_exec_dir,
1223 manadocs += ['text-utils/colcrt.1.adoc']
1224 bashcompletions += ['colcrt']
1229 include_directories : includes,
1230 link_with : lib_common,
1231 install_dir : usrbin_exec_dir,
1234 manadocs += ['text-utils/colrm.1.adoc']
1235 bashcompletions += ['colrm']
1240 include_directories : includes,
1241 install_dir : usrbin_exec_dir,
1244 manadocs += ['text-utils/rev.1.adoc']
1245 bashcompletions += ['rev']
1250 include_directories : includes,
1251 link_with : [lib_common,
1253 install_dir : usrbin_exec_dir,
1255 if not is_disabler(exe)
1257 manadocs += ['text-utils/column.1.adoc']
1258 bashcompletions += ['column']
1261 opt = not get_option('build-line').disabled()
1265 include_directories : includes,
1266 install_dir : usrbin_exec_dir,
1268 build_by_default : opt)
1269 if opt and not is_disabler(exe)
1271 manadocs += ['text-utils/line.1.adoc']
1274 opt = not get_option('build-pg').disabled()
1278 link_with : lib_common,
1279 include_directories : includes,
1280 dependencies : [lib_tinfo,
1282 install_dir : usrbin_exec_dir,
1284 build_by_default : opt)
1285 if opt and not is_disabler(exe)
1287 manadocs += ['text-utils/pg.1.adoc']
1288 bashcompletions += ['pg']
1291 opt = not get_option('build-ul').disabled()
1295 include_directories : includes,
1296 dependencies : [lib_tinfo,
1298 install_dir : usrbin_exec_dir,
1300 build_by_default : opt)
1301 if opt and not is_disabler(exe)
1303 manadocs += ['text-utils/ul.1.adoc']
1304 bashcompletions += ['ul']
1307 opt = not get_option('build-more').disabled()
1311 link_with : [lib_common],
1312 include_directories : includes,
1313 dependencies : [lib_tinfo,
1317 build_by_default : opt)
1321 link_with : [lib_common],
1322 include_directories : includes,
1323 c_args : '-DTEST_PROGRAM',
1324 dependencies : [lib_tinfo,
1327 build_by_default : opt and program_tests)
1329 if opt and not is_disabler(exe)
1331 manadocs += ['text-utils/more.1.adoc']
1332 bashcompletions += ['more']
1338 include_directories : includes,
1339 link_with : [lib_common,
1341 install_dir : usrbin_exec_dir,
1343 if not is_disabler(exe)
1345 manadocs += ['text-utils/hexdump.1.adoc']
1346 bashcompletions += ['hexdump']
1349 opt = not get_option('build-lsmem').disabled()
1353 include_directories : includes,
1354 link_with : [lib_common,
1356 install_dir : usrbin_exec_dir,
1358 build_by_default : opt)
1359 if opt and not is_disabler(exe)
1361 manadocs += ['sys-utils/lsmem.1.adoc']
1362 bashcompletions += ['lsmem']
1365 opt = not get_option('build-chmem').disabled()
1369 include_directories : includes,
1370 link_with : [lib_common],
1371 install_dir : usrbin_exec_dir,
1373 build_by_default : opt)
1374 if opt and not is_disabler(exe)
1376 manadocs += ['sys-utils/chmem.8.adoc']
1377 bashcompletions += ['chmem']
1383 include_directories : includes,
1384 link_with : [lib_common],
1385 install_dir : usrbin_exec_dir,
1388 manadocs += ['sys-utils/choom.1.adoc']
1390 has_seminfo_type = cc.has_type('struct seminfo', args : '-D_GNU_SOURCE', prefix : '#include <sys/sem.h>')
1392 opt = get_option('build-ipcmk').require(has_seminfo_type).allowed()
1396 include_directories : includes,
1397 link_with : [lib_common],
1398 install_dir : usrbin_exec_dir,
1400 build_by_default : opt)
1401 if opt and not is_disabler(exe)
1403 manadocs += ['sys-utils/ipcmk.1.adoc']
1404 bashcompletions += ['ipcmk']
1407 opt = get_option('build-ipcrm').require(has_seminfo_type).allowed()
1411 include_directories : includes,
1412 link_with : [lib_common],
1413 install_dir : usrbin_exec_dir,
1415 build_by_default : opt)
1416 if opt and not is_disabler(exe)
1418 manadocs += ['sys-utils/ipcrm.1.adoc']
1419 bashcompletions += ['ipcrm']
1422 opt = not get_option('build-ipcs').require(has_seminfo_type).disabled()
1426 include_directories : includes,
1427 link_with : [lib_common],
1428 install_dir : usrbin_exec_dir,
1430 build_by_default : opt)
1431 if opt and not is_disabler(exe)
1433 manadocs += ['sys-utils/ipcs.1.adoc']
1434 bashcompletions += ['ipcs']
1437 opt = not get_option('build-rfkill').disabled()
1441 include_directories : includes,
1442 link_with : [lib_common,
1444 install_dir : usrsbin_exec_dir,
1446 build_by_default : opt)
1447 if opt and not is_disabler(exe)
1449 manadocs += ['sys-utils/rfkill.8.adoc']
1450 bashcompletions += ['rfkill']
1456 include_directories : includes,
1457 link_with : [lib_common,
1459 install_dir : usrbin_exec_dir,
1461 if not is_disabler(exe)
1463 manadocs += ['sys-utils/renice.1.adoc']
1464 bashcompletions += ['renice']
1470 include_directories: includes,
1471 link_with : [lib_common,
1473 install_dir : usrbin_exec_dir,
1475 if opt and not is_disabler(exe)
1477 manadocs += ['sys-utils/setpgid.1.adoc']
1478 bashcompletions += ['setpgid']
1484 include_directories : includes,
1485 link_with : [lib_common,
1487 install_dir : usrbin_exec_dir,
1489 if opt and not is_disabler(exe)
1491 manadocs += ['sys-utils/setsid.1.adoc']
1492 bashcompletions += ['setsid']
1497 readprofile_sources,
1498 include_directories : includes,
1499 link_with : [lib_common,
1501 install_dir : usrsbin_exec_dir,
1503 if not is_disabler(exe)
1505 manadocs += ['sys-utils/readprofile.8.adoc']
1506 bashcompletions += ['readprofile']
1509 opt = not get_option('build-tunelp').disabled()
1513 include_directories : includes,
1514 link_with : [lib_common],
1515 install_dir : usrsbin_exec_dir,
1517 build_by_default : opt)
1518 if opt and not is_disabler(exe)
1520 manadocs += ['sys-utils/tunelp.8.adoc']
1521 bashcompletions += ['tunelp']
1524 opt = get_option('build-fstrim').require(have_sys_vfs_header).allowed()
1528 include_directories : includes,
1529 link_with : [lib_common],
1530 dependencies : [mount_dep],
1531 install_dir : sbindir,
1533 build_by_default : opt)
1534 if opt and not is_disabler(exe)
1536 manadocs += ['sys-utils/fstrim.8.adoc']
1537 bashcompletions += ['fstrim']
1540 opt = get_option('build-dmesg').require(cc.has_header('sys/klog.h')).allowed()
1544 include_directories : includes,
1545 link_with : [lib_common,
1548 build_by_default : opt)
1549 if opt and not is_disabler(exe)
1551 manadocs += ['sys-utils/dmesg.1.adoc']
1552 bashcompletions += ['dmesg']
1558 include_directories : dir_include,
1559 c_args : '-DTEST_DMESG',
1560 link_with : [lib_common,
1562 build_by_default : program_tests)
1563 if not is_disabler(exe)
1570 include_directories : includes,
1571 link_with : [lib_common],
1572 install_dir : sbindir,
1575 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1576 bashcompletions += ['ctrlaltdel']
1581 include_directories : includes,
1582 install_dir : sbindir,
1585 manadocs += ['sys-utils/fsfreeze.8.adoc']
1586 bashcompletions += ['fsfreeze']
1591 include_directories : includes,
1592 link_with : [lib_common],
1593 dependencies : [blkid_dep],
1594 install_dir : sbindir,
1597 manadocs += ['sys-utils/blkdiscard.8.adoc']
1598 bashcompletions += ['blkdiscard']
1600 opt = get_option('build-blkzone').require(cc.has_header('linux/blkzoned.h')).allowed()
1604 include_directories : includes,
1605 link_with : [lib_common],
1606 install_dir : sbindir,
1608 build_by_default : opt)
1609 if opt and not is_disabler(exe)
1611 manadocs += ['sys-utils/blkzone.8.adoc']
1612 bashcompletions += ['blkzone']
1615 opt = get_option('build-blkpr').require(cc.has_header('linux/pr.h')).allowed()
1619 include_directories : includes,
1620 link_with : [lib_common],
1621 install_dir : sbindir,
1623 build_by_default : opt)
1624 if opt and not is_disabler(exe)
1626 manadocs += ['sys-utils/blkpr.8.adoc']
1632 include_directories : includes,
1633 link_with : [lib_common],
1634 install_dir : usrsbin_exec_dir,
1637 manadocs += ['sys-utils/ldattach.8.adoc']
1638 bashcompletions += ['ldattach']
1643 include_directories : includes,
1644 link_with : [lib_common],
1645 install_dir : usrsbin_exec_dir,
1648 manadocs += ['sys-utils/rtcwake.8.adoc']
1649 bashcompletions += ['rtcwake']
1654 include_directories : includes,
1655 link_with : [lib_common],
1656 install_dir : usrbin_exec_dir,
1659 manadocs += ['sys-utils/setarch.8.adoc']
1660 bashcompletions += ['setarch']
1662 setarch_links = ['uname26', 'linux32', 'linux64']
1663 setarch_links_arch = {
1664 's390x' : ['s390', 's390x'],
1666 'x86_64' : ['i386', 'x86_64'],
1667 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1668 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1669 'mips64' : ['mips', 'mips64', 'mips32'],
1670 'ia64' : ['i386', 'ia64'],
1671 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1673 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1675 foreach link: setarch_links
1676 meson.add_install_script(meson_make_symlink,
1678 join_paths(usrbin_exec_dir, link))
1679 manlinks += {link + '.8': 'setarch.8'}
1682 opt = not get_option('build-eject').disabled()
1686 include_directories : includes,
1687 link_with : [lib_common],
1688 dependencies : [mount_dep],
1689 install_dir : usrbin_exec_dir,
1691 build_by_default : opt)
1692 if opt and not is_disabler(exe)
1694 manadocs += ['sys-utils/eject.1.adoc']
1695 bashcompletions += ['eject']
1698 opt = not get_option('build-losetup').disabled()
1702 include_directories : includes,
1703 link_with : [lib_common,
1705 install_dir : sbindir,
1707 build_by_default : opt)
1708 if opt and not is_disabler(exe)
1709 manadocs += ['sys-utils/losetup.8.adoc']
1711 bashcompletions += ['losetup']
1714 opt = opt and 'losetup' in static_programs
1718 include_directories : includes,
1719 link_args : ['--static'],
1720 link_with : [lib_common,
1721 lib_smartcols.get_static_lib()],
1722 install_dir : sbindir,
1724 build_by_default : opt)
1725 if opt and not is_disabler(exe)
1729 opt = not get_option('build-zramctl').disabled()
1733 include_directories : includes,
1734 link_with : [lib_common,
1736 install_dir : sbindir,
1738 build_by_default : opt)
1739 if opt and not is_disabler(exe)
1741 manadocs += ['sys-utils/zramctl.8.adoc']
1742 bashcompletions += ['zramctl']
1748 include_directories : includes,
1749 link_with : [lib_common,
1751 install_dir : usrbin_exec_dir,
1753 if not is_disabler(exe)
1755 manadocs += ['sys-utils/prlimit.1.adoc']
1756 bashcompletions += ['prlimit']
1759 opt = not get_option('build-lsns').disabled()
1763 include_directories : includes,
1764 link_with : [lib_common,
1766 dependencies : [mount_dep],
1767 install_dir : usrbin_exec_dir,
1769 build_by_default : opt)
1770 if opt and not is_disabler(exe)
1772 manadocs += ['sys-utils/lsns.8.adoc']
1773 bashcompletions += ['lsns']
1776 opt = not get_option('build-mount').disabled()
1780 include_directories : includes,
1781 link_with : [lib_common,
1783 dependencies : [lib_selinux, mount_dep],
1784 install_mode : 'rwsr-xr-x',
1786 build_by_default : opt)
1790 include_directories : includes,
1791 link_with : [lib_common],
1792 dependencies : [mount_dep],
1793 install_mode : 'rwsr-xr-x',
1795 build_by_default : opt)
1796 if opt and not is_disabler(exe)
1798 manadocs += ['sys-utils/fstab.5.adoc',
1799 'sys-utils/mount.8.adoc',
1800 'sys-utils/umount.8.adoc']
1801 bashcompletions += ['mount', 'umount']
1804 opt2 = opt and 'mount' in static_programs
1808 include_directories : includes,
1809 link_args : ['--static'],
1810 link_with : [lib_common,
1811 lib_smartcols_static],
1812 dependencies : [mount_static_dep],
1814 build_by_default : opt2)
1815 if opt2 and not is_disabler(exe)
1819 opt2 = opt and 'umount' in static_programs
1823 include_directories : includes,
1824 link_args : ['--static'],
1825 link_with : [lib_common],
1826 dependencies : [mount_static_dep],
1828 build_by_default : opt2)
1829 if opt2 and not is_disabler(exe)
1835 opt = not get_option('build-swapon').disabled()
1839 include_directories : includes,
1840 link_with : [lib_common,
1842 dependencies : [blkid_dep, mount_dep],
1843 install_dir : sbindir,
1845 build_by_default : opt)
1846 if opt and not is_disabler(exe)
1848 manadocs += ['sys-utils/swapon.8.adoc']
1849 bashcompletions += ['swapon']
1852 opt = not get_option('build-swapoff').disabled()
1856 include_directories : includes,
1857 link_with : [lib_common],
1858 dependencies : [blkid_dep, mount_dep],
1859 install_dir : sbindir,
1861 build_by_default : opt)
1862 if opt and not is_disabler(exe)
1864 manlinks += {'swapoff.8': 'swapon.8'}
1865 bashcompletions += ['swapoff']
1871 include_directories : includes,
1872 link_with : [lib_common,
1874 dependencies : [rtas_libs],
1875 install_dir : usrbin_exec_dir,
1877 if not is_disabler(exe)
1879 manadocs += ['sys-utils/lscpu.1.adoc']
1880 bashcompletions += ['lscpu']
1886 include_directories : includes,
1887 link_with : [lib_common],
1888 install_dir : sbindir,
1891 manadocs += ['sys-utils/chcpu.8.adoc']
1892 bashcompletions += ['chcpu']
1897 include_directories : includes,
1898 link_with : [lib_common,
1901 if not is_disabler(exe)
1903 manadocs += ['sys-utils/wdctl.8.adoc']
1904 bashcompletions += ['wdctl']
1907 opt = not get_option('build-mountpoint').disabled()
1911 include_directories : includes,
1912 dependencies : [mount_dep],
1914 build_by_default : opt)
1915 if opt and not is_disabler(exe)
1917 manadocs += ['sys-utils/mountpoint.1.adoc']
1918 bashcompletions += ['mountpoint']
1921 opt = not get_option('build-fallocate').disabled()
1925 include_directories : includes,
1926 link_with : [lib_common],
1927 install_dir : usrbin_exec_dir,
1929 build_by_default : opt)
1930 if opt and not is_disabler(exe)
1932 manadocs += ['sys-utils/fallocate.1.adoc']
1933 bashcompletions += ['fallocate']
1936 opt = not get_option('build-pivot_root').disabled()
1940 include_directories : includes,
1941 install_dir : sbindir,
1943 build_by_default : opt)
1944 if opt and not is_disabler(exe)
1946 manadocs += ['sys-utils/pivot_root.8.adoc']
1947 bashcompletions += ['pivot_root']
1950 opt = not get_option('build-switch_root').disabled()
1951 if opt and not have_dirfd and not have_ddfd
1952 error('neither dirfd nor ddfd are available')
1956 switch_root_sources,
1957 include_directories : includes,
1958 install_dir : sbindir,
1960 build_by_default : opt)
1961 if opt and not is_disabler(exe)
1963 manadocs += ['sys-utils/switch_root.8.adoc']
1966 opt = not get_option('build-unshare').disabled()
1970 include_directories : includes,
1971 link_with : [lib_common],
1972 dependencies : [mount_dep],
1973 install_dir : usrbin_exec_dir,
1975 build_by_default : opt)
1976 if opt and not is_disabler(exe)
1978 manadocs += ['sys-utils/unshare.1.adoc']
1979 bashcompletions += ['unshare']
1982 opt = opt and 'unshare' in static_programs
1986 include_directories : includes,
1987 link_with : [lib_common],
1988 dependencies : [mount_dep],
1989 install_dir : usrbin_exec_dir,
1991 build_by_default : opt)
1992 if opt and not is_disabler(exe)
1996 opt = not get_option('build-nsenter').disabled()
2000 include_directories : includes,
2001 link_with : [lib_common],
2002 dependencies : [lib_selinux],
2003 install_dir : usrbin_exec_dir,
2005 build_by_default : opt)
2006 if opt and not is_disabler(exe)
2008 manadocs += ['sys-utils/nsenter.1.adoc']
2009 bashcompletions += ['nsenter']
2012 opt = opt and 'nsenter' in static_programs
2016 include_directories : includes,
2017 link_with : [lib_common],
2018 dependencies : [lib_selinux],
2019 install_dir : usrbin_exec_dir,
2021 build_by_default : opt)
2022 if opt and not is_disabler(exe)
2026 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
2030 include_directories : includes,
2031 link_with : [lib_common],
2032 dependencies : [lib_cap_ng],
2033 install_dir : usrbin_exec_dir,
2035 build_by_default : opt)
2036 if opt and not is_disabler(exe)
2038 manadocs += ['sys-utils/setpriv.1.adoc']
2039 bashcompletions += ['setpriv']
2045 include_directories : includes,
2046 link_with : [lib_common],
2047 dependencies : realtime_libs,
2048 install_dir : usrbin_exec_dir,
2051 manadocs += ['sys-utils/flock.1.adoc']
2052 bashcompletions += ['flock']
2054 opt = not get_option('build-lsirq').disabled()
2058 include_directories : includes,
2059 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/lsirq.1.adoc']
2067 bashcompletions += ['lsirq']
2070 opt = not get_option('build-irqtop').disabled()
2074 include_directories : includes,
2075 dependencies : [realtime_libs, curses_libs],
2076 link_with : [lib_common,
2079 install_dir : usrbin_exec_dir,
2081 build_by_default : opt)
2082 if opt and not is_disabler(exe)
2084 manadocs += ['sys-utils/irqtop.1.adoc']
2085 bashcompletions += ['irqtop']
2088 opt = not get_option('build-ipcs').disabled()
2092 include_directories : includes,
2093 link_with : [lib_common,
2095 install_dir : usrbin_exec_dir,
2097 build_by_default : opt)
2098 if opt and not is_disabler(exe)
2100 manadocs += ['sys-utils/lsipc.1.adoc']
2101 bashcompletions += ['lsipc']
2108 include_directories : includes,
2109 link_with : [lib_common],
2110 dependencies : [lib_m,
2112 install_dir : sbindir,
2114 build_by_default : opt)
2115 if opt and not is_disabler(exe)
2117 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2118 bashcompletions += ['hwclock']
2124 include_directories : includes,
2125 install_dir : sbindir,
2128 manadocs += ['disk-utils/mkfs.8.adoc']
2129 bashcompletions += ['mkfs']
2131 opt = not get_option('build-bfs').disabled()
2135 include_directories : includes,
2136 link_with : [lib_common],
2137 install_dir : sbindir,
2139 build_by_default : opt)
2140 if opt and not is_disabler(exe)
2142 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2143 bashcompletions += ['mkfs.bfs']
2149 include_directories : includes,
2150 link_with : [lib_common],
2151 install_dir : usrbin_exec_dir,
2154 manadocs += ['disk-utils/isosize.8.adoc']
2155 bashcompletions += ['isosize']
2160 include_directories : includes,
2161 link_with : [lib_common,
2163 dependencies: [blkid_dep, lib_selinux],
2164 install_dir : sbindir,
2166 if not is_disabler(exe)
2168 manadocs += ['disk-utils/mkswap.8.adoc']
2169 bashcompletions += ['mkswap']
2175 include_directories : includes,
2176 link_with : [lib_common,
2178 dependencies : [blkid_dep],
2179 install_dir : sbindir,
2181 if not is_disabler(exe)
2183 manadocs += ['disk-utils/swaplabel.8.adoc']
2184 bashcompletions += ['swaplabel']
2187 opt = not get_option('build-fsck').disabled()
2191 include_directories : includes,
2192 link_with : [lib_common],
2193 dependencies : [blkid_dep, mount_dep, realtime_libs],
2194 install_dir : sbindir,
2196 build_by_default : opt)
2197 if opt and not is_disabler(exe)
2199 manadocs += ['disk-utils/fsck.8.adoc']
2200 bashcompletions += ['fsck']
2203 opt = not get_option('build-minix').disabled()
2207 include_directories : includes,
2208 link_with : [lib_common],
2209 install_dir : sbindir,
2211 build_by_default : opt)
2215 include_directories : includes,
2216 c_args : '-DTEST_SCRIPT',
2217 link_with : [lib_common],
2218 build_by_default : opt and program_tests)
2222 include_directories : includes,
2223 link_with : [lib_common],
2224 install_dir : sbindir,
2226 build_by_default : opt)
2227 if opt and not is_disabler(exe)
2228 exes += [exe, exe2, exe3]
2229 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2230 bashcompletions += ['mkfs.minix', 'fsck.minix']
2233 opt = not get_option('build-cramfs').disabled()
2236 mkfs_cramfs_sources,
2237 include_directories : includes,
2238 link_with : [lib_common],
2239 dependencies : [lib_z],
2240 install_dir : sbindir,
2242 build_by_default : opt)
2245 fsck_cramfs_sources,
2246 include_directories : includes,
2247 link_with : [lib_common],
2248 dependencies : [lib_z],
2249 install_dir : sbindir,
2251 build_by_default : opt)
2252 if not is_disabler(exe)
2254 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2255 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2258 opt = not get_option('build-raw').disabled()
2260 cc.has_header('linux/raw.h', required: opt)
2265 include_directories : includes,
2266 install_dir : sbindir,
2268 build_by_default : opt)
2269 if opt and not is_disabler(exe)
2271 manadocs += ['disk-utils/raw.8.adoc']
2272 bashcompletions += ['raw']
2275 opt = not get_option('build-fdformat').disabled()
2279 include_directories : includes,
2280 link_with : [lib_common],
2281 install_dir : usrsbin_exec_dir,
2283 build_by_default : opt)
2284 if opt and not is_disabler(exe)
2286 manadocs += ['disk-utils/fdformat.8.adoc']
2287 bashcompletions += ['fdformat']
2293 include_directories : includes,
2294 link_with : [lib_common],
2295 install_dir : sbindir,
2297 manadocs += ['disk-utils/blockdev.8.adoc']
2298 bashcompletions += ['blockdev']
2300 opt = not get_option('build-fdisks').disabled()
2301 if opt and not have_dirfd and not have_ddfd
2302 error('neither dirfd nor ddfd are available')
2307 include_directories : includes,
2308 link_with : [lib_common,
2312 dependencies : [lib_readline],
2313 install_dir : sbindir,
2315 build_by_default : opt)
2316 if opt and not is_disabler(exe)
2318 bashcompletions += ['fdisk']
2321 opt2 = opt and 'fdisk' in static_programs
2325 link_args : ['--static'],
2326 include_directories : includes,
2327 link_with : [lib_common,
2330 lib_smartcols.get_static_lib()],
2331 dependencies : [lib_readline_static],
2332 install_dir : sbindir,
2334 build_by_default : opt2)
2335 if opt2 and not is_disabler(exe)
2342 include_directories : includes,
2343 link_with : [lib_common,
2347 dependencies : [lib_readline],
2348 install_dir : sbindir,
2350 build_by_default : opt)
2351 if opt and not is_disabler(exe)
2353 bashcompletions += ['sfdisk']
2356 opt2 = opt and 'sfdisk' in static_programs
2360 include_directories : includes,
2361 link_with : [lib_common,
2364 lib_smartcols.get_static_lib()],
2365 dependencies : [lib_readline_static],
2366 install_dir : sbindir,
2368 build_by_default : opt2)
2369 if opt2 and not is_disabler(exe)
2376 include_directories : includes,
2377 link_with : [lib_common,
2381 dependencies : [curses_libs, mount_dep],
2382 install_dir : sbindir,
2384 build_by_default : opt)
2385 if opt and not is_disabler(exe)
2387 manadocs += ['disk-utils/fdisk.8.adoc',
2388 'disk-utils/sfdisk.8.adoc',
2389 'disk-utils/cfdisk.8.adoc']
2390 bashcompletions += ['cfdisk']
2393 opt = not get_option('build-partx').disabled()
2397 include_directories : includes,
2398 link_with : [lib_common],
2399 install_dir : usrsbin_exec_dir,
2401 build_by_default : opt)
2405 include_directories : includes,
2406 link_with : [lib_common],
2407 install_dir : usrsbin_exec_dir,
2409 build_by_default : opt)
2413 include_directories : includes,
2414 link_with : [lib_common],
2415 install_dir : usrsbin_exec_dir,
2417 build_by_default : opt)
2421 include_directories : includes,
2422 link_with : [lib_common,
2424 dependencies : [blkid_dep],
2425 install_dir : usrsbin_exec_dir,
2427 build_by_default : opt)
2429 exes += [exe, exe2, exe3, exe4]
2430 manadocs += ['disk-utils/addpart.8.adoc',
2431 'disk-utils/delpart.8.adoc',
2432 'disk-utils/resizepart.8.adoc',
2433 'disk-utils/partx.8.adoc']
2434 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2436 opt = opt and 'partx' in static_programs
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 install_dir : usrsbin_exec_dir,
2454 build_by_default : opt)
2456 'resizepart.static',
2458 include_directories : includes,
2459 link_args : ['--static'],
2460 link_with : [lib_common],
2461 install_dir : usrsbin_exec_dir,
2463 build_by_default : opt)
2467 include_directories : includes,
2468 link_args : ['--static'],
2469 link_with : [lib_common,
2470 lib_smartcols.get_static_lib()],
2471 dependencies : [blkid_static_dep],
2472 install_dir : usrsbin_exec_dir,
2474 build_by_default : opt)
2477 exes += [exe, exe2, exe3, exe4]
2480 ############################################################
2485 include_directories : includes,
2486 link_with : [lib_common],
2487 dependencies : [lib_util,
2491 install_dir : usrbin_exec_dir,
2494 manadocs += ['term-utils/script.1.adoc']
2495 bashcompletions += ['script']
2500 include_directories : includes,
2501 c_args : '-DTEST_SCRIPT',
2502 link_with : [lib_common],
2503 dependencies : [lib_util,
2507 build_by_default : program_tests)
2513 include_directories : includes,
2514 link_with : [lib_common],
2515 dependencies : [lib_util,
2518 install_dir : usrbin_exec_dir,
2521 manadocs += ['term-utils/scriptlive.1.adoc']
2522 bashcompletions += ['scriptlive']
2526 scriptreplay_sources,
2527 include_directories : includes,
2528 link_with : [lib_common],
2529 dependencies : [math_libs],
2530 install_dir : usrbin_exec_dir,
2533 manadocs += ['term-utils/scriptreplay.1.adoc']
2534 bashcompletions += ['scriptreplay']
2536 opt = not get_option('build-agetty').disabled()
2540 include_directories : includes,
2541 link_with : [lib_common, logindefs_c],
2542 dependencies : [BSD ? lib_util : [], lib_systemd],
2543 install_dir : sbindir,
2545 build_by_default : opt)
2548 manadocs += ['term-utils/agetty.8.adoc']
2551 opt = not get_option('build-setterm').disabled()
2555 include_directories : includes,
2556 link_with : [lib_common],
2557 dependencies : [curses_libs],
2558 install_dir : usrbin_exec_dir,
2560 build_by_default : opt)
2563 manadocs += ['term-utils/setterm.1.adoc']
2564 bashcompletions += ['setterm']
2567 opt = not get_option('build-mesg').disabled()
2571 include_directories : includes,
2572 link_with : [lib_common],
2573 install_dir : usrbin_exec_dir,
2575 build_by_default : opt)
2578 manadocs += ['term-utils/mesg.1.adoc']
2579 bashcompletions += ['mesg']
2582 opt = not get_option('build-wall').disabled()
2586 include_directories : includes,
2587 link_with : [lib_common],
2588 dependencies : [lib_systemd],
2589 install_dir : usrbin_exec_dir,
2590 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2592 build_by_default : opt)
2595 manadocs += ['term-utils/wall.1.adoc']
2596 bashcompletions += ['wall']
2599 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2600 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2602 opt = not get_option('build-write').disabled()
2606 include_directories : includes,
2607 link_with : [lib_common],
2608 dependencies : [lib_systemd],
2609 install_dir : usrbin_exec_dir,
2610 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2612 build_by_default : opt)
2615 manadocs += ['term-utils/write.1.adoc']
2616 bashcompletions += ['write']
2619 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2620 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2622 opt = not get_option('build-login').disabled()
2626 include_directories : includes,
2627 link_with : [lib_common, logindefs_c],
2628 dependencies : [lib_pam,
2632 build_by_default : opt)
2633 if not is_disabler(exe)
2635 manadocs += ['login-utils/login.1.adoc']
2638 opt = not get_option('build-sulogin').disabled()
2642 include_directories : includes,
2643 link_with : [lib_common],
2644 dependencies : [lib_crypt,
2646 install_dir : sbindir,
2648 build_by_default : opt)
2649 if not is_disabler(exe)
2651 manadocs += ['login-utils/sulogin.8.adoc']
2657 include_directories : includes,
2658 link_with : [lib_common,
2660 dependencies : [curses_libs],
2661 install_dir : usrbin_exec_dir,
2664 manadocs += ['misc-utils/cal.1.adoc']
2665 bashcompletions += ['cal']
2667 opt = not get_option('build-logger').disabled()
2671 include_directories : includes,
2672 link_with : [lib_common],
2673 dependencies : [lib_systemd],
2674 install_dir : usrbin_exec_dir,
2676 build_by_default : opt)
2677 if opt and not is_disabler(exe)
2679 manadocs += ['misc-utils/logger.1.adoc']
2680 bashcompletions += ['logger']
2686 include_directories : includes,
2687 c_args : '-DTEST_LOGGER',
2688 link_with : [lib_common],
2689 dependencies : [lib_systemd],
2690 build_by_default: program_tests)
2691 if not is_disabler(exe)
2698 include_directories : includes,
2699 install_dir : usrbin_exec_dir,
2702 manadocs += ['misc-utils/look.1.adoc']
2703 bashcompletions += ['look']
2708 include_directories : includes,
2709 link_with : [lib_common],
2710 install_dir : usrbin_exec_dir,
2713 manadocs += ['misc-utils/mcookie.1.adoc']
2714 bashcompletions += ['mcookie']
2716 if build_liblastlog2
2720 include_directories : includes,
2721 link_with : [lib_common, lib_lastlog2],
2722 install_dir : usrbin_exec_dir,
2725 manadocs += ['misc-utils/lastlog2.8.adoc']
2726 bashcompletions += ['lastlog2']
2727 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2728 'liblastlog2/man/ll2_write_entry.3.adoc',
2729 'liblastlog2/man/ll2_read_entry.3.adoc',
2730 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2731 'liblastlog2/man/ll2_read_all.3.adoc',
2732 'liblastlog2/man/ll2_remove_entry.3.adoc',
2733 'liblastlog2/man/ll2_rename_user.3.adoc',
2734 'liblastlog2/man/ll2_update_login_time.3.adoc'
2741 include_directories : includes,
2742 dependencies : [lib_selinux],
2743 install_dir : usrbin_exec_dir,
2746 manadocs += ['misc-utils/namei.1.adoc']
2747 bashcompletions += ['namei']
2752 include_directories : includes,
2753 link_with : [lib_common],
2754 install_dir : usrbin_exec_dir,
2757 manadocs += ['misc-utils/whereis.1.adoc']
2758 bashcompletions += ['whereis']
2760 opt = not get_option('build-lslocks').disabled()
2764 include_directories : includes,
2765 link_with : [lib_common,
2767 dependencies : [mount_dep],
2768 install_dir : usrbin_exec_dir,
2770 build_by_default : opt)
2771 if opt and not is_disabler(exe)
2773 manadocs += ['misc-utils/lslocks.8.adoc']
2774 bashcompletions += ['lslocks']
2777 opt = not get_option('build-lsblk').disabled()
2781 include_directories : includes,
2782 link_with : [lib_common,
2785 dependencies : [blkid_dep, lib_udev, mount_dep],
2787 build_by_default : opt)
2788 if opt and not is_disabler(exe)
2790 manadocs += ['misc-utils/lsblk.8.adoc']
2791 bashcompletions += ['lsblk']
2794 errnos_h = custom_target('errnos.h',
2795 input : 'tools/all_errnos',
2796 output : 'errnos.h',
2797 command : ['tools/all_errnos', sed.full_path(),
2798 cc.cmd_array(), get_option('c_args')],
2801 opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
2804 lsfd_sources, errnos_h,
2805 include_directories : includes,
2806 link_with : [lib_common,
2808 dependencies : [lib_rt],
2809 install_dir : usrbin_exec_dir,
2811 build_by_default : opt)
2812 if opt and not is_disabler(exe)
2814 manadocs += ['lsfd-cmd/lsfd.1.adoc']
2820 include_directories : includes,
2821 link_with : [lib_common,
2823 install_dir : usrbin_exec_dir,
2825 if not is_disabler(exe)
2827 manadocs += ['misc-utils/uuidgen.1.adoc']
2828 bashcompletions += ['uuidgen']
2834 include_directories : includes,
2835 link_with : [lib_common,
2838 install_dir : usrbin_exec_dir,
2840 if not is_disabler(exe)
2842 manadocs += ['misc-utils/uuidparse.1.adoc']
2843 bashcompletions += ['uuidparse']
2850 include_directories : includes,
2851 link_with : [lib_common,
2853 dependencies : [realtime_libs,
2855 install_dir : usrsbin_exec_dir,
2857 build_by_default : opt)
2861 include_directories : includes,
2862 link_with : [lib_common,
2864 dependencies : thread_libs,
2865 build_by_default : opt and program_tests)
2866 if not is_disabler(exe)
2868 manadocs += ['misc-utils/uuidd.8.adoc']
2869 bashcompletions += ['uuidd']
2872 opt = build_libblkid
2876 include_directories : includes,
2877 link_with : [lib_common],
2878 dependencies : [blkid_dep],
2879 install_dir : sbindir,
2881 build_by_default : opt)
2882 if opt and not is_disabler(exe)
2884 manadocs += ['misc-utils/blkid.8.adoc']
2885 bashcompletions += ['blkid']
2888 opt = opt and 'blkid' in static_programs
2892 include_directories : includes,
2893 link_with : [lib_common],
2894 dependencies : [blkid_static_dep],
2895 install_dir : sbindir,
2897 build_by_default : opt)
2898 if opt and not is_disabler(exe)
2904 'libblkid/samples/mkfs.c',
2905 include_directories : includes,
2906 dependencies : [blkid_dep])
2907 if not is_disabler(exe)
2912 'sample-partitions',
2913 'libblkid/samples/partitions.c',
2914 include_directories : includes,
2915 dependencies : [blkid_dep])
2916 if not is_disabler(exe)
2921 'sample-superblocks',
2922 'libblkid/samples/superblocks.c',
2923 include_directories : includes,
2924 dependencies : [blkid_dep])
2925 if not is_disabler(exe)
2931 'libblkid/samples/topology.c',
2932 include_directories : includes,
2933 dependencies : [blkid_dep])
2934 if not is_disabler(exe)
2939 'test_blkid_fuzz_sample',
2940 'libblkid/src/fuzz.c',
2941 include_directories: includes,
2942 dependencies : [blkid_dep],
2943 build_by_default: program_tests)
2944 if not is_disabler(exe)
2948 ############################################################
2953 include_directories : includes,
2954 dependencies : [blkid_dep],
2955 install_dir : sbindir,
2957 if not is_disabler(exe)
2959 manadocs += ['misc-utils/findfs.8.adoc']
2960 bashcompletions += ['findfs']
2966 include_directories : includes,
2967 link_with : [lib_common,
2969 dependencies : [blkid_dep],
2970 install_dir : sbindir,
2972 if not is_disabler(exe)
2974 manadocs += ['misc-utils/wipefs.8.adoc']
2975 bashcompletions += ['wipefs']
2978 opt = not get_option('build-findmnt').disabled()
2982 include_directories : includes,
2983 link_with : [lib_common,
2985 dependencies : [blkid_dep, lib_udev, mount_dep],
2987 build_by_default : opt)
2988 if opt and not is_disabler(exe)
2990 manadocs += ['misc-utils/findmnt.8.adoc']
2991 bashcompletions += ['findmnt']
2997 include_directories : includes,
2998 link_with : [lib_common],
3000 if not is_disabler(exe)
3002 manadocs += ['misc-utils/kill.1.adoc']
3005 opt = not get_option('build-rename').disabled()
3009 include_directories : includes,
3010 install_dir : usrbin_exec_dir,
3012 build_by_default : opt)
3013 if opt and not is_disabler(exe)
3015 manadocs += ['misc-utils/rename.1.adoc']
3016 bashcompletions += ['rename']
3022 include_directories : includes,
3023 link_with : [lib_common],
3024 install_dir : usrbin_exec_dir,
3027 manadocs += ['misc-utils/getopt.1.adoc']
3028 bashcompletions += ['getopt']
3033 include_directories : includes,
3034 link_with : [lib_common,
3036 install_dir : usrbin_exec_dir,
3038 if not is_disabler(exe)
3040 manadocs += ['misc-utils/fincore.1.adoc']
3041 bashcompletions += ['fincore']
3047 include_directories : includes,
3048 link_with : [lib_common],
3049 install_dir : usrbin_exec_dir,
3051 if not is_disabler(exe)
3053 manadocs += ['misc-utils/hardlink.1.adoc']
3054 bashcompletions += ['hardlink']
3057 opt = not get_option('build-pipesz').disabled()
3061 include_directories : includes,
3062 link_with : [lib_common],
3063 install_dir : usrbin_exec_dir,
3065 if opt and not is_disabler(exe)
3067 manadocs += ['misc-utils/pipesz.1.adoc']
3068 bashcompletions += ['pipesz']
3074 include_directories : includes,
3075 c_args : '-DTEST_CAL',
3076 link_with : [lib_common,
3078 dependencies : [curses_libs],
3079 build_by_default: program_tests)
3080 if not is_disabler(exe)
3087 include_directories : includes,
3088 link_with : [lib_common],
3089 install_dir : usrbin_exec_dir,
3091 if not is_disabler(exe)
3093 manadocs += ['misc-utils/fadvise.1.adoc']
3094 bashcompletions += ['fadvise']
3097 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3101 include_directories : includes,
3102 link_with : [lib_common],
3103 install_dir : usrbin_exec_dir,
3105 if not is_disabler(exe)
3107 manadocs += ['misc-utils/waitpid.1.adoc']
3108 bashcompletions += ['waitpid']
3112 syscalls_h = custom_target('syscalls.h',
3113 input : 'tools/all_syscalls',
3114 output : 'syscalls.h',
3115 command : ['tools/all_syscalls', sed.full_path(),
3116 cc.cmd_array(), get_option('c_args')],
3119 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3122 'misc-utils/enosys.c', syscalls_h, errnos_h,
3123 include_directories : includes,
3124 link_with : [lib_common],
3125 install_dir : usrbin_exec_dir,
3127 if not is_disabler(exe)
3129 manadocs += ['misc-utils/enosys.1.adoc']
3130 bashcompletions += ['enosys']
3137 include_directories : includes,
3138 link_with : [lib_common, lib_smartcols],
3139 install_dir : usrbin_exec_dir,
3141 if not is_disabler(exe)
3143 manadocs += ['misc-utils/lsclocks.1.adoc']
3144 bashcompletions += ['lsclocks']
3147 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3151 include_directories : includes,
3152 link_with : [lib_common],
3153 install_dir : usrbin_exec_dir,
3155 if not is_disabler(exe)
3157 manadocs += ['misc-utils/exch.1.adoc']
3158 bashcompletions += ['exch']
3162 ############################################################
3164 opt = not get_option('build-schedutils').disabled()
3167 'schedutils/chrt.c',
3168 include_directories : includes,
3169 link_with : lib_common,
3170 install_dir : usrbin_exec_dir,
3172 build_by_default : opt)
3176 'schedutils/ionice.c',
3177 include_directories : includes,
3178 link_with : lib_common,
3179 install_dir : usrbin_exec_dir,
3181 build_by_default : opt)
3185 'schedutils/taskset.c',
3186 include_directories : includes,
3187 link_with : lib_common,
3188 install_dir : usrbin_exec_dir,
3190 build_by_default : opt)
3194 'schedutils/uclampset.c',
3195 include_directories : includes,
3196 link_with : lib_common,
3197 install_dir : usrbin_exec_dir,
3199 build_by_default : opt)
3201 if opt and not is_disabler(exe)
3202 exes += [exe, exe2, exe3, exe4]
3203 manadocs += ['schedutils/chrt.1.adoc',
3204 'schedutils/ionice.1.adoc',
3205 'schedutils/taskset.1.adoc',
3206 'schedutils/uclampset.1.adoc']
3207 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3210 ############################################################
3212 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3217 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3218 include_directories : dir_include,
3219 link_with : lib_common,
3220 build_by_default: program_tests)
3226 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3227 include_directories : dir_include,
3228 link_with : lib_common,
3229 build_by_default: program_tests)
3235 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3236 include_directories : dir_include,
3237 link_with : lib_common,
3238 build_by_default: program_tests)
3244 c_args : ['-DTEST_PROGRAM_MANGLE'],
3245 include_directories : dir_include,
3246 build_by_default: program_tests)
3252 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3253 include_directories : dir_include,
3254 build_by_default: program_tests)
3260 'lib/color-names.c',
3261 c_args : ['-DTEST_PROGRAM_COLORS'],
3262 include_directories : dir_include,
3263 link_with : [lib_common, lib_tcolors],
3264 build_by_default: program_tests)
3270 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3271 include_directories : dir_include,
3272 build_by_default: program_tests)
3275 if conf.get('HAVE_OPENAT').to_string() == '1' \
3276 and conf.get('HAVE_DIRFD').to_string() == '1'
3280 c_args : ['-DTEST_PROGRAM_PROCFS'],
3281 include_directories : dir_include,
3282 link_with : lib_common,
3283 build_by_default: program_tests)
3290 have_cpu_set_t ? 'lib/cpuset.c' : [],
3291 c_args : ['-DTEST_PROGRAM_PATH'],
3292 include_directories : dir_include,
3293 link_with : lib_common,
3294 build_by_default: program_tests)
3298 if conf.get('HAVE_PTY').to_string() == '1'
3303 c_args : ['-DTEST_PROGRAM_PTY'],
3304 include_directories : dir_include,
3305 link_with : [lib_common],
3306 dependencies : [lib_m,
3309 build_by_default: program_tests)
3317 c_args : ['-DTEST_PROGRAM_CPUSET'],
3318 include_directories : dir_include,
3319 build_by_default: program_tests)
3330 have_cpu_set_t ? 'lib/cpuset.c' : [],
3331 c_args : ['-DTEST_PROGRAM_SYSFS'],
3332 include_directories : dir_include,
3333 build_by_default: program_tests)
3339 c_args : ['-DTEST_PROGRAM_PAGER'],
3340 include_directories : dir_include,
3341 build_by_default: program_tests)
3345 'test_linux_version',
3346 'lib/linux_version.c',
3347 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3348 include_directories : dir_include,
3349 build_by_default: program_tests)
3355 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3356 include_directories : dir_include,
3357 build_by_default: program_tests)
3361 'test_canonicalize',
3362 'lib/canonicalize.c',
3363 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3364 include_directories : dir_include,
3365 build_by_default: program_tests)
3372 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3373 include_directories : dir_include,
3374 build_by_default: program_tests)
3380 c_args : ['-DTEST_PROGRAM'],
3381 include_directories : dir_include,
3382 link_with : lib_common,
3383 build_by_default: program_tests)
3389 c_args : ['-DTEST_PROGRAM'],
3390 include_directories : dir_include,
3391 link_with : [lib_common, logindefs_c],
3392 build_by_default: program_tests)
3396 ############################################################
3400 'libuuid/src/test_uuid.c',
3401 include_directories : [dir_include, dir_libuuid],
3402 link_with : lib_uuid,
3403 dependencies : socket_libs,
3404 build_by_default: program_tests)
3405 if not is_disabler(exe)
3409 ############################################################
3411 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3412 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid]
3413 libfdisk_tests_ldadd_deps = [blkid_dep]
3417 'libfdisk/src/ask.c',
3418 c_args : libfdisk_tests_cflags,
3419 include_directories : lib_fdisk_includes,
3420 link_with : libfdisk_tests_ldadd,
3421 dependencies : libfdisk_tests_ldadd_deps,
3422 build_by_default: program_tests)
3423 if not is_disabler(exe)
3429 'libfdisk/src/gpt.c',
3430 c_args : libfdisk_tests_cflags,
3431 include_directories : lib_fdisk_includes,
3432 link_with : libfdisk_tests_ldadd,
3433 dependencies : libfdisk_tests_ldadd_deps,
3434 build_by_default: program_tests)
3435 if not is_disabler(exe)
3441 'libfdisk/src/utils.c',
3442 c_args : libfdisk_tests_cflags,
3443 include_directories : lib_fdisk_includes,
3444 link_with : libfdisk_tests_ldadd,
3445 dependencies : libfdisk_tests_ldadd_deps,
3446 build_by_default: program_tests)
3447 if not is_disabler(exe)
3452 'test_fdisk_script',
3453 'libfdisk/src/script.c',
3454 c_args : libfdisk_tests_cflags,
3455 include_directories : lib_fdisk_includes,
3456 link_with : libfdisk_tests_ldadd,
3457 dependencies : libfdisk_tests_ldadd_deps,
3458 build_by_default: program_tests)
3459 if not is_disabler(exe)
3464 'test_fdisk_version',
3465 'libfdisk/src/version.c',
3466 c_args : libfdisk_tests_cflags,
3467 include_directories : lib_fdisk_includes,
3468 link_with : libfdisk_tests_ldadd,
3469 dependencies : libfdisk_tests_ldadd_deps,
3470 build_by_default: program_tests)
3471 if not is_disabler(exe)
3477 'libfdisk/src/item.c',
3478 c_args : libfdisk_tests_cflags,
3479 include_directories : lib_fdisk_includes,
3480 link_with : libfdisk_tests_ldadd,
3481 dependencies : libfdisk_tests_ldadd_deps,
3482 build_by_default: program_tests)
3483 if not is_disabler(exe)
3487 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3490 'sample-fdisk-mkpart',
3491 'libfdisk/samples/mkpart.c',
3492 include_directories : lib_fdisk_includes,
3493 link_with : sample_fdisk_ldadd)
3494 if not is_disabler(exe)
3499 'sample-fdisk-mkpart-fullspec',
3500 'libfdisk/samples/mkpart-fullspec.c',
3501 include_directories : lib_fdisk_includes,
3502 link_with : sample_fdisk_ldadd)
3503 if not is_disabler(exe)
3507 ############################################################
3511 'tests/helpers/test_cap.c',
3512 include_directories : includes,
3513 dependencies : [lib_cap_ng],
3514 build_by_default: program_tests)
3515 if not is_disabler(exe)
3521 'tests/helpers/test_mbsencode.c',
3522 include_directories : includes,
3523 link_with : lib_common,
3524 build_by_default: program_tests)
3529 'tests/helpers/test_byteswap.c',
3530 include_directories : includes,
3531 build_by_default: program_tests)
3536 'tests/helpers/test_md5.c',
3538 include_directories : includes,
3539 build_by_default: program_tests)
3544 'tests/helpers/test_sha1.c',
3546 include_directories : includes,
3547 build_by_default: program_tests)
3552 'tests/helpers/test_pathnames.c',
3553 include_directories : includes,
3554 build_by_default: program_tests)
3559 'tests/helpers/test_strerror.c',
3560 include_directories : includes,
3561 build_by_default: program_tests)
3566 'tests/helpers/test_sysinfo.c',
3567 include_directories : includes,
3568 build_by_default: program_tests)
3573 'tests/helpers/test_sigreceive.c',
3574 include_directories : includes,
3575 link_with : lib_common,
3576 build_by_default: program_tests)
3581 'tests/helpers/test_tiocsti.c',
3582 include_directories : includes,
3583 build_by_default: program_tests)
3587 'test_uuid_namespace',
3588 'tests/helpers/test_uuid_namespace.c',
3592 include_directories : includes,
3593 build_by_default: program_tests)
3596 if LINUX and lib_rt.found()
3599 'tests/helpers/test_mkfds.c',
3600 'tests/helpers/test_mkfds.h',
3601 'tests/helpers/test_mkfds_ppoll.c',
3602 include_directories : includes,
3603 dependencies : [lib_rt],
3604 build_by_default: program_tests)
3610 'tests/helpers/test_enosys.c',
3611 include_directories : includes,
3612 build_by_default: program_tests)
3615 ############################################################
3617 if conf.get('HAVE_OPENAT').to_string() == '1'
3619 'sample-scols-tree',
3620 'libsmartcols/samples/tree.c',
3621 include_directories : includes,
3622 link_with : [lib_smartcols, lib_common],
3623 build_by_default: program_tests)
3624 if not is_disabler(exe)
3630 'sample-scols-title',
3631 'libsmartcols/samples/title.c',
3632 include_directories : includes,
3633 link_with : [lib_smartcols, lib_common])
3634 if not is_disabler(exe)
3639 'sample-scols-wrap',
3640 'libsmartcols/samples/wrap.c',
3641 include_directories : includes,
3642 link_with : [lib_smartcols, lib_common])
3643 if not is_disabler(exe)
3648 'sample-scols-continuous',
3649 'libsmartcols/samples/continuous.c',
3650 include_directories : includes,
3651 link_with : [lib_smartcols, lib_common])
3652 if not is_disabler(exe)
3657 'sample-scols-continuous-json',
3658 'libsmartcols/samples/continuous-json.c',
3659 include_directories : includes,
3660 link_with : [lib_smartcols, lib_common])
3661 if not is_disabler(exe)
3666 'sample-scols-maxout',
3667 'libsmartcols/samples/maxout.c',
3668 include_directories : includes,
3669 link_with : [lib_smartcols, lib_common])
3670 if not is_disabler(exe)
3675 'sample-scols-fromfile',
3676 'libsmartcols/samples/fromfile.c',
3677 include_directories : includes,
3678 link_with : [lib_smartcols, lib_common])
3679 if not is_disabler(exe)
3684 'sample-scols-grouping-simple',
3685 'libsmartcols/samples/grouping-simple.c',
3686 include_directories : includes,
3687 link_with : [lib_smartcols, lib_common])
3688 if not is_disabler(exe)
3693 'sample-scols-grouping-overlay',
3694 'libsmartcols/samples/grouping-overlay.c',
3695 include_directories : includes,
3696 link_with : [lib_smartcols, lib_common])
3697 if not is_disabler(exe)
3703 'Documentation/boilerplate.c',
3704 include_directories : includes,
3705 build_by_default: program_tests)
3706 if not is_disabler(exe)
3710 ############################################################
3712 # Let the test runner know whether we're running under asan and export
3713 # some paths. We use a file on disk so that it is possible to run the
3714 # test scripts from commandline without setting any variables.
3715 configure_file(output : 'meson.conf',
3720 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3721 python.full_path())])
3723 run_sh = find_program('tests/run.sh')
3727 '--srcdir=' + meson.current_source_dir(),
3728 '--builddir=' + meson.current_build_dir(),
3734 manadocs += ['lib/terminal-colors.d.5.adoc']
3735 manadocs += ['libblkid/libblkid.3.adoc']
3739 'libuuid/man/uuid.3.adoc',
3740 'libuuid/man/uuid_clear.3.adoc',
3741 'libuuid/man/uuid_compare.3.adoc',
3742 'libuuid/man/uuid_copy.3.adoc',
3743 'libuuid/man/uuid_generate.3.adoc',
3744 'libuuid/man/uuid_is_null.3.adoc',
3745 'libuuid/man/uuid_parse.3.adoc',
3746 'libuuid/man/uuid_time.3.adoc',
3747 'libuuid/man/uuid_unparse.3.adoc']
3749 'uuid_generate_random.3': 'uuid_generate.3',
3750 'uuid_generate_time.3': 'uuid_generate.3',
3751 'uuid_generate_time_safe.3': 'uuid_generate.3',
3755 asciidoctor = find_program('asciidoctor', required : false)
3756 if asciidoctor.found()
3757 foreach adoc : manadocs
3758 name = adoc.split('/')[-1]
3759 page = name.split('.adoc')[0]
3760 section = page.split('.')[-1]
3761 mandirn = join_paths(mandir, 'man' + section)
3766 command : [ asciidoctor,
3768 '-a', 'VERSION=' + meson.project_version(),
3769 '-a', 'release-version=' + meson.project_version(),
3770 '-a', 'ADJTIME_PATH=/etc/adjtime',
3771 '-a', 'package-docdir=' + docdir,
3772 '--base-dir=' + meson.current_source_dir(),
3773 '--destination-dir=' + meson.current_build_dir(),
3774 '--load-path', '@SOURCE_ROOT@/tools',
3775 '--require', 'asciidoctor-includetracker',
3779 depfile : page + '.deps',
3781 install_dir : mandirn)
3784 foreach link_name, target : manlinks
3785 link_section = link_name.split('.')[-1]
3786 target_section = target.split('.')[-1]
3787 meson.add_install_script(meson_make_manpage_stub,
3788 join_paths('man' + target_section, target),
3789 join_paths(mandir, 'man' + link_section, link_name))
3793 if bash_completion.found()
3794 foreach completion : bashcompletions
3796 join_paths('bash-completion', completion),
3797 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3800 foreach link_name, target : bashcompletionslinks
3801 meson.add_install_script(meson_make_symlink,
3803 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))