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