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', prefix : '#include <sys/types.h>')
466 conf.set('HAVE_LOFF_T', have ? 1 : false)
468 have = cc.compiles('''
469 #define _GNU_SOURCE 1
470 #include <langinfo.h>
473 str = nl_langinfo (ALTMON_1);
474 str = nl_langinfo (ALTMON_2);
475 str = nl_langinfo (ALTMON_3);
476 str = nl_langinfo (ALTMON_4);
477 str = nl_langinfo (ALTMON_5);
478 str = nl_langinfo (ALTMON_6);
479 str = nl_langinfo (ALTMON_7);
480 str = nl_langinfo (ALTMON_8);
481 str = nl_langinfo (ALTMON_9);
482 str = nl_langinfo (ALTMON_10);
483 str = nl_langinfo (ALTMON_11);
484 str = nl_langinfo (ALTMON_12);
488 name : 'langinfo.h defines ALTMON_x constants')
489 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
491 have = cc.compiles('''
492 #define _GNU_SOURCE 1
493 #include <langinfo.h>
496 str = nl_langinfo (_NL_ABALTMON_1);
497 str = nl_langinfo (_NL_ABALTMON_2);
498 str = nl_langinfo (_NL_ABALTMON_3);
499 str = nl_langinfo (_NL_ABALTMON_4);
500 str = nl_langinfo (_NL_ABALTMON_5);
501 str = nl_langinfo (_NL_ABALTMON_6);
502 str = nl_langinfo (_NL_ABALTMON_7);
503 str = nl_langinfo (_NL_ABALTMON_8);
504 str = nl_langinfo (_NL_ABALTMON_9);
505 str = nl_langinfo (_NL_ABALTMON_10);
506 str = nl_langinfo (_NL_ABALTMON_11);
507 str = nl_langinfo (_NL_ABALTMON_12);
511 name : 'langinfo.h defines _NL_ABALTMON_x constants')
512 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
514 have = cc.compiles('''
515 #define _GNU_SOURCE 1
516 #include <langinfo.h>
519 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
523 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
524 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
557 landlock_create_ruleset
559 landlock_restrict_self
623 have = cc.has_function(func)
624 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
625 # This makes little sense, but is necessary to avoid warnings about
626 # redefined macros from Python.h, which uses this convention.
627 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
630 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
631 conf.set('AGETTY_RELOAD', have ? 1 : false)
633 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
636 have_dirfd = (cc.has_function('dirfd') or
637 cc.has_header_symbol('dirent.h', 'dirfd',
638 prefix : '#include <sys/types.h>'))
639 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
641 have_ddfd = cc.has_member('DIR', 'dd_fd',
643 #include <sys/types.h>
646 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
648 have = cc.has_member('struct tm', 'tm_gmtoff',
653 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
657 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
658 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
660 have = cc.has_member('struct termios', 'c_line',
661 prefix : '#include <termios.h>')
662 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
664 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
665 prefix : '#include <sys/stat.h>')
666 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
668 have = cc.has_member('struct statx', 'stx_mnt_id',
669 prefix : '#include <sys/stat.h>')
670 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
672 # replacement for AC_STRUCT_TIMEZONE
673 have = cc.has_member('struct tm', 'tm_zone',
674 prefix : '#include <time.h>')
675 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
677 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
678 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
680 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
681 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
683 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
684 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
689 extern char *tzname[];
692 return tzname ? 0 : 1;
694 '''.format(have ? 1 : 0)
695 have = cc.compiles(code, name : 'using tzname[]')
696 conf.set('HAVE_TZNAME', have ? 1 : false)
698 have = cc.sizeof('time_t', prefix : '#include <time.h>')
700 add_global_arguments('-D_TIME_BITS=64', language : 'c')
701 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
703 if get_option('allow-32bit-time')
704 warning('Could not make time_t 64bits wide')
706 error('Could not make time_t 64bits wide')
712 if not cc.has_function('socket')
713 socket_libs += cc.find_library('socket', required : true)
714 have = cc.has_function('socket',
715 dependencies : socket_libs)
717 error('socket() function not available')
722 have = cc.has_function('clock_gettime')
724 realtime_libs += cc.find_library('rt', required : true)
725 have = cc.has_function('clock_gettime',
726 dependencies : realtime_libs)
728 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
730 thread_libs = dependency('threads')
732 have = cc.has_function('timer_create')
734 realtime_libs = [cc.find_library('rt', required : true)]
735 have = cc.has_function('timer_create',
736 dependencies : realtime_libs)
738 realtime_libs += thread_libs
739 have = cc.has_function('timer_create',
740 dependencies : realtime_libs)
743 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
745 have = cc.has_function('setitimer')
746 conf.set('HAVE_SETITIMER', have ? 1 : false)
749 rtas_libs = cc.find_library('rtas', required : false)
750 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
753 if not cc.has_header_symbol('math.h', 'isnan')
754 lib = cc.find_library('m', required : true)
755 if (cc.has_function('isnan', dependencies : lib) and
756 cc.has_function('__isnan', dependencies : lib))
761 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
762 args : '-D_GNU_SOURCE')
763 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
766 extern char *__progname;
768 return (*__progname != 0);
771 have = cc.compiles(code, name : 'using __progname')
772 conf.set('HAVE___PROGNAME', have ? 1 : false)
774 have = conf.get('HAVE_PTY_H').to_string() == '1' \
775 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
776 conf.set('HAVE_PTY', have ? 1 : false)
778 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
779 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
781 build_plymouth_support = get_option('build-plymouth-support')
782 have_tiocglcktrmios = cc.has_header_symbol(
783 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
784 required : build_plymouth_support.enabled())
785 have_sock_cloexec = cc.has_header_symbol(
786 'sys/socket.h', 'SOCK_CLOEXEC',
787 prefix : '#include <sys/types.h>',
788 required : build_plymouth_support.enabled())
789 have_sock_nonblock = cc.has_header_symbol(
790 'sys/socket.h', 'SOCK_NONBLOCK',
791 prefix : '#include <sys/types.h>',
792 required : build_plymouth_support.enabled())
793 have_so_passcred = cc.has_header_symbol(
794 'sys/socket.h', 'SO_PASSCRED',
795 args : ['-D_GNU_SOURCE'],
796 prefix : '#include <sys/types.h>',
797 required : build_plymouth_support.enabled())
799 build_plymouth_support = (not build_plymouth_support.disabled() and
800 have_tiocglcktrmios and
801 have_sock_cloexec and
802 have_sock_nonblock and
804 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
805 summary('plymouth support',
806 build_plymouth_support ? 'enabled' : 'disabled',
807 section : 'components')
809 # check for valid fallocate() function
810 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
811 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
812 # and program can't be linked.
820 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
821 return ret == 0 ? 0 : 1;
824 have = cc.links(code, name : 'fallocate() function')
825 conf.set('HAVE_FALLOCATE', have ? 1 : false)
833 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
834 return ret == 0 ? 0 : 1;
837 have = cc.links(code, name : 'posix_fallocate() function')
838 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
840 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
841 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
842 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
844 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
845 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
846 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
848 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
850 ############################################################
853 fs_search_path = get_option('fs-search-path')
854 fs_search_path_extra = get_option('fs-search-path-extra')
855 if fs_search_path_extra != ''
856 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
858 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
860 systemdsystemunitdir = ''
862 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
865 sysvinit = get_option('sysvinit').enabled()
866 sysvinitrcdir = sysconfdir + '/init.d'
868 program_tests = get_option('program-tests')
870 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
871 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
873 have = get_option('chsh-only-listed')
874 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
876 have = get_option('use-tty-group')
877 conf.set('USE_TTY_GROUP', have ? 1 : false)
879 bison = find_program('bison')
880 flex = find_program('flex')
882 build_hwclock = not get_option('build-hwclock').disabled()
883 bison_gen = generator(
885 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
886 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
888 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
889 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
893 configuration : conf)
895 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
900 '-Waddress-of-packed-member',
901 '-Wdiscarded-qualifiers',
902 '-Wembedded-directive',
905 '-Wimplicit-function-declaration',
906 '-Wmissing-declarations',
907 '-Wmissing-parameter-type',
908 '-Wmissing-prototypes',
910 '-Wno-missing-field-initializers',
911 '-Wold-style-definition',
915 '-Wstrict-prototypes',
918 '-Wunused-but-set-parameter',
919 '-Wunused-but-set-variable',
920 '-Wunused-parameter',
926 foreach compiler_flag : compiler_flags
927 if cc.has_argument(compiler_flag)
928 add_project_arguments(compiler_flag, language : 'c')
936 bashcompletionslinks = {}
942 subdir('libsmartcols')
944 subdir('liblastlog2')
946 subdir('pam_lastlog2')
947 subdir('login-utils')
955 includes = [dir_include,
966 opt = not get_option('build-chfn-chsh').disabled()
971 include_directories : includes,
972 link_with : [lib_common, logindefs_c],
973 dependencies : chfn_chsh_deps,
974 install_dir : usrbin_exec_dir,
975 install_mode : 'rwsr-xr-x',
977 build_by_default : opt)
981 'login-utils/chsh.c',
984 include_directories : includes,
985 link_with : lib_common,
986 dependencies : chfn_chsh_deps,
987 install_dir : usrbin_exec_dir,
988 install_mode : 'rwsr-xr-x',
990 build_by_default : opt)
991 if opt and not is_disabler(exe)
993 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
994 bashcompletions += ['chfn', 'chsh']
999 test_islocal_sources,
1000 include_directories : includes,
1001 c_args : '-DTEST_PROGRAM',
1002 build_by_default : program_tests)
1007 test_consoles_sources,
1008 c_args : ['-DTEST_PROGRAM'],
1009 include_directories : includes,
1010 link_with : lib_common,
1011 build_by_default : program_tests)
1014 opt = not get_option('build-last').disabled()
1018 include_directories : includes,
1019 link_with : [lib_common],
1020 install_dir : usrbin_exec_dir,
1022 build_by_default : opt)
1023 if opt and not is_disabler(exe)
1025 meson.add_install_script(meson_make_symlink,
1027 join_paths(usrbin_exec_dir, 'lastb'))
1028 manadocs += ['login-utils/last.1.adoc']
1029 manlinks += {'lastb.1': 'last.1'}
1030 bashcompletions += ['last']
1031 bashcompletionslinks += {'lastb': 'last'}
1034 opt = not get_option('build-nologin').disabled()
1037 'login-utils/nologin.c',
1038 include_directories : includes,
1039 install_dir : sbindir,
1040 link_with : [lib_common],
1042 build_by_default : opt)
1043 if opt and not is_disabler(exe)
1045 manadocs += ['login-utils/nologin.8.adoc']
1048 opt = not get_option('build-utmpdump').disabled()
1051 'login-utils/utmpdump.c',
1052 include_directories : includes,
1053 link_with : [lib_common],
1054 install_dir : usrbin_exec_dir,
1056 build_by_default : opt)
1057 if opt and not is_disabler(exe)
1059 manadocs += ['login-utils/utmpdump.1.adoc']
1060 bashcompletions += ['utmpdump']
1063 opt = not get_option('build-su').disabled()
1067 'login-utils/su-common.c',
1068 'login-utils/su-common.h',
1072 include_directories : includes,
1073 link_with : [lib_common, logindefs_c],
1074 dependencies : [lib_pam,
1078 install_mode : 'rwsr-xr-x',
1080 build_by_default : opt)
1081 if opt and not is_disabler(exe)
1083 manadocs += ['login-utils/su.1.adoc']
1084 bashcompletions += ['su']
1087 opt = not get_option('build-newgrp').disabled()
1090 'login-utils/newgrp.c',
1091 include_directories : includes,
1092 dependencies : [lib_crypt],
1093 install_dir : usrbin_exec_dir,
1094 install_mode : 'rwsr-xr-x',
1096 build_by_default : opt)
1097 if opt and not is_disabler(exe)
1099 manadocs += ['login-utils/newgrp.1.adoc']
1100 bashcompletions += ['newgrp']
1103 opt = not get_option('build-lslogins').disabled()
1106 'login-utils/lslogins.c',
1107 include_directories : includes,
1108 link_with : [lib_common,
1111 (build_liblastlog2 ? [lib_lastlog2] : []),
1112 dependencies : [lib_selinux,
1114 install_dir : usrbin_exec_dir,
1116 build_by_default : opt)
1117 if opt and not is_disabler(exe)
1119 manadocs += ['login-utils/lslogins.1.adoc']
1120 bashcompletions += ['lslogins']
1123 opt = not get_option('build-vipw').disabled()
1126 'login-utils/vipw.c',
1127 'login-utils/setpwnam.h',
1128 include_directories : includes,
1129 link_with : [lib_common],
1130 dependencies : [lib_selinux],
1131 install_dir : usrbin_exec_dir,
1133 build_by_default : opt)
1134 if opt and not is_disabler(exe)
1136 meson.add_install_script(meson_make_symlink,
1138 join_paths(usrbin_exec_dir, 'vigr'))
1139 manadocs += ['login-utils/vipw.8.adoc']
1140 meson.add_install_script(meson_make_symlink,
1142 join_paths(mandir, 'man8/vigr.8'))
1145 opt = not get_option('build-runuser').disabled()
1148 'login-utils/runuser.c',
1149 'login-utils/su-common.c',
1150 'login-utils/su-common.h',
1154 include_directories : includes,
1155 link_with : [lib_common, logindefs_c],
1156 dependencies : [lib_pam,
1160 install_dir : sbindir,
1162 build_by_default : opt)
1163 if opt and not is_disabler(exe)
1165 manadocs += ['login-utils/runuser.1.adoc']
1166 bashcompletionslinks += {'runuser': 'su'}
1169 ############################################################
1175 include_directories : includes,
1176 link_with : lib_common,
1177 install_dir : usrbin_exec_dir,
1180 manadocs += ['text-utils/col.1.adoc']
1181 bashcompletions += ['col']
1187 include_directories : includes,
1188 install_dir : usrbin_exec_dir,
1191 manadocs += ['text-utils/colcrt.1.adoc']
1192 bashcompletions += ['colcrt']
1197 include_directories : includes,
1198 link_with : lib_common,
1199 install_dir : usrbin_exec_dir,
1202 manadocs += ['text-utils/colrm.1.adoc']
1203 bashcompletions += ['colrm']
1208 include_directories : includes,
1209 install_dir : usrbin_exec_dir,
1212 manadocs += ['text-utils/rev.1.adoc']
1213 bashcompletions += ['rev']
1218 include_directories : includes,
1219 link_with : [lib_common,
1221 install_dir : usrbin_exec_dir,
1223 if not is_disabler(exe)
1225 manadocs += ['text-utils/column.1.adoc']
1226 bashcompletions += ['column']
1229 opt = not get_option('build-line').disabled()
1233 include_directories : includes,
1234 install_dir : usrbin_exec_dir,
1236 build_by_default : opt)
1237 if opt and not is_disabler(exe)
1239 manadocs += ['text-utils/line.1.adoc']
1242 opt = not get_option('build-pg').disabled()
1246 link_with : lib_common,
1247 include_directories : includes,
1248 dependencies : [lib_tinfo,
1250 install_dir : usrbin_exec_dir,
1252 build_by_default : opt)
1253 if opt and not is_disabler(exe)
1255 manadocs += ['text-utils/pg.1.adoc']
1256 bashcompletions += ['pg']
1259 opt = not get_option('build-ul').disabled()
1263 include_directories : includes,
1264 dependencies : [lib_tinfo,
1266 install_dir : usrbin_exec_dir,
1268 build_by_default : opt)
1269 if opt and not is_disabler(exe)
1271 manadocs += ['text-utils/ul.1.adoc']
1272 bashcompletions += ['ul']
1275 opt = not get_option('build-more').disabled()
1279 link_with : [lib_common],
1280 include_directories : includes,
1281 dependencies : [lib_tinfo,
1285 build_by_default : opt)
1289 link_with : [lib_common],
1290 include_directories : includes,
1291 c_args : '-DTEST_PROGRAM',
1292 dependencies : [lib_tinfo,
1295 build_by_default : opt and program_tests)
1297 if opt and not is_disabler(exe)
1299 manadocs += ['text-utils/more.1.adoc']
1300 bashcompletions += ['more']
1306 include_directories : includes,
1307 link_with : [lib_common,
1309 install_dir : usrbin_exec_dir,
1311 if not is_disabler(exe)
1313 manadocs += ['text-utils/hexdump.1.adoc']
1314 bashcompletions += ['hexdump']
1317 opt = not get_option('build-lsmem').disabled()
1321 include_directories : includes,
1322 link_with : [lib_common,
1324 install_dir : usrbin_exec_dir,
1326 build_by_default : opt)
1327 if opt and not is_disabler(exe)
1329 manadocs += ['sys-utils/lsmem.1.adoc']
1330 bashcompletions += ['lsmem']
1333 opt = not get_option('build-chmem').disabled()
1337 include_directories : includes,
1338 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/chmem.8.adoc']
1345 bashcompletions += ['chmem']
1351 include_directories : includes,
1352 link_with : [lib_common],
1353 install_dir : usrbin_exec_dir,
1356 manadocs += ['sys-utils/choom.1.adoc']
1361 include_directories : includes,
1362 link_with : [lib_common],
1363 install_dir : usrbin_exec_dir,
1366 manadocs += ['sys-utils/ipcmk.1.adoc']
1367 bashcompletions += ['ipcmk']
1372 include_directories : includes,
1373 link_with : [lib_common],
1374 install_dir : usrbin_exec_dir,
1377 manadocs += ['sys-utils/ipcrm.1.adoc']
1378 bashcompletions += ['ipcrm']
1380 opt = not get_option('build-ipcs').disabled()
1384 include_directories : includes,
1385 link_with : [lib_common],
1386 install_dir : usrbin_exec_dir,
1388 build_by_default : opt)
1389 if opt and not is_disabler(exe)
1391 manadocs += ['sys-utils/ipcs.1.adoc']
1392 bashcompletions += ['ipcs']
1395 opt = not get_option('build-rfkill').disabled()
1399 include_directories : includes,
1400 link_with : [lib_common,
1402 install_dir : usrsbin_exec_dir,
1404 build_by_default : opt)
1405 if opt and not is_disabler(exe)
1407 manadocs += ['sys-utils/rfkill.8.adoc']
1408 bashcompletions += ['rfkill']
1414 include_directories : includes,
1415 link_with : [lib_common,
1417 install_dir : usrbin_exec_dir,
1419 if not is_disabler(exe)
1421 manadocs += ['sys-utils/renice.1.adoc']
1422 bashcompletions += ['renice']
1428 include_directories: includes,
1429 link_with : [lib_common,
1431 install_dir : usrbin_exec_dir,
1433 if opt and not is_disabler(exe)
1435 manadocs += ['sys-utils/setpgid.1.adoc']
1436 bashcompletions += ['setpgid']
1442 include_directories : includes,
1443 link_with : [lib_common,
1445 install_dir : usrbin_exec_dir,
1447 if opt and not is_disabler(exe)
1449 manadocs += ['sys-utils/setsid.1.adoc']
1450 bashcompletions += ['setsid']
1455 readprofile_sources,
1456 include_directories : includes,
1457 link_with : [lib_common,
1459 install_dir : usrsbin_exec_dir,
1461 if not is_disabler(exe)
1463 manadocs += ['sys-utils/readprofile.8.adoc']
1464 bashcompletions += ['readprofile']
1467 opt = not get_option('build-tunelp').disabled()
1471 include_directories : includes,
1472 link_with : [lib_common],
1473 install_dir : usrsbin_exec_dir,
1475 build_by_default : opt)
1476 if opt and not is_disabler(exe)
1478 manadocs += ['sys-utils/tunelp.8.adoc']
1479 bashcompletions += ['tunelp']
1485 include_directories : includes,
1486 link_with : [lib_common,
1488 install_dir : sbindir,
1490 if not is_disabler(exe)
1492 manadocs += ['sys-utils/fstrim.8.adoc']
1493 bashcompletions += ['fstrim']
1499 include_directories : includes,
1500 link_with : [lib_common,
1503 if not is_disabler(exe)
1505 manadocs += ['sys-utils/dmesg.1.adoc']
1506 bashcompletions += ['dmesg']
1512 include_directories : dir_include,
1513 c_args : '-DTEST_DMESG',
1514 link_with : [lib_common,
1516 build_by_default : program_tests)
1517 if not is_disabler(exe)
1524 include_directories : includes,
1525 link_with : [lib_common],
1526 install_dir : sbindir,
1529 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1530 bashcompletions += ['ctrlaltdel']
1535 include_directories : includes,
1536 install_dir : sbindir,
1539 manadocs += ['sys-utils/fsfreeze.8.adoc']
1540 bashcompletions += ['fsfreeze']
1545 include_directories : includes,
1546 link_with : [lib_common,
1548 install_dir : sbindir,
1551 manadocs += ['sys-utils/blkdiscard.8.adoc']
1552 bashcompletions += ['blkdiscard']
1557 include_directories : includes,
1558 link_with : [lib_common],
1559 install_dir : sbindir,
1562 manadocs += ['sys-utils/blkzone.8.adoc']
1563 bashcompletions += ['blkzone']
1568 include_directories : includes,
1569 link_with : [lib_common],
1570 install_dir : sbindir,
1573 manadocs += ['sys-utils/blkpr.8.adoc']
1578 include_directories : includes,
1579 link_with : [lib_common],
1580 install_dir : usrsbin_exec_dir,
1583 manadocs += ['sys-utils/ldattach.8.adoc']
1584 bashcompletions += ['ldattach']
1589 include_directories : includes,
1590 link_with : [lib_common],
1591 install_dir : usrsbin_exec_dir,
1594 manadocs += ['sys-utils/rtcwake.8.adoc']
1595 bashcompletions += ['rtcwake']
1600 include_directories : includes,
1601 link_with : [lib_common],
1602 install_dir : usrbin_exec_dir,
1605 manadocs += ['sys-utils/setarch.8.adoc']
1606 bashcompletions += ['setarch']
1608 setarch_links = ['uname26', 'linux32', 'linux64']
1609 setarch_links_arch = {
1610 's390x' : ['s390', 's390x'],
1612 'x86_64' : ['i386', 'x86_64'],
1613 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1614 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1615 'mips64' : ['mips', 'mips64', 'mips32'],
1616 'ia64' : ['i386', 'ia64'],
1617 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1619 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1621 foreach link: setarch_links
1622 meson.add_install_script(meson_make_symlink,
1624 join_paths(usrbin_exec_dir, link))
1625 manlinks += {link + '.8': 'setarch.8'}
1628 opt = not get_option('build-eject').disabled()
1632 include_directories : includes,
1633 link_with : [lib_common,
1635 install_dir : usrbin_exec_dir,
1637 build_by_default : opt)
1638 if opt and not is_disabler(exe)
1640 manadocs += ['sys-utils/eject.1.adoc']
1641 bashcompletions += ['eject']
1644 opt = not get_option('build-losetup').disabled()
1648 include_directories : includes,
1649 link_with : [lib_common,
1651 install_dir : sbindir,
1653 build_by_default : opt)
1654 if opt and not is_disabler(exe)
1655 manadocs += ['sys-utils/losetup.8.adoc']
1657 bashcompletions += ['losetup']
1660 opt = opt and 'losetup' in static_programs
1664 include_directories : includes,
1665 link_args : ['--static'],
1666 link_with : [lib_common,
1667 lib_smartcols.get_static_lib()],
1668 install_dir : sbindir,
1670 build_by_default : opt)
1671 if opt and not is_disabler(exe)
1675 opt = not get_option('build-zramctl').disabled()
1679 include_directories : includes,
1680 link_with : [lib_common,
1682 install_dir : sbindir,
1684 build_by_default : opt)
1685 if opt and not is_disabler(exe)
1687 manadocs += ['sys-utils/zramctl.8.adoc']
1688 bashcompletions += ['zramctl']
1694 include_directories : includes,
1695 link_with : [lib_common,
1697 install_dir : usrbin_exec_dir,
1699 if not is_disabler(exe)
1701 manadocs += ['sys-utils/prlimit.1.adoc']
1702 bashcompletions += ['prlimit']
1708 include_directories : includes,
1709 link_with : [lib_common,
1712 install_dir : usrbin_exec_dir,
1714 if not is_disabler(exe)
1716 manadocs += ['sys-utils/lsns.8.adoc']
1717 bashcompletions += ['lsns']
1720 opt = not get_option('build-mount').disabled()
1724 include_directories : includes,
1725 link_with : [lib_common,
1728 dependencies : lib_selinux,
1729 install_mode : 'rwsr-xr-x',
1731 build_by_default : opt)
1735 include_directories : includes,
1736 link_with : [lib_common,
1738 install_mode : 'rwsr-xr-x',
1740 build_by_default : opt)
1741 if opt and not is_disabler(exe)
1743 manadocs += ['sys-utils/fstab.5.adoc',
1744 'sys-utils/mount.8.adoc',
1745 'sys-utils/umount.8.adoc']
1746 bashcompletions += ['mount', 'umount']
1749 opt2 = opt and 'mount' in static_programs
1753 include_directories : includes,
1754 link_args : ['--static'],
1755 link_with : [lib_common,
1756 lib_smartcols_static,
1759 build_by_default : opt2)
1760 if opt2 and not is_disabler(exe)
1764 opt2 = opt and 'umount' in static_programs
1768 include_directories : includes,
1769 link_args : ['--static'],
1770 link_with : [lib_common,
1773 build_by_default : opt2)
1774 if opt2 and not is_disabler(exe)
1783 include_directories : includes,
1784 link_with : [lib_common,
1788 install_dir : sbindir,
1790 if not is_disabler(exe)
1792 manadocs += ['sys-utils/swapon.8.adoc']
1793 bashcompletions += ['swapon']
1799 include_directories : includes,
1800 link_with : [lib_common,
1803 install_dir : sbindir,
1805 if not is_disabler(exe)
1807 manlinks += {'swapoff.8': 'swapon.8'}
1808 bashcompletions += ['swapoff']
1814 include_directories : includes,
1815 link_with : [lib_common,
1817 dependencies : [rtas_libs],
1818 install_dir : usrbin_exec_dir,
1820 if not is_disabler(exe)
1822 manadocs += ['sys-utils/lscpu.1.adoc']
1823 bashcompletions += ['lscpu']
1829 include_directories : includes,
1830 link_with : [lib_common],
1831 install_dir : sbindir,
1834 manadocs += ['sys-utils/chcpu.8.adoc']
1835 bashcompletions += ['chcpu']
1840 include_directories : includes,
1841 link_with : [lib_common,
1844 if not is_disabler(exe)
1846 manadocs += ['sys-utils/wdctl.8.adoc']
1847 bashcompletions += ['wdctl']
1850 opt = not get_option('build-mountpoint').disabled()
1854 include_directories : includes,
1855 link_with : [lib_mount],
1857 build_by_default : opt)
1858 if opt and not is_disabler(exe)
1860 manadocs += ['sys-utils/mountpoint.1.adoc']
1861 bashcompletions += ['mountpoint']
1864 opt = not get_option('build-fallocate').disabled()
1868 include_directories : includes,
1869 link_with : [lib_common],
1870 install_dir : usrbin_exec_dir,
1872 build_by_default : opt)
1873 if opt and not is_disabler(exe)
1875 manadocs += ['sys-utils/fallocate.1.adoc']
1876 bashcompletions += ['fallocate']
1879 opt = not get_option('build-pivot_root').disabled()
1883 include_directories : includes,
1884 install_dir : sbindir,
1886 build_by_default : opt)
1887 if opt and not is_disabler(exe)
1889 manadocs += ['sys-utils/pivot_root.8.adoc']
1890 bashcompletions += ['pivot_root']
1893 opt = not get_option('build-switch_root').disabled()
1894 if opt and not have_dirfd and not have_ddfd
1895 error('neither dirfd nor ddfd are available')
1899 switch_root_sources,
1900 include_directories : includes,
1901 install_dir : sbindir,
1903 build_by_default : opt)
1904 if opt and not is_disabler(exe)
1906 manadocs += ['sys-utils/switch_root.8.adoc']
1909 opt = not get_option('build-unshare').disabled()
1913 include_directories : includes,
1914 link_with : [lib_common],
1915 install_dir : usrbin_exec_dir,
1917 build_by_default : opt)
1918 if opt and not is_disabler(exe)
1920 manadocs += ['sys-utils/unshare.1.adoc']
1921 bashcompletions += ['unshare']
1924 opt = opt and 'unshare' in static_programs
1928 include_directories : includes,
1929 link_with : [lib_common],
1930 install_dir : usrbin_exec_dir,
1932 build_by_default : opt)
1933 if opt and not is_disabler(exe)
1937 opt = not get_option('build-nsenter').disabled()
1941 include_directories : includes,
1942 link_with : [lib_common],
1943 dependencies : [lib_selinux],
1944 install_dir : usrbin_exec_dir,
1946 build_by_default : opt)
1947 if opt and not is_disabler(exe)
1949 manadocs += ['sys-utils/nsenter.1.adoc']
1950 bashcompletions += ['nsenter']
1953 opt = opt and 'nsenter' in static_programs
1957 include_directories : includes,
1958 link_with : [lib_common],
1959 dependencies : [lib_selinux],
1960 install_dir : usrbin_exec_dir,
1962 build_by_default : opt)
1963 if opt and not is_disabler(exe)
1967 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1971 include_directories : includes,
1972 link_with : [lib_common],
1973 dependencies : [lib_cap_ng],
1974 install_dir : usrbin_exec_dir,
1976 build_by_default : opt)
1977 if opt and not is_disabler(exe)
1979 manadocs += ['sys-utils/setpriv.1.adoc']
1980 bashcompletions += ['setpriv']
1986 include_directories : includes,
1987 link_with : [lib_common],
1988 dependencies : realtime_libs,
1989 install_dir : usrbin_exec_dir,
1992 manadocs += ['sys-utils/flock.1.adoc']
1993 bashcompletions += ['flock']
1995 opt = not get_option('build-lsirq').disabled()
1999 include_directories : includes,
2000 link_with : [lib_common,
2002 install_dir : usrbin_exec_dir,
2004 build_by_default : opt)
2005 if opt and not is_disabler(exe)
2007 manadocs += ['sys-utils/lsirq.1.adoc']
2008 bashcompletions += ['lsirq']
2011 opt = not get_option('build-irqtop').disabled()
2015 include_directories : includes,
2016 dependencies : [realtime_libs, curses_libs],
2017 link_with : [lib_common,
2020 install_dir : usrbin_exec_dir,
2022 build_by_default : opt)
2023 if opt and not is_disabler(exe)
2025 manadocs += ['sys-utils/irqtop.1.adoc']
2026 bashcompletions += ['irqtop']
2029 opt = not get_option('build-ipcs').disabled()
2033 include_directories : includes,
2034 link_with : [lib_common,
2036 install_dir : usrbin_exec_dir,
2038 build_by_default : opt)
2039 if opt and not is_disabler(exe)
2041 manadocs += ['sys-utils/lsipc.1.adoc']
2042 bashcompletions += ['lsipc']
2049 include_directories : includes,
2050 link_with : [lib_common],
2051 dependencies : [lib_m,
2053 install_dir : sbindir,
2055 build_by_default : opt)
2056 if opt and not is_disabler(exe)
2058 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2059 bashcompletions += ['hwclock']
2065 include_directories : includes,
2066 install_dir : sbindir,
2069 manadocs += ['disk-utils/mkfs.8.adoc']
2070 bashcompletions += ['mkfs']
2072 opt = not get_option('build-bfs').disabled()
2076 include_directories : includes,
2077 link_with : [lib_common],
2078 install_dir : sbindir,
2080 build_by_default : opt)
2081 if opt and not is_disabler(exe)
2083 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2084 bashcompletions += ['mkfs.bfs']
2090 include_directories : includes,
2091 link_with : [lib_common],
2092 install_dir : usrbin_exec_dir,
2095 manadocs += ['disk-utils/isosize.8.adoc']
2096 bashcompletions += ['isosize']
2101 include_directories : includes,
2102 link_with : [lib_common,
2105 dependencies: [lib_selinux],
2106 install_dir : sbindir,
2108 if not is_disabler(exe)
2110 manadocs += ['disk-utils/mkswap.8.adoc']
2111 bashcompletions += ['mkswap']
2117 include_directories : includes,
2118 link_with : [lib_common,
2121 install_dir : sbindir,
2123 if not is_disabler(exe)
2125 manadocs += ['disk-utils/swaplabel.8.adoc']
2126 bashcompletions += ['swaplabel']
2129 opt = not get_option('build-fsck').disabled()
2133 include_directories : includes,
2134 link_with : [lib_common,
2137 dependencies : realtime_libs,
2138 install_dir : sbindir,
2140 build_by_default : opt)
2141 if opt and not is_disabler(exe)
2143 manadocs += ['disk-utils/fsck.8.adoc']
2144 bashcompletions += ['fsck']
2147 opt = not get_option('build-minix').disabled()
2151 include_directories : includes,
2152 link_with : [lib_common],
2153 install_dir : sbindir,
2155 build_by_default : opt)
2159 include_directories : includes,
2160 c_args : '-DTEST_SCRIPT',
2161 link_with : [lib_common],
2162 build_by_default : opt and program_tests)
2166 include_directories : includes,
2167 link_with : [lib_common],
2168 install_dir : sbindir,
2170 build_by_default : opt)
2171 if opt and not is_disabler(exe)
2172 exes += [exe, exe2, exe3]
2173 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2174 bashcompletions += ['mkfs.minix', 'fsck.minix']
2177 opt = not get_option('build-cramfs').disabled()
2180 mkfs_cramfs_sources,
2181 include_directories : includes,
2182 link_with : [lib_common],
2183 dependencies : [lib_z],
2184 install_dir : sbindir,
2186 build_by_default : opt)
2189 fsck_cramfs_sources,
2190 include_directories : includes,
2191 link_with : [lib_common],
2192 dependencies : [lib_z],
2193 install_dir : sbindir,
2195 build_by_default : opt)
2196 if not is_disabler(exe)
2198 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2199 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2202 opt = not get_option('build-raw').disabled()
2204 cc.has_header('linux/raw.h', required: opt)
2209 include_directories : includes,
2210 install_dir : sbindir,
2212 build_by_default : opt)
2213 if opt and not is_disabler(exe)
2215 manadocs += ['disk-utils/raw.8.adoc']
2216 bashcompletions += ['raw']
2219 opt = not get_option('build-fdformat').disabled()
2223 include_directories : includes,
2224 link_with : [lib_common],
2225 install_dir : usrsbin_exec_dir,
2227 build_by_default : opt)
2228 if opt and not is_disabler(exe)
2230 manadocs += ['disk-utils/fdformat.8.adoc']
2231 bashcompletions += ['fdformat']
2237 include_directories : includes,
2238 link_with : [lib_common],
2239 install_dir : sbindir,
2241 manadocs += ['disk-utils/blockdev.8.adoc']
2242 bashcompletions += ['blockdev']
2244 opt = not get_option('build-fdisks').disabled()
2245 if opt and not have_dirfd and not have_ddfd
2246 error('neither dirfd nor ddfd are available')
2251 include_directories : includes,
2252 link_with : [lib_common,
2256 dependencies : [lib_readline],
2257 install_dir : sbindir,
2259 build_by_default : opt)
2260 if opt and not is_disabler(exe)
2262 bashcompletions += ['fdisk']
2265 opt2 = opt and 'fdisk' in static_programs
2269 link_args : ['--static'],
2270 include_directories : includes,
2271 link_with : [lib_common,
2274 lib_smartcols.get_static_lib()],
2275 dependencies : [lib_readline_static],
2276 install_dir : sbindir,
2278 build_by_default : opt2)
2279 if opt2 and not is_disabler(exe)
2286 include_directories : includes,
2287 link_with : [lib_common,
2291 dependencies : [lib_readline],
2292 install_dir : sbindir,
2294 build_by_default : opt)
2295 if opt and not is_disabler(exe)
2297 bashcompletions += ['sfdisk']
2300 opt2 = opt and 'sfdisk' in static_programs
2304 include_directories : includes,
2305 link_with : [lib_common,
2308 lib_smartcols.get_static_lib()],
2309 dependencies : [lib_readline_static],
2310 install_dir : sbindir,
2312 build_by_default : opt2)
2313 if opt2 and not is_disabler(exe)
2320 include_directories : includes,
2321 link_with : [lib_common,
2326 dependencies : [curses_libs],
2327 install_dir : sbindir,
2329 build_by_default : opt)
2330 if opt and not is_disabler(exe)
2332 manadocs += ['disk-utils/fdisk.8.adoc',
2333 'disk-utils/sfdisk.8.adoc',
2334 'disk-utils/cfdisk.8.adoc']
2335 bashcompletions += ['cfdisk']
2338 opt = not get_option('build-partx').disabled()
2342 include_directories : includes,
2343 link_with : [lib_common],
2344 install_dir : usrsbin_exec_dir,
2346 build_by_default : opt)
2350 include_directories : includes,
2351 link_with : [lib_common],
2352 install_dir : usrsbin_exec_dir,
2354 build_by_default : opt)
2358 include_directories : includes,
2359 link_with : [lib_common],
2360 install_dir : usrsbin_exec_dir,
2362 build_by_default : opt)
2366 include_directories : includes,
2367 link_with : [lib_common,
2370 install_dir : usrsbin_exec_dir,
2372 build_by_default : opt)
2374 exes += [exe, exe2, exe3, exe4]
2375 manadocs += ['disk-utils/addpart.8.adoc',
2376 'disk-utils/delpart.8.adoc',
2377 'disk-utils/resizepart.8.adoc',
2378 'disk-utils/partx.8.adoc']
2379 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2382 ############################################################
2387 include_directories : includes,
2388 link_with : [lib_common],
2389 dependencies : [lib_util,
2393 install_dir : usrbin_exec_dir,
2396 manadocs += ['term-utils/script.1.adoc']
2397 bashcompletions += ['script']
2402 include_directories : includes,
2403 c_args : '-DTEST_SCRIPT',
2404 link_with : [lib_common],
2405 dependencies : [lib_util,
2409 build_by_default : program_tests)
2415 include_directories : includes,
2416 link_with : [lib_common],
2417 dependencies : [lib_util,
2420 install_dir : usrbin_exec_dir,
2423 manadocs += ['term-utils/scriptlive.1.adoc']
2424 bashcompletions += ['scriptlive']
2428 scriptreplay_sources,
2429 include_directories : includes,
2430 link_with : [lib_common],
2431 dependencies : [math_libs],
2432 install_dir : usrbin_exec_dir,
2435 manadocs += ['term-utils/scriptreplay.1.adoc']
2436 bashcompletions += ['scriptreplay']
2438 opt = not get_option('build-agetty').disabled()
2442 include_directories : includes,
2443 link_with : [lib_common, logindefs_c],
2444 dependencies : [BSD ? lib_util : [], lib_systemd],
2445 install_dir : sbindir,
2447 build_by_default : opt)
2450 manadocs += ['term-utils/agetty.8.adoc']
2453 opt = not get_option('build-setterm').disabled()
2457 include_directories : includes,
2458 link_with : [lib_common],
2459 dependencies : [curses_libs],
2460 install_dir : usrbin_exec_dir,
2462 build_by_default : opt)
2465 manadocs += ['term-utils/setterm.1.adoc']
2466 bashcompletions += ['setterm']
2469 opt = not get_option('build-mesg').disabled()
2473 include_directories : includes,
2474 link_with : [lib_common],
2475 install_dir : usrbin_exec_dir,
2477 build_by_default : opt)
2480 manadocs += ['term-utils/mesg.1.adoc']
2481 bashcompletions += ['mesg']
2484 opt = not get_option('build-wall').disabled()
2488 include_directories : includes,
2489 link_with : [lib_common],
2490 dependencies : [lib_systemd],
2491 install_dir : usrbin_exec_dir,
2492 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2494 build_by_default : opt)
2497 manadocs += ['term-utils/wall.1.adoc']
2498 bashcompletions += ['wall']
2501 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2502 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2504 opt = not get_option('build-write').disabled()
2508 include_directories : includes,
2509 link_with : [lib_common],
2510 dependencies : [lib_systemd],
2511 install_dir : usrbin_exec_dir,
2512 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2514 build_by_default : opt)
2517 manadocs += ['term-utils/write.1.adoc']
2518 bashcompletions += ['write']
2521 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2522 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2524 opt = not get_option('build-login').disabled()
2528 include_directories : includes,
2529 link_with : [lib_common, logindefs_c],
2530 dependencies : [lib_pam,
2534 build_by_default : opt)
2535 if not is_disabler(exe)
2537 manadocs += ['login-utils/login.1.adoc']
2540 opt = not get_option('build-sulogin').disabled()
2544 include_directories : includes,
2545 link_with : [lib_common],
2546 dependencies : [lib_crypt,
2548 install_dir : sbindir,
2550 build_by_default : opt)
2551 if not is_disabler(exe)
2553 manadocs += ['login-utils/sulogin.8.adoc']
2559 include_directories : includes,
2560 link_with : [lib_common,
2562 dependencies : [curses_libs],
2563 install_dir : usrbin_exec_dir,
2566 manadocs += ['misc-utils/cal.1.adoc']
2567 bashcompletions += ['cal']
2569 opt = not get_option('build-logger').disabled()
2573 include_directories : includes,
2574 link_with : [lib_common],
2575 dependencies : [lib_systemd],
2576 install_dir : usrbin_exec_dir,
2578 build_by_default : opt)
2579 if opt and not is_disabler(exe)
2581 manadocs += ['misc-utils/logger.1.adoc']
2582 bashcompletions += ['logger']
2588 include_directories : includes,
2589 c_args : '-DTEST_LOGGER',
2590 link_with : [lib_common],
2591 dependencies : [lib_systemd],
2592 build_by_default: program_tests)
2593 if not is_disabler(exe)
2600 include_directories : includes,
2601 install_dir : usrbin_exec_dir,
2604 manadocs += ['misc-utils/look.1.adoc']
2605 bashcompletions += ['look']
2610 include_directories : includes,
2611 link_with : [lib_common],
2612 install_dir : usrbin_exec_dir,
2615 manadocs += ['misc-utils/mcookie.1.adoc']
2616 bashcompletions += ['mcookie']
2618 if build_liblastlog2
2622 include_directories : includes,
2623 link_with : [lib_common, lib_lastlog2],
2624 install_dir : usrbin_exec_dir,
2627 manadocs += ['misc-utils/lastlog2.8.adoc']
2628 bashcompletions += ['lastlog2']
2629 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2630 'liblastlog2/man/ll2_write_entry.3.adoc',
2631 'liblastlog2/man/ll2_read_entry.3.adoc',
2632 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2633 'liblastlog2/man/ll2_read_all.3.adoc',
2634 'liblastlog2/man/ll2_remove_entry.3.adoc',
2635 'liblastlog2/man/ll2_rename_user.3.adoc',
2636 'liblastlog2/man/ll2_update_login_time.3.adoc'
2643 include_directories : includes,
2644 dependencies : [lib_selinux],
2645 install_dir : usrbin_exec_dir,
2648 manadocs += ['misc-utils/namei.1.adoc']
2649 bashcompletions += ['namei']
2654 include_directories : includes,
2655 link_with : [lib_common],
2656 install_dir : usrbin_exec_dir,
2659 manadocs += ['misc-utils/whereis.1.adoc']
2660 bashcompletions += ['whereis']
2665 include_directories : includes,
2666 link_with : [lib_common,
2669 install_dir : usrbin_exec_dir,
2671 if not is_disabler(exe)
2673 manadocs += ['misc-utils/lslocks.8.adoc']
2674 bashcompletions += ['lslocks']
2680 include_directories : includes,
2681 link_with : [lib_common,
2686 dependencies : lib_udev,
2688 if not is_disabler(exe)
2690 manadocs += ['misc-utils/lsblk.8.adoc']
2691 bashcompletions += ['lsblk']
2694 errnos_h = custom_target('errnos.h',
2695 input : 'tools/all_errnos',
2696 output : 'errnos.h',
2697 command : ['tools/all_errnos', cc.cmd_array()]
2701 mq_libs += cc.find_library('rt', required : true)
2705 lsfd_sources, errnos_h,
2706 include_directories : includes,
2707 link_with : [lib_common,
2709 dependencies : mq_libs,
2710 install_dir : usrbin_exec_dir,
2712 if not is_disabler(exe)
2714 manadocs += ['misc-utils/lsfd.1.adoc']
2720 include_directories : includes,
2721 link_with : [lib_common,
2723 install_dir : usrbin_exec_dir,
2725 if not is_disabler(exe)
2727 manadocs += ['misc-utils/uuidgen.1.adoc']
2728 bashcompletions += ['uuidgen']
2734 include_directories : includes,
2735 link_with : [lib_common,
2738 install_dir : usrbin_exec_dir,
2740 if not is_disabler(exe)
2742 manadocs += ['misc-utils/uuidparse.1.adoc']
2743 bashcompletions += ['uuidparse']
2750 include_directories : includes,
2751 link_with : [lib_common,
2753 dependencies : [realtime_libs,
2755 install_dir : usrsbin_exec_dir,
2757 build_by_default : opt)
2761 include_directories : includes,
2762 link_with : [lib_common,
2764 dependencies : thread_libs,
2765 build_by_default : opt and program_tests)
2766 if not is_disabler(exe)
2768 manadocs += ['misc-utils/uuidd.8.adoc']
2769 bashcompletions += ['uuidd']
2772 opt = build_libblkid
2776 include_directories : includes,
2777 link_with : [lib_common,
2779 install_dir : sbindir,
2781 build_by_default : opt)
2782 if opt and not is_disabler(exe)
2784 manadocs += ['misc-utils/blkid.8.adoc']
2785 bashcompletions += ['blkid']
2788 opt = opt and 'blkid' in static_programs
2792 include_directories : includes,
2793 link_with : [lib_common,
2795 install_dir : sbindir,
2797 build_by_default : opt)
2798 if opt and not is_disabler(exe)
2804 'libblkid/samples/mkfs.c',
2805 include_directories : includes,
2806 link_with : lib_blkid)
2807 if not is_disabler(exe)
2812 'sample-partitions',
2813 'libblkid/samples/partitions.c',
2814 include_directories : includes,
2815 link_with : lib_blkid)
2816 if not is_disabler(exe)
2821 'sample-superblocks',
2822 'libblkid/samples/superblocks.c',
2823 include_directories : includes,
2824 link_with : lib_blkid)
2825 if not is_disabler(exe)
2831 'libblkid/samples/topology.c',
2832 include_directories : includes,
2833 link_with : lib_blkid)
2834 if not is_disabler(exe)
2839 'test_blkid_fuzz_sample',
2840 'libblkid/src/fuzz.c',
2841 include_directories: includes,
2842 link_with: lib_blkid,
2843 build_by_default: program_tests)
2844 if not is_disabler(exe)
2848 ############################################################
2853 include_directories : includes,
2854 link_with : [lib_blkid],
2855 install_dir : sbindir,
2857 if not is_disabler(exe)
2859 manadocs += ['misc-utils/findfs.8.adoc']
2860 bashcompletions += ['findfs']
2866 include_directories : includes,
2867 link_with : [lib_common,
2870 install_dir : sbindir,
2872 if not is_disabler(exe)
2874 manadocs += ['misc-utils/wipefs.8.adoc']
2875 bashcompletions += ['wipefs']
2881 include_directories : includes,
2882 link_with : [lib_common,
2886 dependencies : [lib_udev],
2888 if not is_disabler(exe)
2890 manadocs += ['misc-utils/findmnt.8.adoc']
2891 bashcompletions += ['findmnt']
2897 include_directories : includes,
2898 link_with : [lib_common],
2900 if not is_disabler(exe)
2902 manadocs += ['misc-utils/kill.1.adoc']
2905 opt = not get_option('build-rename').disabled()
2909 include_directories : includes,
2910 install_dir : usrbin_exec_dir,
2912 build_by_default : opt)
2913 if opt and not is_disabler(exe)
2915 manadocs += ['misc-utils/rename.1.adoc']
2916 bashcompletions += ['rename']
2922 include_directories : includes,
2923 link_with : [lib_common],
2924 install_dir : usrbin_exec_dir,
2927 manadocs += ['misc-utils/getopt.1.adoc']
2928 bashcompletions += ['getopt']
2933 include_directories : includes,
2934 link_with : [lib_common,
2936 install_dir : usrbin_exec_dir,
2938 if not is_disabler(exe)
2940 manadocs += ['misc-utils/fincore.1.adoc']
2941 bashcompletions += ['fincore']
2947 include_directories : includes,
2948 link_with : [lib_common],
2949 install_dir : usrbin_exec_dir,
2951 if not is_disabler(exe)
2953 manadocs += ['misc-utils/hardlink.1.adoc']
2954 bashcompletions += ['hardlink']
2957 opt = not get_option('build-pipesz').disabled()
2961 include_directories : includes,
2962 link_with : [lib_common],
2963 install_dir : usrbin_exec_dir,
2965 if opt and not is_disabler(exe)
2967 manadocs += ['misc-utils/pipesz.1.adoc']
2968 bashcompletions += ['pipesz']
2974 include_directories : includes,
2975 c_args : '-DTEST_CAL',
2976 link_with : [lib_common,
2978 dependencies : [curses_libs],
2979 build_by_default: program_tests)
2980 if not is_disabler(exe)
2987 include_directories : includes,
2988 link_with : [lib_common],
2989 install_dir : usrbin_exec_dir,
2991 if not is_disabler(exe)
2993 manadocs += ['misc-utils/fadvise.1.adoc']
2994 bashcompletions += ['fadvise']
2997 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3001 include_directories : includes,
3002 link_with : [lib_common],
3003 install_dir : usrbin_exec_dir,
3005 if not is_disabler(exe)
3007 manadocs += ['misc-utils/waitpid.1.adoc']
3008 bashcompletions += ['waitpid']
3012 syscalls_h = custom_target('syscalls.h',
3013 input : 'tools/all_syscalls',
3014 output : 'syscalls.h',
3015 command : ['tools/all_syscalls', cc.cmd_array()]
3018 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3021 'misc-utils/enosys.c', syscalls_h,
3022 include_directories : includes,
3023 link_with : [lib_common],
3024 install_dir : usrbin_exec_dir,
3026 if not is_disabler(exe)
3028 manadocs += ['misc-utils/enosys.1.adoc']
3029 bashcompletions += ['enosys']
3036 include_directories : includes,
3037 link_with : [lib_common, lib_smartcols],
3038 install_dir : usrbin_exec_dir,
3040 if not is_disabler(exe)
3042 manadocs += ['misc-utils/lsclocks.1.adoc']
3043 bashcompletions += ['lsclocks']
3046 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3050 include_directories : includes,
3051 link_with : [lib_common],
3052 install_dir : usrbin_exec_dir,
3054 if not is_disabler(exe)
3056 manadocs += ['misc-utils/exch.1.adoc']
3057 bashcompletions += ['exch']
3061 ############################################################
3063 opt = not get_option('build-schedutils').disabled()
3066 'schedutils/chrt.c',
3067 include_directories : includes,
3068 link_with : lib_common,
3069 install_dir : usrbin_exec_dir,
3071 build_by_default : opt)
3075 'schedutils/ionice.c',
3076 include_directories : includes,
3077 link_with : lib_common,
3078 install_dir : usrbin_exec_dir,
3080 build_by_default : opt)
3084 'schedutils/taskset.c',
3085 include_directories : includes,
3086 link_with : lib_common,
3087 install_dir : usrbin_exec_dir,
3089 build_by_default : opt)
3093 'schedutils/uclampset.c',
3094 include_directories : includes,
3095 link_with : lib_common,
3096 install_dir : usrbin_exec_dir,
3098 build_by_default : opt)
3100 if opt and not is_disabler(exe)
3101 exes += [exe, exe2, exe3, exe4]
3102 manadocs += ['schedutils/chrt.1.adoc',
3103 'schedutils/ionice.1.adoc',
3104 'schedutils/taskset.1.adoc',
3105 'schedutils/uclampset.1.adoc']
3106 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3109 ############################################################
3111 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3116 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3117 include_directories : dir_include,
3118 link_with : lib_common,
3119 build_by_default: program_tests)
3125 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3126 include_directories : dir_include,
3127 link_with : lib_common,
3128 build_by_default: program_tests)
3134 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3135 include_directories : dir_include,
3136 link_with : lib_common,
3137 build_by_default: program_tests)
3143 c_args : ['-DTEST_PROGRAM_MANGLE'],
3144 include_directories : dir_include,
3145 build_by_default: program_tests)
3151 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3152 include_directories : dir_include,
3153 build_by_default: program_tests)
3159 'lib/color-names.c',
3160 c_args : ['-DTEST_PROGRAM_COLORS'],
3161 include_directories : dir_include,
3162 link_with : [lib_common, lib_tcolors],
3163 build_by_default: program_tests)
3169 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3170 include_directories : dir_include,
3171 build_by_default: program_tests)
3174 if conf.get('HAVE_OPENAT').to_string() == '1' \
3175 and conf.get('HAVE_DIRFD').to_string() == '1'
3179 c_args : ['-DTEST_PROGRAM_PROCFS'],
3180 include_directories : dir_include,
3181 link_with : lib_common,
3182 build_by_default: program_tests)
3189 have_cpu_set_t ? 'lib/cpuset.c' : [],
3190 c_args : ['-DTEST_PROGRAM_PATH'],
3191 include_directories : dir_include,
3192 link_with : lib_common,
3193 build_by_default: program_tests)
3197 if conf.get('HAVE_PTY').to_string() == '1'
3202 c_args : ['-DTEST_PROGRAM_PTY'],
3203 include_directories : dir_include,
3204 link_with : [lib_common],
3205 dependencies : [lib_m,
3208 build_by_default: program_tests)
3216 c_args : ['-DTEST_PROGRAM_CPUSET'],
3217 include_directories : dir_include,
3218 build_by_default: program_tests)
3229 have_cpu_set_t ? 'lib/cpuset.c' : [],
3230 c_args : ['-DTEST_PROGRAM_SYSFS'],
3231 include_directories : dir_include,
3232 build_by_default: program_tests)
3238 c_args : ['-DTEST_PROGRAM_PAGER'],
3239 include_directories : dir_include,
3240 build_by_default: program_tests)
3244 'test_linux_version',
3245 'lib/linux_version.c',
3246 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3247 include_directories : dir_include,
3248 build_by_default: program_tests)
3254 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3255 include_directories : dir_include,
3256 build_by_default: program_tests)
3260 'test_canonicalize',
3261 'lib/canonicalize.c',
3262 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3263 include_directories : dir_include,
3264 build_by_default: program_tests)
3271 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3272 include_directories : dir_include,
3273 build_by_default: program_tests)
3279 c_args : ['-DTEST_PROGRAM'],
3280 include_directories : dir_include,
3281 link_with : lib_common,
3282 build_by_default: program_tests)
3288 c_args : ['-DTEST_PROGRAM'],
3289 include_directories : dir_include,
3290 link_with : [lib_common, logindefs_c],
3291 build_by_default: program_tests)
3295 ############################################################
3299 'libuuid/src/test_uuid.c',
3300 include_directories : [dir_include, dir_libuuid],
3301 link_with : lib_uuid,
3302 dependencies : socket_libs,
3303 build_by_default: program_tests)
3304 if not is_disabler(exe)
3308 ############################################################
3310 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3311 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3315 'libfdisk/src/ask.c',
3316 c_args : libfdisk_tests_cflags,
3317 include_directories : lib_fdisk_includes,
3318 link_with : libfdisk_tests_ldadd,
3319 build_by_default: program_tests)
3320 if not is_disabler(exe)
3326 'libfdisk/src/gpt.c',
3327 c_args : libfdisk_tests_cflags,
3328 include_directories : lib_fdisk_includes,
3329 link_with : libfdisk_tests_ldadd,
3330 build_by_default: program_tests)
3331 if not is_disabler(exe)
3337 'libfdisk/src/utils.c',
3338 c_args : libfdisk_tests_cflags,
3339 include_directories : lib_fdisk_includes,
3340 link_with : libfdisk_tests_ldadd,
3341 build_by_default: program_tests)
3342 if not is_disabler(exe)
3347 'test_fdisk_script',
3348 'libfdisk/src/script.c',
3349 c_args : libfdisk_tests_cflags,
3350 include_directories : lib_fdisk_includes,
3351 link_with : libfdisk_tests_ldadd,
3352 build_by_default: program_tests)
3353 if not is_disabler(exe)
3358 'test_fdisk_version',
3359 'libfdisk/src/version.c',
3360 c_args : libfdisk_tests_cflags,
3361 include_directories : lib_fdisk_includes,
3362 link_with : libfdisk_tests_ldadd,
3363 build_by_default: program_tests)
3364 if not is_disabler(exe)
3370 'libfdisk/src/item.c',
3371 c_args : libfdisk_tests_cflags,
3372 include_directories : lib_fdisk_includes,
3373 link_with : libfdisk_tests_ldadd,
3374 build_by_default: program_tests)
3375 if not is_disabler(exe)
3379 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3382 'sample-fdisk-mkpart',
3383 'libfdisk/samples/mkpart.c',
3384 include_directories : lib_fdisk_includes,
3385 link_with : sample_fdisk_ldadd)
3386 if not is_disabler(exe)
3391 'sample-fdisk-mkpart-fullspec',
3392 'libfdisk/samples/mkpart-fullspec.c',
3393 include_directories : lib_fdisk_includes,
3394 link_with : sample_fdisk_ldadd)
3395 if not is_disabler(exe)
3399 ############################################################
3403 'tests/helpers/test_cap.c',
3404 include_directories : includes,
3405 dependencies : [lib_cap_ng],
3406 build_by_default: program_tests)
3407 if not is_disabler(exe)
3413 'tests/helpers/test_mbsencode.c',
3414 include_directories : includes,
3415 link_with : lib_common,
3416 build_by_default: program_tests)
3421 'tests/helpers/test_byteswap.c',
3422 include_directories : includes,
3423 build_by_default: program_tests)
3428 'tests/helpers/test_md5.c',
3430 include_directories : includes,
3431 build_by_default: program_tests)
3436 'tests/helpers/test_sha1.c',
3438 include_directories : includes,
3439 build_by_default: program_tests)
3444 'tests/helpers/test_pathnames.c',
3445 include_directories : includes,
3446 build_by_default: program_tests)
3451 'tests/helpers/test_strerror.c',
3452 include_directories : includes,
3453 build_by_default: program_tests)
3458 'tests/helpers/test_sysinfo.c',
3459 include_directories : includes,
3460 build_by_default: program_tests)
3465 'tests/helpers/test_sigreceive.c',
3466 include_directories : includes,
3467 link_with : lib_common,
3468 build_by_default: program_tests)
3473 'tests/helpers/test_tiocsti.c',
3474 include_directories : includes,
3475 build_by_default: program_tests)
3479 'test_uuid_namespace',
3480 'tests/helpers/test_uuid_namespace.c',
3484 include_directories : includes,
3485 build_by_default: program_tests)
3491 'tests/helpers/test_mkfds.c',
3492 'tests/helpers/test_mkfds.h',
3493 'tests/helpers/test_mkfds_ppoll.c',
3494 include_directories : includes,
3495 dependencies : mq_libs,
3496 build_by_default: program_tests)
3502 'tests/helpers/test_enosys.c',
3503 include_directories : includes,
3504 build_by_default: program_tests)
3507 ############################################################
3509 if conf.get('HAVE_OPENAT').to_string() == '1'
3511 'sample-scols-tree',
3512 'libsmartcols/samples/tree.c',
3513 include_directories : includes,
3514 link_with : [lib_smartcols, lib_common],
3515 build_by_default: program_tests)
3516 if not is_disabler(exe)
3522 'sample-scols-title',
3523 'libsmartcols/samples/title.c',
3524 include_directories : includes,
3525 link_with : [lib_smartcols, lib_common])
3526 if not is_disabler(exe)
3531 'sample-scols-wrap',
3532 'libsmartcols/samples/wrap.c',
3533 include_directories : includes,
3534 link_with : [lib_smartcols, lib_common])
3535 if not is_disabler(exe)
3540 'sample-scols-continuous',
3541 'libsmartcols/samples/continuous.c',
3542 include_directories : includes,
3543 link_with : [lib_smartcols, lib_common])
3544 if not is_disabler(exe)
3549 'sample-scols-continuous-json',
3550 'libsmartcols/samples/continuous-json.c',
3551 include_directories : includes,
3552 link_with : [lib_smartcols, lib_common])
3553 if not is_disabler(exe)
3558 'sample-scols-maxout',
3559 'libsmartcols/samples/maxout.c',
3560 include_directories : includes,
3561 link_with : [lib_smartcols, lib_common])
3562 if not is_disabler(exe)
3567 'sample-scols-fromfile',
3568 'libsmartcols/samples/fromfile.c',
3569 include_directories : includes,
3570 link_with : [lib_smartcols, lib_common])
3571 if not is_disabler(exe)
3576 'sample-scols-grouping-simple',
3577 'libsmartcols/samples/grouping-simple.c',
3578 include_directories : includes,
3579 link_with : [lib_smartcols, lib_common])
3580 if not is_disabler(exe)
3585 'sample-scols-grouping-overlay',
3586 'libsmartcols/samples/grouping-overlay.c',
3587 include_directories : includes,
3588 link_with : [lib_smartcols, lib_common])
3589 if not is_disabler(exe)
3595 'Documentation/boilerplate.c',
3596 include_directories : includes,
3597 build_by_default: program_tests)
3598 if not is_disabler(exe)
3602 ############################################################
3604 # Let the test runner know whether we're running under asan and export
3605 # some paths. We use a file on disk so that it is possible to run the
3606 # test scripts from commandline without setting any variables.
3607 configure_file(output : 'meson.conf',
3612 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3613 python.full_path())])
3615 run_sh = find_program('tests/run.sh')
3619 '--srcdir=' + meson.current_source_dir(),
3620 '--builddir=' + meson.current_build_dir(),
3626 manadocs += ['lib/terminal-colors.d.5.adoc']
3627 manadocs += ['libblkid/libblkid.3.adoc']
3631 'libuuid/man/uuid.3.adoc',
3632 'libuuid/man/uuid_clear.3.adoc',
3633 'libuuid/man/uuid_compare.3.adoc',
3634 'libuuid/man/uuid_copy.3.adoc',
3635 'libuuid/man/uuid_generate.3.adoc',
3636 'libuuid/man/uuid_is_null.3.adoc',
3637 'libuuid/man/uuid_parse.3.adoc',
3638 'libuuid/man/uuid_time.3.adoc',
3639 'libuuid/man/uuid_unparse.3.adoc']
3641 'uuid_generate_random.3': 'uuid_generate.3',
3642 'uuid_generate_time.3': 'uuid_generate.3',
3643 'uuid_generate_time_safe.3': 'uuid_generate.3',
3647 asciidoctor = find_program('asciidoctor', required : false)
3648 if asciidoctor.found()
3649 foreach adoc : manadocs
3650 name = adoc.split('/')[-1]
3651 page = name.split('.adoc')[0]
3652 section = page.split('.')[-1]
3653 mandirn = join_paths(mandir, 'man' + section)
3658 command : [ asciidoctor,
3660 '-a', 'VERSION=' + meson.project_version(),
3661 '-a', 'release-version=' + meson.project_version(),
3662 '-a', 'ADJTIME_PATH=/etc/adjtime',
3663 '-a', 'package-docdir=' + docdir,
3664 '--base-dir=' + meson.current_source_dir(),
3665 '--destination-dir=' + meson.current_build_dir(),
3666 '--load-path', '@SOURCE_ROOT@/tools',
3667 '--require', 'asciidoctor-includetracker',
3671 depfile : page + '.deps',
3673 install_dir : mandirn)
3676 foreach link_name, target : manlinks
3677 link_section = link_name.split('.')[-1]
3678 target_section = target.split('.')[-1]
3679 meson.add_install_script(meson_make_manpage_stub,
3680 join_paths('man' + target_section, target),
3681 join_paths(mandir, 'man' + link_section, link_name))
3685 if bash_completion.found()
3686 foreach completion : bashcompletions
3688 join_paths('bash-completion', completion),
3689 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3692 foreach link_name, target : bashcompletionslinks
3693 meson.add_install_script(meson_make_symlink,
3695 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))