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