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']
1564 if cc.has_header('linux/blkzoned.h')
1568 include_directories : includes,
1569 link_with : [lib_common],
1570 install_dir : sbindir,
1573 manadocs += ['sys-utils/blkzone.8.adoc']
1574 bashcompletions += ['blkzone']
1577 if cc.has_header('linux/pr.h')
1581 include_directories : includes,
1582 link_with : [lib_common],
1583 install_dir : sbindir,
1586 manadocs += ['sys-utils/blkpr.8.adoc']
1592 include_directories : includes,
1593 link_with : [lib_common],
1594 install_dir : usrsbin_exec_dir,
1597 manadocs += ['sys-utils/ldattach.8.adoc']
1598 bashcompletions += ['ldattach']
1603 include_directories : includes,
1604 link_with : [lib_common],
1605 install_dir : usrsbin_exec_dir,
1608 manadocs += ['sys-utils/rtcwake.8.adoc']
1609 bashcompletions += ['rtcwake']
1614 include_directories : includes,
1615 link_with : [lib_common],
1616 install_dir : usrbin_exec_dir,
1619 manadocs += ['sys-utils/setarch.8.adoc']
1620 bashcompletions += ['setarch']
1622 setarch_links = ['uname26', 'linux32', 'linux64']
1623 setarch_links_arch = {
1624 's390x' : ['s390', 's390x'],
1626 'x86_64' : ['i386', 'x86_64'],
1627 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1628 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1629 'mips64' : ['mips', 'mips64', 'mips32'],
1630 'ia64' : ['i386', 'ia64'],
1631 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1633 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1635 foreach link: setarch_links
1636 meson.add_install_script(meson_make_symlink,
1638 join_paths(usrbin_exec_dir, link))
1639 manlinks += {link + '.8': 'setarch.8'}
1642 opt = not get_option('build-eject').disabled()
1646 include_directories : includes,
1647 link_with : [lib_common,
1649 install_dir : usrbin_exec_dir,
1651 build_by_default : opt)
1652 if opt and not is_disabler(exe)
1654 manadocs += ['sys-utils/eject.1.adoc']
1655 bashcompletions += ['eject']
1658 opt = not get_option('build-losetup').disabled()
1662 include_directories : includes,
1663 link_with : [lib_common,
1665 install_dir : sbindir,
1667 build_by_default : opt)
1668 if opt and not is_disabler(exe)
1669 manadocs += ['sys-utils/losetup.8.adoc']
1671 bashcompletions += ['losetup']
1674 opt = opt and 'losetup' in static_programs
1678 include_directories : includes,
1679 link_args : ['--static'],
1680 link_with : [lib_common,
1681 lib_smartcols.get_static_lib()],
1682 install_dir : sbindir,
1684 build_by_default : opt)
1685 if opt and not is_disabler(exe)
1689 opt = not get_option('build-zramctl').disabled()
1693 include_directories : includes,
1694 link_with : [lib_common,
1696 install_dir : sbindir,
1698 build_by_default : opt)
1699 if opt and not is_disabler(exe)
1701 manadocs += ['sys-utils/zramctl.8.adoc']
1702 bashcompletions += ['zramctl']
1708 include_directories : includes,
1709 link_with : [lib_common,
1711 install_dir : usrbin_exec_dir,
1713 if not is_disabler(exe)
1715 manadocs += ['sys-utils/prlimit.1.adoc']
1716 bashcompletions += ['prlimit']
1722 include_directories : includes,
1723 link_with : [lib_common,
1726 install_dir : usrbin_exec_dir,
1728 if not is_disabler(exe)
1730 manadocs += ['sys-utils/lsns.8.adoc']
1731 bashcompletions += ['lsns']
1734 opt = not get_option('build-mount').disabled()
1738 include_directories : includes,
1739 link_with : [lib_common,
1742 dependencies : lib_selinux,
1743 install_mode : 'rwsr-xr-x',
1745 build_by_default : opt)
1749 include_directories : includes,
1750 link_with : [lib_common,
1752 install_mode : 'rwsr-xr-x',
1754 build_by_default : opt)
1755 if opt and not is_disabler(exe)
1757 manadocs += ['sys-utils/fstab.5.adoc',
1758 'sys-utils/mount.8.adoc',
1759 'sys-utils/umount.8.adoc']
1760 bashcompletions += ['mount', 'umount']
1763 opt2 = opt and 'mount' in static_programs
1767 include_directories : includes,
1768 link_args : ['--static'],
1769 link_with : [lib_common,
1770 lib_smartcols_static,
1773 build_by_default : opt2)
1774 if opt2 and not is_disabler(exe)
1778 opt2 = opt and 'umount' in static_programs
1782 include_directories : includes,
1783 link_args : ['--static'],
1784 link_with : [lib_common,
1787 build_by_default : opt2)
1788 if opt2 and not is_disabler(exe)
1797 include_directories : includes,
1798 link_with : [lib_common,
1802 install_dir : sbindir,
1804 if not is_disabler(exe)
1806 manadocs += ['sys-utils/swapon.8.adoc']
1807 bashcompletions += ['swapon']
1813 include_directories : includes,
1814 link_with : [lib_common,
1817 install_dir : sbindir,
1819 if not is_disabler(exe)
1821 manlinks += {'swapoff.8': 'swapon.8'}
1822 bashcompletions += ['swapoff']
1828 include_directories : includes,
1829 link_with : [lib_common,
1831 dependencies : [rtas_libs],
1832 install_dir : usrbin_exec_dir,
1834 if not is_disabler(exe)
1836 manadocs += ['sys-utils/lscpu.1.adoc']
1837 bashcompletions += ['lscpu']
1843 include_directories : includes,
1844 link_with : [lib_common],
1845 install_dir : sbindir,
1848 manadocs += ['sys-utils/chcpu.8.adoc']
1849 bashcompletions += ['chcpu']
1854 include_directories : includes,
1855 link_with : [lib_common,
1858 if not is_disabler(exe)
1860 manadocs += ['sys-utils/wdctl.8.adoc']
1861 bashcompletions += ['wdctl']
1864 opt = not get_option('build-mountpoint').disabled()
1868 include_directories : includes,
1869 link_with : [lib_mount],
1871 build_by_default : opt)
1872 if opt and not is_disabler(exe)
1874 manadocs += ['sys-utils/mountpoint.1.adoc']
1875 bashcompletions += ['mountpoint']
1878 opt = not get_option('build-fallocate').disabled()
1882 include_directories : includes,
1883 link_with : [lib_common],
1884 install_dir : usrbin_exec_dir,
1886 build_by_default : opt)
1887 if opt and not is_disabler(exe)
1889 manadocs += ['sys-utils/fallocate.1.adoc']
1890 bashcompletions += ['fallocate']
1893 opt = not get_option('build-pivot_root').disabled()
1897 include_directories : includes,
1898 install_dir : sbindir,
1900 build_by_default : opt)
1901 if opt and not is_disabler(exe)
1903 manadocs += ['sys-utils/pivot_root.8.adoc']
1904 bashcompletions += ['pivot_root']
1907 opt = not get_option('build-switch_root').disabled()
1908 if opt and not have_dirfd and not have_ddfd
1909 error('neither dirfd nor ddfd are available')
1913 switch_root_sources,
1914 include_directories : includes,
1915 install_dir : sbindir,
1917 build_by_default : opt)
1918 if opt and not is_disabler(exe)
1920 manadocs += ['sys-utils/switch_root.8.adoc']
1923 opt = not get_option('build-unshare').disabled()
1927 include_directories : includes,
1928 link_with : [lib_common],
1929 install_dir : usrbin_exec_dir,
1931 build_by_default : opt)
1932 if opt and not is_disabler(exe)
1934 manadocs += ['sys-utils/unshare.1.adoc']
1935 bashcompletions += ['unshare']
1938 opt = opt and 'unshare' in static_programs
1942 include_directories : includes,
1943 link_with : [lib_common],
1944 install_dir : usrbin_exec_dir,
1946 build_by_default : opt)
1947 if opt and not is_disabler(exe)
1951 opt = not get_option('build-nsenter').disabled()
1955 include_directories : includes,
1956 link_with : [lib_common],
1957 dependencies : [lib_selinux],
1958 install_dir : usrbin_exec_dir,
1960 build_by_default : opt)
1961 if opt and not is_disabler(exe)
1963 manadocs += ['sys-utils/nsenter.1.adoc']
1964 bashcompletions += ['nsenter']
1967 opt = opt and 'nsenter' in static_programs
1971 include_directories : includes,
1972 link_with : [lib_common],
1973 dependencies : [lib_selinux],
1974 install_dir : usrbin_exec_dir,
1976 build_by_default : opt)
1977 if opt and not is_disabler(exe)
1981 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1985 include_directories : includes,
1986 link_with : [lib_common],
1987 dependencies : [lib_cap_ng],
1988 install_dir : usrbin_exec_dir,
1990 build_by_default : opt)
1991 if opt and not is_disabler(exe)
1993 manadocs += ['sys-utils/setpriv.1.adoc']
1994 bashcompletions += ['setpriv']
2000 include_directories : includes,
2001 link_with : [lib_common],
2002 dependencies : realtime_libs,
2003 install_dir : usrbin_exec_dir,
2006 manadocs += ['sys-utils/flock.1.adoc']
2007 bashcompletions += ['flock']
2009 opt = not get_option('build-lsirq').disabled()
2013 include_directories : includes,
2014 link_with : [lib_common,
2016 install_dir : usrbin_exec_dir,
2018 build_by_default : opt)
2019 if opt and not is_disabler(exe)
2021 manadocs += ['sys-utils/lsirq.1.adoc']
2022 bashcompletions += ['lsirq']
2025 opt = not get_option('build-irqtop').disabled()
2029 include_directories : includes,
2030 dependencies : [realtime_libs, curses_libs],
2031 link_with : [lib_common,
2034 install_dir : usrbin_exec_dir,
2036 build_by_default : opt)
2037 if opt and not is_disabler(exe)
2039 manadocs += ['sys-utils/irqtop.1.adoc']
2040 bashcompletions += ['irqtop']
2043 opt = not get_option('build-ipcs').disabled()
2047 include_directories : includes,
2048 link_with : [lib_common,
2050 install_dir : usrbin_exec_dir,
2052 build_by_default : opt)
2053 if opt and not is_disabler(exe)
2055 manadocs += ['sys-utils/lsipc.1.adoc']
2056 bashcompletions += ['lsipc']
2063 include_directories : includes,
2064 link_with : [lib_common],
2065 dependencies : [lib_m,
2067 install_dir : sbindir,
2069 build_by_default : opt)
2070 if opt and not is_disabler(exe)
2072 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2073 bashcompletions += ['hwclock']
2079 include_directories : includes,
2080 install_dir : sbindir,
2083 manadocs += ['disk-utils/mkfs.8.adoc']
2084 bashcompletions += ['mkfs']
2086 opt = not get_option('build-bfs').disabled()
2090 include_directories : includes,
2091 link_with : [lib_common],
2092 install_dir : sbindir,
2094 build_by_default : opt)
2095 if opt and not is_disabler(exe)
2097 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2098 bashcompletions += ['mkfs.bfs']
2104 include_directories : includes,
2105 link_with : [lib_common],
2106 install_dir : usrbin_exec_dir,
2109 manadocs += ['disk-utils/isosize.8.adoc']
2110 bashcompletions += ['isosize']
2115 include_directories : includes,
2116 link_with : [lib_common,
2119 dependencies: [lib_selinux],
2120 install_dir : sbindir,
2122 if not is_disabler(exe)
2124 manadocs += ['disk-utils/mkswap.8.adoc']
2125 bashcompletions += ['mkswap']
2131 include_directories : includes,
2132 link_with : [lib_common,
2135 install_dir : sbindir,
2137 if not is_disabler(exe)
2139 manadocs += ['disk-utils/swaplabel.8.adoc']
2140 bashcompletions += ['swaplabel']
2143 opt = not get_option('build-fsck').disabled()
2147 include_directories : includes,
2148 link_with : [lib_common,
2151 dependencies : realtime_libs,
2152 install_dir : sbindir,
2154 build_by_default : opt)
2155 if opt and not is_disabler(exe)
2157 manadocs += ['disk-utils/fsck.8.adoc']
2158 bashcompletions += ['fsck']
2161 opt = not get_option('build-minix').disabled()
2165 include_directories : includes,
2166 link_with : [lib_common],
2167 install_dir : sbindir,
2169 build_by_default : opt)
2173 include_directories : includes,
2174 c_args : '-DTEST_SCRIPT',
2175 link_with : [lib_common],
2176 build_by_default : opt and program_tests)
2180 include_directories : includes,
2181 link_with : [lib_common],
2182 install_dir : sbindir,
2184 build_by_default : opt)
2185 if opt and not is_disabler(exe)
2186 exes += [exe, exe2, exe3]
2187 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2188 bashcompletions += ['mkfs.minix', 'fsck.minix']
2191 opt = not get_option('build-cramfs').disabled()
2194 mkfs_cramfs_sources,
2195 include_directories : includes,
2196 link_with : [lib_common],
2197 dependencies : [lib_z],
2198 install_dir : sbindir,
2200 build_by_default : opt)
2203 fsck_cramfs_sources,
2204 include_directories : includes,
2205 link_with : [lib_common],
2206 dependencies : [lib_z],
2207 install_dir : sbindir,
2209 build_by_default : opt)
2210 if not is_disabler(exe)
2212 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2213 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2216 opt = not get_option('build-raw').disabled()
2218 cc.has_header('linux/raw.h', required: opt)
2223 include_directories : includes,
2224 install_dir : sbindir,
2226 build_by_default : opt)
2227 if opt and not is_disabler(exe)
2229 manadocs += ['disk-utils/raw.8.adoc']
2230 bashcompletions += ['raw']
2233 opt = not get_option('build-fdformat').disabled()
2237 include_directories : includes,
2238 link_with : [lib_common],
2239 install_dir : usrsbin_exec_dir,
2241 build_by_default : opt)
2242 if opt and not is_disabler(exe)
2244 manadocs += ['disk-utils/fdformat.8.adoc']
2245 bashcompletions += ['fdformat']
2251 include_directories : includes,
2252 link_with : [lib_common],
2253 install_dir : sbindir,
2255 manadocs += ['disk-utils/blockdev.8.adoc']
2256 bashcompletions += ['blockdev']
2258 opt = not get_option('build-fdisks').disabled()
2259 if opt and not have_dirfd and not have_ddfd
2260 error('neither dirfd nor ddfd are available')
2265 include_directories : includes,
2266 link_with : [lib_common,
2270 dependencies : [lib_readline],
2271 install_dir : sbindir,
2273 build_by_default : opt)
2274 if opt and not is_disabler(exe)
2276 bashcompletions += ['fdisk']
2279 opt2 = opt and 'fdisk' in static_programs
2283 link_args : ['--static'],
2284 include_directories : includes,
2285 link_with : [lib_common,
2288 lib_smartcols.get_static_lib()],
2289 dependencies : [lib_readline_static],
2290 install_dir : sbindir,
2292 build_by_default : opt2)
2293 if opt2 and not is_disabler(exe)
2300 include_directories : includes,
2301 link_with : [lib_common,
2305 dependencies : [lib_readline],
2306 install_dir : sbindir,
2308 build_by_default : opt)
2309 if opt and not is_disabler(exe)
2311 bashcompletions += ['sfdisk']
2314 opt2 = opt and 'sfdisk' in static_programs
2318 include_directories : includes,
2319 link_with : [lib_common,
2322 lib_smartcols.get_static_lib()],
2323 dependencies : [lib_readline_static],
2324 install_dir : sbindir,
2326 build_by_default : opt2)
2327 if opt2 and not is_disabler(exe)
2334 include_directories : includes,
2335 link_with : [lib_common,
2340 dependencies : [curses_libs],
2341 install_dir : sbindir,
2343 build_by_default : opt)
2344 if opt and not is_disabler(exe)
2346 manadocs += ['disk-utils/fdisk.8.adoc',
2347 'disk-utils/sfdisk.8.adoc',
2348 'disk-utils/cfdisk.8.adoc']
2349 bashcompletions += ['cfdisk']
2352 opt = not get_option('build-partx').disabled()
2356 include_directories : includes,
2357 link_with : [lib_common],
2358 install_dir : usrsbin_exec_dir,
2360 build_by_default : opt)
2364 include_directories : includes,
2365 link_with : [lib_common],
2366 install_dir : usrsbin_exec_dir,
2368 build_by_default : opt)
2372 include_directories : includes,
2373 link_with : [lib_common],
2374 install_dir : usrsbin_exec_dir,
2376 build_by_default : opt)
2380 include_directories : includes,
2381 link_with : [lib_common,
2384 install_dir : usrsbin_exec_dir,
2386 build_by_default : opt)
2388 exes += [exe, exe2, exe3, exe4]
2389 manadocs += ['disk-utils/addpart.8.adoc',
2390 'disk-utils/delpart.8.adoc',
2391 'disk-utils/resizepart.8.adoc',
2392 'disk-utils/partx.8.adoc']
2393 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2396 ############################################################
2401 include_directories : includes,
2402 link_with : [lib_common],
2403 dependencies : [lib_util,
2407 install_dir : usrbin_exec_dir,
2410 manadocs += ['term-utils/script.1.adoc']
2411 bashcompletions += ['script']
2416 include_directories : includes,
2417 c_args : '-DTEST_SCRIPT',
2418 link_with : [lib_common],
2419 dependencies : [lib_util,
2423 build_by_default : program_tests)
2429 include_directories : includes,
2430 link_with : [lib_common],
2431 dependencies : [lib_util,
2434 install_dir : usrbin_exec_dir,
2437 manadocs += ['term-utils/scriptlive.1.adoc']
2438 bashcompletions += ['scriptlive']
2442 scriptreplay_sources,
2443 include_directories : includes,
2444 link_with : [lib_common],
2445 dependencies : [math_libs],
2446 install_dir : usrbin_exec_dir,
2449 manadocs += ['term-utils/scriptreplay.1.adoc']
2450 bashcompletions += ['scriptreplay']
2452 opt = not get_option('build-agetty').disabled()
2456 include_directories : includes,
2457 link_with : [lib_common, logindefs_c],
2458 dependencies : [BSD ? lib_util : [], lib_systemd],
2459 install_dir : sbindir,
2461 build_by_default : opt)
2464 manadocs += ['term-utils/agetty.8.adoc']
2467 opt = not get_option('build-setterm').disabled()
2471 include_directories : includes,
2472 link_with : [lib_common],
2473 dependencies : [curses_libs],
2474 install_dir : usrbin_exec_dir,
2476 build_by_default : opt)
2479 manadocs += ['term-utils/setterm.1.adoc']
2480 bashcompletions += ['setterm']
2483 opt = not get_option('build-mesg').disabled()
2487 include_directories : includes,
2488 link_with : [lib_common],
2489 install_dir : usrbin_exec_dir,
2491 build_by_default : opt)
2494 manadocs += ['term-utils/mesg.1.adoc']
2495 bashcompletions += ['mesg']
2498 opt = not get_option('build-wall').disabled()
2502 include_directories : includes,
2503 link_with : [lib_common],
2504 dependencies : [lib_systemd],
2505 install_dir : usrbin_exec_dir,
2506 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2508 build_by_default : opt)
2511 manadocs += ['term-utils/wall.1.adoc']
2512 bashcompletions += ['wall']
2515 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2516 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2518 opt = not get_option('build-write').disabled()
2522 include_directories : includes,
2523 link_with : [lib_common],
2524 dependencies : [lib_systemd],
2525 install_dir : usrbin_exec_dir,
2526 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2528 build_by_default : opt)
2531 manadocs += ['term-utils/write.1.adoc']
2532 bashcompletions += ['write']
2535 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2536 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2538 opt = not get_option('build-login').disabled()
2542 include_directories : includes,
2543 link_with : [lib_common, logindefs_c],
2544 dependencies : [lib_pam,
2548 build_by_default : opt)
2549 if not is_disabler(exe)
2551 manadocs += ['login-utils/login.1.adoc']
2554 opt = not get_option('build-sulogin').disabled()
2558 include_directories : includes,
2559 link_with : [lib_common],
2560 dependencies : [lib_crypt,
2562 install_dir : sbindir,
2564 build_by_default : opt)
2565 if not is_disabler(exe)
2567 manadocs += ['login-utils/sulogin.8.adoc']
2573 include_directories : includes,
2574 link_with : [lib_common,
2576 dependencies : [curses_libs],
2577 install_dir : usrbin_exec_dir,
2580 manadocs += ['misc-utils/cal.1.adoc']
2581 bashcompletions += ['cal']
2583 opt = not get_option('build-logger').disabled()
2587 include_directories : includes,
2588 link_with : [lib_common],
2589 dependencies : [lib_systemd],
2590 install_dir : usrbin_exec_dir,
2592 build_by_default : opt)
2593 if opt and not is_disabler(exe)
2595 manadocs += ['misc-utils/logger.1.adoc']
2596 bashcompletions += ['logger']
2602 include_directories : includes,
2603 c_args : '-DTEST_LOGGER',
2604 link_with : [lib_common],
2605 dependencies : [lib_systemd],
2606 build_by_default: program_tests)
2607 if not is_disabler(exe)
2614 include_directories : includes,
2615 install_dir : usrbin_exec_dir,
2618 manadocs += ['misc-utils/look.1.adoc']
2619 bashcompletions += ['look']
2624 include_directories : includes,
2625 link_with : [lib_common],
2626 install_dir : usrbin_exec_dir,
2629 manadocs += ['misc-utils/mcookie.1.adoc']
2630 bashcompletions += ['mcookie']
2632 if build_liblastlog2
2636 include_directories : includes,
2637 link_with : [lib_common, lib_lastlog2],
2638 install_dir : usrbin_exec_dir,
2641 manadocs += ['misc-utils/lastlog2.8.adoc']
2642 bashcompletions += ['lastlog2']
2643 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2644 'liblastlog2/man/ll2_write_entry.3.adoc',
2645 'liblastlog2/man/ll2_read_entry.3.adoc',
2646 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2647 'liblastlog2/man/ll2_read_all.3.adoc',
2648 'liblastlog2/man/ll2_remove_entry.3.adoc',
2649 'liblastlog2/man/ll2_rename_user.3.adoc',
2650 'liblastlog2/man/ll2_update_login_time.3.adoc'
2657 include_directories : includes,
2658 dependencies : [lib_selinux],
2659 install_dir : usrbin_exec_dir,
2662 manadocs += ['misc-utils/namei.1.adoc']
2663 bashcompletions += ['namei']
2668 include_directories : includes,
2669 link_with : [lib_common],
2670 install_dir : usrbin_exec_dir,
2673 manadocs += ['misc-utils/whereis.1.adoc']
2674 bashcompletions += ['whereis']
2679 include_directories : includes,
2680 link_with : [lib_common,
2683 install_dir : usrbin_exec_dir,
2685 if not is_disabler(exe)
2687 manadocs += ['misc-utils/lslocks.8.adoc']
2688 bashcompletions += ['lslocks']
2694 include_directories : includes,
2695 link_with : [lib_common,
2700 dependencies : lib_udev,
2702 if not is_disabler(exe)
2704 manadocs += ['misc-utils/lsblk.8.adoc']
2705 bashcompletions += ['lsblk']
2708 errnos_h = custom_target('errnos.h',
2709 input : 'tools/all_errnos',
2710 output : 'errnos.h',
2711 command : ['tools/all_errnos', cc.cmd_array()]
2715 mq_libs += cc.find_library('rt', required : true)
2719 lsfd_sources, errnos_h,
2720 include_directories : includes,
2721 link_with : [lib_common,
2723 dependencies : mq_libs,
2724 install_dir : usrbin_exec_dir,
2726 if not is_disabler(exe)
2728 manadocs += ['misc-utils/lsfd.1.adoc']
2734 include_directories : includes,
2735 link_with : [lib_common,
2737 install_dir : usrbin_exec_dir,
2739 if not is_disabler(exe)
2741 manadocs += ['misc-utils/uuidgen.1.adoc']
2742 bashcompletions += ['uuidgen']
2748 include_directories : includes,
2749 link_with : [lib_common,
2752 install_dir : usrbin_exec_dir,
2754 if not is_disabler(exe)
2756 manadocs += ['misc-utils/uuidparse.1.adoc']
2757 bashcompletions += ['uuidparse']
2764 include_directories : includes,
2765 link_with : [lib_common,
2767 dependencies : [realtime_libs,
2769 install_dir : usrsbin_exec_dir,
2771 build_by_default : opt)
2775 include_directories : includes,
2776 link_with : [lib_common,
2778 dependencies : thread_libs,
2779 build_by_default : opt and program_tests)
2780 if not is_disabler(exe)
2782 manadocs += ['misc-utils/uuidd.8.adoc']
2783 bashcompletions += ['uuidd']
2786 opt = build_libblkid
2790 include_directories : includes,
2791 link_with : [lib_common,
2793 install_dir : sbindir,
2795 build_by_default : opt)
2796 if opt and not is_disabler(exe)
2798 manadocs += ['misc-utils/blkid.8.adoc']
2799 bashcompletions += ['blkid']
2802 opt = opt and 'blkid' in static_programs
2806 include_directories : includes,
2807 link_with : [lib_common,
2809 install_dir : sbindir,
2811 build_by_default : opt)
2812 if opt and not is_disabler(exe)
2818 'libblkid/samples/mkfs.c',
2819 include_directories : includes,
2820 link_with : lib_blkid)
2821 if not is_disabler(exe)
2826 'sample-partitions',
2827 'libblkid/samples/partitions.c',
2828 include_directories : includes,
2829 link_with : lib_blkid)
2830 if not is_disabler(exe)
2835 'sample-superblocks',
2836 'libblkid/samples/superblocks.c',
2837 include_directories : includes,
2838 link_with : lib_blkid)
2839 if not is_disabler(exe)
2845 'libblkid/samples/topology.c',
2846 include_directories : includes,
2847 link_with : lib_blkid)
2848 if not is_disabler(exe)
2853 'test_blkid_fuzz_sample',
2854 'libblkid/src/fuzz.c',
2855 include_directories: includes,
2856 link_with: lib_blkid,
2857 build_by_default: program_tests)
2858 if not is_disabler(exe)
2862 ############################################################
2867 include_directories : includes,
2868 link_with : [lib_blkid],
2869 install_dir : sbindir,
2871 if not is_disabler(exe)
2873 manadocs += ['misc-utils/findfs.8.adoc']
2874 bashcompletions += ['findfs']
2880 include_directories : includes,
2881 link_with : [lib_common,
2884 install_dir : sbindir,
2886 if not is_disabler(exe)
2888 manadocs += ['misc-utils/wipefs.8.adoc']
2889 bashcompletions += ['wipefs']
2895 include_directories : includes,
2896 link_with : [lib_common,
2900 dependencies : [lib_udev],
2902 if not is_disabler(exe)
2904 manadocs += ['misc-utils/findmnt.8.adoc']
2905 bashcompletions += ['findmnt']
2911 include_directories : includes,
2912 link_with : [lib_common],
2914 if not is_disabler(exe)
2916 manadocs += ['misc-utils/kill.1.adoc']
2919 opt = not get_option('build-rename').disabled()
2923 include_directories : includes,
2924 install_dir : usrbin_exec_dir,
2926 build_by_default : opt)
2927 if opt and not is_disabler(exe)
2929 manadocs += ['misc-utils/rename.1.adoc']
2930 bashcompletions += ['rename']
2936 include_directories : includes,
2937 link_with : [lib_common],
2938 install_dir : usrbin_exec_dir,
2941 manadocs += ['misc-utils/getopt.1.adoc']
2942 bashcompletions += ['getopt']
2947 include_directories : includes,
2948 link_with : [lib_common,
2950 install_dir : usrbin_exec_dir,
2952 if not is_disabler(exe)
2954 manadocs += ['misc-utils/fincore.1.adoc']
2955 bashcompletions += ['fincore']
2961 include_directories : includes,
2962 link_with : [lib_common],
2963 install_dir : usrbin_exec_dir,
2965 if not is_disabler(exe)
2967 manadocs += ['misc-utils/hardlink.1.adoc']
2968 bashcompletions += ['hardlink']
2971 opt = not get_option('build-pipesz').disabled()
2975 include_directories : includes,
2976 link_with : [lib_common],
2977 install_dir : usrbin_exec_dir,
2979 if opt and not is_disabler(exe)
2981 manadocs += ['misc-utils/pipesz.1.adoc']
2982 bashcompletions += ['pipesz']
2988 include_directories : includes,
2989 c_args : '-DTEST_CAL',
2990 link_with : [lib_common,
2992 dependencies : [curses_libs],
2993 build_by_default: program_tests)
2994 if not is_disabler(exe)
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/fadvise.1.adoc']
3008 bashcompletions += ['fadvise']
3011 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3015 include_directories : includes,
3016 link_with : [lib_common],
3017 install_dir : usrbin_exec_dir,
3019 if not is_disabler(exe)
3021 manadocs += ['misc-utils/waitpid.1.adoc']
3022 bashcompletions += ['waitpid']
3026 syscalls_h = custom_target('syscalls.h',
3027 input : 'tools/all_syscalls',
3028 output : 'syscalls.h',
3029 command : ['tools/all_syscalls', cc.cmd_array()]
3032 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3035 'misc-utils/enosys.c', syscalls_h, errnos_h,
3036 include_directories : includes,
3037 link_with : [lib_common],
3038 install_dir : usrbin_exec_dir,
3040 if not is_disabler(exe)
3042 manadocs += ['misc-utils/enosys.1.adoc']
3043 bashcompletions += ['enosys']
3050 include_directories : includes,
3051 link_with : [lib_common, lib_smartcols],
3052 install_dir : usrbin_exec_dir,
3054 if not is_disabler(exe)
3056 manadocs += ['misc-utils/lsclocks.1.adoc']
3057 bashcompletions += ['lsclocks']
3060 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3064 include_directories : includes,
3065 link_with : [lib_common],
3066 install_dir : usrbin_exec_dir,
3068 if not is_disabler(exe)
3070 manadocs += ['misc-utils/exch.1.adoc']
3071 bashcompletions += ['exch']
3075 ############################################################
3077 opt = not get_option('build-schedutils').disabled()
3080 'schedutils/chrt.c',
3081 include_directories : includes,
3082 link_with : lib_common,
3083 install_dir : usrbin_exec_dir,
3085 build_by_default : opt)
3089 'schedutils/ionice.c',
3090 include_directories : includes,
3091 link_with : lib_common,
3092 install_dir : usrbin_exec_dir,
3094 build_by_default : opt)
3098 'schedutils/taskset.c',
3099 include_directories : includes,
3100 link_with : lib_common,
3101 install_dir : usrbin_exec_dir,
3103 build_by_default : opt)
3107 'schedutils/uclampset.c',
3108 include_directories : includes,
3109 link_with : lib_common,
3110 install_dir : usrbin_exec_dir,
3112 build_by_default : opt)
3114 if opt and not is_disabler(exe)
3115 exes += [exe, exe2, exe3, exe4]
3116 manadocs += ['schedutils/chrt.1.adoc',
3117 'schedutils/ionice.1.adoc',
3118 'schedutils/taskset.1.adoc',
3119 'schedutils/uclampset.1.adoc']
3120 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3123 ############################################################
3125 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3130 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3131 include_directories : dir_include,
3132 link_with : lib_common,
3133 build_by_default: program_tests)
3139 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3140 include_directories : dir_include,
3141 link_with : lib_common,
3142 build_by_default: program_tests)
3148 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3149 include_directories : dir_include,
3150 link_with : lib_common,
3151 build_by_default: program_tests)
3157 c_args : ['-DTEST_PROGRAM_MANGLE'],
3158 include_directories : dir_include,
3159 build_by_default: program_tests)
3165 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3166 include_directories : dir_include,
3167 build_by_default: program_tests)
3173 'lib/color-names.c',
3174 c_args : ['-DTEST_PROGRAM_COLORS'],
3175 include_directories : dir_include,
3176 link_with : [lib_common, lib_tcolors],
3177 build_by_default: program_tests)
3183 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3184 include_directories : dir_include,
3185 build_by_default: program_tests)
3188 if conf.get('HAVE_OPENAT').to_string() == '1' \
3189 and conf.get('HAVE_DIRFD').to_string() == '1'
3193 c_args : ['-DTEST_PROGRAM_PROCFS'],
3194 include_directories : dir_include,
3195 link_with : lib_common,
3196 build_by_default: program_tests)
3203 have_cpu_set_t ? 'lib/cpuset.c' : [],
3204 c_args : ['-DTEST_PROGRAM_PATH'],
3205 include_directories : dir_include,
3206 link_with : lib_common,
3207 build_by_default: program_tests)
3211 if conf.get('HAVE_PTY').to_string() == '1'
3216 c_args : ['-DTEST_PROGRAM_PTY'],
3217 include_directories : dir_include,
3218 link_with : [lib_common],
3219 dependencies : [lib_m,
3222 build_by_default: program_tests)
3230 c_args : ['-DTEST_PROGRAM_CPUSET'],
3231 include_directories : dir_include,
3232 build_by_default: program_tests)
3243 have_cpu_set_t ? 'lib/cpuset.c' : [],
3244 c_args : ['-DTEST_PROGRAM_SYSFS'],
3245 include_directories : dir_include,
3246 build_by_default: program_tests)
3252 c_args : ['-DTEST_PROGRAM_PAGER'],
3253 include_directories : dir_include,
3254 build_by_default: program_tests)
3258 'test_linux_version',
3259 'lib/linux_version.c',
3260 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3261 include_directories : dir_include,
3262 build_by_default: program_tests)
3268 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3269 include_directories : dir_include,
3270 build_by_default: program_tests)
3274 'test_canonicalize',
3275 'lib/canonicalize.c',
3276 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3277 include_directories : dir_include,
3278 build_by_default: program_tests)
3285 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3286 include_directories : dir_include,
3287 build_by_default: program_tests)
3293 c_args : ['-DTEST_PROGRAM'],
3294 include_directories : dir_include,
3295 link_with : lib_common,
3296 build_by_default: program_tests)
3302 c_args : ['-DTEST_PROGRAM'],
3303 include_directories : dir_include,
3304 link_with : [lib_common, logindefs_c],
3305 build_by_default: program_tests)
3309 ############################################################
3313 'libuuid/src/test_uuid.c',
3314 include_directories : [dir_include, dir_libuuid],
3315 link_with : lib_uuid,
3316 dependencies : socket_libs,
3317 build_by_default: program_tests)
3318 if not is_disabler(exe)
3322 ############################################################
3324 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3325 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3329 'libfdisk/src/ask.c',
3330 c_args : libfdisk_tests_cflags,
3331 include_directories : lib_fdisk_includes,
3332 link_with : libfdisk_tests_ldadd,
3333 build_by_default: program_tests)
3334 if not is_disabler(exe)
3340 'libfdisk/src/gpt.c',
3341 c_args : libfdisk_tests_cflags,
3342 include_directories : lib_fdisk_includes,
3343 link_with : libfdisk_tests_ldadd,
3344 build_by_default: program_tests)
3345 if not is_disabler(exe)
3351 'libfdisk/src/utils.c',
3352 c_args : libfdisk_tests_cflags,
3353 include_directories : lib_fdisk_includes,
3354 link_with : libfdisk_tests_ldadd,
3355 build_by_default: program_tests)
3356 if not is_disabler(exe)
3361 'test_fdisk_script',
3362 'libfdisk/src/script.c',
3363 c_args : libfdisk_tests_cflags,
3364 include_directories : lib_fdisk_includes,
3365 link_with : libfdisk_tests_ldadd,
3366 build_by_default: program_tests)
3367 if not is_disabler(exe)
3372 'test_fdisk_version',
3373 'libfdisk/src/version.c',
3374 c_args : libfdisk_tests_cflags,
3375 include_directories : lib_fdisk_includes,
3376 link_with : libfdisk_tests_ldadd,
3377 build_by_default: program_tests)
3378 if not is_disabler(exe)
3384 'libfdisk/src/item.c',
3385 c_args : libfdisk_tests_cflags,
3386 include_directories : lib_fdisk_includes,
3387 link_with : libfdisk_tests_ldadd,
3388 build_by_default: program_tests)
3389 if not is_disabler(exe)
3393 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3396 'sample-fdisk-mkpart',
3397 'libfdisk/samples/mkpart.c',
3398 include_directories : lib_fdisk_includes,
3399 link_with : sample_fdisk_ldadd)
3400 if not is_disabler(exe)
3405 'sample-fdisk-mkpart-fullspec',
3406 'libfdisk/samples/mkpart-fullspec.c',
3407 include_directories : lib_fdisk_includes,
3408 link_with : sample_fdisk_ldadd)
3409 if not is_disabler(exe)
3413 ############################################################
3417 'tests/helpers/test_cap.c',
3418 include_directories : includes,
3419 dependencies : [lib_cap_ng],
3420 build_by_default: program_tests)
3421 if not is_disabler(exe)
3427 'tests/helpers/test_mbsencode.c',
3428 include_directories : includes,
3429 link_with : lib_common,
3430 build_by_default: program_tests)
3435 'tests/helpers/test_byteswap.c',
3436 include_directories : includes,
3437 build_by_default: program_tests)
3442 'tests/helpers/test_md5.c',
3444 include_directories : includes,
3445 build_by_default: program_tests)
3450 'tests/helpers/test_sha1.c',
3452 include_directories : includes,
3453 build_by_default: program_tests)
3458 'tests/helpers/test_pathnames.c',
3459 include_directories : includes,
3460 build_by_default: program_tests)
3465 'tests/helpers/test_strerror.c',
3466 include_directories : includes,
3467 build_by_default: program_tests)
3472 'tests/helpers/test_sysinfo.c',
3473 include_directories : includes,
3474 build_by_default: program_tests)
3479 'tests/helpers/test_sigreceive.c',
3480 include_directories : includes,
3481 link_with : lib_common,
3482 build_by_default: program_tests)
3487 'tests/helpers/test_tiocsti.c',
3488 include_directories : includes,
3489 build_by_default: program_tests)
3493 'test_uuid_namespace',
3494 'tests/helpers/test_uuid_namespace.c',
3498 include_directories : includes,
3499 build_by_default: program_tests)
3505 'tests/helpers/test_mkfds.c',
3506 'tests/helpers/test_mkfds.h',
3507 'tests/helpers/test_mkfds_ppoll.c',
3508 include_directories : includes,
3509 dependencies : mq_libs,
3510 build_by_default: program_tests)
3516 'tests/helpers/test_enosys.c',
3517 include_directories : includes,
3518 build_by_default: program_tests)
3521 ############################################################
3523 if conf.get('HAVE_OPENAT').to_string() == '1'
3525 'sample-scols-tree',
3526 'libsmartcols/samples/tree.c',
3527 include_directories : includes,
3528 link_with : [lib_smartcols, lib_common],
3529 build_by_default: program_tests)
3530 if not is_disabler(exe)
3536 'sample-scols-title',
3537 'libsmartcols/samples/title.c',
3538 include_directories : includes,
3539 link_with : [lib_smartcols, lib_common])
3540 if not is_disabler(exe)
3545 'sample-scols-wrap',
3546 'libsmartcols/samples/wrap.c',
3547 include_directories : includes,
3548 link_with : [lib_smartcols, lib_common])
3549 if not is_disabler(exe)
3554 'sample-scols-continuous',
3555 'libsmartcols/samples/continuous.c',
3556 include_directories : includes,
3557 link_with : [lib_smartcols, lib_common])
3558 if not is_disabler(exe)
3563 'sample-scols-continuous-json',
3564 'libsmartcols/samples/continuous-json.c',
3565 include_directories : includes,
3566 link_with : [lib_smartcols, lib_common])
3567 if not is_disabler(exe)
3572 'sample-scols-maxout',
3573 'libsmartcols/samples/maxout.c',
3574 include_directories : includes,
3575 link_with : [lib_smartcols, lib_common])
3576 if not is_disabler(exe)
3581 'sample-scols-fromfile',
3582 'libsmartcols/samples/fromfile.c',
3583 include_directories : includes,
3584 link_with : [lib_smartcols, lib_common])
3585 if not is_disabler(exe)
3590 'sample-scols-grouping-simple',
3591 'libsmartcols/samples/grouping-simple.c',
3592 include_directories : includes,
3593 link_with : [lib_smartcols, lib_common])
3594 if not is_disabler(exe)
3599 'sample-scols-grouping-overlay',
3600 'libsmartcols/samples/grouping-overlay.c',
3601 include_directories : includes,
3602 link_with : [lib_smartcols, lib_common])
3603 if not is_disabler(exe)
3609 'Documentation/boilerplate.c',
3610 include_directories : includes,
3611 build_by_default: program_tests)
3612 if not is_disabler(exe)
3616 ############################################################
3618 # Let the test runner know whether we're running under asan and export
3619 # some paths. We use a file on disk so that it is possible to run the
3620 # test scripts from commandline without setting any variables.
3621 configure_file(output : 'meson.conf',
3626 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3627 python.full_path())])
3629 run_sh = find_program('tests/run.sh')
3633 '--srcdir=' + meson.current_source_dir(),
3634 '--builddir=' + meson.current_build_dir(),
3640 manadocs += ['lib/terminal-colors.d.5.adoc']
3641 manadocs += ['libblkid/libblkid.3.adoc']
3645 'libuuid/man/uuid.3.adoc',
3646 'libuuid/man/uuid_clear.3.adoc',
3647 'libuuid/man/uuid_compare.3.adoc',
3648 'libuuid/man/uuid_copy.3.adoc',
3649 'libuuid/man/uuid_generate.3.adoc',
3650 'libuuid/man/uuid_is_null.3.adoc',
3651 'libuuid/man/uuid_parse.3.adoc',
3652 'libuuid/man/uuid_time.3.adoc',
3653 'libuuid/man/uuid_unparse.3.adoc']
3655 'uuid_generate_random.3': 'uuid_generate.3',
3656 'uuid_generate_time.3': 'uuid_generate.3',
3657 'uuid_generate_time_safe.3': 'uuid_generate.3',
3661 asciidoctor = find_program('asciidoctor', required : false)
3662 if asciidoctor.found()
3663 foreach adoc : manadocs
3664 name = adoc.split('/')[-1]
3665 page = name.split('.adoc')[0]
3666 section = page.split('.')[-1]
3667 mandirn = join_paths(mandir, 'man' + section)
3672 command : [ asciidoctor,
3674 '-a', 'VERSION=' + meson.project_version(),
3675 '-a', 'release-version=' + meson.project_version(),
3676 '-a', 'ADJTIME_PATH=/etc/adjtime',
3677 '-a', 'package-docdir=' + docdir,
3678 '--base-dir=' + meson.current_source_dir(),
3679 '--destination-dir=' + meson.current_build_dir(),
3680 '--load-path', '@SOURCE_ROOT@/tools',
3681 '--require', 'asciidoctor-includetracker',
3685 depfile : page + '.deps',
3687 install_dir : mandirn)
3690 foreach link_name, target : manlinks
3691 link_section = link_name.split('.')[-1]
3692 target_section = target.split('.')[-1]
3693 meson.add_install_script(meson_make_manpage_stub,
3694 join_paths('man' + target_section, target),
3695 join_paths(mandir, 'man' + link_section, link_name))
3699 if bash_completion.found()
3700 foreach completion : bashcompletions
3702 join_paths('bash-completion', completion),
3703 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3706 foreach link_name, target : bashcompletionslinks
3707 meson.add_install_script(meson_make_symlink,
3709 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))