1 project('util-linux', 'c',
2 version : run_command('tools/git-version-gen', check: true).stdout(),
3 meson_version: '>=0.60.0',
11 pkgconfig = import('pkgconfig')
13 libblkid_version = '1.1.0'
14 libblkid_date = '01-Jun-2021'
15 libuuid_version = '1.3.0'
16 libmount_version = '1.1.0'
17 libsmartcols_version = '1.1.0'
18 libfdisk_version = '1.1.0'
20 prefixdir = get_option('prefix')
21 if not prefixdir.startswith('/')
22 error('Prefix is not absolute: "@0@"'.format(prefixdir))
24 bindir = join_paths(prefixdir, get_option('bindir'))
25 sbindir = join_paths(prefixdir, get_option('sbindir'))
26 sysconfstaticdir = join_paths(prefixdir, 'lib')
27 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
28 mandir = join_paths(prefixdir, get_option('mandir'))
30 execprefixdir = prefixdir
31 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
32 usrbin_exec_dir = join_paths(execprefixdir, bindir)
33 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
34 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
36 vendordir = get_option('vendordir')
38 add_project_arguments('-D_GNU_SOURCE', language : 'c')
40 cc = meson.get_compiler('c')
42 conf = configuration_data()
43 conf.set_quoted('PACKAGE', meson.project_name())
44 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
45 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
46 conf.set_quoted('PACKAGE_STRING', package_string)
49 pc_version = meson.project_version().split('-')[0].split('.')
51 if pc_version.length() < 3
55 pc_version = '.'.join(pc_version)
57 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
58 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
60 conf.set('bindir', bindir)
61 conf.set('sbindir', sbindir)
62 conf.set('runstatedir', runstatedir)
63 conf.set('sysconfdir', sysconfdir)
64 conf.set('usrsbin_execdir', usrsbin_exec_dir)
65 conf.set('docdir', docdir)
66 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
67 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
68 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
69 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
71 conf.set_quoted('_PATH_VENDORDIR', vendordir)
72 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
74 build_libblkid = not get_option('build-libblkid').disabled()
75 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
76 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
78 build_libuuid = not get_option('build-libuuid').disabled()
79 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
80 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
82 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
83 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
84 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
86 have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
87 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
89 build_libmount = not get_option('build-libmount').disabled()
90 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
91 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
92 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
93 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
95 build_libsmartcols = not get_option('build-libsmartcols').disabled()
96 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
97 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
99 build_libfdisk = not get_option('build-libfdisk').disabled()
100 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
101 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
103 build_uuidd = not get_option('build-uuidd').disabled()
104 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
105 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
107 static_programs = get_option('static-programs')
108 need_static_libs = static_programs.length() > 0 # a rough estimate...
109 summary('static programs', static_programs)
111 LINUX = host_machine.system() in ['linux']
112 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
114 ############################################################
132 have = cc.compiles(code, name : 'wchar_t support')
133 if not have and get_option('widechar').enabled()
134 error('widechar support requested but unavailable')
136 if get_option('ncurses').enabled() and get_option('widechar').enabled()
137 error('widechar support is incompatible with non-wide ncurses')
139 conf.set('HAVE_WIDECHAR', have ? 1 : false)
180 linux/net_namespace.h
226 lib_m = cc.find_library('m')
228 lib_tinfo = dependency(
230 required : get_option('tinfo'))
232 lib_ncursesw = dependency(
234 required : get_option('ncursesw'))
235 if lib_ncursesw.found()
236 headers += ['ncursesw/ncurses.h',
240 lib_ncurses = disabler()
242 lib_ncurses = dependency(
244 required : get_option('ncurses'))
245 headers += ['ncurses.h',
249 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
250 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
251 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
253 lib_slang = dependency(
255 required : get_option('slang'))
257 headers += ['slang.h',
262 conf.set('HAVE_SLANG', lib_slang.found())
264 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
265 if curses_libs.found()
266 have = cc.has_function('use_default_colors', dependencies : curses_libs)
267 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
268 have = cc.has_function('resizeterm', dependencies : curses_libs)
269 conf.set('HAVE_RESIZETERM', have ? 1 : false)
276 required : get_option('zlib'))
278 lib_readline = dependency(
280 required : get_option('readline'))
281 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
283 lib_readline_static = dependency(
286 required : need_static_libs ? get_option('readline') : disabler())
288 if meson.version().version_compare('>= 0.59.0')
289 lib_intl = dependency(
291 required : get_option('nls'))
292 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
294 if get_option('nls').enabled()
295 error('nls is not supported with meson before 0.59.0')
297 lib_intl = dependency('', required : false)
300 lib_user = dependency(
303 required : get_option('libuser'))
304 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
306 lib_util = cc.find_library(
308 required : get_option('libutil'))
309 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
311 lib_utempter = cc.find_library(
313 required : get_option('libutempter'))
314 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
316 systemd = dependency(
318 required : get_option('systemd'))
320 lib_systemd = dependency(
322 required : get_option('systemd'))
323 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
324 conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false)
326 have = cc.has_function(
327 'sd_session_get_username',
328 dependencies : lib_systemd)
329 conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false)
331 lib_udev = dependency(
333 required : get_option('systemd'))
334 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
336 lib_crypt = cc.find_library('crypt')
338 lib_pam = cc.find_library('pam', required : get_option('build-login'))
339 if not lib_pam.found()
340 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
342 if not lib_pam.found()
343 lib_pam = cc.find_library('pam', required : get_option('build-su'))
345 if not lib_pam.found()
346 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
349 lib_pam_misc = cc.find_library('pam_misc')
350 lib_pam = [lib_pam, lib_pam_misc]
352 lib_pam_misc = declare_dependency()
355 lib_cryptsetup = dependency(
357 required : get_option('cryptsetup'))
358 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
360 if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
361 if meson.version().version_compare('>= 0.62.0')
362 lib_dl = dependency('dl')
364 lib_dl = cc.find_library('dl')
366 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
367 summary('cryptsetup support (dlopen)',
369 section : 'components')
371 summary('cryptsetup support',
372 lib_cryptsetup.found() ? 'enabled' : 'disabled',
373 section : 'components')
376 have = cc.has_function(
377 'crypt_activate_by_signed_key',
378 dependencies : lib_cryptsetup)
379 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
381 lib_cap_ng = dependency(
383 required : get_option('build-setpriv'))
384 if not lib_cap_ng.found()
385 lib_cap_ng = disabler()
388 lib_selinux = dependency(
391 required : get_option('selinux'))
392 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
394 lib_magic = dependency(
396 required : get_option('magic'))
397 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
399 lib_econf = dependency(
401 required : get_option('econf'))
402 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
404 lib_audit = dependency(
406 required : get_option('audit'))
407 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
409 conf.set('HAVE_SMACK', not get_option('smack').disabled())
411 foreach header : headers
412 have = cc.has_header(header)
413 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
416 header = 'linux/btrfs.h'
417 enable_btrfs = cc.has_header(header,
418 required : get_option('btrfs'))
419 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
420 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
422 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
427 have = cc.has_header(header,
429 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
432 have = cc.has_header('sched.h')
433 conf.set10('HAVE_DECL_CPU_ALLOC', have)
434 # We get -1 if the size cannot be determined
435 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
436 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
438 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
439 conf.set10('HAVE_ENVIRON_DECL', have)
441 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
442 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
444 have = cc.has_function('strsignal')
445 conf.set10('HAVE_STRSIGNAL_DECL', have)
447 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
448 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
450 have = cc.has_type('loff_t', prefix : '#include <sys/types.h>')
451 conf.set('HAVE_LOFF_T', have ? 1 : false)
453 have = cc.compiles('''
454 #define _GNU_SOURCE 1
455 #include <langinfo.h>
458 str = nl_langinfo (ALTMON_1);
459 str = nl_langinfo (ALTMON_2);
460 str = nl_langinfo (ALTMON_3);
461 str = nl_langinfo (ALTMON_4);
462 str = nl_langinfo (ALTMON_5);
463 str = nl_langinfo (ALTMON_6);
464 str = nl_langinfo (ALTMON_7);
465 str = nl_langinfo (ALTMON_8);
466 str = nl_langinfo (ALTMON_9);
467 str = nl_langinfo (ALTMON_10);
468 str = nl_langinfo (ALTMON_11);
469 str = nl_langinfo (ALTMON_12);
473 name : 'langinfo.h defines ALTMON_x constants')
474 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
476 have = cc.compiles('''
477 #define _GNU_SOURCE 1
478 #include <langinfo.h>
481 str = nl_langinfo (_NL_ABALTMON_1);
482 str = nl_langinfo (_NL_ABALTMON_2);
483 str = nl_langinfo (_NL_ABALTMON_3);
484 str = nl_langinfo (_NL_ABALTMON_4);
485 str = nl_langinfo (_NL_ABALTMON_5);
486 str = nl_langinfo (_NL_ABALTMON_6);
487 str = nl_langinfo (_NL_ABALTMON_7);
488 str = nl_langinfo (_NL_ABALTMON_8);
489 str = nl_langinfo (_NL_ABALTMON_9);
490 str = nl_langinfo (_NL_ABALTMON_10);
491 str = nl_langinfo (_NL_ABALTMON_11);
492 str = nl_langinfo (_NL_ABALTMON_12);
496 name : 'langinfo.h defines _NL_ABALTMON_x constants')
497 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
499 have = cc.compiles('''
500 #define _GNU_SOURCE 1
501 #include <langinfo.h>
504 str = nl_langinfo (_NL_TIME_WEEK_1STDAY);
508 name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant')
509 conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false)
604 have = cc.has_function(func)
605 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
606 # This makes little sense, but is necessary to avoid warnings about
607 # redefined macros from Python.h, which uses this convention.
608 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
611 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
612 conf.set('AGETTY_RELOAD', have ? 1 : false)
614 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
617 have_dirfd = (cc.has_function('dirfd') or
618 cc.has_header_symbol('dirent.h', 'dirfd',
619 prefix : '#include <sys/types.h>'))
620 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
622 have_ddfd = cc.has_member('DIR', 'dd_fd',
624 #include <sys/types.h>
627 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
629 have = cc.has_member('struct tm', 'tm_gmtoff',
634 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
638 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
639 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
641 have = cc.has_member('struct termios', 'c_line',
642 prefix : '#include <termios.h>')
643 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
645 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
646 prefix : '#include <sys/stat.h>')
647 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
649 have = cc.has_member('struct statx', 'stx_mnt_id',
650 prefix : '#include <sys/stat.h>')
651 conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
653 # replacement for AC_STRUCT_TIMEZONE
654 have = cc.has_member('struct tm', 'tm_zone',
655 prefix : '#include <time.h>')
656 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
658 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
659 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
661 have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY')
662 conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false)
664 have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY')
665 conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false)
670 extern char *tzname[];
673 return tzname ? 0 : 1;
675 '''.format(have ? 1 : 0)
676 have = cc.compiles(code, name : 'using tzname[]')
677 conf.set('HAVE_TZNAME', have ? 1 : false)
680 if not cc.has_function('socket')
681 socket_libs += cc.find_library('socket', required : true)
682 have = cc.has_function('socket',
683 dependencies : socket_libs)
685 error('socket() function not available')
690 have = cc.has_function('clock_gettime')
692 realtime_libs += cc.find_library('rt', required : true)
693 have = cc.has_function('clock_gettime',
694 dependencies : realtime_libs)
696 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
698 thread_libs = dependency('threads')
700 have = cc.has_function('timer_create')
702 realtime_libs = [cc.find_library('rt', required : true)]
703 have = cc.has_function('timer_create',
704 dependencies : realtime_libs)
706 realtime_libs += thread_libs
707 have = cc.has_function('timer_create',
708 dependencies : realtime_libs)
711 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
713 have = cc.has_function('setitimer')
714 conf.set('HAVE_SETITIMER', have ? 1 : false)
717 rtas_libs = cc.find_library('rtas', required : false)
718 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
721 if not cc.has_header_symbol('math.h', 'isnan')
722 lib = cc.find_library('m', required : true)
723 if (cc.has_function('isnan', dependencies : lib) and
724 cc.has_function('__isnan', dependencies : lib))
729 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
730 args : '-D_GNU_SOURCE')
731 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
734 extern char *__progname;
736 return (*__progname != 0);
739 have = cc.compiles(code, name : 'using __progname')
740 conf.set('HAVE___PROGNAME', have ? 1 : false)
742 have = conf.get('HAVE_PTY_H').to_string() == '1' \
743 and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1'
744 conf.set('HAVE_PTY', have ? 1 : false)
746 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
747 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
749 build_plymouth_support = get_option('build-plymouth-support')
750 have_tiocglcktrmios = cc.has_header_symbol(
751 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
752 required : build_plymouth_support.enabled())
753 have_sock_cloexec = cc.has_header_symbol(
754 'sys/socket.h', 'SOCK_CLOEXEC',
755 prefix : '#include <sys/types.h>',
756 required : build_plymouth_support.enabled())
757 have_sock_nonblock = cc.has_header_symbol(
758 'sys/socket.h', 'SOCK_NONBLOCK',
759 prefix : '#include <sys/types.h>',
760 required : build_plymouth_support.enabled())
761 have_so_passcred = cc.has_header_symbol(
762 'sys/socket.h', 'SO_PASSCRED',
763 prefix : '#include <sys/types.h>',
764 required : build_plymouth_support.enabled())
766 build_plymouth_support = (not build_plymouth_support.disabled() and
767 have_tiocglcktrmios and
768 have_sock_cloexec and
769 have_sock_nonblock and
771 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
772 summary('plymouth support',
773 build_plymouth_support ? 'enabled' : 'disabled',
774 section : 'components')
776 # check for valid fallocate() function
777 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
778 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
779 # and program can't be linked.
787 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
788 return ret == 0 ? 0 : 1;
791 have = cc.links(code, name : 'fallocate() function')
792 conf.set('HAVE_FALLOCATE', have ? 1 : false)
800 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
801 return ret == 0 ? 0 : 1;
804 have = cc.links(code, name : 'posix_fallocate() function')
805 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
807 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
808 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
809 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
811 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
812 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
813 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
815 is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__')
817 ############################################################
820 fs_search_path = get_option('fs-search-path')
821 fs_search_path_extra = get_option('fs-search-path-extra')
822 if fs_search_path_extra != ''
823 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
825 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
827 systemdsystemunitdir = ''
829 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
832 sysvinit = get_option('sysvinit').enabled()
833 sysvinitrcdir = sysconfdir + '/init.d'
835 program_tests = get_option('program-tests')
837 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
838 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
840 have = get_option('chsh-only-listed')
841 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
843 have = get_option('use-tty-group')
844 conf.set('USE_TTY_GROUP', have ? 1 : false)
846 bison = find_program('bison')
847 flex = find_program('flex')
849 build_hwclock = not get_option('build-hwclock').disabled()
850 bison_gen = generator(
852 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
853 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
855 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
856 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
860 configuration : conf)
862 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
867 '-Waddress-of-packed-member',
868 '-Wdiscarded-qualifiers',
869 '-Wembedded-directive',
872 '-Wimplicit-function-declaration',
873 '-Wmissing-declarations',
874 '-Wmissing-parameter-type',
875 '-Wmissing-prototypes',
877 '-Wno-missing-field-initializers',
878 '-Wold-style-definition',
882 '-Wstrict-prototypes',
885 '-Wunused-but-set-parameter',
886 '-Wunused-but-set-variable',
887 '-Wunused-parameter',
893 foreach compiler_flag : compiler_flags
894 if cc.has_argument(compiler_flag)
895 add_project_arguments(compiler_flag, language : 'c')
903 bashcompletionslinks = {}
909 subdir('libsmartcols')
912 subdir('login-utils')
920 includes = [dir_include,
930 opt = not get_option('build-chfn-chsh').disabled()
935 include_directories : includes,
936 link_with : [lib_common, logindefs_c],
937 dependencies : chfn_chsh_deps,
938 install_dir : usrbin_exec_dir,
939 install_mode : 'rwsr-xr-x',
941 build_by_default : opt)
945 'login-utils/chsh.c',
948 include_directories : includes,
949 link_with : lib_common,
950 dependencies : chfn_chsh_deps,
951 install_dir : usrbin_exec_dir,
952 install_mode : 'rwsr-xr-x',
954 build_by_default : opt)
955 if opt and not is_disabler(exe)
957 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
958 bashcompletions += ['chfn', 'chsh']
963 test_islocal_sources,
964 include_directories : includes,
965 c_args : '-DTEST_PROGRAM',
966 build_by_default : program_tests)
971 test_consoles_sources,
972 c_args : ['-DTEST_PROGRAM'],
973 include_directories : includes,
974 link_with : lib_common,
975 build_by_default : program_tests)
978 opt = not get_option('build-last').disabled()
982 include_directories : includes,
983 link_with : [lib_common],
984 install_dir : usrbin_exec_dir,
986 build_by_default : opt)
987 if opt and not is_disabler(exe)
989 meson.add_install_script(meson_make_symlink,
991 join_paths(usrbin_exec_dir, 'lastb'))
992 manadocs += ['login-utils/last.1.adoc']
993 manlinks += {'lastb.1': 'last.1'}
994 bashcompletions += ['last']
995 bashcompletionslinks += {'lastb': 'last'}
998 opt = not get_option('build-nologin').disabled()
1001 'login-utils/nologin.c',
1002 include_directories : includes,
1003 install_dir : sbindir,
1004 link_with : [lib_common],
1006 build_by_default : opt)
1007 if opt and not is_disabler(exe)
1009 manadocs += ['login-utils/nologin.8.adoc']
1012 opt = not get_option('build-utmpdump').disabled()
1015 'login-utils/utmpdump.c',
1016 include_directories : includes,
1017 link_with : [lib_common],
1018 install_dir : usrbin_exec_dir,
1020 build_by_default : opt)
1021 if opt and not is_disabler(exe)
1023 manadocs += ['login-utils/utmpdump.1.adoc']
1024 bashcompletions += ['utmpdump']
1027 opt = not get_option('build-su').disabled()
1031 'login-utils/su-common.c',
1032 'login-utils/su-common.h',
1036 include_directories : includes,
1037 link_with : [lib_common, logindefs_c],
1038 dependencies : [lib_pam,
1042 install_mode : 'rwsr-xr-x',
1044 build_by_default : opt)
1045 if opt and not is_disabler(exe)
1047 manadocs += ['login-utils/su.1.adoc']
1048 bashcompletions += ['su']
1051 opt = not get_option('build-newgrp').disabled()
1054 'login-utils/newgrp.c',
1055 include_directories : includes,
1056 dependencies : [lib_crypt],
1057 install_dir : usrbin_exec_dir,
1058 install_mode : 'rwsr-xr-x',
1060 build_by_default : opt)
1061 if opt and not is_disabler(exe)
1063 manadocs += ['login-utils/newgrp.1.adoc']
1064 bashcompletions += ['newgrp']
1067 opt = not get_option('build-lslogins').disabled()
1070 'login-utils/lslogins.c',
1071 include_directories : includes,
1072 link_with : [lib_common,
1075 dependencies : [lib_selinux,
1077 install_dir : usrbin_exec_dir,
1079 build_by_default : opt)
1080 if opt and not is_disabler(exe)
1082 manadocs += ['login-utils/lslogins.1.adoc']
1083 bashcompletions += ['lslogins']
1086 opt = not get_option('build-vipw').disabled()
1089 'login-utils/vipw.c',
1090 'login-utils/setpwnam.h',
1091 include_directories : includes,
1092 link_with : [lib_common],
1093 dependencies : [lib_selinux],
1094 install_dir : usrbin_exec_dir,
1096 build_by_default : opt)
1097 if opt and not is_disabler(exe)
1099 meson.add_install_script(meson_make_symlink,
1101 join_paths(usrbin_exec_dir, 'vigr'))
1102 manadocs += ['login-utils/vipw.8.adoc']
1103 meson.add_install_script(meson_make_symlink,
1105 join_paths(mandir, 'man8/vigr.8'))
1108 opt = not get_option('build-runuser').disabled()
1111 'login-utils/runuser.c',
1112 'login-utils/su-common.c',
1113 'login-utils/su-common.h',
1117 include_directories : includes,
1118 link_with : [lib_common, logindefs_c],
1119 dependencies : [lib_pam,
1123 install_dir : sbindir,
1125 build_by_default : opt)
1126 if opt and not is_disabler(exe)
1128 manadocs += ['login-utils/runuser.1.adoc']
1129 bashcompletionslinks += {'runuser': 'su'}
1132 ############################################################
1138 include_directories : includes,
1139 link_with : lib_common,
1140 install_dir : usrbin_exec_dir,
1143 manadocs += ['text-utils/col.1.adoc']
1144 bashcompletions += ['col']
1150 include_directories : includes,
1151 install_dir : usrbin_exec_dir,
1154 manadocs += ['text-utils/colcrt.1.adoc']
1155 bashcompletions += ['colcrt']
1160 include_directories : includes,
1161 link_with : lib_common,
1162 install_dir : usrbin_exec_dir,
1165 manadocs += ['text-utils/colrm.1.adoc']
1166 bashcompletions += ['colrm']
1171 include_directories : includes,
1172 install_dir : usrbin_exec_dir,
1175 manadocs += ['text-utils/rev.1.adoc']
1176 bashcompletions += ['rev']
1181 include_directories : includes,
1182 link_with : [lib_common,
1184 install_dir : usrbin_exec_dir,
1186 if not is_disabler(exe)
1188 manadocs += ['text-utils/column.1.adoc']
1189 bashcompletions += ['column']
1192 opt = not get_option('build-line').disabled()
1196 include_directories : includes,
1197 install_dir : usrbin_exec_dir,
1199 build_by_default : opt)
1200 if opt and not is_disabler(exe)
1202 manadocs += ['text-utils/line.1.adoc']
1205 opt = not get_option('build-pg').disabled()
1209 link_with : lib_common,
1210 include_directories : includes,
1211 dependencies : [lib_tinfo,
1213 install_dir : usrbin_exec_dir,
1215 build_by_default : opt)
1216 if opt and not is_disabler(exe)
1218 manadocs += ['text-utils/pg.1.adoc']
1219 bashcompletions += ['pg']
1222 opt = not get_option('build-ul').disabled()
1226 include_directories : includes,
1227 dependencies : [lib_tinfo,
1229 install_dir : usrbin_exec_dir,
1231 build_by_default : opt)
1232 if opt and not is_disabler(exe)
1234 manadocs += ['text-utils/ul.1.adoc']
1235 bashcompletions += ['ul']
1238 opt = not get_option('build-more').disabled()
1242 link_with : [lib_common],
1243 include_directories : includes,
1244 dependencies : [lib_tinfo,
1248 build_by_default : opt)
1252 link_with : [lib_common],
1253 include_directories : includes,
1254 c_args : '-DTEST_PROGRAM',
1255 dependencies : [lib_tinfo,
1258 build_by_default : opt and program_tests)
1260 if opt and not is_disabler(exe)
1262 manadocs += ['text-utils/more.1.adoc']
1263 bashcompletions += ['more']
1269 include_directories : includes,
1270 link_with : [lib_common,
1272 install_dir : usrbin_exec_dir,
1274 if not is_disabler(exe)
1276 manadocs += ['text-utils/hexdump.1.adoc']
1277 bashcompletions += ['hexdump']
1280 opt = not get_option('build-lsmem').disabled()
1284 include_directories : includes,
1285 link_with : [lib_common,
1287 install_dir : usrbin_exec_dir,
1289 build_by_default : opt)
1290 if opt and not is_disabler(exe)
1292 manadocs += ['sys-utils/lsmem.1.adoc']
1293 bashcompletions += ['lsmem']
1296 opt = not get_option('build-chmem').disabled()
1300 include_directories : includes,
1301 link_with : [lib_common],
1302 install_dir : usrbin_exec_dir,
1304 build_by_default : opt)
1305 if opt and not is_disabler(exe)
1307 manadocs += ['sys-utils/chmem.8.adoc']
1308 bashcompletions += ['chmem']
1314 include_directories : includes,
1315 link_with : [lib_common],
1316 install_dir : usrbin_exec_dir,
1319 manadocs += ['sys-utils/choom.1.adoc']
1324 include_directories : includes,
1325 link_with : [lib_common],
1326 install_dir : usrbin_exec_dir,
1329 manadocs += ['sys-utils/ipcmk.1.adoc']
1330 bashcompletions += ['ipcmk']
1335 include_directories : includes,
1336 link_with : [lib_common],
1337 install_dir : usrbin_exec_dir,
1340 manadocs += ['sys-utils/ipcrm.1.adoc']
1341 bashcompletions += ['ipcrm']
1343 opt = not get_option('build-ipcs').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/ipcs.1.adoc']
1355 bashcompletions += ['ipcs']
1358 opt = not get_option('build-rfkill').disabled()
1362 include_directories : includes,
1363 link_with : [lib_common,
1365 install_dir : usrsbin_exec_dir,
1367 build_by_default : opt)
1368 if opt and not is_disabler(exe)
1370 manadocs += ['sys-utils/rfkill.8.adoc']
1371 bashcompletions += ['rfkill']
1377 include_directories : includes,
1378 link_with : [lib_common,
1380 install_dir : usrbin_exec_dir,
1382 if not is_disabler(exe)
1384 manadocs += ['sys-utils/renice.1.adoc']
1385 bashcompletions += ['renice']
1391 include_directories: includes,
1392 link_with : [lib_common,
1394 install_dir : usrbin_exec_dir,
1396 if opt and not is_disabler(exe)
1398 manadocs += ['sys-utils/setpgid.1.adoc']
1399 bashcompletions += ['setpgid']
1405 include_directories : includes,
1406 link_with : [lib_common,
1408 install_dir : usrbin_exec_dir,
1410 if opt and not is_disabler(exe)
1412 manadocs += ['sys-utils/setsid.1.adoc']
1413 bashcompletions += ['setsid']
1418 readprofile_sources,
1419 include_directories : includes,
1420 link_with : [lib_common,
1422 install_dir : usrsbin_exec_dir,
1424 if not is_disabler(exe)
1426 manadocs += ['sys-utils/readprofile.8.adoc']
1427 bashcompletions += ['readprofile']
1430 opt = not get_option('build-tunelp').disabled()
1434 include_directories : includes,
1435 link_with : [lib_common],
1436 install_dir : usrsbin_exec_dir,
1438 build_by_default : opt)
1439 if opt and not is_disabler(exe)
1441 manadocs += ['sys-utils/tunelp.8.adoc']
1442 bashcompletions += ['tunelp']
1448 include_directories : includes,
1449 link_with : [lib_common,
1451 install_dir : sbindir,
1453 if not is_disabler(exe)
1455 manadocs += ['sys-utils/fstrim.8.adoc']
1456 bashcompletions += ['fstrim']
1462 include_directories : includes,
1463 link_with : [lib_common,
1466 if not is_disabler(exe)
1468 manadocs += ['sys-utils/dmesg.1.adoc']
1469 bashcompletions += ['dmesg']
1475 include_directories : dir_include,
1476 c_args : '-DTEST_DMESG',
1477 link_with : [lib_common,
1479 build_by_default : program_tests)
1480 if not is_disabler(exe)
1487 include_directories : includes,
1488 link_with : [lib_common],
1489 install_dir : sbindir,
1492 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1493 bashcompletions += ['ctrlaltdel']
1498 include_directories : includes,
1499 install_dir : sbindir,
1502 manadocs += ['sys-utils/fsfreeze.8.adoc']
1503 bashcompletions += ['fsfreeze']
1508 include_directories : includes,
1509 link_with : [lib_common,
1511 install_dir : sbindir,
1514 manadocs += ['sys-utils/blkdiscard.8.adoc']
1515 bashcompletions += ['blkdiscard']
1520 include_directories : includes,
1521 link_with : [lib_common],
1522 install_dir : sbindir,
1525 manadocs += ['sys-utils/blkzone.8.adoc']
1526 bashcompletions += ['blkzone']
1531 include_directories : includes,
1532 link_with : [lib_common],
1533 install_dir : sbindir,
1536 manadocs += ['sys-utils/blkpr.8.adoc']
1541 include_directories : includes,
1542 link_with : [lib_common],
1543 install_dir : usrsbin_exec_dir,
1546 manadocs += ['sys-utils/ldattach.8.adoc']
1547 bashcompletions += ['ldattach']
1552 include_directories : includes,
1553 link_with : [lib_common],
1554 install_dir : usrsbin_exec_dir,
1557 manadocs += ['sys-utils/rtcwake.8.adoc']
1558 bashcompletions += ['rtcwake']
1563 include_directories : includes,
1564 link_with : [lib_common],
1565 install_dir : usrbin_exec_dir,
1568 manadocs += ['sys-utils/setarch.8.adoc']
1569 bashcompletions += ['setarch']
1571 setarch_links = ['uname26', 'linux32', 'linux64']
1572 setarch_links_arch = {
1573 's390x' : ['s390', 's390x'],
1575 'x86_64' : ['i386', 'x86_64'],
1576 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1577 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1578 'mips64' : ['mips', 'mips64', 'mips32'],
1579 'ia64' : ['i386', 'ia64'],
1580 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1582 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1584 foreach link: setarch_links
1585 meson.add_install_script(meson_make_symlink,
1587 join_paths(usrbin_exec_dir, link))
1588 manlinks += {link + '.8': 'setarch.8'}
1591 opt = not get_option('build-eject').disabled()
1595 include_directories : includes,
1596 link_with : [lib_common,
1598 install_dir : usrbin_exec_dir,
1600 build_by_default : opt)
1601 if opt and not is_disabler(exe)
1603 manadocs += ['sys-utils/eject.1.adoc']
1604 bashcompletions += ['eject']
1607 opt = not get_option('build-losetup').disabled()
1611 include_directories : includes,
1612 link_with : [lib_common,
1614 install_dir : sbindir,
1616 build_by_default : opt)
1617 if opt and not is_disabler(exe)
1618 manadocs += ['sys-utils/losetup.8.adoc']
1620 bashcompletions += ['losetup']
1623 opt = opt and 'losetup' in static_programs
1627 include_directories : includes,
1628 link_args : ['--static'],
1629 link_with : [lib_common,
1630 lib_smartcols.get_static_lib()],
1631 install_dir : sbindir,
1633 build_by_default : opt)
1634 if opt and not is_disabler(exe)
1638 opt = not get_option('build-zramctl').disabled()
1642 include_directories : includes,
1643 link_with : [lib_common,
1645 install_dir : sbindir,
1647 build_by_default : opt)
1648 if opt and not is_disabler(exe)
1650 manadocs += ['sys-utils/zramctl.8.adoc']
1651 bashcompletions += ['zramctl']
1657 include_directories : includes,
1658 link_with : [lib_common,
1660 install_dir : usrbin_exec_dir,
1662 if not is_disabler(exe)
1664 manadocs += ['sys-utils/prlimit.1.adoc']
1665 bashcompletions += ['prlimit']
1671 include_directories : includes,
1672 link_with : [lib_common,
1675 install_dir : usrbin_exec_dir,
1677 if not is_disabler(exe)
1679 manadocs += ['sys-utils/lsns.8.adoc']
1680 bashcompletions += ['lsns']
1683 opt = not get_option('build-mount').disabled()
1687 include_directories : includes,
1688 link_with : [lib_common,
1691 dependencies : lib_selinux,
1692 install_mode : 'rwsr-xr-x',
1694 build_by_default : opt)
1698 include_directories : includes,
1699 link_with : [lib_common,
1701 install_mode : 'rwsr-xr-x',
1703 build_by_default : opt)
1704 if opt and not is_disabler(exe)
1706 manadocs += ['sys-utils/fstab.5.adoc',
1707 'sys-utils/mount.8.adoc',
1708 'sys-utils/umount.8.adoc']
1709 bashcompletions += ['mount', 'umount']
1712 opt2 = opt and 'mount' in static_programs
1716 include_directories : includes,
1717 link_args : ['--static'],
1718 link_with : [lib_common,
1719 lib_smartcols_static,
1722 build_by_default : opt2)
1723 if opt2 and not is_disabler(exe)
1727 opt2 = opt and 'umount' in static_programs
1731 include_directories : includes,
1732 link_args : ['--static'],
1733 link_with : [lib_common,
1736 build_by_default : opt2)
1737 if opt2 and not is_disabler(exe)
1746 include_directories : includes,
1747 link_with : [lib_common,
1751 install_dir : sbindir,
1753 if not is_disabler(exe)
1755 manadocs += ['sys-utils/swapon.8.adoc']
1756 bashcompletions += ['swapon']
1762 include_directories : includes,
1763 link_with : [lib_common,
1766 install_dir : sbindir,
1768 if not is_disabler(exe)
1770 manlinks += {'swapoff.8': 'swapon.8'}
1771 bashcompletions += ['swapoff']
1777 include_directories : includes,
1778 link_with : [lib_common,
1780 dependencies : [rtas_libs],
1781 install_dir : usrbin_exec_dir,
1783 if not is_disabler(exe)
1785 manadocs += ['sys-utils/lscpu.1.adoc']
1786 bashcompletions += ['lscpu']
1792 include_directories : includes,
1793 link_with : [lib_common],
1794 install_dir : sbindir,
1797 manadocs += ['sys-utils/chcpu.8.adoc']
1798 bashcompletions += ['chcpu']
1803 include_directories : includes,
1804 link_with : [lib_common,
1807 if not is_disabler(exe)
1809 manadocs += ['sys-utils/wdctl.8.adoc']
1810 bashcompletions += ['wdctl']
1813 opt = not get_option('build-mountpoint').disabled()
1817 include_directories : includes,
1818 link_with : [lib_mount],
1820 build_by_default : opt)
1821 if opt and not is_disabler(exe)
1823 manadocs += ['sys-utils/mountpoint.1.adoc']
1824 bashcompletions += ['mountpoint']
1827 opt = not get_option('build-fallocate').disabled()
1831 include_directories : includes,
1832 link_with : [lib_common],
1833 install_dir : usrbin_exec_dir,
1835 build_by_default : opt)
1836 if opt and not is_disabler(exe)
1838 manadocs += ['sys-utils/fallocate.1.adoc']
1839 bashcompletions += ['fallocate']
1842 opt = not get_option('build-pivot_root').disabled()
1846 include_directories : includes,
1847 install_dir : sbindir,
1849 build_by_default : opt)
1850 if opt and not is_disabler(exe)
1852 manadocs += ['sys-utils/pivot_root.8.adoc']
1853 bashcompletions += ['pivot_root']
1856 opt = not get_option('build-switch_root').disabled()
1857 if opt and not have_dirfd and not have_ddfd
1858 error('neither dirfd nor ddfd are available')
1862 switch_root_sources,
1863 include_directories : includes,
1864 install_dir : sbindir,
1866 build_by_default : opt)
1867 if opt and not is_disabler(exe)
1869 manadocs += ['sys-utils/switch_root.8.adoc']
1872 opt = not get_option('build-unshare').disabled()
1876 include_directories : includes,
1877 link_with : [lib_common],
1878 install_dir : usrbin_exec_dir,
1880 build_by_default : opt)
1881 if opt and not is_disabler(exe)
1883 manadocs += ['sys-utils/unshare.1.adoc']
1884 bashcompletions += ['unshare']
1887 opt = opt and 'unshare' in static_programs
1891 include_directories : includes,
1892 link_with : [lib_common],
1893 install_dir : usrbin_exec_dir,
1895 build_by_default : opt)
1896 if opt and not is_disabler(exe)
1900 opt = not get_option('build-nsenter').disabled()
1904 include_directories : includes,
1905 link_with : [lib_common],
1906 dependencies : [lib_selinux],
1907 install_dir : usrbin_exec_dir,
1909 build_by_default : opt)
1910 if opt and not is_disabler(exe)
1912 manadocs += ['sys-utils/nsenter.1.adoc']
1913 bashcompletions += ['nsenter']
1916 opt = opt and 'nsenter' in static_programs
1920 include_directories : includes,
1921 link_with : [lib_common],
1922 dependencies : [lib_selinux],
1923 install_dir : usrbin_exec_dir,
1925 build_by_default : opt)
1926 if opt and not is_disabler(exe)
1930 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1934 include_directories : includes,
1935 link_with : [lib_common],
1936 dependencies : [lib_cap_ng],
1937 install_dir : usrbin_exec_dir,
1939 build_by_default : opt)
1940 if opt and not is_disabler(exe)
1942 manadocs += ['sys-utils/setpriv.1.adoc']
1943 bashcompletions += ['setpriv']
1949 include_directories : includes,
1950 link_with : [lib_common],
1951 dependencies : realtime_libs,
1952 install_dir : usrbin_exec_dir,
1955 manadocs += ['sys-utils/flock.1.adoc']
1956 bashcompletions += ['flock']
1958 opt = not get_option('build-lsirq').disabled()
1962 include_directories : includes,
1963 link_with : [lib_common,
1965 install_dir : usrbin_exec_dir,
1967 build_by_default : opt)
1968 if opt and not is_disabler(exe)
1970 manadocs += ['sys-utils/lsirq.1.adoc']
1971 bashcompletions += ['lsirq']
1974 opt = not get_option('build-irqtop').disabled()
1978 include_directories : includes,
1979 dependencies : [realtime_libs, curses_libs],
1980 link_with : [lib_common,
1983 install_dir : usrbin_exec_dir,
1985 build_by_default : opt)
1986 if opt and not is_disabler(exe)
1988 manadocs += ['sys-utils/irqtop.1.adoc']
1989 bashcompletions += ['irqtop']
1992 opt = not get_option('build-ipcs').disabled()
1996 include_directories : includes,
1997 link_with : [lib_common,
1999 install_dir : usrbin_exec_dir,
2001 build_by_default : opt)
2002 if opt and not is_disabler(exe)
2004 manadocs += ['sys-utils/lsipc.1.adoc']
2005 bashcompletions += ['lsipc']
2012 include_directories : includes,
2013 link_with : [lib_common],
2014 dependencies : [lib_m,
2016 install_dir : sbindir,
2018 build_by_default : opt)
2019 if opt and not is_disabler(exe)
2021 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
2022 bashcompletions += ['hwclock']
2028 include_directories : includes,
2029 install_dir : sbindir,
2032 manadocs += ['disk-utils/mkfs.8.adoc']
2033 bashcompletions += ['mkfs']
2035 opt = not get_option('build-bfs').disabled()
2039 include_directories : includes,
2040 link_with : [lib_common],
2041 install_dir : sbindir,
2043 build_by_default : opt)
2044 if opt and not is_disabler(exe)
2046 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
2047 bashcompletions += ['mkfs.bfs']
2053 include_directories : includes,
2054 link_with : [lib_common],
2055 install_dir : usrbin_exec_dir,
2058 manadocs += ['disk-utils/isosize.8.adoc']
2059 bashcompletions += ['isosize']
2064 include_directories : includes,
2065 link_with : [lib_common,
2068 dependencies: [lib_selinux],
2069 install_dir : sbindir,
2071 if opt and not is_disabler(exe)
2073 manadocs += ['disk-utils/mkswap.8.adoc']
2074 bashcompletions += ['mkswap']
2080 include_directories : includes,
2081 link_with : [lib_common,
2084 install_dir : sbindir,
2086 if opt and not is_disabler(exe)
2088 manadocs += ['disk-utils/swaplabel.8.adoc']
2089 bashcompletions += ['swaplabel']
2092 opt = not get_option('build-fsck').disabled()
2096 include_directories : includes,
2097 link_with : [lib_common,
2100 dependencies : realtime_libs,
2101 install_dir : sbindir,
2103 build_by_default : opt)
2104 if opt and not is_disabler(exe)
2106 manadocs += ['disk-utils/fsck.8.adoc']
2107 bashcompletions += ['fsck']
2110 opt = not get_option('build-minix').disabled()
2114 include_directories : includes,
2115 link_with : [lib_common],
2116 install_dir : sbindir,
2118 build_by_default : opt)
2122 include_directories : includes,
2123 c_args : '-DTEST_SCRIPT',
2124 link_with : [lib_common],
2125 build_by_default : opt and program_tests)
2129 include_directories : includes,
2130 link_with : [lib_common],
2131 install_dir : sbindir,
2133 build_by_default : opt)
2134 if opt and not is_disabler(exe)
2135 exes += [exe, exe2, exe3]
2136 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2137 bashcompletions += ['mkfs.minix', 'fsck.minix']
2140 opt = not get_option('build-cramfs').disabled()
2143 mkfs_cramfs_sources,
2144 include_directories : includes,
2145 link_with : [lib_common],
2146 dependencies : [lib_z],
2147 install_dir : sbindir,
2149 build_by_default : opt)
2152 fsck_cramfs_sources,
2153 include_directories : includes,
2154 link_with : [lib_common],
2155 dependencies : [lib_z],
2156 install_dir : sbindir,
2158 build_by_default : opt)
2159 if not is_disabler(exe)
2161 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2162 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2165 opt = not get_option('build-raw').disabled()
2167 cc.has_header('linux/raw.h', required: opt)
2172 include_directories : includes,
2173 install_dir : sbindir,
2175 build_by_default : opt)
2176 if opt and not is_disabler(exe)
2178 manadocs += ['disk-utils/raw.8.adoc']
2179 bashcompletions += ['raw']
2182 opt = not get_option('build-fdformat').disabled()
2186 include_directories : includes,
2187 link_with : [lib_common],
2188 install_dir : usrsbin_exec_dir,
2190 build_by_default : opt)
2191 if opt and not is_disabler(exe)
2193 manadocs += ['disk-utils/fdformat.8.adoc']
2199 include_directories : includes,
2200 link_with : [lib_common],
2201 install_dir : sbindir,
2203 manadocs += ['disk-utils/blockdev.8.adoc']
2204 bashcompletions += ['blockdev']
2206 opt = not get_option('build-fdisks').disabled()
2207 if opt and not have_dirfd and not have_ddfd
2208 error('neither dirfd nor ddfd are available')
2213 include_directories : includes,
2214 link_with : [lib_common,
2218 dependencies : [lib_readline],
2219 install_dir : sbindir,
2221 build_by_default : opt)
2222 if opt and not is_disabler(exe)
2224 bashcompletions += ['fdisk']
2227 opt2 = opt and 'fdisk' in static_programs
2231 link_args : ['--static'],
2232 include_directories : includes,
2233 link_with : [lib_common,
2236 lib_smartcols.get_static_lib()],
2237 dependencies : [lib_readline_static],
2238 install_dir : sbindir,
2240 build_by_default : opt2)
2241 if opt2 and not is_disabler(exe)
2248 include_directories : includes,
2249 link_with : [lib_common,
2253 dependencies : [lib_readline],
2254 install_dir : sbindir,
2256 build_by_default : opt)
2257 if opt and not is_disabler(exe)
2259 bashcompletions += ['sfdisk']
2262 opt2 = opt and 'sfdisk' in static_programs
2266 include_directories : includes,
2267 link_with : [lib_common,
2270 lib_smartcols.get_static_lib()],
2271 dependencies : [lib_readline_static],
2272 install_dir : sbindir,
2274 build_by_default : opt2)
2275 if opt2 and not is_disabler(exe)
2282 include_directories : includes,
2283 link_with : [lib_common,
2288 dependencies : [curses_libs],
2289 install_dir : sbindir,
2291 build_by_default : opt)
2292 if opt and not is_disabler(exe)
2294 manadocs += ['disk-utils/fdisk.8.adoc',
2295 'disk-utils/sfdisk.8.adoc',
2296 'disk-utils/cfdisk.8.adoc']
2297 bashcompletions += ['cfdisk']
2300 opt = not get_option('build-partx').disabled()
2304 include_directories : includes,
2305 link_with : [lib_common],
2306 install_dir : usrsbin_exec_dir,
2308 build_by_default : opt)
2312 include_directories : includes,
2313 link_with : [lib_common],
2314 install_dir : usrsbin_exec_dir,
2316 build_by_default : opt)
2320 include_directories : includes,
2321 link_with : [lib_common],
2322 install_dir : usrsbin_exec_dir,
2324 build_by_default : opt)
2328 include_directories : includes,
2329 link_with : [lib_common,
2332 install_dir : usrsbin_exec_dir,
2334 build_by_default : opt)
2336 exes += [exe, exe2, exe3, exe4]
2337 manadocs += ['disk-utils/addpart.8.adoc',
2338 'disk-utils/delpart.8.adoc',
2339 'disk-utils/resizepart.8.adoc',
2340 'disk-utils/partx.8.adoc']
2341 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2344 ############################################################
2349 include_directories : includes,
2350 link_with : [lib_common],
2351 dependencies : [lib_util,
2355 install_dir : usrbin_exec_dir,
2358 manadocs += ['term-utils/script.1.adoc']
2359 bashcompletions += ['script']
2364 include_directories : includes,
2365 c_args : '-DTEST_SCRIPT',
2366 link_with : [lib_common],
2367 dependencies : [lib_util,
2371 build_by_default : program_tests)
2377 include_directories : includes,
2378 link_with : [lib_common],
2379 dependencies : [lib_util,
2382 install_dir : usrbin_exec_dir,
2385 manadocs += ['term-utils/scriptlive.1.adoc']
2386 bashcompletions += ['scriptlive']
2390 scriptreplay_sources,
2391 include_directories : includes,
2392 link_with : [lib_common],
2393 dependencies : [math_libs],
2394 install_dir : usrbin_exec_dir,
2397 manadocs += ['term-utils/scriptreplay.1.adoc']
2398 bashcompletions += ['scriptreplay']
2400 opt = not get_option('build-agetty').disabled()
2404 include_directories : includes,
2405 link_with : [lib_common, logindefs_c],
2406 dependencies : [BSD ? lib_util : [], lib_systemd],
2407 install_dir : sbindir,
2409 build_by_default : opt)
2412 manadocs += ['term-utils/agetty.8.adoc']
2415 opt = not get_option('build-setterm').disabled()
2419 include_directories : includes,
2420 link_with : [lib_common],
2421 dependencies : [curses_libs],
2422 install_dir : usrbin_exec_dir,
2424 build_by_default : opt)
2427 manadocs += ['term-utils/setterm.1.adoc']
2428 bashcompletions += ['setterm']
2431 opt = not get_option('build-mesg').disabled()
2435 include_directories : includes,
2436 link_with : [lib_common],
2437 install_dir : usrbin_exec_dir,
2439 build_by_default : opt)
2442 manadocs += ['term-utils/mesg.1.adoc']
2443 bashcompletions += ['mesg']
2446 opt = not get_option('build-wall').disabled()
2450 include_directories : includes,
2451 link_with : [lib_common],
2452 dependencies : [lib_systemd],
2453 install_dir : usrbin_exec_dir,
2454 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2456 build_by_default : opt)
2459 manadocs += ['term-utils/wall.1.adoc']
2460 bashcompletions += ['wall']
2463 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2464 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2466 opt = not get_option('build-write').disabled()
2470 include_directories : includes,
2471 link_with : [lib_common],
2472 dependencies : [lib_systemd],
2473 install_dir : usrbin_exec_dir,
2474 install_mode : [ 'rwxr-sr-x', 'root', 'tty' ],
2476 build_by_default : opt)
2479 manadocs += ['term-utils/write.1.adoc']
2480 bashcompletions += ['write']
2483 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2484 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2486 opt = not get_option('build-login').disabled()
2490 include_directories : includes,
2491 link_with : [lib_common, logindefs_c],
2492 dependencies : [lib_pam,
2496 build_by_default : opt)
2497 if not is_disabler(exe)
2499 manadocs += ['login-utils/login.1.adoc']
2502 opt = not get_option('build-sulogin').disabled()
2506 include_directories : includes,
2507 link_with : [lib_common],
2508 dependencies : [lib_crypt,
2510 install_dir : sbindir,
2512 build_by_default : opt)
2513 if not is_disabler(exe)
2515 manadocs += ['login-utils/sulogin.8.adoc']
2521 include_directories : includes,
2522 link_with : [lib_common,
2524 dependencies : [curses_libs],
2525 install_dir : usrbin_exec_dir,
2528 manadocs += ['misc-utils/cal.1.adoc']
2529 bashcompletions += ['cal']
2531 opt = not get_option('build-logger').disabled()
2535 include_directories : includes,
2536 link_with : [lib_common],
2537 dependencies : [lib_systemd],
2538 install_dir : usrbin_exec_dir,
2540 build_by_default : opt)
2541 if opt and not is_disabler(exe)
2543 manadocs += ['misc-utils/logger.1.adoc']
2544 bashcompletions += ['logger']
2550 include_directories : includes,
2551 c_args : '-DTEST_LOGGER',
2552 link_with : [lib_common],
2553 dependencies : [lib_systemd],
2554 build_by_default: program_tests)
2555 if not is_disabler(exe)
2562 include_directories : includes,
2563 install_dir : usrbin_exec_dir,
2566 manadocs += ['misc-utils/look.1.adoc']
2567 bashcompletions += ['look']
2572 include_directories : includes,
2573 link_with : [lib_common],
2574 install_dir : usrbin_exec_dir,
2577 manadocs += ['misc-utils/mcookie.1.adoc']
2578 bashcompletions += ['mcookie']
2583 include_directories : includes,
2584 dependencies : [lib_selinux],
2585 install_dir : usrbin_exec_dir,
2588 manadocs += ['misc-utils/namei.1.adoc']
2589 bashcompletions += ['namei']
2594 include_directories : includes,
2595 link_with : [lib_common],
2596 install_dir : usrbin_exec_dir,
2599 manadocs += ['misc-utils/whereis.1.adoc']
2600 bashcompletions += ['whereis']
2605 include_directories : includes,
2606 link_with : [lib_common,
2609 install_dir : usrbin_exec_dir,
2611 if not is_disabler(exe)
2613 manadocs += ['misc-utils/lslocks.8.adoc']
2614 bashcompletions += ['lslocks']
2620 include_directories : includes,
2621 link_with : [lib_common,
2626 dependencies : lib_udev,
2628 if not is_disabler(exe)
2630 manadocs += ['misc-utils/lsblk.8.adoc']
2631 bashcompletions += ['lsblk']
2635 mq_libs += cc.find_library('rt', required : true)
2640 include_directories : includes,
2641 link_with : [lib_common,
2643 dependencies : mq_libs,
2644 install_dir : usrbin_exec_dir,
2646 if not is_disabler(exe)
2648 manadocs += ['misc-utils/lsfd.1.adoc']
2654 include_directories : includes,
2655 link_with : [lib_common,
2657 install_dir : usrbin_exec_dir,
2659 if not is_disabler(exe)
2661 manadocs += ['misc-utils/uuidgen.1.adoc']
2662 bashcompletions += ['uuidgen']
2668 include_directories : includes,
2669 link_with : [lib_common,
2672 install_dir : usrbin_exec_dir,
2674 if not is_disabler(exe)
2676 manadocs += ['misc-utils/uuidparse.1.adoc']
2677 bashcompletions += ['uuidparse']
2684 include_directories : includes,
2685 link_with : [lib_common,
2687 dependencies : [realtime_libs,
2689 install_dir : usrsbin_exec_dir,
2691 build_by_default : opt)
2695 include_directories : includes,
2696 link_with : [lib_common,
2698 dependencies : thread_libs,
2699 build_by_default : opt and program_tests)
2700 if not is_disabler(exe)
2702 manadocs += ['misc-utils/uuidd.8.adoc']
2703 bashcompletions += ['uuidd']
2706 opt = build_libblkid
2710 include_directories : includes,
2711 link_with : [lib_common,
2713 install_dir : sbindir,
2715 build_by_default : opt)
2716 if opt and not is_disabler(exe)
2718 manadocs += ['misc-utils/blkid.8.adoc']
2719 bashcompletions += ['blkid']
2722 opt = opt and 'blkid' in static_programs
2726 include_directories : includes,
2727 link_with : [lib_common,
2729 install_dir : sbindir,
2731 build_by_default : opt)
2732 if opt and not is_disabler(exe)
2738 'libblkid/samples/mkfs.c',
2739 include_directories : includes,
2740 link_with : lib_blkid)
2741 if not is_disabler(exe)
2746 'sample-partitions',
2747 'libblkid/samples/partitions.c',
2748 include_directories : includes,
2749 link_with : lib_blkid)
2750 if not is_disabler(exe)
2755 'sample-superblocks',
2756 'libblkid/samples/superblocks.c',
2757 include_directories : includes,
2758 link_with : lib_blkid)
2759 if not is_disabler(exe)
2765 'libblkid/samples/topology.c',
2766 include_directories : includes,
2767 link_with : lib_blkid)
2768 if not is_disabler(exe)
2773 'test_blkid_fuzz_sample',
2774 'libblkid/src/fuzz.c',
2775 include_directories: includes,
2776 link_with: lib_blkid,
2777 build_by_default: program_tests)
2778 if not is_disabler(exe)
2782 ############################################################
2787 include_directories : includes,
2788 link_with : [lib_blkid],
2789 install_dir : sbindir,
2791 if not is_disabler(exe)
2793 manadocs += ['misc-utils/findfs.8.adoc']
2794 bashcompletions += ['findfs']
2800 include_directories : includes,
2801 link_with : [lib_common,
2804 install_dir : sbindir,
2806 if not is_disabler(exe)
2808 manadocs += ['misc-utils/wipefs.8.adoc']
2809 bashcompletions += ['wipefs']
2815 include_directories : includes,
2816 link_with : [lib_common,
2820 dependencies : [lib_udev],
2822 if not is_disabler(exe)
2824 manadocs += ['misc-utils/findmnt.8.adoc']
2825 bashcompletions += ['findmnt']
2831 include_directories : includes,
2832 link_with : [lib_common],
2834 if not is_disabler(exe)
2836 manadocs += ['misc-utils/kill.1.adoc']
2839 opt = not get_option('build-rename').disabled()
2843 include_directories : includes,
2844 install_dir : usrbin_exec_dir,
2846 build_by_default : opt)
2847 if opt and not is_disabler(exe)
2849 manadocs += ['misc-utils/rename.1.adoc']
2850 bashcompletions += ['rename']
2856 include_directories : includes,
2857 link_with : [lib_common],
2858 install_dir : usrbin_exec_dir,
2861 manadocs += ['misc-utils/getopt.1.adoc']
2862 bashcompletions += ['getopt']
2867 include_directories : includes,
2868 link_with : [lib_common,
2870 install_dir : usrbin_exec_dir,
2872 if not is_disabler(exe)
2874 manadocs += ['misc-utils/fincore.1.adoc']
2875 bashcompletions += ['fincore']
2881 include_directories : includes,
2882 link_with : [lib_common],
2883 install_dir : usrbin_exec_dir,
2885 if not is_disabler(exe)
2887 manadocs += ['misc-utils/hardlink.1.adoc']
2888 bashcompletions += ['hardlink']
2891 opt = not get_option('build-pipesz').disabled()
2895 include_directories : includes,
2896 link_with : [lib_common],
2897 install_dir : usrbin_exec_dir,
2899 if opt and not is_disabler(exe)
2901 manadocs += ['misc-utils/pipesz.1.adoc']
2902 bashcompletions += ['pipesz']
2908 include_directories : includes,
2909 c_args : '-DTEST_CAL',
2910 link_with : [lib_common,
2912 dependencies : [curses_libs],
2913 build_by_default: program_tests)
2914 if not is_disabler(exe)
2921 include_directories : includes,
2922 link_with : [lib_common],
2923 install_dir : usrbin_exec_dir,
2925 if not is_disabler(exe)
2927 manadocs += ['misc-utils/fadvise.1.adoc']
2928 bashcompletions += ['fadvise']
2931 if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1'
2935 include_directories : includes,
2936 link_with : [lib_common],
2937 install_dir : usrbin_exec_dir,
2939 if not is_disabler(exe)
2941 manadocs += ['misc-utils/waitpid.1.adoc']
2942 bashcompletions += ['waitpid']
2946 syscalls_h = custom_target('syscalls.h',
2947 input : 'tools/all_syscalls',
2948 output : 'syscalls.h',
2949 command : ['tools/all_syscalls', cc.cmd_array()]
2952 if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
2955 'misc-utils/enosys.c', syscalls_h,
2956 include_directories : includes,
2957 link_with : [lib_common],
2958 install_dir : usrbin_exec_dir,
2960 if not is_disabler(exe)
2962 manadocs += ['misc-utils/enosys.1.adoc']
2963 bashcompletions += ['enosys']
2970 include_directories : includes,
2971 link_with : [lib_common, lib_smartcols],
2972 install_dir : usrbin_exec_dir,
2974 if not is_disabler(exe)
2976 manadocs += ['misc-utils/lsclocks.1.adoc']
2977 bashcompletions += ['lsclocks']
2980 ############################################################
2982 opt = not get_option('build-schedutils').disabled()
2985 'schedutils/chrt.c',
2986 include_directories : includes,
2987 link_with : lib_common,
2988 install_dir : usrbin_exec_dir,
2990 build_by_default : opt)
2994 'schedutils/ionice.c',
2995 include_directories : includes,
2996 link_with : lib_common,
2997 install_dir : usrbin_exec_dir,
2999 build_by_default : opt)
3003 'schedutils/taskset.c',
3004 include_directories : includes,
3005 link_with : lib_common,
3006 install_dir : usrbin_exec_dir,
3008 build_by_default : opt)
3012 'schedutils/uclampset.c',
3013 include_directories : includes,
3014 link_with : lib_common,
3015 install_dir : usrbin_exec_dir,
3017 build_by_default : opt)
3019 if opt and not is_disabler(exe)
3020 exes += [exe, exe2, exe3, exe4]
3021 manadocs += ['schedutils/chrt.1.adoc',
3022 'schedutils/ionice.1.adoc',
3023 'schedutils/taskset.1.adoc',
3024 'schedutils/uclampset.1.adoc']
3025 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
3028 ############################################################
3030 # TODO: when autotools compat is not needed, s/_/-/g in file names?
3035 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
3036 include_directories : dir_include,
3037 link_with : lib_common,
3038 build_by_default: program_tests)
3044 c_args : ['-DTEST_PROGRAM_BLKDEV'],
3045 include_directories : dir_include,
3046 link_with : lib_common,
3047 build_by_default: program_tests)
3053 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
3054 include_directories : dir_include,
3055 link_with : lib_common,
3056 build_by_default: program_tests)
3062 c_args : ['-DTEST_PROGRAM_MANGLE'],
3063 include_directories : dir_include,
3064 build_by_default: program_tests)
3070 c_args : ['-DTEST_PROGRAM_STRUTILS'],
3071 include_directories : dir_include,
3072 build_by_default: program_tests)
3078 'lib/color-names.c',
3079 c_args : ['-DTEST_PROGRAM_COLORS'],
3080 include_directories : dir_include,
3081 link_with : [lib_common, lib_tcolors],
3082 build_by_default: program_tests)
3088 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
3089 include_directories : dir_include,
3090 build_by_default: program_tests)
3093 if conf.get('HAVE_OPENAT').to_string() == '1' \
3094 and conf.get('HAVE_DIRFD').to_string() == '1'
3098 c_args : ['-DTEST_PROGRAM_PROCFS'],
3099 include_directories : dir_include,
3100 link_with : lib_common,
3101 build_by_default: program_tests)
3108 have_cpu_set_t ? 'lib/cpuset.c' : [],
3109 c_args : ['-DTEST_PROGRAM_PATH'],
3110 include_directories : dir_include,
3111 link_with : lib_common,
3112 build_by_default: program_tests)
3116 if conf.get('HAVE_PTY').to_string() == '1'
3121 c_args : ['-DTEST_PROGRAM_PTY'],
3122 include_directories : dir_include,
3123 link_with : [lib_common],
3124 dependencies : [lib_m,
3127 build_by_default: program_tests)
3135 c_args : ['-DTEST_PROGRAM_CPUSET'],
3136 include_directories : dir_include,
3137 build_by_default: program_tests)
3148 have_cpu_set_t ? 'lib/cpuset.c' : [],
3149 c_args : ['-DTEST_PROGRAM_SYSFS'],
3150 include_directories : dir_include,
3151 build_by_default: program_tests)
3157 c_args : ['-DTEST_PROGRAM_PAGER'],
3158 include_directories : dir_include,
3159 build_by_default: program_tests)
3163 'test_linux_version',
3164 'lib/linux_version.c',
3165 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3166 include_directories : dir_include,
3167 build_by_default: program_tests)
3173 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3174 include_directories : dir_include,
3175 build_by_default: program_tests)
3179 'test_canonicalize',
3180 'lib/canonicalize.c',
3181 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3182 include_directories : dir_include,
3183 build_by_default: program_tests)
3190 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3191 include_directories : dir_include,
3192 build_by_default: program_tests)
3198 c_args : ['-DTEST_PROGRAM'],
3199 include_directories : dir_include,
3200 link_with : lib_common,
3201 build_by_default: program_tests)
3207 c_args : ['-DTEST_PROGRAM'],
3208 include_directories : dir_include,
3209 link_with : [lib_common, logindefs_c],
3210 build_by_default: program_tests)
3214 ############################################################
3218 'libuuid/src/test_uuid.c',
3219 include_directories : [dir_include, dir_libuuid],
3220 link_with : lib_uuid,
3221 dependencies : socket_libs,
3222 build_by_default: program_tests)
3223 if not is_disabler(exe)
3227 ############################################################
3229 libfdisk_tests_cflags = ['-DTEST_PROGRAM']
3230 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3234 'libfdisk/src/ask.c',
3235 c_args : libfdisk_tests_cflags,
3236 include_directories : lib_fdisk_includes,
3237 link_with : libfdisk_tests_ldadd,
3238 build_by_default: program_tests)
3239 if not is_disabler(exe)
3245 'libfdisk/src/gpt.c',
3246 c_args : libfdisk_tests_cflags,
3247 include_directories : lib_fdisk_includes,
3248 link_with : libfdisk_tests_ldadd,
3249 build_by_default: program_tests)
3250 if not is_disabler(exe)
3256 'libfdisk/src/utils.c',
3257 c_args : libfdisk_tests_cflags,
3258 include_directories : lib_fdisk_includes,
3259 link_with : libfdisk_tests_ldadd,
3260 build_by_default: program_tests)
3261 if not is_disabler(exe)
3266 'test_fdisk_script',
3267 'libfdisk/src/script.c',
3268 c_args : libfdisk_tests_cflags,
3269 include_directories : lib_fdisk_includes,
3270 link_with : libfdisk_tests_ldadd,
3271 build_by_default: program_tests)
3272 if not is_disabler(exe)
3277 'test_fdisk_version',
3278 'libfdisk/src/version.c',
3279 c_args : libfdisk_tests_cflags,
3280 include_directories : lib_fdisk_includes,
3281 link_with : libfdisk_tests_ldadd,
3282 build_by_default: program_tests)
3283 if not is_disabler(exe)
3289 'libfdisk/src/item.c',
3290 c_args : libfdisk_tests_cflags,
3291 include_directories : lib_fdisk_includes,
3292 link_with : libfdisk_tests_ldadd,
3293 build_by_default: program_tests)
3294 if not is_disabler(exe)
3298 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3301 'sample-fdisk-mkpart',
3302 'libfdisk/samples/mkpart.c',
3303 include_directories : lib_fdisk_includes,
3304 link_with : sample_fdisk_ldadd)
3305 if not is_disabler(exe)
3310 'sample-fdisk-mkpart-fullspec',
3311 'libfdisk/samples/mkpart-fullspec.c',
3312 include_directories : lib_fdisk_includes,
3313 link_with : sample_fdisk_ldadd)
3314 if not is_disabler(exe)
3318 ############################################################
3322 'tests/helpers/test_cap.c',
3323 include_directories : includes,
3324 dependencies : [lib_cap_ng],
3325 build_by_default: program_tests)
3326 if not is_disabler(exe)
3332 'tests/helpers/test_mbsencode.c',
3333 include_directories : includes,
3334 link_with : lib_common,
3335 build_by_default: program_tests)
3340 'tests/helpers/test_byteswap.c',
3341 include_directories : includes,
3342 build_by_default: program_tests)
3347 'tests/helpers/test_md5.c',
3349 include_directories : includes,
3350 build_by_default: program_tests)
3355 'tests/helpers/test_sha1.c',
3357 include_directories : includes,
3358 build_by_default: program_tests)
3363 'tests/helpers/test_pathnames.c',
3364 include_directories : includes,
3365 build_by_default: program_tests)
3370 'tests/helpers/test_strerror.c',
3371 include_directories : includes,
3372 build_by_default: program_tests)
3377 'tests/helpers/test_sysinfo.c',
3378 include_directories : includes,
3379 build_by_default: program_tests)
3384 'tests/helpers/test_sigreceive.c',
3385 include_directories : includes,
3386 link_with : lib_common,
3387 build_by_default: program_tests)
3392 'tests/helpers/test_tiocsti.c',
3393 include_directories : includes,
3394 build_by_default: program_tests)
3398 'test_uuid_namespace',
3399 'tests/helpers/test_uuid_namespace.c',
3403 include_directories : includes,
3404 build_by_default: program_tests)
3410 'tests/helpers/test_mkfds.c',
3411 'tests/helpers/test_mkfds.h',
3412 'tests/helpers/test_mkfds_ppoll.c',
3413 include_directories : includes,
3414 dependencies : mq_libs,
3415 build_by_default: program_tests)
3421 'tests/helpers/test_enosys.c',
3422 include_directories : includes,
3423 build_by_default: program_tests)
3426 ############################################################
3428 if conf.get('HAVE_OPENAT').to_string() == '1'
3430 'sample-scols-tree',
3431 'libsmartcols/samples/tree.c',
3432 include_directories : includes,
3433 link_with : [lib_smartcols, lib_common],
3434 build_by_default: program_tests)
3435 if not is_disabler(exe)
3441 'sample-scols-title',
3442 'libsmartcols/samples/title.c',
3443 include_directories : includes,
3444 link_with : [lib_smartcols, lib_common])
3445 if not is_disabler(exe)
3450 'sample-scols-wrap',
3451 'libsmartcols/samples/wrap.c',
3452 include_directories : includes,
3453 link_with : [lib_smartcols, lib_common])
3454 if not is_disabler(exe)
3459 'sample-scols-continuous',
3460 'libsmartcols/samples/continuous.c',
3461 include_directories : includes,
3462 link_with : [lib_smartcols, lib_common])
3463 if not is_disabler(exe)
3468 'sample-scols-maxout',
3469 'libsmartcols/samples/maxout.c',
3470 include_directories : includes,
3471 link_with : [lib_smartcols, lib_common])
3472 if not is_disabler(exe)
3477 'sample-scols-fromfile',
3478 'libsmartcols/samples/fromfile.c',
3479 include_directories : includes,
3480 link_with : [lib_smartcols, lib_common])
3481 if not is_disabler(exe)
3486 'sample-scols-grouping-simple',
3487 'libsmartcols/samples/grouping-simple.c',
3488 include_directories : includes,
3489 link_with : [lib_smartcols, lib_common])
3490 if not is_disabler(exe)
3495 'sample-scols-grouping-overlay',
3496 'libsmartcols/samples/grouping-overlay.c',
3497 include_directories : includes,
3498 link_with : [lib_smartcols, lib_common])
3499 if not is_disabler(exe)
3503 ############################################################
3505 # Let the test runner know whether we're running under asan and export
3506 # some paths. We use a file on disk so that it is possible to run the
3507 # test scripts from commandline without setting any variables.
3508 configure_file(output : 'meson.conf',
3513 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3514 python.full_path())])
3516 run_sh = find_program('tests/run.sh')
3520 '--srcdir=' + meson.current_source_dir(),
3521 '--builddir=' + meson.current_build_dir(),
3527 manadocs += ['lib/terminal-colors.d.5.adoc']
3528 manadocs += ['libblkid/libblkid.3.adoc']
3532 'libuuid/man/uuid.3.adoc',
3533 'libuuid/man/uuid_clear.3.adoc',
3534 'libuuid/man/uuid_compare.3.adoc',
3535 'libuuid/man/uuid_copy.3.adoc',
3536 'libuuid/man/uuid_generate.3.adoc',
3537 'libuuid/man/uuid_is_null.3.adoc',
3538 'libuuid/man/uuid_parse.3.adoc',
3539 'libuuid/man/uuid_time.3.adoc',
3540 'libuuid/man/uuid_unparse.3.adoc']
3542 'uuid_generate_random.3': 'uuid_generate.3',
3543 'uuid_generate_time.3': 'uuid_generate.3',
3544 'uuid_generate_time_safe.3': 'uuid_generate.3',
3548 asciidoctor = find_program('asciidoctor', required : false)
3549 if asciidoctor.found()
3550 foreach adoc : manadocs
3551 name = adoc.split('/')[-1]
3552 page = name.split('.adoc')[0]
3553 section = page.split('.')[-1]
3554 mandirn = join_paths(mandir, 'man' + section)
3559 command : [ asciidoctor,
3561 '-a', 'VERSION=' + meson.project_version(),
3562 '-a', 'release-version=' + meson.project_version(),
3563 '-a', 'ADJTIME_PATH=/etc/adjtime',
3564 '-a', 'package-docdir=' + docdir,
3565 '--base-dir=' + meson.current_source_dir(),
3566 '--destination-dir=' + meson.current_build_dir(),
3567 '--load-path', '@SOURCE_ROOT@/tools',
3568 '--require', 'asciidoctor-includetracker',
3572 depfile : page + '.deps',
3574 install_dir : mandirn)
3577 foreach link_name, target : manlinks
3578 link_section = link_name.split('.')[-1]
3579 target_section = target.split('.')[-1]
3580 meson.add_install_script(meson_make_manpage_stub,
3581 join_paths('man' + target_section, target),
3582 join_paths(mandir, 'man' + link_section, link_name))
3586 if bash_completion.found()
3587 foreach completion : bashcompletions
3589 join_paths('bash-completion', completion),
3590 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3593 foreach link_name, target : bashcompletionslinks
3594 meson.add_install_script(meson_make_symlink,
3596 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))