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.set('HAVE_ENVIRON_DECL', have ? 1 : false)
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
629 have = cc.has_function(func)
630 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
631 # This makes little sense, but is necessary to avoid warnings about
632 # redefined macros from Python.h, which uses this convention.
633 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
636 have_mempcpy = cc.has_function('mempcpy', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
637 conf.set('HAVE_MEMPCPY', have_mempcpy ? 1 : false)
639 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
640 conf.set('AGETTY_RELOAD', have ? 1 : false)
642 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
645 have_dirfd = (cc.has_function('dirfd') or
646 cc.has_header_symbol('dirent.h', 'dirfd',
647 prefix : '#include <sys/types.h>'))
648 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
650 have_ddfd = cc.has_member('DIR', 'dd_fd',
652 #include <sys/types.h>
655 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
657 have = cc.has_member('struct tm', 'tm_gmtoff',
658 args : '-D_GNU_SOURCE',
663 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
667 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
668 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
670 have = cc.has_member('struct termios', 'c_line',
671 prefix : '#include <termios.h>')
672 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
674 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
675 args : '-D_GNU_SOURCE',
676 prefix : '#include <sys/stat.h>')
677 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
679 have = cc.has_member('struct statx', 'stx_mnt_id',
680 prefix : '#include <sys/stat.h>')
681 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
683 # replacement for AC_STRUCT_TIMEZONE
684 have = cc.has_member('struct tm', 'tm_zone',
685 args : '-D_GNU_SOURCE',
686 prefix : '#include <time.h>')
687 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
689 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
690 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
692 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
693 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
695 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
696 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
701 extern char *tzname[];
704 return tzname ? 0 : 1;
706 '''.format(have ? 1 : 0)
707 have = cc.compiles(code, name : 'using tzname[]')
708 conf.set('HAVE_TZNAME', have ? 1 : false)
710 have = cc.sizeof('time_t', prefix : '#include <time.h>')
712 add_global_arguments('-D_TIME_BITS=64', language : 'c')
713 have = cc.sizeof('time_t', args : '-D_TIME_BITS=64', prefix : '#include <time.h>')
715 if get_option('allow-32bit-time')
716 warning('Could not make time_t 64bits wide')
718 error('Could not make time_t 64bits wide')
724 if not cc.has_function('socket')
725 socket_libs += cc.find_library('socket', required : true)
726 have = cc.has_function('socket',
727 dependencies : socket_libs)
729 error('socket() function not available')
734 have = cc.has_function('clock_gettime')
736 realtime_libs += cc.find_library('rt', required : true)
737 have = cc.has_function('clock_gettime',
738 dependencies : realtime_libs)
740 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
742 thread_libs = dependency('threads')
744 have = cc.has_function('timer_create')
746 realtime_libs = [cc.find_library('rt', required : true)]
747 have = cc.has_function('timer_create',
748 dependencies : realtime_libs)
750 realtime_libs += thread_libs
751 have = cc.has_function('timer_create',
752 dependencies : realtime_libs)
755 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
757 have = cc.has_function('setitimer')
758 conf.set('HAVE_SETITIMER', have ? 1 : false)
761 rtas_libs = cc.find_library('rtas', required : false)
762 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
765 if not cc.has_header_symbol('math.h', 'isnan')
766 lib = cc.find_library('m', required : true)
767 if (cc.has_function('isnan', dependencies : lib) and
768 cc.has_function('__isnan', dependencies : lib))
773 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
774 args : '-D_GNU_SOURCE')
775 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
778 extern char *__progname;
780 return (*__progname != 0);
783 have = cc.compiles(code, name : 'using __progname')
784 conf.set('HAVE___PROGNAME', have ? 1 : false)
786 have = conf.get('HAVE_PTY_H').to_string() == '1' \
787 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
788 conf.set('HAVE_PTY', have ? 1 : false)
790 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
791 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
793 build_plymouth_support = get_option('build-plymouth-support')
794 have_tiocglcktrmios = cc.has_header_symbol(
795 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
796 required : build_plymouth_support.enabled())
797 have_sock_cloexec = cc.has_header_symbol(
798 'sys/socket.h', 'SOCK_CLOEXEC',
799 prefix : '#include <sys/types.h>',
800 required : build_plymouth_support.enabled())
801 have_sock_nonblock = cc.has_header_symbol(
802 'sys/socket.h', 'SOCK_NONBLOCK',
803 prefix : '#include <sys/types.h>',
804 required : build_plymouth_support.enabled())
805 have_so_passcred = cc.has_header_symbol(
806 'sys/socket.h', 'SO_PASSCRED',
807 args : ['-D_GNU_SOURCE'],
808 prefix : '#include <sys/types.h>',
809 required : build_plymouth_support.enabled())
811 build_plymouth_support = (not build_plymouth_support.disabled() and
812 have_tiocglcktrmios and
813 have_sock_cloexec and
814 have_sock_nonblock and
816 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
817 summary('plymouth support',
818 build_plymouth_support ? 'enabled' : 'disabled',
819 section : 'components')
821 # check for valid fallocate() function
822 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
823 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
824 # and program can't be linked.
832 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
833 return ret == 0 ? 0 : 1;
836 have = cc.links(code, name : 'fallocate() function')
837 conf.set('HAVE_FALLOCATE', have ? 1 : false)
845 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
846 return ret == 0 ? 0 : 1;
849 have = cc.links(code, name : 'posix_fallocate() function')
850 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
852 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
853 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
854 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
856 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
857 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
858 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
860 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
862 ############################################################
865 fs_search_path = get_option('fs-search-path')
866 fs_search_path_extra = get_option('fs-search-path-extra')
867 if fs_search_path_extra != ''
868 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
870 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
872 systemdsystemunitdir = ''
874 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
877 sysvinit = get_option('sysvinit').enabled()
878 sysvinitrcdir = sysconfdir + '/init.d'
880 program_tests = get_option('program-tests')
882 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
883 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
885 have = get_option('chsh-only-listed')
886 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
888 have = get_option('use-tty-group')
889 conf.set('USE_TTY_GROUP', have ? 1 : false)
891 bison = find_program('bison')
892 flex = find_program('flex')
894 build_hwclock = not get_option('build-hwclock').disabled()
895 bison_gen = generator(
897 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
898 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
900 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
901 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
905 configuration : conf)
907 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
912 '-Waddress-of-packed-member',
913 '-Wdiscarded-qualifiers',
914 '-Wembedded-directive',
917 '-Wimplicit-function-declaration',
918 '-Wmissing-declarations',
919 '-Wmissing-parameter-type',
920 '-Wmissing-prototypes',
922 '-Wno-missing-field-initializers',
923 '-Wold-style-definition',
927 '-Wstrict-prototypes',
930 '-Wunused-but-set-parameter',
931 '-Wunused-but-set-variable',
932 '-Wunused-parameter',
938 foreach compiler_flag : compiler_flags
939 if cc.has_argument(compiler_flag)
940 add_project_arguments(compiler_flag, language : 'c')
948 bashcompletionslinks = {}
954 subdir('libsmartcols')
956 subdir('liblastlog2')
958 subdir('pam_lastlog2')
959 subdir('login-utils')
967 includes = [dir_include,
978 opt = not get_option('build-chfn-chsh').disabled()
983 include_directories : includes,
984 link_with : [lib_common, logindefs_c],
985 dependencies : chfn_chsh_deps,
986 install_dir : usrbin_exec_dir,
987 install_mode : 'rwsr-xr-x',
989 build_by_default : opt)
993 'login-utils/chsh.c',
996 include_directories : includes,
997 link_with : lib_common,
998 dependencies : chfn_chsh_deps,
999 install_dir : usrbin_exec_dir,
1000 install_mode : 'rwsr-xr-x',
1002 build_by_default : opt)
1003 if opt and not is_disabler(exe)
1005 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
1006 bashcompletions += ['chfn', 'chsh']
1011 test_islocal_sources,
1012 include_directories : includes,
1013 c_args : '-DTEST_PROGRAM',
1014 build_by_default : program_tests)
1019 test_consoles_sources,
1020 c_args : ['-DTEST_PROGRAM'],
1021 include_directories : includes,
1022 link_with : lib_common,
1023 build_by_default : program_tests)
1026 opt = not get_option('build-last').disabled()
1030 include_directories : includes,
1031 link_with : [lib_common],
1032 install_dir : usrbin_exec_dir,
1034 build_by_default : opt)
1035 if opt and not is_disabler(exe)
1037 meson.add_install_script(meson_make_symlink,
1039 join_paths(usrbin_exec_dir, 'lastb'))
1040 manadocs += ['login-utils/last.1.adoc']
1041 manlinks += {'lastb.1': 'last.1'}
1042 bashcompletions += ['last']
1043 bashcompletionslinks += {'lastb': 'last'}
1046 opt = not get_option('build-nologin').disabled()
1049 'login-utils/nologin.c',
1050 include_directories : includes,
1051 install_dir : sbindir,
1052 link_with : [lib_common],
1054 build_by_default : opt)
1055 if opt and not is_disabler(exe)
1057 manadocs += ['login-utils/nologin.8.adoc']
1060 opt = not get_option('build-utmpdump').disabled()
1063 'login-utils/utmpdump.c',
1064 include_directories : includes,
1065 link_with : [lib_common],
1066 install_dir : usrbin_exec_dir,
1068 build_by_default : opt)
1069 if opt and not is_disabler(exe)
1071 manadocs += ['login-utils/utmpdump.1.adoc']
1072 bashcompletions += ['utmpdump']
1075 opt = not get_option('build-su').disabled()
1079 'login-utils/su-common.c',
1080 'login-utils/su-common.h',
1084 include_directories : includes,
1085 link_with : [lib_common, logindefs_c],
1086 dependencies : [lib_pam,
1090 install_mode : 'rwsr-xr-x',
1092 build_by_default : opt)
1093 if opt and not is_disabler(exe)
1095 manadocs += ['login-utils/su.1.adoc']
1096 bashcompletions += ['su']
1099 opt = not get_option('build-newgrp').disabled()
1102 'login-utils/newgrp.c',
1103 include_directories : includes,
1104 dependencies : [lib_crypt],
1105 install_dir : usrbin_exec_dir,
1106 install_mode : 'rwsr-xr-x',
1108 build_by_default : opt)
1109 if opt and not is_disabler(exe)
1111 manadocs += ['login-utils/newgrp.1.adoc']
1112 bashcompletions += ['newgrp']
1115 opt = not get_option('build-lslogins').disabled()
1118 'login-utils/lslogins.c',
1119 include_directories : includes,
1120 link_with : [lib_common,
1123 (build_liblastlog2 ? [lib_lastlog2] : []),
1124 dependencies : [lib_selinux,
1126 install_dir : usrbin_exec_dir,
1128 build_by_default : opt)
1129 if opt and not is_disabler(exe)
1131 manadocs += ['login-utils/lslogins.1.adoc']
1132 bashcompletions += ['lslogins']
1135 opt = not get_option('build-vipw').disabled()
1138 'login-utils/vipw.c',
1139 'login-utils/setpwnam.h',
1140 include_directories : includes,
1141 link_with : [lib_common],
1142 dependencies : [lib_selinux],
1143 install_dir : usrbin_exec_dir,
1145 build_by_default : opt)
1146 if opt and not is_disabler(exe)
1148 meson.add_install_script(meson_make_symlink,
1150 join_paths(usrbin_exec_dir, 'vigr'))
1151 manadocs += ['login-utils/vipw.8.adoc']
1152 meson.add_install_script(meson_make_symlink,
1154 join_paths(mandir, 'man8/vigr.8'))
1157 opt = not get_option('build-runuser').disabled()
1160 'login-utils/runuser.c',
1161 'login-utils/su-common.c',
1162 'login-utils/su-common.h',
1166 include_directories : includes,
1167 link_with : [lib_common, logindefs_c],
1168 dependencies : [lib_pam,
1172 install_dir : sbindir,
1174 build_by_default : opt)
1175 if opt and not is_disabler(exe)
1177 manadocs += ['login-utils/runuser.1.adoc']
1178 bashcompletionslinks += {'runuser': 'su'}
1181 ############################################################
1187 include_directories : includes,
1188 link_with : lib_common,
1189 install_dir : usrbin_exec_dir,
1192 manadocs += ['text-utils/col.1.adoc']
1193 bashcompletions += ['col']
1199 include_directories : includes,
1200 install_dir : usrbin_exec_dir,
1203 manadocs += ['text-utils/colcrt.1.adoc']
1204 bashcompletions += ['colcrt']
1209 include_directories : includes,
1210 link_with : lib_common,
1211 install_dir : usrbin_exec_dir,
1214 manadocs += ['text-utils/colrm.1.adoc']
1215 bashcompletions += ['colrm']
1220 include_directories : includes,
1221 install_dir : usrbin_exec_dir,
1224 manadocs += ['text-utils/rev.1.adoc']
1225 bashcompletions += ['rev']
1230 include_directories : includes,
1231 link_with : [lib_common,
1233 install_dir : usrbin_exec_dir,
1235 if not is_disabler(exe)
1237 manadocs += ['text-utils/column.1.adoc']
1238 bashcompletions += ['column']
1241 opt = not get_option('build-line').disabled()
1245 include_directories : includes,
1246 install_dir : usrbin_exec_dir,
1248 build_by_default : opt)
1249 if opt and not is_disabler(exe)
1251 manadocs += ['text-utils/line.1.adoc']
1254 opt = not get_option('build-pg').disabled()
1258 link_with : lib_common,
1259 include_directories : includes,
1260 dependencies : [lib_tinfo,
1262 install_dir : usrbin_exec_dir,
1264 build_by_default : opt)
1265 if opt and not is_disabler(exe)
1267 manadocs += ['text-utils/pg.1.adoc']
1268 bashcompletions += ['pg']
1271 opt = not get_option('build-ul').disabled()
1275 include_directories : includes,
1276 dependencies : [lib_tinfo,
1278 install_dir : usrbin_exec_dir,
1280 build_by_default : opt)
1281 if opt and not is_disabler(exe)
1283 manadocs += ['text-utils/ul.1.adoc']
1284 bashcompletions += ['ul']
1287 opt = not get_option('build-more').disabled()
1291 link_with : [lib_common],
1292 include_directories : includes,
1293 dependencies : [lib_tinfo,
1297 build_by_default : opt)
1301 link_with : [lib_common],
1302 include_directories : includes,
1303 c_args : '-DTEST_PROGRAM',
1304 dependencies : [lib_tinfo,
1307 build_by_default : opt and program_tests)
1309 if opt and not is_disabler(exe)
1311 manadocs += ['text-utils/more.1.adoc']
1312 bashcompletions += ['more']
1318 include_directories : includes,
1319 link_with : [lib_common,
1321 install_dir : usrbin_exec_dir,
1323 if not is_disabler(exe)
1325 manadocs += ['text-utils/hexdump.1.adoc']
1326 bashcompletions += ['hexdump']
1329 opt = not get_option('build-lsmem').disabled()
1333 include_directories : includes,
1334 link_with : [lib_common,
1336 install_dir : usrbin_exec_dir,
1338 build_by_default : opt)
1339 if opt and not is_disabler(exe)
1341 manadocs += ['sys-utils/lsmem.1.adoc']
1342 bashcompletions += ['lsmem']
1345 opt = not get_option('build-chmem').disabled()
1349 include_directories : includes,
1350 link_with : [lib_common],
1351 install_dir : usrbin_exec_dir,
1353 build_by_default : opt)
1354 if opt and not is_disabler(exe)
1356 manadocs += ['sys-utils/chmem.8.adoc']
1357 bashcompletions += ['chmem']
1363 include_directories : includes,
1364 link_with : [lib_common],
1365 install_dir : usrbin_exec_dir,
1368 manadocs += ['sys-utils/choom.1.adoc']
1373 include_directories : includes,
1374 link_with : [lib_common],
1375 install_dir : usrbin_exec_dir,
1378 manadocs += ['sys-utils/ipcmk.1.adoc']
1379 bashcompletions += ['ipcmk']
1384 include_directories : includes,
1385 link_with : [lib_common],
1386 install_dir : usrbin_exec_dir,
1389 manadocs += ['sys-utils/ipcrm.1.adoc']
1390 bashcompletions += ['ipcrm']
1392 opt = not get_option('build-ipcs').disabled()
1396 include_directories : includes,
1397 link_with : [lib_common],
1398 install_dir : usrbin_exec_dir,
1400 build_by_default : opt)
1401 if opt and not is_disabler(exe)
1403 manadocs += ['sys-utils/ipcs.1.adoc']
1404 bashcompletions += ['ipcs']
1407 opt = not get_option('build-rfkill').disabled()
1411 include_directories : includes,
1412 link_with : [lib_common,
1414 install_dir : usrsbin_exec_dir,
1416 build_by_default : opt)
1417 if opt and not is_disabler(exe)
1419 manadocs += ['sys-utils/rfkill.8.adoc']
1420 bashcompletions += ['rfkill']
1426 include_directories : includes,
1427 link_with : [lib_common,
1429 install_dir : usrbin_exec_dir,
1431 if not is_disabler(exe)
1433 manadocs += ['sys-utils/renice.1.adoc']
1434 bashcompletions += ['renice']
1440 include_directories: includes,
1441 link_with : [lib_common,
1443 install_dir : usrbin_exec_dir,
1445 if opt and not is_disabler(exe)
1447 manadocs += ['sys-utils/setpgid.1.adoc']
1448 bashcompletions += ['setpgid']
1454 include_directories : includes,
1455 link_with : [lib_common,
1457 install_dir : usrbin_exec_dir,
1459 if opt and not is_disabler(exe)
1461 manadocs += ['sys-utils/setsid.1.adoc']
1462 bashcompletions += ['setsid']
1467 readprofile_sources,
1468 include_directories : includes,
1469 link_with : [lib_common,
1471 install_dir : usrsbin_exec_dir,
1473 if not is_disabler(exe)
1475 manadocs += ['sys-utils/readprofile.8.adoc']
1476 bashcompletions += ['readprofile']
1479 opt = not get_option('build-tunelp').disabled()
1483 include_directories : includes,
1484 link_with : [lib_common],
1485 install_dir : usrsbin_exec_dir,
1487 build_by_default : opt)
1488 if opt and not is_disabler(exe)
1490 manadocs += ['sys-utils/tunelp.8.adoc']
1491 bashcompletions += ['tunelp']
1497 include_directories : includes,
1498 link_with : [lib_common,
1500 install_dir : sbindir,
1502 if not is_disabler(exe)
1504 manadocs += ['sys-utils/fstrim.8.adoc']
1505 bashcompletions += ['fstrim']
1511 include_directories : includes,
1512 link_with : [lib_common,
1515 if not is_disabler(exe)
1517 manadocs += ['sys-utils/dmesg.1.adoc']
1518 bashcompletions += ['dmesg']
1524 include_directories : dir_include,
1525 c_args : '-DTEST_DMESG',
1526 link_with : [lib_common,
1528 build_by_default : program_tests)
1529 if not is_disabler(exe)
1536 include_directories : includes,
1537 link_with : [lib_common],
1538 install_dir : sbindir,
1541 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1542 bashcompletions += ['ctrlaltdel']
1547 include_directories : includes,
1548 install_dir : sbindir,
1551 manadocs += ['sys-utils/fsfreeze.8.adoc']
1552 bashcompletions += ['fsfreeze']
1557 include_directories : includes,
1558 link_with : [lib_common,
1560 install_dir : sbindir,
1563 manadocs += ['sys-utils/blkdiscard.8.adoc']
1564 bashcompletions += ['blkdiscard']
1566 if cc.has_header('linux/blkzoned.h')
1570 include_directories : includes,
1571 link_with : [lib_common],
1572 install_dir : sbindir,
1575 manadocs += ['sys-utils/blkzone.8.adoc']
1576 bashcompletions += ['blkzone']
1579 if cc.has_header('linux/pr.h')
1583 include_directories : includes,
1584 link_with : [lib_common],
1585 install_dir : sbindir,
1588 manadocs += ['sys-utils/blkpr.8.adoc']
1594 include_directories : includes,
1595 link_with : [lib_common],
1596 install_dir : usrsbin_exec_dir,
1599 manadocs += ['sys-utils/ldattach.8.adoc']
1600 bashcompletions += ['ldattach']
1605 include_directories : includes,
1606 link_with : [lib_common],
1607 install_dir : usrsbin_exec_dir,
1610 manadocs += ['sys-utils/rtcwake.8.adoc']
1611 bashcompletions += ['rtcwake']
1616 include_directories : includes,
1617 link_with : [lib_common],
1618 install_dir : usrbin_exec_dir,
1621 manadocs += ['sys-utils/setarch.8.adoc']
1622 bashcompletions += ['setarch']
1624 setarch_links = ['uname26', 'linux32', 'linux64']
1625 setarch_links_arch = {
1626 's390x' : ['s390', 's390x'],
1628 'x86_64' : ['i386', 'x86_64'],
1629 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1630 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1631 'mips64' : ['mips', 'mips64', 'mips32'],
1632 'ia64' : ['i386', 'ia64'],
1633 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1635 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1637 foreach link: setarch_links
1638 meson.add_install_script(meson_make_symlink,
1640 join_paths(usrbin_exec_dir, link))
1641 manlinks += {link + '.8': 'setarch.8'}
1644 opt = not get_option('build-eject').disabled()
1648 include_directories : includes,
1649 link_with : [lib_common,
1651 install_dir : usrbin_exec_dir,
1653 build_by_default : opt)
1654 if opt and not is_disabler(exe)
1656 manadocs += ['sys-utils/eject.1.adoc']
1657 bashcompletions += ['eject']
1660 opt = not get_option('build-losetup').disabled()
1664 include_directories : includes,
1665 link_with : [lib_common,
1667 install_dir : sbindir,
1669 build_by_default : opt)
1670 if opt and not is_disabler(exe)
1671 manadocs += ['sys-utils/losetup.8.adoc']
1673 bashcompletions += ['losetup']
1676 opt = opt and 'losetup' in static_programs
1680 include_directories : includes,
1681 link_args : ['--static'],
1682 link_with : [lib_common,
1683 lib_smartcols.get_static_lib()],
1684 install_dir : sbindir,
1686 build_by_default : opt)
1687 if opt and not is_disabler(exe)
1691 opt = not get_option('build-zramctl').disabled()
1695 include_directories : includes,
1696 link_with : [lib_common,
1698 install_dir : sbindir,
1700 build_by_default : opt)
1701 if opt and not is_disabler(exe)
1703 manadocs += ['sys-utils/zramctl.8.adoc']
1704 bashcompletions += ['zramctl']
1710 include_directories : includes,
1711 link_with : [lib_common,
1713 install_dir : usrbin_exec_dir,
1715 if not is_disabler(exe)
1717 manadocs += ['sys-utils/prlimit.1.adoc']
1718 bashcompletions += ['prlimit']
1724 include_directories : includes,
1725 link_with : [lib_common,
1728 install_dir : usrbin_exec_dir,
1730 if not is_disabler(exe)
1732 manadocs += ['sys-utils/lsns.8.adoc']
1733 bashcompletions += ['lsns']
1736 opt = not get_option('build-mount').disabled()
1740 include_directories : includes,
1741 link_with : [lib_common,
1744 dependencies : lib_selinux,
1745 install_mode : 'rwsr-xr-x',
1747 build_by_default : opt)
1751 include_directories : includes,
1752 link_with : [lib_common,
1754 install_mode : 'rwsr-xr-x',
1756 build_by_default : opt)
1757 if opt and not is_disabler(exe)
1759 manadocs += ['sys-utils/fstab.5.adoc',
1760 'sys-utils/mount.8.adoc',
1761 'sys-utils/umount.8.adoc']
1762 bashcompletions += ['mount', 'umount']
1765 opt2 = opt and 'mount' in static_programs
1769 include_directories : includes,
1770 link_args : ['--static'],
1771 link_with : [lib_common,
1772 lib_smartcols_static,
1775 build_by_default : opt2)
1776 if opt2 and not is_disabler(exe)
1780 opt2 = opt and 'umount' in static_programs
1784 include_directories : includes,
1785 link_args : ['--static'],
1786 link_with : [lib_common,
1789 build_by_default : opt2)
1790 if opt2 and not is_disabler(exe)
1799 include_directories : includes,
1800 link_with : [lib_common,
1804 install_dir : sbindir,
1806 if not is_disabler(exe)
1808 manadocs += ['sys-utils/swapon.8.adoc']
1809 bashcompletions += ['swapon']
1815 include_directories : includes,
1816 link_with : [lib_common,
1819 install_dir : sbindir,
1821 if not is_disabler(exe)
1823 manlinks += {'swapoff.8': 'swapon.8'}
1824 bashcompletions += ['swapoff']
1830 include_directories : includes,
1831 link_with : [lib_common,
1833 dependencies : [rtas_libs],
1834 install_dir : usrbin_exec_dir,
1836 if not is_disabler(exe)
1838 manadocs += ['sys-utils/lscpu.1.adoc']
1839 bashcompletions += ['lscpu']
1845 include_directories : includes,
1846 link_with : [lib_common],
1847 install_dir : sbindir,
1850 manadocs += ['sys-utils/chcpu.8.adoc']
1851 bashcompletions += ['chcpu']
1856 include_directories : includes,
1857 link_with : [lib_common,
1860 if not is_disabler(exe)
1862 manadocs += ['sys-utils/wdctl.8.adoc']
1863 bashcompletions += ['wdctl']
1866 opt = not get_option('build-mountpoint').disabled()
1870 include_directories : includes,
1871 link_with : [lib_mount],
1873 build_by_default : opt)
1874 if opt and not is_disabler(exe)
1876 manadocs += ['sys-utils/mountpoint.1.adoc']
1877 bashcompletions += ['mountpoint']
1880 opt = not get_option('build-fallocate').disabled()
1884 include_directories : includes,
1885 link_with : [lib_common],
1886 install_dir : usrbin_exec_dir,
1888 build_by_default : opt)
1889 if opt and not is_disabler(exe)
1891 manadocs += ['sys-utils/fallocate.1.adoc']
1892 bashcompletions += ['fallocate']
1895 opt = not get_option('build-pivot_root').disabled()
1899 include_directories : includes,
1900 install_dir : sbindir,
1902 build_by_default : opt)
1903 if opt and not is_disabler(exe)
1905 manadocs += ['sys-utils/pivot_root.8.adoc']
1906 bashcompletions += ['pivot_root']
1909 opt = not get_option('build-switch_root').disabled()
1910 if opt and not have_dirfd and not have_ddfd
1911 error('neither dirfd nor ddfd are available')
1915 switch_root_sources,
1916 include_directories : includes,
1917 install_dir : sbindir,
1919 build_by_default : opt)
1920 if opt and not is_disabler(exe)
1922 manadocs += ['sys-utils/switch_root.8.adoc']
1925 opt = not get_option('build-unshare').disabled()
1929 include_directories : includes,
1930 link_with : [lib_common],
1931 install_dir : usrbin_exec_dir,
1933 build_by_default : opt)
1934 if opt and not is_disabler(exe)
1936 manadocs += ['sys-utils/unshare.1.adoc']
1937 bashcompletions += ['unshare']
1940 opt = opt and 'unshare' in static_programs
1944 include_directories : includes,
1945 link_with : [lib_common],
1946 install_dir : usrbin_exec_dir,
1948 build_by_default : opt)
1949 if opt and not is_disabler(exe)
1953 opt = not get_option('build-nsenter').disabled()
1957 include_directories : includes,
1958 link_with : [lib_common],
1959 dependencies : [lib_selinux],
1960 install_dir : usrbin_exec_dir,
1962 build_by_default : opt)
1963 if opt and not is_disabler(exe)
1965 manadocs += ['sys-utils/nsenter.1.adoc']
1966 bashcompletions += ['nsenter']
1969 opt = opt and 'nsenter' in static_programs
1973 include_directories : includes,
1974 link_with : [lib_common],
1975 dependencies : [lib_selinux],
1976 install_dir : usrbin_exec_dir,
1978 build_by_default : opt)
1979 if opt and not is_disabler(exe)
1983 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1987 include_directories : includes,
1988 link_with : [lib_common],
1989 dependencies : [lib_cap_ng],
1990 install_dir : usrbin_exec_dir,
1992 build_by_default : opt)
1993 if opt and not is_disabler(exe)
1995 manadocs += ['sys-utils/setpriv.1.adoc']
1996 bashcompletions += ['setpriv']
2002 include_directories : includes,
2003 link_with : [lib_common],
2004 dependencies : realtime_libs,
2005 install_dir : usrbin_exec_dir,
2008 manadocs += ['sys-utils/flock.1.adoc']
2009 bashcompletions += ['flock']
2011 opt = not get_option('build-lsirq').disabled()
2015 include_directories : includes,
2016 link_with : [lib_common,
2018 install_dir : usrbin_exec_dir,
2020 build_by_default : opt)
2021 if opt and not is_disabler(exe)
2023 manadocs += ['sys-utils/lsirq.1.adoc']
2024 bashcompletions += ['lsirq']
2027 opt = not get_option('build-irqtop').disabled()
2031 include_directories : includes,
2032 dependencies : [realtime_libs, curses_libs],
2033 link_with : [lib_common,
2036 install_dir : usrbin_exec_dir,
2038 build_by_default : opt)
2039 if opt and not is_disabler(exe)
2041 manadocs += ['sys-utils/irqtop.1.adoc']
2042 bashcompletions += ['irqtop']
2045 opt = not get_option('build-ipcs').disabled()
2049 include_directories : includes,
2050 link_with : [lib_common,
2052 install_dir : usrbin_exec_dir,
2054 build_by_default : opt)
2055 if opt and not is_disabler(exe)
2057 manadocs += ['sys-utils/lsipc.1.adoc']
2058 bashcompletions += ['lsipc']
2065 include_directories : includes,
2066 link_with : [lib_common],
2067 dependencies : [lib_m,
2069 install_dir : sbindir,
2071 build_by_default : opt)
2072 if opt and not is_disabler(exe)
2074 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2075 bashcompletions += ['hwclock']
2081 include_directories : includes,
2082 install_dir : sbindir,
2085 manadocs += ['disk-utils/mkfs.8.adoc']
2086 bashcompletions += ['mkfs']
2088 opt = not get_option('build-bfs').disabled()
2092 include_directories : includes,
2093 link_with : [lib_common],
2094 install_dir : sbindir,
2096 build_by_default : opt)
2097 if opt and not is_disabler(exe)
2099 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2100 bashcompletions += ['mkfs.bfs']
2106 include_directories : includes,
2107 link_with : [lib_common],
2108 install_dir : usrbin_exec_dir,
2111 manadocs += ['disk-utils/isosize.8.adoc']
2112 bashcompletions += ['isosize']
2117 include_directories : includes,
2118 link_with : [lib_common,
2121 dependencies: [lib_selinux],
2122 install_dir : sbindir,
2124 if not is_disabler(exe)
2126 manadocs += ['disk-utils/mkswap.8.adoc']
2127 bashcompletions += ['mkswap']
2133 include_directories : includes,
2134 link_with : [lib_common,
2137 install_dir : sbindir,
2139 if not is_disabler(exe)
2141 manadocs += ['disk-utils/swaplabel.8.adoc']
2142 bashcompletions += ['swaplabel']
2145 opt = not get_option('build-fsck').disabled()
2149 include_directories : includes,
2150 link_with : [lib_common,
2153 dependencies : realtime_libs,
2154 install_dir : sbindir,
2156 build_by_default : opt)
2157 if opt and not is_disabler(exe)
2159 manadocs += ['disk-utils/fsck.8.adoc']
2160 bashcompletions += ['fsck']
2163 opt = not get_option('build-minix').disabled()
2167 include_directories : includes,
2168 link_with : [lib_common],
2169 install_dir : sbindir,
2171 build_by_default : opt)
2175 include_directories : includes,
2176 c_args : '-DTEST_SCRIPT',
2177 link_with : [lib_common],
2178 build_by_default : opt and program_tests)
2182 include_directories : includes,
2183 link_with : [lib_common],
2184 install_dir : sbindir,
2186 build_by_default : opt)
2187 if opt and not is_disabler(exe)
2188 exes += [exe, exe2, exe3]
2189 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2190 bashcompletions += ['mkfs.minix', 'fsck.minix']
2193 opt = not get_option('build-cramfs').disabled()
2196 mkfs_cramfs_sources,
2197 include_directories : includes,
2198 link_with : [lib_common],
2199 dependencies : [lib_z],
2200 install_dir : sbindir,
2202 build_by_default : opt)
2205 fsck_cramfs_sources,
2206 include_directories : includes,
2207 link_with : [lib_common],
2208 dependencies : [lib_z],
2209 install_dir : sbindir,
2211 build_by_default : opt)
2212 if not is_disabler(exe)
2214 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2215 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2218 opt = not get_option('build-raw').disabled()
2220 cc.has_header('linux/raw.h', required: opt)
2225 include_directories : includes,
2226 install_dir : sbindir,
2228 build_by_default : opt)
2229 if opt and not is_disabler(exe)
2231 manadocs += ['disk-utils/raw.8.adoc']
2232 bashcompletions += ['raw']
2235 opt = not get_option('build-fdformat').disabled()
2239 include_directories : includes,
2240 link_with : [lib_common],
2241 install_dir : usrsbin_exec_dir,
2243 build_by_default : opt)
2244 if opt and not is_disabler(exe)
2246 manadocs += ['disk-utils/fdformat.8.adoc']
2247 bashcompletions += ['fdformat']
2253 include_directories : includes,
2254 link_with : [lib_common],
2255 install_dir : sbindir,
2257 manadocs += ['disk-utils/blockdev.8.adoc']
2258 bashcompletions += ['blockdev']
2260 opt = not get_option('build-fdisks').disabled()
2261 if opt and not have_dirfd and not have_ddfd
2262 error('neither dirfd nor ddfd are available')
2267 include_directories : includes,
2268 link_with : [lib_common,
2272 dependencies : [lib_readline],
2273 install_dir : sbindir,
2275 build_by_default : opt)
2276 if opt and not is_disabler(exe)
2278 bashcompletions += ['fdisk']
2281 opt2 = opt and 'fdisk' in static_programs
2285 link_args : ['--static'],
2286 include_directories : includes,
2287 link_with : [lib_common,
2290 lib_smartcols.get_static_lib()],
2291 dependencies : [lib_readline_static],
2292 install_dir : sbindir,
2294 build_by_default : opt2)
2295 if opt2 and not is_disabler(exe)
2302 include_directories : includes,
2303 link_with : [lib_common,
2307 dependencies : [lib_readline],
2308 install_dir : sbindir,
2310 build_by_default : opt)
2311 if opt and not is_disabler(exe)
2313 bashcompletions += ['sfdisk']
2316 opt2 = opt and 'sfdisk' in static_programs
2320 include_directories : includes,
2321 link_with : [lib_common,
2324 lib_smartcols.get_static_lib()],
2325 dependencies : [lib_readline_static],
2326 install_dir : sbindir,
2328 build_by_default : opt2)
2329 if opt2 and not is_disabler(exe)
2336 include_directories : includes,
2337 link_with : [lib_common,
2342 dependencies : [curses_libs],
2343 install_dir : sbindir,
2345 build_by_default : opt)
2346 if opt and not is_disabler(exe)
2348 manadocs += ['disk-utils/fdisk.8.adoc',
2349 'disk-utils/sfdisk.8.adoc',
2350 'disk-utils/cfdisk.8.adoc']
2351 bashcompletions += ['cfdisk']
2354 opt = not get_option('build-partx').disabled()
2358 include_directories : includes,
2359 link_with : [lib_common],
2360 install_dir : usrsbin_exec_dir,
2362 build_by_default : opt)
2366 include_directories : includes,
2367 link_with : [lib_common],
2368 install_dir : usrsbin_exec_dir,
2370 build_by_default : opt)
2374 include_directories : includes,
2375 link_with : [lib_common],
2376 install_dir : usrsbin_exec_dir,
2378 build_by_default : opt)
2382 include_directories : includes,
2383 link_with : [lib_common,
2386 install_dir : usrsbin_exec_dir,
2388 build_by_default : opt)
2390 exes += [exe, exe2, exe3, exe4]
2391 manadocs += ['disk-utils/addpart.8.adoc',
2392 'disk-utils/delpart.8.adoc',
2393 'disk-utils/resizepart.8.adoc',
2394 'disk-utils/partx.8.adoc']
2395 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2398 ############################################################
2403 include_directories : includes,
2404 link_with : [lib_common],
2405 dependencies : [lib_util,
2409 install_dir : usrbin_exec_dir,
2412 manadocs += ['term-utils/script.1.adoc']
2413 bashcompletions += ['script']
2418 include_directories : includes,
2419 c_args : '-DTEST_SCRIPT',
2420 link_with : [lib_common],
2421 dependencies : [lib_util,
2425 build_by_default : program_tests)
2431 include_directories : includes,
2432 link_with : [lib_common],
2433 dependencies : [lib_util,
2436 install_dir : usrbin_exec_dir,
2439 manadocs += ['term-utils/scriptlive.1.adoc']
2440 bashcompletions += ['scriptlive']
2444 scriptreplay_sources,
2445 include_directories : includes,
2446 link_with : [lib_common],
2447 dependencies : [math_libs],
2448 install_dir : usrbin_exec_dir,
2451 manadocs += ['term-utils/scriptreplay.1.adoc']
2452 bashcompletions += ['scriptreplay']
2454 opt = not get_option('build-agetty').disabled()
2458 include_directories : includes,
2459 link_with : [lib_common, logindefs_c],
2460 dependencies : [BSD ? lib_util : [], lib_systemd],
2461 install_dir : sbindir,
2463 build_by_default : opt)
2466 manadocs += ['term-utils/agetty.8.adoc']
2469 opt = not get_option('build-setterm').disabled()
2473 include_directories : includes,
2474 link_with : [lib_common],
2475 dependencies : [curses_libs],
2476 install_dir : usrbin_exec_dir,
2478 build_by_default : opt)
2481 manadocs += ['term-utils/setterm.1.adoc']
2482 bashcompletions += ['setterm']
2485 opt = not get_option('build-mesg').disabled()
2489 include_directories : includes,
2490 link_with : [lib_common],
2491 install_dir : usrbin_exec_dir,
2493 build_by_default : opt)
2496 manadocs += ['term-utils/mesg.1.adoc']
2497 bashcompletions += ['mesg']
2500 opt = not get_option('build-wall').disabled()
2504 include_directories : includes,
2505 link_with : [lib_common],
2506 dependencies : [lib_systemd],
2507 install_dir : usrbin_exec_dir,
2508 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2510 build_by_default : opt)
2513 manadocs += ['term-utils/wall.1.adoc']
2514 bashcompletions += ['wall']
2517 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2518 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2520 opt = not get_option('build-write').disabled()
2524 include_directories : includes,
2525 link_with : [lib_common],
2526 dependencies : [lib_systemd],
2527 install_dir : usrbin_exec_dir,
2528 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2530 build_by_default : opt)
2533 manadocs += ['term-utils/write.1.adoc']
2534 bashcompletions += ['write']
2537 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2538 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2540 opt = not get_option('build-login').disabled()
2544 include_directories : includes,
2545 link_with : [lib_common, logindefs_c],
2546 dependencies : [lib_pam,
2550 build_by_default : opt)
2551 if not is_disabler(exe)
2553 manadocs += ['login-utils/login.1.adoc']
2556 opt = not get_option('build-sulogin').disabled()
2560 include_directories : includes,
2561 link_with : [lib_common],
2562 dependencies : [lib_crypt,
2564 install_dir : sbindir,
2566 build_by_default : opt)
2567 if not is_disabler(exe)
2569 manadocs += ['login-utils/sulogin.8.adoc']
2575 include_directories : includes,
2576 link_with : [lib_common,
2578 dependencies : [curses_libs],
2579 install_dir : usrbin_exec_dir,
2582 manadocs += ['misc-utils/cal.1.adoc']
2583 bashcompletions += ['cal']
2585 opt = not get_option('build-logger').disabled()
2589 include_directories : includes,
2590 link_with : [lib_common],
2591 dependencies : [lib_systemd],
2592 install_dir : usrbin_exec_dir,
2594 build_by_default : opt)
2595 if opt and not is_disabler(exe)
2597 manadocs += ['misc-utils/logger.1.adoc']
2598 bashcompletions += ['logger']
2604 include_directories : includes,
2605 c_args : '-DTEST_LOGGER',
2606 link_with : [lib_common],
2607 dependencies : [lib_systemd],
2608 build_by_default: program_tests)
2609 if not is_disabler(exe)
2616 include_directories : includes,
2617 install_dir : usrbin_exec_dir,
2620 manadocs += ['misc-utils/look.1.adoc']
2621 bashcompletions += ['look']
2626 include_directories : includes,
2627 link_with : [lib_common],
2628 install_dir : usrbin_exec_dir,
2631 manadocs += ['misc-utils/mcookie.1.adoc']
2632 bashcompletions += ['mcookie']
2634 if build_liblastlog2
2638 include_directories : includes,
2639 link_with : [lib_common, lib_lastlog2],
2640 install_dir : usrbin_exec_dir,
2643 manadocs += ['misc-utils/lastlog2.8.adoc']
2644 bashcompletions += ['lastlog2']
2645 manadocs += ['liblastlog2/man/lastlog2.3.adoc',
2646 'liblastlog2/man/ll2_write_entry.3.adoc',
2647 'liblastlog2/man/ll2_read_entry.3.adoc',
2648 'liblastlog2/man/ll2_import_lastlog.3.adoc',
2649 'liblastlog2/man/ll2_read_all.3.adoc',
2650 'liblastlog2/man/ll2_remove_entry.3.adoc',
2651 'liblastlog2/man/ll2_rename_user.3.adoc',
2652 'liblastlog2/man/ll2_update_login_time.3.adoc'
2659 include_directories : includes,
2660 dependencies : [lib_selinux],
2661 install_dir : usrbin_exec_dir,
2664 manadocs += ['misc-utils/namei.1.adoc']
2665 bashcompletions += ['namei']
2670 include_directories : includes,
2671 link_with : [lib_common],
2672 install_dir : usrbin_exec_dir,
2675 manadocs += ['misc-utils/whereis.1.adoc']
2676 bashcompletions += ['whereis']
2681 include_directories : includes,
2682 link_with : [lib_common,
2685 install_dir : usrbin_exec_dir,
2687 if not is_disabler(exe)
2689 manadocs += ['misc-utils/lslocks.8.adoc']
2690 bashcompletions += ['lslocks']
2696 include_directories : includes,
2697 link_with : [lib_common,
2702 dependencies : lib_udev,
2704 if not is_disabler(exe)
2706 manadocs += ['misc-utils/lsblk.8.adoc']
2707 bashcompletions += ['lsblk']
2710 errnos_h = custom_target('errnos.h',
2711 input : 'tools/all_errnos',
2712 output : 'errnos.h',
2713 command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
2717 mq_libs += cc.find_library('rt', required : true)
2721 lsfd_sources, errnos_h,
2722 include_directories : includes,
2723 link_with : [lib_common,
2725 dependencies : mq_libs,
2726 install_dir : usrbin_exec_dir,
2728 if not is_disabler(exe)
2730 manadocs += ['misc-utils/lsfd.1.adoc']
2736 include_directories : includes,
2737 link_with : [lib_common,
2739 install_dir : usrbin_exec_dir,
2741 if not is_disabler(exe)
2743 manadocs += ['misc-utils/uuidgen.1.adoc']
2744 bashcompletions += ['uuidgen']
2750 include_directories : includes,
2751 link_with : [lib_common,
2754 install_dir : usrbin_exec_dir,
2756 if not is_disabler(exe)
2758 manadocs += ['misc-utils/uuidparse.1.adoc']
2759 bashcompletions += ['uuidparse']
2766 include_directories : includes,
2767 link_with : [lib_common,
2769 dependencies : [realtime_libs,
2771 install_dir : usrsbin_exec_dir,
2773 build_by_default : opt)
2777 include_directories : includes,
2778 link_with : [lib_common,
2780 dependencies : thread_libs,
2781 build_by_default : opt and program_tests)
2782 if not is_disabler(exe)
2784 manadocs += ['misc-utils/uuidd.8.adoc']
2785 bashcompletions += ['uuidd']
2788 opt = build_libblkid
2792 include_directories : includes,
2793 link_with : [lib_common,
2795 install_dir : sbindir,
2797 build_by_default : opt)
2798 if opt and not is_disabler(exe)
2800 manadocs += ['misc-utils/blkid.8.adoc']
2801 bashcompletions += ['blkid']
2804 opt = opt and 'blkid' in static_programs
2808 include_directories : includes,
2809 link_with : [lib_common,
2811 install_dir : sbindir,
2813 build_by_default : opt)
2814 if opt and not is_disabler(exe)
2820 'libblkid/samples/mkfs.c',
2821 include_directories : includes,
2822 link_with : lib_blkid)
2823 if not is_disabler(exe)
2828 'sample-partitions',
2829 'libblkid/samples/partitions.c',
2830 include_directories : includes,
2831 link_with : lib_blkid)
2832 if not is_disabler(exe)
2837 'sample-superblocks',
2838 'libblkid/samples/superblocks.c',
2839 include_directories : includes,
2840 link_with : lib_blkid)
2841 if not is_disabler(exe)
2847 'libblkid/samples/topology.c',
2848 include_directories : includes,
2849 link_with : lib_blkid)
2850 if not is_disabler(exe)
2855 'test_blkid_fuzz_sample',
2856 'libblkid/src/fuzz.c',
2857 include_directories: includes,
2858 link_with: lib_blkid,
2859 build_by_default: program_tests)
2860 if not is_disabler(exe)
2864 ############################################################
2869 include_directories : includes,
2870 link_with : [lib_blkid],
2871 install_dir : sbindir,
2873 if not is_disabler(exe)
2875 manadocs += ['misc-utils/findfs.8.adoc']
2876 bashcompletions += ['findfs']
2882 include_directories : includes,
2883 link_with : [lib_common,
2886 install_dir : sbindir,
2888 if not is_disabler(exe)
2890 manadocs += ['misc-utils/wipefs.8.adoc']
2891 bashcompletions += ['wipefs']
2897 include_directories : includes,
2898 link_with : [lib_common,
2902 dependencies : [lib_udev],
2904 if not is_disabler(exe)
2906 manadocs += ['misc-utils/findmnt.8.adoc']
2907 bashcompletions += ['findmnt']
2913 include_directories : includes,
2914 link_with : [lib_common],
2916 if not is_disabler(exe)
2918 manadocs += ['misc-utils/kill.1.adoc']
2921 opt = not get_option('build-rename').disabled()
2925 include_directories : includes,
2926 install_dir : usrbin_exec_dir,
2928 build_by_default : opt)
2929 if opt and not is_disabler(exe)
2931 manadocs += ['misc-utils/rename.1.adoc']
2932 bashcompletions += ['rename']
2938 include_directories : includes,
2939 link_with : [lib_common],
2940 install_dir : usrbin_exec_dir,
2943 manadocs += ['misc-utils/getopt.1.adoc']
2944 bashcompletions += ['getopt']
2949 include_directories : includes,
2950 link_with : [lib_common,
2952 install_dir : usrbin_exec_dir,
2954 if not is_disabler(exe)
2956 manadocs += ['misc-utils/fincore.1.adoc']
2957 bashcompletions += ['fincore']
2963 include_directories : includes,
2964 link_with : [lib_common],
2965 install_dir : usrbin_exec_dir,
2967 if not is_disabler(exe)
2969 manadocs += ['misc-utils/hardlink.1.adoc']
2970 bashcompletions += ['hardlink']
2973 opt = not get_option('build-pipesz').disabled()
2977 include_directories : includes,
2978 link_with : [lib_common],
2979 install_dir : usrbin_exec_dir,
2981 if opt and not is_disabler(exe)
2983 manadocs += ['misc-utils/pipesz.1.adoc']
2984 bashcompletions += ['pipesz']
2990 include_directories : includes,
2991 c_args : '-DTEST_CAL',
2992 link_with : [lib_common,
2994 dependencies : [curses_libs],
2995 build_by_default: program_tests)
2996 if not is_disabler(exe)
3003 include_directories : includes,
3004 link_with : [lib_common],
3005 install_dir : usrbin_exec_dir,
3007 if not is_disabler(exe)
3009 manadocs += ['misc-utils/fadvise.1.adoc']
3010 bashcompletions += ['fadvise']
3013 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
3017 include_directories : includes,
3018 link_with : [lib_common],
3019 install_dir : usrbin_exec_dir,
3021 if not is_disabler(exe)
3023 manadocs += ['misc-utils/waitpid.1.adoc']
3024 bashcompletions += ['waitpid']
3028 syscalls_h = custom_target('syscalls.h',
3029 input : 'tools/all_syscalls',
3030 output : 'syscalls.h',
3031 command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
3034 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
3037 'misc-utils/enosys.c', syscalls_h, errnos_h,
3038 include_directories : includes,
3039 link_with : [lib_common],
3040 install_dir : usrbin_exec_dir,
3042 if not is_disabler(exe)
3044 manadocs += ['misc-utils/enosys.1.adoc']
3045 bashcompletions += ['enosys']
3052 include_directories : includes,
3053 link_with : [lib_common, lib_smartcols],
3054 install_dir : usrbin_exec_dir,
3056 if not is_disabler(exe)
3058 manadocs += ['misc-utils/lsclocks.1.adoc']
3059 bashcompletions += ['lsclocks']
3062 if conf.get('HAVE_RENAMEAT2').to_string() == '1'
3066 include_directories : includes,
3067 link_with : [lib_common],
3068 install_dir : usrbin_exec_dir,
3070 if not is_disabler(exe)
3072 manadocs += ['misc-utils/exch.1.adoc']
3073 bashcompletions += ['exch']
3077 ############################################################
3079 opt = not get_option('build-schedutils').disabled()
3082 'schedutils/chrt.c',
3083 include_directories : includes,
3084 link_with : lib_common,
3085 install_dir : usrbin_exec_dir,
3087 build_by_default : opt)
3091 'schedutils/ionice.c',
3092 include_directories : includes,
3093 link_with : lib_common,
3094 install_dir : usrbin_exec_dir,
3096 build_by_default : opt)
3100 'schedutils/taskset.c',
3101 include_directories : includes,
3102 link_with : lib_common,
3103 install_dir : usrbin_exec_dir,
3105 build_by_default : opt)
3109 'schedutils/uclampset.c',
3110 include_directories : includes,
3111 link_with : lib_common,
3112 install_dir : usrbin_exec_dir,
3114 build_by_default : opt)
3116 if opt and not is_disabler(exe)
3117 exes += [exe, exe2, exe3, exe4]
3118 manadocs += ['schedutils/chrt.1.adoc',
3119 'schedutils/ionice.1.adoc',
3120 'schedutils/taskset.1.adoc',
3121 'schedutils/uclampset.1.adoc']
3122 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3125 ############################################################
3127 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3132 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3133 include_directories : dir_include,
3134 link_with : lib_common,
3135 build_by_default: program_tests)
3141 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3142 include_directories : dir_include,
3143 link_with : lib_common,
3144 build_by_default: program_tests)
3150 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3151 include_directories : dir_include,
3152 link_with : lib_common,
3153 build_by_default: program_tests)
3159 c_args : ['-DTEST_PROGRAM_MANGLE'],
3160 include_directories : dir_include,
3161 build_by_default: program_tests)
3167 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3168 include_directories : dir_include,
3169 build_by_default: program_tests)
3175 'lib/color-names.c',
3176 c_args : ['-DTEST_PROGRAM_COLORS'],
3177 include_directories : dir_include,
3178 link_with : [lib_common, lib_tcolors],
3179 build_by_default: program_tests)
3185 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3186 include_directories : dir_include,
3187 build_by_default: program_tests)
3190 if conf.get('HAVE_OPENAT').to_string() == '1' \
3191 and conf.get('HAVE_DIRFD').to_string() == '1'
3195 c_args : ['-DTEST_PROGRAM_PROCFS'],
3196 include_directories : dir_include,
3197 link_with : lib_common,
3198 build_by_default: program_tests)
3205 have_cpu_set_t ? 'lib/cpuset.c' : [],
3206 c_args : ['-DTEST_PROGRAM_PATH'],
3207 include_directories : dir_include,
3208 link_with : lib_common,
3209 build_by_default: program_tests)
3213 if conf.get('HAVE_PTY').to_string() == '1'
3218 c_args : ['-DTEST_PROGRAM_PTY'],
3219 include_directories : dir_include,
3220 link_with : [lib_common],
3221 dependencies : [lib_m,
3224 build_by_default: program_tests)
3232 c_args : ['-DTEST_PROGRAM_CPUSET'],
3233 include_directories : dir_include,
3234 build_by_default: program_tests)
3245 have_cpu_set_t ? 'lib/cpuset.c' : [],
3246 c_args : ['-DTEST_PROGRAM_SYSFS'],
3247 include_directories : dir_include,
3248 build_by_default: program_tests)
3254 c_args : ['-DTEST_PROGRAM_PAGER'],
3255 include_directories : dir_include,
3256 build_by_default: program_tests)
3260 'test_linux_version',
3261 'lib/linux_version.c',
3262 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3263 include_directories : dir_include,
3264 build_by_default: program_tests)
3270 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3271 include_directories : dir_include,
3272 build_by_default: program_tests)
3276 'test_canonicalize',
3277 'lib/canonicalize.c',
3278 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3279 include_directories : dir_include,
3280 build_by_default: program_tests)
3287 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3288 include_directories : dir_include,
3289 build_by_default: program_tests)
3295 c_args : ['-DTEST_PROGRAM'],
3296 include_directories : dir_include,
3297 link_with : lib_common,
3298 build_by_default: program_tests)
3304 c_args : ['-DTEST_PROGRAM'],
3305 include_directories : dir_include,
3306 link_with : [lib_common, logindefs_c],
3307 build_by_default: program_tests)
3311 ############################################################
3315 'libuuid/src/test_uuid.c',
3316 include_directories : [dir_include, dir_libuuid],
3317 link_with : lib_uuid,
3318 dependencies : socket_libs,
3319 build_by_default: program_tests)
3320 if not is_disabler(exe)
3324 ############################################################
3326 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3327 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3331 'libfdisk/src/ask.c',
3332 c_args : libfdisk_tests_cflags,
3333 include_directories : lib_fdisk_includes,
3334 link_with : libfdisk_tests_ldadd,
3335 build_by_default: program_tests)
3336 if not is_disabler(exe)
3342 'libfdisk/src/gpt.c',
3343 c_args : libfdisk_tests_cflags,
3344 include_directories : lib_fdisk_includes,
3345 link_with : libfdisk_tests_ldadd,
3346 build_by_default: program_tests)
3347 if not is_disabler(exe)
3353 'libfdisk/src/utils.c',
3354 c_args : libfdisk_tests_cflags,
3355 include_directories : lib_fdisk_includes,
3356 link_with : libfdisk_tests_ldadd,
3357 build_by_default: program_tests)
3358 if not is_disabler(exe)
3363 'test_fdisk_script',
3364 'libfdisk/src/script.c',
3365 c_args : libfdisk_tests_cflags,
3366 include_directories : lib_fdisk_includes,
3367 link_with : libfdisk_tests_ldadd,
3368 build_by_default: program_tests)
3369 if not is_disabler(exe)
3374 'test_fdisk_version',
3375 'libfdisk/src/version.c',
3376 c_args : libfdisk_tests_cflags,
3377 include_directories : lib_fdisk_includes,
3378 link_with : libfdisk_tests_ldadd,
3379 build_by_default: program_tests)
3380 if not is_disabler(exe)
3386 'libfdisk/src/item.c',
3387 c_args : libfdisk_tests_cflags,
3388 include_directories : lib_fdisk_includes,
3389 link_with : libfdisk_tests_ldadd,
3390 build_by_default: program_tests)
3391 if not is_disabler(exe)
3395 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3398 'sample-fdisk-mkpart',
3399 'libfdisk/samples/mkpart.c',
3400 include_directories : lib_fdisk_includes,
3401 link_with : sample_fdisk_ldadd)
3402 if not is_disabler(exe)
3407 'sample-fdisk-mkpart-fullspec',
3408 'libfdisk/samples/mkpart-fullspec.c',
3409 include_directories : lib_fdisk_includes,
3410 link_with : sample_fdisk_ldadd)
3411 if not is_disabler(exe)
3415 ############################################################
3419 'tests/helpers/test_cap.c',
3420 include_directories : includes,
3421 dependencies : [lib_cap_ng],
3422 build_by_default: program_tests)
3423 if not is_disabler(exe)
3429 'tests/helpers/test_mbsencode.c',
3430 include_directories : includes,
3431 link_with : lib_common,
3432 build_by_default: program_tests)
3437 'tests/helpers/test_byteswap.c',
3438 include_directories : includes,
3439 build_by_default: program_tests)
3444 'tests/helpers/test_md5.c',
3446 include_directories : includes,
3447 build_by_default: program_tests)
3452 'tests/helpers/test_sha1.c',
3454 include_directories : includes,
3455 build_by_default: program_tests)
3460 'tests/helpers/test_pathnames.c',
3461 include_directories : includes,
3462 build_by_default: program_tests)
3467 'tests/helpers/test_strerror.c',
3468 include_directories : includes,
3469 build_by_default: program_tests)
3474 'tests/helpers/test_sysinfo.c',
3475 include_directories : includes,
3476 build_by_default: program_tests)
3481 'tests/helpers/test_sigreceive.c',
3482 include_directories : includes,
3483 link_with : lib_common,
3484 build_by_default: program_tests)
3489 'tests/helpers/test_tiocsti.c',
3490 include_directories : includes,
3491 build_by_default: program_tests)
3495 'test_uuid_namespace',
3496 'tests/helpers/test_uuid_namespace.c',
3500 include_directories : includes,
3501 build_by_default: program_tests)
3507 'tests/helpers/test_mkfds.c',
3508 'tests/helpers/test_mkfds.h',
3509 'tests/helpers/test_mkfds_ppoll.c',
3510 include_directories : includes,
3511 dependencies : mq_libs,
3512 build_by_default: program_tests)
3518 'tests/helpers/test_enosys.c',
3519 include_directories : includes,
3520 build_by_default: program_tests)
3523 ############################################################
3525 if conf.get('HAVE_OPENAT').to_string() == '1'
3527 'sample-scols-tree',
3528 'libsmartcols/samples/tree.c',
3529 include_directories : includes,
3530 link_with : [lib_smartcols, lib_common],
3531 build_by_default: program_tests)
3532 if not is_disabler(exe)
3538 'sample-scols-title',
3539 'libsmartcols/samples/title.c',
3540 include_directories : includes,
3541 link_with : [lib_smartcols, lib_common])
3542 if not is_disabler(exe)
3547 'sample-scols-wrap',
3548 'libsmartcols/samples/wrap.c',
3549 include_directories : includes,
3550 link_with : [lib_smartcols, lib_common])
3551 if not is_disabler(exe)
3556 'sample-scols-continuous',
3557 'libsmartcols/samples/continuous.c',
3558 include_directories : includes,
3559 link_with : [lib_smartcols, lib_common])
3560 if not is_disabler(exe)
3565 'sample-scols-continuous-json',
3566 'libsmartcols/samples/continuous-json.c',
3567 include_directories : includes,
3568 link_with : [lib_smartcols, lib_common])
3569 if not is_disabler(exe)
3574 'sample-scols-maxout',
3575 'libsmartcols/samples/maxout.c',
3576 include_directories : includes,
3577 link_with : [lib_smartcols, lib_common])
3578 if not is_disabler(exe)
3583 'sample-scols-fromfile',
3584 'libsmartcols/samples/fromfile.c',
3585 include_directories : includes,
3586 link_with : [lib_smartcols, lib_common])
3587 if not is_disabler(exe)
3592 'sample-scols-grouping-simple',
3593 'libsmartcols/samples/grouping-simple.c',
3594 include_directories : includes,
3595 link_with : [lib_smartcols, lib_common])
3596 if not is_disabler(exe)
3601 'sample-scols-grouping-overlay',
3602 'libsmartcols/samples/grouping-overlay.c',
3603 include_directories : includes,
3604 link_with : [lib_smartcols, lib_common])
3605 if not is_disabler(exe)
3611 'Documentation/boilerplate.c',
3612 include_directories : includes,
3613 build_by_default: program_tests)
3614 if not is_disabler(exe)
3618 ############################################################
3620 # Let the test runner know whether we're running under asan and export
3621 # some paths. We use a file on disk so that it is possible to run the
3622 # test scripts from commandline without setting any variables.
3623 configure_file(output : 'meson.conf',
3628 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3629 python.full_path())])
3631 run_sh = find_program('tests/run.sh')
3635 '--srcdir=' + meson.current_source_dir(),
3636 '--builddir=' + meson.current_build_dir(),
3642 manadocs += ['lib/terminal-colors.d.5.adoc']
3643 manadocs += ['libblkid/libblkid.3.adoc']
3647 'libuuid/man/uuid.3.adoc',
3648 'libuuid/man/uuid_clear.3.adoc',
3649 'libuuid/man/uuid_compare.3.adoc',
3650 'libuuid/man/uuid_copy.3.adoc',
3651 'libuuid/man/uuid_generate.3.adoc',
3652 'libuuid/man/uuid_is_null.3.adoc',
3653 'libuuid/man/uuid_parse.3.adoc',
3654 'libuuid/man/uuid_time.3.adoc',
3655 'libuuid/man/uuid_unparse.3.adoc']
3657 'uuid_generate_random.3': 'uuid_generate.3',
3658 'uuid_generate_time.3': 'uuid_generate.3',
3659 'uuid_generate_time_safe.3': 'uuid_generate.3',
3663 asciidoctor = find_program('asciidoctor', required : false)
3664 if asciidoctor.found()
3665 foreach adoc : manadocs
3666 name = adoc.split('/')[-1]
3667 page = name.split('.adoc')[0]
3668 section = page.split('.')[-1]
3669 mandirn = join_paths(mandir, 'man' + section)
3674 command : [ asciidoctor,
3676 '-a', 'VERSION=' + meson.project_version(),
3677 '-a', 'release-version=' + meson.project_version(),
3678 '-a', 'ADJTIME_PATH=/etc/adjtime',
3679 '-a', 'package-docdir=' + docdir,
3680 '--base-dir=' + meson.current_source_dir(),
3681 '--destination-dir=' + meson.current_build_dir(),
3682 '--load-path', '@SOURCE_ROOT@/tools',
3683 '--require', 'asciidoctor-includetracker',
3687 depfile : page + '.deps',
3689 install_dir : mandirn)
3692 foreach link_name, target : manlinks
3693 link_section = link_name.split('.')[-1]
3694 target_section = target.split('.')[-1]
3695 meson.add_install_script(meson_make_manpage_stub,
3696 join_paths('man' + target_section, target),
3697 join_paths(mandir, 'man' + link_section, link_name))
3701 if bash_completion.found()
3702 foreach completion : bashcompletions
3704 join_paths('bash-completion', completion),
3705 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3708 foreach link_name, target : bashcompletionslinks
3709 meson.add_install_script(meson_make_symlink,
3711 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))