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