2 dnl Check for ext2fs undel support.
3 dnl Set shell variable ext2fs_undel to "yes" if we have it,
4 dnl "no" otherwise. May define USE_EXT2FSLIB for cpp.
5 dnl Will set EXT2FS_UNDEL_LIBS to required libraries.
7 AC_DEFUN([MC_UNDELFS_CHECKS], [
10 AC_CHECK_HEADERS(linux/ext2_fs.h)
11 if test x$ac_cv_header_linux_ext2_fs_h = xyes
13 AC_CHECK_HEADERS(ext2fs/ext2fs.h, , , [#include <stdio.h>
14 #include <linux/ext2_fs.h>])
15 if test x$ac_cv_header_ext2fs_ext2fs_h = xyes
17 AC_DEFINE(USE_EXT2FSLIB, 1,
18 [Define to enable undelete support on ext2])
20 EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
21 AC_CHECK_TYPE(ext2_ino_t, ,
22 [AC_DEFINE(ext2_ino_t, ino_t,
23 [Define to ino_t if undefined.])],
28 /* asm/types.h defines its own umode_t :-( */
30 #include <linux/ext2_fs.h>
31 #include <ext2fs/ext2fs.h>])
39 dnl Check for various functions needed by libvfs.
40 dnl This has various effects:
41 dnl Sets MC_VFS_LIBS to libraries required
42 dnl Sets termnet to true or false depending on whether it is required.
43 dnl If yes, defines USE_TERMNET.
44 dnl Sets vfs_flags to "pretty" list of vfs implementations we include.
45 dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
46 dnl "no" (--without-vfs).
47 dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv".
50 AC_DEFUN([MC_WITH_VFS],[
51 dnl FIXME: network checks should probably be in their own macro.
52 AC_CHECK_LIB(nsl, t_accept)
53 AC_CHECK_LIB(socket, socket)
56 AC_CHECK_FUNCS(socket, have_socket=yes)
57 if test $have_socket = no; then
58 # socket is not in the default libraries. See if it's in some other.
59 for lib in bsd socket inet; do
60 AC_CHECK_LIB([$lib], [socket], [
63 AC_DEFINE(HAVE_SOCKET)
69 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
70 if test $have_gethostbyname = no; then
71 # gethostbyname is not in the default libraries. See if it's in some other.
72 for lib in bsd socket inet; do
73 AC_CHECK_LIB([$lib], [gethostbyname],
74 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
80 if test $have_socket = yes; then
82 AC_CHECK_FUNCS(pmap_set, , [
83 AC_CHECK_LIB(rpc, pmap_set, [
85 AC_DEFINE(HAVE_PMAP_SET)
87 AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
88 dnl add for source routing support setsockopt
89 AC_CHECK_HEADERS(rpc/pmap_clnt.h, , , [
90 #include <sys/types.h>
91 #include <sys/socket.h>
92 #include <netinet/in.h>
94 #include <rpc/pmap_prot.h>
96 vfs_flags="$vfs_flags, mcfs, ftpfs, fish"
106 [--with-samba Support smb virtual file system],[
107 if test "x$withval" != "xno"; then
108 AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
109 vfs_flags="$vfs_flags, smbfs"
111 SAMBAFILES="\$(SAMBAFILES)"
118 dnl The termnet support
122 [--with-termnet If you want a termified net support],[
123 if test x$withval = xyes; then
124 AC_DEFINE(USE_TERMNET, 1,
125 [Define to enable `term' firewall support])
131 AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
132 if $use_net_code; then
133 AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
136 if test $have_socket = yes; then
153 AC_DEFUN([MC_VFS_CHECKS],[
156 [--with-vfs Compile with the VFS code],
163 dnl Should we issue a warning?
170 dnl Check for struct linger
172 AC_DEFUN([AC_STRUCT_LINGER], [
174 AC_MSG_CHECKING([struct linger is available])
176 #include <sys/types.h>
177 #include <sys/socket.h>
188 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
189 [Define if `struct linger' is available])
196 AC_MSG_RESULT([$av_struct_linger])
202 dnl Check for size of d_name dirent member
204 AC_DEFUN([AC_SHORT_D_NAME_LEN], [
205 AC_MSG_CHECKING([filename fits on dirent.d_name])
206 AC_CACHE_VAL(ac_cv_dnamesize, [
208 CFLAGS="$CFLAGS -I$srcdir"
216 if (sizeof (ddd.d_name) < 12)
225 ac_cv_dnamesize="yes"
227 # Cannot find out, so assume no
232 if test x$ac_cv_dnamesize = xno; then
233 AC_DEFINE(NEED_EXTRA_DIRENT_BUFFER, 1,
234 [Define if using `struct dirent' can overwrite stack])
236 AC_MSG_RESULT([$ac_cv_dnamesize])
240 dnl Filesystem information detection
242 dnl To get information about the disk, mount points, etc.
245 AC_DEFUN([AC_GET_FS_INFO], [
246 AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
247 AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
248 AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
249 AC_CHECK_HEADERS(sys/mount.h, , , [
250 #include <sys/param.h>
251 #include <sys/stat.h>
253 AC_CHECK_FUNCS(getmntinfo)
255 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
256 dnl job is to detect a method to get list of mounted filesystems.
258 AC_MSG_CHECKING([for d_ino member in directory struct])
259 AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
261 #include <sys/types.h>
264 #else /* not HAVE_DIRENT_H */
265 # define dirent direct
266 # ifdef HAVE_SYS_NDIR_H
267 # include <sys/ndir.h>
268 # endif /* HAVE_SYS_NDIR_H */
269 # ifdef HAVE_SYS_DIR_H
270 # include <sys/dir.h>
271 # endif /* HAVE_SYS_DIR_H */
274 # endif /* HAVE_NDIR_H */
275 #endif /* HAVE_DIRENT_H */
277 [struct dirent dp; dp.d_ino = 0;],
278 fu_cv_sys_d_ino_in_dirent=yes,
279 fu_cv_sys_d_ino_in_dirent=no)])
280 AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
281 if test $fu_cv_sys_d_ino_in_dirent = yes; then
282 AC_DEFINE(D_INO_IN_DIRENT, 1,
283 [Define if `d_ino' is member of `struct directory'])
286 # Determine how to get the list of mounted filesystems.
289 # If the getmntent function is available but not in the standard library,
290 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
293 if test $ac_cv_func_getmntent = yes; then
295 # This system has the getmntent function.
296 # Determine whether it's the one-argument variant or the two-argument one.
298 if test -z "$list_mounted_fs"; then
300 AC_MSG_CHECKING([for two-argument getmntent function])
301 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
302 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
303 fu_cv_sys_mounted_getmntent2=yes,
304 fu_cv_sys_mounted_getmntent2=no)])
305 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
306 if test $fu_cv_sys_mounted_getmntent2 = yes; then
307 list_mounted_fs=found
308 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
309 [Define if function `getmntent' takes 2 arguments])
313 if test -z "$list_mounted_fs"; then
314 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
315 AC_MSG_CHECKING([for one-argument getmntent function])
316 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
317 [test $ac_cv_header_mntent_h = yes \
318 && fu_cv_sys_mounted_getmntent1=yes \
319 || fu_cv_sys_mounted_getmntent1=no])
320 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
321 if test $fu_cv_sys_mounted_getmntent1 = yes; then
322 list_mounted_fs=found
323 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
324 [Define if function `getmntent' takes 1 argument])
330 if test -z "$list_mounted_fs"; then
331 # DEC Alpha running OSF/1.
332 AC_MSG_CHECKING([for getfsstat function])
333 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
335 #include <sys/types.h>
336 #include <sys/mount.h>
337 #include <sys/fs_types.h>],
338 [struct statfs *stats;
339 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
340 fu_cv_sys_mounted_getsstat=yes,
341 fu_cv_sys_mounted_getsstat=no)])
342 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
343 if test $fu_cv_sys_mounted_getsstat = yes; then
344 list_mounted_fs=found
345 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
346 [Define if function `getfsstat' can be used])
350 if test -z "$list_mounted_fs"; then
352 AC_MSG_CHECKING([for mntctl function and struct vmount])
353 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
354 [AC_TRY_CPP([#include <fshelp.h>],
355 fu_cv_sys_mounted_vmount=yes,
356 fu_cv_sys_mounted_vmount=no)])
357 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
358 if test $fu_cv_sys_mounted_vmount = yes; then
359 list_mounted_fs=found
360 AC_DEFINE(MOUNTED_VMOUNT, 1,
361 [Define if function `mntctl' and `struct vmount' can be used])
365 if test -z "$list_mounted_fs"; then
367 AC_MSG_CHECKING([for existence of three headers])
368 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
370 #include <sys/statfs.h>
371 #include <sys/fstyp.h>
372 #include <mnttab.h>],
373 fu_cv_sys_mounted_fread_fstyp=yes,
374 fu_cv_sys_mounted_fread_fstyp=no)])
375 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
376 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
377 list_mounted_fs=found
378 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
379 [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
380 can be used together])
384 if test -z "$list_mounted_fs"; then
385 # 4.4BSD and DEC OSF/1.
386 AC_MSG_CHECKING([for getmntinfo function])
387 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
390 if test $ac_cv_func_getmntinfo = yes; then
391 AC_EGREP_HEADER(f_type;, sys/mount.h,
395 && fu_cv_sys_mounted_getmntinfo=yes \
396 || fu_cv_sys_mounted_getmntinfo=no
398 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
399 if test $fu_cv_sys_mounted_getmntinfo = yes; then
400 list_mounted_fs=found
401 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
402 [Define if `getmntinfo' function can be used])
403 AC_MSG_CHECKING([if struct statfs has f_fstypename])
404 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
405 [AC_EGREP_HEADER([f_fstypename],
407 [fu_cv_sys_mounted_f_fstypename=yes],
408 [fu_cv_sys_mounted_f_fstypename=no])
410 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
411 if test $fu_cv_sys_mounted_f_fstypename = yes; then
412 AC_DEFINE(HAVE_F_FSTYPENAME, 1,
413 [Define if `f_fstypename' is member of `struct statfs'])
418 if test -z "$list_mounted_fs"; then
420 AC_MSG_CHECKING([for getmnt function])
421 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
423 #include <sys/fs_types.h>
424 #include <sys/mount.h>],
425 fu_cv_sys_mounted_getmnt=yes,
426 fu_cv_sys_mounted_getmnt=no)])
427 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
428 if test $fu_cv_sys_mounted_getmnt = yes; then
429 list_mounted_fs=found
430 AC_DEFINE(MOUNTED_GETMNT, 1,
431 [Define if `getmnt' function can be used])
435 if test -z "$list_mounted_fs"; then
437 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
438 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
439 [AC_TRY_CPP([#include <mnttab.h>],
440 fu_cv_sys_mounted_fread=yes,
441 fu_cv_sys_mounted_fread=no)])
442 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
443 if test $fu_cv_sys_mounted_fread = yes; then
444 list_mounted_fs=found
445 AC_DEFINE(MOUNTED_FREAD, 1,
446 [Define if it's possible to resort to fread on /etc/mnttab])
450 if test -z "$list_mounted_fs"; then
451 AC_MSG_WARN([could not determine how to read list of mounted fs])
453 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
454 [Define if the list of mounted filesystems can be determined])
457 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
458 dnl job is to detect a method to get file system information.
460 AC_MSG_NOTICE([checking how to get filesystem space usage])
463 # Here we'll compromise a little (and perform only the link test)
464 # since it seems there are no variants of the statvfs function.
465 if test $space = no; then
467 AC_CHECK_FUNCS(statvfs)
468 if test $ac_cv_func_statvfs = yes; then
470 AC_DEFINE(STAT_STATVFS, 1,
471 [Define if function `statfs' can be used])
475 if test $space = no; then
476 # DEC Alpha running OSF/1
477 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
478 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
480 #include <sys/param.h>
481 #include <sys/types.h>
482 #include <sys/mount.h>
487 exit (statfs (".", &fsd, sizeof (struct statfs)));
489 fu_cv_sys_stat_statfs3_osf1=yes,
490 fu_cv_sys_stat_statfs3_osf1=no,
491 fu_cv_sys_stat_statfs3_osf1=no)])
492 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
493 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
495 AC_DEFINE(STAT_STATFS3_OSF1, 1,
496 [Define if function `statfs' takes 3 arguments])
500 if test $space = no; then
502 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
503 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
505 #ifdef HAVE_SYS_PARAM_H
506 #include <sys/param.h>
508 #ifdef HAVE_SYS_MOUNT_H
509 #include <sys/mount.h>
511 #ifdef HAVE_SYS_VFS_H
518 exit (statfs (".", &fsd));
520 fu_cv_sys_stat_statfs2_bsize=yes,
521 fu_cv_sys_stat_statfs2_bsize=no,
522 fu_cv_sys_stat_statfs2_bsize=no)])
523 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
524 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
526 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
527 [Define if function `statfs' takes two arguments and
528 `bsize' is member of `struct statfs'])
532 if test $space = no; then
534 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
535 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
536 [AC_TRY_RUN([#include <sys/types.h>
537 #include <sys/statfs.h>
541 exit (statfs (".", &fsd, sizeof fsd, 0));
543 fu_cv_sys_stat_statfs4=yes,
544 fu_cv_sys_stat_statfs4=no,
545 fu_cv_sys_stat_statfs4=no)])
546 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
547 if test $fu_cv_sys_stat_statfs4 = yes; then
549 AC_DEFINE(STAT_STATFS4, 1,
550 [Define if function `statfs' takes 4 arguments])
554 if test $space = no; then
556 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
557 member (4.4BSD and NetBSD)])
558 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
559 [AC_TRY_RUN([#include <sys/types.h>
560 #ifdef HAVE_SYS_PARAM_H
561 #include <sys/param.h>
563 #ifdef HAVE_SYS_MOUNT_H
564 #include <sys/mount.h>
570 exit (statfs (".", &fsd));
572 fu_cv_sys_stat_statfs2_fsize=yes,
573 fu_cv_sys_stat_statfs2_fsize=no,
574 fu_cv_sys_stat_statfs2_fsize=no)])
575 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
576 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
578 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
579 [Define if function `statfs' takes two arguments and
580 `fsize' is member of `struct statfs'])
584 if test $space = no; then
586 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
587 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
589 #include <sys/types.h>
590 #ifdef HAVE_SYS_PARAM_H
591 #include <sys/param.h>
593 #ifdef HAVE_SYS_MOUNT_H
594 #include <sys/mount.h>
596 #ifdef HAVE_SYS_FS_TYPES_H
597 #include <sys/fs_types.h>
602 /* Ultrix's statfs returns 1 for success,
603 0 for not mounted, -1 for failure. */
604 exit (statfs (".", &fsd) != 1);
606 fu_cv_sys_stat_fs_data=yes,
607 fu_cv_sys_stat_fs_data=no,
608 fu_cv_sys_stat_fs_data=no)])
609 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
610 if test $fu_cv_sys_stat_fs_data = yes; then
612 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
613 [Define if function `statfs' takes two arguments
614 and uses `struct fs_data'])
619 dnl if test $space = no; then
621 dnl AC_TRY_CPP([#include <sys/filsys.h>],
622 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
626 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
627 dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
628 AC_DEFUN([AC_TRY_WARNINGS],
629 [cat > conftest.$ac_ext <<EOF
630 dnl This sometimes fails to find confdefs.h, for some reason.
631 dnl [#]line __oline__ "[$]0"
632 [#]line __oline__ "configure"
633 #include "confdefs.h"
635 int main() { return 0; }
640 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
641 if { if eval $ac_compile_warn; then :; else echo arning; fi; } |
642 grep arning 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
643 ifelse([$4], , :, [rm -rf conftest*
645 ifelse([$3], , , [else
653 AC_DEFUN([AC_USE_TERMINFO], [
654 AC_DEFINE(SLANG_TERMINFO, 1, [Define to use S-Lang with terminfo])
655 AC_MSG_NOTICE([using SLang screen manager/terminfo])
656 slang_term=" with terminfo"
659 AC_DEFUN([AC_USE_TERMCAP], [
660 AC_MSG_NOTICE([using S-Lang screen manager/termcap])
661 AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
662 dnl Check with $LIBS at the end so that it works with ELF libs.
663 AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap"], , [$LIBS])
664 slang_term=" with termcap"
667 AC_DEFUN([AC_WITH_SLANG], [
668 AC_DEFINE(HAVE_SLANG, 1,
669 [Define to use S-Lang library for screen management])
671 if $slang_use_system_installed_lib
673 AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
674 [Define to use S-Lang library installed on the system])
675 MCLIBS="-lslang $MCLIBS"
676 screen_manager="SLang (system-installed library)"
677 AC_MSG_NOTICE([using system installed S-Lang library])
683 #ifdef HAVE_SLANG_SLANG_H
684 #include <slang/slang.h>
690 [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO],
691 [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
693 screen_manager="SLang"
694 CPPFLAGS="$CPPFLAGS -I../slang"
699 for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
700 /usr/local/share /usr/share
702 if test -d $dir/terminfo; then
707 if $use_terminfo; then
715 AC_DEFUN([AC_WITH_EDIT], [
716 AC_DEFINE(USE_INTERNAL_EDIT, 1,
717 [Define to enable internal editor])
718 LIBEDIT_A="libedit.a"
722 AC_MSG_NOTICE([using internal editor])
725 AC_DEFUN([AC_EXT2_UNDEL], [
727 if test "$ext2fs_undel" = yes; then
728 AC_MSG_NOTICE([using ext2fs file recovery code])
729 vfs_flags="${vfs_flags}, undelfs"
730 undelfs_o="undelfs.o"
731 LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
733 AC_MSG_NOTICE([not using ext2fs file recovery code])
738 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
740 AC_DEFUN([AC_NCURSES], [
745 AC_MSG_NOTICE([found ncurses header $1/$2])
747 CPPFLAGS="$CPPFLAGS $4"
750 AC_DEFINE(USE_NCURSES, 1,
751 [Define to use ncurses for screen management])