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