]> git.ipfire.org Git - thirdparty/util-linux.git/blob - meson.build
include: improve statx fallback
[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 build_plymouth_support = get_option('build-plymouth-support')
696 have_tiocglcktrmios = cc.has_header_symbol(
697 'sys/ioctl.h', 'TIOCGLCKTRMIOS',
698 required : build_plymouth_support.enabled())
699 have_sock_cloexec = cc.has_header_symbol(
700 'sys/socket.h', 'SOCK_CLOEXEC',
701 prefix : '#include <sys/types.h>',
702 required : build_plymouth_support.enabled())
703 have_sock_nonblock = cc.has_header_symbol(
704 'sys/socket.h', 'SOCK_NONBLOCK',
705 prefix : '#include <sys/types.h>',
706 required : build_plymouth_support.enabled())
707 have_so_passcred = cc.has_header_symbol(
708 'sys/socket.h', 'SO_PASSCRED',
709 prefix : '#include <sys/types.h>',
710 required : build_plymouth_support.enabled())
711
712 build_plymouth_support = (not build_plymouth_support.disabled() and
713 have_tiocglcktrmios and
714 have_sock_cloexec and
715 have_sock_nonblock and
716 have_so_passcred)
717 conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false)
718 summary('plymouth support',
719 build_plymouth_support ? 'enabled' : 'disabled',
720 section : 'components')
721
722 # check for valid fallocate() function
723 # with 32 bits glibc 2.10, fallocate() exists but not fallocate64()
724 # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64()
725 # and program can't be linked.
726 code = '''
727 #define _GNU_SOURCE
728 #include <unistd.h>
729 #include <fcntl.h>
730
731 int main(void) {
732 long ret;
733 ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful);
734 return ret == 0 ? 0 : 1;
735 }
736 '''
737 have = cc.links(code, name : 'fallocate() function')
738 conf.set('HAVE_FALLOCATE', have ? 1 : false)
739
740 code = '''
741 #include <unistd.h>
742 #include <fcntl.h>
743
744 int main(void) {
745 long ret;
746 ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful);
747 return ret == 0 ? 0 : 1;
748 }
749 '''
750 have = cc.links(code, name : 'posix_fallocate() function')
751 conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false)
752
753 use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64']
754 message('Use CMOS clock: @0@'.format(use_hwclock_cmos))
755 conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false)
756
757 conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false)
758 conf.set('PG_BELL', get_option('pg-bell') ? 1 : false)
759 conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false)
760
761 ############################################################
762
763
764 fs_search_path = get_option('fs-search-path')
765 fs_search_path_extra = get_option('fs-search-path-extra')
766 if fs_search_path_extra != ''
767 fs_search_path = ':'.join(fs_search_path, fs_search_path_extra)
768 endif
769 conf.set_quoted('FS_SEARCH_PATH', fs_search_path)
770
771 systemdsystemunitdir = ''
772 if systemd.found()
773 systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
774 endif
775
776 sysvinit = get_option('sysvinit').enabled()
777 sysvinitrcdir = sysconfdir + '/init.d'
778
779 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
780 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
781
782 have = get_option('chsh-only-listed')
783 conf.set('ONLY_LISTED_SHELLS', have ? 1 : false)
784
785 have = get_option('use-tty-group')
786 conf.set('USE_TTY_GROUP', have ? 1 : false)
787
788 build_hwclock = not get_option('build-hwclock').disabled()
789 bison = find_program('bison', required: build_hwclock)
790 bison_gen = generator(
791 bison,
792 output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
793 arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'])
794
795
796
797 meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh'
798 meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh'
799
800 configure_file(
801 output : 'config.h',
802 configuration : conf)
803
804 add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
805
806 compiler_flags = [
807 '-fno-common',
808
809 '-Waddress-of-packed-member',
810 '-Wdiscarded-qualifiers',
811 '-Wembedded-directive',
812 '-Wextra-semi',
813 '-Wformat-security',
814 '-Wimplicit-function-declaration',
815 '-Wmissing-declarations',
816 '-Wmissing-parameter-type',
817 '-Wmissing-prototypes',
818 '-Wnested-externs',
819 '-Wno-missing-field-initializers',
820 '-Wold-style-definition',
821 '-Wpointer-arith',
822 '-Wredundant-decls',
823 '-Wsign-compare',
824 '-Wstrict-prototypes',
825 '-Wtype-limits',
826 '-Wuninitialized',
827 '-Wunused-but-set-parameter',
828 '-Wunused-but-set-variable',
829 '-Wunused-parameter',
830 '-Wunused-result',
831 '-Wunused-variable',
832 ]
833 foreach compiler_flag : compiler_flags
834 if cc.has_argument(compiler_flag)
835 add_project_arguments(compiler_flag, language : 'c')
836 endif
837 endforeach
838
839 manadocs = []
840 manlinks = {}
841
842 bashcompletions = []
843 bashcompletionslinks = {}
844
845 subdir('include')
846 subdir('lib')
847 subdir('libblkid')
848 subdir('libmount')
849 subdir('libsmartcols')
850 subdir('libuuid')
851 subdir('libfdisk')
852 subdir('login-utils')
853 subdir('sys-utils')
854 subdir('disk-utils')
855 subdir('misc-utils')
856 subdir('text-utils')
857 subdir('term-utils')
858 subdir('po')
859
860 includes = [dir_include,
861 dir_libblkid,
862 dir_libsmartcols,
863 dir_libmount,
864 dir_libfdisk,
865 dir_libuuid,
866 dir_sys_utils]
867
868 exes = []
869
870 opt = not get_option('build-chfn-chsh').disabled()
871 exe = executable(
872 'chfn',
873 chfn_sources,
874 chfn_chsh_sources,
875 include_directories : includes,
876 link_with : [lib_common, logindefs_c],
877 dependencies : chfn_chsh_deps,
878 install_dir : usrbin_exec_dir,
879 install : opt,
880 build_by_default : opt)
881
882 exe2 = executable(
883 'chsh',
884 'login-utils/chsh.c',
885 'lib/shells.c',
886 chfn_chsh_sources,
887 include_directories : includes,
888 link_with : lib_common,
889 dependencies : chfn_chsh_deps,
890 install_dir : usrbin_exec_dir,
891 install : opt,
892 build_by_default : opt)
893 if opt and not is_disabler(exe)
894 exes += [exe, exe2]
895 manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc']
896 bashcompletions += ['chfn', 'chsh']
897 endif
898
899 exe = executable(
900 'test_islocal',
901 test_islocal_sources,
902 include_directories : includes,
903 c_args : '-DTEST_PROGRAM')
904 exes += exe
905
906 exe = executable(
907 'test-consoles',
908 test_consoles_sources,
909 c_args : ['-DTEST_PROGRAM'],
910 include_directories : includes,
911 link_with : lib_common)
912 exes += exe
913
914 opt = not get_option('build-last').disabled()
915 exe = executable(
916 'last',
917 last_sources,
918 include_directories : includes,
919 link_with : [lib_common],
920 install_dir : usrbin_exec_dir,
921 install : opt,
922 build_by_default : opt)
923 if opt and not is_disabler(exe)
924 exes += exe
925 meson.add_install_script(meson_make_symlink,
926 'last',
927 join_paths(usrbin_exec_dir, 'lastb'))
928 manadocs += ['login-utils/last.1.adoc']
929 manlinks += {'lastb.1': 'last.1'}
930 bashcompletions += ['last']
931 bashcompletionslinks += {'lastb': 'last'}
932 endif
933
934 opt = not get_option('build-nologin').disabled()
935 exe = executable(
936 'nologin',
937 'login-utils/nologin.c',
938 include_directories : includes,
939 install_dir : sbindir,
940 link_with : [lib_common],
941 install : opt,
942 build_by_default : opt)
943 if opt and not is_disabler(exe)
944 exes += exe
945 manadocs += ['login-utils/nologin.8.adoc']
946 endif
947
948 opt = not get_option('build-utmpdump').disabled()
949 exe = executable(
950 'utmpdump',
951 'login-utils/utmpdump.c',
952 include_directories : includes,
953 link_with : [lib_common],
954 install_dir : usrbin_exec_dir,
955 install : opt,
956 build_by_default : opt)
957 if opt and not is_disabler(exe)
958 exes += exe
959 manadocs += ['login-utils/utmpdump.1.adoc']
960 bashcompletions += ['utmpdump']
961 endif
962
963 opt = not get_option('build-su').disabled()
964 exe = executable(
965 'su',
966 'login-utils/su.c',
967 'login-utils/su-common.c',
968 'login-utils/su-common.h',
969 'lib/shells.c',
970 pty_session_c,
971 monotonic_c,
972 include_directories : includes,
973 link_with : [lib_common, logindefs_c],
974 dependencies : [lib_pam,
975 lib_pam_misc,
976 lib_util,
977 realtime_libs],
978 install : opt,
979 build_by_default : opt)
980 if opt and not is_disabler(exe)
981 exes += exe
982 manadocs += ['login-utils/su.1.adoc']
983 bashcompletions += ['su']
984 endif
985
986 opt = not get_option('build-newgrp').disabled()
987 exe = executable(
988 'newgrp',
989 'login-utils/newgrp.c',
990 include_directories : includes,
991 dependencies : [lib_crypt],
992 install_dir : usrbin_exec_dir,
993 install : opt,
994 build_by_default : opt)
995 if opt and not is_disabler(exe)
996 exes += exe
997 manadocs += ['login-utils/newgrp.1.adoc']
998 endif
999
1000 opt = not get_option('build-lslogins').disabled()
1001 exe = executable(
1002 'lslogins',
1003 'login-utils/lslogins.c',
1004 include_directories : includes,
1005 link_with : [lib_common,
1006 lib_smartcols,
1007 logindefs_c],
1008 dependencies : [lib_selinux,
1009 lib_systemd],
1010 install_dir : usrbin_exec_dir,
1011 install : opt,
1012 build_by_default : opt)
1013 if opt and not is_disabler(exe)
1014 exes += exe
1015 manadocs += ['login-utils/lslogins.1.adoc']
1016 bashcompletions += ['lslogins']
1017 endif
1018
1019 opt = not get_option('build-vipw').disabled()
1020 exe = executable(
1021 'vipw',
1022 'login-utils/vipw.c',
1023 'login-utils/setpwnam.h',
1024 include_directories : includes,
1025 link_with : [lib_common],
1026 dependencies : [lib_selinux],
1027 install_dir : usrbin_exec_dir,
1028 install : opt,
1029 build_by_default : opt)
1030 if opt and not is_disabler(exe)
1031 exes += exe
1032 meson.add_install_script(meson_make_symlink,
1033 'vipw',
1034 join_paths(usrbin_exec_dir, 'vigr'))
1035 manadocs += ['login-utils/vipw.8.adoc']
1036 endif
1037
1038 opt = not get_option('build-runuser').disabled()
1039 exe = executable(
1040 'runuser',
1041 'login-utils/runuser.c',
1042 'login-utils/su-common.c',
1043 'login-utils/su-common.h',
1044 'lib/shells.c',
1045 pty_session_c,
1046 monotonic_c,
1047 include_directories : includes,
1048 link_with : [lib_common, logindefs_c],
1049 dependencies : [lib_pam,
1050 lib_pam_misc,
1051 lib_util,
1052 realtime_libs],
1053 install_dir : sbindir,
1054 install : opt,
1055 build_by_default : opt)
1056 if opt and not is_disabler(exe)
1057 exes += exe
1058 manadocs += ['login-utils/runuser.1.adoc']
1059 bashcompletionslinks += {'runuser': 'su'}
1060 endif
1061
1062 ############################################################
1063
1064 exe = executable(
1065 'col',
1066 col_sources,
1067 include_directories : includes,
1068 link_with : lib_common,
1069 install_dir : usrbin_exec_dir,
1070 install : true)
1071 exes += exe
1072 manadocs += ['text-utils/col.1.adoc']
1073 bashcompletions += ['col']
1074
1075 exe = executable(
1076 'colcrt',
1077 colcrt_sources,
1078 include_directories : includes,
1079 install_dir : usrbin_exec_dir,
1080 install : true)
1081 exes += exe
1082 manadocs += ['text-utils/colcrt.1.adoc']
1083 bashcompletions += ['colcrt']
1084
1085 exe = executable(
1086 'colrm',
1087 colrm_sources,
1088 include_directories : includes,
1089 link_with : lib_common,
1090 install_dir : usrbin_exec_dir,
1091 install : true)
1092 exes += exe
1093 manadocs += ['text-utils/colrm.1.adoc']
1094 bashcompletions += ['colrm']
1095
1096 exe = executable(
1097 'rev',
1098 rev_sources,
1099 include_directories : includes,
1100 install_dir : usrbin_exec_dir,
1101 install : true)
1102 exes += exe
1103 manadocs += ['text-utils/rev.1.adoc']
1104 bashcompletions += ['rev']
1105
1106 exe = executable(
1107 'column',
1108 column_sources,
1109 include_directories : includes,
1110 link_with : [lib_common,
1111 lib_smartcols],
1112 install_dir : usrbin_exec_dir,
1113 install : true)
1114 if not is_disabler(exe)
1115 exes += exe
1116 manadocs += ['text-utils/column.1.adoc']
1117 bashcompletions += ['column']
1118 endif
1119
1120 opt = not get_option('build-line').disabled()
1121 exe = executable(
1122 'line',
1123 line_sources,
1124 include_directories : includes,
1125 install_dir : usrbin_exec_dir,
1126 install : opt,
1127 build_by_default : opt)
1128 if opt and not is_disabler(exe)
1129 exes += exe
1130 manadocs += ['text-utils/line.1.adoc']
1131 endif
1132
1133 opt = not get_option('build-pg').disabled()
1134 exe = executable(
1135 'pg',
1136 pg_sources,
1137 link_with : lib_common,
1138 include_directories : includes,
1139 dependencies : [lib_tinfo,
1140 curses_libs],
1141 install_dir : usrbin_exec_dir,
1142 install : opt,
1143 build_by_default : opt)
1144 if opt and not is_disabler(exe)
1145 exes += exe
1146 manadocs += ['text-utils/pg.1.adoc']
1147 bashcompletions += ['pg']
1148 endif
1149
1150 opt = not get_option('build-ul').disabled()
1151 exe = executable(
1152 'ul',
1153 ul_sources,
1154 include_directories : includes,
1155 dependencies : [lib_tinfo,
1156 curses_libs],
1157 install_dir : usrbin_exec_dir,
1158 install : opt,
1159 build_by_default : opt)
1160 if opt and not is_disabler(exe)
1161 exes += exe
1162 manadocs += ['text-utils/ul.1.adoc']
1163 bashcompletions += ['ul']
1164 endif
1165
1166 opt = not get_option('build-more').disabled()
1167 exe = executable(
1168 'more',
1169 more_sources,
1170 link_with : [lib_common],
1171 include_directories : includes,
1172 dependencies : [lib_tinfo,
1173 curses_libs,
1174 lib_magic],
1175 install : opt,
1176 build_by_default : opt)
1177 exe2 = executable(
1178 'test_more',
1179 more_sources,
1180 link_with : [lib_common],
1181 include_directories : includes,
1182 c_args : '-DTEST_PROGRAM',
1183 dependencies : [lib_tinfo,
1184 curses_libs,
1185 lib_magic],
1186 build_by_default : opt)
1187 exes += exe
1188 if opt and not is_disabler(exe)
1189 exes += [exe, exe2]
1190 manadocs += ['text-utils/more.1.adoc']
1191 bashcompletions += ['more']
1192 endif
1193
1194 exe = executable(
1195 'hexdump',
1196 hexdump_sources,
1197 include_directories : includes,
1198 link_with : [lib_common,
1199 lib_tcolors],
1200 install_dir : usrbin_exec_dir,
1201 install : true)
1202 if not is_disabler(exe)
1203 exes += exe
1204 manadocs += ['text-utils/hexdump.1.adoc']
1205 bashcompletions += ['hexdump']
1206 endif
1207
1208 opt = not get_option('build-lsmem').disabled()
1209 exe = executable(
1210 'lsmem',
1211 lsmem_sources,
1212 include_directories : includes,
1213 link_with : [lib_common,
1214 lib_smartcols],
1215 install_dir : usrbin_exec_dir,
1216 install : opt,
1217 build_by_default : opt)
1218 if opt and not is_disabler(exe)
1219 exes += exe
1220 manadocs += ['sys-utils/lsmem.1.adoc']
1221 bashcompletions += ['lsmem']
1222 endif
1223
1224 opt = not get_option('build-chmem').disabled()
1225 exe = executable(
1226 'chmem',
1227 chmem_sources,
1228 include_directories : includes,
1229 link_with : [lib_common],
1230 install_dir : usrbin_exec_dir,
1231 install : opt,
1232 build_by_default : opt)
1233 if opt and not is_disabler(exe)
1234 exes += exe
1235 manadocs += ['sys-utils/chmem.8.adoc']
1236 bashcompletions += ['chmem']
1237 endif
1238
1239 exe = executable(
1240 'choom',
1241 choom_sources,
1242 include_directories : includes,
1243 link_with : [lib_common],
1244 install_dir : usrbin_exec_dir,
1245 install : true)
1246 exes += exe
1247 manadocs += ['sys-utils/choom.1.adoc']
1248
1249 exe = executable(
1250 'ipcmk',
1251 ipcmk_sources,
1252 include_directories : includes,
1253 link_with : [lib_common],
1254 install_dir : usrbin_exec_dir,
1255 install : true)
1256 exes += exe
1257 manadocs += ['sys-utils/ipcmk.1.adoc']
1258 bashcompletions += ['ipcmk']
1259
1260 exe = executable(
1261 'ipcrm',
1262 ipcrm_sources,
1263 include_directories : includes,
1264 link_with : [lib_common],
1265 install_dir : usrbin_exec_dir,
1266 install : true)
1267 exes += exe
1268 manadocs += ['sys-utils/ipcrm.1.adoc']
1269 bashcompletions += ['ipcrm']
1270
1271 opt = not get_option('build-ipcs').disabled()
1272 exe = executable(
1273 'ipcs',
1274 ipcs_sources,
1275 include_directories : includes,
1276 link_with : [lib_common],
1277 install_dir : usrbin_exec_dir,
1278 install : opt,
1279 build_by_default : opt)
1280 if opt and not is_disabler(exe)
1281 exes += exe
1282 manadocs += ['sys-utils/ipcs.1.adoc']
1283 bashcompletions += ['ipcs']
1284 endif
1285
1286 opt = not get_option('build-rfkill').disabled()
1287 exe = executable(
1288 'rfkill',
1289 rfkill_sources,
1290 include_directories : includes,
1291 link_with : [lib_common,
1292 lib_smartcols],
1293 install_dir : usrsbin_exec_dir,
1294 install : opt,
1295 build_by_default : opt)
1296 if opt and not is_disabler(exe)
1297 exes += exe
1298 manadocs += ['sys-utils/rfkill.8.adoc']
1299 bashcompletions += ['rfkill']
1300 endif
1301
1302 exe = executable(
1303 'renice',
1304 renice_sources,
1305 include_directories : includes,
1306 link_with : [lib_common,
1307 lib_smartcols],
1308 install_dir : usrbin_exec_dir,
1309 install : true)
1310 if not is_disabler(exe)
1311 exes += exe
1312 manadocs += ['sys-utils/renice.1.adoc']
1313 bashcompletions += ['renice']
1314 endif
1315
1316 exe = executable(
1317 'setsid',
1318 setsid_sources,
1319 include_directories : includes,
1320 link_with : [lib_common,
1321 lib_smartcols],
1322 install_dir : usrbin_exec_dir,
1323 install : true)
1324 if opt and not is_disabler(exe)
1325 exes += exe
1326 manadocs += ['sys-utils/setsid.1.adoc']
1327 bashcompletions += ['setsid']
1328 endif
1329
1330 exe = executable(
1331 'readprofile',
1332 readprofile_sources,
1333 include_directories : includes,
1334 link_with : [lib_common,
1335 lib_smartcols],
1336 install_dir : usrsbin_exec_dir,
1337 install : true)
1338 if not is_disabler(exe)
1339 exes += exe
1340 manadocs += ['sys-utils/readprofile.8.adoc']
1341 bashcompletions += ['readprofile']
1342 endif
1343
1344 opt = not get_option('build-tunelp').disabled()
1345 exe = executable(
1346 'tunelp',
1347 tunelp_sources,
1348 include_directories : includes,
1349 link_with : [lib_common],
1350 install_dir : usrsbin_exec_dir,
1351 install : opt,
1352 build_by_default : opt)
1353 if opt and not is_disabler(exe)
1354 exes += exe
1355 manadocs += ['sys-utils/tunelp.8.adoc']
1356 bashcompletions += ['tunelp']
1357 endif
1358
1359 exe = executable(
1360 'fstrim',
1361 fstrim_sources,
1362 include_directories : includes,
1363 link_with : [lib_common,
1364 lib_mount],
1365 install_dir : sbindir,
1366 install : true)
1367 if not is_disabler(exe)
1368 exes += exe
1369 manadocs += ['sys-utils/fstrim.8.adoc']
1370 bashcompletions += ['fstrim']
1371 endif
1372
1373 exe = executable(
1374 'dmesg',
1375 dmesg_sources,
1376 include_directories : includes,
1377 link_with : [lib_common,
1378 lib_tcolors],
1379 install : true)
1380 if not is_disabler(exe)
1381 exes += exe
1382 manadocs += ['sys-utils/dmesg.1.adoc']
1383 bashcompletions += ['dmesg']
1384 endif
1385
1386 exe = executable(
1387 'test_dmesg',
1388 dmesg_sources,
1389 include_directories : dir_include,
1390 c_args : '-DTEST_DMESG',
1391 link_with : [lib_common,
1392 lib_tcolors])
1393 if not is_disabler(exe)
1394 exes += exe
1395 endif
1396
1397 exe = executable(
1398 'ctrlaltdel',
1399 ctrlaltdel_sources,
1400 include_directories : includes,
1401 link_with : [lib_common],
1402 install_dir : sbindir,
1403 install : true)
1404 exes += exe
1405 manadocs += ['sys-utils/ctrlaltdel.8.adoc']
1406 bashcompletions += ['ctrlaltdel']
1407
1408 exe = executable(
1409 'fsfreeze',
1410 fsfreeze_sources,
1411 include_directories : includes,
1412 install_dir : sbindir,
1413 install : true)
1414 exes += exe
1415 manadocs += ['sys-utils/fsfreeze.8.adoc']
1416 bashcompletions += ['fsfreeze']
1417
1418 exe = executable(
1419 'blkdiscard',
1420 blkdiscard_sources,
1421 include_directories : includes,
1422 link_with : [lib_common,
1423 lib_blkid],
1424 install_dir : sbindir,
1425 install : true)
1426 exes += exe
1427 manadocs += ['sys-utils/blkdiscard.8.adoc']
1428 bashcompletions += ['blkdiscard']
1429
1430 exe = executable(
1431 'blkzone',
1432 blkzone_sources,
1433 include_directories : includes,
1434 link_with : [lib_common],
1435 install_dir : sbindir,
1436 install : true)
1437 exes += exe
1438 manadocs += ['sys-utils/blkzone.8.adoc']
1439 bashcompletions += ['blkzone']
1440
1441 exe = executable(
1442 'blkpr',
1443 blkpr_sources,
1444 include_directories : includes,
1445 link_with : [lib_common],
1446 install_dir : sbindir,
1447 install : true)
1448 exes += exe
1449 manadocs += ['sys-utils/blkpr.8.adoc']
1450
1451 exe = executable(
1452 'ldattach',
1453 ldattach_sources,
1454 include_directories : includes,
1455 link_with : [lib_common],
1456 install_dir : usrsbin_exec_dir,
1457 install : true)
1458 exes += exe
1459 manadocs += ['sys-utils/ldattach.8.adoc']
1460 bashcompletions += ['ldattach']
1461
1462 exe = executable(
1463 'rtcwake',
1464 rtcwake_sources,
1465 include_directories : includes,
1466 link_with : [lib_common],
1467 install_dir : usrsbin_exec_dir,
1468 install : true)
1469 exes += exe
1470 manadocs += ['sys-utils/rtcwake.8.adoc']
1471 bashcompletions += ['rtcwake']
1472
1473 exe = executable(
1474 'setarch',
1475 setarch_sources,
1476 include_directories : includes,
1477 link_with : [lib_common],
1478 install_dir : usrbin_exec_dir,
1479 install : true)
1480 exes += exe
1481 manadocs += ['sys-utils/setarch.8.adoc']
1482 bashcompletions += ['setarch']
1483
1484 setarch_links = ['uname26', 'linux32', 'linux64']
1485 setarch_links_arch = {
1486 's390x' : ['s390', 's390x'],
1487 'x86' : ['i386'],
1488 'x86_64' : ['i386', 'x86_64'],
1489 'ppc64' : ['ppc', 'ppc64', 'ppc32'],
1490 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'],
1491 'mips64' : ['mips', 'mips64', 'mips32'],
1492 'ia64' : ['i386', 'ia64'],
1493 'hppa' : ['parisc', 'parisc64', 'parisc32'],
1494 }
1495 setarch_links += setarch_links_arch.get(host_machine.cpu_family(), [])
1496
1497 foreach link: setarch_links
1498 meson.add_install_script(meson_make_symlink,
1499 'setarch',
1500 join_paths(usrbin_exec_dir, link))
1501 manlinks += {link + '.8': 'setarch.8'}
1502 endforeach
1503
1504 opt = not get_option('build-eject').disabled()
1505 exe = executable(
1506 'eject',
1507 eject_sources,
1508 include_directories : includes,
1509 link_with : [lib_common,
1510 lib_mount],
1511 install_dir : usrbin_exec_dir,
1512 install : opt,
1513 build_by_default : opt)
1514 if opt and not is_disabler(exe)
1515 exe = exe
1516 manadocs += ['sys-utils/eject.1.adoc']
1517 bashcompletions += ['eject']
1518 endif
1519
1520 opt = not get_option('build-losetup').disabled()
1521 exe = executable(
1522 'losetup',
1523 losetup_sources,
1524 include_directories : includes,
1525 link_with : [lib_common,
1526 lib_smartcols],
1527 install_dir : sbindir,
1528 install : opt,
1529 build_by_default : opt)
1530 if opt and not is_disabler(exe)
1531 manadocs += ['sys-utils/losetup.8.adoc']
1532 exes += exe
1533 bashcompletions += ['losetup']
1534 endif
1535
1536 opt = opt and 'losetup' in static_programs
1537 exe = executable(
1538 'losetup.static',
1539 losetup_sources,
1540 include_directories : includes,
1541 link_args : ['--static'],
1542 link_with : [lib_common,
1543 lib_smartcols.get_static_lib()],
1544 install_dir : sbindir,
1545 install : opt,
1546 build_by_default : opt)
1547 if opt and not is_disabler(exe)
1548 exes += exe
1549 endif
1550
1551 opt = not get_option('build-zramctl').disabled()
1552 exe = executable(
1553 'zramctl',
1554 zramctl_sources,
1555 include_directories : includes,
1556 link_with : [lib_common,
1557 lib_smartcols],
1558 install_dir : sbindir,
1559 install : opt,
1560 build_by_default : opt)
1561 if opt and not is_disabler(exe)
1562 exes += exe
1563 manadocs += ['sys-utils/zramctl.8.adoc']
1564 bashcompletions += ['zramctl']
1565 endif
1566
1567 exe = executable(
1568 'prlimit',
1569 prlimit_sources,
1570 include_directories : includes,
1571 link_with : [lib_common,
1572 lib_smartcols],
1573 install_dir : usrbin_exec_dir,
1574 install : true)
1575 if not is_disabler(exe)
1576 exes += exe
1577 manadocs += ['sys-utils/prlimit.1.adoc']
1578 bashcompletions += ['prlimit']
1579 endif
1580
1581 exe = executable(
1582 'lsns',
1583 lsns_sources,
1584 include_directories : includes,
1585 link_with : [lib_common,
1586 lib_smartcols,
1587 lib_mount],
1588 install_dir : usrbin_exec_dir,
1589 install : true)
1590 if not is_disabler(exe)
1591 exes += exe
1592 manadocs += ['sys-utils/lsns.8.adoc']
1593 bashcompletions += ['lsns']
1594 endif
1595
1596 opt = not get_option('build-mount').disabled()
1597 exe = executable(
1598 'mount',
1599 mount_sources,
1600 include_directories : includes,
1601 link_with : [lib_common,
1602 lib_smartcols,
1603 lib_mount],
1604 dependencies : lib_selinux,
1605 install : opt,
1606 build_by_default : opt)
1607 exe2 = executable(
1608 'umount',
1609 umount_sources,
1610 include_directories : includes,
1611 link_with : [lib_common,
1612 lib_mount],
1613 install : opt,
1614 build_by_default : opt)
1615 if opt and not is_disabler(exe)
1616 exes += [exe, exe2]
1617 manadocs += ['sys-utils/fstab.5.adoc',
1618 'sys-utils/mount.8.adoc',
1619 'sys-utils/umount.8.adoc']
1620 bashcompletions += ['mount', 'umount']
1621 endif
1622
1623 opt2 = opt and 'mount' in static_programs
1624 exe = executable(
1625 'mount.static',
1626 mount_sources,
1627 include_directories : includes,
1628 link_args : ['--static'],
1629 link_with : [lib_common,
1630 lib_smartcols_static,
1631 lib_mount_static],
1632 install : opt2,
1633 build_by_default : opt2)
1634 if opt2 and not is_disabler(exe)
1635 exes += exe
1636 endif
1637
1638 opt2 = opt and 'umount' in static_programs
1639 exe = executable(
1640 'umount.static',
1641 umount_sources,
1642 include_directories : includes,
1643 link_args : ['--static'],
1644 link_with : [lib_common,
1645 lib_mount_static],
1646 install : opt2,
1647 build_by_default : opt2)
1648 if opt2 and not is_disabler(exe)
1649 exes += exe
1650 endif
1651
1652 # setuid?
1653
1654 exe = executable(
1655 'swapon',
1656 swapon_sources,
1657 include_directories : includes,
1658 link_with : [lib_common,
1659 lib_blkid,
1660 lib_mount,
1661 lib_smartcols],
1662 install_dir : sbindir,
1663 install : true)
1664 if not is_disabler(exe)
1665 exes += exe
1666 manadocs += ['sys-utils/swapon.8.adoc']
1667 bashcompletions += ['swapon']
1668 endif
1669
1670 exe = executable(
1671 'swapoff',
1672 swapoff_sources,
1673 include_directories : includes,
1674 link_with : [lib_common,
1675 lib_blkid,
1676 lib_mount],
1677 install_dir : sbindir,
1678 install : true)
1679 if not is_disabler(exe)
1680 exes += exe
1681 manlinks += {'swapoff.8': 'swapon.8'}
1682 bashcompletions += ['swapoff']
1683 endif
1684
1685 exe = executable(
1686 'lscpu',
1687 lscpu_sources,
1688 include_directories : includes,
1689 link_with : [lib_common,
1690 lib_smartcols],
1691 dependencies : [rtas_libs],
1692 install_dir : usrbin_exec_dir,
1693 install : true)
1694 if not is_disabler(exe)
1695 exes += exe
1696 manadocs += ['sys-utils/lscpu.1.adoc']
1697 bashcompletions += ['lscpu']
1698 endif
1699
1700 exe = executable(
1701 'chcpu',
1702 chcpu_sources,
1703 include_directories : includes,
1704 link_with : [lib_common],
1705 install_dir : sbindir,
1706 install : true)
1707 exes += exe
1708 manadocs += ['sys-utils/chcpu.8.adoc']
1709 bashcompletions += ['chcpu']
1710
1711 exe = executable(
1712 'wdctl',
1713 wdctl_sources,
1714 include_directories : includes,
1715 link_with : [lib_common,
1716 lib_smartcols],
1717 install : true)
1718 if not is_disabler(exe)
1719 exes += exe
1720 manadocs += ['sys-utils/wdctl.8.adoc']
1721 bashcompletions += ['wdctl']
1722 endif
1723
1724 opt = not get_option('build-mountpoint').disabled()
1725 exe = executable(
1726 'mountpoint',
1727 mountpoint_sources,
1728 include_directories : includes,
1729 link_with : [lib_mount],
1730 install : opt,
1731 build_by_default : opt)
1732 if opt and not is_disabler(exe)
1733 exes += exe
1734 manadocs += ['sys-utils/mountpoint.1.adoc']
1735 bashcompletions += ['mountpoint']
1736 endif
1737
1738 opt = not get_option('build-fallocate').disabled()
1739 exe = executable(
1740 'fallocate',
1741 fallocate_sources,
1742 include_directories : includes,
1743 link_with : [lib_common],
1744 install_dir : usrbin_exec_dir,
1745 install : opt,
1746 build_by_default : opt)
1747 if opt and not is_disabler(exe)
1748 exes += exe
1749 manadocs += ['sys-utils/fallocate.1.adoc']
1750 bashcompletions += ['fallocate']
1751 endif
1752
1753 opt = not get_option('build-pivot_root').disabled()
1754 exe = executable(
1755 'pivot_root',
1756 pivot_root_sources,
1757 include_directories : includes,
1758 install_dir : sbindir,
1759 install : opt,
1760 build_by_default : opt)
1761 if opt and not is_disabler(exe)
1762 exes += exe
1763 manadocs += ['sys-utils/pivot_root.8.adoc']
1764 bashcompletions += ['pivot_root']
1765 endif
1766
1767 opt = not get_option('build-switch_root').disabled()
1768 if opt and not have_dirfd and not have_ddfd
1769 error('neither dirfd nor ddfd are available')
1770 endif
1771 exe = executable(
1772 'switch_root',
1773 switch_root_sources,
1774 include_directories : includes,
1775 install_dir : sbindir,
1776 install : opt,
1777 build_by_default : opt)
1778 if opt and not is_disabler(exe)
1779 exes += exe
1780 manadocs += ['sys-utils/switch_root.8.adoc']
1781 endif
1782
1783 opt = not get_option('build-unshare').disabled()
1784 exe = executable(
1785 'unshare',
1786 unshare_sources,
1787 include_directories : includes,
1788 link_with : [lib_common],
1789 install_dir : usrbin_exec_dir,
1790 install : opt,
1791 build_by_default : opt)
1792 if opt and not is_disabler(exe)
1793 exes += exe
1794 manadocs += ['sys-utils/unshare.1.adoc']
1795 bashcompletions += ['unshare']
1796 endif
1797
1798 opt = opt and 'unshare' in static_programs
1799 exe = executable(
1800 'unshare.static',
1801 unshare_sources,
1802 include_directories : includes,
1803 link_with : [lib_common],
1804 install_dir : usrbin_exec_dir,
1805 install : opt,
1806 build_by_default : opt)
1807 if opt and not is_disabler(exe)
1808 exes += exe
1809 endif
1810
1811 opt = not get_option('build-nsenter').disabled()
1812 exe = executable(
1813 'nsenter',
1814 nsenter_sources,
1815 include_directories : includes,
1816 link_with : [lib_common],
1817 dependencies : [lib_selinux],
1818 install_dir : usrbin_exec_dir,
1819 install : opt,
1820 build_by_default : opt)
1821 if opt and not is_disabler(exe)
1822 exes += exe
1823 manadocs += ['sys-utils/nsenter.1.adoc']
1824 bashcompletions += ['nsenter']
1825 endif
1826
1827 opt = opt and 'nsenter' in static_programs
1828 exe = executable(
1829 'nsenter.static',
1830 nsenter_sources,
1831 include_directories : includes,
1832 link_with : [lib_common],
1833 dependencies : [lib_selinux],
1834 install_dir : usrbin_exec_dir,
1835 install : opt,
1836 build_by_default : opt)
1837 if opt and not is_disabler(exe)
1838 exes += exe
1839 endif
1840
1841 opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found()
1842 exe = executable(
1843 'setpriv',
1844 setpriv_sources,
1845 include_directories : includes,
1846 link_with : [lib_common],
1847 dependencies : [lib_cap_ng],
1848 install_dir : usrbin_exec_dir,
1849 install : opt,
1850 build_by_default : opt)
1851 if opt and not is_disabler(exe)
1852 exes += exe
1853 manadocs += ['sys-utils/setpriv.1.adoc']
1854 bashcompletions += ['setpriv']
1855 endif
1856
1857 exe = executable(
1858 'flock',
1859 flock_sources,
1860 include_directories : includes,
1861 link_with : [lib_common],
1862 dependencies : realtime_libs,
1863 install_dir : usrbin_exec_dir,
1864 install : true)
1865 exes += exe
1866 manadocs += ['sys-utils/flock.1.adoc']
1867 bashcompletions += ['flock']
1868
1869 opt = not get_option('build-lsirq').disabled()
1870 exe = executable(
1871 'lsirq',
1872 lsirq_sources,
1873 include_directories : includes,
1874 link_with : [lib_common,
1875 lib_smartcols],
1876 install_dir : usrbin_exec_dir,
1877 install : opt,
1878 build_by_default : opt)
1879 if opt and not is_disabler(exe)
1880 exes += exe
1881 manadocs += ['sys-utils/lsirq.1.adoc']
1882 bashcompletions += ['lsirq']
1883 endif
1884
1885 opt = not get_option('build-irqtop').disabled()
1886 exe = executable(
1887 'irqtop',
1888 irqtop_sources,
1889 include_directories : includes,
1890 dependencies : [realtime_libs, curses_libs],
1891 link_with : [lib_common,
1892 lib_smartcols,
1893 lib_tcolors],
1894 install_dir : usrbin_exec_dir,
1895 install : opt,
1896 build_by_default : opt)
1897 if opt and not is_disabler(exe)
1898 exes += exe
1899 manadocs += ['sys-utils/irqtop.1.adoc']
1900 bashcompletions += ['irqtop']
1901 endif
1902
1903 opt = not get_option('build-ipcs').disabled()
1904 exe = executable(
1905 'lsipc',
1906 lsipc_sources,
1907 include_directories : includes,
1908 link_with : [lib_common,
1909 lib_smartcols],
1910 install_dir : usrbin_exec_dir,
1911 install : opt,
1912 build_by_default : opt)
1913 if opt and not is_disabler(exe)
1914 exes += exe
1915 manadocs += ['sys-utils/lsipc.1.adoc']
1916 bashcompletions += ['lsipc']
1917 endif
1918
1919 opt = build_hwclock
1920 exe = executable(
1921 'hwclock',
1922 hwclock_sources,
1923 include_directories : includes,
1924 link_with : [lib_common],
1925 dependencies : [lib_m,
1926 lib_audit],
1927 install_dir : sbindir,
1928 install : opt,
1929 build_by_default : opt)
1930 if opt and not is_disabler(exe)
1931 exes += exe
1932 manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc']
1933 bashcompletions += ['hwclock']
1934 endif
1935
1936 exe = executable(
1937 'mkfs',
1938 mkfs_sources,
1939 include_directories : includes,
1940 install_dir : sbindir,
1941 install : true)
1942 exes += exe
1943 manadocs += ['disk-utils/mkfs.8.adoc']
1944 bashcompletions += ['mkfs']
1945
1946 opt = not get_option('build-bfs').disabled()
1947 exe = executable(
1948 'mkfs.bfs',
1949 mkfs_bfs_sources,
1950 include_directories : includes,
1951 link_with : [lib_common],
1952 install_dir : sbindir,
1953 install : opt,
1954 build_by_default : opt)
1955 if opt and not is_disabler(exe)
1956 exes += exe
1957 manadocs += ['disk-utils/mkfs.bfs.8.adoc']
1958 bashcompletions += ['mkfs.bfs']
1959 endif
1960
1961 exe = executable(
1962 'isosize',
1963 isosize_sources,
1964 include_directories : includes,
1965 link_with : [lib_common],
1966 install_dir : usrbin_exec_dir,
1967 install : true)
1968 exes += exe
1969 manadocs += ['disk-utils/isosize.8.adoc']
1970 bashcompletions += ['isosize']
1971
1972 exe = executable(
1973 'mkswap',
1974 mkswap_sources,
1975 include_directories : includes,
1976 link_with : [lib_common,
1977 lib_blkid,
1978 lib_uuid],
1979 dependencies: [lib_selinux],
1980 install_dir : sbindir,
1981 install : true)
1982 if opt and not is_disabler(exe)
1983 exes += exe
1984 manadocs += ['disk-utils/mkswap.8.adoc']
1985 bashcompletions += ['mkswap']
1986 endif
1987
1988 exe = executable(
1989 'swaplabel',
1990 swaplabel_sources,
1991 include_directories : includes,
1992 link_with : [lib_common,
1993 lib_blkid,
1994 lib_uuid],
1995 install_dir : sbindir,
1996 install : true)
1997 if opt and not is_disabler(exe)
1998 exes += exe
1999 manadocs += ['disk-utils/swaplabel.8.adoc']
2000 bashcompletions += ['swaplabel']
2001 endif
2002
2003 opt = not get_option('build-fsck').disabled()
2004 exe = executable(
2005 'fsck',
2006 fsck_sources,
2007 include_directories : includes,
2008 link_with : [lib_common,
2009 lib_blkid,
2010 lib_mount],
2011 dependencies : realtime_libs,
2012 install_dir : sbindir,
2013 install : opt,
2014 build_by_default : opt)
2015 if opt and not is_disabler(exe)
2016 exes += exe
2017 manadocs += ['disk-utils/fsck.8.adoc']
2018 bashcompletions += ['fsck']
2019 endif
2020
2021 opt = not get_option('build-minix').disabled()
2022 exe = executable(
2023 'mkfs.minix',
2024 mkfs_minix_sources,
2025 include_directories : includes,
2026 link_with : [lib_common],
2027 install_dir : sbindir,
2028 install : opt,
2029 build_by_default : opt)
2030 exe2 = executable(
2031 'test_mkfs_minix',
2032 mkfs_minix_sources,
2033 include_directories : includes,
2034 c_args : '-DTEST_SCRIPT',
2035 link_with : [lib_common],
2036 build_by_default : opt)
2037 exe3 = executable(
2038 'fsck.minix',
2039 fsck_minix_sources,
2040 include_directories : includes,
2041 link_with : [lib_common],
2042 install_dir : sbindir,
2043 install : opt,
2044 build_by_default : opt)
2045 if opt and not is_disabler(exe)
2046 exes += [exe, exe2, exe3]
2047 manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc']
2048 bashcompletions += ['mkfs.minix', 'fsck.minix']
2049 endif
2050
2051 opt = not get_option('build-cramfs').disabled()
2052 exe = executable(
2053 'mkfs.cramfs',
2054 mkfs_cramfs_sources,
2055 include_directories : includes,
2056 link_with : [lib_common],
2057 dependencies : [lib_z],
2058 install_dir : sbindir,
2059 install : opt,
2060 build_by_default : opt)
2061 exe2 = executable(
2062 'fsck.cramfs',
2063 fsck_cramfs_sources,
2064 include_directories : includes,
2065 link_with : [lib_common],
2066 dependencies : [lib_z],
2067 install_dir : sbindir,
2068 install : opt,
2069 build_by_default : opt)
2070 if not is_disabler(exe)
2071 exes += [exe, exe2]
2072 manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc']
2073 bashcompletions += ['mkfs.cramfs', 'fsck.cramfs']
2074 endif
2075
2076 opt = not get_option('build-raw').disabled()
2077 if opt
2078 cc.has_header('linux/raw.h', required: opt)
2079 endif
2080 exe = executable(
2081 'raw',
2082 raw_sources,
2083 include_directories : includes,
2084 install_dir : sbindir,
2085 install : opt,
2086 build_by_default : opt)
2087 if opt and not is_disabler(exe)
2088 exes += exe
2089 manadocs += ['disk-utils/raw.8.adoc']
2090 bashcompletions += ['raw']
2091 endif
2092
2093 opt = not get_option('build-fdformat').disabled()
2094 exe = executable(
2095 'fdformat',
2096 fdformat_sources,
2097 include_directories : includes,
2098 link_with : [lib_common],
2099 install_dir : usrsbin_exec_dir,
2100 install : opt,
2101 build_by_default : opt)
2102 if opt and not is_disabler(exe)
2103 exes += exe
2104 manadocs += ['disk-utils/fdformat.8.adoc']
2105 endif
2106
2107 exe = executable(
2108 'blockdev',
2109 blockdev_sources,
2110 include_directories : includes,
2111 link_with : [lib_common],
2112 install_dir : sbindir,
2113 install : true)
2114 manadocs += ['disk-utils/blockdev.8.adoc']
2115 bashcompletions += ['blockdev']
2116
2117 opt = not get_option('build-fdisks').disabled()
2118 if opt and not have_dirfd and not have_ddfd
2119 error('neither dirfd nor ddfd are available')
2120 endif
2121 exe = executable(
2122 'fdisk',
2123 fdisk_sources,
2124 include_directories : includes,
2125 link_with : [lib_common,
2126 lib_fdisk,
2127 lib_smartcols,
2128 lib_tcolors],
2129 dependencies : [lib_readline],
2130 install_dir : sbindir,
2131 install : opt,
2132 build_by_default : opt)
2133 if opt and not is_disabler(exe)
2134 exes += exe
2135 bashcompletions += ['fdisk']
2136 endif
2137
2138 opt2 = opt and 'fdisk' in static_programs
2139 exe = executable(
2140 'fdisk.static',
2141 fdisk_sources,
2142 link_args : ['--static'],
2143 include_directories : includes,
2144 link_with : [lib_common,
2145 lib_tcolors,
2146 lib_fdisk_static,
2147 lib_smartcols.get_static_lib()],
2148 dependencies : [lib_readline_static],
2149 install_dir : sbindir,
2150 install : opt2,
2151 build_by_default : opt2)
2152 if opt2 and not is_disabler(exe)
2153 exes += exe
2154 endif
2155
2156 exe = executable(
2157 'sfdisk',
2158 sfdisk_sources,
2159 include_directories : includes,
2160 link_with : [lib_common,
2161 lib_fdisk,
2162 lib_smartcols,
2163 lib_tcolors],
2164 dependencies : [lib_readline],
2165 install_dir : sbindir,
2166 install : opt,
2167 build_by_default : opt)
2168 if opt and not is_disabler(exe)
2169 exes += exe
2170 bashcompletions += ['sfdisk']
2171 endif
2172
2173 opt2 = opt and 'sfdisk' in static_programs
2174 exe = executable(
2175 'sfdisk.static',
2176 sfdisk_sources,
2177 include_directories : includes,
2178 link_with : [lib_common,
2179 lib_tcolors,
2180 lib_fdisk_static,
2181 lib_smartcols.get_static_lib()],
2182 dependencies : [lib_readline_static],
2183 install_dir : sbindir,
2184 install : opt2,
2185 build_by_default : opt2)
2186 if opt2 and not is_disabler(exe)
2187 exes += exe
2188 endif
2189
2190 exe = executable(
2191 'cfdisk',
2192 cfdisk_sources,
2193 include_directories : includes,
2194 link_with : [lib_common,
2195 lib_fdisk,
2196 lib_smartcols,
2197 lib_tcolors,
2198 lib_mount],
2199 dependencies : [curses_libs],
2200 install_dir : sbindir,
2201 install : opt,
2202 build_by_default : opt)
2203 if opt and not is_disabler(exe)
2204 exes += exe
2205 manadocs += ['disk-utils/fdisk.8.adoc',
2206 'disk-utils/sfdisk.8.adoc',
2207 'disk-utils/cfdisk.8.adoc']
2208 bashcompletions += ['cfdisk']
2209 endif
2210
2211 opt = not get_option('build-partx').disabled()
2212 exe = executable(
2213 'addpart',
2214 addpart_sources,
2215 include_directories : includes,
2216 link_with : [lib_common],
2217 install_dir : usrsbin_exec_dir,
2218 install : opt,
2219 build_by_default : opt)
2220 exe2 = executable(
2221 'delpart',
2222 delpart_sources,
2223 include_directories : includes,
2224 link_with : [lib_common],
2225 install_dir : usrsbin_exec_dir,
2226 install : opt,
2227 build_by_default : opt)
2228 exe3 = executable(
2229 'resizepart',
2230 resizepart_sources,
2231 include_directories : includes,
2232 link_with : [lib_common],
2233 install_dir : usrsbin_exec_dir,
2234 install : opt,
2235 build_by_default : opt)
2236 exe4 = executable(
2237 'partx',
2238 partx_sources,
2239 include_directories : includes,
2240 link_with : [lib_common,
2241 lib_blkid,
2242 lib_smartcols],
2243 install_dir : usrsbin_exec_dir,
2244 install : opt,
2245 build_by_default : opt)
2246 if opt
2247 exes += [exe, exe2, exe3, exe4]
2248 manadocs += ['disk-utils/addpart.8.adoc',
2249 'disk-utils/delpart.8.adoc',
2250 'disk-utils/resizepart.8.adoc',
2251 'disk-utils/partx.8.adoc']
2252 bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx']
2253 endif
2254
2255 ############################################################
2256
2257 exe = executable(
2258 'script',
2259 script_sources,
2260 include_directories : includes,
2261 link_with : [lib_common],
2262 dependencies : [lib_util,
2263 lib_utempter,
2264 realtime_libs,
2265 math_libs],
2266 install_dir : usrbin_exec_dir,
2267 install : true)
2268 exes += exe
2269 manadocs += ['term-utils/script.1.adoc']
2270 bashcompletions += ['script']
2271
2272 exe = executable(
2273 'test_script',
2274 script_sources,
2275 include_directories : includes,
2276 c_args : '-DTEST_SCRIPT',
2277 link_with : [lib_common],
2278 dependencies : [lib_util,
2279 lib_utempter,
2280 realtime_libs,
2281 math_libs])
2282 exes += exe
2283
2284 exe = executable(
2285 'scriptlive',
2286 scriptlive_sources,
2287 include_directories : includes,
2288 link_with : [lib_common],
2289 dependencies : [lib_util,
2290 realtime_libs,
2291 math_libs],
2292 install_dir : usrbin_exec_dir,
2293 install : true)
2294 exes += exe
2295 manadocs += ['term-utils/scriptlive.1.adoc']
2296 bashcompletions += ['scriptlive']
2297
2298 exe = executable(
2299 'scriptreplay',
2300 scriptreplay_sources,
2301 include_directories : includes,
2302 link_with : [lib_common],
2303 dependencies : [math_libs],
2304 install_dir : usrbin_exec_dir,
2305 install : true)
2306 exes += exe
2307 manadocs += ['term-utils/scriptreplay.1.adoc']
2308 bashcompletions += ['scriptreplay']
2309
2310 opt = not get_option('build-agetty').disabled()
2311 exe = executable(
2312 'agetty',
2313 agetty_sources,
2314 include_directories : includes,
2315 link_with : [lib_common, logindefs_c],
2316 dependencies : BSD ? lib_util : [],
2317 install_dir : sbindir,
2318 install : opt,
2319 build_by_default : opt)
2320 if opt
2321 exes += exe
2322 manadocs += ['term-utils/agetty.8.adoc']
2323 endif
2324
2325 opt = not get_option('build-setterm').disabled()
2326 exe = executable(
2327 'setterm',
2328 setterm_sources,
2329 include_directories : includes,
2330 link_with : [lib_common],
2331 dependencies : [curses_libs],
2332 install_dir : usrbin_exec_dir,
2333 install : opt,
2334 build_by_default : opt)
2335 if opt
2336 exes += exe
2337 manadocs += ['term-utils/setterm.1.adoc']
2338 bashcompletions += ['setterm']
2339 endif
2340
2341 opt = not get_option('build-mesg').disabled()
2342 exe = executable(
2343 'mesg',
2344 mesg_sources,
2345 include_directories : includes,
2346 link_with : [lib_common],
2347 install_dir : usrbin_exec_dir,
2348 install : opt,
2349 build_by_default : opt)
2350 if opt
2351 exes += exe
2352 manadocs += ['term-utils/mesg.1.adoc']
2353 bashcompletions += ['mesg']
2354 endif
2355
2356 opt = not get_option('build-wall').disabled()
2357 exe = executable(
2358 'wall',
2359 wall_sources,
2360 include_directories : includes,
2361 link_with : [lib_common],
2362 install_dir : usrbin_exec_dir,
2363 install : opt,
2364 build_by_default : opt)
2365 if opt
2366 exes += exe
2367 manadocs += ['term-utils/wall.1.adoc']
2368 bashcompletions += ['wall']
2369 endif
2370
2371 # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall
2372 # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall
2373
2374 opt = not get_option('build-write').disabled()
2375 exe = executable(
2376 'write',
2377 write_sources,
2378 include_directories : includes,
2379 link_with : [lib_common],
2380 install_dir : usrbin_exec_dir,
2381 install : opt,
2382 build_by_default : opt)
2383 if opt
2384 exes += exe
2385 manadocs += ['term-utils/write.1.adoc']
2386 endif
2387
2388 # chgrp tty $(DESTDIR)$(usrbin_execdir)/write
2389 # chmod g+s $(DESTDIR)$(usrbin_execdir)/write
2390
2391 opt = not get_option('build-login').disabled()
2392 exe = executable(
2393 'login',
2394 login_sources,
2395 include_directories : includes,
2396 link_with : [lib_common, logindefs_c],
2397 dependencies : [lib_pam,
2398 lib_audit,
2399 lib_selinux],
2400 install : opt,
2401 build_by_default : opt)
2402 if not is_disabler(exe)
2403 exes += exe
2404 manadocs += ['login-utils/login.1.adoc']
2405 endif
2406
2407 opt = not get_option('build-sulogin').disabled()
2408 exe = executable(
2409 'sulogin',
2410 sulogin_sources,
2411 include_directories : includes,
2412 link_with : [lib_common],
2413 dependencies : [lib_crypt,
2414 lib_selinux],
2415 install_dir : sbindir,
2416 install : opt,
2417 build_by_default : opt)
2418 if not is_disabler(exe)
2419 exes += exe
2420 manadocs += ['login-utils/sulogin.8.adoc']
2421 endif
2422
2423 exe = executable(
2424 'cal',
2425 cal_sources,
2426 include_directories : includes,
2427 link_with : [lib_common,
2428 lib_tcolors],
2429 dependencies : [curses_libs],
2430 install_dir : usrbin_exec_dir,
2431 install : true)
2432 exes += exe
2433 manadocs += ['misc-utils/cal.1.adoc']
2434 bashcompletions += ['cal']
2435
2436 opt = not get_option('build-logger').disabled()
2437 exe = executable(
2438 'logger',
2439 logger_sources,
2440 include_directories : includes,
2441 link_with : [lib_common],
2442 dependencies : [lib_systemd],
2443 install_dir : usrbin_exec_dir,
2444 install : opt,
2445 build_by_default : opt)
2446 if opt and not is_disabler(exe)
2447 exes += exe
2448 manadocs += ['misc-utils/logger.1.adoc']
2449 bashcompletions += ['logger']
2450 endif
2451
2452 exe = executable(
2453 'test_logger',
2454 logger_sources,
2455 include_directories : includes,
2456 c_args : '-DTEST_LOGGER',
2457 link_with : [lib_common],
2458 dependencies : [lib_systemd])
2459 if not is_disabler(exe)
2460 exes += exe
2461 endif
2462
2463 exe = executable(
2464 'look',
2465 look_sources,
2466 include_directories : includes,
2467 install_dir : usrbin_exec_dir,
2468 install : true)
2469 exes += exe
2470 manadocs += ['misc-utils/look.1.adoc']
2471 bashcompletions += ['look']
2472
2473 exe = executable(
2474 'mcookie',
2475 mcookie_sources,
2476 include_directories : includes,
2477 link_with : [lib_common],
2478 install_dir : usrbin_exec_dir,
2479 install : true)
2480 exes += exe
2481 manadocs += ['misc-utils/mcookie.1.adoc']
2482 bashcompletions += ['mcookie']
2483
2484 exe = executable(
2485 'namei',
2486 namei_sources,
2487 include_directories : includes,
2488 dependencies : [lib_selinux],
2489 install_dir : usrbin_exec_dir,
2490 install : true)
2491 exes += exe
2492 manadocs += ['misc-utils/namei.1.adoc']
2493 bashcompletions += ['namei']
2494
2495 exe = executable(
2496 'whereis',
2497 whereis_sources,
2498 include_directories : includes,
2499 link_with : [lib_common],
2500 install_dir : usrbin_exec_dir,
2501 install : true)
2502 exes += exe
2503 manadocs += ['misc-utils/whereis.1.adoc']
2504 bashcompletions += ['whereis']
2505
2506 exe = executable(
2507 'lslocks',
2508 lslocks_sources,
2509 include_directories : includes,
2510 link_with : [lib_common,
2511 lib_mount,
2512 lib_smartcols],
2513 install_dir : usrbin_exec_dir,
2514 install : true)
2515 if not is_disabler(exe)
2516 exes += exe
2517 manadocs += ['misc-utils/lslocks.8.adoc']
2518 bashcompletions += ['lslocks']
2519 endif
2520
2521 exe = executable(
2522 'lsblk',
2523 lsblk_sources,
2524 include_directories : includes,
2525 link_with : [lib_common,
2526 lib_blkid,
2527 lib_mount,
2528 lib_smartcols],
2529 dependencies : lib_udev,
2530 install : true)
2531 if not is_disabler(exe)
2532 exes += exe
2533 manadocs += ['misc-utils/lsblk.8.adoc']
2534 bashcompletions += ['lsblk']
2535 endif
2536
2537 exe = executable(
2538 'lsfd',
2539 lsfd_sources,
2540 include_directories : includes,
2541 link_with : [lib_common,
2542 lib_smartcols],
2543 install_dir : usrbin_exec_dir,
2544 install : true)
2545 if not is_disabler(exe)
2546 exes += exe
2547 manadocs += ['misc-utils/lsfd.1.adoc']
2548 endif
2549
2550 exe = executable(
2551 'uuidgen',
2552 uuidgen_sources,
2553 include_directories : includes,
2554 link_with : [lib_uuid],
2555 install_dir : usrbin_exec_dir,
2556 install : true)
2557 if not is_disabler(exe)
2558 exes += exe
2559 manadocs += ['misc-utils/uuidgen.1.adoc']
2560 bashcompletions += ['uuidgen']
2561 endif
2562
2563 exe = executable(
2564 'uuidparse',
2565 uuidparse_sources,
2566 include_directories : includes,
2567 link_with : [lib_common,
2568 lib_uuid,
2569 lib_smartcols],
2570 install_dir : usrbin_exec_dir,
2571 install : true)
2572 if not is_disabler(exe)
2573 exes += exe
2574 manadocs += ['misc-utils/uuidparse.1.adoc']
2575 bashcompletions += ['uuidparse']
2576 endif
2577
2578 opt = build_uuidd
2579 exe = executable(
2580 'uuidd',
2581 uuidd_sources,
2582 include_directories : includes,
2583 link_with : [lib_common,
2584 lib_uuid],
2585 dependencies : [realtime_libs,
2586 lib_systemd],
2587 install_dir : usrsbin_exec_dir,
2588 install : opt,
2589 build_by_default : opt)
2590 exe2 = executable(
2591 'test_uuidd',
2592 test_uuidd_sources,
2593 include_directories : includes,
2594 link_with : [lib_common,
2595 lib_uuid],
2596 dependencies : thread_libs,
2597 build_by_default : opt)
2598 if not is_disabler(exe)
2599 exes += [exe, exe2]
2600 manadocs += ['misc-utils/uuidd.8.adoc']
2601 bashcompletions += ['uuidd']
2602 endif
2603
2604 opt = build_libblkid
2605 exe = executable(
2606 'blkid',
2607 blkid_sources,
2608 include_directories : includes,
2609 link_with : [lib_common,
2610 lib_blkid],
2611 install_dir : sbindir,
2612 install : opt,
2613 build_by_default : opt)
2614 if opt and not is_disabler(exe)
2615 exes += exe
2616 manadocs += ['misc-utils/blkid.8.adoc']
2617 bashcompletions += ['blkid']
2618 endif
2619
2620 opt = opt and 'blkid' in static_programs
2621 exe = executable(
2622 'blkid.static',
2623 blkid_sources,
2624 include_directories : includes,
2625 link_with : [lib_common,
2626 lib_blkid_static],
2627 install_dir : sbindir,
2628 install : opt,
2629 build_by_default : opt)
2630 if opt and not is_disabler(exe)
2631 exes += exe
2632 endif
2633
2634 exe = executable(
2635 'sample-mkfs',
2636 'libblkid/samples/mkfs.c',
2637 include_directories : includes,
2638 link_with : lib_blkid)
2639 if not is_disabler(exe)
2640 exes += exe
2641 endif
2642
2643 exe = executable(
2644 'sample-partitions',
2645 'libblkid/samples/partitions.c',
2646 include_directories : includes,
2647 link_with : lib_blkid)
2648 if not is_disabler(exe)
2649 exes += exe
2650 endif
2651
2652 exe = executable(
2653 'sample-superblocks',
2654 'libblkid/samples/superblocks.c',
2655 include_directories : includes,
2656 link_with : lib_blkid)
2657 if not is_disabler(exe)
2658 exes += exe
2659 endif
2660
2661 exe = executable(
2662 'sample-topology',
2663 'libblkid/samples/topology.c',
2664 include_directories : includes,
2665 link_with : lib_blkid)
2666 if not is_disabler(exe)
2667 exes += exe
2668 endif
2669
2670 exe = executable(
2671 'test_blkid_fuzz_sample',
2672 'libblkid/src/fuzz.c',
2673 include_directories: includes,
2674 link_with: lib_blkid)
2675 if not is_disabler(exe)
2676 exes += exe
2677 endif
2678
2679 ############################################################
2680
2681 exe = executable(
2682 'findfs',
2683 findfs_sources,
2684 include_directories : includes,
2685 link_with : [lib_blkid],
2686 install_dir : sbindir,
2687 install : true)
2688 if not is_disabler(exe)
2689 exes += exe
2690 manadocs += ['misc-utils/findfs.8.adoc']
2691 bashcompletions += ['findfs']
2692 endif
2693
2694 exe = executable(
2695 'wipefs',
2696 wipefs_sources,
2697 include_directories : includes,
2698 link_with : [lib_common,
2699 lib_blkid,
2700 lib_smartcols],
2701 install_dir : sbindir,
2702 install : true)
2703 if not is_disabler(exe)
2704 exes += exe
2705 manadocs += ['misc-utils/wipefs.8.adoc']
2706 bashcompletions += ['wipefs']
2707 endif
2708
2709 exe = executable(
2710 'findmnt',
2711 findmnt_sources,
2712 include_directories : includes,
2713 link_with : [lib_common,
2714 lib_blkid,
2715 lib_mount,
2716 lib_smartcols],
2717 dependencies : [lib_udev],
2718 install : true)
2719 if not is_disabler(exe)
2720 exes += exe
2721 manadocs += ['misc-utils/findmnt.8.adoc']
2722 bashcompletions += ['findmnt']
2723 endif
2724
2725 exe = executable(
2726 'kill',
2727 kill_sources,
2728 include_directories : includes,
2729 link_with : [lib_common],
2730 install : true)
2731 if not is_disabler(exe)
2732 exes += exe
2733 manadocs += ['misc-utils/kill.1.adoc']
2734 endif
2735
2736 opt = not get_option('build-rename').disabled()
2737 exe = executable(
2738 'rename',
2739 rename_sources,
2740 include_directories : includes,
2741 install_dir : usrbin_exec_dir,
2742 install : opt,
2743 build_by_default : opt)
2744 if opt and not is_disabler(exe)
2745 exes += exe
2746 manadocs += ['misc-utils/rename.1.adoc']
2747 bashcompletions += ['rename']
2748 endif
2749
2750 exe = executable(
2751 'getopt',
2752 getopt_sources,
2753 include_directories : includes,
2754 link_with : [lib_common],
2755 install_dir : usrbin_exec_dir,
2756 install : true)
2757 exes += exe
2758 manadocs += ['misc-utils/getopt.1.adoc']
2759 bashcompletions += ['getopt']
2760
2761 exe = executable(
2762 'fincore',
2763 fincore_sources,
2764 include_directories : includes,
2765 link_with : [lib_common,
2766 lib_smartcols],
2767 install_dir : usrbin_exec_dir,
2768 install : true)
2769 if not is_disabler(exe)
2770 exes += exe
2771 manadocs += ['misc-utils/fincore.1.adoc']
2772 bashcompletions += ['fincore']
2773 endif
2774
2775 exe = executable(
2776 'hardlink',
2777 hardlink_sources,
2778 include_directories : includes,
2779 link_with : [lib_common],
2780 install_dir : usrbin_exec_dir,
2781 install : true)
2782 if not is_disabler(exe)
2783 exes += exe
2784 manadocs += ['misc-utils/hardlink.1.adoc']
2785 bashcompletions += ['hardlink']
2786 endif
2787
2788 opt = not get_option('build-pipesz').disabled()
2789 exe = executable(
2790 'pipesz',
2791 pipesz_sources,
2792 include_directories : includes,
2793 link_with : [lib_common],
2794 install_dir : usrbin_exec_dir,
2795 install : true)
2796 if opt and not is_disabler(exe)
2797 exes += exe
2798 manadocs += ['misc-utils/pipesz.1.adoc']
2799 bashcompletions += ['pipesz']
2800 endif
2801
2802 exe = executable(
2803 'test_cal',
2804 cal_sources,
2805 include_directories : includes,
2806 c_args : '-DTEST_CAL',
2807 link_with : [lib_common,
2808 lib_tcolors],
2809 dependencies : [curses_libs])
2810 if not is_disabler(exe)
2811 exes += exe
2812 endif
2813
2814 exe = executable(
2815 'fadvise',
2816 fadvise_sources,
2817 include_directories : includes,
2818 link_with : [lib_common],
2819 install_dir : usrbin_exec_dir,
2820 install : true)
2821 if not is_disabler(exe)
2822 exes += exe
2823 manadocs += ['misc-utils/fadvise.1.adoc']
2824 bashcompletions += ['fadvise']
2825 endif
2826
2827 exe = executable(
2828 'waitpid',
2829 waitpid_sources,
2830 include_directories : includes,
2831 link_with : [lib_common],
2832 install_dir : usrbin_exec_dir,
2833 install : true)
2834 if not is_disabler(exe)
2835 exes += exe
2836 manadocs += ['misc-utils/waitpid.1.adoc']
2837 bashcompletions += ['waitpid']
2838 endif
2839
2840 ############################################################
2841
2842 opt = not get_option('build-schedutils').disabled()
2843 exe = executable(
2844 'chrt',
2845 'schedutils/chrt.c',
2846 include_directories : includes,
2847 link_with : lib_common,
2848 install_dir : usrbin_exec_dir,
2849 install : opt,
2850 build_by_default : opt)
2851
2852 exe2 = executable(
2853 'ionice',
2854 'schedutils/ionice.c',
2855 include_directories : includes,
2856 link_with : lib_common,
2857 install_dir : usrbin_exec_dir,
2858 install : opt,
2859 build_by_default : opt)
2860
2861 exe3 = executable(
2862 'taskset',
2863 'schedutils/taskset.c',
2864 include_directories : includes,
2865 link_with : lib_common,
2866 install_dir : usrbin_exec_dir,
2867 install : opt,
2868 build_by_default : opt)
2869
2870 exe4 = executable(
2871 'uclampset',
2872 'schedutils/uclampset.c',
2873 include_directories : includes,
2874 link_with : lib_common,
2875 install_dir : usrbin_exec_dir,
2876 install : opt,
2877 build_by_default : opt)
2878
2879 if opt and not is_disabler(exe)
2880 exes += [exe, exe2, exe3, exe4]
2881 manadocs += ['schedutils/chrt.1.adoc',
2882 'schedutils/ionice.1.adoc',
2883 'schedutils/taskset.1.adoc',
2884 'schedutils/uclampset.1.adoc']
2885 bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset']
2886 endif
2887
2888 ############################################################
2889
2890 # TODO: when autotools compat is not needed, s/_/-/g in file names?
2891
2892 exe = executable(
2893 'test_ttyutils',
2894 'lib/ttyutils.c',
2895 c_args : ['-DTEST_PROGRAM_TTYUTILS'],
2896 include_directories : dir_include,
2897 link_with : lib_common)
2898 exes += exe
2899
2900 exe = executable(
2901 'test_blkdev',
2902 'lib/blkdev.c',
2903 c_args : ['-DTEST_PROGRAM_BLKDEV'],
2904 include_directories : dir_include,
2905 link_with : lib_common)
2906 exes += exe
2907
2908 exe = executable(
2909 'test_ismounted',
2910 'lib/ismounted.c',
2911 c_args : ['-DTEST_PROGRAM_ISMOUNTED'],
2912 include_directories : dir_include,
2913 link_with : lib_common)
2914 exes += exe
2915
2916 exe = executable(
2917 'test_mangle',
2918 'lib/mangle.c',
2919 c_args : ['-DTEST_PROGRAM_MANGLE'],
2920 include_directories : dir_include)
2921 exes += exe
2922
2923 exe = executable(
2924 'test_strutils',
2925 'lib/strutils.c',
2926 c_args : ['-DTEST_PROGRAM_STRUTILS'],
2927 include_directories : dir_include)
2928 exes += exe
2929
2930 exe = executable(
2931 'test_colors',
2932 'lib/colors.c',
2933 'lib/color-names.c',
2934 c_args : ['-DTEST_PROGRAM_COLORS'],
2935 include_directories : dir_include,
2936 link_with : [lib_common, lib_tcolors])
2937 exes += exe
2938
2939 exe = executable(
2940 'test_randutils',
2941 'lib/randutils.c',
2942 c_args : ['-DTEST_PROGRAM_RANDUTILS'],
2943 include_directories : dir_include)
2944 exes += exe
2945
2946 # XXX: HAVE_OPENAT && HAVE_DIRFD
2947 exe = executable(
2948 'test_procfs',
2949 'lib/procfs.c',
2950 c_args : ['-DTEST_PROGRAM_PROCFS'],
2951 include_directories : dir_include,
2952 link_with : lib_common)
2953 exes += exe
2954
2955 # XXX: HAVE_OPENAT && HAVE_DIRFD
2956 exe = executable(
2957 'test_path',
2958 'lib/path.c',
2959 'lib/fileutils.c',
2960 have_cpu_set_t ? 'lib/cpuset.c' : [],
2961 c_args : ['-DTEST_PROGRAM_PATH'],
2962 include_directories : dir_include,
2963 link_with : lib_common)
2964 exes += exe
2965
2966 # XXX: HAVE_PTY
2967 exe = executable(
2968 'test_pty',
2969 pty_session_c,
2970 monotonic_c,
2971 c_args : ['-DTEST_PROGRAM_PTY'],
2972 include_directories : dir_include,
2973 link_with : [lib_common],
2974 dependencies : [lib_m,
2975 realtime_libs,
2976 lib_util])
2977 exes += exe
2978
2979 # XXX: LINUX
2980 exe = executable(
2981 'test_cpuset',
2982 'lib/cpuset.c',
2983 c_args : ['-DTEST_PROGRAM_CPUSET'],
2984 include_directories : dir_include)
2985 exes += exe
2986
2987 exe = executable(
2988 'test_sysfs',
2989 'lib/sysfs.c',
2990 'lib/path.c',
2991 'lib/buffer.c',
2992 'lib/mbsalign.c',
2993 'lib/fileutils.c',
2994 have_cpu_set_t ? 'lib/cpuset.c' : [],
2995 c_args : ['-DTEST_PROGRAM_SYSFS'],
2996 include_directories : dir_include)
2997 exes += exe
2998
2999 exe = executable(
3000 'test_pager',
3001 'lib/pager.c',
3002 c_args : ['-DTEST_PROGRAM_PAGER'],
3003 include_directories : dir_include)
3004 exes += exe
3005
3006 exe = executable(
3007 'test_linux_version',
3008 'lib/linux_version.c',
3009 c_args : ['-DTEST_PROGRAM_LINUXVERSION'],
3010 include_directories : dir_include)
3011 exes += exe
3012
3013 exe = executable(
3014 'test_fileutils',
3015 'lib/fileutils.c',
3016 c_args : ['-DTEST_PROGRAM_FILEUTILS'],
3017 include_directories : dir_include)
3018 exes += exe
3019
3020 exe = executable(
3021 'test_canonicalize',
3022 'lib/canonicalize.c',
3023 c_args : ['-DTEST_PROGRAM_CANONICALIZE'],
3024 include_directories : dir_include)
3025 exes += exe
3026
3027 exe = executable(
3028 'test_timeutils',
3029 'lib/timeutils.c',
3030 'lib/strutils.c',
3031 c_args : ['-DTEST_PROGRAM_TIMEUTILS'],
3032 include_directories : dir_include)
3033 exes += exe
3034
3035 exe = executable(
3036 'test_pwdutils',
3037 'lib/pwdutils.c',
3038 c_args : ['-DTEST_PROGRAM'],
3039 include_directories : dir_include,
3040 link_with : lib_common)
3041 exes += exe
3042
3043 exe = executable(
3044 'test_logindefs',
3045 'lib/logindefs.c',
3046 c_args : ['-DTEST_PROGRAM'],
3047 include_directories : dir_include,
3048 link_with : [lib_common, logindefs_c])
3049 exes += exe
3050
3051
3052 ############################################################
3053
3054 exe = executable(
3055 'test_uuid_parser',
3056 'libuuid/src/test_uuid.c',
3057 include_directories : [dir_include, dir_libuuid],
3058 link_with : lib_uuid,
3059 dependencies : socket_libs)
3060 if not is_disabler(exe)
3061 exes += exe
3062 endif
3063
3064 ############################################################
3065
3066 libfdisk_tests_cflags = ['-DTEST_PROGRAM',
3067 '-Wno-unused']
3068 libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid]
3069
3070 exe = executable(
3071 'test_fdisk_ask',
3072 'libfdisk/src/ask.c',
3073 c_args : libfdisk_tests_cflags,
3074 include_directories : lib_fdisk_includes,
3075 link_with : libfdisk_tests_ldadd)
3076 if not is_disabler(exe)
3077 exes += exe
3078 endif
3079
3080 exe = executable(
3081 'test_fdisk_gpt',
3082 'libfdisk/src/gpt.c',
3083 c_args : libfdisk_tests_cflags,
3084 include_directories : lib_fdisk_includes,
3085 link_with : libfdisk_tests_ldadd)
3086 if not is_disabler(exe)
3087 exes += exe
3088 endif
3089
3090 exe = executable(
3091 'test_fdisk_utils',
3092 'libfdisk/src/utils.c',
3093 c_args : libfdisk_tests_cflags,
3094 include_directories : lib_fdisk_includes,
3095 link_with : libfdisk_tests_ldadd)
3096 if not is_disabler(exe)
3097 exes += exe
3098 endif
3099
3100 exe = executable(
3101 'test_fdisk_script',
3102 'libfdisk/src/script.c',
3103 c_args : libfdisk_tests_cflags,
3104 include_directories : lib_fdisk_includes,
3105 link_with : libfdisk_tests_ldadd)
3106 if not is_disabler(exe)
3107 exes += exe
3108 endif
3109
3110 exe = executable(
3111 'test_fdisk_version',
3112 'libfdisk/src/version.c',
3113 c_args : libfdisk_tests_cflags,
3114 include_directories : lib_fdisk_includes,
3115 link_with : libfdisk_tests_ldadd)
3116 if not is_disabler(exe)
3117 exes += exe
3118 endif
3119
3120 exe = executable(
3121 'test_fdisk_item',
3122 'libfdisk/src/item.c',
3123 c_args : libfdisk_tests_cflags,
3124 include_directories : lib_fdisk_includes,
3125 link_with : libfdisk_tests_ldadd)
3126 if not is_disabler(exe)
3127 exes += exe
3128 endif
3129
3130 sample_fdisk_cflags = ['-Wno-unused']
3131 sample_fdisk_ldadd = [lib_common, lib_fdisk]
3132
3133 exe = executable(
3134 'sample-fdisk-mkpart',
3135 'libfdisk/samples/mkpart.c',
3136 c_args : sample_fdisk_cflags,
3137 include_directories : lib_fdisk_includes,
3138 link_with : sample_fdisk_ldadd)
3139 if not is_disabler(exe)
3140 exes += exe
3141 endif
3142
3143 exe = executable(
3144 'sample-fdisk-mkpart-fullspec',
3145 'libfdisk/samples/mkpart-fullspec.c',
3146 c_args : sample_fdisk_cflags,
3147 include_directories : lib_fdisk_includes,
3148 link_with : sample_fdisk_ldadd)
3149 if not is_disabler(exe)
3150 exes += exe
3151 endif
3152
3153 ############################################################
3154
3155 exe = executable(
3156 'test_mbsencode',
3157 'tests/helpers/test_mbsencode.c',
3158 include_directories : includes,
3159 link_with : lib_common)
3160 exes += exe
3161
3162 exe = executable(
3163 'test_byteswap',
3164 'tests/helpers/test_byteswap.c',
3165 include_directories : includes)
3166 exes += exe
3167
3168 exe = executable(
3169 'test_md5',
3170 'tests/helpers/test_md5.c',
3171 md5_c,
3172 include_directories : includes)
3173 exes += exe
3174
3175 exe = executable(
3176 'test_sha1',
3177 'tests/helpers/test_sha1.c',
3178 sha1_c,
3179 include_directories : includes)
3180 exes += exe
3181
3182 exe = executable(
3183 'test_pathnames',
3184 'tests/helpers/test_pathnames.c',
3185 include_directories : includes)
3186 exes += exe
3187
3188 exe = executable(
3189 'test_strerror',
3190 'tests/helpers/test_strerror.c',
3191 include_directories : includes)
3192 exes += exe
3193
3194 exe = executable(
3195 'test_sysinfo',
3196 'tests/helpers/test_sysinfo.c',
3197 include_directories : includes)
3198 exes += exe
3199
3200 exe = executable(
3201 'test_sigreceive',
3202 'tests/helpers/test_sigreceive.c',
3203 include_directories : includes,
3204 link_with : lib_common)
3205 exes += exe
3206
3207 exe = executable(
3208 'test_tiocsti',
3209 'tests/helpers/test_tiocsti.c',
3210 include_directories : includes)
3211 exes += exe
3212
3213 exe = executable(
3214 'test_uuid_namespace',
3215 'tests/helpers/test_uuid_namespace.c',
3216 predefined_c,
3217 unpack_c,
3218 unparse_c,
3219 include_directories : includes)
3220 exes += exe
3221
3222 # XXX: LINUX
3223 exe = executable(
3224 'test_mkfds',
3225 'tests/helpers/test_mkfds.c',
3226 include_directories : includes)
3227 exes += exe
3228
3229 ############################################################
3230
3231 # XXX: HAVE_OPENAT
3232 exe = executable(
3233 'sample-scols-tree',
3234 'libsmartcols/samples/tree.c',
3235 include_directories : includes,
3236 link_with : [lib_smartcols, lib_common])
3237 if not is_disabler(exe)
3238 exes += exe
3239 endif
3240
3241 exe = executable(
3242 'sample-scols-title',
3243 'libsmartcols/samples/title.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-wrap',
3252 'libsmartcols/samples/wrap.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-continuous',
3261 'libsmartcols/samples/continuous.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-maxout',
3270 'libsmartcols/samples/maxout.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-fromfile',
3279 'libsmartcols/samples/fromfile.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-grouping-simple',
3288 'libsmartcols/samples/grouping-simple.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-overlay',
3297 'libsmartcols/samples/grouping-overlay.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 ############################################################
3305
3306 # Let the test runner know whether we're running under asan and export
3307 # some paths. We use a file on disk so that it is possible to run the
3308 # test scripts from commandline without setting any variables.
3309 configure_file(output : 'meson.conf',
3310 capture : true,
3311 command : ['echo',
3312 '''asan=@0@
3313 PYTHON=@1@
3314 '''.format(get_option('b_sanitize')=='address' ? 'yes' : '',
3315 python.path())])
3316
3317 run_sh = find_program('tests/run.sh')
3318 run_target(
3319 'check',
3320 command : [run_sh,
3321 '--srcdir=' + meson.current_source_dir(),
3322 '--builddir=' + meson.current_build_dir(),
3323 '--parallel',
3324 '--nonroot'],
3325 depends : exes)
3326
3327
3328 manadocs += ['lib/terminal-colors.d.5.adoc']
3329 manadocs += ['libblkid/libblkid.3.adoc']
3330
3331 if build_libuuid
3332 manadocs += [
3333 'libuuid/man/uuid.3.adoc',
3334 'libuuid/man/uuid_clear.3.adoc',
3335 'libuuid/man/uuid_compare.3.adoc',
3336 'libuuid/man/uuid_copy.3.adoc',
3337 'libuuid/man/uuid_generate.3.adoc',
3338 'libuuid/man/uuid_is_null.3.adoc',
3339 'libuuid/man/uuid_parse.3.adoc',
3340 'libuuid/man/uuid_time.3.adoc',
3341 'libuuid/man/uuid_unparse.3.adoc']
3342 manlinks += {
3343 'uuid_generate_random.3': 'uuid_generate.3',
3344 'uuid_generate_time.3': 'uuid_generate.3',
3345 'uuid_generate_time_safe.3': 'uuid_generate.3',
3346 }
3347 endif
3348
3349 asciidoctor = find_program('asciidoctor', required : false)
3350 if asciidoctor.found()
3351 foreach adoc : manadocs
3352 name = adoc.split('/')[-1]
3353 page = name.split('.adoc')[0]
3354 section = page.split('.')[-1]
3355 mandirn = join_paths(mandir, 'man' + section)
3356 input = adoc
3357
3358 custom_target(
3359 page,
3360 command : [ asciidoctor,
3361 '-b', 'manpage',
3362 '-a', 'VERSION=' + meson.project_version(),
3363 '-a', 'release-version=' + meson.project_version(),
3364 '-a', 'ADJTIME_PATH=/etc/adjtime',
3365 '-a', 'package-docdir=' + docdir,
3366 '--base-dir=' + meson.current_source_dir(),
3367 '--destination-dir=' + meson.current_build_dir(),
3368 '--load-path', '@SOURCE_ROOT@/tools',
3369 '--require', 'asciidoctor-includetracker',
3370 '@INPUT@'],
3371 input : input,
3372 output : [page],
3373 depfile : page + '.deps',
3374 install: true,
3375 install_dir : mandirn)
3376 endforeach
3377
3378 foreach link_name, target : manlinks
3379 link_section = link_name.split('.')[-1]
3380 target_section = target.split('.')[-1]
3381 meson.add_install_script(meson_make_manpage_stub,
3382 join_paths('man' + target_section, target),
3383 join_paths(mandir, 'man' + link_section, link_name))
3384 endforeach
3385 endif
3386
3387 if bash_completion.found()
3388 foreach completion : bashcompletions
3389 install_data(
3390 join_paths('bash-completion', completion),
3391 install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir')
3392 )
3393 endforeach
3394 foreach link_name, target : bashcompletionslinks
3395 meson.add_install_script(meson_make_symlink,
3396 target,
3397 join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name))
3398 endforeach
3399 endif