1 project('util-linux', 'c',
2 version : run_command('tools/git-version-gen', check: true).stdout(),
3 meson_version: '>=0.60.0',
11 pkgconfig = import('pkgconfig')
13 # soname versions; This never change because we use symbols versioing. There is also
14 # API version (LIB*_VERSION macros) and it follow package version.
15 libblkid_version = '1.1.0'
16 libblkid_date = '01-Jun-2021'
17 libuuid_version = '1.3.0'
18 liblastlog2_version = '2.0.0'
19 libmount_version = '1.1.0'
20 libsmartcols_version = '1.1.0'
21 libfdisk_version = '1.1.0'
23 prefixdir = get_option('prefix')
24 if not prefixdir.startswith('/')
25 error('Prefix is not absolute: "@0@"'.format(prefixdir))
27 bindir = join_paths(prefixdir, get_option('bindir'))
28 sbindir = join_paths(prefixdir, get_option('sbindir'))
29 sysconfstaticdir = join_paths(prefixdir, 'lib')
30 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
31 mandir = join_paths(prefixdir, get_option('mandir'))
33 localstatedir = '/var'
34 execprefixdir = prefixdir
35 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
36 usrbin_exec_dir = join_paths(execprefixdir, bindir)
37 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
38 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
40 vendordir = get_option('vendordir')
42 add_project_arguments('-D_GNU_SOURCE', language : 'c')
44 cc = meson.get_compiler('c')
46 conf = configuration_data()
47 conf.set_quoted('PACKAGE', meson.project_name())
48 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
49 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
50 conf.set_quoted('PACKAGE_STRING', package_string)
53 pc_version = meson.project_version().split('-')[0].split('.')
55 if pc_version.length() < 3
59 pc_version = '.'.join(pc_version)
61 conf.set_quoted('LIBBLKID_VERSION', pc_version)
62 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
64 conf.set('bindir', bindir)
65 conf.set('sbindir', sbindir)
66 conf.set('runstatedir', runstatedir)
67 conf.set('localstatedir', localstatedir)
68 conf.set('sysconfdir', sysconfdir)
69 conf.set('usrbin_execdir', usrbin_exec_dir)
70 conf.set('usrsbin_execdir', usrsbin_exec_dir)
71 conf.set('docdir', docdir)
72 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
73 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
74 conf.set_quoted('_PATH_LOCALSTATEDIR', localstatedir)
75 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
76 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
78 conf.set_quoted('_PATH_VENDORDIR', vendordir)
79 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
81 build_libblkid = not get_option('build-libblkid').disabled()
82 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
83 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
85 build_libuuid = not get_option('build-libuuid').disabled()
86 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
87 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
89 build_liblastlog2 = not get_option('build-liblastlog2').disabled()
90 conf.set('HAVE_LIBLASTLOG2', build_liblastlog2 ? 1 : false)
91 summary('liblastlog2', build_liblastlog2 ? 'enabled' : 'disabled', section : 'components')
93 login_lastlogin = get_option('login-lastlogin')
94 conf.set('USE_LOGIN_LASTLOG', login_lastlogin ? 1 : false)
95 summary('login-lastlogin', login_lastlogin ? 'enabled' : 'disabled', section : 'components')
97 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
98 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
99 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
101 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
102 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
104 build_libmount = not get_option('build-libmount').disabled()
105 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
106 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
107 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
108 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
110 build_libsmartcols = not get_option('build-libsmartcols').disabled()
111 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
112 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
114 build_libfdisk = not get_option('build-libfdisk').disabled()
115 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
116 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
118 build_uuidd = not get_option('build-uuidd').disabled()
119 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
120 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
122 static_programs = get_option('static-programs')
123 need_static_libs = static_programs.length() > 0 # a rough estimate...
124 summary('static programs', static_programs)
126 LINUX = host_machine.system() in ['linux']
127 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
129 ############################################################
147 have = cc.compiles(code, name : 'wchar_t support')
148 if not have and get_option('widechar').enabled()
149 error('widechar support requested but unavailable')
151 if get_option('ncurses').enabled() and get_option('widechar').enabled()
152 error('widechar support is incompatible with non-wide ncurses')
154 conf.set('HAVE_WIDECHAR', have ? 1 : false)
196 linux/net_namespace.h
210 security/pam_modules.h
243 lib_m = cc.find_library('m')
245 lib_tinfo = dependency(
247 required : get_option('tinfo'))
249 lib_ncursesw = dependency(
251 required : get_option('ncursesw'))
252 if lib_ncursesw.found()
253 headers += ['ncursesw/ncurses.h',
257 lib_ncurses = disabler()
259 lib_ncurses = dependency(
261 required : get_option('ncurses'))
262 headers += ['ncurses.h',
266 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
267 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
268 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
270 lib_slang = dependency(
272 required : get_option('slang'))
274 headers += ['slang.h',
279 conf.set('HAVE_SLANG', lib_slang.found())
281 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
282 if curses_libs.found()
283 have = cc.has_function('use_default_colors', dependencies : curses_libs)
284 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
285 have = cc.has_function('resizeterm', dependencies : curses_libs)
286 conf.set('HAVE_RESIZETERM', have ? 1 : false)
293 required : get_option('zlib'))
295 lib_readline = dependency(
297 required : get_option('readline'))
298 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
300 lib_readline_static = dependency(
303 required : need_static_libs ? get_option('readline') : disabler())
305 if meson.version().version_compare('>= 0.59.0')
306 lib_intl = dependency(
308 required : get_option('nls'))
309 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
311 if get_option('nls').enabled()
312 error('nls is not supported with meson before 0.59.0')
314 lib_intl = dependency('', required : false)
317 lib_user = dependency(
320 required : get_option('libuser'))
321 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
323 lib_util = cc.find_library(
325 required : get_option('libutil'))
326 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
328 lib_utempter = cc.find_library(
330 required : get_option('libutempter'))
331 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
333 systemd = dependency(
335 required : get_option('systemd'))
337 lib_systemd = dependency(
339 required : get_option('systemd'))
340 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
341 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
343 have = cc.has_function(
344 'sd_session_get_username',
345 dependencies : lib_systemd)
346 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
348 lib_udev = dependency(
350 required : get_option('systemd'))
351 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
353 lib_crypt = cc.find_library('crypt')
355 lib_pam = cc.find_library('pam', required : get_option('build-login'))
356 if not lib_pam.found()
357 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
359 if not lib_pam.found()
360 lib_pam = cc.find_library('pam', required : get_option('build-su'))
362 if not lib_pam.found()
363 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
366 lib_pam_misc = cc.find_library('pam_misc')
367 lib_pam = [lib_pam, lib_pam_misc]
369 lib_pam_misc = declare_dependency()
372 lib_cryptsetup = dependency(
374 required : get_option('cryptsetup'))
375 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
377 cryptsetup_dlopen = not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
379 if meson.version().version_compare('>= 0.62.0')
380 lib_dl = dependency('dl')
382 lib_dl = cc.find_library('dl')
384 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
385 summary('cryptsetup support (dlopen)',
387 section : 'components')
389 summary('cryptsetup support',
390 lib_cryptsetup.found() ? 'enabled' : 'disabled',
391 section : 'components')
394 have = cc.has_function(
395 'crypt_activate_by_signed_key',
396 dependencies : lib_cryptsetup)
397 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
399 lib_cap_ng = dependency(
401 required : get_option('build-setpriv'))
402 if not lib_cap_ng.found()
403 lib_cap_ng = disabler()
406 lib_selinux = dependency(
409 required : get_option('selinux'))
410 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
412 lib_magic = dependency(
414 required : get_option('magic'))
415 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
417 lib_econf = dependency(
419 required : get_option('econf'))
420 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
422 lib_audit = dependency(
424 required : get_option('audit'))
425 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
427 conf.set('HAVE_SMACK', not get_option('smack').disabled())
429 lib_sqlite3 = dependency('sqlite3', required : get_option('build-liblastlog2'))
431 foreach header : headers
432 have = cc.has_header(header)
433 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
436 header = 'linux/btrfs.h'
437 enable_btrfs = cc.has_header(header,
438 required : get_option('btrfs'))
439 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
440 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
442 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
447 have = cc.has_header(header,
449 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
452 have = cc.has_header('sched.h')
453 conf.set10('HAVE_DECL_CPU_ALLOC', have)
454 # We get -1 if the size cannot be determined
455 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
456 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
458 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
459 conf.set10('HAVE_ENVIRON_DECL', have)
461 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
462 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
464 have = cc.has_function('strsignal')
465 conf.set10('HAVE_STRSIGNAL_DECL', have)
467 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
468 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
470 have = cc.has_type('loff_t',
471 args : '-D_GNU_SOURCE',
472 prefix : '#include <sys/types.h>')
473 conf.set('HAVE_LOFF_T', have ? 1 : false)
475 have = cc.compiles('''
476 #define _GNU_SOURCE 1
477 #include <langinfo.h>
480 str = nl_langinfo (ALTMON_1);
481 str = nl_langinfo (ALTMON_2);
482 str = nl_langinfo (ALTMON_3);
483 str = nl_langinfo (ALTMON_4);
484 str = nl_langinfo (ALTMON_5);
485 str = nl_langinfo (ALTMON_6);
486 str = nl_langinfo (ALTMON_7);
487 str = nl_langinfo (ALTMON_8);
488 str = nl_langinfo (ALTMON_9);
489 str = nl_langinfo (ALTMON_10);
490 str = nl_langinfo (ALTMON_11);
491 str = nl_langinfo (ALTMON_12);
495 name : 'langinfo.h defines ALTMON_x constants')
496 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
498 have = cc.compiles('''
499 #define _GNU_SOURCE 1
500 #include <langinfo.h>
503 str = nl_langinfo (_NL_ABALTMON_1);
504 str = nl_langinfo (_NL_ABALTMON_2);
505 str = nl_langinfo (_NL_ABALTMON_3);
506 str = nl_langinfo (_NL_ABALTMON_4);
507 str = nl_langinfo (_NL_ABALTMON_5);
508 str = nl_langinfo (_NL_ABALTMON_6);
509 str = nl_langinfo (_NL_ABALTMON_7);
510 str = nl_langinfo (_NL_ABALTMON_8);
511 str = nl_langinfo (_NL_ABALTMON_9);
512 str = nl_langinfo (_NL_ABALTMON_10);
513 str = nl_langinfo (_NL_ABALTMON_11);
514 str = nl_langinfo (_NL_ABALTMON_12);
518 name : 'langinfo.h defines _NL_ABALTMON_x constants')
519 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
521 have = cc.compiles('''
522 #define _GNU_SOURCE 1
523 #include <langinfo.h>
526 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
530 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
531 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
564 landlock_create_ruleset
566 landlock_restrict_self
630 have = cc.has_function(func)
631 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
632 # This makes little sense, but is necessary to avoid warnings about
633 # redefined macros from Python.h, which uses this convention.
634 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
637 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
638 conf.set('AGETTY_RELOAD', have ? 1 : false)
640 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
643 have_dirfd = (cc.has_function('dirfd') or
644 cc.has_header_symbol('dirent.h', 'dirfd',
645 prefix : '#include <sys/types.h>'))
646 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
648 have_ddfd = cc.has_member('DIR', 'dd_fd',
650 #include <sys/types.h>
653 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
655 have = cc.has_member('struct tm', 'tm_gmtoff',
656 args : '-D_GNU_SOURCE',
661 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
665 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
666 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
668 have = cc.has_member('struct termios', 'c_line',
669 prefix : '#include <termios.h>')
670 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
672 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
673 args : '-D_GNU_SOURCE',
674 prefix : '#include <sys/stat.h>')
675 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
677 have = cc.has_member('struct statx', 'stx_mnt_id',
678 prefix : '#include <sys/stat.h>')
679 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
681 # replacement for AC_STRUCT_TIMEZONE
682 have = cc.has_member('struct tm', 'tm_zone',
683 args : '-D_GNU_SOURCE',
684 prefix : '#include <time.h>')
685 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
687 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
688 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
690 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
691 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
693 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
694 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
699 extern char *tzname[];
702 return tzname ? 0 : 1;
704 '''.format(have ? 1 : 0)
705 have = cc.compiles(code, name : 'using tzname[]')
706 conf.set('HAVE_TZNAME', have ? 1 : false)
708 have = cc.sizeof('time_t', prefix : '#include <time.h>')
710 add_global_arguments('-D_TIME_BITS=64', language : 'c')
711 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
713 if get_option('allow-32bit-time')
714 warning('Could not make time_t 64bits wide')
716 error('Could not make time_t 64bits wide')
722 if not cc.has_function('socket')
723 socket_libs += cc.find_library('socket', required : true)
724 have = cc.has_function('socket',
725 dependencies : socket_libs)
727 error('socket() function not available')
732 have = cc.has_function('clock_gettime')
734 realtime_libs += cc.find_library('rt', required : true)
735 have = cc.has_function('clock_gettime',
736 dependencies : realtime_libs)
738 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
740 thread_libs = dependency('threads')
742 have = cc.has_function('timer_create')
744 realtime_libs = [cc.find_library('rt', required : true)]
745 have = cc.has_function('timer_create',
746 dependencies : realtime_libs)
748 realtime_libs += thread_libs
749 have = cc.has_function('timer_create',
750 dependencies : realtime_libs)
753 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
755 have = cc.has_function('setitimer')
756 conf.set('HAVE_SETITIMER', have ? 1 : false)
759 rtas_libs = cc.find_library('rtas', required : false)
760 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
763 if not cc.has_header_symbol('math.h', 'isnan')
764 lib = cc.find_library('m', required : true)
765 if (cc.has_function('isnan', dependencies : lib) and
766 cc.has_function('__isnan', dependencies : lib))
771 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
772 args : '-D_GNU_SOURCE')
773 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
776 extern char *__progname;
778 return (*__progname != 0);
781 have = cc.compiles(code, name : 'using __progname')
782 conf.set('HAVE___PROGNAME', have ? 1 : false)
784 have = conf.get('HAVE_PTY_H').to_string() == '1' \
785 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
786 conf.set('HAVE_PTY', have ? 1 : false)
788 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
789 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
791 build_plymouth_support = get_option('build-plymouth-support')
792 have_tiocglcktrmios = cc.has_header_symbol(
793 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
794 required : build_plymouth_support.enabled())
795 have_sock_cloexec = cc.has_header_symbol(
796 'sys/socket.h', 'SOCK_CLOEXEC',
797 prefix : '#include <sys/types.h>',
798 required : build_plymouth_support.enabled())
799 have_sock_nonblock = cc.has_header_symbol(
800 'sys/socket.h', 'SOCK_NONBLOCK',
801 prefix : '#include <sys/types.h>',
802 required : build_plymouth_support.enabled())
803 have_so_passcred = cc.has_header_symbol(
804 'sys/socket.h', 'SO_PASSCRED',
805 args : ['-D_GNU_SOURCE'],
806 prefix : '#include <sys/types.h>',
807 required : build_plymouth_support.enabled())
809 build_plymouth_support = (not build_plymouth_support.disabled() and
810 have_tiocglcktrmios and
811 have_sock_cloexec and
812 have_sock_nonblock and
814 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
815 summary('plymouth support',
816 build_plymouth_support ? 'enabled' : 'disabled',
817 section : 'components')
819 # check for valid fallocate() function
820 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
821 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
822 # and program can't be linked.
830 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
831 return ret == 0 ? 0 : 1;
834 have = cc.links(code, name : 'fallocate() function')
835 conf.set('HAVE_FALLOCATE', have ? 1 : false)
843 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
844 return ret == 0 ? 0 : 1;
847 have = cc.links(code, name : 'posix_fallocate() function')
848 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
850 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
851 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
852 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
854 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
855 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
856 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
858 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
860 ############################################################
863 fs_search_path = get_option('fs-search-path')
864 fs_search_path_extra = get_option('fs-search-path-extra')
865 if fs_search_path_extra != ''
866 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
868 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
870 systemdsystemunitdir = ''
872 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
875 sysvinit = get_option('sysvinit').enabled()
876 sysvinitrcdir = sysconfdir + '/init.d'
878 program_tests = get_option('program-tests')
880 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
881 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
883 have = get_option('chsh-only-listed')
884 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
886 have = get_option('use-tty-group')
887 conf.set('USE_TTY_GROUP', have ? 1 : false)
889 bison = find_program('bison')
890 flex = find_program('flex')
892 build_hwclock = not get_option('build-hwclock').disabled()
893 bison_gen = generator(
895 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
896 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
898 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
899 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
903 configuration : conf)
905 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
910 '-Waddress-of-packed-member',
911 '-Wdiscarded-qualifiers',
912 '-Wembedded-directive',
915 '-Wimplicit-function-declaration',
916 '-Wmissing-declarations',
917 '-Wmissing-parameter-type',
918 '-Wmissing-prototypes',
920 '-Wno-missing-field-initializers',
921 '-Wold-style-definition',
925 '-Wstrict-prototypes',
928 '-Wunused-but-set-parameter',
929 '-Wunused-but-set-variable',
930 '-Wunused-parameter',
936 foreach compiler_flag : compiler_flags
937 if cc.has_argument(compiler_flag)
938 add_project_arguments(compiler_flag, language : 'c')
946 bashcompletionslinks = {}
952 subdir('libsmartcols')
954 subdir('liblastlog2')
956 subdir('pam_lastlog2')
957 subdir('login-utils')
965 includes = [dir_include,
976 opt = not get_option('build-chfn-chsh').disabled()
981 include_directories : includes,
982 link_with : [lib_common, logindefs_c],
983 dependencies : chfn_chsh_deps,
984 install_dir : usrbin_exec_dir,
985 install_mode : 'rwsr-xr-x',
987 build_by_default : opt)
991 'login-utils/chsh.c',
994 include_directories : includes,
995 link_with : lib_common,
996 dependencies : chfn_chsh_deps,
997 install_dir : usrbin_exec_dir,
998 install_mode : 'rwsr-xr-x',
1000 build_by_default : opt)
1001 if opt and not is_disabler(exe)
1003 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1004 bashcompletions += ['chfn', 'chsh']
1009 test_islocal_sources,
1010 include_directories : includes,
1011 c_args : '-DTEST_PROGRAM',
1012 build_by_default : program_tests)
1017 test_consoles_sources,
1018 c_args : ['-DTEST_PROGRAM'],
1019 include_directories : includes,
1020 link_with : lib_common,
1021 build_by_default : program_tests)
1024 opt = not get_option('build-last').disabled()
1028 include_directories : includes,
1029 link_with : [lib_common],
1030 install_dir : usrbin_exec_dir,
1032 build_by_default : opt)
1033 if opt and not is_disabler(exe)
1035 meson.add_install_script(meson_make_symlink,
1037 join_paths(usrbin_exec_dir, 'lastb'))
1038 manadocs += ['login-utils/last.1.adoc']
1039 manlinks += {'lastb.1': 'last.1'}
1040 bashcompletions += ['last']
1041 bashcompletionslinks += {'lastb': 'last'}
1044 opt = not get_option('build-nologin').disabled()
1047 'login-utils/nologin.c',
1048 include_directories : includes,
1049 install_dir : sbindir,
1050 link_with : [lib_common],
1052 build_by_default : opt)
1053 if opt and not is_disabler(exe)
1055 manadocs += ['login-utils/nologin.8.adoc']
1058 opt = not get_option('build-utmpdump').disabled()
1061 'login-utils/utmpdump.c',
1062 include_directories : includes,
1063 link_with : [lib_common],
1064 install_dir : usrbin_exec_dir,
1066 build_by_default : opt)
1067 if opt and not is_disabler(exe)
1069 manadocs += ['login-utils/utmpdump.1.adoc']
1070 bashcompletions += ['utmpdump']
1073 opt = not get_option('build-su').disabled()
1077 'login-utils/su-common.c',
1078 'login-utils/su-common.h',
1082 include_directories : includes,
1083 link_with : [lib_common, logindefs_c],
1084 dependencies : [lib_pam,
1088 install_mode : 'rwsr-xr-x',
1090 build_by_default : opt)
1091 if opt and not is_disabler(exe)
1093 manadocs += ['login-utils/su.1.adoc']
1094 bashcompletions += ['su']
1097 opt = not get_option('build-newgrp').disabled()
1100 'login-utils/newgrp.c',
1101 include_directories : includes,
1102 dependencies : [lib_crypt],
1103 install_dir : usrbin_exec_dir,
1104 install_mode : 'rwsr-xr-x',
1106 build_by_default : opt)
1107 if opt and not is_disabler(exe)
1109 manadocs += ['login-utils/newgrp.1.adoc']
1110 bashcompletions += ['newgrp']
1113 opt = not get_option('build-lslogins').disabled()
1116 'login-utils/lslogins.c',
1117 include_directories : includes,
1118 link_with : [lib_common,
1121 (build_liblastlog2 ? [lib_lastlog2] : []),
1122 dependencies : [lib_selinux,
1124 install_dir : usrbin_exec_dir,
1126 build_by_default : opt)
1127 if opt and not is_disabler(exe)
1129 manadocs += ['login-utils/lslogins.1.adoc']
1130 bashcompletions += ['lslogins']
1133 opt = not get_option('build-vipw').disabled()
1136 'login-utils/vipw.c',
1137 'login-utils/setpwnam.h',
1138 include_directories : includes,
1139 link_with : [lib_common],
1140 dependencies : [lib_selinux],
1141 install_dir : usrbin_exec_dir,
1143 build_by_default : opt)
1144 if opt and not is_disabler(exe)
1146 meson.add_install_script(meson_make_symlink,
1148 join_paths(usrbin_exec_dir, 'vigr'))
1149 manadocs += ['login-utils/vipw.8.adoc']
1150 meson.add_install_script(meson_make_symlink,
1152 join_paths(mandir, 'man8/vigr.8'))
1155 opt = not get_option('build-runuser').disabled()
1158 'login-utils/runuser.c',
1159 'login-utils/su-common.c',
1160 'login-utils/su-common.h',
1164 include_directories : includes,
1165 link_with : [lib_common, logindefs_c],
1166 dependencies : [lib_pam,
1170 install_dir : sbindir,
1172 build_by_default : opt)
1173 if opt and not is_disabler(exe)
1175 manadocs += ['login-utils/runuser.1.adoc']
1176 bashcompletionslinks += {'runuser': 'su'}
1179 ############################################################
1185 include_directories : includes,
1186 link_with : lib_common,
1187 install_dir : usrbin_exec_dir,
1190 manadocs += ['text-utils/col.1.adoc']
1191 bashcompletions += ['col']
1197 include_directories : includes,
1198 install_dir : usrbin_exec_dir,
1201 manadocs += ['text-utils/colcrt.1.adoc']
1202 bashcompletions += ['colcrt']
1207 include_directories : includes,
1208 link_with : lib_common,
1209 install_dir : usrbin_exec_dir,
1212 manadocs += ['text-utils/colrm.1.adoc']
1213 bashcompletions += ['colrm']
1218 include_directories : includes,
1219 install_dir : usrbin_exec_dir,
1222 manadocs += ['text-utils/rev.1.adoc']
1223 bashcompletions += ['rev']
1228 include_directories : includes,
1229 link_with : [lib_common,
1231 install_dir : usrbin_exec_dir,
1233 if not is_disabler(exe)
1235 manadocs += ['text-utils/column.1.adoc']
1236 bashcompletions += ['column']
1239 opt = not get_option('build-line').disabled()
1243 include_directories : includes,
1244 install_dir : usrbin_exec_dir,
1246 build_by_default : opt)
1247 if opt and not is_disabler(exe)
1249 manadocs += ['text-utils/line.1.adoc']
1252 opt = not get_option('build-pg').disabled()
1256 link_with : lib_common,
1257 include_directories : includes,
1258 dependencies : [lib_tinfo,
1260 install_dir : usrbin_exec_dir,
1262 build_by_default : opt)
1263 if opt and not is_disabler(exe)
1265 manadocs += ['text-utils/pg.1.adoc']
1266 bashcompletions += ['pg']
1269 opt = not get_option('build-ul').disabled()
1273 include_directories : includes,
1274 dependencies : [lib_tinfo,
1276 install_dir : usrbin_exec_dir,
1278 build_by_default : opt)
1279 if opt and not is_disabler(exe)
1281 manadocs += ['text-utils/ul.1.adoc']
1282 bashcompletions += ['ul']
1285 opt = not get_option('build-more').disabled()
1289 link_with : [lib_common],
1290 include_directories : includes,
1291 dependencies : [lib_tinfo,
1295 build_by_default : opt)
1299 link_with : [lib_common],
1300 include_directories : includes,
1301 c_args : '-DTEST_PROGRAM',
1302 dependencies : [lib_tinfo,
1305 build_by_default : opt and program_tests)
1307 if opt and not is_disabler(exe)
1309 manadocs += ['text-utils/more.1.adoc']
1310 bashcompletions += ['more']
1316 include_directories : includes,
1317 link_with : [lib_common,
1319 install_dir : usrbin_exec_dir,
1321 if not is_disabler(exe)
1323 manadocs += ['text-utils/hexdump.1.adoc']
1324 bashcompletions += ['hexdump']
1327 opt = not get_option('build-lsmem').disabled()
1331 include_directories : includes,
1332 link_with : [lib_common,
1334 install_dir : usrbin_exec_dir,
1336 build_by_default : opt)
1337 if opt and not is_disabler(exe)
1339 manadocs += ['sys-utils/lsmem.1.adoc']
1340 bashcompletions += ['lsmem']
1343 opt = not get_option('build-chmem').disabled()
1347 include_directories : includes,
1348 link_with : [lib_common],
1349 install_dir : usrbin_exec_dir,
1351 build_by_default : opt)
1352 if opt and not is_disabler(exe)
1354 manadocs += ['sys-utils/chmem.8.adoc']
1355 bashcompletions += ['chmem']
1361 include_directories : includes,
1362 link_with : [lib_common],
1363 install_dir : usrbin_exec_dir,
1366 manadocs += ['sys-utils/choom.1.adoc']
1371 include_directories : includes,
1372 link_with : [lib_common],
1373 install_dir : usrbin_exec_dir,
1376 manadocs += ['sys-utils/ipcmk.1.adoc']
1377 bashcompletions += ['ipcmk']
1382 include_directories : includes,
1383 link_with : [lib_common],
1384 install_dir : usrbin_exec_dir,
1387 manadocs += ['sys-utils/ipcrm.1.adoc']
1388 bashcompletions += ['ipcrm']
1390 opt = not get_option('build-ipcs').disabled()
1394 include_directories : includes,
1395 link_with : [lib_common],
1396 install_dir : usrbin_exec_dir,
1398 build_by_default : opt)
1399 if opt and not is_disabler(exe)
1401 manadocs += ['sys-utils/ipcs.1.adoc']
1402 bashcompletions += ['ipcs']
1405 opt = not get_option('build-rfkill').disabled()
1409 include_directories : includes,
1410 link_with : [lib_common,
1412 install_dir : usrsbin_exec_dir,
1414 build_by_default : opt)
1415 if opt and not is_disabler(exe)
1417 manadocs += ['sys-utils/rfkill.8.adoc']
1418 bashcompletions += ['rfkill']
1424 include_directories : includes,
1425 link_with : [lib_common,
1427 install_dir : usrbin_exec_dir,
1429 if not is_disabler(exe)
1431 manadocs += ['sys-utils/renice.1.adoc']
1432 bashcompletions += ['renice']
1438 include_directories: includes,
1439 link_with : [lib_common,
1441 install_dir : usrbin_exec_dir,
1443 if opt and not is_disabler(exe)
1445 manadocs += ['sys-utils/setpgid.1.adoc']
1446 bashcompletions += ['setpgid']
1452 include_directories : includes,
1453 link_with : [lib_common,
1455 install_dir : usrbin_exec_dir,
1457 if opt and not is_disabler(exe)
1459 manadocs += ['sys-utils/setsid.1.adoc']
1460 bashcompletions += ['setsid']
1465 readprofile_sources,
1466 include_directories : includes,
1467 link_with : [lib_common,
1469 install_dir : usrsbin_exec_dir,
1471 if not is_disabler(exe)
1473 manadocs += ['sys-utils/readprofile.8.adoc']
1474 bashcompletions += ['readprofile']
1477 opt = not get_option('build-tunelp').disabled()
1481 include_directories : includes,
1482 link_with : [lib_common],
1483 install_dir : usrsbin_exec_dir,
1485 build_by_default : opt)
1486 if opt and not is_disabler(exe)
1488 manadocs += ['sys-utils/tunelp.8.adoc']
1489 bashcompletions += ['tunelp']
1495 include_directories : includes,
1496 link_with : [lib_common,
1498 install_dir : sbindir,
1500 if not is_disabler(exe)
1502 manadocs += ['sys-utils/fstrim.8.adoc']
1503 bashcompletions += ['fstrim']
1509 include_directories : includes,
1510 link_with : [lib_common,
1513 if not is_disabler(exe)
1515 manadocs += ['sys-utils/dmesg.1.adoc']
1516 bashcompletions += ['dmesg']
1522 include_directories : dir_include,
1523 c_args : '-DTEST_DMESG',
1524 link_with : [lib_common,
1526 build_by_default : program_tests)
1527 if not is_disabler(exe)
1534 include_directories : includes,
1535 link_with : [lib_common],
1536 install_dir : sbindir,
1539 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1540 bashcompletions += ['ctrlaltdel']
1545 include_directories : includes,
1546 install_dir : sbindir,
1549 manadocs += ['sys-utils/fsfreeze.8.adoc']
1550 bashcompletions += ['fsfreeze']
1555 include_directories : includes,
1556 link_with : [lib_common,
1558 install_dir : sbindir,
1561 manadocs += ['sys-utils/blkdiscard.8.adoc']
1562 bashcompletions += ['blkdiscard']
1567 include_directories : includes,
1568 link_with : [lib_common],
1569 install_dir : sbindir,
1572 manadocs += ['sys-utils/blkzone.8.adoc']
1573 bashcompletions += ['blkzone']
1578 include_directories : includes,
1579 link_with : [lib_common],
1580 install_dir : sbindir,
1583 manadocs += ['sys-utils/blkpr.8.adoc']
1588 include_directories : includes,
1589 link_with : [lib_common],
1590 install_dir : usrsbin_exec_dir,
1593 manadocs += ['sys-utils/ldattach.8.adoc']
1594 bashcompletions += ['ldattach']
1599 include_directories : includes,
1600 link_with : [lib_common],
1601 install_dir : usrsbin_exec_dir,
1604 manadocs += ['sys-utils/rtcwake.8.adoc']
1605 bashcompletions += ['rtcwake']
1610 include_directories : includes,
1611 link_with : [lib_common],
1612 install_dir : usrbin_exec_dir,
1615 manadocs += ['sys-utils/setarch.8.adoc']
1616 bashcompletions += ['setarch']
1618 setarch_links = ['uname26', 'linux32', 'linux64']
1619 setarch_links_arch = {
1620 's390x' : ['s390', 's390x'],
1622 'x86_64' : ['i386', 'x86_64'],
1623 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1624 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1625 'mips64' : ['mips', 'mips64', 'mips32'],
1626 'ia64' : ['i386', 'ia64'],
1627 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1629 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1631 foreach link: setarch_links
1632 meson.add_install_script(meson_make_symlink,
1634 join_paths(usrbin_exec_dir, link))
1635 manlinks += {link + '.8': 'setarch.8'}
1638 opt = not get_option('build-eject').disabled()
1642 include_directories : includes,
1643 link_with : [lib_common,
1645 install_dir : usrbin_exec_dir,
1647 build_by_default : opt)
1648 if opt and not is_disabler(exe)
1650 manadocs += ['sys-utils/eject.1.adoc']
1651 bashcompletions += ['eject']
1654 opt = not get_option('build-losetup').disabled()
1658 include_directories : includes,
1659 link_with : [lib_common,
1661 install_dir : sbindir,
1663 build_by_default : opt)
1664 if opt and not is_disabler(exe)
1665 manadocs += ['sys-utils/losetup.8.adoc']
1667 bashcompletions += ['losetup']
1670 opt = opt and 'losetup' in static_programs
1674 include_directories : includes,
1675 link_args : ['--static'],
1676 link_with : [lib_common,
1677 lib_smartcols.get_static_lib()],
1678 install_dir : sbindir,
1680 build_by_default : opt)
1681 if opt and not is_disabler(exe)
1685 opt = not get_option('build-zramctl').disabled()
1689 include_directories : includes,
1690 link_with : [lib_common,
1692 install_dir : sbindir,
1694 build_by_default : opt)
1695 if opt and not is_disabler(exe)
1697 manadocs += ['sys-utils/zramctl.8.adoc']
1698 bashcompletions += ['zramctl']
1704 include_directories : includes,
1705 link_with : [lib_common,
1707 install_dir : usrbin_exec_dir,
1709 if not is_disabler(exe)
1711 manadocs += ['sys-utils/prlimit.1.adoc']
1712 bashcompletions += ['prlimit']
1718 include_directories : includes,
1719 link_with : [lib_common,
1722 install_dir : usrbin_exec_dir,
1724 if not is_disabler(exe)
1726 manadocs += ['sys-utils/lsns.8.adoc']
1727 bashcompletions += ['lsns']
1730 opt = not get_option('build-mount').disabled()
1734 include_directories : includes,
1735 link_with : [lib_common,
1738 dependencies : lib_selinux,
1739 install_mode : 'rwsr-xr-x',
1741 build_by_default : opt)
1745 include_directories : includes,
1746 link_with : [lib_common,
1748 install_mode : 'rwsr-xr-x',
1750 build_by_default : opt)
1751 if opt and not is_disabler(exe)
1753 manadocs += ['sys-utils/fstab.5.adoc',
1754 'sys-utils/mount.8.adoc',
1755 'sys-utils/umount.8.adoc']
1756 bashcompletions += ['mount', 'umount']
1759 opt2 = opt and 'mount' in static_programs
1763 include_directories : includes,
1764 link_args : ['--static'],
1765 link_with : [lib_common,
1766 lib_smartcols_static,
1769 build_by_default : opt2)
1770 if opt2 and not is_disabler(exe)
1774 opt2 = opt and 'umount' in static_programs
1778 include_directories : includes,
1779 link_args : ['--static'],
1780 link_with : [lib_common,
1783 build_by_default : opt2)
1784 if opt2 and not is_disabler(exe)
1793 include_directories : includes,
1794 link_with : [lib_common,
1798 install_dir : sbindir,
1800 if not is_disabler(exe)
1802 manadocs += ['sys-utils/swapon.8.adoc']
1803 bashcompletions += ['swapon']
1809 include_directories : includes,
1810 link_with : [lib_common,
1813 install_dir : sbindir,
1815 if not is_disabler(exe)
1817 manlinks += {'swapoff.8': 'swapon.8'}
1818 bashcompletions += ['swapoff']
1824 include_directories : includes,
1825 link_with : [lib_common,
1827 dependencies : [rtas_libs],
1828 install_dir : usrbin_exec_dir,
1830 if not is_disabler(exe)
1832 manadocs += ['sys-utils/lscpu.1.adoc']
1833 bashcompletions += ['lscpu']
1839 include_directories : includes,
1840 link_with : [lib_common],
1841 install_dir : sbindir,
1844 manadocs += ['sys-utils/chcpu.8.adoc']
1845 bashcompletions += ['chcpu']
1850 include_directories : includes,
1851 link_with : [lib_common,
1854 if not is_disabler(exe)
1856 manadocs += ['sys-utils/wdctl.8.adoc']
1857 bashcompletions += ['wdctl']
1860 opt = not get_option('build-mountpoint').disabled()
1864 include_directories : includes,
1865 link_with : [lib_mount],
1867 build_by_default : opt)
1868 if opt and not is_disabler(exe)
1870 manadocs += ['sys-utils/mountpoint.1.adoc']
1871 bashcompletions += ['mountpoint']
1874 opt = not get_option('build-fallocate').disabled()
1878 include_directories : includes,
1879 link_with : [lib_common],
1880 install_dir : usrbin_exec_dir,
1882 build_by_default : opt)
1883 if opt and not is_disabler(exe)
1885 manadocs += ['sys-utils/fallocate.1.adoc']
1886 bashcompletions += ['fallocate']
1889 opt = not get_option('build-pivot_root').disabled()
1893 include_directories : includes,
1894 install_dir : sbindir,
1896 build_by_default : opt)
1897 if opt and not is_disabler(exe)
1899 manadocs += ['sys-utils/pivot_root.8.adoc']
1900 bashcompletions += ['pivot_root']
1903 opt = not get_option('build-switch_root').disabled()
1904 if opt and not have_dirfd and not have_ddfd
1905 error('neither dirfd nor ddfd are available')
1909 switch_root_sources,
1910 include_directories : includes,
1911 install_dir : sbindir,
1913 build_by_default : opt)
1914 if opt and not is_disabler(exe)
1916 manadocs += ['sys-utils/switch_root.8.adoc']
1919 opt = not get_option('build-unshare').disabled()
1923 include_directories : includes,
1924 link_with : [lib_common],
1925 install_dir : usrbin_exec_dir,
1927 build_by_default : opt)
1928 if opt and not is_disabler(exe)
1930 manadocs += ['sys-utils/unshare.1.adoc']
1931 bashcompletions += ['unshare']
1934 opt = opt and 'unshare' in static_programs
1938 include_directories : includes,
1939 link_with : [lib_common],
1940 install_dir : usrbin_exec_dir,
1942 build_by_default : opt)
1943 if opt and not is_disabler(exe)
1947 opt = not get_option('build-nsenter').disabled()
1951 include_directories : includes,
1952 link_with : [lib_common],
1953 dependencies : [lib_selinux],
1954 install_dir : usrbin_exec_dir,
1956 build_by_default : opt)
1957 if opt and not is_disabler(exe)
1959 manadocs += ['sys-utils/nsenter.1.adoc']
1960 bashcompletions += ['nsenter']
1963 opt = opt and 'nsenter' in static_programs
1967 include_directories : includes,
1968 link_with : [lib_common],
1969 dependencies : [lib_selinux],
1970 install_dir : usrbin_exec_dir,
1972 build_by_default : opt)
1973 if opt and not is_disabler(exe)
1977 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1981 include_directories : includes,
1982 link_with : [lib_common],
1983 dependencies : [lib_cap_ng],
1984 install_dir : usrbin_exec_dir,
1986 build_by_default : opt)
1987 if opt and not is_disabler(exe)
1989 manadocs += ['sys-utils/setpriv.1.adoc']
1990 bashcompletions += ['setpriv']
1996 include_directories : includes,
1997 link_with : [lib_common],
1998 dependencies : realtime_libs,
1999 install_dir : usrbin_exec_dir,
2002 manadocs += ['sys-utils/flock.1.adoc']
2003 bashcompletions += ['flock']
2005 opt = not get_option('build-lsirq').disabled()
2009 include_directories : includes,
2010 link_with : [lib_common,
2012 install_dir : usrbin_exec_dir,
2014 build_by_default : opt)
2015 if opt and not is_disabler(exe)
2017 manadocs += ['sys-utils/lsirq.1.adoc']
2018 bashcompletions += ['lsirq']
2021 opt = not get_option('build-irqtop').disabled()
2025 include_directories : includes,
2026 dependencies : [realtime_libs, curses_libs],
2027 link_with : [lib_common,
2030 install_dir : usrbin_exec_dir,
2032 build_by_default : opt)
2033 if opt and not is_disabler(exe)
2035 manadocs += ['sys-utils/irqtop.1.adoc']
2036 bashcompletions += ['irqtop']
2039 opt = not get_option('build-ipcs').disabled()
2043 include_directories : includes,
2044 link_with : [lib_common,
2046 install_dir : usrbin_exec_dir,
2048 build_by_default : opt)
2049 if opt and not is_disabler(exe)
2051 manadocs += ['sys-utils/lsipc.1.adoc']
2052 bashcompletions += ['lsipc']
2059 include_directories : includes,
2060 link_with : [lib_common],
2061 dependencies : [lib_m,
2063 install_dir : sbindir,
2065 build_by_default : opt)
2066 if opt and not is_disabler(exe)
2068 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2069 bashcompletions += ['hwclock']
2075 include_directories : includes,
2076 install_dir : sbindir,
2079 manadocs += ['disk-utils/mkfs.8.adoc']
2080 bashcompletions += ['mkfs']
2082 opt = not get_option('build-bfs').disabled()
2086 include_directories : includes,
2087 link_with : [lib_common],
2088 install_dir : sbindir,
2090 build_by_default : opt)
2091 if opt and not is_disabler(exe)
2093 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2094 bashcompletions += ['mkfs.bfs']
2100 include_directories : includes,
2101 link_with : [lib_common],
2102 install_dir : usrbin_exec_dir,
2105 manadocs += ['disk-utils/isosize.8.adoc']
2106 bashcompletions += ['isosize']
2111 include_directories : includes,
2112 link_with : [lib_common,
2115 dependencies: [lib_selinux],
2116 install_dir : sbindir,
2118 if not is_disabler(exe)
2120 manadocs += ['disk-utils/mkswap.8.adoc']
2121 bashcompletions += ['mkswap']
2127 include_directories : includes,
2128 link_with : [lib_common,
2131 install_dir : sbindir,
2133 if not is_disabler(exe)
2135 manadocs += ['disk-utils/swaplabel.8.adoc']
2136 bashcompletions += ['swaplabel']
2139 opt = not get_option('build-fsck').disabled()
2143 include_directories : includes,
2144 link_with : [lib_common,
2147 dependencies : realtime_libs,
2148 install_dir : sbindir,
2150 build_by_default : opt)
2151 if opt and not is_disabler(exe)
2153 manadocs += ['disk-utils/fsck.8.adoc']
2154 bashcompletions += ['fsck']
2157 opt = not get_option('build-minix').disabled()
2161 include_directories : includes,
2162 link_with : [lib_common],
2163 install_dir : sbindir,
2165 build_by_default : opt)
2169 include_directories : includes,
2170 c_args : '-DTEST_SCRIPT',
2171 link_with : [lib_common],
2172 build_by_default : opt and program_tests)
2176 include_directories : includes,
2177 link_with : [lib_common],
2178 install_dir : sbindir,
2180 build_by_default : opt)
2181 if opt and not is_disabler(exe)
2182 exes += [exe, exe2, exe3]
2183 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2184 bashcompletions += ['mkfs.minix', 'fsck.minix']
2187 opt = not get_option('build-cramfs').disabled()
2190 mkfs_cramfs_sources,
2191 include_directories : includes,
2192 link_with : [lib_common],
2193 dependencies : [lib_z],
2194 install_dir : sbindir,
2196 build_by_default : opt)
2199 fsck_cramfs_sources,
2200 include_directories : includes,
2201 link_with : [lib_common],
2202 dependencies : [lib_z],
2203 install_dir : sbindir,
2205 build_by_default : opt)
2206 if not is_disabler(exe)
2208 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2209 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2212 opt = not get_option('build-raw').disabled()
2214 cc.has_header('linux/raw.h', required: opt)
2219 include_directories : includes,
2220 install_dir : sbindir,
2222 build_by_default : opt)
2223 if opt and not is_disabler(exe)
2225 manadocs += ['disk-utils/raw.8.adoc']
2226 bashcompletions += ['raw']
2229 opt = not get_option('build-fdformat').disabled()
2233 include_directories : includes,
2234 link_with : [lib_common],
2235 install_dir : usrsbin_exec_dir,
2237 build_by_default : opt)
2238 if opt and not is_disabler(exe)
2240 manadocs += ['disk-utils/fdformat.8.adoc']
2241 bashcompletions += ['fdformat']
2247 include_directories : includes,
2248 link_with : [lib_common],
2249 install_dir : sbindir,
2251 manadocs += ['disk-utils/blockdev.8.adoc']
2252 bashcompletions += ['blockdev']
2254 opt = not get_option('build-fdisks').disabled()
2255 if opt and not have_dirfd and not have_ddfd
2256 error('neither dirfd nor ddfd are available')
2261 include_directories : includes,
2262 link_with : [lib_common,
2266 dependencies : [lib_readline],
2267 install_dir : sbindir,
2269 build_by_default : opt)
2270 if opt and not is_disabler(exe)
2272 bashcompletions += ['fdisk']
2275 opt2 = opt and 'fdisk' in static_programs
2279 link_args : ['--static'],
2280 include_directories : includes,
2281 link_with : [lib_common,
2284 lib_smartcols.get_static_lib()],
2285 dependencies : [lib_readline_static],
2286 install_dir : sbindir,
2288 build_by_default : opt2)
2289 if opt2 and not is_disabler(exe)
2296 include_directories : includes,
2297 link_with : [lib_common,
2301 dependencies : [lib_readline],
2302 install_dir : sbindir,
2304 build_by_default : opt)
2305 if opt and not is_disabler(exe)
2307 bashcompletions += ['sfdisk']
2310 opt2 = opt and 'sfdisk' in static_programs
2314 include_directories : includes,
2315 link_with : [lib_common,
2318 lib_smartcols.get_static_lib()],
2319 dependencies : [lib_readline_static],
2320 install_dir : sbindir,
2322 build_by_default : opt2)
2323 if opt2 and not is_disabler(exe)
2330 include_directories : includes,
2331 link_with : [lib_common,
2336 dependencies : [curses_libs],
2337 install_dir : sbindir,
2339 build_by_default : opt)
2340 if opt and not is_disabler(exe)
2342 manadocs += ['disk-utils/fdisk.8.adoc',
2343 'disk-utils/sfdisk.8.adoc',
2344 'disk-utils/cfdisk.8.adoc']
2345 bashcompletions += ['cfdisk']
2348 opt = not get_option('build-partx').disabled()
2352 include_directories : includes,
2353 link_with : [lib_common],
2354 install_dir : usrsbin_exec_dir,
2356 build_by_default : opt)
2360 include_directories : includes,
2361 link_with : [lib_common],
2362 install_dir : usrsbin_exec_dir,
2364 build_by_default : opt)
2368 include_directories : includes,
2369 link_with : [lib_common],
2370 install_dir : usrsbin_exec_dir,
2372 build_by_default : opt)
2376 include_directories : includes,
2377 link_with : [lib_common,
2380 install_dir : usrsbin_exec_dir,
2382 build_by_default : opt)
2384 exes += [exe, exe2, exe3, exe4]
2385 manadocs += ['disk-utils/addpart.8.adoc',
2386 'disk-utils/delpart.8.adoc',
2387 'disk-utils/resizepart.8.adoc',
2388 'disk-utils/partx.8.adoc']
2389 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2392 ############################################################
2397 include_directories : includes,
2398 link_with : [lib_common],
2399 dependencies : [lib_util,
2403 install_dir : usrbin_exec_dir,
2406 manadocs += ['term-utils/script.1.adoc']
2407 bashcompletions += ['script']
2412 include_directories : includes,
2413 c_args : '-DTEST_SCRIPT',
2414 link_with : [lib_common],
2415 dependencies : [lib_util,
2419 build_by_default : program_tests)
2425 include_directories : includes,
2426 link_with : [lib_common],
2427 dependencies : [lib_util,
2430 install_dir : usrbin_exec_dir,
2433 manadocs += ['term-utils/scriptlive.1.adoc']
2434 bashcompletions += ['scriptlive']
2438 scriptreplay_sources,
2439 include_directories : includes,
2440 link_with : [lib_common],
2441 dependencies : [math_libs],
2442 install_dir : usrbin_exec_dir,
2445 manadocs += ['term-utils/scriptreplay.1.adoc']
2446 bashcompletions += ['scriptreplay']
2448 opt = not get_option('build-agetty').disabled()
2452 include_directories : includes,
2453 link_with : [lib_common, logindefs_c],
2454 dependencies : [BSD ? lib_util : [], lib_systemd],
2455 install_dir : sbindir,
2457 build_by_default : opt)
2460 manadocs += ['term-utils/agetty.8.adoc']
2463 opt = not get_option('build-setterm').disabled()
2467 include_directories : includes,
2468 link_with : [lib_common],
2469 dependencies : [curses_libs],
2470 install_dir : usrbin_exec_dir,
2472 build_by_default : opt)
2475 manadocs += ['term-utils/setterm.1.adoc']
2476 bashcompletions += ['setterm']
2479 opt = not get_option('build-mesg').disabled()
2483 include_directories : includes,
2484 link_with : [lib_common],
2485 install_dir : usrbin_exec_dir,
2487 build_by_default : opt)
2490 manadocs += ['term-utils/mesg.1.adoc']
2491 bashcompletions += ['mesg']
2494 opt = not get_option('build-wall').disabled()
2498 include_directories : includes,
2499 link_with : [lib_common],
2500 dependencies : [lib_systemd],
2501 install_dir : usrbin_exec_dir,
2502 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2504 build_by_default : opt)
2507 manadocs += ['term-utils/wall.1.adoc']
2508 bashcompletions += ['wall']
2511 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2512 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2514 opt = not get_option('build-write').disabled()
2518 include_directories : includes,
2519 link_with : [lib_common],
2520 dependencies : [lib_systemd],
2521 install_dir : usrbin_exec_dir,
2522 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2524 build_by_default : opt)
2527 manadocs += ['term-utils/write.1.adoc']
2528 bashcompletions += ['write']
2531 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2532 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2534 opt = not get_option('build-login').disabled()
2538 include_directories : includes,
2539 link_with : [lib_common, logindefs_c],
2540 dependencies : [lib_pam,
2544 build_by_default : opt)
2545 if not is_disabler(exe)
2547 manadocs += ['login-utils/login.1.adoc']
2550 opt = not get_option('build-sulogin').disabled()
2554 include_directories : includes,
2555 link_with : [lib_common],
2556 dependencies : [lib_crypt,
2558 install_dir : sbindir,
2560 build_by_default : opt)
2561 if not is_disabler(exe)
2563 manadocs += ['login-utils/sulogin.8.adoc']
2569 include_directories : includes,
2570 link_with : [lib_common,
2572 dependencies : [curses_libs],
2573 install_dir : usrbin_exec_dir,
2576 manadocs += ['misc-utils/cal.1.adoc']
2577 bashcompletions += ['cal']
2579 opt = not get_option('build-logger').disabled()
2583 include_directories : includes,
2584 link_with : [lib_common],
2585 dependencies : [lib_systemd],
2586 install_dir : usrbin_exec_dir,
2588 build_by_default : opt)
2589 if opt and not is_disabler(exe)
2591 manadocs += ['misc-utils/logger.1.adoc']
2592 bashcompletions += ['logger']
2598 include_directories : includes,
2599 c_args : '-DTEST_LOGGER',
2600 link_with : [lib_common],
2601 dependencies : [lib_systemd],
2602 build_by_default: program_tests)
2603 if not is_disabler(exe)
2610 include_directories : includes,
2611 install_dir : usrbin_exec_dir,
2614 manadocs += ['misc-utils/look.1.adoc']
2615 bashcompletions += ['look']
2620 include_directories : includes,
2621 link_with : [lib_common],
2622 install_dir : usrbin_exec_dir,
2625 manadocs += ['misc-utils/mcookie.1.adoc']
2626 bashcompletions += ['mcookie']
2628 if build_liblastlog2
2632 include_directories : includes,
2633 link_with : [lib_common, lib_lastlog2],
2634 install_dir : usrbin_exec_dir,
2637 manadocs += ['misc-utils/lastlog2.8.adoc']
2638 bashcompletions += ['lastlog2']
2639 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2640 'liblastlog2/man/ll2_write_entry.3.adoc',
2641 'liblastlog2/man/ll2_read_entry.3.adoc',
2642 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2643 'liblastlog2/man/ll2_read_all.3.adoc',
2644 'liblastlog2/man/ll2_remove_entry.3.adoc',
2645 'liblastlog2/man/ll2_rename_user.3.adoc',
2646 'liblastlog2/man/ll2_update_login_time.3.adoc'
2653 include_directories : includes,
2654 dependencies : [lib_selinux],
2655 install_dir : usrbin_exec_dir,
2658 manadocs += ['misc-utils/namei.1.adoc']
2659 bashcompletions += ['namei']
2664 include_directories : includes,
2665 link_with : [lib_common],
2666 install_dir : usrbin_exec_dir,
2669 manadocs += ['misc-utils/whereis.1.adoc']
2670 bashcompletions += ['whereis']
2675 include_directories : includes,
2676 link_with : [lib_common,
2679 install_dir : usrbin_exec_dir,
2681 if not is_disabler(exe)
2683 manadocs += ['misc-utils/lslocks.8.adoc']
2684 bashcompletions += ['lslocks']
2690 include_directories : includes,
2691 link_with : [lib_common,
2696 dependencies : lib_udev,
2698 if not is_disabler(exe)
2700 manadocs += ['misc-utils/lsblk.8.adoc']
2701 bashcompletions += ['lsblk']
2704 errnos_h = custom_target('errnos.h',
2705 input : 'tools/all_errnos',
2706 output : 'errnos.h',
2707 command : ['tools/all_errnos', cc.cmd_array()]
2711 mq_libs += cc.find_library('rt', required : true)
2715 lsfd_sources, errnos_h,
2716 include_directories : includes,
2717 link_with : [lib_common,
2719 dependencies : mq_libs,
2720 install_dir : usrbin_exec_dir,
2722 if not is_disabler(exe)
2724 manadocs += ['misc-utils/lsfd.1.adoc']
2730 include_directories : includes,
2731 link_with : [lib_common,
2733 install_dir : usrbin_exec_dir,
2735 if not is_disabler(exe)
2737 manadocs += ['misc-utils/uuidgen.1.adoc']
2738 bashcompletions += ['uuidgen']
2744 include_directories : includes,
2745 link_with : [lib_common,
2748 install_dir : usrbin_exec_dir,
2750 if not is_disabler(exe)
2752 manadocs += ['misc-utils/uuidparse.1.adoc']
2753 bashcompletions += ['uuidparse']
2760 include_directories : includes,
2761 link_with : [lib_common,
2763 dependencies : [realtime_libs,
2765 install_dir : usrsbin_exec_dir,
2767 build_by_default : opt)
2771 include_directories : includes,
2772 link_with : [lib_common,
2774 dependencies : thread_libs,
2775 build_by_default : opt and program_tests)
2776 if not is_disabler(exe)
2778 manadocs += ['misc-utils/uuidd.8.adoc']
2779 bashcompletions += ['uuidd']
2782 opt = build_libblkid
2786 include_directories : includes,
2787 link_with : [lib_common,
2789 install_dir : sbindir,
2791 build_by_default : opt)
2792 if opt and not is_disabler(exe)
2794 manadocs += ['misc-utils/blkid.8.adoc']
2795 bashcompletions += ['blkid']
2798 opt = opt and 'blkid' in static_programs
2802 include_directories : includes,
2803 link_with : [lib_common,
2805 install_dir : sbindir,
2807 build_by_default : opt)
2808 if opt and not is_disabler(exe)
2814 'libblkid/samples/mkfs.c',
2815 include_directories : includes,
2816 link_with : lib_blkid)
2817 if not is_disabler(exe)
2822 'sample-partitions',
2823 'libblkid/samples/partitions.c',
2824 include_directories : includes,
2825 link_with : lib_blkid)
2826 if not is_disabler(exe)
2831 'sample-superblocks',
2832 'libblkid/samples/superblocks.c',
2833 include_directories : includes,
2834 link_with : lib_blkid)
2835 if not is_disabler(exe)
2841 'libblkid/samples/topology.c',
2842 include_directories : includes,
2843 link_with : lib_blkid)
2844 if not is_disabler(exe)
2849 'test_blkid_fuzz_sample',
2850 'libblkid/src/fuzz.c',
2851 include_directories: includes,
2852 link_with: lib_blkid,
2853 build_by_default: program_tests)
2854 if not is_disabler(exe)
2858 ############################################################
2863 include_directories : includes,
2864 link_with : [lib_blkid],
2865 install_dir : sbindir,
2867 if not is_disabler(exe)
2869 manadocs += ['misc-utils/findfs.8.adoc']
2870 bashcompletions += ['findfs']
2876 include_directories : includes,
2877 link_with : [lib_common,
2880 install_dir : sbindir,
2882 if not is_disabler(exe)
2884 manadocs += ['misc-utils/wipefs.8.adoc']
2885 bashcompletions += ['wipefs']
2891 include_directories : includes,
2892 link_with : [lib_common,
2896 dependencies : [lib_udev],
2898 if not is_disabler(exe)
2900 manadocs += ['misc-utils/findmnt.8.adoc']
2901 bashcompletions += ['findmnt']
2907 include_directories : includes,
2908 link_with : [lib_common],
2910 if not is_disabler(exe)
2912 manadocs += ['misc-utils/kill.1.adoc']
2915 opt = not get_option('build-rename').disabled()
2919 include_directories : includes,
2920 install_dir : usrbin_exec_dir,
2922 build_by_default : opt)
2923 if opt and not is_disabler(exe)
2925 manadocs += ['misc-utils/rename.1.adoc']
2926 bashcompletions += ['rename']
2932 include_directories : includes,
2933 link_with : [lib_common],
2934 install_dir : usrbin_exec_dir,
2937 manadocs += ['misc-utils/getopt.1.adoc']
2938 bashcompletions += ['getopt']
2943 include_directories : includes,
2944 link_with : [lib_common,
2946 install_dir : usrbin_exec_dir,
2948 if not is_disabler(exe)
2950 manadocs += ['misc-utils/fincore.1.adoc']
2951 bashcompletions += ['fincore']
2957 include_directories : includes,
2958 link_with : [lib_common],
2959 install_dir : usrbin_exec_dir,
2961 if not is_disabler(exe)
2963 manadocs += ['misc-utils/hardlink.1.adoc']
2964 bashcompletions += ['hardlink']
2967 opt = not get_option('build-pipesz').disabled()
2971 include_directories : includes,
2972 link_with : [lib_common],
2973 install_dir : usrbin_exec_dir,
2975 if opt and not is_disabler(exe)
2977 manadocs += ['misc-utils/pipesz.1.adoc']
2978 bashcompletions += ['pipesz']
2984 include_directories : includes,
2985 c_args : '-DTEST_CAL',
2986 link_with : [lib_common,
2988 dependencies : [curses_libs],
2989 build_by_default: program_tests)
2990 if not is_disabler(exe)
2997 include_directories : includes,
2998 link_with : [lib_common],
2999 install_dir : usrbin_exec_dir,
3001 if not is_disabler(exe)
3003 manadocs += ['misc-utils/fadvise.1.adoc']
3004 bashcompletions += ['fadvise']
3007 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3011 include_directories : includes,
3012 link_with : [lib_common],
3013 install_dir : usrbin_exec_dir,
3015 if not is_disabler(exe)
3017 manadocs += ['misc-utils/waitpid.1.adoc']
3018 bashcompletions += ['waitpid']
3022 syscalls_h = custom_target('syscalls.h',
3023 input : 'tools/all_syscalls',
3024 output : 'syscalls.h',
3025 command : ['tools/all_syscalls', cc.cmd_array()]
3028 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3031 'misc-utils/enosys.c', syscalls_h, errnos_h,
3032 include_directories : includes,
3033 link_with : [lib_common],
3034 install_dir : usrbin_exec_dir,
3036 if not is_disabler(exe)
3038 manadocs += ['misc-utils/enosys.1.adoc']
3039 bashcompletions += ['enosys']
3046 include_directories : includes,
3047 link_with : [lib_common, lib_smartcols],
3048 install_dir : usrbin_exec_dir,
3050 if not is_disabler(exe)
3052 manadocs += ['misc-utils/lsclocks.1.adoc']
3053 bashcompletions += ['lsclocks']
3056 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3060 include_directories : includes,
3061 link_with : [lib_common],
3062 install_dir : usrbin_exec_dir,
3064 if not is_disabler(exe)
3066 manadocs += ['misc-utils/exch.1.adoc']
3067 bashcompletions += ['exch']
3071 ############################################################
3073 opt = not get_option('build-schedutils').disabled()
3076 'schedutils/chrt.c',
3077 include_directories : includes,
3078 link_with : lib_common,
3079 install_dir : usrbin_exec_dir,
3081 build_by_default : opt)
3085 'schedutils/ionice.c',
3086 include_directories : includes,
3087 link_with : lib_common,
3088 install_dir : usrbin_exec_dir,
3090 build_by_default : opt)
3094 'schedutils/taskset.c',
3095 include_directories : includes,
3096 link_with : lib_common,
3097 install_dir : usrbin_exec_dir,
3099 build_by_default : opt)
3103 'schedutils/uclampset.c',
3104 include_directories : includes,
3105 link_with : lib_common,
3106 install_dir : usrbin_exec_dir,
3108 build_by_default : opt)
3110 if opt and not is_disabler(exe)
3111 exes += [exe, exe2, exe3, exe4]
3112 manadocs += ['schedutils/chrt.1.adoc',
3113 'schedutils/ionice.1.adoc',
3114 'schedutils/taskset.1.adoc',
3115 'schedutils/uclampset.1.adoc']
3116 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3119 ############################################################
3121 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3126 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3127 include_directories : dir_include,
3128 link_with : lib_common,
3129 build_by_default: program_tests)
3135 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3136 include_directories : dir_include,
3137 link_with : lib_common,
3138 build_by_default: program_tests)
3144 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3145 include_directories : dir_include,
3146 link_with : lib_common,
3147 build_by_default: program_tests)
3153 c_args : ['-DTEST_PROGRAM_MANGLE'],
3154 include_directories : dir_include,
3155 build_by_default: program_tests)
3161 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3162 include_directories : dir_include,
3163 build_by_default: program_tests)
3169 'lib/color-names.c',
3170 c_args : ['-DTEST_PROGRAM_COLORS'],
3171 include_directories : dir_include,
3172 link_with : [lib_common, lib_tcolors],
3173 build_by_default: program_tests)
3179 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3180 include_directories : dir_include,
3181 build_by_default: program_tests)
3184 if conf.get('HAVE_OPENAT').to_string() == '1' \
3185 and conf.get('HAVE_DIRFD').to_string() == '1'
3189 c_args : ['-DTEST_PROGRAM_PROCFS'],
3190 include_directories : dir_include,
3191 link_with : lib_common,
3192 build_by_default: program_tests)
3199 have_cpu_set_t ? 'lib/cpuset.c' : [],
3200 c_args : ['-DTEST_PROGRAM_PATH'],
3201 include_directories : dir_include,
3202 link_with : lib_common,
3203 build_by_default: program_tests)
3207 if conf.get('HAVE_PTY').to_string() == '1'
3212 c_args : ['-DTEST_PROGRAM_PTY'],
3213 include_directories : dir_include,
3214 link_with : [lib_common],
3215 dependencies : [lib_m,
3218 build_by_default: program_tests)
3226 c_args : ['-DTEST_PROGRAM_CPUSET'],
3227 include_directories : dir_include,
3228 build_by_default: program_tests)
3239 have_cpu_set_t ? 'lib/cpuset.c' : [],
3240 c_args : ['-DTEST_PROGRAM_SYSFS'],
3241 include_directories : dir_include,
3242 build_by_default: program_tests)
3248 c_args : ['-DTEST_PROGRAM_PAGER'],
3249 include_directories : dir_include,
3250 build_by_default: program_tests)
3254 'test_linux_version',
3255 'lib/linux_version.c',
3256 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3257 include_directories : dir_include,
3258 build_by_default: program_tests)
3264 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3265 include_directories : dir_include,
3266 build_by_default: program_tests)
3270 'test_canonicalize',
3271 'lib/canonicalize.c',
3272 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3273 include_directories : dir_include,
3274 build_by_default: program_tests)
3281 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3282 include_directories : dir_include,
3283 build_by_default: program_tests)
3289 c_args : ['-DTEST_PROGRAM'],
3290 include_directories : dir_include,
3291 link_with : lib_common,
3292 build_by_default: program_tests)
3298 c_args : ['-DTEST_PROGRAM'],
3299 include_directories : dir_include,
3300 link_with : [lib_common, logindefs_c],
3301 build_by_default: program_tests)
3305 ############################################################
3309 'libuuid/src/test_uuid.c',
3310 include_directories : [dir_include, dir_libuuid],
3311 link_with : lib_uuid,
3312 dependencies : socket_libs,
3313 build_by_default: program_tests)
3314 if not is_disabler(exe)
3318 ############################################################
3320 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3321 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3325 'libfdisk/src/ask.c',
3326 c_args : libfdisk_tests_cflags,
3327 include_directories : lib_fdisk_includes,
3328 link_with : libfdisk_tests_ldadd,
3329 build_by_default: program_tests)
3330 if not is_disabler(exe)
3336 'libfdisk/src/gpt.c',
3337 c_args : libfdisk_tests_cflags,
3338 include_directories : lib_fdisk_includes,
3339 link_with : libfdisk_tests_ldadd,
3340 build_by_default: program_tests)
3341 if not is_disabler(exe)
3347 'libfdisk/src/utils.c',
3348 c_args : libfdisk_tests_cflags,
3349 include_directories : lib_fdisk_includes,
3350 link_with : libfdisk_tests_ldadd,
3351 build_by_default: program_tests)
3352 if not is_disabler(exe)
3357 'test_fdisk_script',
3358 'libfdisk/src/script.c',
3359 c_args : libfdisk_tests_cflags,
3360 include_directories : lib_fdisk_includes,
3361 link_with : libfdisk_tests_ldadd,
3362 build_by_default: program_tests)
3363 if not is_disabler(exe)
3368 'test_fdisk_version',
3369 'libfdisk/src/version.c',
3370 c_args : libfdisk_tests_cflags,
3371 include_directories : lib_fdisk_includes,
3372 link_with : libfdisk_tests_ldadd,
3373 build_by_default: program_tests)
3374 if not is_disabler(exe)
3380 'libfdisk/src/item.c',
3381 c_args : libfdisk_tests_cflags,
3382 include_directories : lib_fdisk_includes,
3383 link_with : libfdisk_tests_ldadd,
3384 build_by_default: program_tests)
3385 if not is_disabler(exe)
3389 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3392 'sample-fdisk-mkpart',
3393 'libfdisk/samples/mkpart.c',
3394 include_directories : lib_fdisk_includes,
3395 link_with : sample_fdisk_ldadd)
3396 if not is_disabler(exe)
3401 'sample-fdisk-mkpart-fullspec',
3402 'libfdisk/samples/mkpart-fullspec.c',
3403 include_directories : lib_fdisk_includes,
3404 link_with : sample_fdisk_ldadd)
3405 if not is_disabler(exe)
3409 ############################################################
3413 'tests/helpers/test_cap.c',
3414 include_directories : includes,
3415 dependencies : [lib_cap_ng],
3416 build_by_default: program_tests)
3417 if not is_disabler(exe)
3423 'tests/helpers/test_mbsencode.c',
3424 include_directories : includes,
3425 link_with : lib_common,
3426 build_by_default: program_tests)
3431 'tests/helpers/test_byteswap.c',
3432 include_directories : includes,
3433 build_by_default: program_tests)
3438 'tests/helpers/test_md5.c',
3440 include_directories : includes,
3441 build_by_default: program_tests)
3446 'tests/helpers/test_sha1.c',
3448 include_directories : includes,
3449 build_by_default: program_tests)
3454 'tests/helpers/test_pathnames.c',
3455 include_directories : includes,
3456 build_by_default: program_tests)
3461 'tests/helpers/test_strerror.c',
3462 include_directories : includes,
3463 build_by_default: program_tests)
3468 'tests/helpers/test_sysinfo.c',
3469 include_directories : includes,
3470 build_by_default: program_tests)
3475 'tests/helpers/test_sigreceive.c',
3476 include_directories : includes,
3477 link_with : lib_common,
3478 build_by_default: program_tests)
3483 'tests/helpers/test_tiocsti.c',
3484 include_directories : includes,
3485 build_by_default: program_tests)
3489 'test_uuid_namespace',
3490 'tests/helpers/test_uuid_namespace.c',
3494 include_directories : includes,
3495 build_by_default: program_tests)
3501 'tests/helpers/test_mkfds.c',
3502 'tests/helpers/test_mkfds.h',
3503 'tests/helpers/test_mkfds_ppoll.c',
3504 include_directories : includes,
3505 dependencies : mq_libs,
3506 build_by_default: program_tests)
3512 'tests/helpers/test_enosys.c',
3513 include_directories : includes,
3514 build_by_default: program_tests)
3517 ############################################################
3519 if conf.get('HAVE_OPENAT').to_string() == '1'
3521 'sample-scols-tree',
3522 'libsmartcols/samples/tree.c',
3523 include_directories : includes,
3524 link_with : [lib_smartcols, lib_common],
3525 build_by_default: program_tests)
3526 if not is_disabler(exe)
3532 'sample-scols-title',
3533 'libsmartcols/samples/title.c',
3534 include_directories : includes,
3535 link_with : [lib_smartcols, lib_common])
3536 if not is_disabler(exe)
3541 'sample-scols-wrap',
3542 'libsmartcols/samples/wrap.c',
3543 include_directories : includes,
3544 link_with : [lib_smartcols, lib_common])
3545 if not is_disabler(exe)
3550 'sample-scols-continuous',
3551 'libsmartcols/samples/continuous.c',
3552 include_directories : includes,
3553 link_with : [lib_smartcols, lib_common])
3554 if not is_disabler(exe)
3559 'sample-scols-continuous-json',
3560 'libsmartcols/samples/continuous-json.c',
3561 include_directories : includes,
3562 link_with : [lib_smartcols, lib_common])
3563 if not is_disabler(exe)
3568 'sample-scols-maxout',
3569 'libsmartcols/samples/maxout.c',
3570 include_directories : includes,
3571 link_with : [lib_smartcols, lib_common])
3572 if not is_disabler(exe)
3577 'sample-scols-fromfile',
3578 'libsmartcols/samples/fromfile.c',
3579 include_directories : includes,
3580 link_with : [lib_smartcols, lib_common])
3581 if not is_disabler(exe)
3586 'sample-scols-grouping-simple',
3587 'libsmartcols/samples/grouping-simple.c',
3588 include_directories : includes,
3589 link_with : [lib_smartcols, lib_common])
3590 if not is_disabler(exe)
3595 'sample-scols-grouping-overlay',
3596 'libsmartcols/samples/grouping-overlay.c',
3597 include_directories : includes,
3598 link_with : [lib_smartcols, lib_common])
3599 if not is_disabler(exe)
3605 'Documentation/boilerplate.c',
3606 include_directories : includes,
3607 build_by_default: program_tests)
3608 if not is_disabler(exe)
3612 ############################################################
3614 # Let the test runner know whether we're running under asan and export
3615 # some paths. We use a file on disk so that it is possible to run the
3616 # test scripts from commandline without setting any variables.
3617 configure_file(output : 'meson.conf',
3622 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3623 python.full_path())])
3625 run_sh = find_program('tests/run.sh')
3629 '--srcdir=' + meson.current_source_dir(),
3630 '--builddir=' + meson.current_build_dir(),
3636 manadocs += ['lib/terminal-colors.d.5.adoc']
3637 manadocs += ['libblkid/libblkid.3.adoc']
3641 'libuuid/man/uuid.3.adoc',
3642 'libuuid/man/uuid_clear.3.adoc',
3643 'libuuid/man/uuid_compare.3.adoc',
3644 'libuuid/man/uuid_copy.3.adoc',
3645 'libuuid/man/uuid_generate.3.adoc',
3646 'libuuid/man/uuid_is_null.3.adoc',
3647 'libuuid/man/uuid_parse.3.adoc',
3648 'libuuid/man/uuid_time.3.adoc',
3649 'libuuid/man/uuid_unparse.3.adoc']
3651 'uuid_generate_random.3': 'uuid_generate.3',
3652 'uuid_generate_time.3': 'uuid_generate.3',
3653 'uuid_generate_time_safe.3': 'uuid_generate.3',
3657 asciidoctor = find_program('asciidoctor', required : false)
3658 if asciidoctor.found()
3659 foreach adoc : manadocs
3660 name = adoc.split('/')[-1]
3661 page = name.split('.adoc')[0]
3662 section = page.split('.')[-1]
3663 mandirn = join_paths(mandir, 'man' + section)
3668 command : [ asciidoctor,
3670 '-a', 'VERSION=' + meson.project_version(),
3671 '-a', 'release-version=' + meson.project_version(),
3672 '-a', 'ADJTIME_PATH=/etc/adjtime',
3673 '-a', 'package-docdir=' + docdir,
3674 '--base-dir=' + meson.current_source_dir(),
3675 '--destination-dir=' + meson.current_build_dir(),
3676 '--load-path', '@SOURCE_ROOT@/tools',
3677 '--require', 'asciidoctor-includetracker',
3681 depfile : page + '.deps',
3683 install_dir : mandirn)
3686 foreach link_name, target : manlinks
3687 link_section = link_name.split('.')[-1]
3688 target_section = target.split('.')[-1]
3689 meson.add_install_script(meson_make_manpage_stub,
3690 join_paths('man' + target_section, target),
3691 join_paths(mandir, 'man' + link_section, link_name))
3695 if bash_completion.found()
3696 foreach completion : bashcompletions
3698 join_paths('bash-completion', completion),
3699 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3702 foreach link_name, target : bashcompletionslinks
3703 meson.add_install_script(meson_make_symlink,
3705 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))