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