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