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