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