]> git.ipfire.org Git - thirdparty/util-linux.git/blob - meson.build
tests: add test_enosys helper
[thirdparty/util-linux.git] / meson.build
1 project('util-linux', 'c',
2 version : run_command('tools/git-version-gen', check: true).stdout(),
3 meson_version: '>=0.53.0',
4 license : 'GPLv2+')
5
6 pkgconfig = import('pkgconfig')
7
8 libblkid_version = '1.1.0'
9 libblkid_date = '01-Jun-2021'
10 libuuid_version = '1.3.0'
11 libmount_version = '1.1.0'
12 libsmartcols_version = '1.1.0'
13 libfdisk_version = '1.1.0'
14
15 prefixdir = get_option('prefix')
16 if not prefixdir.startswith('/')
17 error('Prefix is not absolute: "@0@"'.format(prefixdir))
18 endif
19 bindir = join_paths(prefixdir, get_option('bindir'))
20 sbindir = join_paths(prefixdir, get_option('sbindir'))
21 sysconfstaticdir = join_paths(prefixdir, 'lib')
22 docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
23 mandir = join_paths(prefixdir, get_option('mandir'))
24 runstatedir = '/run'
25 execprefixdir = prefixdir
26 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
27 usrbin_exec_dir = join_paths(execprefixdir, bindir)
28 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
29 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
30
31 vendordir = get_option('vendordir')
32
33 add_project_arguments('-D_GNU_SOURCE', language : 'c')
34
35 cc = meson.get_compiler('c')
36
37 conf = configuration_data()
38 conf.set_quoted('PACKAGE', meson.project_name())
39 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
40 package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version())
41 conf.set_quoted('PACKAGE_STRING', package_string)
42
43 codes = [''' {print $1} ''',
44 ''' {sub("-.*","",$2); print $2} ''',
45 ''' {sub("-.*","",$3); print $3 ~ /^[0-9]+$/ ? $3 : 0} ''']
46 pc_version = []
47 foreach code : codes
48 res = run_command('bash', '-c',
49 '''echo '@0@' | awk -F. '@1@' '''.format(
50 meson.project_version(), code), check: true)
51 pc_version += res.stdout().strip()
52 endforeach
53 pc_version = '.'.join(pc_version)
54
55 conf.set_quoted('LIBBLKID_VERSION', libblkid_version)
56 conf.set_quoted('LIBBLKID_DATE', libblkid_date)
57
58 conf.set('bindir', bindir)
59 conf.set('sbindir', sbindir)
60 conf.set('runstatedir', runstatedir)
61 conf.set('sysconfdir', sysconfdir)
62 conf.set('usrsbin_execdir', usrsbin_exec_dir)
63 conf.set('docdir', docdir)
64 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
65 conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir)
66 conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime')
67 conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :(
68
69 conf.set_quoted('_PATH_VENDORDIR', vendordir)
70 conf.set('USE_VENDORDIR', vendordir == '' ? false : 1)
71
72 build_libblkid = not get_option('build-libblkid').disabled()
73 conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false)
74 summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components')
75
76 build_libuuid = not get_option('build-libuuid').disabled()
77 conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false)
78 summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components')
79
80 have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0
81 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
82 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
83
84 build_libmount = not get_option('build-libmount').disabled()
85 conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false)
86 conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1)
87 conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false)
88 summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components')
89
90 build_libsmartcols = not get_option('build-libsmartcols').disabled()
91 conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false)
92 summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components')
93
94 build_libfdisk = not get_option('build-libfdisk').disabled()
95 conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false)
96 summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components')
97
98 build_uuidd = not get_option('build-uuidd').disabled()
99 conf.set('HAVE_UUIDD', build_uuidd ? 1 : false)
100 summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components')
101
102 static_programs = get_option('static-programs')
103 need_static_libs = static_programs.length() > 0 # a rough estimate...
104 summary('static programs', static_programs)
105
106 LINUX = host_machine.system() in ['linux']
107 BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
108
109 ############################################################
110
111 code = '''
112 #include <wchar.h>
113 #include <wctype.h>
114 #include <stdio.h>
115 #include <stdlib.h>
116 int main(void) {
117 wchar_t wc;
118 wint_t w;
119 w = fgetwc(stdin);
120 if (w == WEOF)
121 return 1;
122 wc = w;
123 fputwc(wc,stdout);
124 return 0;
125 }
126 '''
127 have = cc.compiles(code, name : 'wchar_t support')
128 if not have and get_option('widechar').enabled()
129 error('widechar support requested but unavailable')
130 endif
131 if get_option('ncurses').enabled() and get_option('widechar').enabled()
132 error('widechar support is incompatible with non-wide ncurses')
133 endif
134 conf.set('HAVE_WIDECHAR', have ? 1 : false)
135
136 headers = '''
137 byteswap.h
138 crypt.h
139 endian.h
140 err.h
141 errno.h
142 fcntl.h
143 getopt.h
144 inttypes.h
145 langinfo.h
146 lastlog.h
147 libutil.h
148 locale.h
149 mntent.h
150 paths.h
151 pty.h
152 shadow.h
153 stdint.h
154 stdio_ext.h
155 stdlib.h
156 string.h
157 strings.h
158 unistd.h
159 utmp.h
160 utmpx.h
161 asm-generic/fcntl.h
162 asm/fcntl.h
163 asm/io.h
164 linux/blkzoned.h
165 linux/capability.h
166 linux/cdrom.h
167 linux/compiler.h
168 linux/falloc.h
169 linux/fd.h
170 linux/fiemap.h
171 linux/gsmmux.h
172 linux/net_namespace.h
173 linux/nsfs.h
174 linux/stat.h
175 linux/securebits.h
176 linux/tiocl.h
177 linux/version.h
178 linux/watchdog.h
179 net/if.h
180 net/if_dl.h
181 netinet/in.h
182 security/openpam.h
183 security/pam_appl.h
184 security/pam_misc.h
185 sys/disk.h
186 sys/disklabel.h
187 sys/endian.h
188 sys/file.h
189 sys/io.h
190 sys/ioccom.h
191 sys/ioctl.h
192 sys/mkdev.h
193 sys/mount.h
194 sys/param.h
195 sys/pidfd.h
196 sys/prctl.h
197 sys/resource.h
198 sys/sendfile.h
199 sys/signalfd.h
200 sys/socket.h
201 sys/sockio.h
202 sys/stat.h
203 sys/swap.h
204 sys/syscall.h
205 sys/sysmacros.h
206 sys/time.h
207 sys/timex.h
208 sys/ttydefaults.h
209 sys/types.h
210 sys/ucred.h
211 sys/un.h
212 sys/xattr.h
213 '''.split()
214
215 lib_m = cc.find_library('m')
216
217 lib_tinfo = dependency(
218 'tinfo',
219 required : get_option('tinfo'))
220
221 lib_ncursesw = dependency(
222 'ncursesw',
223 required : get_option('ncursesw'))
224 if lib_ncursesw.found()
225 headers += ['ncursesw/ncurses.h',
226 'ncursesw/term.h',
227 'ncurses.h',
228 'term.h']
229 lib_ncurses = disabler()
230 else
231 lib_ncurses = dependency(
232 'ncurses',
233 required : get_option('ncurses'))
234 headers += ['ncurses.h',
235 'term.h']
236 endif
237
238 conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found())
239 conf.set('HAVE_LIBNCURSES', lib_ncurses.found())
240 conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found())
241
242 lib_slang = dependency(
243 'slang',
244 required : get_option('slang'))
245 if lib_slang.found()
246 headers += ['slang.h',
247 'slang/slang.h',
248 'slcurses.h',
249 'slang/slcurses.h']
250 endif
251 conf.set('HAVE_SLANG', lib_slang.found())
252
253 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
254 if curses_libs.found()
255 have = cc.has_function('use_default_colors', dependencies : curses_libs)
256 conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false)
257 have = cc.has_function('resizeterm', dependencies : curses_libs)
258 conf.set('HAVE_RESIZETERM', have ? 1 : false)
259 break
260 endif
261 endforeach
262
263 lib_z = dependency(
264 'zlib',
265 required : get_option('zlib'))
266
267 lib_readline = dependency(
268 'readline',
269 required : get_option('readline'))
270 conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false)
271
272 lib_readline_static = dependency(
273 'readline',
274 static : true,
275 required : need_static_libs ? get_option('readline') : disabler())
276
277 if meson.version().version_compare('>= 0.59.0')
278 lib_intl = dependency(
279 'intl',
280 required : get_option('nls'))
281 conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false)
282 else
283 if get_option('nls').enabled()
284 error('nls is not supported with meson before 0.59.0')
285 endif
286 lib_intl = dependency('', required : false)
287 endif
288
289 lib_user = dependency(
290 'libuser',
291 version : '>= 0.58',
292 required : get_option('libuser'))
293 conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false)
294
295 lib_util = cc.find_library(
296 'util',
297 required : get_option('libutil'))
298 conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false)
299
300 lib_utempter = cc.find_library(
301 'utempter',
302 required : get_option('libutempter'))
303 conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false)
304
305 systemd = dependency(
306 'systemd',
307 required : get_option('systemd'))
308
309 lib_systemd = dependency(
310 'libsystemd',
311 required : get_option('systemd'))
312 conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false)
313
314 lib_udev = dependency(
315 'libudev',
316 required : get_option('systemd'))
317 conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false)
318
319 lib_crypt = cc.find_library('crypt')
320
321 lib_pam = cc.find_library('pam', required : get_option('build-login'))
322 if not lib_pam.found()
323 lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh'))
324 endif
325 if not lib_pam.found()
326 lib_pam = cc.find_library('pam', required : get_option('build-su'))
327 endif
328 if not lib_pam.found()
329 lib_pam = cc.find_library('pam', required : get_option('build-runuser'))
330 endif
331 if lib_pam.found()
332 lib_pam_misc = cc.find_library('pam_misc')
333 lib_pam = [lib_pam, lib_pam_misc]
334 else
335 lib_pam_misc = declare_dependency()
336 endif
337
338 lib_cryptsetup = dependency(
339 'libcryptsetup',
340 required : get_option('cryptsetup'))
341 conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false)
342
343 if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled()
344 if meson.version().version_compare('>= 0.62.0')
345 lib_dl = dependency('dl')
346 else
347 lib_dl = cc.find_library('dl')
348 endif
349 conf.set('CRYPTSETUP_VIA_DLOPEN', 1)
350 summary('cryptsetup support (dlopen)',
351 'enabled',
352 section : 'components')
353 else
354 summary('cryptsetup support',
355 lib_cryptsetup.found() ? 'enabled' : 'disabled',
356 section : 'components')
357 endif
358
359 have = cc.has_function(
360 'crypt_activate_by_signed_key',
361 dependencies : lib_cryptsetup)
362 conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false)
363
364 lib_cap_ng = dependency(
365 'libcap-ng',
366 required : get_option('build-setpriv'))
367
368 lib_selinux = dependency(
369 'libselinux',
370 version : '>= 2.5',
371 required : get_option('selinux'))
372 conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false)
373
374 lib_magic = dependency(
375 'libmagic',
376 required : get_option('magic'))
377 conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false)
378
379 lib_econf = dependency(
380 'libeconf',
381 required : get_option('econf'))
382 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
383
384 lib_audit = dependency(
385 'audit',
386 required : get_option('audit'))
387 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
388
389 conf.set('HAVE_SMACK', not get_option('smack').disabled())
390
391 foreach header : headers
392 have = cc.has_header(header)
393 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
394 endforeach
395
396 header = 'linux/btrfs.h'
397 enable_btrfs = cc.has_header(header,
398 required : get_option('btrfs'))
399 conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false)
400 conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false)
401
402 prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : ''
403 foreach header : [
404 'linux/blkpg.h',
405 'linux/major.h',
406 ]
407 have = cc.has_header(header,
408 prefix : prefix)
409 conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false)
410 endforeach
411
412 have = cc.has_header('sched.h')
413 conf.set10('HAVE_DECL_CPU_ALLOC', have)
414 # We get -1 if the size cannot be determined
415 have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0
416 conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false)
417
418 have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE')
419 conf.set10('HAVE_ENVIRON_DECL', have)
420
421 have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE')
422 conf.set('HAVE_SIGHANDLER_T', have ? 1 : false)
423
424 have = cc.has_function('strsignal')
425 conf.set10('HAVE_STRSIGNAL_DECL', have)
426
427 have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0
428 conf.set('HAVE_UNION_SEMUN', have ? 1 : false)
429
430 have = cc.compiles('''
431 #define _GNU_SOURCE 1
432 #include <langinfo.h>
433 int main(void) {
434 char *str;
435 str = nl_langinfo (ALTMON_1);
436 str = nl_langinfo (ALTMON_2);
437 str = nl_langinfo (ALTMON_3);
438 str = nl_langinfo (ALTMON_4);
439 str = nl_langinfo (ALTMON_5);
440 str = nl_langinfo (ALTMON_6);
441 str = nl_langinfo (ALTMON_7);
442 str = nl_langinfo (ALTMON_8);
443 str = nl_langinfo (ALTMON_9);
444 str = nl_langinfo (ALTMON_10);
445 str = nl_langinfo (ALTMON_11);
446 str = nl_langinfo (ALTMON_12);
447 return 0;
448 }
449 ''',
450 name : 'langinfo.h defines ALTMON_x constants')
451 conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false)
452
453 have = cc.compiles('''
454 #define _GNU_SOURCE 1
455 #include <langinfo.h>
456 int main(void) {
457 char *str;
458 str = nl_langinfo (_NL_ABALTMON_1);
459 str = nl_langinfo (_NL_ABALTMON_2);
460 str = nl_langinfo (_NL_ABALTMON_3);
461 str = nl_langinfo (_NL_ABALTMON_4);
462 str = nl_langinfo (_NL_ABALTMON_5);
463 str = nl_langinfo (_NL_ABALTMON_6);
464 str = nl_langinfo (_NL_ABALTMON_7);
465 str = nl_langinfo (_NL_ABALTMON_8);
466 str = nl_langinfo (_NL_ABALTMON_9);
467 str = nl_langinfo (_NL_ABALTMON_10);
468 str = nl_langinfo (_NL_ABALTMON_11);
469 str = nl_langinfo (_NL_ABALTMON_12);
470 return 0;
471 }
472 ''',
473 name : 'langinfo.h defines _NL_ABALTMON_x constants')
474 conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false)
475
476 funcs = '''
477 clearenv
478 close_range
479 __fpurge
480 fpurge
481 __fpending
482 secure_getenv
483 __secure_getenv
484 eaccess
485 err
486 errx
487 explicit_bzero
488 fmemopen
489 fnmatch
490 fseeko
491 fsconfig
492 fsmount
493 fsopen
494 fspick
495 fsync
496 utimensat
497 getdomainname
498 getdtablesize
499 getexecname
500 getmntinfo
501 getrandom
502 getrlimit
503 getsgnam
504 inotify_init
505 jrand48
506 lchown
507 lgetxattr
508 llistxattr
509 llseek
510 newlocale
511 mempcpy
512 mkostemp
513 move_mount
514 mount_setattr
515 nanosleep
516 ntp_gettime
517 open_tree
518 personality
519 pidfd_open
520 pidfd_send_signal
521 posix_fadvise
522 prctl
523 qsort_r
524 rpmatch
525 scandirat
526 setprogname
527 sendfile
528 setns
529 setresgid
530 setresuid
531 sched_setattr
532 sched_setscheduler
533 sigqueue
534 srandom
535 statx
536 strnchr
537 strndup
538 strnlen
539 strtod_l
540 sysconf
541 sysinfo
542 swapon
543 swapoff
544 timegm
545 unshare
546 usleep
547 uselocale
548 utimensat
549 vwarnx
550 warn
551 warnx
552 prlimit
553
554 openat
555 fstatat
556 unlinkat
557 ioperm
558 iopl
559 futimens
560 inotify_init1
561 open_memstream
562 reboot
563 getusershell
564 '''.split()
565
566 foreach func: funcs
567 have = cc.has_function(func)
568 # For autotools compatibility, use either #define FOO 1 or #undef FOO.
569 # This makes little sense, but is necessary to avoid warnings about
570 # redefined macros from Python.h, which uses this convention.
571 conf.set('HAVE_' + func.to_upper(), have ? 1 : false)
572 endforeach
573
574 have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1]
575 conf.set('AGETTY_RELOAD', have ? 1 : false)
576 if not have
577 warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality')
578 endif
579
580 have_dirfd = (cc.has_function('dirfd') or
581 cc.has_header_symbol('dirent.h', 'dirfd',
582 prefix : '#include <sys/types.h>'))
583 conf.set('HAVE_DIRFD', have_dirfd ? 1 : false)
584
585 have_ddfd = cc.has_member('DIR', 'dd_fd',
586 prefix : '''
587 #include <sys/types.h>
588 #include <dirent.h>
589 ''')
590 conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false)
591
592 have = cc.has_member('struct tm', 'tm_gmtoff',
593 prefix : '''
594 #include <time.h>
595 #include <unistd.h>
596 ''')
597 conf.set('HAVE_TM_GMTOFF', have ? 1 : false)
598
599
600
601 have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0
602 conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false)
603
604 have = cc.has_member('struct termios', 'c_line',
605 prefix : '#include <termios.h>')
606 conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false)
607
608 have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
609 prefix : '#include <sys/stat.h>')
610 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
611
612 # replacement for AC_STRUCT_TIMEZONE
613 have = cc.has_member('struct tm', 'tm_zone',
614 prefix : '#include <time.h>')
615 conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false)
616
617 have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE')
618 conf.set('HAVE_DECL_TZNAME', have ? 1 : false)
619
620 code = '''
621 #include <time.h>
622 #if !@0@
623 extern char *tzname[];
624 #endif
625 int main(void) {
626 return tzname ? 0 : 1;
627 }
628 '''.format(have ? 1 : 0)
629 have = cc.compiles(code, name : 'using tzname[]')
630 conf.set('HAVE_TZNAME', have ? 1 : false)
631
632 socket_libs = []
633 if not cc.has_function('socket')
634 socket_libs += cc.find_library('socket', required : true)
635 have = cc.has_function('socket',
636 dependencies : socket_libs)
637 if not have
638 error('socket() function not available')
639 endif
640 endif
641
642 realtime_libs = []
643 have = cc.has_function('clock_gettime')
644 if not have
645 realtime_libs += cc.find_library('rt', required : true)
646 have = cc.has_function('clock_gettime',
647 dependencies : realtime_libs)
648 endif
649 conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false)
650
651 thread_libs = dependency('threads')
652
653 have = cc.has_function('timer_create')
654 if not have
655 realtime_libs = [cc.find_library('rt', required : true)]
656 have = cc.has_function('timer_create',
657 dependencies : realtime_libs)
658 if not have
659 realtime_libs += thread_libs
660 have = cc.has_function('timer_create',
661 dependencies : realtime_libs)
662 endif
663 endif
664 conf.set('HAVE_TIMER_CREATE', have ? 1 : false)
665 if not have
666 have = cc.has_function('setitimer')
667 conf.set('HAVE_SETITIMER', have ? 1 : false)
668 endif
669
670 rtas_libs = cc.find_library('rtas', required : false)
671 conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false)
672
673 math_libs = []
674 if not cc.has_header_symbol('math.h', 'isnan')
675 lib = cc.find_library('m', required : true)
676 if (cc.has_function('isnan', dependencies : lib) and
677 cc.has_function('__isnan', dependencies : lib))
678 math_libs += lib
679 endif
680 endif
681
682 have = cc.has_header_symbol('errno.h', 'program_invocation_short_name',
683 args : '-D_GNU_SOURCE')
684 conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false)
685
686 code = '''
687 extern char *__progname;
688 int main(void) {
689 return (*__progname != 0);
690 }
691 '''
692 have = cc.compiles(code, name : 'using __progname')
693 conf.set('HAVE___PROGNAME', have ? 1 : false)
694
695 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
696 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
697
698 build_plymouth_support = get_option('build-plymouth-support')
699 have_tiocglcktrmios = cc.has_header_symbol(
700 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
701 required : build_plymouth_support.enabled())
702 have_sock_cloexec = cc.has_header_symbol(
703 'sys/socket.h', 'SOCK_CLOEXEC',
704 prefix : '#include <sys/types.h>',
705 required : build_plymouth_support.enabled())
706 have_sock_nonblock = cc.has_header_symbol(
707 'sys/socket.h', 'SOCK_NONBLOCK',
708 prefix : '#include <sys/types.h>',
709 required : build_plymouth_support.enabled())
710 have_so_passcred = cc.has_header_symbol(
711 'sys/socket.h', 'SO_PASSCRED',
712 prefix : '#include <sys/types.h>',
713 required : build_plymouth_support.enabled())
714
715 build_plymouth_support = (not build_plymouth_support.disabled() and
716 have_tiocglcktrmios and
717 have_sock_cloexec and
718 have_sock_nonblock and
719 have_so_passcred)
720 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
721 summary('plymouth support',
722 build_plymouth_support ? 'enabled' : 'disabled',
723 section : 'components')
724
725 # check for valid fallocate() function
726 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
727 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
728 # and program can't be linked.
729 code = '''
730 #define _GNU_SOURCE
731 #include <unistd.h>
732 #include <fcntl.h>
733
734 int main(void) {
735 long ret;
736 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
737 return ret == 0 ? 0 : 1;
738 }
739 '''
740 have = cc.links(code, name : 'fallocate() function')
741 conf.set('HAVE_FALLOCATE', have ? 1 : false)
742
743 code = '''
744 #include <unistd.h>
745 #include <fcntl.h>
746
747 int main(void) {
748 long ret;
749 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
750 return ret == 0 ? 0 : 1;
751 }
752 '''
753 have = cc.links(code, name : 'posix_fallocate() function')
754 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
755
756 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
757 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
758 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
759
760 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
761 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
762 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
763
764 ############################################################
765
766
767 fs_search_path = get_option('fs-search-path')
768 fs_search_path_extra = get_option('fs-search-path-extra')
769 if fs_search_path_extra != ''
770 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
771 endif
772 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
773
774 systemdsystemunitdir = ''
775 if systemd.found()
776 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
777 endif
778
779 sysvinit = get_option('sysvinit').enabled()
780 sysvinitrcdir = sysconfdir + '/init.d'
781
782 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
783 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
784
785 have = get_option('chsh-only-listed')
786 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
787
788 have = get_option('use-tty-group')
789 conf.set('USE_TTY_GROUP', have ? 1 : false)
790
791 build_hwclock = not get_option('build-hwclock').disabled()
792 bison = find_program('bison', required: build_hwclock)
793 bison_gen = generator(
794 bison,
795 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
796 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
797
798
799
800 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
801 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
802
803 configure_file(
804 output : 'config.h',
805 configuration : conf)
806
807 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
808
809 compiler_flags = [
810 '-fno-common',
811
812 '-Waddress-of-packed-member',
813 '-Wdiscarded-qualifiers',
814 '-Wembedded-directive',
815 '-Wextra-semi',
816 '-Wformat-security',
817 '-Wimplicit-function-declaration',
818 '-Wmissing-declarations',
819 '-Wmissing-parameter-type',
820 '-Wmissing-prototypes',
821 '-Wnested-externs',
822 '-Wno-missing-field-initializers',
823 '-Wold-style-definition',
824 '-Wpointer-arith',
825 '-Wredundant-decls',
826 '-Wsign-compare',
827 '-Wstrict-prototypes',
828 '-Wtype-limits',
829 '-Wuninitialized',
830 '-Wunused-but-set-parameter',
831 '-Wunused-but-set-variable',
832 '-Wunused-parameter',
833 '-Wunused-result',
834 '-Wunused-variable',
835 ]
836 foreach compiler_flag : compiler_flags
837 if cc.has_argument(compiler_flag)
838 add_project_arguments(compiler_flag, language : 'c')
839 endif
840 endforeach
841
842 manadocs = []
843 manlinks = {}
844
845 bashcompletions = []
846 bashcompletionslinks = {}
847
848 subdir('include')
849 subdir('lib')
850 subdir('libblkid')
851 subdir('libmount')
852 subdir('libsmartcols')
853 subdir('libuuid')
854 subdir('libfdisk')
855 subdir('login-utils')
856 subdir('sys-utils')
857 subdir('disk-utils')
858 subdir('misc-utils')
859 subdir('text-utils')
860 subdir('term-utils')
861 subdir('po')
862
863 includes = [dir_include,
864 dir_libblkid,
865 dir_libsmartcols,
866 dir_libmount,
867 dir_libfdisk,
868 dir_libuuid,
869 dir_sys_utils]
870
871 exes = []
872
873 opt = not get_option('build-chfn-chsh').disabled()
874 exe = executable(
875 'chfn',
876 chfn_sources,
877 chfn_chsh_sources,
878 include_directories : includes,
879 link_with : [lib_common, logindefs_c],
880 dependencies : chfn_chsh_deps,
881 install_dir : usrbin_exec_dir,
882 install : opt,
883 build_by_default : opt)
884
885 exe2 = executable(
886 'chsh',
887 'login-utils/chsh.c',
888 'lib/shells.c',
889 chfn_chsh_sources,
890 include_directories : includes,
891 link_with : lib_common,
892 dependencies : chfn_chsh_deps,
893 install_dir : usrbin_exec_dir,
894 install : opt,
895 build_by_default : opt)
896 if opt and not is_disabler(exe)
897 exes += [exe, exe2]
898 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
899 bashcompletions += ['chfn', 'chsh']
900 endif
901
902 exe = executable(
903 'test_islocal',
904 test_islocal_sources,
905 include_directories : includes,
906 c_args : '-DTEST_PROGRAM')
907 exes += exe
908
909 exe = executable(
910 'test-consoles',
911 test_consoles_sources,
912 c_args : ['-DTEST_PROGRAM'],
913 include_directories : includes,
914 link_with : lib_common)
915 exes += exe
916
917 opt = not get_option('build-last').disabled()
918 exe = executable(
919 'last',
920 last_sources,
921 include_directories : includes,
922 link_with : [lib_common],
923 install_dir : usrbin_exec_dir,
924 install : opt,
925 build_by_default : opt)
926 if opt and not is_disabler(exe)
927 exes += exe
928 meson.add_install_script(meson_make_symlink,
929 'last',
930 join_paths(usrbin_exec_dir, 'lastb'))
931 manadocs += ['login-utils/last.1.adoc']
932 manlinks += {'lastb.1': 'last.1'}
933 bashcompletions += ['last']
934 bashcompletionslinks += {'lastb': 'last'}
935 endif
936
937 opt = not get_option('build-nologin').disabled()
938 exe = executable(
939 'nologin',
940 'login-utils/nologin.c',
941 include_directories : includes,
942 install_dir : sbindir,
943 link_with : [lib_common],
944 install : opt,
945 build_by_default : opt)
946 if opt and not is_disabler(exe)
947 exes += exe
948 manadocs += ['login-utils/nologin.8.adoc']
949 endif
950
951 opt = not get_option('build-utmpdump').disabled()
952 exe = executable(
953 'utmpdump',
954 'login-utils/utmpdump.c',
955 include_directories : includes,
956 link_with : [lib_common],
957 install_dir : usrbin_exec_dir,
958 install : opt,
959 build_by_default : opt)
960 if opt and not is_disabler(exe)
961 exes += exe
962 manadocs += ['login-utils/utmpdump.1.adoc']
963 bashcompletions += ['utmpdump']
964 endif
965
966 opt = not get_option('build-su').disabled()
967 exe = executable(
968 'su',
969 'login-utils/su.c',
970 'login-utils/su-common.c',
971 'login-utils/su-common.h',
972 'lib/shells.c',
973 pty_session_c,
974 monotonic_c,
975 include_directories : includes,
976 link_with : [lib_common, logindefs_c],
977 dependencies : [lib_pam,
978 lib_pam_misc,
979 lib_util,
980 realtime_libs],
981 install : opt,
982 build_by_default : opt)
983 if opt and not is_disabler(exe)
984 exes += exe
985 manadocs += ['login-utils/su.1.adoc']
986 bashcompletions += ['su']
987 endif
988
989 opt = not get_option('build-newgrp').disabled()
990 exe = executable(
991 'newgrp',
992 'login-utils/newgrp.c',
993 include_directories : includes,
994 dependencies : [lib_crypt],
995 install_dir : usrbin_exec_dir,
996 install : opt,
997 build_by_default : opt)
998 if opt and not is_disabler(exe)
999 exes += exe
1000 manadocs += ['login-utils/newgrp.1.adoc']
1001 endif
1002
1003 opt = not get_option('build-lslogins').disabled()
1004 exe = executable(
1005 'lslogins',
1006 'login-utils/lslogins.c',
1007 include_directories : includes,
1008 link_with : [lib_common,
1009 lib_smartcols,
1010 logindefs_c],
1011 dependencies : [lib_selinux,
1012 lib_systemd],
1013 install_dir : usrbin_exec_dir,
1014 install : opt,
1015 build_by_default : opt)
1016 if opt and not is_disabler(exe)
1017 exes += exe
1018 manadocs += ['login-utils/lslogins.1.adoc']
1019 bashcompletions += ['lslogins']
1020 endif
1021
1022 opt = not get_option('build-vipw').disabled()
1023 exe = executable(
1024 'vipw',
1025 'login-utils/vipw.c',
1026 'login-utils/setpwnam.h',
1027 include_directories : includes,
1028 link_with : [lib_common],
1029 dependencies : [lib_selinux],
1030 install_dir : usrbin_exec_dir,
1031 install : opt,
1032 build_by_default : opt)
1033 if opt and not is_disabler(exe)
1034 exes += exe
1035 meson.add_install_script(meson_make_symlink,
1036 'vipw',
1037 join_paths(usrbin_exec_dir, 'vigr'))
1038 manadocs += ['login-utils/vipw.8.adoc']
1039 endif
1040
1041 opt = not get_option('build-runuser').disabled()
1042 exe = executable(
1043 'runuser',
1044 'login-utils/runuser.c',
1045 'login-utils/su-common.c',
1046 'login-utils/su-common.h',
1047 'lib/shells.c',
1048 pty_session_c,
1049 monotonic_c,
1050 include_directories : includes,
1051 link_with : [lib_common, logindefs_c],
1052 dependencies : [lib_pam,
1053 lib_pam_misc,
1054 lib_util,
1055 realtime_libs],
1056 install_dir : sbindir,
1057 install : opt,
1058 build_by_default : opt)
1059 if opt and not is_disabler(exe)
1060 exes += exe
1061 manadocs += ['login-utils/runuser.1.adoc']
1062 bashcompletionslinks += {'runuser': 'su'}
1063 endif
1064
1065 ############################################################
1066
1067 exe = executable(
1068 'col',
1069 col_sources,
1070 include_directories : includes,
1071 link_with : lib_common,
1072 install_dir : usrbin_exec_dir,
1073 install : true)
1074 exes += exe
1075 manadocs += ['text-utils/col.1.adoc']
1076 bashcompletions += ['col']
1077
1078 exe = executable(
1079 'colcrt',
1080 colcrt_sources,
1081 include_directories : includes,
1082 install_dir : usrbin_exec_dir,
1083 install : true)
1084 exes += exe
1085 manadocs += ['text-utils/colcrt.1.adoc']
1086 bashcompletions += ['colcrt']
1087
1088 exe = executable(
1089 'colrm',
1090 colrm_sources,
1091 include_directories : includes,
1092 link_with : lib_common,
1093 install_dir : usrbin_exec_dir,
1094 install : true)
1095 exes += exe
1096 manadocs += ['text-utils/colrm.1.adoc']
1097 bashcompletions += ['colrm']
1098
1099 exe = executable(
1100 'rev',
1101 rev_sources,
1102 include_directories : includes,
1103 install_dir : usrbin_exec_dir,
1104 install : true)
1105 exes += exe
1106 manadocs += ['text-utils/rev.1.adoc']
1107 bashcompletions += ['rev']
1108
1109 exe = executable(
1110 'column',
1111 column_sources,
1112 include_directories : includes,
1113 link_with : [lib_common,
1114 lib_smartcols],
1115 install_dir : usrbin_exec_dir,
1116 install : true)
1117 if not is_disabler(exe)
1118 exes += exe
1119 manadocs += ['text-utils/column.1.adoc']
1120 bashcompletions += ['column']
1121 endif
1122
1123 opt = not get_option('build-line').disabled()
1124 exe = executable(
1125 'line',
1126 line_sources,
1127 include_directories : includes,
1128 install_dir : usrbin_exec_dir,
1129 install : opt,
1130 build_by_default : opt)
1131 if opt and not is_disabler(exe)
1132 exes += exe
1133 manadocs += ['text-utils/line.1.adoc']
1134 endif
1135
1136 opt = not get_option('build-pg').disabled()
1137 exe = executable(
1138 'pg',
1139 pg_sources,
1140 link_with : lib_common,
1141 include_directories : includes,
1142 dependencies : [lib_tinfo,
1143 curses_libs],
1144 install_dir : usrbin_exec_dir,
1145 install : opt,
1146 build_by_default : opt)
1147 if opt and not is_disabler(exe)
1148 exes += exe
1149 manadocs += ['text-utils/pg.1.adoc']
1150 bashcompletions += ['pg']
1151 endif
1152
1153 opt = not get_option('build-ul').disabled()
1154 exe = executable(
1155 'ul',
1156 ul_sources,
1157 include_directories : includes,
1158 dependencies : [lib_tinfo,
1159 curses_libs],
1160 install_dir : usrbin_exec_dir,
1161 install : opt,
1162 build_by_default : opt)
1163 if opt and not is_disabler(exe)
1164 exes += exe
1165 manadocs += ['text-utils/ul.1.adoc']
1166 bashcompletions += ['ul']
1167 endif
1168
1169 opt = not get_option('build-more').disabled()
1170 exe = executable(
1171 'more',
1172 more_sources,
1173 link_with : [lib_common],
1174 include_directories : includes,
1175 dependencies : [lib_tinfo,
1176 curses_libs,
1177 lib_magic],
1178 install : opt,
1179 build_by_default : opt)
1180 exe2 = executable(
1181 'test_more',
1182 more_sources,
1183 link_with : [lib_common],
1184 include_directories : includes,
1185 c_args : '-DTEST_PROGRAM',
1186 dependencies : [lib_tinfo,
1187 curses_libs,
1188 lib_magic],
1189 build_by_default : opt)
1190 exes += exe
1191 if opt and not is_disabler(exe)
1192 exes += [exe, exe2]
1193 manadocs += ['text-utils/more.1.adoc']
1194 bashcompletions += ['more']
1195 endif
1196
1197 exe = executable(
1198 'hexdump',
1199 hexdump_sources,
1200 include_directories : includes,
1201 link_with : [lib_common,
1202 lib_tcolors],
1203 install_dir : usrbin_exec_dir,
1204 install : true)
1205 if not is_disabler(exe)
1206 exes += exe
1207 manadocs += ['text-utils/hexdump.1.adoc']
1208 bashcompletions += ['hexdump']
1209 endif
1210
1211 opt = not get_option('build-lsmem').disabled()
1212 exe = executable(
1213 'lsmem',
1214 lsmem_sources,
1215 include_directories : includes,
1216 link_with : [lib_common,
1217 lib_smartcols],
1218 install_dir : usrbin_exec_dir,
1219 install : opt,
1220 build_by_default : opt)
1221 if opt and not is_disabler(exe)
1222 exes += exe
1223 manadocs += ['sys-utils/lsmem.1.adoc']
1224 bashcompletions += ['lsmem']
1225 endif
1226
1227 opt = not get_option('build-chmem').disabled()
1228 exe = executable(
1229 'chmem',
1230 chmem_sources,
1231 include_directories : includes,
1232 link_with : [lib_common],
1233 install_dir : usrbin_exec_dir,
1234 install : opt,
1235 build_by_default : opt)
1236 if opt and not is_disabler(exe)
1237 exes += exe
1238 manadocs += ['sys-utils/chmem.8.adoc']
1239 bashcompletions += ['chmem']
1240 endif
1241
1242 exe = executable(
1243 'choom',
1244 choom_sources,
1245 include_directories : includes,
1246 link_with : [lib_common],
1247 install_dir : usrbin_exec_dir,
1248 install : true)
1249 exes += exe
1250 manadocs += ['sys-utils/choom.1.adoc']
1251
1252 exe = executable(
1253 'ipcmk',
1254 ipcmk_sources,
1255 include_directories : includes,
1256 link_with : [lib_common],
1257 install_dir : usrbin_exec_dir,
1258 install : true)
1259 exes += exe
1260 manadocs += ['sys-utils/ipcmk.1.adoc']
1261 bashcompletions += ['ipcmk']
1262
1263 exe = executable(
1264 'ipcrm',
1265 ipcrm_sources,
1266 include_directories : includes,
1267 link_with : [lib_common],
1268 install_dir : usrbin_exec_dir,
1269 install : true)
1270 exes += exe
1271 manadocs += ['sys-utils/ipcrm.1.adoc']
1272 bashcompletions += ['ipcrm']
1273
1274 opt = not get_option('build-ipcs').disabled()
1275 exe = executable(
1276 'ipcs',
1277 ipcs_sources,
1278 include_directories : includes,
1279 link_with : [lib_common],
1280 install_dir : usrbin_exec_dir,
1281 install : opt,
1282 build_by_default : opt)
1283 if opt and not is_disabler(exe)
1284 exes += exe
1285 manadocs += ['sys-utils/ipcs.1.adoc']
1286 bashcompletions += ['ipcs']
1287 endif
1288
1289 opt = not get_option('build-rfkill').disabled()
1290 exe = executable(
1291 'rfkill',
1292 rfkill_sources,
1293 include_directories : includes,
1294 link_with : [lib_common,
1295 lib_smartcols],
1296 install_dir : usrsbin_exec_dir,
1297 install : opt,
1298 build_by_default : opt)
1299 if opt and not is_disabler(exe)
1300 exes += exe
1301 manadocs += ['sys-utils/rfkill.8.adoc']
1302 bashcompletions += ['rfkill']
1303 endif
1304
1305 exe = executable(
1306 'renice',
1307 renice_sources,
1308 include_directories : includes,
1309 link_with : [lib_common,
1310 lib_smartcols],
1311 install_dir : usrbin_exec_dir,
1312 install : true)
1313 if not is_disabler(exe)
1314 exes += exe
1315 manadocs += ['sys-utils/renice.1.adoc']
1316 bashcompletions += ['renice']
1317 endif
1318
1319 exe = executable(
1320 'setsid',
1321 setsid_sources,
1322 include_directories : includes,
1323 link_with : [lib_common,
1324 lib_smartcols],
1325 install_dir : usrbin_exec_dir,
1326 install : true)
1327 if opt and not is_disabler(exe)
1328 exes += exe
1329 manadocs += ['sys-utils/setsid.1.adoc']
1330 bashcompletions += ['setsid']
1331 endif
1332
1333 exe = executable(
1334 'readprofile',
1335 readprofile_sources,
1336 include_directories : includes,
1337 link_with : [lib_common,
1338 lib_smartcols],
1339 install_dir : usrsbin_exec_dir,
1340 install : true)
1341 if not is_disabler(exe)
1342 exes += exe
1343 manadocs += ['sys-utils/readprofile.8.adoc']
1344 bashcompletions += ['readprofile']
1345 endif
1346
1347 opt = not get_option('build-tunelp').disabled()
1348 exe = executable(
1349 'tunelp',
1350 tunelp_sources,
1351 include_directories : includes,
1352 link_with : [lib_common],
1353 install_dir : usrsbin_exec_dir,
1354 install : opt,
1355 build_by_default : opt)
1356 if opt and not is_disabler(exe)
1357 exes += exe
1358 manadocs += ['sys-utils/tunelp.8.adoc']
1359 bashcompletions += ['tunelp']
1360 endif
1361
1362 exe = executable(
1363 'fstrim',
1364 fstrim_sources,
1365 include_directories : includes,
1366 link_with : [lib_common,
1367 lib_mount],
1368 install_dir : sbindir,
1369 install : true)
1370 if not is_disabler(exe)
1371 exes += exe
1372 manadocs += ['sys-utils/fstrim.8.adoc']
1373 bashcompletions += ['fstrim']
1374 endif
1375
1376 exe = executable(
1377 'dmesg',
1378 dmesg_sources,
1379 include_directories : includes,
1380 link_with : [lib_common,
1381 lib_tcolors],
1382 install : true)
1383 if not is_disabler(exe)
1384 exes += exe
1385 manadocs += ['sys-utils/dmesg.1.adoc']
1386 bashcompletions += ['dmesg']
1387 endif
1388
1389 exe = executable(
1390 'test_dmesg',
1391 dmesg_sources,
1392 include_directories : dir_include,
1393 c_args : '-DTEST_DMESG',
1394 link_with : [lib_common,
1395 lib_tcolors])
1396 if not is_disabler(exe)
1397 exes += exe
1398 endif
1399
1400 exe = executable(
1401 'ctrlaltdel',
1402 ctrlaltdel_sources,
1403 include_directories : includes,
1404 link_with : [lib_common],
1405 install_dir : sbindir,
1406 install : true)
1407 exes += exe
1408 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1409 bashcompletions += ['ctrlaltdel']
1410
1411 exe = executable(
1412 'fsfreeze',
1413 fsfreeze_sources,
1414 include_directories : includes,
1415 install_dir : sbindir,
1416 install : true)
1417 exes += exe
1418 manadocs += ['sys-utils/fsfreeze.8.adoc']
1419 bashcompletions += ['fsfreeze']
1420
1421 exe = executable(
1422 'blkdiscard',
1423 blkdiscard_sources,
1424 include_directories : includes,
1425 link_with : [lib_common,
1426 lib_blkid],
1427 install_dir : sbindir,
1428 install : true)
1429 exes += exe
1430 manadocs += ['sys-utils/blkdiscard.8.adoc']
1431 bashcompletions += ['blkdiscard']
1432
1433 exe = executable(
1434 'blkzone',
1435 blkzone_sources,
1436 include_directories : includes,
1437 link_with : [lib_common],
1438 install_dir : sbindir,
1439 install : true)
1440 exes += exe
1441 manadocs += ['sys-utils/blkzone.8.adoc']
1442 bashcompletions += ['blkzone']
1443
1444 exe = executable(
1445 'blkpr',
1446 blkpr_sources,
1447 include_directories : includes,
1448 link_with : [lib_common],
1449 install_dir : sbindir,
1450 install : true)
1451 exes += exe
1452 manadocs += ['sys-utils/blkpr.8.adoc']
1453
1454 exe = executable(
1455 'ldattach',
1456 ldattach_sources,
1457 include_directories : includes,
1458 link_with : [lib_common],
1459 install_dir : usrsbin_exec_dir,
1460 install : true)
1461 exes += exe
1462 manadocs += ['sys-utils/ldattach.8.adoc']
1463 bashcompletions += ['ldattach']
1464
1465 exe = executable(
1466 'rtcwake',
1467 rtcwake_sources,
1468 include_directories : includes,
1469 link_with : [lib_common],
1470 install_dir : usrsbin_exec_dir,
1471 install : true)
1472 exes += exe
1473 manadocs += ['sys-utils/rtcwake.8.adoc']
1474 bashcompletions += ['rtcwake']
1475
1476 exe = executable(
1477 'setarch',
1478 setarch_sources,
1479 include_directories : includes,
1480 link_with : [lib_common],
1481 install_dir : usrbin_exec_dir,
1482 install : true)
1483 exes += exe
1484 manadocs += ['sys-utils/setarch.8.adoc']
1485 bashcompletions += ['setarch']
1486
1487 setarch_links = ['uname26', 'linux32', 'linux64']
1488 setarch_links_arch = {
1489 's390x' : ['s390', 's390x'],
1490 'x86' : ['i386'],
1491 'x86_64' : ['i386', 'x86_64'],
1492 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1493 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1494 'mips64' : ['mips', 'mips64', 'mips32'],
1495 'ia64' : ['i386', 'ia64'],
1496 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1497 }
1498 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1499
1500 foreach link: setarch_links
1501 meson.add_install_script(meson_make_symlink,
1502 'setarch',
1503 join_paths(usrbin_exec_dir, link))
1504 manlinks += {link + '.8': 'setarch.8'}
1505 endforeach
1506
1507 opt = not get_option('build-eject').disabled()
1508 exe = executable(
1509 'eject',
1510 eject_sources,
1511 include_directories : includes,
1512 link_with : [lib_common,
1513 lib_mount],
1514 install_dir : usrbin_exec_dir,
1515 install : opt,
1516 build_by_default : opt)
1517 if opt and not is_disabler(exe)
1518 exe = exe
1519 manadocs += ['sys-utils/eject.1.adoc']
1520 bashcompletions += ['eject']
1521 endif
1522
1523 opt = not get_option('build-losetup').disabled()
1524 exe = executable(
1525 'losetup',
1526 losetup_sources,
1527 include_directories : includes,
1528 link_with : [lib_common,
1529 lib_smartcols],
1530 install_dir : sbindir,
1531 install : opt,
1532 build_by_default : opt)
1533 if opt and not is_disabler(exe)
1534 manadocs += ['sys-utils/losetup.8.adoc']
1535 exes += exe
1536 bashcompletions += ['losetup']
1537 endif
1538
1539 opt = opt and 'losetup' in static_programs
1540 exe = executable(
1541 'losetup.static',
1542 losetup_sources,
1543 include_directories : includes,
1544 link_args : ['--static'],
1545 link_with : [lib_common,
1546 lib_smartcols.get_static_lib()],
1547 install_dir : sbindir,
1548 install : opt,
1549 build_by_default : opt)
1550 if opt and not is_disabler(exe)
1551 exes += exe
1552 endif
1553
1554 opt = not get_option('build-zramctl').disabled()
1555 exe = executable(
1556 'zramctl',
1557 zramctl_sources,
1558 include_directories : includes,
1559 link_with : [lib_common,
1560 lib_smartcols],
1561 install_dir : sbindir,
1562 install : opt,
1563 build_by_default : opt)
1564 if opt and not is_disabler(exe)
1565 exes += exe
1566 manadocs += ['sys-utils/zramctl.8.adoc']
1567 bashcompletions += ['zramctl']
1568 endif
1569
1570 exe = executable(
1571 'prlimit',
1572 prlimit_sources,
1573 include_directories : includes,
1574 link_with : [lib_common,
1575 lib_smartcols],
1576 install_dir : usrbin_exec_dir,
1577 install : true)
1578 if not is_disabler(exe)
1579 exes += exe
1580 manadocs += ['sys-utils/prlimit.1.adoc']
1581 bashcompletions += ['prlimit']
1582 endif
1583
1584 exe = executable(
1585 'lsns',
1586 lsns_sources,
1587 include_directories : includes,
1588 link_with : [lib_common,
1589 lib_smartcols,
1590 lib_mount],
1591 install_dir : usrbin_exec_dir,
1592 install : true)
1593 if not is_disabler(exe)
1594 exes += exe
1595 manadocs += ['sys-utils/lsns.8.adoc']
1596 bashcompletions += ['lsns']
1597 endif
1598
1599 opt = not get_option('build-mount').disabled()
1600 exe = executable(
1601 'mount',
1602 mount_sources,
1603 include_directories : includes,
1604 link_with : [lib_common,
1605 lib_smartcols,
1606 lib_mount],
1607 dependencies : lib_selinux,
1608 install : opt,
1609 build_by_default : opt)
1610 exe2 = executable(
1611 'umount',
1612 umount_sources,
1613 include_directories : includes,
1614 link_with : [lib_common,
1615 lib_mount],
1616 install : opt,
1617 build_by_default : opt)
1618 if opt and not is_disabler(exe)
1619 exes += [exe, exe2]
1620 manadocs += ['sys-utils/fstab.5.adoc',
1621 'sys-utils/mount.8.adoc',
1622 'sys-utils/umount.8.adoc']
1623 bashcompletions += ['mount', 'umount']
1624 endif
1625
1626 opt2 = opt and 'mount' in static_programs
1627 exe = executable(
1628 'mount.static',
1629 mount_sources,
1630 include_directories : includes,
1631 link_args : ['--static'],
1632 link_with : [lib_common,
1633 lib_smartcols_static,
1634 lib_mount_static],
1635 install : opt2,
1636 build_by_default : opt2)
1637 if opt2 and not is_disabler(exe)
1638 exes += exe
1639 endif
1640
1641 opt2 = opt and 'umount' in static_programs
1642 exe = executable(
1643 'umount.static',
1644 umount_sources,
1645 include_directories : includes,
1646 link_args : ['--static'],
1647 link_with : [lib_common,
1648 lib_mount_static],
1649 install : opt2,
1650 build_by_default : opt2)
1651 if opt2 and not is_disabler(exe)
1652 exes += exe
1653 endif
1654
1655 # setuid?
1656
1657 exe = executable(
1658 'swapon',
1659 swapon_sources,
1660 include_directories : includes,
1661 link_with : [lib_common,
1662 lib_blkid,
1663 lib_mount,
1664 lib_smartcols],
1665 install_dir : sbindir,
1666 install : true)
1667 if not is_disabler(exe)
1668 exes += exe
1669 manadocs += ['sys-utils/swapon.8.adoc']
1670 bashcompletions += ['swapon']
1671 endif
1672
1673 exe = executable(
1674 'swapoff',
1675 swapoff_sources,
1676 include_directories : includes,
1677 link_with : [lib_common,
1678 lib_blkid,
1679 lib_mount],
1680 install_dir : sbindir,
1681 install : true)
1682 if not is_disabler(exe)
1683 exes += exe
1684 manlinks += {'swapoff.8': 'swapon.8'}
1685 bashcompletions += ['swapoff']
1686 endif
1687
1688 exe = executable(
1689 'lscpu',
1690 lscpu_sources,
1691 include_directories : includes,
1692 link_with : [lib_common,
1693 lib_smartcols],
1694 dependencies : [rtas_libs],
1695 install_dir : usrbin_exec_dir,
1696 install : true)
1697 if not is_disabler(exe)
1698 exes += exe
1699 manadocs += ['sys-utils/lscpu.1.adoc']
1700 bashcompletions += ['lscpu']
1701 endif
1702
1703 exe = executable(
1704 'chcpu',
1705 chcpu_sources,
1706 include_directories : includes,
1707 link_with : [lib_common],
1708 install_dir : sbindir,
1709 install : true)
1710 exes += exe
1711 manadocs += ['sys-utils/chcpu.8.adoc']
1712 bashcompletions += ['chcpu']
1713
1714 exe = executable(
1715 'wdctl',
1716 wdctl_sources,
1717 include_directories : includes,
1718 link_with : [lib_common,
1719 lib_smartcols],
1720 install : true)
1721 if not is_disabler(exe)
1722 exes += exe
1723 manadocs += ['sys-utils/wdctl.8.adoc']
1724 bashcompletions += ['wdctl']
1725 endif
1726
1727 opt = not get_option('build-mountpoint').disabled()
1728 exe = executable(
1729 'mountpoint',
1730 mountpoint_sources,
1731 include_directories : includes,
1732 link_with : [lib_mount],
1733 install : opt,
1734 build_by_default : opt)
1735 if opt and not is_disabler(exe)
1736 exes += exe
1737 manadocs += ['sys-utils/mountpoint.1.adoc']
1738 bashcompletions += ['mountpoint']
1739 endif
1740
1741 opt = not get_option('build-fallocate').disabled()
1742 exe = executable(
1743 'fallocate',
1744 fallocate_sources,
1745 include_directories : includes,
1746 link_with : [lib_common],
1747 install_dir : usrbin_exec_dir,
1748 install : opt,
1749 build_by_default : opt)
1750 if opt and not is_disabler(exe)
1751 exes += exe
1752 manadocs += ['sys-utils/fallocate.1.adoc']
1753 bashcompletions += ['fallocate']
1754 endif
1755
1756 opt = not get_option('build-pivot_root').disabled()
1757 exe = executable(
1758 'pivot_root',
1759 pivot_root_sources,
1760 include_directories : includes,
1761 install_dir : sbindir,
1762 install : opt,
1763 build_by_default : opt)
1764 if opt and not is_disabler(exe)
1765 exes += exe
1766 manadocs += ['sys-utils/pivot_root.8.adoc']
1767 bashcompletions += ['pivot_root']
1768 endif
1769
1770 opt = not get_option('build-switch_root').disabled()
1771 if opt and not have_dirfd and not have_ddfd
1772 error('neither dirfd nor ddfd are available')
1773 endif
1774 exe = executable(
1775 'switch_root',
1776 switch_root_sources,
1777 include_directories : includes,
1778 install_dir : sbindir,
1779 install : opt,
1780 build_by_default : opt)
1781 if opt and not is_disabler(exe)
1782 exes += exe
1783 manadocs += ['sys-utils/switch_root.8.adoc']
1784 endif
1785
1786 opt = not get_option('build-unshare').disabled()
1787 exe = executable(
1788 'unshare',
1789 unshare_sources,
1790 include_directories : includes,
1791 link_with : [lib_common],
1792 install_dir : usrbin_exec_dir,
1793 install : opt,
1794 build_by_default : opt)
1795 if opt and not is_disabler(exe)
1796 exes += exe
1797 manadocs += ['sys-utils/unshare.1.adoc']
1798 bashcompletions += ['unshare']
1799 endif
1800
1801 opt = opt and 'unshare' in static_programs
1802 exe = executable(
1803 'unshare.static',
1804 unshare_sources,
1805 include_directories : includes,
1806 link_with : [lib_common],
1807 install_dir : usrbin_exec_dir,
1808 install : opt,
1809 build_by_default : opt)
1810 if opt and not is_disabler(exe)
1811 exes += exe
1812 endif
1813
1814 opt = not get_option('build-nsenter').disabled()
1815 exe = executable(
1816 'nsenter',
1817 nsenter_sources,
1818 include_directories : includes,
1819 link_with : [lib_common],
1820 dependencies : [lib_selinux],
1821 install_dir : usrbin_exec_dir,
1822 install : opt,
1823 build_by_default : opt)
1824 if opt and not is_disabler(exe)
1825 exes += exe
1826 manadocs += ['sys-utils/nsenter.1.adoc']
1827 bashcompletions += ['nsenter']
1828 endif
1829
1830 opt = opt and 'nsenter' in static_programs
1831 exe = executable(
1832 'nsenter.static',
1833 nsenter_sources,
1834 include_directories : includes,
1835 link_with : [lib_common],
1836 dependencies : [lib_selinux],
1837 install_dir : usrbin_exec_dir,
1838 install : opt,
1839 build_by_default : opt)
1840 if opt and not is_disabler(exe)
1841 exes += exe
1842 endif
1843
1844 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1845 exe = executable(
1846 'setpriv',
1847 setpriv_sources,
1848 include_directories : includes,
1849 link_with : [lib_common],
1850 dependencies : [lib_cap_ng],
1851 install_dir : usrbin_exec_dir,
1852 install : opt,
1853 build_by_default : opt)
1854 if opt and not is_disabler(exe)
1855 exes += exe
1856 manadocs += ['sys-utils/setpriv.1.adoc']
1857 bashcompletions += ['setpriv']
1858 endif
1859
1860 exe = executable(
1861 'flock',
1862 flock_sources,
1863 include_directories : includes,
1864 link_with : [lib_common],
1865 dependencies : realtime_libs,
1866 install_dir : usrbin_exec_dir,
1867 install : true)
1868 exes += exe
1869 manadocs += ['sys-utils/flock.1.adoc']
1870 bashcompletions += ['flock']
1871
1872 opt = not get_option('build-lsirq').disabled()
1873 exe = executable(
1874 'lsirq',
1875 lsirq_sources,
1876 include_directories : includes,
1877 link_with : [lib_common,
1878 lib_smartcols],
1879 install_dir : usrbin_exec_dir,
1880 install : opt,
1881 build_by_default : opt)
1882 if opt and not is_disabler(exe)
1883 exes += exe
1884 manadocs += ['sys-utils/lsirq.1.adoc']
1885 bashcompletions += ['lsirq']
1886 endif
1887
1888 opt = not get_option('build-irqtop').disabled()
1889 exe = executable(
1890 'irqtop',
1891 irqtop_sources,
1892 include_directories : includes,
1893 dependencies : [realtime_libs, curses_libs],
1894 link_with : [lib_common,
1895 lib_smartcols,
1896 lib_tcolors],
1897 install_dir : usrbin_exec_dir,
1898 install : opt,
1899 build_by_default : opt)
1900 if opt and not is_disabler(exe)
1901 exes += exe
1902 manadocs += ['sys-utils/irqtop.1.adoc']
1903 bashcompletions += ['irqtop']
1904 endif
1905
1906 opt = not get_option('build-ipcs').disabled()
1907 exe = executable(
1908 'lsipc',
1909 lsipc_sources,
1910 include_directories : includes,
1911 link_with : [lib_common,
1912 lib_smartcols],
1913 install_dir : usrbin_exec_dir,
1914 install : opt,
1915 build_by_default : opt)
1916 if opt and not is_disabler(exe)
1917 exes += exe
1918 manadocs += ['sys-utils/lsipc.1.adoc']
1919 bashcompletions += ['lsipc']
1920 endif
1921
1922 opt = build_hwclock
1923 exe = executable(
1924 'hwclock',
1925 hwclock_sources,
1926 include_directories : includes,
1927 link_with : [lib_common],
1928 dependencies : [lib_m,
1929 lib_audit],
1930 install_dir : sbindir,
1931 install : opt,
1932 build_by_default : opt)
1933 if opt and not is_disabler(exe)
1934 exes += exe
1935 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
1936 bashcompletions += ['hwclock']
1937 endif
1938
1939 exe = executable(
1940 'mkfs',
1941 mkfs_sources,
1942 include_directories : includes,
1943 install_dir : sbindir,
1944 install : true)
1945 exes += exe
1946 manadocs += ['disk-utils/mkfs.8.adoc']
1947 bashcompletions += ['mkfs']
1948
1949 opt = not get_option('build-bfs').disabled()
1950 exe = executable(
1951 'mkfs.bfs',
1952 mkfs_bfs_sources,
1953 include_directories : includes,
1954 link_with : [lib_common],
1955 install_dir : sbindir,
1956 install : opt,
1957 build_by_default : opt)
1958 if opt and not is_disabler(exe)
1959 exes += exe
1960 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
1961 bashcompletions += ['mkfs.bfs']
1962 endif
1963
1964 exe = executable(
1965 'isosize',
1966 isosize_sources,
1967 include_directories : includes,
1968 link_with : [lib_common],
1969 install_dir : usrbin_exec_dir,
1970 install : true)
1971 exes += exe
1972 manadocs += ['disk-utils/isosize.8.adoc']
1973 bashcompletions += ['isosize']
1974
1975 exe = executable(
1976 'mkswap',
1977 mkswap_sources,
1978 include_directories : includes,
1979 link_with : [lib_common,
1980 lib_blkid,
1981 lib_uuid],
1982 dependencies: [lib_selinux],
1983 install_dir : sbindir,
1984 install : true)
1985 if opt and not is_disabler(exe)
1986 exes += exe
1987 manadocs += ['disk-utils/mkswap.8.adoc']
1988 bashcompletions += ['mkswap']
1989 endif
1990
1991 exe = executable(
1992 'swaplabel',
1993 swaplabel_sources,
1994 include_directories : includes,
1995 link_with : [lib_common,
1996 lib_blkid,
1997 lib_uuid],
1998 install_dir : sbindir,
1999 install : true)
2000 if opt and not is_disabler(exe)
2001 exes += exe
2002 manadocs += ['disk-utils/swaplabel.8.adoc']
2003 bashcompletions += ['swaplabel']
2004 endif
2005
2006 opt = not get_option('build-fsck').disabled()
2007 exe = executable(
2008 'fsck',
2009 fsck_sources,
2010 include_directories : includes,
2011 link_with : [lib_common,
2012 lib_blkid,
2013 lib_mount],
2014 dependencies : realtime_libs,
2015 install_dir : sbindir,
2016 install : opt,
2017 build_by_default : opt)
2018 if opt and not is_disabler(exe)
2019 exes += exe
2020 manadocs += ['disk-utils/fsck.8.adoc']
2021 bashcompletions += ['fsck']
2022 endif
2023
2024 opt = not get_option('build-minix').disabled()
2025 exe = executable(
2026 'mkfs.minix',
2027 mkfs_minix_sources,
2028 include_directories : includes,
2029 link_with : [lib_common],
2030 install_dir : sbindir,
2031 install : opt,
2032 build_by_default : opt)
2033 exe2 = executable(
2034 'test_mkfs_minix',
2035 mkfs_minix_sources,
2036 include_directories : includes,
2037 c_args : '-DTEST_SCRIPT',
2038 link_with : [lib_common],
2039 build_by_default : opt)
2040 exe3 = executable(
2041 'fsck.minix',
2042 fsck_minix_sources,
2043 include_directories : includes,
2044 link_with : [lib_common],
2045 install_dir : sbindir,
2046 install : opt,
2047 build_by_default : opt)
2048 if opt and not is_disabler(exe)
2049 exes += [exe, exe2, exe3]
2050 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2051 bashcompletions += ['mkfs.minix', 'fsck.minix']
2052 endif
2053
2054 opt = not get_option('build-cramfs').disabled()
2055 exe = executable(
2056 'mkfs.cramfs',
2057 mkfs_cramfs_sources,
2058 include_directories : includes,
2059 link_with : [lib_common],
2060 dependencies : [lib_z],
2061 install_dir : sbindir,
2062 install : opt,
2063 build_by_default : opt)
2064 exe2 = executable(
2065 'fsck.cramfs',
2066 fsck_cramfs_sources,
2067 include_directories : includes,
2068 link_with : [lib_common],
2069 dependencies : [lib_z],
2070 install_dir : sbindir,
2071 install : opt,
2072 build_by_default : opt)
2073 if not is_disabler(exe)
2074 exes += [exe, exe2]
2075 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2076 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2077 endif
2078
2079 opt = not get_option('build-raw').disabled()
2080 if opt
2081 cc.has_header('linux/raw.h', required: opt)
2082 endif
2083 exe = executable(
2084 'raw',
2085 raw_sources,
2086 include_directories : includes,
2087 install_dir : sbindir,
2088 install : opt,
2089 build_by_default : opt)
2090 if opt and not is_disabler(exe)
2091 exes += exe
2092 manadocs += ['disk-utils/raw.8.adoc']
2093 bashcompletions += ['raw']
2094 endif
2095
2096 opt = not get_option('build-fdformat').disabled()
2097 exe = executable(
2098 'fdformat',
2099 fdformat_sources,
2100 include_directories : includes,
2101 link_with : [lib_common],
2102 install_dir : usrsbin_exec_dir,
2103 install : opt,
2104 build_by_default : opt)
2105 if opt and not is_disabler(exe)
2106 exes += exe
2107 manadocs += ['disk-utils/fdformat.8.adoc']
2108 endif
2109
2110 exe = executable(
2111 'blockdev',
2112 blockdev_sources,
2113 include_directories : includes,
2114 link_with : [lib_common],
2115 install_dir : sbindir,
2116 install : true)
2117 manadocs += ['disk-utils/blockdev.8.adoc']
2118 bashcompletions += ['blockdev']
2119
2120 opt = not get_option('build-fdisks').disabled()
2121 if opt and not have_dirfd and not have_ddfd
2122 error('neither dirfd nor ddfd are available')
2123 endif
2124 exe = executable(
2125 'fdisk',
2126 fdisk_sources,
2127 include_directories : includes,
2128 link_with : [lib_common,
2129 lib_fdisk,
2130 lib_smartcols,
2131 lib_tcolors],
2132 dependencies : [lib_readline],
2133 install_dir : sbindir,
2134 install : opt,
2135 build_by_default : opt)
2136 if opt and not is_disabler(exe)
2137 exes += exe
2138 bashcompletions += ['fdisk']
2139 endif
2140
2141 opt2 = opt and 'fdisk' in static_programs
2142 exe = executable(
2143 'fdisk.static',
2144 fdisk_sources,
2145 link_args : ['--static'],
2146 include_directories : includes,
2147 link_with : [lib_common,
2148 lib_tcolors,
2149 lib_fdisk_static,
2150 lib_smartcols.get_static_lib()],
2151 dependencies : [lib_readline_static],
2152 install_dir : sbindir,
2153 install : opt2,
2154 build_by_default : opt2)
2155 if opt2 and not is_disabler(exe)
2156 exes += exe
2157 endif
2158
2159 exe = executable(
2160 'sfdisk',
2161 sfdisk_sources,
2162 include_directories : includes,
2163 link_with : [lib_common,
2164 lib_fdisk,
2165 lib_smartcols,
2166 lib_tcolors],
2167 dependencies : [lib_readline],
2168 install_dir : sbindir,
2169 install : opt,
2170 build_by_default : opt)
2171 if opt and not is_disabler(exe)
2172 exes += exe
2173 bashcompletions += ['sfdisk']
2174 endif
2175
2176 opt2 = opt and 'sfdisk' in static_programs
2177 exe = executable(
2178 'sfdisk.static',
2179 sfdisk_sources,
2180 include_directories : includes,
2181 link_with : [lib_common,
2182 lib_tcolors,
2183 lib_fdisk_static,
2184 lib_smartcols.get_static_lib()],
2185 dependencies : [lib_readline_static],
2186 install_dir : sbindir,
2187 install : opt2,
2188 build_by_default : opt2)
2189 if opt2 and not is_disabler(exe)
2190 exes += exe
2191 endif
2192
2193 exe = executable(
2194 'cfdisk',
2195 cfdisk_sources,
2196 include_directories : includes,
2197 link_with : [lib_common,
2198 lib_fdisk,
2199 lib_smartcols,
2200 lib_tcolors,
2201 lib_mount],
2202 dependencies : [curses_libs],
2203 install_dir : sbindir,
2204 install : opt,
2205 build_by_default : opt)
2206 if opt and not is_disabler(exe)
2207 exes += exe
2208 manadocs += ['disk-utils/fdisk.8.adoc',
2209 'disk-utils/sfdisk.8.adoc',
2210 'disk-utils/cfdisk.8.adoc']
2211 bashcompletions += ['cfdisk']
2212 endif
2213
2214 opt = not get_option('build-partx').disabled()
2215 exe = executable(
2216 'addpart',
2217 addpart_sources,
2218 include_directories : includes,
2219 link_with : [lib_common],
2220 install_dir : usrsbin_exec_dir,
2221 install : opt,
2222 build_by_default : opt)
2223 exe2 = executable(
2224 'delpart',
2225 delpart_sources,
2226 include_directories : includes,
2227 link_with : [lib_common],
2228 install_dir : usrsbin_exec_dir,
2229 install : opt,
2230 build_by_default : opt)
2231 exe3 = executable(
2232 'resizepart',
2233 resizepart_sources,
2234 include_directories : includes,
2235 link_with : [lib_common],
2236 install_dir : usrsbin_exec_dir,
2237 install : opt,
2238 build_by_default : opt)
2239 exe4 = executable(
2240 'partx',
2241 partx_sources,
2242 include_directories : includes,
2243 link_with : [lib_common,
2244 lib_blkid,
2245 lib_smartcols],
2246 install_dir : usrsbin_exec_dir,
2247 install : opt,
2248 build_by_default : opt)
2249 if opt
2250 exes += [exe, exe2, exe3, exe4]
2251 manadocs += ['disk-utils/addpart.8.adoc',
2252 'disk-utils/delpart.8.adoc',
2253 'disk-utils/resizepart.8.adoc',
2254 'disk-utils/partx.8.adoc']
2255 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2256 endif
2257
2258 ############################################################
2259
2260 exe = executable(
2261 'script',
2262 script_sources,
2263 include_directories : includes,
2264 link_with : [lib_common],
2265 dependencies : [lib_util,
2266 lib_utempter,
2267 realtime_libs,
2268 math_libs],
2269 install_dir : usrbin_exec_dir,
2270 install : true)
2271 exes += exe
2272 manadocs += ['term-utils/script.1.adoc']
2273 bashcompletions += ['script']
2274
2275 exe = executable(
2276 'test_script',
2277 script_sources,
2278 include_directories : includes,
2279 c_args : '-DTEST_SCRIPT',
2280 link_with : [lib_common],
2281 dependencies : [lib_util,
2282 lib_utempter,
2283 realtime_libs,
2284 math_libs])
2285 exes += exe
2286
2287 exe = executable(
2288 'scriptlive',
2289 scriptlive_sources,
2290 include_directories : includes,
2291 link_with : [lib_common],
2292 dependencies : [lib_util,
2293 realtime_libs,
2294 math_libs],
2295 install_dir : usrbin_exec_dir,
2296 install : true)
2297 exes += exe
2298 manadocs += ['term-utils/scriptlive.1.adoc']
2299 bashcompletions += ['scriptlive']
2300
2301 exe = executable(
2302 'scriptreplay',
2303 scriptreplay_sources,
2304 include_directories : includes,
2305 link_with : [lib_common],
2306 dependencies : [math_libs],
2307 install_dir : usrbin_exec_dir,
2308 install : true)
2309 exes += exe
2310 manadocs += ['term-utils/scriptreplay.1.adoc']
2311 bashcompletions += ['scriptreplay']
2312
2313 opt = not get_option('build-agetty').disabled()
2314 exe = executable(
2315 'agetty',
2316 agetty_sources,
2317 include_directories : includes,
2318 link_with : [lib_common, logindefs_c],
2319 dependencies : BSD ? lib_util : [],
2320 install_dir : sbindir,
2321 install : opt,
2322 build_by_default : opt)
2323 if opt
2324 exes += exe
2325 manadocs += ['term-utils/agetty.8.adoc']
2326 endif
2327
2328 opt = not get_option('build-setterm').disabled()
2329 exe = executable(
2330 'setterm',
2331 setterm_sources,
2332 include_directories : includes,
2333 link_with : [lib_common],
2334 dependencies : [curses_libs],
2335 install_dir : usrbin_exec_dir,
2336 install : opt,
2337 build_by_default : opt)
2338 if opt
2339 exes += exe
2340 manadocs += ['term-utils/setterm.1.adoc']
2341 bashcompletions += ['setterm']
2342 endif
2343
2344 opt = not get_option('build-mesg').disabled()
2345 exe = executable(
2346 'mesg',
2347 mesg_sources,
2348 include_directories : includes,
2349 link_with : [lib_common],
2350 install_dir : usrbin_exec_dir,
2351 install : opt,
2352 build_by_default : opt)
2353 if opt
2354 exes += exe
2355 manadocs += ['term-utils/mesg.1.adoc']
2356 bashcompletions += ['mesg']
2357 endif
2358
2359 opt = not get_option('build-wall').disabled()
2360 exe = executable(
2361 'wall',
2362 wall_sources,
2363 include_directories : includes,
2364 link_with : [lib_common],
2365 install_dir : usrbin_exec_dir,
2366 install : opt,
2367 build_by_default : opt)
2368 if opt
2369 exes += exe
2370 manadocs += ['term-utils/wall.1.adoc']
2371 bashcompletions += ['wall']
2372 endif
2373
2374 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2375 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2376
2377 opt = not get_option('build-write').disabled()
2378 exe = executable(
2379 'write',
2380 write_sources,
2381 include_directories : includes,
2382 link_with : [lib_common],
2383 install_dir : usrbin_exec_dir,
2384 install : opt,
2385 build_by_default : opt)
2386 if opt
2387 exes += exe
2388 manadocs += ['term-utils/write.1.adoc']
2389 endif
2390
2391 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2392 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2393
2394 opt = not get_option('build-login').disabled()
2395 exe = executable(
2396 'login',
2397 login_sources,
2398 include_directories : includes,
2399 link_with : [lib_common, logindefs_c],
2400 dependencies : [lib_pam,
2401 lib_audit,
2402 lib_selinux],
2403 install : opt,
2404 build_by_default : opt)
2405 if not is_disabler(exe)
2406 exes += exe
2407 manadocs += ['login-utils/login.1.adoc']
2408 endif
2409
2410 opt = not get_option('build-sulogin').disabled()
2411 exe = executable(
2412 'sulogin',
2413 sulogin_sources,
2414 include_directories : includes,
2415 link_with : [lib_common],
2416 dependencies : [lib_crypt,
2417 lib_selinux],
2418 install_dir : sbindir,
2419 install : opt,
2420 build_by_default : opt)
2421 if not is_disabler(exe)
2422 exes += exe
2423 manadocs += ['login-utils/sulogin.8.adoc']
2424 endif
2425
2426 exe = executable(
2427 'cal',
2428 cal_sources,
2429 include_directories : includes,
2430 link_with : [lib_common,
2431 lib_tcolors],
2432 dependencies : [curses_libs],
2433 install_dir : usrbin_exec_dir,
2434 install : true)
2435 exes += exe
2436 manadocs += ['misc-utils/cal.1.adoc']
2437 bashcompletions += ['cal']
2438
2439 opt = not get_option('build-logger').disabled()
2440 exe = executable(
2441 'logger',
2442 logger_sources,
2443 include_directories : includes,
2444 link_with : [lib_common],
2445 dependencies : [lib_systemd],
2446 install_dir : usrbin_exec_dir,
2447 install : opt,
2448 build_by_default : opt)
2449 if opt and not is_disabler(exe)
2450 exes += exe
2451 manadocs += ['misc-utils/logger.1.adoc']
2452 bashcompletions += ['logger']
2453 endif
2454
2455 exe = executable(
2456 'test_logger',
2457 logger_sources,
2458 include_directories : includes,
2459 c_args : '-DTEST_LOGGER',
2460 link_with : [lib_common],
2461 dependencies : [lib_systemd])
2462 if not is_disabler(exe)
2463 exes += exe
2464 endif
2465
2466 exe = executable(
2467 'look',
2468 look_sources,
2469 include_directories : includes,
2470 install_dir : usrbin_exec_dir,
2471 install : true)
2472 exes += exe
2473 manadocs += ['misc-utils/look.1.adoc']
2474 bashcompletions += ['look']
2475
2476 exe = executable(
2477 'mcookie',
2478 mcookie_sources,
2479 include_directories : includes,
2480 link_with : [lib_common],
2481 install_dir : usrbin_exec_dir,
2482 install : true)
2483 exes += exe
2484 manadocs += ['misc-utils/mcookie.1.adoc']
2485 bashcompletions += ['mcookie']
2486
2487 exe = executable(
2488 'namei',
2489 namei_sources,
2490 include_directories : includes,
2491 dependencies : [lib_selinux],
2492 install_dir : usrbin_exec_dir,
2493 install : true)
2494 exes += exe
2495 manadocs += ['misc-utils/namei.1.adoc']
2496 bashcompletions += ['namei']
2497
2498 exe = executable(
2499 'whereis',
2500 whereis_sources,
2501 include_directories : includes,
2502 link_with : [lib_common],
2503 install_dir : usrbin_exec_dir,
2504 install : true)
2505 exes += exe
2506 manadocs += ['misc-utils/whereis.1.adoc']
2507 bashcompletions += ['whereis']
2508
2509 exe = executable(
2510 'lslocks',
2511 lslocks_sources,
2512 include_directories : includes,
2513 link_with : [lib_common,
2514 lib_mount,
2515 lib_smartcols],
2516 install_dir : usrbin_exec_dir,
2517 install : true)
2518 if not is_disabler(exe)
2519 exes += exe
2520 manadocs += ['misc-utils/lslocks.8.adoc']
2521 bashcompletions += ['lslocks']
2522 endif
2523
2524 exe = executable(
2525 'lsblk',
2526 lsblk_sources,
2527 include_directories : includes,
2528 link_with : [lib_common,
2529 lib_blkid,
2530 lib_mount,
2531 lib_smartcols],
2532 dependencies : lib_udev,
2533 install : true)
2534 if not is_disabler(exe)
2535 exes += exe
2536 manadocs += ['misc-utils/lsblk.8.adoc']
2537 bashcompletions += ['lsblk']
2538 endif
2539
2540 exe = executable(
2541 'lsfd',
2542 lsfd_sources,
2543 include_directories : includes,
2544 link_with : [lib_common,
2545 lib_smartcols],
2546 install_dir : usrbin_exec_dir,
2547 install : true)
2548 if not is_disabler(exe)
2549 exes += exe
2550 manadocs += ['misc-utils/lsfd.1.adoc']
2551 endif
2552
2553 exe = executable(
2554 'uuidgen',
2555 uuidgen_sources,
2556 include_directories : includes,
2557 link_with : [lib_uuid],
2558 install_dir : usrbin_exec_dir,
2559 install : true)
2560 if not is_disabler(exe)
2561 exes += exe
2562 manadocs += ['misc-utils/uuidgen.1.adoc']
2563 bashcompletions += ['uuidgen']
2564 endif
2565
2566 exe = executable(
2567 'uuidparse',
2568 uuidparse_sources,
2569 include_directories : includes,
2570 link_with : [lib_common,
2571 lib_uuid,
2572 lib_smartcols],
2573 install_dir : usrbin_exec_dir,
2574 install : true)
2575 if not is_disabler(exe)
2576 exes += exe
2577 manadocs += ['misc-utils/uuidparse.1.adoc']
2578 bashcompletions += ['uuidparse']
2579 endif
2580
2581 opt = build_uuidd
2582 exe = executable(
2583 'uuidd',
2584 uuidd_sources,
2585 include_directories : includes,
2586 link_with : [lib_common,
2587 lib_uuid],
2588 dependencies : [realtime_libs,
2589 lib_systemd],
2590 install_dir : usrsbin_exec_dir,
2591 install : opt,
2592 build_by_default : opt)
2593 exe2 = executable(
2594 'test_uuidd',
2595 test_uuidd_sources,
2596 include_directories : includes,
2597 link_with : [lib_common,
2598 lib_uuid],
2599 dependencies : thread_libs,
2600 build_by_default : opt)
2601 if not is_disabler(exe)
2602 exes += [exe, exe2]
2603 manadocs += ['misc-utils/uuidd.8.adoc']
2604 bashcompletions += ['uuidd']
2605 endif
2606
2607 opt = build_libblkid
2608 exe = executable(
2609 'blkid',
2610 blkid_sources,
2611 include_directories : includes,
2612 link_with : [lib_common,
2613 lib_blkid],
2614 install_dir : sbindir,
2615 install : opt,
2616 build_by_default : opt)
2617 if opt and not is_disabler(exe)
2618 exes += exe
2619 manadocs += ['misc-utils/blkid.8.adoc']
2620 bashcompletions += ['blkid']
2621 endif
2622
2623 opt = opt and 'blkid' in static_programs
2624 exe = executable(
2625 'blkid.static',
2626 blkid_sources,
2627 include_directories : includes,
2628 link_with : [lib_common,
2629 lib_blkid_static],
2630 install_dir : sbindir,
2631 install : opt,
2632 build_by_default : opt)
2633 if opt and not is_disabler(exe)
2634 exes += exe
2635 endif
2636
2637 exe = executable(
2638 'sample-mkfs',
2639 'libblkid/samples/mkfs.c',
2640 include_directories : includes,
2641 link_with : lib_blkid)
2642 if not is_disabler(exe)
2643 exes += exe
2644 endif
2645
2646 exe = executable(
2647 'sample-partitions',
2648 'libblkid/samples/partitions.c',
2649 include_directories : includes,
2650 link_with : lib_blkid)
2651 if not is_disabler(exe)
2652 exes += exe
2653 endif
2654
2655 exe = executable(
2656 'sample-superblocks',
2657 'libblkid/samples/superblocks.c',
2658 include_directories : includes,
2659 link_with : lib_blkid)
2660 if not is_disabler(exe)
2661 exes += exe
2662 endif
2663
2664 exe = executable(
2665 'sample-topology',
2666 'libblkid/samples/topology.c',
2667 include_directories : includes,
2668 link_with : lib_blkid)
2669 if not is_disabler(exe)
2670 exes += exe
2671 endif
2672
2673 exe = executable(
2674 'test_blkid_fuzz_sample',
2675 'libblkid/src/fuzz.c',
2676 include_directories: includes,
2677 link_with: lib_blkid)
2678 if not is_disabler(exe)
2679 exes += exe
2680 endif
2681
2682 ############################################################
2683
2684 exe = executable(
2685 'findfs',
2686 findfs_sources,
2687 include_directories : includes,
2688 link_with : [lib_blkid],
2689 install_dir : sbindir,
2690 install : true)
2691 if not is_disabler(exe)
2692 exes += exe
2693 manadocs += ['misc-utils/findfs.8.adoc']
2694 bashcompletions += ['findfs']
2695 endif
2696
2697 exe = executable(
2698 'wipefs',
2699 wipefs_sources,
2700 include_directories : includes,
2701 link_with : [lib_common,
2702 lib_blkid,
2703 lib_smartcols],
2704 install_dir : sbindir,
2705 install : true)
2706 if not is_disabler(exe)
2707 exes += exe
2708 manadocs += ['misc-utils/wipefs.8.adoc']
2709 bashcompletions += ['wipefs']
2710 endif
2711
2712 exe = executable(
2713 'findmnt',
2714 findmnt_sources,
2715 include_directories : includes,
2716 link_with : [lib_common,
2717 lib_blkid,
2718 lib_mount,
2719 lib_smartcols],
2720 dependencies : [lib_udev],
2721 install : true)
2722 if not is_disabler(exe)
2723 exes += exe
2724 manadocs += ['misc-utils/findmnt.8.adoc']
2725 bashcompletions += ['findmnt']
2726 endif
2727
2728 exe = executable(
2729 'kill',
2730 kill_sources,
2731 include_directories : includes,
2732 link_with : [lib_common],
2733 install : true)
2734 if not is_disabler(exe)
2735 exes += exe
2736 manadocs += ['misc-utils/kill.1.adoc']
2737 endif
2738
2739 opt = not get_option('build-rename').disabled()
2740 exe = executable(
2741 'rename',
2742 rename_sources,
2743 include_directories : includes,
2744 install_dir : usrbin_exec_dir,
2745 install : opt,
2746 build_by_default : opt)
2747 if opt and not is_disabler(exe)
2748 exes += exe
2749 manadocs += ['misc-utils/rename.1.adoc']
2750 bashcompletions += ['rename']
2751 endif
2752
2753 exe = executable(
2754 'getopt',
2755 getopt_sources,
2756 include_directories : includes,
2757 link_with : [lib_common],
2758 install_dir : usrbin_exec_dir,
2759 install : true)
2760 exes += exe
2761 manadocs += ['misc-utils/getopt.1.adoc']
2762 bashcompletions += ['getopt']
2763
2764 exe = executable(
2765 'fincore',
2766 fincore_sources,
2767 include_directories : includes,
2768 link_with : [lib_common,
2769 lib_smartcols],
2770 install_dir : usrbin_exec_dir,
2771 install : true)
2772 if not is_disabler(exe)
2773 exes += exe
2774 manadocs += ['misc-utils/fincore.1.adoc']
2775 bashcompletions += ['fincore']
2776 endif
2777
2778 exe = executable(
2779 'hardlink',
2780 hardlink_sources,
2781 include_directories : includes,
2782 link_with : [lib_common],
2783 install_dir : usrbin_exec_dir,
2784 install : true)
2785 if not is_disabler(exe)
2786 exes += exe
2787 manadocs += ['misc-utils/hardlink.1.adoc']
2788 bashcompletions += ['hardlink']
2789 endif
2790
2791 opt = not get_option('build-pipesz').disabled()
2792 exe = executable(
2793 'pipesz',
2794 pipesz_sources,
2795 include_directories : includes,
2796 link_with : [lib_common],
2797 install_dir : usrbin_exec_dir,
2798 install : true)
2799 if opt and not is_disabler(exe)
2800 exes += exe
2801 manadocs += ['misc-utils/pipesz.1.adoc']
2802 bashcompletions += ['pipesz']
2803 endif
2804
2805 exe = executable(
2806 'test_cal',
2807 cal_sources,
2808 include_directories : includes,
2809 c_args : '-DTEST_CAL',
2810 link_with : [lib_common,
2811 lib_tcolors],
2812 dependencies : [curses_libs])
2813 if not is_disabler(exe)
2814 exes += exe
2815 endif
2816
2817 exe = executable(
2818 'fadvise',
2819 fadvise_sources,
2820 include_directories : includes,
2821 link_with : [lib_common],
2822 install_dir : usrbin_exec_dir,
2823 install : true)
2824 if not is_disabler(exe)
2825 exes += exe
2826 manadocs += ['misc-utils/fadvise.1.adoc']
2827 bashcompletions += ['fadvise']
2828 endif
2829
2830 exe = executable(
2831 'waitpid',
2832 waitpid_sources,
2833 include_directories : includes,
2834 link_with : [lib_common],
2835 install_dir : usrbin_exec_dir,
2836 install : true)
2837 if not is_disabler(exe)
2838 exes += exe
2839 manadocs += ['misc-utils/waitpid.1.adoc']
2840 bashcompletions += ['waitpid']
2841 endif
2842
2843 ############################################################
2844
2845 opt = not get_option('build-schedutils').disabled()
2846 exe = executable(
2847 'chrt',
2848 'schedutils/chrt.c',
2849 include_directories : includes,
2850 link_with : lib_common,
2851 install_dir : usrbin_exec_dir,
2852 install : opt,
2853 build_by_default : opt)
2854
2855 exe2 = executable(
2856 'ionice',
2857 'schedutils/ionice.c',
2858 include_directories : includes,
2859 link_with : lib_common,
2860 install_dir : usrbin_exec_dir,
2861 install : opt,
2862 build_by_default : opt)
2863
2864 exe3 = executable(
2865 'taskset',
2866 'schedutils/taskset.c',
2867 include_directories : includes,
2868 link_with : lib_common,
2869 install_dir : usrbin_exec_dir,
2870 install : opt,
2871 build_by_default : opt)
2872
2873 exe4 = executable(
2874 'uclampset',
2875 'schedutils/uclampset.c',
2876 include_directories : includes,
2877 link_with : lib_common,
2878 install_dir : usrbin_exec_dir,
2879 install : opt,
2880 build_by_default : opt)
2881
2882 if opt and not is_disabler(exe)
2883 exes += [exe, exe2, exe3, exe4]
2884 manadocs += ['schedutils/chrt.1.adoc',
2885 'schedutils/ionice.1.adoc',
2886 'schedutils/taskset.1.adoc',
2887 'schedutils/uclampset.1.adoc']
2888 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
2889 endif
2890
2891 ############################################################
2892
2893 # TODO: when autotools compat is not needed, s/_/-/g in file names?
2894
2895 exe = executable(
2896 'test_ttyutils',
2897 'lib/ttyutils.c',
2898 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
2899 include_directories : dir_include,
2900 link_with : lib_common)
2901 exes += exe
2902
2903 exe = executable(
2904 'test_blkdev',
2905 'lib/blkdev.c',
2906 c_args : ['-DTEST_PROGRAM_BLKDEV'],
2907 include_directories : dir_include,
2908 link_with : lib_common)
2909 exes += exe
2910
2911 exe = executable(
2912 'test_ismounted',
2913 'lib/ismounted.c',
2914 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
2915 include_directories : dir_include,
2916 link_with : lib_common)
2917 exes += exe
2918
2919 exe = executable(
2920 'test_mangle',
2921 'lib/mangle.c',
2922 c_args : ['-DTEST_PROGRAM_MANGLE'],
2923 include_directories : dir_include)
2924 exes += exe
2925
2926 exe = executable(
2927 'test_strutils',
2928 'lib/strutils.c',
2929 c_args : ['-DTEST_PROGRAM_STRUTILS'],
2930 include_directories : dir_include)
2931 exes += exe
2932
2933 exe = executable(
2934 'test_colors',
2935 'lib/colors.c',
2936 'lib/color-names.c',
2937 c_args : ['-DTEST_PROGRAM_COLORS'],
2938 include_directories : dir_include,
2939 link_with : [lib_common, lib_tcolors])
2940 exes += exe
2941
2942 exe = executable(
2943 'test_randutils',
2944 'lib/randutils.c',
2945 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
2946 include_directories : dir_include)
2947 exes += exe
2948
2949 # XXX: HAVE_OPENAT && HAVE_DIRFD
2950 exe = executable(
2951 'test_procfs',
2952 'lib/procfs.c',
2953 c_args : ['-DTEST_PROGRAM_PROCFS'],
2954 include_directories : dir_include,
2955 link_with : lib_common)
2956 exes += exe
2957
2958 # XXX: HAVE_OPENAT && HAVE_DIRFD
2959 exe = executable(
2960 'test_path',
2961 'lib/path.c',
2962 'lib/fileutils.c',
2963 have_cpu_set_t ? 'lib/cpuset.c' : [],
2964 c_args : ['-DTEST_PROGRAM_PATH'],
2965 include_directories : dir_include,
2966 link_with : lib_common)
2967 exes += exe
2968
2969 # XXX: HAVE_PTY
2970 exe = executable(
2971 'test_pty',
2972 pty_session_c,
2973 monotonic_c,
2974 c_args : ['-DTEST_PROGRAM_PTY'],
2975 include_directories : dir_include,
2976 link_with : [lib_common],
2977 dependencies : [lib_m,
2978 realtime_libs,
2979 lib_util])
2980 exes += exe
2981
2982 # XXX: LINUX
2983 exe = executable(
2984 'test_cpuset',
2985 'lib/cpuset.c',
2986 c_args : ['-DTEST_PROGRAM_CPUSET'],
2987 include_directories : dir_include)
2988 exes += exe
2989
2990 exe = executable(
2991 'test_sysfs',
2992 'lib/sysfs.c',
2993 'lib/path.c',
2994 'lib/buffer.c',
2995 'lib/mbsalign.c',
2996 'lib/fileutils.c',
2997 have_cpu_set_t ? 'lib/cpuset.c' : [],
2998 c_args : ['-DTEST_PROGRAM_SYSFS'],
2999 include_directories : dir_include)
3000 exes += exe
3001
3002 exe = executable(
3003 'test_pager',
3004 'lib/pager.c',
3005 c_args : ['-DTEST_PROGRAM_PAGER'],
3006 include_directories : dir_include)
3007 exes += exe
3008
3009 exe = executable(
3010 'test_linux_version',
3011 'lib/linux_version.c',
3012 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3013 include_directories : dir_include)
3014 exes += exe
3015
3016 exe = executable(
3017 'test_fileutils',
3018 'lib/fileutils.c',
3019 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3020 include_directories : dir_include)
3021 exes += exe
3022
3023 exe = executable(
3024 'test_canonicalize',
3025 'lib/canonicalize.c',
3026 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3027 include_directories : dir_include)
3028 exes += exe
3029
3030 exe = executable(
3031 'test_timeutils',
3032 'lib/timeutils.c',
3033 'lib/strutils.c',
3034 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3035 include_directories : dir_include)
3036 exes += exe
3037
3038 exe = executable(
3039 'test_pwdutils',
3040 'lib/pwdutils.c',
3041 c_args : ['-DTEST_PROGRAM'],
3042 include_directories : dir_include,
3043 link_with : lib_common)
3044 exes += exe
3045
3046 exe = executable(
3047 'test_logindefs',
3048 'lib/logindefs.c',
3049 c_args : ['-DTEST_PROGRAM'],
3050 include_directories : dir_include,
3051 link_with : [lib_common, logindefs_c])
3052 exes += exe
3053
3054
3055 ############################################################
3056
3057 exe = executable(
3058 'test_uuid_parser',
3059 'libuuid/src/test_uuid.c',
3060 include_directories : [dir_include, dir_libuuid],
3061 link_with : lib_uuid,
3062 dependencies : socket_libs)
3063 if not is_disabler(exe)
3064 exes += exe
3065 endif
3066
3067 ############################################################
3068
3069 libfdisk_tests_cflags = ['-DTEST_PROGRAM',
3070 '-Wno-unused']
3071 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3072
3073 exe = executable(
3074 'test_fdisk_ask',
3075 'libfdisk/src/ask.c',
3076 c_args : libfdisk_tests_cflags,
3077 include_directories : lib_fdisk_includes,
3078 link_with : libfdisk_tests_ldadd)
3079 if not is_disabler(exe)
3080 exes += exe
3081 endif
3082
3083 exe = executable(
3084 'test_fdisk_gpt',
3085 'libfdisk/src/gpt.c',
3086 c_args : libfdisk_tests_cflags,
3087 include_directories : lib_fdisk_includes,
3088 link_with : libfdisk_tests_ldadd)
3089 if not is_disabler(exe)
3090 exes += exe
3091 endif
3092
3093 exe = executable(
3094 'test_fdisk_utils',
3095 'libfdisk/src/utils.c',
3096 c_args : libfdisk_tests_cflags,
3097 include_directories : lib_fdisk_includes,
3098 link_with : libfdisk_tests_ldadd)
3099 if not is_disabler(exe)
3100 exes += exe
3101 endif
3102
3103 exe = executable(
3104 'test_fdisk_script',
3105 'libfdisk/src/script.c',
3106 c_args : libfdisk_tests_cflags,
3107 include_directories : lib_fdisk_includes,
3108 link_with : libfdisk_tests_ldadd)
3109 if not is_disabler(exe)
3110 exes += exe
3111 endif
3112
3113 exe = executable(
3114 'test_fdisk_version',
3115 'libfdisk/src/version.c',
3116 c_args : libfdisk_tests_cflags,
3117 include_directories : lib_fdisk_includes,
3118 link_with : libfdisk_tests_ldadd)
3119 if not is_disabler(exe)
3120 exes += exe
3121 endif
3122
3123 exe = executable(
3124 'test_fdisk_item',
3125 'libfdisk/src/item.c',
3126 c_args : libfdisk_tests_cflags,
3127 include_directories : lib_fdisk_includes,
3128 link_with : libfdisk_tests_ldadd)
3129 if not is_disabler(exe)
3130 exes += exe
3131 endif
3132
3133 sample_fdisk_cflags = ['-Wno-unused']
3134 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3135
3136 exe = executable(
3137 'sample-fdisk-mkpart',
3138 'libfdisk/samples/mkpart.c',
3139 c_args : sample_fdisk_cflags,
3140 include_directories : lib_fdisk_includes,
3141 link_with : sample_fdisk_ldadd)
3142 if not is_disabler(exe)
3143 exes += exe
3144 endif
3145
3146 exe = executable(
3147 'sample-fdisk-mkpart-fullspec',
3148 'libfdisk/samples/mkpart-fullspec.c',
3149 c_args : sample_fdisk_cflags,
3150 include_directories : lib_fdisk_includes,
3151 link_with : sample_fdisk_ldadd)
3152 if not is_disabler(exe)
3153 exes += exe
3154 endif
3155
3156 ############################################################
3157
3158 exe = executable(
3159 'test_mbsencode',
3160 'tests/helpers/test_mbsencode.c',
3161 include_directories : includes,
3162 link_with : lib_common)
3163 exes += exe
3164
3165 exe = executable(
3166 'test_byteswap',
3167 'tests/helpers/test_byteswap.c',
3168 include_directories : includes)
3169 exes += exe
3170
3171 exe = executable(
3172 'test_md5',
3173 'tests/helpers/test_md5.c',
3174 md5_c,
3175 include_directories : includes)
3176 exes += exe
3177
3178 exe = executable(
3179 'test_sha1',
3180 'tests/helpers/test_sha1.c',
3181 sha1_c,
3182 include_directories : includes)
3183 exes += exe
3184
3185 exe = executable(
3186 'test_pathnames',
3187 'tests/helpers/test_pathnames.c',
3188 include_directories : includes)
3189 exes += exe
3190
3191 exe = executable(
3192 'test_strerror',
3193 'tests/helpers/test_strerror.c',
3194 include_directories : includes)
3195 exes += exe
3196
3197 exe = executable(
3198 'test_sysinfo',
3199 'tests/helpers/test_sysinfo.c',
3200 include_directories : includes)
3201 exes += exe
3202
3203 exe = executable(
3204 'test_sigreceive',
3205 'tests/helpers/test_sigreceive.c',
3206 include_directories : includes,
3207 link_with : lib_common)
3208 exes += exe
3209
3210 exe = executable(
3211 'test_tiocsti',
3212 'tests/helpers/test_tiocsti.c',
3213 include_directories : includes)
3214 exes += exe
3215
3216 exe = executable(
3217 'test_uuid_namespace',
3218 'tests/helpers/test_uuid_namespace.c',
3219 predefined_c,
3220 unpack_c,
3221 unparse_c,
3222 include_directories : includes)
3223 exes += exe
3224
3225 # XXX: LINUX
3226 exe = executable(
3227 'test_mkfds',
3228 'tests/helpers/test_mkfds.c',
3229 include_directories : includes)
3230 exes += exe
3231
3232 exe = executable(
3233 'test_enosys',
3234 'tests/helpers/test_enosys.c',
3235 include_directories : includes)
3236 exes += exe
3237
3238 ############################################################
3239
3240 # XXX: HAVE_OPENAT
3241 exe = executable(
3242 'sample-scols-tree',
3243 'libsmartcols/samples/tree.c',
3244 include_directories : includes,
3245 link_with : [lib_smartcols, lib_common])
3246 if not is_disabler(exe)
3247 exes += exe
3248 endif
3249
3250 exe = executable(
3251 'sample-scols-title',
3252 'libsmartcols/samples/title.c',
3253 include_directories : includes,
3254 link_with : [lib_smartcols, lib_common])
3255 if not is_disabler(exe)
3256 exes += exe
3257 endif
3258
3259 exe = executable(
3260 'sample-scols-wrap',
3261 'libsmartcols/samples/wrap.c',
3262 include_directories : includes,
3263 link_with : [lib_smartcols, lib_common])
3264 if not is_disabler(exe)
3265 exes += exe
3266 endif
3267
3268 exe = executable(
3269 'sample-scols-continuous',
3270 'libsmartcols/samples/continuous.c',
3271 include_directories : includes,
3272 link_with : [lib_smartcols, lib_common])
3273 if not is_disabler(exe)
3274 exes += exe
3275 endif
3276
3277 exe = executable(
3278 'sample-scols-maxout',
3279 'libsmartcols/samples/maxout.c',
3280 include_directories : includes,
3281 link_with : [lib_smartcols, lib_common])
3282 if not is_disabler(exe)
3283 exes += exe
3284 endif
3285
3286 exe = executable(
3287 'sample-scols-fromfile',
3288 'libsmartcols/samples/fromfile.c',
3289 include_directories : includes,
3290 link_with : [lib_smartcols, lib_common])
3291 if not is_disabler(exe)
3292 exes += exe
3293 endif
3294
3295 exe = executable(
3296 'sample-scols-grouping-simple',
3297 'libsmartcols/samples/grouping-simple.c',
3298 include_directories : includes,
3299 link_with : [lib_smartcols, lib_common])
3300 if not is_disabler(exe)
3301 exes += exe
3302 endif
3303
3304 exe = executable(
3305 'sample-scols-grouping-overlay',
3306 'libsmartcols/samples/grouping-overlay.c',
3307 include_directories : includes,
3308 link_with : [lib_smartcols, lib_common])
3309 if not is_disabler(exe)
3310 exes += exe
3311 endif
3312
3313 ############################################################
3314
3315 # Let the test runner know whether we're running under asan and export
3316 # some paths. We use a file on disk so that it is possible to run the
3317 # test scripts from commandline without setting any variables.
3318 configure_file(output : 'meson.conf',
3319 capture : true,
3320 command : ['echo',
3321 '''asan=@0@
3322 PYTHON=@1@
3323 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3324 python.path())])
3325
3326 run_sh = find_program('tests/run.sh')
3327 run_target(
3328 'check',
3329 command : [run_sh,
3330 '--srcdir=' + meson.current_source_dir(),
3331 '--builddir=' + meson.current_build_dir(),
3332 '--parallel',
3333 '--nonroot'],
3334 depends : exes)
3335
3336
3337 manadocs += ['lib/terminal-colors.d.5.adoc']
3338 manadocs += ['libblkid/libblkid.3.adoc']
3339
3340 if build_libuuid
3341 manadocs += [
3342 'libuuid/man/uuid.3.adoc',
3343 'libuuid/man/uuid_clear.3.adoc',
3344 'libuuid/man/uuid_compare.3.adoc',
3345 'libuuid/man/uuid_copy.3.adoc',
3346 'libuuid/man/uuid_generate.3.adoc',
3347 'libuuid/man/uuid_is_null.3.adoc',
3348 'libuuid/man/uuid_parse.3.adoc',
3349 'libuuid/man/uuid_time.3.adoc',
3350 'libuuid/man/uuid_unparse.3.adoc']
3351 manlinks += {
3352 'uuid_generate_random.3': 'uuid_generate.3',
3353 'uuid_generate_time.3': 'uuid_generate.3',
3354 'uuid_generate_time_safe.3': 'uuid_generate.3',
3355 }
3356 endif
3357
3358 asciidoctor = find_program('asciidoctor', required : false)
3359 if asciidoctor.found()
3360 foreach adoc : manadocs
3361 name = adoc.split('/')[-1]
3362 page = name.split('.adoc')[0]
3363 section = page.split('.')[-1]
3364 mandirn = join_paths(mandir, 'man' + section)
3365 input = adoc
3366
3367 custom_target(
3368 page,
3369 command : [ asciidoctor,
3370 '-b', 'manpage',
3371 '-a', 'VERSION=' + meson.project_version(),
3372 '-a', 'release-version=' + meson.project_version(),
3373 '-a', 'ADJTIME_PATH=/etc/adjtime',
3374 '-a', 'package-docdir=' + docdir,
3375 '--base-dir=' + meson.current_source_dir(),
3376 '--destination-dir=' + meson.current_build_dir(),
3377 '--load-path', '@SOURCE_ROOT@/tools',
3378 '--require', 'asciidoctor-includetracker',
3379 '@INPUT@'],
3380 input : input,
3381 output : [page],
3382 depfile : page + '.deps',
3383 install: true,
3384 install_dir : mandirn)
3385 endforeach
3386
3387 foreach link_name, target : manlinks
3388 link_section = link_name.split('.')[-1]
3389 target_section = target.split('.')[-1]
3390 meson.add_install_script(meson_make_manpage_stub,
3391 join_paths('man' + target_section, target),
3392 join_paths(mandir, 'man' + link_section, link_name))
3393 endforeach
3394 endif
3395
3396 if bash_completion.found()
3397 foreach completion : bashcompletions
3398 install_data(
3399 join_paths('bash-completion', completion),
3400 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3401 )
3402 endforeach
3403 foreach link_name, target : bashcompletionslinks
3404 meson.add_install_script(meson_make_symlink,
3405 target,
3406 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))
3407 endforeach
3408 endif