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