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 libblkid_version = '1.1.0'
14 libblkid_date = '01-Jun-2021'
15 libuuid_version = '1.3.0'
16 liblastlog2_version = '2.0.0'
17 libmount_version = '1.1.0'
18 libsmartcols_version = '1.1.0'
19 libfdisk_version = '1.1.0'
21 prefixdir = get_option('prefix')
22 if not prefixdir.startswith('/')
23 error('Prefix is not absolute: "@0@"'.format(prefixdir))
25 bindir = join_paths(prefixdir, get_option('bindir'))
26 sbindir = join_paths(prefixdir, get_option('sbindir'))
27 sysconfstaticdir = join_paths(prefixdir, 'lib')
28 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
29 mandir = join_paths(prefixdir, get_option('mandir'))
31 execprefixdir = prefixdir
32 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
33 usrbin_exec_dir = join_paths(execprefixdir, bindir)
34 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
35 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
37 vendordir = get_option('vendordir')
39 add_project_arguments('-D_GNU_SOURCE', language : 'c')
41 cc = meson.get_compiler('c')
43 conf = configuration_data()
44 conf.set_quoted('PACKAGE', meson.project_name())
45 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
46 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
47 conf.set_quoted('PACKAGE_STRING', package_string)
50 pc_version = meson.project_version().split('-')[0].split('.')
52 if pc_version.length() < 3
56 pc_version = '.'.join(pc_version)
58 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
59 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
61 conf.set('bindir', bindir)
62 conf.set('sbindir', sbindir)
63 conf.set('runstatedir', runstatedir)
64 conf.set('sysconfdir', sysconfdir)
65 conf.set('usrbin_execdir', usrbin_exec_dir)
66 conf.set('usrsbin_execdir', usrsbin_exec_dir)
67 conf.set('docdir', docdir)
68 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
69 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
70 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
71 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
73 conf.set_quoted('_PATH_VENDORDIR', vendordir)
74 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
76 build_libblkid = not get_option('build-libblkid').disabled()
77 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
78 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
80 build_libuuid = not get_option('build-libuuid').disabled()
81 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
82 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
84 build_liblastlog2 = not get_option('build-liblastlog2').disabled()
85 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
86 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
88 login_lastlogin = get_option('login-lastlogin')
89 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
90 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
92 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
93 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
94 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
96 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
97 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
99 build_libmount = not get_option('build-libmount').disabled()
100 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
101 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
102 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
103 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
105 build_libsmartcols = not get_option('build-libsmartcols').disabled()
106 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
107 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
109 build_libfdisk = not get_option('build-libfdisk').disabled()
110 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
111 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
113 build_uuidd = not get_option('build-uuidd').disabled()
114 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
115 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
117 static_programs = get_option('static-programs')
118 need_static_libs = static_programs.length() > 0 # a rough estimate...
119 summary('static programs', static_programs)
121 LINUX = host_machine.system() in ['linux']
122 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
124 ############################################################
142 have = cc.compiles(code, name : 'wchar_t support')
143 if not have and get_option('widechar').enabled()
144 error('widechar support requested but unavailable')
146 if get_option('ncurses').enabled() and get_option('widechar').enabled()
147 error('widechar support is incompatible with non-wide ncurses')
149 conf.set('HAVE_WIDECHAR', have ? 1 : false)
191 linux/net_namespace.h
205 security/pam_modules.h
238 lib_m = cc.find_library('m')
240 lib_tinfo = dependency(
242 required : get_option('tinfo'))
244 lib_ncursesw = dependency(
246 required : get_option('ncursesw'))
247 if lib_ncursesw.found()
248 headers += ['ncursesw/ncurses.h',
252 lib_ncurses = disabler()
254 lib_ncurses = dependency(
256 required : get_option('ncurses'))
257 headers += ['ncurses.h',
261 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
262 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
263 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
265 lib_slang = dependency(
267 required : get_option('slang'))
269 headers += ['slang.h',
274 conf.set('HAVE_SLANG', lib_slang.found())
276 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
277 if curses_libs.found()
278 have = cc.has_function('use_default_colors', dependencies : curses_libs)
279 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
280 have = cc.has_function('resizeterm', dependencies : curses_libs)
281 conf.set('HAVE_RESIZETERM', have ? 1 : false)
288 required : get_option('zlib'))
290 lib_readline = dependency(
292 required : get_option('readline'))
293 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
295 lib_readline_static = dependency(
298 required : need_static_libs ? get_option('readline') : disabler())
300 if meson.version().version_compare('>= 0.59.0')
301 lib_intl = dependency(
303 required : get_option('nls'))
304 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
306 if get_option('nls').enabled()
307 error('nls is not supported with meson before 0.59.0')
309 lib_intl = dependency('', required : false)
312 lib_user = dependency(
315 required : get_option('libuser'))
316 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
318 lib_util = cc.find_library(
320 required : get_option('libutil'))
321 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
323 lib_utempter = cc.find_library(
325 required : get_option('libutempter'))
326 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
328 systemd = dependency(
330 required : get_option('systemd'))
332 lib_systemd = dependency(
334 required : get_option('systemd'))
335 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
336 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
338 have = cc.has_function(
339 'sd_session_get_username',
340 dependencies : lib_systemd)
341 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
343 lib_udev = dependency(
345 required : get_option('systemd'))
346 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
348 lib_crypt = cc.find_library('crypt')
350 lib_pam = cc.find_library('pam', required : get_option('build-login'))
351 if not lib_pam.found()
352 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
354 if not lib_pam.found()
355 lib_pam = cc.find_library('pam', required : get_option('build-su'))
357 if not lib_pam.found()
358 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
361 lib_pam_misc = cc.find_library('pam_misc')
362 lib_pam = [lib_pam, lib_pam_misc]
364 lib_pam_misc = declare_dependency()
367 lib_cryptsetup = dependency(
369 required : get_option('cryptsetup'))
370 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
372 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
374 if meson.version().version_compare('>= 0.62.0')
375 lib_dl = dependency('dl')
377 lib_dl = cc.find_library('dl')
379 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
380 summary('cryptsetup support (dlopen)',
382 section : 'components')
384 summary('cryptsetup support',
385 lib_cryptsetup.found() ? 'enabled' : 'disabled',
386 section : 'components')
389 have = cc.has_function(
390 'crypt_activate_by_signed_key',
391 dependencies : lib_cryptsetup)
392 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
394 lib_cap_ng = dependency(
396 required : get_option('build-setpriv'))
397 if not lib_cap_ng.found()
398 lib_cap_ng = disabler()
401 lib_selinux = dependency(
404 required : get_option('selinux'))
405 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
407 lib_magic = dependency(
409 required : get_option('magic'))
410 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
412 lib_econf = dependency(
414 required : get_option('econf'))
415 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
417 lib_audit = dependency(
419 required : get_option('audit'))
420 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
422 conf.set('HAVE_SMACK', not get_option('smack').disabled())
424 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
426 foreach header : headers
427 have = cc.has_header(header)
428 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
431 header = 'linux/btrfs.h'
432 enable_btrfs = cc.has_header(header,
433 required : get_option('btrfs'))
434 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
435 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
437 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
442 have = cc.has_header(header,
444 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
447 have = cc.has_header('sched.h')
448 conf.set10('HAVE_DECL_CPU_ALLOC', have)
449 # We get -1 if the size cannot be determined
450 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
451 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
453 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
454 conf.set10('HAVE_ENVIRON_DECL', have)
456 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
457 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
459 have = cc.has_function('strsignal')
460 conf.set10('HAVE_STRSIGNAL_DECL', have)
462 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
463 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
465 have = cc.has_type('loff_t',
466 args : '-D_GNU_SOURCE',
467 prefix : '#include <sys/types.h>')
468 conf.set('HAVE_LOFF_T', have ? 1 : false)
470 have = cc.compiles('''
471 #define _GNU_SOURCE 1
472 #include <langinfo.h>
475 str = nl_langinfo (ALTMON_1);
476 str = nl_langinfo (ALTMON_2);
477 str = nl_langinfo (ALTMON_3);
478 str = nl_langinfo (ALTMON_4);
479 str = nl_langinfo (ALTMON_5);
480 str = nl_langinfo (ALTMON_6);
481 str = nl_langinfo (ALTMON_7);
482 str = nl_langinfo (ALTMON_8);
483 str = nl_langinfo (ALTMON_9);
484 str = nl_langinfo (ALTMON_10);
485 str = nl_langinfo (ALTMON_11);
486 str = nl_langinfo (ALTMON_12);
490 name : 'langinfo.h defines ALTMON_x constants')
491 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
493 have = cc.compiles('''
494 #define _GNU_SOURCE 1
495 #include <langinfo.h>
498 str = nl_langinfo (_NL_ABALTMON_1);
499 str = nl_langinfo (_NL_ABALTMON_2);
500 str = nl_langinfo (_NL_ABALTMON_3);
501 str = nl_langinfo (_NL_ABALTMON_4);
502 str = nl_langinfo (_NL_ABALTMON_5);
503 str = nl_langinfo (_NL_ABALTMON_6);
504 str = nl_langinfo (_NL_ABALTMON_7);
505 str = nl_langinfo (_NL_ABALTMON_8);
506 str = nl_langinfo (_NL_ABALTMON_9);
507 str = nl_langinfo (_NL_ABALTMON_10);
508 str = nl_langinfo (_NL_ABALTMON_11);
509 str = nl_langinfo (_NL_ABALTMON_12);
513 name : 'langinfo.h defines _NL_ABALTMON_x constants')
514 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
516 have = cc.compiles('''
517 #define _GNU_SOURCE 1
518 #include <langinfo.h>
521 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
525 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
526 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
559 landlock_create_ruleset
561 landlock_restrict_self
625 have = cc.has_function(func)
626 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
627 # This makes little sense, but is necessary to avoid warnings about
628 # redefined macros from Python.h, which uses this convention.
629 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
632 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
633 conf.set('AGETTY_RELOAD', have ? 1 : false)
635 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
638 have_dirfd = (cc.has_function('dirfd') or
639 cc.has_header_symbol('dirent.h', 'dirfd',
640 prefix : '#include <sys/types.h>'))
641 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
643 have_ddfd = cc.has_member('DIR', 'dd_fd',
645 #include <sys/types.h>
648 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
650 have = cc.has_member('struct tm', 'tm_gmtoff',
651 args : '-D_GNU_SOURCE',
656 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
660 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
661 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
663 have = cc.has_member('struct termios', 'c_line',
664 prefix : '#include <termios.h>')
665 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
667 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
668 args : '-D_GNU_SOURCE',
669 prefix : '#include <sys/stat.h>')
670 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
672 have = cc.has_member('struct statx', 'stx_mnt_id',
673 prefix : '#include <sys/stat.h>')
674 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
676 # replacement for AC_STRUCT_TIMEZONE
677 have = cc.has_member('struct tm', 'tm_zone',
678 args : '-D_GNU_SOURCE',
679 prefix : '#include <time.h>')
680 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
682 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
683 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
685 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
686 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
688 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
689 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
694 extern char *tzname[];
697 return tzname ? 0 : 1;
699 '''.format(have ? 1 : 0)
700 have = cc.compiles(code, name : 'using tzname[]')
701 conf.set('HAVE_TZNAME', have ? 1 : false)
703 have = cc.sizeof('time_t', prefix : '#include <time.h>')
705 add_global_arguments('-D_TIME_BITS=64', language : 'c')
706 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
708 if get_option('allow-32bit-time')
709 warning('Could not make time_t 64bits wide')
711 error('Could not make time_t 64bits wide')
717 if not cc.has_function('socket')
718 socket_libs += cc.find_library('socket', required : true)
719 have = cc.has_function('socket',
720 dependencies : socket_libs)
722 error('socket() function not available')
727 have = cc.has_function('clock_gettime')
729 realtime_libs += cc.find_library('rt', required : true)
730 have = cc.has_function('clock_gettime',
731 dependencies : realtime_libs)
733 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
735 thread_libs = dependency('threads')
737 have = cc.has_function('timer_create')
739 realtime_libs = [cc.find_library('rt', required : true)]
740 have = cc.has_function('timer_create',
741 dependencies : realtime_libs)
743 realtime_libs += thread_libs
744 have = cc.has_function('timer_create',
745 dependencies : realtime_libs)
748 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
750 have = cc.has_function('setitimer')
751 conf.set('HAVE_SETITIMER', have ? 1 : false)
754 rtas_libs = cc.find_library('rtas', required : false)
755 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
758 if not cc.has_header_symbol('math.h', 'isnan')
759 lib = cc.find_library('m', required : true)
760 if (cc.has_function('isnan', dependencies : lib) and
761 cc.has_function('__isnan', dependencies : lib))
766 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
767 args : '-D_GNU_SOURCE')
768 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
771 extern char *__progname;
773 return (*__progname != 0);
776 have = cc.compiles(code, name : 'using __progname')
777 conf.set('HAVE___PROGNAME', have ? 1 : false)
779 have = conf.get('HAVE_PTY_H').to_string() == '1' \
780 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
781 conf.set('HAVE_PTY', have ? 1 : false)
783 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
784 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
786 build_plymouth_support = get_option('build-plymouth-support')
787 have_tiocglcktrmios = cc.has_header_symbol(
788 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
789 required : build_plymouth_support.enabled())
790 have_sock_cloexec = cc.has_header_symbol(
791 'sys/socket.h', 'SOCK_CLOEXEC',
792 prefix : '#include <sys/types.h>',
793 required : build_plymouth_support.enabled())
794 have_sock_nonblock = cc.has_header_symbol(
795 'sys/socket.h', 'SOCK_NONBLOCK',
796 prefix : '#include <sys/types.h>',
797 required : build_plymouth_support.enabled())
798 have_so_passcred = cc.has_header_symbol(
799 'sys/socket.h', 'SO_PASSCRED',
800 args : ['-D_GNU_SOURCE'],
801 prefix : '#include <sys/types.h>',
802 required : build_plymouth_support.enabled())
804 build_plymouth_support = (not build_plymouth_support.disabled() and
805 have_tiocglcktrmios and
806 have_sock_cloexec and
807 have_sock_nonblock and
809 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
810 summary('plymouth support',
811 build_plymouth_support ? 'enabled' : 'disabled',
812 section : 'components')
814 # check for valid fallocate() function
815 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
816 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
817 # and program can't be linked.
825 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
826 return ret == 0 ? 0 : 1;
829 have = cc.links(code, name : 'fallocate() function')
830 conf.set('HAVE_FALLOCATE', have ? 1 : false)
838 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
839 return ret == 0 ? 0 : 1;
842 have = cc.links(code, name : 'posix_fallocate() function')
843 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
845 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
846 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
847 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
849 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
850 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
851 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
853 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
855 ############################################################
858 fs_search_path = get_option('fs-search-path')
859 fs_search_path_extra = get_option('fs-search-path-extra')
860 if fs_search_path_extra != ''
861 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
863 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
865 systemdsystemunitdir = ''
867 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
870 sysvinit = get_option('sysvinit').enabled()
871 sysvinitrcdir = sysconfdir + '/init.d'
873 program_tests = get_option('program-tests')
875 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
876 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
878 have = get_option('chsh-only-listed')
879 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
881 have = get_option('use-tty-group')
882 conf.set('USE_TTY_GROUP', have ? 1 : false)
884 bison = find_program('bison')
885 flex = find_program('flex')
887 build_hwclock = not get_option('build-hwclock').disabled()
888 bison_gen = generator(
890 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
891 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
893 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
894 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
898 configuration : conf)
900 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
905 '-Waddress-of-packed-member',
906 '-Wdiscarded-qualifiers',
907 '-Wembedded-directive',
910 '-Wimplicit-function-declaration',
911 '-Wmissing-declarations',
912 '-Wmissing-parameter-type',
913 '-Wmissing-prototypes',
915 '-Wno-missing-field-initializers',
916 '-Wold-style-definition',
920 '-Wstrict-prototypes',
923 '-Wunused-but-set-parameter',
924 '-Wunused-but-set-variable',
925 '-Wunused-parameter',
931 foreach compiler_flag : compiler_flags
932 if cc.has_argument(compiler_flag)
933 add_project_arguments(compiler_flag, language : 'c')
941 bashcompletionslinks = {}
947 subdir('libsmartcols')
949 subdir('liblastlog2')
951 subdir('pam_lastlog2')
952 subdir('login-utils')
960 includes = [dir_include,
971 opt = not get_option('build-chfn-chsh').disabled()
976 include_directories : includes,
977 link_with : [lib_common, logindefs_c],
978 dependencies : chfn_chsh_deps,
979 install_dir : usrbin_exec_dir,
980 install_mode : 'rwsr-xr-x',
982 build_by_default : opt)
986 'login-utils/chsh.c',
989 include_directories : includes,
990 link_with : lib_common,
991 dependencies : chfn_chsh_deps,
992 install_dir : usrbin_exec_dir,
993 install_mode : 'rwsr-xr-x',
995 build_by_default : opt)
996 if opt and not is_disabler(exe)
998 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
999 bashcompletions += ['chfn', 'chsh']
1004 test_islocal_sources,
1005 include_directories : includes,
1006 c_args : '-DTEST_PROGRAM',
1007 build_by_default : program_tests)
1012 test_consoles_sources,
1013 c_args : ['-DTEST_PROGRAM'],
1014 include_directories : includes,
1015 link_with : lib_common,
1016 build_by_default : program_tests)
1019 opt = not get_option('build-last').disabled()
1023 include_directories : includes,
1024 link_with : [lib_common],
1025 install_dir : usrbin_exec_dir,
1027 build_by_default : opt)
1028 if opt and not is_disabler(exe)
1030 meson.add_install_script(meson_make_symlink,
1032 join_paths(usrbin_exec_dir, 'lastb'))
1033 manadocs += ['login-utils/last.1.adoc']
1034 manlinks += {'lastb.1': 'last.1'}
1035 bashcompletions += ['last']
1036 bashcompletionslinks += {'lastb': 'last'}
1039 opt = not get_option('build-nologin').disabled()
1042 'login-utils/nologin.c',
1043 include_directories : includes,
1044 install_dir : sbindir,
1045 link_with : [lib_common],
1047 build_by_default : opt)
1048 if opt and not is_disabler(exe)
1050 manadocs += ['login-utils/nologin.8.adoc']
1053 opt = not get_option('build-utmpdump').disabled()
1056 'login-utils/utmpdump.c',
1057 include_directories : includes,
1058 link_with : [lib_common],
1059 install_dir : usrbin_exec_dir,
1061 build_by_default : opt)
1062 if opt and not is_disabler(exe)
1064 manadocs += ['login-utils/utmpdump.1.adoc']
1065 bashcompletions += ['utmpdump']
1068 opt = not get_option('build-su').disabled()
1072 'login-utils/su-common.c',
1073 'login-utils/su-common.h',
1077 include_directories : includes,
1078 link_with : [lib_common, logindefs_c],
1079 dependencies : [lib_pam,
1083 install_mode : 'rwsr-xr-x',
1085 build_by_default : opt)
1086 if opt and not is_disabler(exe)
1088 manadocs += ['login-utils/su.1.adoc']
1089 bashcompletions += ['su']
1092 opt = not get_option('build-newgrp').disabled()
1095 'login-utils/newgrp.c',
1096 include_directories : includes,
1097 dependencies : [lib_crypt],
1098 install_dir : usrbin_exec_dir,
1099 install_mode : 'rwsr-xr-x',
1101 build_by_default : opt)
1102 if opt and not is_disabler(exe)
1104 manadocs += ['login-utils/newgrp.1.adoc']
1105 bashcompletions += ['newgrp']
1108 opt = not get_option('build-lslogins').disabled()
1111 'login-utils/lslogins.c',
1112 include_directories : includes,
1113 link_with : [lib_common,
1116 (build_liblastlog2 ? [lib_lastlog2] : []),
1117 dependencies : [lib_selinux,
1119 install_dir : usrbin_exec_dir,
1121 build_by_default : opt)
1122 if opt and not is_disabler(exe)
1124 manadocs += ['login-utils/lslogins.1.adoc']
1125 bashcompletions += ['lslogins']
1128 opt = not get_option('build-vipw').disabled()
1131 'login-utils/vipw.c',
1132 'login-utils/setpwnam.h',
1133 include_directories : includes,
1134 link_with : [lib_common],
1135 dependencies : [lib_selinux],
1136 install_dir : usrbin_exec_dir,
1138 build_by_default : opt)
1139 if opt and not is_disabler(exe)
1141 meson.add_install_script(meson_make_symlink,
1143 join_paths(usrbin_exec_dir, 'vigr'))
1144 manadocs += ['login-utils/vipw.8.adoc']
1145 meson.add_install_script(meson_make_symlink,
1147 join_paths(mandir, 'man8/vigr.8'))
1150 opt = not get_option('build-runuser').disabled()
1153 'login-utils/runuser.c',
1154 'login-utils/su-common.c',
1155 'login-utils/su-common.h',
1159 include_directories : includes,
1160 link_with : [lib_common, logindefs_c],
1161 dependencies : [lib_pam,
1165 install_dir : sbindir,
1167 build_by_default : opt)
1168 if opt and not is_disabler(exe)
1170 manadocs += ['login-utils/runuser.1.adoc']
1171 bashcompletionslinks += {'runuser': 'su'}
1174 ############################################################
1180 include_directories : includes,
1181 link_with : lib_common,
1182 install_dir : usrbin_exec_dir,
1185 manadocs += ['text-utils/col.1.adoc']
1186 bashcompletions += ['col']
1192 include_directories : includes,
1193 install_dir : usrbin_exec_dir,
1196 manadocs += ['text-utils/colcrt.1.adoc']
1197 bashcompletions += ['colcrt']
1202 include_directories : includes,
1203 link_with : lib_common,
1204 install_dir : usrbin_exec_dir,
1207 manadocs += ['text-utils/colrm.1.adoc']
1208 bashcompletions += ['colrm']
1213 include_directories : includes,
1214 install_dir : usrbin_exec_dir,
1217 manadocs += ['text-utils/rev.1.adoc']
1218 bashcompletions += ['rev']
1223 include_directories : includes,
1224 link_with : [lib_common,
1226 install_dir : usrbin_exec_dir,
1228 if not is_disabler(exe)
1230 manadocs += ['text-utils/column.1.adoc']
1231 bashcompletions += ['column']
1234 opt = not get_option('build-line').disabled()
1238 include_directories : includes,
1239 install_dir : usrbin_exec_dir,
1241 build_by_default : opt)
1242 if opt and not is_disabler(exe)
1244 manadocs += ['text-utils/line.1.adoc']
1247 opt = not get_option('build-pg').disabled()
1251 link_with : lib_common,
1252 include_directories : includes,
1253 dependencies : [lib_tinfo,
1255 install_dir : usrbin_exec_dir,
1257 build_by_default : opt)
1258 if opt and not is_disabler(exe)
1260 manadocs += ['text-utils/pg.1.adoc']
1261 bashcompletions += ['pg']
1264 opt = not get_option('build-ul').disabled()
1268 include_directories : includes,
1269 dependencies : [lib_tinfo,
1271 install_dir : usrbin_exec_dir,
1273 build_by_default : opt)
1274 if opt and not is_disabler(exe)
1276 manadocs += ['text-utils/ul.1.adoc']
1277 bashcompletions += ['ul']
1280 opt = not get_option('build-more').disabled()
1284 link_with : [lib_common],
1285 include_directories : includes,
1286 dependencies : [lib_tinfo,
1290 build_by_default : opt)
1294 link_with : [lib_common],
1295 include_directories : includes,
1296 c_args : '-DTEST_PROGRAM',
1297 dependencies : [lib_tinfo,
1300 build_by_default : opt and program_tests)
1302 if opt and not is_disabler(exe)
1304 manadocs += ['text-utils/more.1.adoc']
1305 bashcompletions += ['more']
1311 include_directories : includes,
1312 link_with : [lib_common,
1314 install_dir : usrbin_exec_dir,
1316 if not is_disabler(exe)
1318 manadocs += ['text-utils/hexdump.1.adoc']
1319 bashcompletions += ['hexdump']
1322 opt = not get_option('build-lsmem').disabled()
1326 include_directories : includes,
1327 link_with : [lib_common,
1329 install_dir : usrbin_exec_dir,
1331 build_by_default : opt)
1332 if opt and not is_disabler(exe)
1334 manadocs += ['sys-utils/lsmem.1.adoc']
1335 bashcompletions += ['lsmem']
1338 opt = not get_option('build-chmem').disabled()
1342 include_directories : includes,
1343 link_with : [lib_common],
1344 install_dir : usrbin_exec_dir,
1346 build_by_default : opt)
1347 if opt and not is_disabler(exe)
1349 manadocs += ['sys-utils/chmem.8.adoc']
1350 bashcompletions += ['chmem']
1356 include_directories : includes,
1357 link_with : [lib_common],
1358 install_dir : usrbin_exec_dir,
1361 manadocs += ['sys-utils/choom.1.adoc']
1366 include_directories : includes,
1367 link_with : [lib_common],
1368 install_dir : usrbin_exec_dir,
1371 manadocs += ['sys-utils/ipcmk.1.adoc']
1372 bashcompletions += ['ipcmk']
1377 include_directories : includes,
1378 link_with : [lib_common],
1379 install_dir : usrbin_exec_dir,
1382 manadocs += ['sys-utils/ipcrm.1.adoc']
1383 bashcompletions += ['ipcrm']
1385 opt = not get_option('build-ipcs').disabled()
1389 include_directories : includes,
1390 link_with : [lib_common],
1391 install_dir : usrbin_exec_dir,
1393 build_by_default : opt)
1394 if opt and not is_disabler(exe)
1396 manadocs += ['sys-utils/ipcs.1.adoc']
1397 bashcompletions += ['ipcs']
1400 opt = not get_option('build-rfkill').disabled()
1404 include_directories : includes,
1405 link_with : [lib_common,
1407 install_dir : usrsbin_exec_dir,
1409 build_by_default : opt)
1410 if opt and not is_disabler(exe)
1412 manadocs += ['sys-utils/rfkill.8.adoc']
1413 bashcompletions += ['rfkill']
1419 include_directories : includes,
1420 link_with : [lib_common,
1422 install_dir : usrbin_exec_dir,
1424 if not is_disabler(exe)
1426 manadocs += ['sys-utils/renice.1.adoc']
1427 bashcompletions += ['renice']
1433 include_directories: includes,
1434 link_with : [lib_common,
1436 install_dir : usrbin_exec_dir,
1438 if opt and not is_disabler(exe)
1440 manadocs += ['sys-utils/setpgid.1.adoc']
1441 bashcompletions += ['setpgid']
1447 include_directories : includes,
1448 link_with : [lib_common,
1450 install_dir : usrbin_exec_dir,
1452 if opt and not is_disabler(exe)
1454 manadocs += ['sys-utils/setsid.1.adoc']
1455 bashcompletions += ['setsid']
1460 readprofile_sources,
1461 include_directories : includes,
1462 link_with : [lib_common,
1464 install_dir : usrsbin_exec_dir,
1466 if not is_disabler(exe)
1468 manadocs += ['sys-utils/readprofile.8.adoc']
1469 bashcompletions += ['readprofile']
1472 opt = not get_option('build-tunelp').disabled()
1476 include_directories : includes,
1477 link_with : [lib_common],
1478 install_dir : usrsbin_exec_dir,
1480 build_by_default : opt)
1481 if opt and not is_disabler(exe)
1483 manadocs += ['sys-utils/tunelp.8.adoc']
1484 bashcompletions += ['tunelp']
1490 include_directories : includes,
1491 link_with : [lib_common,
1493 install_dir : sbindir,
1495 if not is_disabler(exe)
1497 manadocs += ['sys-utils/fstrim.8.adoc']
1498 bashcompletions += ['fstrim']
1504 include_directories : includes,
1505 link_with : [lib_common,
1508 if not is_disabler(exe)
1510 manadocs += ['sys-utils/dmesg.1.adoc']
1511 bashcompletions += ['dmesg']
1517 include_directories : dir_include,
1518 c_args : '-DTEST_DMESG',
1519 link_with : [lib_common,
1521 build_by_default : program_tests)
1522 if not is_disabler(exe)
1529 include_directories : includes,
1530 link_with : [lib_common],
1531 install_dir : sbindir,
1534 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1535 bashcompletions += ['ctrlaltdel']
1540 include_directories : includes,
1541 install_dir : sbindir,
1544 manadocs += ['sys-utils/fsfreeze.8.adoc']
1545 bashcompletions += ['fsfreeze']
1550 include_directories : includes,
1551 link_with : [lib_common,
1553 install_dir : sbindir,
1556 manadocs += ['sys-utils/blkdiscard.8.adoc']
1557 bashcompletions += ['blkdiscard']
1562 include_directories : includes,
1563 link_with : [lib_common],
1564 install_dir : sbindir,
1567 manadocs += ['sys-utils/blkzone.8.adoc']
1568 bashcompletions += ['blkzone']
1573 include_directories : includes,
1574 link_with : [lib_common],
1575 install_dir : sbindir,
1578 manadocs += ['sys-utils/blkpr.8.adoc']
1583 include_directories : includes,
1584 link_with : [lib_common],
1585 install_dir : usrsbin_exec_dir,
1588 manadocs += ['sys-utils/ldattach.8.adoc']
1589 bashcompletions += ['ldattach']
1594 include_directories : includes,
1595 link_with : [lib_common],
1596 install_dir : usrsbin_exec_dir,
1599 manadocs += ['sys-utils/rtcwake.8.adoc']
1600 bashcompletions += ['rtcwake']
1605 include_directories : includes,
1606 link_with : [lib_common],
1607 install_dir : usrbin_exec_dir,
1610 manadocs += ['sys-utils/setarch.8.adoc']
1611 bashcompletions += ['setarch']
1613 setarch_links = ['uname26', 'linux32', 'linux64']
1614 setarch_links_arch = {
1615 's390x' : ['s390', 's390x'],
1617 'x86_64' : ['i386', 'x86_64'],
1618 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1619 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1620 'mips64' : ['mips', 'mips64', 'mips32'],
1621 'ia64' : ['i386', 'ia64'],
1622 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1624 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1626 foreach link: setarch_links
1627 meson.add_install_script(meson_make_symlink,
1629 join_paths(usrbin_exec_dir, link))
1630 manlinks += {link + '.8': 'setarch.8'}
1633 opt = not get_option('build-eject').disabled()
1637 include_directories : includes,
1638 link_with : [lib_common,
1640 install_dir : usrbin_exec_dir,
1642 build_by_default : opt)
1643 if opt and not is_disabler(exe)
1645 manadocs += ['sys-utils/eject.1.adoc']
1646 bashcompletions += ['eject']
1649 opt = not get_option('build-losetup').disabled()
1653 include_directories : includes,
1654 link_with : [lib_common,
1656 install_dir : sbindir,
1658 build_by_default : opt)
1659 if opt and not is_disabler(exe)
1660 manadocs += ['sys-utils/losetup.8.adoc']
1662 bashcompletions += ['losetup']
1665 opt = opt and 'losetup' in static_programs
1669 include_directories : includes,
1670 link_args : ['--static'],
1671 link_with : [lib_common,
1672 lib_smartcols.get_static_lib()],
1673 install_dir : sbindir,
1675 build_by_default : opt)
1676 if opt and not is_disabler(exe)
1680 opt = not get_option('build-zramctl').disabled()
1684 include_directories : includes,
1685 link_with : [lib_common,
1687 install_dir : sbindir,
1689 build_by_default : opt)
1690 if opt and not is_disabler(exe)
1692 manadocs += ['sys-utils/zramctl.8.adoc']
1693 bashcompletions += ['zramctl']
1699 include_directories : includes,
1700 link_with : [lib_common,
1702 install_dir : usrbin_exec_dir,
1704 if not is_disabler(exe)
1706 manadocs += ['sys-utils/prlimit.1.adoc']
1707 bashcompletions += ['prlimit']
1713 include_directories : includes,
1714 link_with : [lib_common,
1717 install_dir : usrbin_exec_dir,
1719 if not is_disabler(exe)
1721 manadocs += ['sys-utils/lsns.8.adoc']
1722 bashcompletions += ['lsns']
1725 opt = not get_option('build-mount').disabled()
1729 include_directories : includes,
1730 link_with : [lib_common,
1733 dependencies : lib_selinux,
1734 install_mode : 'rwsr-xr-x',
1736 build_by_default : opt)
1740 include_directories : includes,
1741 link_with : [lib_common,
1743 install_mode : 'rwsr-xr-x',
1745 build_by_default : opt)
1746 if opt and not is_disabler(exe)
1748 manadocs += ['sys-utils/fstab.5.adoc',
1749 'sys-utils/mount.8.adoc',
1750 'sys-utils/umount.8.adoc']
1751 bashcompletions += ['mount', 'umount']
1754 opt2 = opt and 'mount' in static_programs
1758 include_directories : includes,
1759 link_args : ['--static'],
1760 link_with : [lib_common,
1761 lib_smartcols_static,
1764 build_by_default : opt2)
1765 if opt2 and not is_disabler(exe)
1769 opt2 = opt and 'umount' in static_programs
1773 include_directories : includes,
1774 link_args : ['--static'],
1775 link_with : [lib_common,
1778 build_by_default : opt2)
1779 if opt2 and not is_disabler(exe)
1788 include_directories : includes,
1789 link_with : [lib_common,
1793 install_dir : sbindir,
1795 if not is_disabler(exe)
1797 manadocs += ['sys-utils/swapon.8.adoc']
1798 bashcompletions += ['swapon']
1804 include_directories : includes,
1805 link_with : [lib_common,
1808 install_dir : sbindir,
1810 if not is_disabler(exe)
1812 manlinks += {'swapoff.8': 'swapon.8'}
1813 bashcompletions += ['swapoff']
1819 include_directories : includes,
1820 link_with : [lib_common,
1822 dependencies : [rtas_libs],
1823 install_dir : usrbin_exec_dir,
1825 if not is_disabler(exe)
1827 manadocs += ['sys-utils/lscpu.1.adoc']
1828 bashcompletions += ['lscpu']
1834 include_directories : includes,
1835 link_with : [lib_common],
1836 install_dir : sbindir,
1839 manadocs += ['sys-utils/chcpu.8.adoc']
1840 bashcompletions += ['chcpu']
1845 include_directories : includes,
1846 link_with : [lib_common,
1849 if not is_disabler(exe)
1851 manadocs += ['sys-utils/wdctl.8.adoc']
1852 bashcompletions += ['wdctl']
1855 opt = not get_option('build-mountpoint').disabled()
1859 include_directories : includes,
1860 link_with : [lib_mount],
1862 build_by_default : opt)
1863 if opt and not is_disabler(exe)
1865 manadocs += ['sys-utils/mountpoint.1.adoc']
1866 bashcompletions += ['mountpoint']
1869 opt = not get_option('build-fallocate').disabled()
1873 include_directories : includes,
1874 link_with : [lib_common],
1875 install_dir : usrbin_exec_dir,
1877 build_by_default : opt)
1878 if opt and not is_disabler(exe)
1880 manadocs += ['sys-utils/fallocate.1.adoc']
1881 bashcompletions += ['fallocate']
1884 opt = not get_option('build-pivot_root').disabled()
1888 include_directories : includes,
1889 install_dir : sbindir,
1891 build_by_default : opt)
1892 if opt and not is_disabler(exe)
1894 manadocs += ['sys-utils/pivot_root.8.adoc']
1895 bashcompletions += ['pivot_root']
1898 opt = not get_option('build-switch_root').disabled()
1899 if opt and not have_dirfd and not have_ddfd
1900 error('neither dirfd nor ddfd are available')
1904 switch_root_sources,
1905 include_directories : includes,
1906 install_dir : sbindir,
1908 build_by_default : opt)
1909 if opt and not is_disabler(exe)
1911 manadocs += ['sys-utils/switch_root.8.adoc']
1914 opt = not get_option('build-unshare').disabled()
1918 include_directories : includes,
1919 link_with : [lib_common],
1920 install_dir : usrbin_exec_dir,
1922 build_by_default : opt)
1923 if opt and not is_disabler(exe)
1925 manadocs += ['sys-utils/unshare.1.adoc']
1926 bashcompletions += ['unshare']
1929 opt = opt and 'unshare' in static_programs
1933 include_directories : includes,
1934 link_with : [lib_common],
1935 install_dir : usrbin_exec_dir,
1937 build_by_default : opt)
1938 if opt and not is_disabler(exe)
1942 opt = not get_option('build-nsenter').disabled()
1946 include_directories : includes,
1947 link_with : [lib_common],
1948 dependencies : [lib_selinux],
1949 install_dir : usrbin_exec_dir,
1951 build_by_default : opt)
1952 if opt and not is_disabler(exe)
1954 manadocs += ['sys-utils/nsenter.1.adoc']
1955 bashcompletions += ['nsenter']
1958 opt = opt and 'nsenter' in static_programs
1962 include_directories : includes,
1963 link_with : [lib_common],
1964 dependencies : [lib_selinux],
1965 install_dir : usrbin_exec_dir,
1967 build_by_default : opt)
1968 if opt and not is_disabler(exe)
1972 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1976 include_directories : includes,
1977 link_with : [lib_common],
1978 dependencies : [lib_cap_ng],
1979 install_dir : usrbin_exec_dir,
1981 build_by_default : opt)
1982 if opt and not is_disabler(exe)
1984 manadocs += ['sys-utils/setpriv.1.adoc']
1985 bashcompletions += ['setpriv']
1991 include_directories : includes,
1992 link_with : [lib_common],
1993 dependencies : realtime_libs,
1994 install_dir : usrbin_exec_dir,
1997 manadocs += ['sys-utils/flock.1.adoc']
1998 bashcompletions += ['flock']
2000 opt = not get_option('build-lsirq').disabled()
2004 include_directories : includes,
2005 link_with : [lib_common,
2007 install_dir : usrbin_exec_dir,
2009 build_by_default : opt)
2010 if opt and not is_disabler(exe)
2012 manadocs += ['sys-utils/lsirq.1.adoc']
2013 bashcompletions += ['lsirq']
2016 opt = not get_option('build-irqtop').disabled()
2020 include_directories : includes,
2021 dependencies : [realtime_libs, curses_libs],
2022 link_with : [lib_common,
2025 install_dir : usrbin_exec_dir,
2027 build_by_default : opt)
2028 if opt and not is_disabler(exe)
2030 manadocs += ['sys-utils/irqtop.1.adoc']
2031 bashcompletions += ['irqtop']
2034 opt = not get_option('build-ipcs').disabled()
2038 include_directories : includes,
2039 link_with : [lib_common,
2041 install_dir : usrbin_exec_dir,
2043 build_by_default : opt)
2044 if opt and not is_disabler(exe)
2046 manadocs += ['sys-utils/lsipc.1.adoc']
2047 bashcompletions += ['lsipc']
2054 include_directories : includes,
2055 link_with : [lib_common],
2056 dependencies : [lib_m,
2058 install_dir : sbindir,
2060 build_by_default : opt)
2061 if opt and not is_disabler(exe)
2063 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2064 bashcompletions += ['hwclock']
2070 include_directories : includes,
2071 install_dir : sbindir,
2074 manadocs += ['disk-utils/mkfs.8.adoc']
2075 bashcompletions += ['mkfs']
2077 opt = not get_option('build-bfs').disabled()
2081 include_directories : includes,
2082 link_with : [lib_common],
2083 install_dir : sbindir,
2085 build_by_default : opt)
2086 if opt and not is_disabler(exe)
2088 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2089 bashcompletions += ['mkfs.bfs']
2095 include_directories : includes,
2096 link_with : [lib_common],
2097 install_dir : usrbin_exec_dir,
2100 manadocs += ['disk-utils/isosize.8.adoc']
2101 bashcompletions += ['isosize']
2106 include_directories : includes,
2107 link_with : [lib_common,
2110 dependencies: [lib_selinux],
2111 install_dir : sbindir,
2113 if not is_disabler(exe)
2115 manadocs += ['disk-utils/mkswap.8.adoc']
2116 bashcompletions += ['mkswap']
2122 include_directories : includes,
2123 link_with : [lib_common,
2126 install_dir : sbindir,
2128 if not is_disabler(exe)
2130 manadocs += ['disk-utils/swaplabel.8.adoc']
2131 bashcompletions += ['swaplabel']
2134 opt = not get_option('build-fsck').disabled()
2138 include_directories : includes,
2139 link_with : [lib_common,
2142 dependencies : realtime_libs,
2143 install_dir : sbindir,
2145 build_by_default : opt)
2146 if opt and not is_disabler(exe)
2148 manadocs += ['disk-utils/fsck.8.adoc']
2149 bashcompletions += ['fsck']
2152 opt = not get_option('build-minix').disabled()
2156 include_directories : includes,
2157 link_with : [lib_common],
2158 install_dir : sbindir,
2160 build_by_default : opt)
2164 include_directories : includes,
2165 c_args : '-DTEST_SCRIPT',
2166 link_with : [lib_common],
2167 build_by_default : opt and program_tests)
2171 include_directories : includes,
2172 link_with : [lib_common],
2173 install_dir : sbindir,
2175 build_by_default : opt)
2176 if opt and not is_disabler(exe)
2177 exes += [exe, exe2, exe3]
2178 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2179 bashcompletions += ['mkfs.minix', 'fsck.minix']
2182 opt = not get_option('build-cramfs').disabled()
2185 mkfs_cramfs_sources,
2186 include_directories : includes,
2187 link_with : [lib_common],
2188 dependencies : [lib_z],
2189 install_dir : sbindir,
2191 build_by_default : opt)
2194 fsck_cramfs_sources,
2195 include_directories : includes,
2196 link_with : [lib_common],
2197 dependencies : [lib_z],
2198 install_dir : sbindir,
2200 build_by_default : opt)
2201 if not is_disabler(exe)
2203 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2204 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2207 opt = not get_option('build-raw').disabled()
2209 cc.has_header('linux/raw.h', required: opt)
2214 include_directories : includes,
2215 install_dir : sbindir,
2217 build_by_default : opt)
2218 if opt and not is_disabler(exe)
2220 manadocs += ['disk-utils/raw.8.adoc']
2221 bashcompletions += ['raw']
2224 opt = not get_option('build-fdformat').disabled()
2228 include_directories : includes,
2229 link_with : [lib_common],
2230 install_dir : usrsbin_exec_dir,
2232 build_by_default : opt)
2233 if opt and not is_disabler(exe)
2235 manadocs += ['disk-utils/fdformat.8.adoc']
2236 bashcompletions += ['fdformat']
2242 include_directories : includes,
2243 link_with : [lib_common],
2244 install_dir : sbindir,
2246 manadocs += ['disk-utils/blockdev.8.adoc']
2247 bashcompletions += ['blockdev']
2249 opt = not get_option('build-fdisks').disabled()
2250 if opt and not have_dirfd and not have_ddfd
2251 error('neither dirfd nor ddfd are available')
2256 include_directories : includes,
2257 link_with : [lib_common,
2261 dependencies : [lib_readline],
2262 install_dir : sbindir,
2264 build_by_default : opt)
2265 if opt and not is_disabler(exe)
2267 bashcompletions += ['fdisk']
2270 opt2 = opt and 'fdisk' in static_programs
2274 link_args : ['--static'],
2275 include_directories : includes,
2276 link_with : [lib_common,
2279 lib_smartcols.get_static_lib()],
2280 dependencies : [lib_readline_static],
2281 install_dir : sbindir,
2283 build_by_default : opt2)
2284 if opt2 and not is_disabler(exe)
2291 include_directories : includes,
2292 link_with : [lib_common,
2296 dependencies : [lib_readline],
2297 install_dir : sbindir,
2299 build_by_default : opt)
2300 if opt and not is_disabler(exe)
2302 bashcompletions += ['sfdisk']
2305 opt2 = opt and 'sfdisk' in static_programs
2309 include_directories : includes,
2310 link_with : [lib_common,
2313 lib_smartcols.get_static_lib()],
2314 dependencies : [lib_readline_static],
2315 install_dir : sbindir,
2317 build_by_default : opt2)
2318 if opt2 and not is_disabler(exe)
2325 include_directories : includes,
2326 link_with : [lib_common,
2331 dependencies : [curses_libs],
2332 install_dir : sbindir,
2334 build_by_default : opt)
2335 if opt and not is_disabler(exe)
2337 manadocs += ['disk-utils/fdisk.8.adoc',
2338 'disk-utils/sfdisk.8.adoc',
2339 'disk-utils/cfdisk.8.adoc']
2340 bashcompletions += ['cfdisk']
2343 opt = not get_option('build-partx').disabled()
2347 include_directories : includes,
2348 link_with : [lib_common],
2349 install_dir : usrsbin_exec_dir,
2351 build_by_default : opt)
2355 include_directories : includes,
2356 link_with : [lib_common],
2357 install_dir : usrsbin_exec_dir,
2359 build_by_default : opt)
2363 include_directories : includes,
2364 link_with : [lib_common],
2365 install_dir : usrsbin_exec_dir,
2367 build_by_default : opt)
2371 include_directories : includes,
2372 link_with : [lib_common,
2375 install_dir : usrsbin_exec_dir,
2377 build_by_default : opt)
2379 exes += [exe, exe2, exe3, exe4]
2380 manadocs += ['disk-utils/addpart.8.adoc',
2381 'disk-utils/delpart.8.adoc',
2382 'disk-utils/resizepart.8.adoc',
2383 'disk-utils/partx.8.adoc']
2384 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2387 ############################################################
2392 include_directories : includes,
2393 link_with : [lib_common],
2394 dependencies : [lib_util,
2398 install_dir : usrbin_exec_dir,
2401 manadocs += ['term-utils/script.1.adoc']
2402 bashcompletions += ['script']
2407 include_directories : includes,
2408 c_args : '-DTEST_SCRIPT',
2409 link_with : [lib_common],
2410 dependencies : [lib_util,
2414 build_by_default : program_tests)
2420 include_directories : includes,
2421 link_with : [lib_common],
2422 dependencies : [lib_util,
2425 install_dir : usrbin_exec_dir,
2428 manadocs += ['term-utils/scriptlive.1.adoc']
2429 bashcompletions += ['scriptlive']
2433 scriptreplay_sources,
2434 include_directories : includes,
2435 link_with : [lib_common],
2436 dependencies : [math_libs],
2437 install_dir : usrbin_exec_dir,
2440 manadocs += ['term-utils/scriptreplay.1.adoc']
2441 bashcompletions += ['scriptreplay']
2443 opt = not get_option('build-agetty').disabled()
2447 include_directories : includes,
2448 link_with : [lib_common, logindefs_c],
2449 dependencies : [BSD ? lib_util : [], lib_systemd],
2450 install_dir : sbindir,
2452 build_by_default : opt)
2455 manadocs += ['term-utils/agetty.8.adoc']
2458 opt = not get_option('build-setterm').disabled()
2462 include_directories : includes,
2463 link_with : [lib_common],
2464 dependencies : [curses_libs],
2465 install_dir : usrbin_exec_dir,
2467 build_by_default : opt)
2470 manadocs += ['term-utils/setterm.1.adoc']
2471 bashcompletions += ['setterm']
2474 opt = not get_option('build-mesg').disabled()
2478 include_directories : includes,
2479 link_with : [lib_common],
2480 install_dir : usrbin_exec_dir,
2482 build_by_default : opt)
2485 manadocs += ['term-utils/mesg.1.adoc']
2486 bashcompletions += ['mesg']
2489 opt = not get_option('build-wall').disabled()
2493 include_directories : includes,
2494 link_with : [lib_common],
2495 dependencies : [lib_systemd],
2496 install_dir : usrbin_exec_dir,
2497 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2499 build_by_default : opt)
2502 manadocs += ['term-utils/wall.1.adoc']
2503 bashcompletions += ['wall']
2506 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2507 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2509 opt = not get_option('build-write').disabled()
2513 include_directories : includes,
2514 link_with : [lib_common],
2515 dependencies : [lib_systemd],
2516 install_dir : usrbin_exec_dir,
2517 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2519 build_by_default : opt)
2522 manadocs += ['term-utils/write.1.adoc']
2523 bashcompletions += ['write']
2526 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2527 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2529 opt = not get_option('build-login').disabled()
2533 include_directories : includes,
2534 link_with : [lib_common, logindefs_c],
2535 dependencies : [lib_pam,
2539 build_by_default : opt)
2540 if not is_disabler(exe)
2542 manadocs += ['login-utils/login.1.adoc']
2545 opt = not get_option('build-sulogin').disabled()
2549 include_directories : includes,
2550 link_with : [lib_common],
2551 dependencies : [lib_crypt,
2553 install_dir : sbindir,
2555 build_by_default : opt)
2556 if not is_disabler(exe)
2558 manadocs += ['login-utils/sulogin.8.adoc']
2564 include_directories : includes,
2565 link_with : [lib_common,
2567 dependencies : [curses_libs],
2568 install_dir : usrbin_exec_dir,
2571 manadocs += ['misc-utils/cal.1.adoc']
2572 bashcompletions += ['cal']
2574 opt = not get_option('build-logger').disabled()
2578 include_directories : includes,
2579 link_with : [lib_common],
2580 dependencies : [lib_systemd],
2581 install_dir : usrbin_exec_dir,
2583 build_by_default : opt)
2584 if opt and not is_disabler(exe)
2586 manadocs += ['misc-utils/logger.1.adoc']
2587 bashcompletions += ['logger']
2593 include_directories : includes,
2594 c_args : '-DTEST_LOGGER',
2595 link_with : [lib_common],
2596 dependencies : [lib_systemd],
2597 build_by_default: program_tests)
2598 if not is_disabler(exe)
2605 include_directories : includes,
2606 install_dir : usrbin_exec_dir,
2609 manadocs += ['misc-utils/look.1.adoc']
2610 bashcompletions += ['look']
2615 include_directories : includes,
2616 link_with : [lib_common],
2617 install_dir : usrbin_exec_dir,
2620 manadocs += ['misc-utils/mcookie.1.adoc']
2621 bashcompletions += ['mcookie']
2623 if build_liblastlog2
2627 include_directories : includes,
2628 link_with : [lib_common, lib_lastlog2],
2629 install_dir : usrbin_exec_dir,
2632 manadocs += ['misc-utils/lastlog2.8.adoc']
2633 bashcompletions += ['lastlog2']
2634 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2635 'liblastlog2/man/ll2_write_entry.3.adoc',
2636 'liblastlog2/man/ll2_read_entry.3.adoc',
2637 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2638 'liblastlog2/man/ll2_read_all.3.adoc',
2639 'liblastlog2/man/ll2_remove_entry.3.adoc',
2640 'liblastlog2/man/ll2_rename_user.3.adoc',
2641 'liblastlog2/man/ll2_update_login_time.3.adoc'
2648 include_directories : includes,
2649 dependencies : [lib_selinux],
2650 install_dir : usrbin_exec_dir,
2653 manadocs += ['misc-utils/namei.1.adoc']
2654 bashcompletions += ['namei']
2659 include_directories : includes,
2660 link_with : [lib_common],
2661 install_dir : usrbin_exec_dir,
2664 manadocs += ['misc-utils/whereis.1.adoc']
2665 bashcompletions += ['whereis']
2670 include_directories : includes,
2671 link_with : [lib_common,
2674 install_dir : usrbin_exec_dir,
2676 if not is_disabler(exe)
2678 manadocs += ['misc-utils/lslocks.8.adoc']
2679 bashcompletions += ['lslocks']
2685 include_directories : includes,
2686 link_with : [lib_common,
2691 dependencies : lib_udev,
2693 if not is_disabler(exe)
2695 manadocs += ['misc-utils/lsblk.8.adoc']
2696 bashcompletions += ['lsblk']
2699 errnos_h = custom_target('errnos.h',
2700 input : 'tools/all_errnos',
2701 output : 'errnos.h',
2702 command : ['tools/all_errnos', cc.cmd_array()]
2706 mq_libs += cc.find_library('rt', required : true)
2710 lsfd_sources, errnos_h,
2711 include_directories : includes,
2712 link_with : [lib_common,
2714 dependencies : mq_libs,
2715 install_dir : usrbin_exec_dir,
2717 if not is_disabler(exe)
2719 manadocs += ['misc-utils/lsfd.1.adoc']
2725 include_directories : includes,
2726 link_with : [lib_common,
2728 install_dir : usrbin_exec_dir,
2730 if not is_disabler(exe)
2732 manadocs += ['misc-utils/uuidgen.1.adoc']
2733 bashcompletions += ['uuidgen']
2739 include_directories : includes,
2740 link_with : [lib_common,
2743 install_dir : usrbin_exec_dir,
2745 if not is_disabler(exe)
2747 manadocs += ['misc-utils/uuidparse.1.adoc']
2748 bashcompletions += ['uuidparse']
2755 include_directories : includes,
2756 link_with : [lib_common,
2758 dependencies : [realtime_libs,
2760 install_dir : usrsbin_exec_dir,
2762 build_by_default : opt)
2766 include_directories : includes,
2767 link_with : [lib_common,
2769 dependencies : thread_libs,
2770 build_by_default : opt and program_tests)
2771 if not is_disabler(exe)
2773 manadocs += ['misc-utils/uuidd.8.adoc']
2774 bashcompletions += ['uuidd']
2777 opt = build_libblkid
2781 include_directories : includes,
2782 link_with : [lib_common,
2784 install_dir : sbindir,
2786 build_by_default : opt)
2787 if opt and not is_disabler(exe)
2789 manadocs += ['misc-utils/blkid.8.adoc']
2790 bashcompletions += ['blkid']
2793 opt = opt and 'blkid' in static_programs
2797 include_directories : includes,
2798 link_with : [lib_common,
2800 install_dir : sbindir,
2802 build_by_default : opt)
2803 if opt and not is_disabler(exe)
2809 'libblkid/samples/mkfs.c',
2810 include_directories : includes,
2811 link_with : lib_blkid)
2812 if not is_disabler(exe)
2817 'sample-partitions',
2818 'libblkid/samples/partitions.c',
2819 include_directories : includes,
2820 link_with : lib_blkid)
2821 if not is_disabler(exe)
2826 'sample-superblocks',
2827 'libblkid/samples/superblocks.c',
2828 include_directories : includes,
2829 link_with : lib_blkid)
2830 if not is_disabler(exe)
2836 'libblkid/samples/topology.c',
2837 include_directories : includes,
2838 link_with : lib_blkid)
2839 if not is_disabler(exe)
2844 'test_blkid_fuzz_sample',
2845 'libblkid/src/fuzz.c',
2846 include_directories: includes,
2847 link_with: lib_blkid,
2848 build_by_default: program_tests)
2849 if not is_disabler(exe)
2853 ############################################################
2858 include_directories : includes,
2859 link_with : [lib_blkid],
2860 install_dir : sbindir,
2862 if not is_disabler(exe)
2864 manadocs += ['misc-utils/findfs.8.adoc']
2865 bashcompletions += ['findfs']
2871 include_directories : includes,
2872 link_with : [lib_common,
2875 install_dir : sbindir,
2877 if not is_disabler(exe)
2879 manadocs += ['misc-utils/wipefs.8.adoc']
2880 bashcompletions += ['wipefs']
2886 include_directories : includes,
2887 link_with : [lib_common,
2891 dependencies : [lib_udev],
2893 if not is_disabler(exe)
2895 manadocs += ['misc-utils/findmnt.8.adoc']
2896 bashcompletions += ['findmnt']
2902 include_directories : includes,
2903 link_with : [lib_common],
2905 if not is_disabler(exe)
2907 manadocs += ['misc-utils/kill.1.adoc']
2910 opt = not get_option('build-rename').disabled()
2914 include_directories : includes,
2915 install_dir : usrbin_exec_dir,
2917 build_by_default : opt)
2918 if opt and not is_disabler(exe)
2920 manadocs += ['misc-utils/rename.1.adoc']
2921 bashcompletions += ['rename']
2927 include_directories : includes,
2928 link_with : [lib_common],
2929 install_dir : usrbin_exec_dir,
2932 manadocs += ['misc-utils/getopt.1.adoc']
2933 bashcompletions += ['getopt']
2938 include_directories : includes,
2939 link_with : [lib_common,
2941 install_dir : usrbin_exec_dir,
2943 if not is_disabler(exe)
2945 manadocs += ['misc-utils/fincore.1.adoc']
2946 bashcompletions += ['fincore']
2952 include_directories : includes,
2953 link_with : [lib_common],
2954 install_dir : usrbin_exec_dir,
2956 if not is_disabler(exe)
2958 manadocs += ['misc-utils/hardlink.1.adoc']
2959 bashcompletions += ['hardlink']
2962 opt = not get_option('build-pipesz').disabled()
2966 include_directories : includes,
2967 link_with : [lib_common],
2968 install_dir : usrbin_exec_dir,
2970 if opt and not is_disabler(exe)
2972 manadocs += ['misc-utils/pipesz.1.adoc']
2973 bashcompletions += ['pipesz']
2979 include_directories : includes,
2980 c_args : '-DTEST_CAL',
2981 link_with : [lib_common,
2983 dependencies : [curses_libs],
2984 build_by_default: program_tests)
2985 if not is_disabler(exe)
2992 include_directories : includes,
2993 link_with : [lib_common],
2994 install_dir : usrbin_exec_dir,
2996 if not is_disabler(exe)
2998 manadocs += ['misc-utils/fadvise.1.adoc']
2999 bashcompletions += ['fadvise']
3002 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3006 include_directories : includes,
3007 link_with : [lib_common],
3008 install_dir : usrbin_exec_dir,
3010 if not is_disabler(exe)
3012 manadocs += ['misc-utils/waitpid.1.adoc']
3013 bashcompletions += ['waitpid']
3017 syscalls_h = custom_target('syscalls.h',
3018 input : 'tools/all_syscalls',
3019 output : 'syscalls.h',
3020 command : ['tools/all_syscalls', cc.cmd_array()]
3023 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3026 'misc-utils/enosys.c', syscalls_h, errnos_h,
3027 include_directories : includes,
3028 link_with : [lib_common],
3029 install_dir : usrbin_exec_dir,
3031 if not is_disabler(exe)
3033 manadocs += ['misc-utils/enosys.1.adoc']
3034 bashcompletions += ['enosys']
3041 include_directories : includes,
3042 link_with : [lib_common, lib_smartcols],
3043 install_dir : usrbin_exec_dir,
3045 if not is_disabler(exe)
3047 manadocs += ['misc-utils/lsclocks.1.adoc']
3048 bashcompletions += ['lsclocks']
3051 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3055 include_directories : includes,
3056 link_with : [lib_common],
3057 install_dir : usrbin_exec_dir,
3059 if not is_disabler(exe)
3061 manadocs += ['misc-utils/exch.1.adoc']
3062 bashcompletions += ['exch']
3066 ############################################################
3068 opt = not get_option('build-schedutils').disabled()
3071 'schedutils/chrt.c',
3072 include_directories : includes,
3073 link_with : lib_common,
3074 install_dir : usrbin_exec_dir,
3076 build_by_default : opt)
3080 'schedutils/ionice.c',
3081 include_directories : includes,
3082 link_with : lib_common,
3083 install_dir : usrbin_exec_dir,
3085 build_by_default : opt)
3089 'schedutils/taskset.c',
3090 include_directories : includes,
3091 link_with : lib_common,
3092 install_dir : usrbin_exec_dir,
3094 build_by_default : opt)
3098 'schedutils/uclampset.c',
3099 include_directories : includes,
3100 link_with : lib_common,
3101 install_dir : usrbin_exec_dir,
3103 build_by_default : opt)
3105 if opt and not is_disabler(exe)
3106 exes += [exe, exe2, exe3, exe4]
3107 manadocs += ['schedutils/chrt.1.adoc',
3108 'schedutils/ionice.1.adoc',
3109 'schedutils/taskset.1.adoc',
3110 'schedutils/uclampset.1.adoc']
3111 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3114 ############################################################
3116 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3121 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3122 include_directories : dir_include,
3123 link_with : lib_common,
3124 build_by_default: program_tests)
3130 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3131 include_directories : dir_include,
3132 link_with : lib_common,
3133 build_by_default: program_tests)
3139 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3140 include_directories : dir_include,
3141 link_with : lib_common,
3142 build_by_default: program_tests)
3148 c_args : ['-DTEST_PROGRAM_MANGLE'],
3149 include_directories : dir_include,
3150 build_by_default: program_tests)
3156 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3157 include_directories : dir_include,
3158 build_by_default: program_tests)
3164 'lib/color-names.c',
3165 c_args : ['-DTEST_PROGRAM_COLORS'],
3166 include_directories : dir_include,
3167 link_with : [lib_common, lib_tcolors],
3168 build_by_default: program_tests)
3174 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3175 include_directories : dir_include,
3176 build_by_default: program_tests)
3179 if conf.get('HAVE_OPENAT').to_string() == '1' \
3180 and conf.get('HAVE_DIRFD').to_string() == '1'
3184 c_args : ['-DTEST_PROGRAM_PROCFS'],
3185 include_directories : dir_include,
3186 link_with : lib_common,
3187 build_by_default: program_tests)
3194 have_cpu_set_t ? 'lib/cpuset.c' : [],
3195 c_args : ['-DTEST_PROGRAM_PATH'],
3196 include_directories : dir_include,
3197 link_with : lib_common,
3198 build_by_default: program_tests)
3202 if conf.get('HAVE_PTY').to_string() == '1'
3207 c_args : ['-DTEST_PROGRAM_PTY'],
3208 include_directories : dir_include,
3209 link_with : [lib_common],
3210 dependencies : [lib_m,
3213 build_by_default: program_tests)
3221 c_args : ['-DTEST_PROGRAM_CPUSET'],
3222 include_directories : dir_include,
3223 build_by_default: program_tests)
3234 have_cpu_set_t ? 'lib/cpuset.c' : [],
3235 c_args : ['-DTEST_PROGRAM_SYSFS'],
3236 include_directories : dir_include,
3237 build_by_default: program_tests)
3243 c_args : ['-DTEST_PROGRAM_PAGER'],
3244 include_directories : dir_include,
3245 build_by_default: program_tests)
3249 'test_linux_version',
3250 'lib/linux_version.c',
3251 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3252 include_directories : dir_include,
3253 build_by_default: program_tests)
3259 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3260 include_directories : dir_include,
3261 build_by_default: program_tests)
3265 'test_canonicalize',
3266 'lib/canonicalize.c',
3267 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3268 include_directories : dir_include,
3269 build_by_default: program_tests)
3276 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3277 include_directories : dir_include,
3278 build_by_default: program_tests)
3284 c_args : ['-DTEST_PROGRAM'],
3285 include_directories : dir_include,
3286 link_with : lib_common,
3287 build_by_default: program_tests)
3293 c_args : ['-DTEST_PROGRAM'],
3294 include_directories : dir_include,
3295 link_with : [lib_common, logindefs_c],
3296 build_by_default: program_tests)
3300 ############################################################
3304 'libuuid/src/test_uuid.c',
3305 include_directories : [dir_include, dir_libuuid],
3306 link_with : lib_uuid,
3307 dependencies : socket_libs,
3308 build_by_default: program_tests)
3309 if not is_disabler(exe)
3313 ############################################################
3315 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3316 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3320 'libfdisk/src/ask.c',
3321 c_args : libfdisk_tests_cflags,
3322 include_directories : lib_fdisk_includes,
3323 link_with : libfdisk_tests_ldadd,
3324 build_by_default: program_tests)
3325 if not is_disabler(exe)
3331 'libfdisk/src/gpt.c',
3332 c_args : libfdisk_tests_cflags,
3333 include_directories : lib_fdisk_includes,
3334 link_with : libfdisk_tests_ldadd,
3335 build_by_default: program_tests)
3336 if not is_disabler(exe)
3342 'libfdisk/src/utils.c',
3343 c_args : libfdisk_tests_cflags,
3344 include_directories : lib_fdisk_includes,
3345 link_with : libfdisk_tests_ldadd,
3346 build_by_default: program_tests)
3347 if not is_disabler(exe)
3352 'test_fdisk_script',
3353 'libfdisk/src/script.c',
3354 c_args : libfdisk_tests_cflags,
3355 include_directories : lib_fdisk_includes,
3356 link_with : libfdisk_tests_ldadd,
3357 build_by_default: program_tests)
3358 if not is_disabler(exe)
3363 'test_fdisk_version',
3364 'libfdisk/src/version.c',
3365 c_args : libfdisk_tests_cflags,
3366 include_directories : lib_fdisk_includes,
3367 link_with : libfdisk_tests_ldadd,
3368 build_by_default: program_tests)
3369 if not is_disabler(exe)
3375 'libfdisk/src/item.c',
3376 c_args : libfdisk_tests_cflags,
3377 include_directories : lib_fdisk_includes,
3378 link_with : libfdisk_tests_ldadd,
3379 build_by_default: program_tests)
3380 if not is_disabler(exe)
3384 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3387 'sample-fdisk-mkpart',
3388 'libfdisk/samples/mkpart.c',
3389 include_directories : lib_fdisk_includes,
3390 link_with : sample_fdisk_ldadd)
3391 if not is_disabler(exe)
3396 'sample-fdisk-mkpart-fullspec',
3397 'libfdisk/samples/mkpart-fullspec.c',
3398 include_directories : lib_fdisk_includes,
3399 link_with : sample_fdisk_ldadd)
3400 if not is_disabler(exe)
3404 ############################################################
3408 'tests/helpers/test_cap.c',
3409 include_directories : includes,
3410 dependencies : [lib_cap_ng],
3411 build_by_default: program_tests)
3412 if not is_disabler(exe)
3418 'tests/helpers/test_mbsencode.c',
3419 include_directories : includes,
3420 link_with : lib_common,
3421 build_by_default: program_tests)
3426 'tests/helpers/test_byteswap.c',
3427 include_directories : includes,
3428 build_by_default: program_tests)
3433 'tests/helpers/test_md5.c',
3435 include_directories : includes,
3436 build_by_default: program_tests)
3441 'tests/helpers/test_sha1.c',
3443 include_directories : includes,
3444 build_by_default: program_tests)
3449 'tests/helpers/test_pathnames.c',
3450 include_directories : includes,
3451 build_by_default: program_tests)
3456 'tests/helpers/test_strerror.c',
3457 include_directories : includes,
3458 build_by_default: program_tests)
3463 'tests/helpers/test_sysinfo.c',
3464 include_directories : includes,
3465 build_by_default: program_tests)
3470 'tests/helpers/test_sigreceive.c',
3471 include_directories : includes,
3472 link_with : lib_common,
3473 build_by_default: program_tests)
3478 'tests/helpers/test_tiocsti.c',
3479 include_directories : includes,
3480 build_by_default: program_tests)
3484 'test_uuid_namespace',
3485 'tests/helpers/test_uuid_namespace.c',
3489 include_directories : includes,
3490 build_by_default: program_tests)
3496 'tests/helpers/test_mkfds.c',
3497 'tests/helpers/test_mkfds.h',
3498 'tests/helpers/test_mkfds_ppoll.c',
3499 include_directories : includes,
3500 dependencies : mq_libs,
3501 build_by_default: program_tests)
3507 'tests/helpers/test_enosys.c',
3508 include_directories : includes,
3509 build_by_default: program_tests)
3512 ############################################################
3514 if conf.get('HAVE_OPENAT').to_string() == '1'
3516 'sample-scols-tree',
3517 'libsmartcols/samples/tree.c',
3518 include_directories : includes,
3519 link_with : [lib_smartcols, lib_common],
3520 build_by_default: program_tests)
3521 if not is_disabler(exe)
3527 'sample-scols-title',
3528 'libsmartcols/samples/title.c',
3529 include_directories : includes,
3530 link_with : [lib_smartcols, lib_common])
3531 if not is_disabler(exe)
3536 'sample-scols-wrap',
3537 'libsmartcols/samples/wrap.c',
3538 include_directories : includes,
3539 link_with : [lib_smartcols, lib_common])
3540 if not is_disabler(exe)
3545 'sample-scols-continuous',
3546 'libsmartcols/samples/continuous.c',
3547 include_directories : includes,
3548 link_with : [lib_smartcols, lib_common])
3549 if not is_disabler(exe)
3554 'sample-scols-continuous-json',
3555 'libsmartcols/samples/continuous-json.c',
3556 include_directories : includes,
3557 link_with : [lib_smartcols, lib_common])
3558 if not is_disabler(exe)
3563 'sample-scols-maxout',
3564 'libsmartcols/samples/maxout.c',
3565 include_directories : includes,
3566 link_with : [lib_smartcols, lib_common])
3567 if not is_disabler(exe)
3572 'sample-scols-fromfile',
3573 'libsmartcols/samples/fromfile.c',
3574 include_directories : includes,
3575 link_with : [lib_smartcols, lib_common])
3576 if not is_disabler(exe)
3581 'sample-scols-grouping-simple',
3582 'libsmartcols/samples/grouping-simple.c',
3583 include_directories : includes,
3584 link_with : [lib_smartcols, lib_common])
3585 if not is_disabler(exe)
3590 'sample-scols-grouping-overlay',
3591 'libsmartcols/samples/grouping-overlay.c',
3592 include_directories : includes,
3593 link_with : [lib_smartcols, lib_common])
3594 if not is_disabler(exe)
3600 'Documentation/boilerplate.c',
3601 include_directories : includes,
3602 build_by_default: program_tests)
3603 if not is_disabler(exe)
3607 ############################################################
3609 # Let the test runner know whether we're running under asan and export
3610 # some paths. We use a file on disk so that it is possible to run the
3611 # test scripts from commandline without setting any variables.
3612 configure_file(output : 'meson.conf',
3617 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3618 python.full_path())])
3620 run_sh = find_program('tests/run.sh')
3624 '--srcdir=' + meson.current_source_dir(),
3625 '--builddir=' + meson.current_build_dir(),
3631 manadocs += ['lib/terminal-colors.d.5.adoc']
3632 manadocs += ['libblkid/libblkid.3.adoc']
3636 'libuuid/man/uuid.3.adoc',
3637 'libuuid/man/uuid_clear.3.adoc',
3638 'libuuid/man/uuid_compare.3.adoc',
3639 'libuuid/man/uuid_copy.3.adoc',
3640 'libuuid/man/uuid_generate.3.adoc',
3641 'libuuid/man/uuid_is_null.3.adoc',
3642 'libuuid/man/uuid_parse.3.adoc',
3643 'libuuid/man/uuid_time.3.adoc',
3644 'libuuid/man/uuid_unparse.3.adoc']
3646 'uuid_generate_random.3': 'uuid_generate.3',
3647 'uuid_generate_time.3': 'uuid_generate.3',
3648 'uuid_generate_time_safe.3': 'uuid_generate.3',
3652 asciidoctor = find_program('asciidoctor', required : false)
3653 if asciidoctor.found()
3654 foreach adoc : manadocs
3655 name = adoc.split('/')[-1]
3656 page = name.split('.adoc')[0]
3657 section = page.split('.')[-1]
3658 mandirn = join_paths(mandir, 'man' + section)
3663 command : [ asciidoctor,
3665 '-a', 'VERSION=' + meson.project_version(),
3666 '-a', 'release-version=' + meson.project_version(),
3667 '-a', 'ADJTIME_PATH=/etc/adjtime',
3668 '-a', 'package-docdir=' + docdir,
3669 '--base-dir=' + meson.current_source_dir(),
3670 '--destination-dir=' + meson.current_build_dir(),
3671 '--load-path', '@SOURCE_ROOT@/tools',
3672 '--require', 'asciidoctor-includetracker',
3676 depfile : page + '.deps',
3678 install_dir : mandirn)
3681 foreach link_name, target : manlinks
3682 link_section = link_name.split('.')[-1]
3683 target_section = target.split('.')[-1]
3684 meson.add_install_script(meson_make_manpage_stub,
3685 join_paths('man' + target_section, target),
3686 join_paths(mandir, 'man' + link_section, link_name))
3690 if bash_completion.found()
3691 foreach completion : bashcompletions
3693 join_paths('bash-completion', completion),
3694 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3697 foreach link_name, target : bashcompletionslinks
3698 meson.add_install_script(meson_make_symlink,
3700 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))