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', language : 'c')
44 cc = meson.get_compiler('c')
46 conf = configuration_data()
47 conf.set_quoted('PACKAGE', meson.project_name())
48 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
49 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
50 conf.set_quoted('PACKAGE_STRING', package_string)
53 pc_version = meson.project_version().split('-')[0].split('.')
55 if pc_version.length() < 3
59 pc_version = '.'.join(pc_version)
61 conf.set_quoted('LIBBLKID_VERSION', pc_version)
62 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
64 conf.set('bindir', bindir)
65 conf.set('sbindir', sbindir)
66 conf.set('runstatedir', runstatedir)
67 conf.set('localstatedir', localstatedir)
68 conf.set('sysconfdir', sysconfdir)
69 conf.set('usrbin_execdir', usrbin_exec_dir)
70 conf.set('usrsbin_execdir', usrsbin_exec_dir)
71 conf.set('docdir', docdir)
72 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
73 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
74 conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir)
75 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
76 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
78 conf.set_quoted('_PATH_VENDORDIR', vendordir)
79 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
81 build_libblkid = not get_option('build-libblkid').disabled()
82 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
83 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
85 build_libuuid = not get_option('build-libuuid').disabled()
86 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
87 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
89 build_liblastlog2 = not get_option('build-liblastlog2').disabled()
90 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
91 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
93 login_lastlogin = get_option('login-lastlogin')
94 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
95 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
97 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
98 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
99 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
101 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
102 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
104 build_libmount = not get_option('build-libmount').disabled()
105 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
106 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
107 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
108 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
110 build_libsmartcols = not get_option('build-libsmartcols').disabled()
111 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
112 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
114 build_libfdisk = not get_option('build-libfdisk').disabled()
115 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
116 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
118 build_uuidd = not get_option('build-uuidd').disabled()
119 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
120 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
122 static_programs = get_option('static-programs')
123 need_static_libs = static_programs.length() > 0 # a rough estimate...
124 summary('static programs', static_programs)
126 LINUX = host_machine.system() in ['linux']
127 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
129 ############################################################
147 have = cc.compiles(code, name : 'wchar_t support')
148 if not have and get_option('widechar').enabled()
149 error('widechar support requested but unavailable')
151 if get_option('ncurses').enabled() and get_option('widechar').enabled()
152 error('widechar support is incompatible with non-wide ncurses')
154 conf.set('HAVE_WIDECHAR', have ? 1 : false)
196 linux/net_namespace.h
210 security/pam_modules.h
243 lib_m = cc.find_library('m')
245 lib_tinfo = dependency(
247 required : get_option('tinfo'))
249 lib_ncursesw = dependency(
251 required : get_option('ncursesw'))
252 if lib_ncursesw.found()
253 headers += ['ncursesw/ncurses.h',
257 lib_ncurses = disabler()
259 lib_ncurses = dependency(
261 required : get_option('ncurses'))
262 headers += ['ncurses.h',
266 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
267 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
268 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
270 lib_slang = dependency(
272 required : get_option('slang'))
274 headers += ['slang.h',
279 conf.set('HAVE_SLANG', lib_slang.found())
281 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
282 if curses_libs.found()
283 have = cc.has_function('use_default_colors', dependencies : curses_libs)
284 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
285 have = cc.has_function('resizeterm', dependencies : curses_libs)
286 conf.set('HAVE_RESIZETERM', have ? 1 : false)
293 required : get_option('zlib'))
295 lib_readline = dependency(
297 required : get_option('readline'))
298 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
300 lib_readline_static = dependency(
303 required : need_static_libs ? get_option('readline') : disabler())
305 if meson.version().version_compare('>= 0.59.0')
306 lib_intl = dependency(
308 required : get_option('nls'))
309 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
311 if get_option('nls').enabled()
312 error('nls is not supported with meson before 0.59.0')
314 lib_intl = dependency('', required : false)
317 lib_user = dependency(
320 required : get_option('libuser'))
321 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
323 lib_util = cc.find_library(
325 required : get_option('libutil'))
326 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
328 lib_utempter = cc.find_library(
330 required : get_option('libutempter'))
331 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
333 systemd = dependency(
335 required : get_option('systemd'))
337 lib_systemd = dependency(
339 required : get_option('systemd'))
340 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
341 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
343 have = cc.has_function(
344 'sd_session_get_username',
345 dependencies : lib_systemd)
346 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
348 lib_udev = dependency(
350 required : get_option('systemd'))
351 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
353 lib_crypt = cc.find_library('crypt', required : get_option('build-newgrp'))
354 if not lib_crypt.found()
355 lib_crypt = cc.find_library('crypt', required : get_option('build-sulogin'))
358 lib_pam = cc.find_library('pam', required : get_option('build-login'))
359 if not lib_pam.found()
360 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
362 if not lib_pam.found()
363 lib_pam = cc.find_library('pam', required : get_option('build-su'))
365 if not lib_pam.found()
366 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
369 lib_pam_misc = cc.find_library('pam_misc')
370 lib_pam = [lib_pam, lib_pam_misc]
372 lib_pam_misc = declare_dependency()
375 lib_cryptsetup = dependency(
377 required : get_option('cryptsetup'))
378 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
380 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
382 if meson.version().version_compare('>= 0.62.0')
383 lib_dl = dependency('dl')
385 lib_dl = cc.find_library('dl')
387 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
388 summary('cryptsetup support (dlopen)',
390 section : 'components')
392 summary('cryptsetup support',
393 lib_cryptsetup.found() ? 'enabled' : 'disabled',
394 section : 'components')
397 have = cc.has_function(
398 'crypt_activate_by_signed_key',
399 dependencies : lib_cryptsetup)
400 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
402 lib_cap_ng = dependency(
404 required : get_option('build-setpriv'))
405 if not lib_cap_ng.found()
406 lib_cap_ng = disabler()
409 lib_selinux = dependency(
412 required : get_option('selinux'))
413 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
415 lib_magic = dependency(
417 required : get_option('magic'))
418 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
420 lib_econf = dependency(
422 required : get_option('econf'))
423 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
425 lib_audit = dependency(
427 required : get_option('audit'))
428 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
430 conf.set('HAVE_SMACK', not get_option('smack').disabled())
432 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
434 foreach header : headers
435 have = cc.has_header(header)
436 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
439 header = 'linux/btrfs.h'
440 enable_btrfs = cc.has_header(header,
441 required : get_option('btrfs'))
442 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
443 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
445 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
450 have = cc.has_header(header,
452 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
455 have = cc.has_header('sched.h')
456 conf.set10('HAVE_DECL_CPU_ALLOC', have)
457 # We get -1 if the size cannot be determined
458 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
459 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
461 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
462 conf.set('HAVE_ENVIRON_DECL', have ? 1 : false)
464 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
465 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
467 have = cc.has_function('strsignal')
468 conf.set10('HAVE_STRSIGNAL_DECL', have)
470 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
471 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
473 have = cc.has_type('loff_t',
474 args : '-D_GNU_SOURCE',
475 prefix : '#include <sys/types.h>')
476 conf.set('HAVE_LOFF_T', have ? 1 : false)
478 have = cc.compiles('''
479 #define _GNU_SOURCE 1
480 #include <langinfo.h>
483 str = nl_langinfo (ALTMON_1);
484 str = nl_langinfo (ALTMON_2);
485 str = nl_langinfo (ALTMON_3);
486 str = nl_langinfo (ALTMON_4);
487 str = nl_langinfo (ALTMON_5);
488 str = nl_langinfo (ALTMON_6);
489 str = nl_langinfo (ALTMON_7);
490 str = nl_langinfo (ALTMON_8);
491 str = nl_langinfo (ALTMON_9);
492 str = nl_langinfo (ALTMON_10);
493 str = nl_langinfo (ALTMON_11);
494 str = nl_langinfo (ALTMON_12);
498 name : 'langinfo.h defines ALTMON_x constants')
499 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
501 have = cc.compiles('''
502 #define _GNU_SOURCE 1
503 #include <langinfo.h>
506 str = nl_langinfo (_NL_ABALTMON_1);
507 str = nl_langinfo (_NL_ABALTMON_2);
508 str = nl_langinfo (_NL_ABALTMON_3);
509 str = nl_langinfo (_NL_ABALTMON_4);
510 str = nl_langinfo (_NL_ABALTMON_5);
511 str = nl_langinfo (_NL_ABALTMON_6);
512 str = nl_langinfo (_NL_ABALTMON_7);
513 str = nl_langinfo (_NL_ABALTMON_8);
514 str = nl_langinfo (_NL_ABALTMON_9);
515 str = nl_langinfo (_NL_ABALTMON_10);
516 str = nl_langinfo (_NL_ABALTMON_11);
517 str = nl_langinfo (_NL_ABALTMON_12);
521 name : 'langinfo.h defines _NL_ABALTMON_x constants')
522 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
524 have = cc.compiles('''
525 #define _GNU_SOURCE 1
526 #include <langinfo.h>
529 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
533 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
534 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
567 landlock_create_ruleset
569 landlock_restrict_self
632 have = cc.has_function(func)
633 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
634 # This makes little sense, but is necessary to avoid warnings about
635 # redefined macros from Python.h, which uses this convention.
636 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
639 have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
640 conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false)
642 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
643 conf.set('AGETTY_RELOAD', have ? 1 : false)
645 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
648 have_dirfd = (cc.has_function('dirfd') or
649 cc.has_header_symbol('dirent.h', 'dirfd',
650 prefix : '#include <sys/types.h>'))
651 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
653 have_ddfd = cc.has_member('DIR', 'dd_fd',
655 #include <sys/types.h>
658 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
660 have = cc.has_member('struct tm', 'tm_gmtoff',
661 args : '-D_GNU_SOURCE',
666 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
670 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
671 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
673 have = cc.has_member('struct termios', 'c_line',
674 prefix : '#include <termios.h>')
675 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
677 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
678 args : '-D_GNU_SOURCE',
679 prefix : '#include <sys/stat.h>')
680 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
682 have = cc.has_member('struct statx', 'stx_mnt_id',
683 prefix : '#include <sys/stat.h>')
684 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
686 # replacement for AC_STRUCT_TIMEZONE
687 have = cc.has_member('struct tm', 'tm_zone',
688 args : '-D_GNU_SOURCE',
689 prefix : '#include <time.h>')
690 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
692 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
693 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
695 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
696 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
698 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
699 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
704 extern char *tzname[];
707 return tzname ? 0 : 1;
709 '''.format(have ? 1 : 0)
710 have = cc.compiles(code, name : 'using tzname[]')
711 conf.set('HAVE_TZNAME', have ? 1 : false)
713 have = cc.sizeof('time_t', prefix : '#include <time.h>')
715 add_global_arguments('-D_TIME_BITS=64', language : 'c')
716 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
718 if get_option('allow-32bit-time')
719 warning('Could not make time_t 64bits wide')
721 error('Could not make time_t 64bits wide')
727 if not cc.has_function('socket')
728 socket_libs += cc.find_library('socket', required : true)
729 have = cc.has_function('socket',
730 dependencies : socket_libs)
732 error('socket() function not available')
737 have = cc.has_function('clock_gettime')
739 realtime_libs += cc.find_library('rt', required : true)
740 have = cc.has_function('clock_gettime',
741 dependencies : realtime_libs)
743 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
745 thread_libs = dependency('threads')
747 have = cc.has_function('timer_create')
749 realtime_libs = [cc.find_library('rt', required : true)]
750 have = cc.has_function('timer_create',
751 dependencies : realtime_libs)
753 realtime_libs += thread_libs
754 have = cc.has_function('timer_create',
755 dependencies : realtime_libs)
758 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
760 have = cc.has_function('setitimer')
761 conf.set('HAVE_SETITIMER', have ? 1 : false)
764 rtas_libs = cc.find_library('rtas', required : false)
765 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
768 if not cc.has_header_symbol('math.h', 'isnan')
769 lib = cc.find_library('m', required : true)
770 if (cc.has_function('isnan', dependencies : lib) and
771 cc.has_function('__isnan', dependencies : lib))
776 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
777 args : '-D_GNU_SOURCE')
778 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
781 extern char *__progname;
783 return (*__progname != 0);
786 have = cc.compiles(code, name : 'using __progname')
787 conf.set('HAVE___PROGNAME', have ? 1 : false)
789 have = conf.get('HAVE_PTY_H').to_string() == '1' \
790 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
791 conf.set('HAVE_PTY', have ? 1 : false)
793 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
794 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
796 build_plymouth_support = get_option('build-plymouth-support')
797 have_tiocglcktrmios = cc.has_header_symbol(
798 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
799 required : build_plymouth_support.enabled())
800 have_sock_cloexec = cc.has_header_symbol(
801 'sys/socket.h', 'SOCK_CLOEXEC',
802 prefix : '#include <sys/types.h>',
803 required : build_plymouth_support.enabled())
804 have_sock_nonblock = cc.has_header_symbol(
805 'sys/socket.h', 'SOCK_NONBLOCK',
806 prefix : '#include <sys/types.h>',
807 required : build_plymouth_support.enabled())
808 have_so_passcred = cc.has_header_symbol(
809 'sys/socket.h', 'SO_PASSCRED',
810 args : ['-D_GNU_SOURCE'],
811 prefix : '#include <sys/types.h>',
812 required : build_plymouth_support.enabled())
814 build_plymouth_support = (not build_plymouth_support.disabled() and
815 have_tiocglcktrmios and
816 have_sock_cloexec and
817 have_sock_nonblock and
819 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
820 summary('plymouth support',
821 build_plymouth_support ? 'enabled' : 'disabled',
822 section : 'components')
824 # check for valid fallocate() function
825 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
826 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
827 # and program can't be linked.
835 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
836 return ret == 0 ? 0 : 1;
839 have = cc.links(code, name : 'fallocate() function')
840 conf.set('HAVE_FALLOCATE', have ? 1 : false)
848 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
849 return ret == 0 ? 0 : 1;
852 have = cc.links(code, name : 'posix_fallocate() function')
853 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
855 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
856 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
857 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
859 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
860 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
861 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
863 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
865 ############################################################
868 fs_search_path = get_option('fs-search-path')
869 fs_search_path_extra = get_option('fs-search-path-extra')
870 if fs_search_path_extra != ''
871 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
873 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
875 systemdsystemunitdir = ''
877 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
880 sysvinit = get_option('sysvinit').enabled()
881 sysvinitrcdir = sysconfdir + '/init.d'
883 program_tests = get_option('program-tests')
885 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
886 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
888 have = get_option('chsh-only-listed')
889 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
891 have = get_option('use-tty-group')
892 conf.set('USE_TTY_GROUP', have ? 1 : false)
894 bison = find_program('bison')
895 flex = find_program('flex')
897 build_hwclock = not get_option('build-hwclock').disabled()
898 bison_gen = generator(
900 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
901 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
903 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
904 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
908 configuration : conf)
910 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
915 '-Waddress-of-packed-member',
916 '-Wdiscarded-qualifiers',
917 '-Wembedded-directive',
920 '-Wimplicit-function-declaration',
921 '-Wmissing-declarations',
922 '-Wmissing-parameter-type',
923 '-Wmissing-prototypes',
925 '-Wno-missing-field-initializers',
926 '-Wold-style-definition',
930 '-Wstrict-prototypes',
933 '-Wunused-but-set-parameter',
934 '-Wunused-but-set-variable',
935 '-Wunused-parameter',
941 foreach compiler_flag : compiler_flags
942 if cc.has_argument(compiler_flag)
943 add_project_arguments(compiler_flag, language : 'c')
951 bashcompletionslinks = {}
957 subdir('libsmartcols')
959 subdir('liblastlog2')
961 subdir('pam_lastlog2')
962 subdir('login-utils')
970 includes = [dir_include,
981 opt = not get_option('build-chfn-chsh').disabled()
986 include_directories : includes,
987 link_with : [lib_common, logindefs_c],
988 dependencies : chfn_chsh_deps,
989 install_dir : usrbin_exec_dir,
990 install_mode : 'rwsr-xr-x',
992 build_by_default : opt)
996 'login-utils/chsh.c',
999 include_directories : includes,
1000 link_with : lib_common,
1001 dependencies : chfn_chsh_deps,
1002 install_dir : usrbin_exec_dir,
1003 install_mode : 'rwsr-xr-x',
1005 build_by_default : opt)
1006 if opt and not is_disabler(exe)
1008 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1009 bashcompletions += ['chfn', 'chsh']
1014 test_islocal_sources,
1015 include_directories : includes,
1016 c_args : '-DTEST_PROGRAM',
1017 build_by_default : program_tests)
1022 test_consoles_sources,
1023 c_args : ['-DTEST_PROGRAM'],
1024 include_directories : includes,
1025 link_with : lib_common,
1026 build_by_default : program_tests)
1029 opt = not get_option('build-last').disabled()
1033 include_directories : includes,
1034 link_with : [lib_common],
1035 install_dir : usrbin_exec_dir,
1037 build_by_default : opt)
1038 if opt and not is_disabler(exe)
1040 meson.add_install_script(meson_make_symlink,
1042 join_paths(usrbin_exec_dir, 'lastb'))
1043 manadocs += ['login-utils/last.1.adoc']
1044 manlinks += {'lastb.1': 'last.1'}
1045 bashcompletions += ['last']
1046 bashcompletionslinks += {'lastb': 'last'}
1049 opt = not get_option('build-nologin').disabled()
1052 'login-utils/nologin.c',
1053 include_directories : includes,
1054 install_dir : sbindir,
1055 link_with : [lib_common],
1057 build_by_default : opt)
1058 if opt and not is_disabler(exe)
1060 manadocs += ['login-utils/nologin.8.adoc']
1063 opt = not get_option('build-utmpdump').disabled()
1066 'login-utils/utmpdump.c',
1067 include_directories : includes,
1068 link_with : [lib_common],
1069 install_dir : usrbin_exec_dir,
1071 build_by_default : opt)
1072 if opt and not is_disabler(exe)
1074 manadocs += ['login-utils/utmpdump.1.adoc']
1075 bashcompletions += ['utmpdump']
1078 opt = not get_option('build-su').disabled()
1082 'login-utils/su-common.c',
1083 'login-utils/su-common.h',
1087 include_directories : includes,
1088 link_with : [lib_common, logindefs_c],
1089 dependencies : [lib_pam,
1093 install_mode : 'rwsr-xr-x',
1095 build_by_default : opt)
1096 if opt and not is_disabler(exe)
1098 manadocs += ['login-utils/su.1.adoc']
1099 bashcompletions += ['su']
1102 opt = not get_option('build-newgrp').disabled()
1105 'login-utils/newgrp.c',
1106 include_directories : includes,
1107 dependencies : [lib_crypt],
1108 install_dir : usrbin_exec_dir,
1109 install_mode : 'rwsr-xr-x',
1111 build_by_default : opt)
1112 if opt and not is_disabler(exe)
1114 manadocs += ['login-utils/newgrp.1.adoc']
1115 bashcompletions += ['newgrp']
1118 opt = not get_option('build-lslogins').disabled()
1121 'login-utils/lslogins.c',
1122 include_directories : includes,
1123 link_with : [lib_common,
1126 (build_liblastlog2 ? [lib_lastlog2] : []),
1127 dependencies : [lib_selinux,
1129 install_dir : usrbin_exec_dir,
1131 build_by_default : opt)
1132 if opt and not is_disabler(exe)
1134 manadocs += ['login-utils/lslogins.1.adoc']
1135 bashcompletions += ['lslogins']
1138 opt = not get_option('build-vipw').disabled()
1141 'login-utils/vipw.c',
1142 'login-utils/setpwnam.h',
1143 include_directories : includes,
1144 link_with : [lib_common],
1145 dependencies : [lib_selinux],
1146 install_dir : usrbin_exec_dir,
1148 build_by_default : opt)
1149 if opt and not is_disabler(exe)
1151 meson.add_install_script(meson_make_symlink,
1153 join_paths(usrbin_exec_dir, 'vigr'))
1154 manadocs += ['login-utils/vipw.8.adoc']
1155 meson.add_install_script(meson_make_symlink,
1157 join_paths(mandir, 'man8/vigr.8'))
1160 opt = not get_option('build-runuser').disabled()
1163 'login-utils/runuser.c',
1164 'login-utils/su-common.c',
1165 'login-utils/su-common.h',
1169 include_directories : includes,
1170 link_with : [lib_common, logindefs_c],
1171 dependencies : [lib_pam,
1175 install_dir : sbindir,
1177 build_by_default : opt)
1178 if opt and not is_disabler(exe)
1180 manadocs += ['login-utils/runuser.1.adoc']
1181 bashcompletionslinks += {'runuser': 'su'}
1184 ############################################################
1190 include_directories : includes,
1191 link_with : lib_common,
1192 install_dir : usrbin_exec_dir,
1195 manadocs += ['text-utils/col.1.adoc']
1196 bashcompletions += ['col']
1202 include_directories : includes,
1203 install_dir : usrbin_exec_dir,
1206 manadocs += ['text-utils/colcrt.1.adoc']
1207 bashcompletions += ['colcrt']
1212 include_directories : includes,
1213 link_with : lib_common,
1214 install_dir : usrbin_exec_dir,
1217 manadocs += ['text-utils/colrm.1.adoc']
1218 bashcompletions += ['colrm']
1223 include_directories : includes,
1224 install_dir : usrbin_exec_dir,
1227 manadocs += ['text-utils/rev.1.adoc']
1228 bashcompletions += ['rev']
1233 include_directories : includes,
1234 link_with : [lib_common,
1236 install_dir : usrbin_exec_dir,
1238 if not is_disabler(exe)
1240 manadocs += ['text-utils/column.1.adoc']
1241 bashcompletions += ['column']
1244 opt = not get_option('build-line').disabled()
1248 include_directories : includes,
1249 install_dir : usrbin_exec_dir,
1251 build_by_default : opt)
1252 if opt and not is_disabler(exe)
1254 manadocs += ['text-utils/line.1.adoc']
1257 opt = not get_option('build-pg').disabled()
1261 link_with : lib_common,
1262 include_directories : includes,
1263 dependencies : [lib_tinfo,
1265 install_dir : usrbin_exec_dir,
1267 build_by_default : opt)
1268 if opt and not is_disabler(exe)
1270 manadocs += ['text-utils/pg.1.adoc']
1271 bashcompletions += ['pg']
1274 opt = not get_option('build-ul').disabled()
1278 include_directories : includes,
1279 dependencies : [lib_tinfo,
1281 install_dir : usrbin_exec_dir,
1283 build_by_default : opt)
1284 if opt and not is_disabler(exe)
1286 manadocs += ['text-utils/ul.1.adoc']
1287 bashcompletions += ['ul']
1290 opt = not get_option('build-more').disabled()
1294 link_with : [lib_common],
1295 include_directories : includes,
1296 dependencies : [lib_tinfo,
1300 build_by_default : opt)
1304 link_with : [lib_common],
1305 include_directories : includes,
1306 c_args : '-DTEST_PROGRAM',
1307 dependencies : [lib_tinfo,
1310 build_by_default : opt and program_tests)
1312 if opt and not is_disabler(exe)
1314 manadocs += ['text-utils/more.1.adoc']
1315 bashcompletions += ['more']
1321 include_directories : includes,
1322 link_with : [lib_common,
1324 install_dir : usrbin_exec_dir,
1326 if not is_disabler(exe)
1328 manadocs += ['text-utils/hexdump.1.adoc']
1329 bashcompletions += ['hexdump']
1332 opt = not get_option('build-lsmem').disabled()
1336 include_directories : includes,
1337 link_with : [lib_common,
1339 install_dir : usrbin_exec_dir,
1341 build_by_default : opt)
1342 if opt and not is_disabler(exe)
1344 manadocs += ['sys-utils/lsmem.1.adoc']
1345 bashcompletions += ['lsmem']
1348 opt = not get_option('build-chmem').disabled()
1352 include_directories : includes,
1353 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/chmem.8.adoc']
1360 bashcompletions += ['chmem']
1366 include_directories : includes,
1367 link_with : [lib_common],
1368 install_dir : usrbin_exec_dir,
1371 manadocs += ['sys-utils/choom.1.adoc']
1376 include_directories : includes,
1377 link_with : [lib_common],
1378 install_dir : usrbin_exec_dir,
1381 manadocs += ['sys-utils/ipcmk.1.adoc']
1382 bashcompletions += ['ipcmk']
1387 include_directories : includes,
1388 link_with : [lib_common],
1389 install_dir : usrbin_exec_dir,
1392 manadocs += ['sys-utils/ipcrm.1.adoc']
1393 bashcompletions += ['ipcrm']
1395 opt = not get_option('build-ipcs').disabled()
1399 include_directories : includes,
1400 link_with : [lib_common],
1401 install_dir : usrbin_exec_dir,
1403 build_by_default : opt)
1404 if opt and not is_disabler(exe)
1406 manadocs += ['sys-utils/ipcs.1.adoc']
1407 bashcompletions += ['ipcs']
1410 opt = not get_option('build-rfkill').disabled()
1414 include_directories : includes,
1415 link_with : [lib_common,
1417 install_dir : usrsbin_exec_dir,
1419 build_by_default : opt)
1420 if opt and not is_disabler(exe)
1422 manadocs += ['sys-utils/rfkill.8.adoc']
1423 bashcompletions += ['rfkill']
1429 include_directories : includes,
1430 link_with : [lib_common,
1432 install_dir : usrbin_exec_dir,
1434 if not is_disabler(exe)
1436 manadocs += ['sys-utils/renice.1.adoc']
1437 bashcompletions += ['renice']
1443 include_directories: includes,
1444 link_with : [lib_common,
1446 install_dir : usrbin_exec_dir,
1448 if opt and not is_disabler(exe)
1450 manadocs += ['sys-utils/setpgid.1.adoc']
1451 bashcompletions += ['setpgid']
1457 include_directories : includes,
1458 link_with : [lib_common,
1460 install_dir : usrbin_exec_dir,
1462 if opt and not is_disabler(exe)
1464 manadocs += ['sys-utils/setsid.1.adoc']
1465 bashcompletions += ['setsid']
1470 readprofile_sources,
1471 include_directories : includes,
1472 link_with : [lib_common,
1474 install_dir : usrsbin_exec_dir,
1476 if not is_disabler(exe)
1478 manadocs += ['sys-utils/readprofile.8.adoc']
1479 bashcompletions += ['readprofile']
1482 opt = not get_option('build-tunelp').disabled()
1486 include_directories : includes,
1487 link_with : [lib_common],
1488 install_dir : usrsbin_exec_dir,
1490 build_by_default : opt)
1491 if opt and not is_disabler(exe)
1493 manadocs += ['sys-utils/tunelp.8.adoc']
1494 bashcompletions += ['tunelp']
1500 include_directories : includes,
1501 link_with : [lib_common,
1503 install_dir : sbindir,
1505 if not is_disabler(exe)
1507 manadocs += ['sys-utils/fstrim.8.adoc']
1508 bashcompletions += ['fstrim']
1514 include_directories : includes,
1515 link_with : [lib_common,
1518 if not is_disabler(exe)
1520 manadocs += ['sys-utils/dmesg.1.adoc']
1521 bashcompletions += ['dmesg']
1527 include_directories : dir_include,
1528 c_args : '-DTEST_DMESG',
1529 link_with : [lib_common,
1531 build_by_default : program_tests)
1532 if not is_disabler(exe)
1539 include_directories : includes,
1540 link_with : [lib_common],
1541 install_dir : sbindir,
1544 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1545 bashcompletions += ['ctrlaltdel']
1550 include_directories : includes,
1551 install_dir : sbindir,
1554 manadocs += ['sys-utils/fsfreeze.8.adoc']
1555 bashcompletions += ['fsfreeze']
1560 include_directories : includes,
1561 link_with : [lib_common,
1563 install_dir : sbindir,
1566 manadocs += ['sys-utils/blkdiscard.8.adoc']
1567 bashcompletions += ['blkdiscard']
1569 if cc.has_header('linux/blkzoned.h')
1573 include_directories : includes,
1574 link_with : [lib_common],
1575 install_dir : sbindir,
1578 manadocs += ['sys-utils/blkzone.8.adoc']
1579 bashcompletions += ['blkzone']
1582 if cc.has_header('linux/pr.h')
1586 include_directories : includes,
1587 link_with : [lib_common],
1588 install_dir : sbindir,
1591 manadocs += ['sys-utils/blkpr.8.adoc']
1597 include_directories : includes,
1598 link_with : [lib_common],
1599 install_dir : usrsbin_exec_dir,
1602 manadocs += ['sys-utils/ldattach.8.adoc']
1603 bashcompletions += ['ldattach']
1608 include_directories : includes,
1609 link_with : [lib_common],
1610 install_dir : usrsbin_exec_dir,
1613 manadocs += ['sys-utils/rtcwake.8.adoc']
1614 bashcompletions += ['rtcwake']
1619 include_directories : includes,
1620 link_with : [lib_common],
1621 install_dir : usrbin_exec_dir,
1624 manadocs += ['sys-utils/setarch.8.adoc']
1625 bashcompletions += ['setarch']
1627 setarch_links = ['uname26', 'linux32', 'linux64']
1628 setarch_links_arch = {
1629 's390x' : ['s390', 's390x'],
1631 'x86_64' : ['i386', 'x86_64'],
1632 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1633 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1634 'mips64' : ['mips', 'mips64', 'mips32'],
1635 'ia64' : ['i386', 'ia64'],
1636 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1638 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1640 foreach link: setarch_links
1641 meson.add_install_script(meson_make_symlink,
1643 join_paths(usrbin_exec_dir, link))
1644 manlinks += {link + '.8': 'setarch.8'}
1647 opt = not get_option('build-eject').disabled()
1651 include_directories : includes,
1652 link_with : [lib_common,
1654 install_dir : usrbin_exec_dir,
1656 build_by_default : opt)
1657 if opt and not is_disabler(exe)
1659 manadocs += ['sys-utils/eject.1.adoc']
1660 bashcompletions += ['eject']
1663 opt = not get_option('build-losetup').disabled()
1667 include_directories : includes,
1668 link_with : [lib_common,
1670 install_dir : sbindir,
1672 build_by_default : opt)
1673 if opt and not is_disabler(exe)
1674 manadocs += ['sys-utils/losetup.8.adoc']
1676 bashcompletions += ['losetup']
1679 opt = opt and 'losetup' in static_programs
1683 include_directories : includes,
1684 link_args : ['--static'],
1685 link_with : [lib_common,
1686 lib_smartcols.get_static_lib()],
1687 install_dir : sbindir,
1689 build_by_default : opt)
1690 if opt and not is_disabler(exe)
1694 opt = not get_option('build-zramctl').disabled()
1698 include_directories : includes,
1699 link_with : [lib_common,
1701 install_dir : sbindir,
1703 build_by_default : opt)
1704 if opt and not is_disabler(exe)
1706 manadocs += ['sys-utils/zramctl.8.adoc']
1707 bashcompletions += ['zramctl']
1713 include_directories : includes,
1714 link_with : [lib_common,
1716 install_dir : usrbin_exec_dir,
1718 if not is_disabler(exe)
1720 manadocs += ['sys-utils/prlimit.1.adoc']
1721 bashcompletions += ['prlimit']
1727 include_directories : includes,
1728 link_with : [lib_common,
1731 install_dir : usrbin_exec_dir,
1733 if not is_disabler(exe)
1735 manadocs += ['sys-utils/lsns.8.adoc']
1736 bashcompletions += ['lsns']
1739 opt = not get_option('build-mount').disabled()
1743 include_directories : includes,
1744 link_with : [lib_common,
1747 dependencies : lib_selinux,
1748 install_mode : 'rwsr-xr-x',
1750 build_by_default : opt)
1754 include_directories : includes,
1755 link_with : [lib_common,
1757 install_mode : 'rwsr-xr-x',
1759 build_by_default : opt)
1760 if opt and not is_disabler(exe)
1762 manadocs += ['sys-utils/fstab.5.adoc',
1763 'sys-utils/mount.8.adoc',
1764 'sys-utils/umount.8.adoc']
1765 bashcompletions += ['mount', 'umount']
1768 opt2 = opt and 'mount' in static_programs
1772 include_directories : includes,
1773 link_args : ['--static'],
1774 link_with : [lib_common,
1775 lib_smartcols_static,
1778 build_by_default : opt2)
1779 if opt2 and not is_disabler(exe)
1783 opt2 = opt and 'umount' in static_programs
1787 include_directories : includes,
1788 link_args : ['--static'],
1789 link_with : [lib_common,
1792 build_by_default : opt2)
1793 if opt2 and not is_disabler(exe)
1802 include_directories : includes,
1803 link_with : [lib_common,
1807 install_dir : sbindir,
1809 if not is_disabler(exe)
1811 manadocs += ['sys-utils/swapon.8.adoc']
1812 bashcompletions += ['swapon']
1818 include_directories : includes,
1819 link_with : [lib_common,
1822 install_dir : sbindir,
1824 if not is_disabler(exe)
1826 manlinks += {'swapoff.8': 'swapon.8'}
1827 bashcompletions += ['swapoff']
1833 include_directories : includes,
1834 link_with : [lib_common,
1836 dependencies : [rtas_libs],
1837 install_dir : usrbin_exec_dir,
1839 if not is_disabler(exe)
1841 manadocs += ['sys-utils/lscpu.1.adoc']
1842 bashcompletions += ['lscpu']
1848 include_directories : includes,
1849 link_with : [lib_common],
1850 install_dir : sbindir,
1853 manadocs += ['sys-utils/chcpu.8.adoc']
1854 bashcompletions += ['chcpu']
1859 include_directories : includes,
1860 link_with : [lib_common,
1863 if not is_disabler(exe)
1865 manadocs += ['sys-utils/wdctl.8.adoc']
1866 bashcompletions += ['wdctl']
1869 opt = not get_option('build-mountpoint').disabled()
1873 include_directories : includes,
1874 link_with : [lib_mount],
1876 build_by_default : opt)
1877 if opt and not is_disabler(exe)
1879 manadocs += ['sys-utils/mountpoint.1.adoc']
1880 bashcompletions += ['mountpoint']
1883 opt = not get_option('build-fallocate').disabled()
1887 include_directories : includes,
1888 link_with : [lib_common],
1889 install_dir : usrbin_exec_dir,
1891 build_by_default : opt)
1892 if opt and not is_disabler(exe)
1894 manadocs += ['sys-utils/fallocate.1.adoc']
1895 bashcompletions += ['fallocate']
1898 opt = not get_option('build-pivot_root').disabled()
1902 include_directories : includes,
1903 install_dir : sbindir,
1905 build_by_default : opt)
1906 if opt and not is_disabler(exe)
1908 manadocs += ['sys-utils/pivot_root.8.adoc']
1909 bashcompletions += ['pivot_root']
1912 opt = not get_option('build-switch_root').disabled()
1913 if opt and not have_dirfd and not have_ddfd
1914 error('neither dirfd nor ddfd are available')
1918 switch_root_sources,
1919 include_directories : includes,
1920 install_dir : sbindir,
1922 build_by_default : opt)
1923 if opt and not is_disabler(exe)
1925 manadocs += ['sys-utils/switch_root.8.adoc']
1928 opt = not get_option('build-unshare').disabled()
1932 include_directories : includes,
1933 link_with : [lib_common],
1934 install_dir : usrbin_exec_dir,
1936 build_by_default : opt)
1937 if opt and not is_disabler(exe)
1939 manadocs += ['sys-utils/unshare.1.adoc']
1940 bashcompletions += ['unshare']
1943 opt = opt and 'unshare' in static_programs
1947 include_directories : includes,
1948 link_with : [lib_common],
1949 install_dir : usrbin_exec_dir,
1951 build_by_default : opt)
1952 if opt and not is_disabler(exe)
1956 opt = not get_option('build-nsenter').disabled()
1960 include_directories : includes,
1961 link_with : [lib_common],
1962 dependencies : [lib_selinux],
1963 install_dir : usrbin_exec_dir,
1965 build_by_default : opt)
1966 if opt and not is_disabler(exe)
1968 manadocs += ['sys-utils/nsenter.1.adoc']
1969 bashcompletions += ['nsenter']
1972 opt = opt and 'nsenter' in static_programs
1976 include_directories : includes,
1977 link_with : [lib_common],
1978 dependencies : [lib_selinux],
1979 install_dir : usrbin_exec_dir,
1981 build_by_default : opt)
1982 if opt and not is_disabler(exe)
1986 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1990 include_directories : includes,
1991 link_with : [lib_common],
1992 dependencies : [lib_cap_ng],
1993 install_dir : usrbin_exec_dir,
1995 build_by_default : opt)
1996 if opt and not is_disabler(exe)
1998 manadocs += ['sys-utils/setpriv.1.adoc']
1999 bashcompletions += ['setpriv']
2005 include_directories : includes,
2006 link_with : [lib_common],
2007 dependencies : realtime_libs,
2008 install_dir : usrbin_exec_dir,
2011 manadocs += ['sys-utils/flock.1.adoc']
2012 bashcompletions += ['flock']
2014 opt = not get_option('build-lsirq').disabled()
2018 include_directories : includes,
2019 link_with : [lib_common,
2021 install_dir : usrbin_exec_dir,
2023 build_by_default : opt)
2024 if opt and not is_disabler(exe)
2026 manadocs += ['sys-utils/lsirq.1.adoc']
2027 bashcompletions += ['lsirq']
2030 opt = not get_option('build-irqtop').disabled()
2034 include_directories : includes,
2035 dependencies : [realtime_libs, curses_libs],
2036 link_with : [lib_common,
2039 install_dir : usrbin_exec_dir,
2041 build_by_default : opt)
2042 if opt and not is_disabler(exe)
2044 manadocs += ['sys-utils/irqtop.1.adoc']
2045 bashcompletions += ['irqtop']
2048 opt = not get_option('build-ipcs').disabled()
2052 include_directories : includes,
2053 link_with : [lib_common,
2055 install_dir : usrbin_exec_dir,
2057 build_by_default : opt)
2058 if opt and not is_disabler(exe)
2060 manadocs += ['sys-utils/lsipc.1.adoc']
2061 bashcompletions += ['lsipc']
2068 include_directories : includes,
2069 link_with : [lib_common],
2070 dependencies : [lib_m,
2072 install_dir : sbindir,
2074 build_by_default : opt)
2075 if opt and not is_disabler(exe)
2077 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2078 bashcompletions += ['hwclock']
2084 include_directories : includes,
2085 install_dir : sbindir,
2088 manadocs += ['disk-utils/mkfs.8.adoc']
2089 bashcompletions += ['mkfs']
2091 opt = not get_option('build-bfs').disabled()
2095 include_directories : includes,
2096 link_with : [lib_common],
2097 install_dir : sbindir,
2099 build_by_default : opt)
2100 if opt and not is_disabler(exe)
2102 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2103 bashcompletions += ['mkfs.bfs']
2109 include_directories : includes,
2110 link_with : [lib_common],
2111 install_dir : usrbin_exec_dir,
2114 manadocs += ['disk-utils/isosize.8.adoc']
2115 bashcompletions += ['isosize']
2120 include_directories : includes,
2121 link_with : [lib_common,
2124 dependencies: [lib_selinux],
2125 install_dir : sbindir,
2127 if not is_disabler(exe)
2129 manadocs += ['disk-utils/mkswap.8.adoc']
2130 bashcompletions += ['mkswap']
2136 include_directories : includes,
2137 link_with : [lib_common,
2140 install_dir : sbindir,
2142 if not is_disabler(exe)
2144 manadocs += ['disk-utils/swaplabel.8.adoc']
2145 bashcompletions += ['swaplabel']
2148 opt = not get_option('build-fsck').disabled()
2152 include_directories : includes,
2153 link_with : [lib_common,
2156 dependencies : realtime_libs,
2157 install_dir : sbindir,
2159 build_by_default : opt)
2160 if opt and not is_disabler(exe)
2162 manadocs += ['disk-utils/fsck.8.adoc']
2163 bashcompletions += ['fsck']
2166 opt = not get_option('build-minix').disabled()
2170 include_directories : includes,
2171 link_with : [lib_common],
2172 install_dir : sbindir,
2174 build_by_default : opt)
2178 include_directories : includes,
2179 c_args : '-DTEST_SCRIPT',
2180 link_with : [lib_common],
2181 build_by_default : opt and program_tests)
2185 include_directories : includes,
2186 link_with : [lib_common],
2187 install_dir : sbindir,
2189 build_by_default : opt)
2190 if opt and not is_disabler(exe)
2191 exes += [exe, exe2, exe3]
2192 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2193 bashcompletions += ['mkfs.minix', 'fsck.minix']
2196 opt = not get_option('build-cramfs').disabled()
2199 mkfs_cramfs_sources,
2200 include_directories : includes,
2201 link_with : [lib_common],
2202 dependencies : [lib_z],
2203 install_dir : sbindir,
2205 build_by_default : opt)
2208 fsck_cramfs_sources,
2209 include_directories : includes,
2210 link_with : [lib_common],
2211 dependencies : [lib_z],
2212 install_dir : sbindir,
2214 build_by_default : opt)
2215 if not is_disabler(exe)
2217 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2218 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2221 opt = not get_option('build-raw').disabled()
2223 cc.has_header('linux/raw.h', required: opt)
2228 include_directories : includes,
2229 install_dir : sbindir,
2231 build_by_default : opt)
2232 if opt and not is_disabler(exe)
2234 manadocs += ['disk-utils/raw.8.adoc']
2235 bashcompletions += ['raw']
2238 opt = not get_option('build-fdformat').disabled()
2242 include_directories : includes,
2243 link_with : [lib_common],
2244 install_dir : usrsbin_exec_dir,
2246 build_by_default : opt)
2247 if opt and not is_disabler(exe)
2249 manadocs += ['disk-utils/fdformat.8.adoc']
2250 bashcompletions += ['fdformat']
2256 include_directories : includes,
2257 link_with : [lib_common],
2258 install_dir : sbindir,
2260 manadocs += ['disk-utils/blockdev.8.adoc']
2261 bashcompletions += ['blockdev']
2263 opt = not get_option('build-fdisks').disabled()
2264 if opt and not have_dirfd and not have_ddfd
2265 error('neither dirfd nor ddfd are available')
2270 include_directories : includes,
2271 link_with : [lib_common,
2275 dependencies : [lib_readline],
2276 install_dir : sbindir,
2278 build_by_default : opt)
2279 if opt and not is_disabler(exe)
2281 bashcompletions += ['fdisk']
2284 opt2 = opt and 'fdisk' in static_programs
2288 link_args : ['--static'],
2289 include_directories : includes,
2290 link_with : [lib_common,
2293 lib_smartcols.get_static_lib()],
2294 dependencies : [lib_readline_static],
2295 install_dir : sbindir,
2297 build_by_default : opt2)
2298 if opt2 and not is_disabler(exe)
2305 include_directories : includes,
2306 link_with : [lib_common,
2310 dependencies : [lib_readline],
2311 install_dir : sbindir,
2313 build_by_default : opt)
2314 if opt and not is_disabler(exe)
2316 bashcompletions += ['sfdisk']
2319 opt2 = opt and 'sfdisk' in static_programs
2323 include_directories : includes,
2324 link_with : [lib_common,
2327 lib_smartcols.get_static_lib()],
2328 dependencies : [lib_readline_static],
2329 install_dir : sbindir,
2331 build_by_default : opt2)
2332 if opt2 and not is_disabler(exe)
2339 include_directories : includes,
2340 link_with : [lib_common,
2345 dependencies : [curses_libs],
2346 install_dir : sbindir,
2348 build_by_default : opt)
2349 if opt and not is_disabler(exe)
2351 manadocs += ['disk-utils/fdisk.8.adoc',
2352 'disk-utils/sfdisk.8.adoc',
2353 'disk-utils/cfdisk.8.adoc']
2354 bashcompletions += ['cfdisk']
2357 opt = not get_option('build-partx').disabled()
2361 include_directories : includes,
2362 link_with : [lib_common],
2363 install_dir : usrsbin_exec_dir,
2365 build_by_default : opt)
2369 include_directories : includes,
2370 link_with : [lib_common],
2371 install_dir : usrsbin_exec_dir,
2373 build_by_default : opt)
2377 include_directories : includes,
2378 link_with : [lib_common],
2379 install_dir : usrsbin_exec_dir,
2381 build_by_default : opt)
2385 include_directories : includes,
2386 link_with : [lib_common,
2389 install_dir : usrsbin_exec_dir,
2391 build_by_default : opt)
2393 exes += [exe, exe2, exe3, exe4]
2394 manadocs += ['disk-utils/addpart.8.adoc',
2395 'disk-utils/delpart.8.adoc',
2396 'disk-utils/resizepart.8.adoc',
2397 'disk-utils/partx.8.adoc']
2398 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2400 opt = opt and 'partx' in static_programs
2404 include_directories : includes,
2405 link_args : ['--static'],
2406 link_with : [lib_common],
2407 install_dir : usrsbin_exec_dir,
2409 build_by_default : opt)
2413 include_directories : includes,
2414 link_args : ['--static'],
2415 link_with : [lib_common],
2416 install_dir : usrsbin_exec_dir,
2418 build_by_default : opt)
2420 'resizepart.static',
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 lib_blkid.get_static_lib(),
2435 lib_smartcols.get_static_lib()],
2436 install_dir : usrsbin_exec_dir,
2438 build_by_default : opt)
2441 exes += [exe, exe2, exe3, exe4]
2444 ############################################################
2449 include_directories : includes,
2450 link_with : [lib_common],
2451 dependencies : [lib_util,
2455 install_dir : usrbin_exec_dir,
2458 manadocs += ['term-utils/script.1.adoc']
2459 bashcompletions += ['script']
2464 include_directories : includes,
2465 c_args : '-DTEST_SCRIPT',
2466 link_with : [lib_common],
2467 dependencies : [lib_util,
2471 build_by_default : program_tests)
2477 include_directories : includes,
2478 link_with : [lib_common],
2479 dependencies : [lib_util,
2482 install_dir : usrbin_exec_dir,
2485 manadocs += ['term-utils/scriptlive.1.adoc']
2486 bashcompletions += ['scriptlive']
2490 scriptreplay_sources,
2491 include_directories : includes,
2492 link_with : [lib_common],
2493 dependencies : [math_libs],
2494 install_dir : usrbin_exec_dir,
2497 manadocs += ['term-utils/scriptreplay.1.adoc']
2498 bashcompletions += ['scriptreplay']
2500 opt = not get_option('build-agetty').disabled()
2504 include_directories : includes,
2505 link_with : [lib_common, logindefs_c],
2506 dependencies : [BSD ? lib_util : [], lib_systemd],
2507 install_dir : sbindir,
2509 build_by_default : opt)
2512 manadocs += ['term-utils/agetty.8.adoc']
2515 opt = not get_option('build-setterm').disabled()
2519 include_directories : includes,
2520 link_with : [lib_common],
2521 dependencies : [curses_libs],
2522 install_dir : usrbin_exec_dir,
2524 build_by_default : opt)
2527 manadocs += ['term-utils/setterm.1.adoc']
2528 bashcompletions += ['setterm']
2531 opt = not get_option('build-mesg').disabled()
2535 include_directories : includes,
2536 link_with : [lib_common],
2537 install_dir : usrbin_exec_dir,
2539 build_by_default : opt)
2542 manadocs += ['term-utils/mesg.1.adoc']
2543 bashcompletions += ['mesg']
2546 opt = not get_option('build-wall').disabled()
2550 include_directories : includes,
2551 link_with : [lib_common],
2552 dependencies : [lib_systemd],
2553 install_dir : usrbin_exec_dir,
2554 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2556 build_by_default : opt)
2559 manadocs += ['term-utils/wall.1.adoc']
2560 bashcompletions += ['wall']
2563 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2564 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2566 opt = not get_option('build-write').disabled()
2570 include_directories : includes,
2571 link_with : [lib_common],
2572 dependencies : [lib_systemd],
2573 install_dir : usrbin_exec_dir,
2574 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2576 build_by_default : opt)
2579 manadocs += ['term-utils/write.1.adoc']
2580 bashcompletions += ['write']
2583 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2584 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2586 opt = not get_option('build-login').disabled()
2590 include_directories : includes,
2591 link_with : [lib_common, logindefs_c],
2592 dependencies : [lib_pam,
2596 build_by_default : opt)
2597 if not is_disabler(exe)
2599 manadocs += ['login-utils/login.1.adoc']
2602 opt = not get_option('build-sulogin').disabled()
2606 include_directories : includes,
2607 link_with : [lib_common],
2608 dependencies : [lib_crypt,
2610 install_dir : sbindir,
2612 build_by_default : opt)
2613 if not is_disabler(exe)
2615 manadocs += ['login-utils/sulogin.8.adoc']
2621 include_directories : includes,
2622 link_with : [lib_common,
2624 dependencies : [curses_libs],
2625 install_dir : usrbin_exec_dir,
2628 manadocs += ['misc-utils/cal.1.adoc']
2629 bashcompletions += ['cal']
2631 opt = not get_option('build-logger').disabled()
2635 include_directories : includes,
2636 link_with : [lib_common],
2637 dependencies : [lib_systemd],
2638 install_dir : usrbin_exec_dir,
2640 build_by_default : opt)
2641 if opt and not is_disabler(exe)
2643 manadocs += ['misc-utils/logger.1.adoc']
2644 bashcompletions += ['logger']
2650 include_directories : includes,
2651 c_args : '-DTEST_LOGGER',
2652 link_with : [lib_common],
2653 dependencies : [lib_systemd],
2654 build_by_default: program_tests)
2655 if not is_disabler(exe)
2662 include_directories : includes,
2663 install_dir : usrbin_exec_dir,
2666 manadocs += ['misc-utils/look.1.adoc']
2667 bashcompletions += ['look']
2672 include_directories : includes,
2673 link_with : [lib_common],
2674 install_dir : usrbin_exec_dir,
2677 manadocs += ['misc-utils/mcookie.1.adoc']
2678 bashcompletions += ['mcookie']
2680 if build_liblastlog2
2684 include_directories : includes,
2685 link_with : [lib_common, lib_lastlog2],
2686 install_dir : usrbin_exec_dir,
2689 manadocs += ['misc-utils/lastlog2.8.adoc']
2690 bashcompletions += ['lastlog2']
2691 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2692 'liblastlog2/man/ll2_write_entry.3.adoc',
2693 'liblastlog2/man/ll2_read_entry.3.adoc',
2694 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2695 'liblastlog2/man/ll2_read_all.3.adoc',
2696 'liblastlog2/man/ll2_remove_entry.3.adoc',
2697 'liblastlog2/man/ll2_rename_user.3.adoc',
2698 'liblastlog2/man/ll2_update_login_time.3.adoc'
2705 include_directories : includes,
2706 dependencies : [lib_selinux],
2707 install_dir : usrbin_exec_dir,
2710 manadocs += ['misc-utils/namei.1.adoc']
2711 bashcompletions += ['namei']
2716 include_directories : includes,
2717 link_with : [lib_common],
2718 install_dir : usrbin_exec_dir,
2721 manadocs += ['misc-utils/whereis.1.adoc']
2722 bashcompletions += ['whereis']
2727 include_directories : includes,
2728 link_with : [lib_common,
2731 install_dir : usrbin_exec_dir,
2733 if not is_disabler(exe)
2735 manadocs += ['misc-utils/lslocks.8.adoc']
2736 bashcompletions += ['lslocks']
2742 include_directories : includes,
2743 link_with : [lib_common,
2748 dependencies : lib_udev,
2750 if not is_disabler(exe)
2752 manadocs += ['misc-utils/lsblk.8.adoc']
2753 bashcompletions += ['lsblk']
2756 errnos_h = custom_target('errnos.h',
2757 input : 'tools/all_errnos',
2758 output : 'errnos.h',
2759 command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
2763 mq_libs += cc.find_library('rt', required : true)
2767 lsfd_sources, errnos_h,
2768 include_directories : includes,
2769 link_with : [lib_common,
2771 dependencies : mq_libs,
2772 install_dir : usrbin_exec_dir,
2774 if not is_disabler(exe)
2776 manadocs += ['misc-utils/lsfd.1.adoc']
2782 include_directories : includes,
2783 link_with : [lib_common,
2785 install_dir : usrbin_exec_dir,
2787 if not is_disabler(exe)
2789 manadocs += ['misc-utils/uuidgen.1.adoc']
2790 bashcompletions += ['uuidgen']
2796 include_directories : includes,
2797 link_with : [lib_common,
2800 install_dir : usrbin_exec_dir,
2802 if not is_disabler(exe)
2804 manadocs += ['misc-utils/uuidparse.1.adoc']
2805 bashcompletions += ['uuidparse']
2812 include_directories : includes,
2813 link_with : [lib_common,
2815 dependencies : [realtime_libs,
2817 install_dir : usrsbin_exec_dir,
2819 build_by_default : opt)
2823 include_directories : includes,
2824 link_with : [lib_common,
2826 dependencies : thread_libs,
2827 build_by_default : opt and program_tests)
2828 if not is_disabler(exe)
2830 manadocs += ['misc-utils/uuidd.8.adoc']
2831 bashcompletions += ['uuidd']
2834 opt = build_libblkid
2838 include_directories : includes,
2839 link_with : [lib_common,
2841 install_dir : sbindir,
2843 build_by_default : opt)
2844 if opt and not is_disabler(exe)
2846 manadocs += ['misc-utils/blkid.8.adoc']
2847 bashcompletions += ['blkid']
2850 opt = opt and 'blkid' in static_programs
2854 include_directories : includes,
2855 link_with : [lib_common,
2857 install_dir : sbindir,
2859 build_by_default : opt)
2860 if opt and not is_disabler(exe)
2866 'libblkid/samples/mkfs.c',
2867 include_directories : includes,
2868 link_with : lib_blkid)
2869 if not is_disabler(exe)
2874 'sample-partitions',
2875 'libblkid/samples/partitions.c',
2876 include_directories : includes,
2877 link_with : lib_blkid)
2878 if not is_disabler(exe)
2883 'sample-superblocks',
2884 'libblkid/samples/superblocks.c',
2885 include_directories : includes,
2886 link_with : lib_blkid)
2887 if not is_disabler(exe)
2893 'libblkid/samples/topology.c',
2894 include_directories : includes,
2895 link_with : lib_blkid)
2896 if not is_disabler(exe)
2901 'test_blkid_fuzz_sample',
2902 'libblkid/src/fuzz.c',
2903 include_directories: includes,
2904 link_with: lib_blkid,
2905 build_by_default: program_tests)
2906 if not is_disabler(exe)
2910 ############################################################
2915 include_directories : includes,
2916 link_with : [lib_blkid],
2917 install_dir : sbindir,
2919 if not is_disabler(exe)
2921 manadocs += ['misc-utils/findfs.8.adoc']
2922 bashcompletions += ['findfs']
2928 include_directories : includes,
2929 link_with : [lib_common,
2932 install_dir : sbindir,
2934 if not is_disabler(exe)
2936 manadocs += ['misc-utils/wipefs.8.adoc']
2937 bashcompletions += ['wipefs']
2943 include_directories : includes,
2944 link_with : [lib_common,
2948 dependencies : [lib_udev],
2950 if not is_disabler(exe)
2952 manadocs += ['misc-utils/findmnt.8.adoc']
2953 bashcompletions += ['findmnt']
2959 include_directories : includes,
2960 link_with : [lib_common],
2962 if not is_disabler(exe)
2964 manadocs += ['misc-utils/kill.1.adoc']
2967 opt = not get_option('build-rename').disabled()
2971 include_directories : includes,
2972 install_dir : usrbin_exec_dir,
2974 build_by_default : opt)
2975 if opt and not is_disabler(exe)
2977 manadocs += ['misc-utils/rename.1.adoc']
2978 bashcompletions += ['rename']
2984 include_directories : includes,
2985 link_with : [lib_common],
2986 install_dir : usrbin_exec_dir,
2989 manadocs += ['misc-utils/getopt.1.adoc']
2990 bashcompletions += ['getopt']
2995 include_directories : includes,
2996 link_with : [lib_common,
2998 install_dir : usrbin_exec_dir,
3000 if not is_disabler(exe)
3002 manadocs += ['misc-utils/fincore.1.adoc']
3003 bashcompletions += ['fincore']
3009 include_directories : includes,
3010 link_with : [lib_common],
3011 install_dir : usrbin_exec_dir,
3013 if not is_disabler(exe)
3015 manadocs += ['misc-utils/hardlink.1.adoc']
3016 bashcompletions += ['hardlink']
3019 opt = not get_option('build-pipesz').disabled()
3023 include_directories : includes,
3024 link_with : [lib_common],
3025 install_dir : usrbin_exec_dir,
3027 if opt and not is_disabler(exe)
3029 manadocs += ['misc-utils/pipesz.1.adoc']
3030 bashcompletions += ['pipesz']
3036 include_directories : includes,
3037 c_args : '-DTEST_CAL',
3038 link_with : [lib_common,
3040 dependencies : [curses_libs],
3041 build_by_default: program_tests)
3042 if not is_disabler(exe)
3049 include_directories : includes,
3050 link_with : [lib_common],
3051 install_dir : usrbin_exec_dir,
3053 if not is_disabler(exe)
3055 manadocs += ['misc-utils/fadvise.1.adoc']
3056 bashcompletions += ['fadvise']
3059 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3063 include_directories : includes,
3064 link_with : [lib_common],
3065 install_dir : usrbin_exec_dir,
3067 if not is_disabler(exe)
3069 manadocs += ['misc-utils/waitpid.1.adoc']
3070 bashcompletions += ['waitpid']
3074 syscalls_h = custom_target('syscalls.h',
3075 input : 'tools/all_syscalls',
3076 output : 'syscalls.h',
3077 command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
3080 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3083 'misc-utils/enosys.c', syscalls_h, errnos_h,
3084 include_directories : includes,
3085 link_with : [lib_common],
3086 install_dir : usrbin_exec_dir,
3088 if not is_disabler(exe)
3090 manadocs += ['misc-utils/enosys.1.adoc']
3091 bashcompletions += ['enosys']
3098 include_directories : includes,
3099 link_with : [lib_common, lib_smartcols],
3100 install_dir : usrbin_exec_dir,
3102 if not is_disabler(exe)
3104 manadocs += ['misc-utils/lsclocks.1.adoc']
3105 bashcompletions += ['lsclocks']
3108 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3112 include_directories : includes,
3113 link_with : [lib_common],
3114 install_dir : usrbin_exec_dir,
3116 if not is_disabler(exe)
3118 manadocs += ['misc-utils/exch.1.adoc']
3119 bashcompletions += ['exch']
3123 ############################################################
3125 opt = not get_option('build-schedutils').disabled()
3128 'schedutils/chrt.c',
3129 include_directories : includes,
3130 link_with : lib_common,
3131 install_dir : usrbin_exec_dir,
3133 build_by_default : opt)
3137 'schedutils/ionice.c',
3138 include_directories : includes,
3139 link_with : lib_common,
3140 install_dir : usrbin_exec_dir,
3142 build_by_default : opt)
3146 'schedutils/taskset.c',
3147 include_directories : includes,
3148 link_with : lib_common,
3149 install_dir : usrbin_exec_dir,
3151 build_by_default : opt)
3155 'schedutils/uclampset.c',
3156 include_directories : includes,
3157 link_with : lib_common,
3158 install_dir : usrbin_exec_dir,
3160 build_by_default : opt)
3162 if opt and not is_disabler(exe)
3163 exes += [exe, exe2, exe3, exe4]
3164 manadocs += ['schedutils/chrt.1.adoc',
3165 'schedutils/ionice.1.adoc',
3166 'schedutils/taskset.1.adoc',
3167 'schedutils/uclampset.1.adoc']
3168 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3171 ############################################################
3173 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3178 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3179 include_directories : dir_include,
3180 link_with : lib_common,
3181 build_by_default: program_tests)
3187 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3188 include_directories : dir_include,
3189 link_with : lib_common,
3190 build_by_default: program_tests)
3196 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3197 include_directories : dir_include,
3198 link_with : lib_common,
3199 build_by_default: program_tests)
3205 c_args : ['-DTEST_PROGRAM_MANGLE'],
3206 include_directories : dir_include,
3207 build_by_default: program_tests)
3213 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3214 include_directories : dir_include,
3215 build_by_default: program_tests)
3221 'lib/color-names.c',
3222 c_args : ['-DTEST_PROGRAM_COLORS'],
3223 include_directories : dir_include,
3224 link_with : [lib_common, lib_tcolors],
3225 build_by_default: program_tests)
3231 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3232 include_directories : dir_include,
3233 build_by_default: program_tests)
3236 if conf.get('HAVE_OPENAT').to_string() == '1' \
3237 and conf.get('HAVE_DIRFD').to_string() == '1'
3241 c_args : ['-DTEST_PROGRAM_PROCFS'],
3242 include_directories : dir_include,
3243 link_with : lib_common,
3244 build_by_default: program_tests)
3251 have_cpu_set_t ? 'lib/cpuset.c' : [],
3252 c_args : ['-DTEST_PROGRAM_PATH'],
3253 include_directories : dir_include,
3254 link_with : lib_common,
3255 build_by_default: program_tests)
3259 if conf.get('HAVE_PTY').to_string() == '1'
3264 c_args : ['-DTEST_PROGRAM_PTY'],
3265 include_directories : dir_include,
3266 link_with : [lib_common],
3267 dependencies : [lib_m,
3270 build_by_default: program_tests)
3278 c_args : ['-DTEST_PROGRAM_CPUSET'],
3279 include_directories : dir_include,
3280 build_by_default: program_tests)
3291 have_cpu_set_t ? 'lib/cpuset.c' : [],
3292 c_args : ['-DTEST_PROGRAM_SYSFS'],
3293 include_directories : dir_include,
3294 build_by_default: program_tests)
3300 c_args : ['-DTEST_PROGRAM_PAGER'],
3301 include_directories : dir_include,
3302 build_by_default: program_tests)
3306 'test_linux_version',
3307 'lib/linux_version.c',
3308 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3309 include_directories : dir_include,
3310 build_by_default: program_tests)
3316 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3317 include_directories : dir_include,
3318 build_by_default: program_tests)
3322 'test_canonicalize',
3323 'lib/canonicalize.c',
3324 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3325 include_directories : dir_include,
3326 build_by_default: program_tests)
3333 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3334 include_directories : dir_include,
3335 build_by_default: program_tests)
3341 c_args : ['-DTEST_PROGRAM'],
3342 include_directories : dir_include,
3343 link_with : lib_common,
3344 build_by_default: program_tests)
3350 c_args : ['-DTEST_PROGRAM'],
3351 include_directories : dir_include,
3352 link_with : [lib_common, logindefs_c],
3353 build_by_default: program_tests)
3357 ############################################################
3361 'libuuid/src/test_uuid.c',
3362 include_directories : [dir_include, dir_libuuid],
3363 link_with : lib_uuid,
3364 dependencies : socket_libs,
3365 build_by_default: program_tests)
3366 if not is_disabler(exe)
3370 ############################################################
3372 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3373 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3377 'libfdisk/src/ask.c',
3378 c_args : libfdisk_tests_cflags,
3379 include_directories : lib_fdisk_includes,
3380 link_with : libfdisk_tests_ldadd,
3381 build_by_default: program_tests)
3382 if not is_disabler(exe)
3388 'libfdisk/src/gpt.c',
3389 c_args : libfdisk_tests_cflags,
3390 include_directories : lib_fdisk_includes,
3391 link_with : libfdisk_tests_ldadd,
3392 build_by_default: program_tests)
3393 if not is_disabler(exe)
3399 'libfdisk/src/utils.c',
3400 c_args : libfdisk_tests_cflags,
3401 include_directories : lib_fdisk_includes,
3402 link_with : libfdisk_tests_ldadd,
3403 build_by_default: program_tests)
3404 if not is_disabler(exe)
3409 'test_fdisk_script',
3410 'libfdisk/src/script.c',
3411 c_args : libfdisk_tests_cflags,
3412 include_directories : lib_fdisk_includes,
3413 link_with : libfdisk_tests_ldadd,
3414 build_by_default: program_tests)
3415 if not is_disabler(exe)
3420 'test_fdisk_version',
3421 'libfdisk/src/version.c',
3422 c_args : libfdisk_tests_cflags,
3423 include_directories : lib_fdisk_includes,
3424 link_with : libfdisk_tests_ldadd,
3425 build_by_default: program_tests)
3426 if not is_disabler(exe)
3432 'libfdisk/src/item.c',
3433 c_args : libfdisk_tests_cflags,
3434 include_directories : lib_fdisk_includes,
3435 link_with : libfdisk_tests_ldadd,
3436 build_by_default: program_tests)
3437 if not is_disabler(exe)
3441 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3444 'sample-fdisk-mkpart',
3445 'libfdisk/samples/mkpart.c',
3446 include_directories : lib_fdisk_includes,
3447 link_with : sample_fdisk_ldadd)
3448 if not is_disabler(exe)
3453 'sample-fdisk-mkpart-fullspec',
3454 'libfdisk/samples/mkpart-fullspec.c',
3455 include_directories : lib_fdisk_includes,
3456 link_with : sample_fdisk_ldadd)
3457 if not is_disabler(exe)
3461 ############################################################
3465 'tests/helpers/test_cap.c',
3466 include_directories : includes,
3467 dependencies : [lib_cap_ng],
3468 build_by_default: program_tests)
3469 if not is_disabler(exe)
3475 'tests/helpers/test_mbsencode.c',
3476 include_directories : includes,
3477 link_with : lib_common,
3478 build_by_default: program_tests)
3483 'tests/helpers/test_byteswap.c',
3484 include_directories : includes,
3485 build_by_default: program_tests)
3490 'tests/helpers/test_md5.c',
3492 include_directories : includes,
3493 build_by_default: program_tests)
3498 'tests/helpers/test_sha1.c',
3500 include_directories : includes,
3501 build_by_default: program_tests)
3506 'tests/helpers/test_pathnames.c',
3507 include_directories : includes,
3508 build_by_default: program_tests)
3513 'tests/helpers/test_strerror.c',
3514 include_directories : includes,
3515 build_by_default: program_tests)
3520 'tests/helpers/test_sysinfo.c',
3521 include_directories : includes,
3522 build_by_default: program_tests)
3527 'tests/helpers/test_sigreceive.c',
3528 include_directories : includes,
3529 link_with : lib_common,
3530 build_by_default: program_tests)
3535 'tests/helpers/test_tiocsti.c',
3536 include_directories : includes,
3537 build_by_default: program_tests)
3541 'test_uuid_namespace',
3542 'tests/helpers/test_uuid_namespace.c',
3546 include_directories : includes,
3547 build_by_default: program_tests)
3553 'tests/helpers/test_mkfds.c',
3554 'tests/helpers/test_mkfds.h',
3555 'tests/helpers/test_mkfds_ppoll.c',
3556 include_directories : includes,
3557 dependencies : mq_libs,
3558 build_by_default: program_tests)
3564 'tests/helpers/test_enosys.c',
3565 include_directories : includes,
3566 build_by_default: program_tests)
3569 ############################################################
3571 if conf.get('HAVE_OPENAT').to_string() == '1'
3573 'sample-scols-tree',
3574 'libsmartcols/samples/tree.c',
3575 include_directories : includes,
3576 link_with : [lib_smartcols, lib_common],
3577 build_by_default: program_tests)
3578 if not is_disabler(exe)
3584 'sample-scols-title',
3585 'libsmartcols/samples/title.c',
3586 include_directories : includes,
3587 link_with : [lib_smartcols, lib_common])
3588 if not is_disabler(exe)
3593 'sample-scols-wrap',
3594 'libsmartcols/samples/wrap.c',
3595 include_directories : includes,
3596 link_with : [lib_smartcols, lib_common])
3597 if not is_disabler(exe)
3602 'sample-scols-continuous',
3603 'libsmartcols/samples/continuous.c',
3604 include_directories : includes,
3605 link_with : [lib_smartcols, lib_common])
3606 if not is_disabler(exe)
3611 'sample-scols-continuous-json',
3612 'libsmartcols/samples/continuous-json.c',
3613 include_directories : includes,
3614 link_with : [lib_smartcols, lib_common])
3615 if not is_disabler(exe)
3620 'sample-scols-maxout',
3621 'libsmartcols/samples/maxout.c',
3622 include_directories : includes,
3623 link_with : [lib_smartcols, lib_common])
3624 if not is_disabler(exe)
3629 'sample-scols-fromfile',
3630 'libsmartcols/samples/fromfile.c',
3631 include_directories : includes,
3632 link_with : [lib_smartcols, lib_common])
3633 if not is_disabler(exe)
3638 'sample-scols-grouping-simple',
3639 'libsmartcols/samples/grouping-simple.c',
3640 include_directories : includes,
3641 link_with : [lib_smartcols, lib_common])
3642 if not is_disabler(exe)
3647 'sample-scols-grouping-overlay',
3648 'libsmartcols/samples/grouping-overlay.c',
3649 include_directories : includes,
3650 link_with : [lib_smartcols, lib_common])
3651 if not is_disabler(exe)
3657 'Documentation/boilerplate.c',
3658 include_directories : includes,
3659 build_by_default: program_tests)
3660 if not is_disabler(exe)
3664 ############################################################
3666 # Let the test runner know whether we're running under asan and export
3667 # some paths. We use a file on disk so that it is possible to run the
3668 # test scripts from commandline without setting any variables.
3669 configure_file(output : 'meson.conf',
3674 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3675 python.full_path())])
3677 run_sh = find_program('tests/run.sh')
3681 '--srcdir=' + meson.current_source_dir(),
3682 '--builddir=' + meson.current_build_dir(),
3688 manadocs += ['lib/terminal-colors.d.5.adoc']
3689 manadocs += ['libblkid/libblkid.3.adoc']
3693 'libuuid/man/uuid.3.adoc',
3694 'libuuid/man/uuid_clear.3.adoc',
3695 'libuuid/man/uuid_compare.3.adoc',
3696 'libuuid/man/uuid_copy.3.adoc',
3697 'libuuid/man/uuid_generate.3.adoc',
3698 'libuuid/man/uuid_is_null.3.adoc',
3699 'libuuid/man/uuid_parse.3.adoc',
3700 'libuuid/man/uuid_time.3.adoc',
3701 'libuuid/man/uuid_unparse.3.adoc']
3703 'uuid_generate_random.3': 'uuid_generate.3',
3704 'uuid_generate_time.3': 'uuid_generate.3',
3705 'uuid_generate_time_safe.3': 'uuid_generate.3',
3709 asciidoctor = find_program('asciidoctor', required : false)
3710 if asciidoctor.found()
3711 foreach adoc : manadocs
3712 name = adoc.split('/')[-1]
3713 page = name.split('.adoc')[0]
3714 section = page.split('.')[-1]
3715 mandirn = join_paths(mandir, 'man' + section)
3720 command : [ asciidoctor,
3722 '-a', 'VERSION=' + meson.project_version(),
3723 '-a', 'release-version=' + meson.project_version(),
3724 '-a', 'ADJTIME_PATH=/etc/adjtime',
3725 '-a', 'package-docdir=' + docdir,
3726 '--base-dir=' + meson.current_source_dir(),
3727 '--destination-dir=' + meson.current_build_dir(),
3728 '--load-path', '@SOURCE_ROOT@/tools',
3729 '--require', 'asciidoctor-includetracker',
3733 depfile : page + '.deps',
3735 install_dir : mandirn)
3738 foreach link_name, target : manlinks
3739 link_section = link_name.split('.')[-1]
3740 target_section = target.split('.')[-1]
3741 meson.add_install_script(meson_make_manpage_stub,
3742 join_paths('man' + target_section, target),
3743 join_paths(mandir, 'man' + link_section, link_name))
3747 if bash_completion.found()
3748 foreach completion : bashcompletions
3750 join_paths('bash-completion', completion),
3751 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3754 foreach link_name, target : bashcompletionslinks
3755 meson.add_install_script(meson_make_symlink,
3757 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))