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>
101 [--with-mcfs Support mc's private file system],[
102 if test "x$withval" = "xno"; then
106 if test "x$mcfs" != "x"; then
107 AC_DEFINE(WITH_MCFS, 1, [Define to enable mc's private file system])
108 vfs_flags="$vfs_flags, mcfs"
110 vfs_flags="$vfs_flags, ftpfs, fish"
120 [--with-samba Support smb virtual file system],[
121 if test "x$withval" != "xno"; then
122 AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
123 vfs_flags="$vfs_flags, smbfs"
125 SAMBAFILES="\$(SAMBAFILES)"
131 if test "x$smbfs" != x ; then
132 #################################################
133 # set Samba configuration directory location
135 AC_ARG_WITH(configdir,
136 [ --with-configdir=DIR Where the Samba configuration files are (/etc)],
140 # Just in case anybody does it
142 AC_MSG_WARN([--with-configdir called without argument - will use default])
151 AC_ARG_WITH(codepagedir,
152 [ --with-codepagedir=DIR Where the Samba codepage files are],
156 # Just in case anybody does it
158 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
165 dnl The termnet support
169 [--with-termnet If you want a termified net support],[
170 if test x$withval = xyes; then
171 AC_DEFINE(USE_TERMNET, 1,
172 [Define to enable `term' firewall support])
178 AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
179 if $use_net_code; then
180 AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
183 if test $have_socket = yes; then
200 AC_DEFUN([MC_VFS_CHECKS],[
203 [--with-vfs Compile with the VFS code],
210 dnl Should we issue a warning?
217 dnl Check for struct linger
219 AC_DEFUN([AC_STRUCT_LINGER], [
221 AC_MSG_CHECKING([struct linger is available])
223 #include <sys/types.h>
224 #include <sys/socket.h>
235 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
236 [Define if `struct linger' is available])
243 AC_MSG_RESULT([$av_struct_linger])
249 dnl Check for size of d_name dirent member
251 AC_DEFUN([AC_SHORT_D_NAME_LEN], [
252 AC_MSG_CHECKING([filename fits on dirent.d_name])
253 AC_CACHE_VAL(ac_cv_dnamesize, [
255 CFLAGS="$CFLAGS -I$srcdir"
263 if (sizeof (ddd.d_name) < 12)
272 ac_cv_dnamesize="yes"
274 # Cannot find out, so assume no
279 if test x$ac_cv_dnamesize = xno; then
280 AC_DEFINE(NEED_EXTRA_DIRENT_BUFFER, 1,
281 [Define if using `struct dirent' can overwrite stack])
283 AC_MSG_RESULT([$ac_cv_dnamesize])
287 dnl Filesystem information detection
289 dnl To get information about the disk, mount points, etc.
292 AC_DEFUN([AC_GET_FS_INFO], [
293 AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
294 AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
295 AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
296 AC_CHECK_HEADERS(sys/mount.h, , , [
297 #include <sys/param.h>
298 #include <sys/stat.h>
300 AC_CHECK_FUNCS(getmntinfo)
302 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
303 dnl job is to detect a method to get list of mounted filesystems.
305 AC_MSG_CHECKING([for d_ino member in directory struct])
306 AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
308 #include <sys/types.h>
311 #else /* not HAVE_DIRENT_H */
312 # define dirent direct
313 # ifdef HAVE_SYS_NDIR_H
314 # include <sys/ndir.h>
315 # endif /* HAVE_SYS_NDIR_H */
316 # ifdef HAVE_SYS_DIR_H
317 # include <sys/dir.h>
318 # endif /* HAVE_SYS_DIR_H */
321 # endif /* HAVE_NDIR_H */
322 #endif /* HAVE_DIRENT_H */
324 [struct dirent dp; dp.d_ino = 0;],
325 fu_cv_sys_d_ino_in_dirent=yes,
326 fu_cv_sys_d_ino_in_dirent=no)])
327 AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
328 if test $fu_cv_sys_d_ino_in_dirent = yes; then
329 AC_DEFINE(D_INO_IN_DIRENT, 1,
330 [Define if `d_ino' is member of `struct directory'])
333 # Determine how to get the list of mounted filesystems.
336 # If the getmntent function is available but not in the standard library,
337 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
340 if test $ac_cv_func_getmntent = yes; then
342 # This system has the getmntent function.
343 # Determine whether it's the one-argument variant or the two-argument one.
345 if test -z "$list_mounted_fs"; then
347 AC_MSG_CHECKING([for two-argument getmntent function])
348 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
349 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
350 fu_cv_sys_mounted_getmntent2=yes,
351 fu_cv_sys_mounted_getmntent2=no)])
352 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
353 if test $fu_cv_sys_mounted_getmntent2 = yes; then
354 list_mounted_fs=found
355 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
356 [Define if function `getmntent' takes 2 arguments])
360 if test -z "$list_mounted_fs"; then
361 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
362 AC_MSG_CHECKING([for one-argument getmntent function])
363 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
364 [test $ac_cv_header_mntent_h = yes \
365 && fu_cv_sys_mounted_getmntent1=yes \
366 || fu_cv_sys_mounted_getmntent1=no])
367 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
368 if test $fu_cv_sys_mounted_getmntent1 = yes; then
369 list_mounted_fs=found
370 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
371 [Define if function `getmntent' takes 1 argument])
377 if test -z "$list_mounted_fs"; then
378 # DEC Alpha running OSF/1.
379 AC_MSG_CHECKING([for getfsstat function])
380 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
382 #include <sys/types.h>
383 #include <sys/mount.h>
384 #include <sys/fs_types.h>],
385 [struct statfs *stats;
386 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
387 fu_cv_sys_mounted_getsstat=yes,
388 fu_cv_sys_mounted_getsstat=no)])
389 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
390 if test $fu_cv_sys_mounted_getsstat = yes; then
391 list_mounted_fs=found
392 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
393 [Define if function `getfsstat' can be used])
397 if test -z "$list_mounted_fs"; then
399 AC_MSG_CHECKING([for mntctl function and struct vmount])
400 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
401 [AC_TRY_CPP([#include <fshelp.h>],
402 fu_cv_sys_mounted_vmount=yes,
403 fu_cv_sys_mounted_vmount=no)])
404 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
405 if test $fu_cv_sys_mounted_vmount = yes; then
406 list_mounted_fs=found
407 AC_DEFINE(MOUNTED_VMOUNT, 1,
408 [Define if function `mntctl' and `struct vmount' can be used])
412 if test -z "$list_mounted_fs"; then
414 AC_MSG_CHECKING([for existence of three headers])
415 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
417 #include <sys/statfs.h>
418 #include <sys/fstyp.h>
419 #include <mnttab.h>],
420 fu_cv_sys_mounted_fread_fstyp=yes,
421 fu_cv_sys_mounted_fread_fstyp=no)])
422 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
423 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
424 list_mounted_fs=found
425 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
426 [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
427 can be used together])
431 if test -z "$list_mounted_fs"; then
432 # 4.4BSD and DEC OSF/1.
433 AC_MSG_CHECKING([for getmntinfo function])
434 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
437 if test $ac_cv_func_getmntinfo = yes; then
438 AC_EGREP_HEADER(f_type;, sys/mount.h,
442 && fu_cv_sys_mounted_getmntinfo=yes \
443 || fu_cv_sys_mounted_getmntinfo=no
445 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
446 if test $fu_cv_sys_mounted_getmntinfo = yes; then
447 list_mounted_fs=found
448 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
449 [Define if `getmntinfo' function can be used])
450 AC_MSG_CHECKING([if struct statfs has f_fstypename])
451 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
452 [AC_EGREP_HEADER([f_fstypename],
454 [fu_cv_sys_mounted_f_fstypename=yes],
455 [fu_cv_sys_mounted_f_fstypename=no])
457 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
458 if test $fu_cv_sys_mounted_f_fstypename = yes; then
459 AC_DEFINE(HAVE_F_FSTYPENAME, 1,
460 [Define if `f_fstypename' is member of `struct statfs'])
465 if test -z "$list_mounted_fs"; then
467 AC_MSG_CHECKING([for getmnt function])
468 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
470 #include <sys/fs_types.h>
471 #include <sys/mount.h>],
472 fu_cv_sys_mounted_getmnt=yes,
473 fu_cv_sys_mounted_getmnt=no)])
474 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
475 if test $fu_cv_sys_mounted_getmnt = yes; then
476 list_mounted_fs=found
477 AC_DEFINE(MOUNTED_GETMNT, 1,
478 [Define if `getmnt' function can be used])
482 if test -z "$list_mounted_fs"; then
484 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
485 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
486 [AC_TRY_CPP([#include <mnttab.h>],
487 fu_cv_sys_mounted_fread=yes,
488 fu_cv_sys_mounted_fread=no)])
489 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
490 if test $fu_cv_sys_mounted_fread = yes; then
491 list_mounted_fs=found
492 AC_DEFINE(MOUNTED_FREAD, 1,
493 [Define if it's possible to resort to fread on /etc/mnttab])
497 if test -z "$list_mounted_fs"; then
498 AC_MSG_WARN([could not determine how to read list of mounted fs])
500 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
501 [Define if the list of mounted filesystems can be determined])
504 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
505 dnl job is to detect a method to get file system information.
507 AC_MSG_NOTICE([checking how to get filesystem space usage])
510 # Here we'll compromise a little (and perform only the link test)
511 # since it seems there are no variants of the statvfs function.
512 if test $space = no; then
514 AC_CHECK_FUNCS(statvfs)
515 if test $ac_cv_func_statvfs = yes; then
517 AC_DEFINE(STAT_STATVFS, 1,
518 [Define if function `statfs' can be used])
522 if test $space = no; then
523 # DEC Alpha running OSF/1
524 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
525 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
527 #include <sys/param.h>
528 #include <sys/types.h>
529 #include <sys/mount.h>
534 exit (statfs (".", &fsd, sizeof (struct statfs)));
536 fu_cv_sys_stat_statfs3_osf1=yes,
537 fu_cv_sys_stat_statfs3_osf1=no,
538 fu_cv_sys_stat_statfs3_osf1=no)])
539 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
540 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
542 AC_DEFINE(STAT_STATFS3_OSF1, 1,
543 [Define if function `statfs' takes 3 arguments])
547 if test $space = no; then
549 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
550 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
552 #ifdef HAVE_SYS_PARAM_H
553 #include <sys/param.h>
555 #ifdef HAVE_SYS_MOUNT_H
556 #include <sys/mount.h>
558 #ifdef HAVE_SYS_VFS_H
565 exit (statfs (".", &fsd));
567 fu_cv_sys_stat_statfs2_bsize=yes,
568 fu_cv_sys_stat_statfs2_bsize=no,
569 fu_cv_sys_stat_statfs2_bsize=no)])
570 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
571 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
573 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
574 [Define if function `statfs' takes two arguments and
575 `bsize' is member of `struct statfs'])
579 if test $space = no; then
581 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
582 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
583 [AC_TRY_RUN([#include <sys/types.h>
584 #include <sys/statfs.h>
588 exit (statfs (".", &fsd, sizeof fsd, 0));
590 fu_cv_sys_stat_statfs4=yes,
591 fu_cv_sys_stat_statfs4=no,
592 fu_cv_sys_stat_statfs4=no)])
593 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
594 if test $fu_cv_sys_stat_statfs4 = yes; then
596 AC_DEFINE(STAT_STATFS4, 1,
597 [Define if function `statfs' takes 4 arguments])
601 if test $space = no; then
603 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
604 member (4.4BSD and NetBSD)])
605 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
606 [AC_TRY_RUN([#include <sys/types.h>
607 #ifdef HAVE_SYS_PARAM_H
608 #include <sys/param.h>
610 #ifdef HAVE_SYS_MOUNT_H
611 #include <sys/mount.h>
617 exit (statfs (".", &fsd));
619 fu_cv_sys_stat_statfs2_fsize=yes,
620 fu_cv_sys_stat_statfs2_fsize=no,
621 fu_cv_sys_stat_statfs2_fsize=no)])
622 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
623 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
625 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
626 [Define if function `statfs' takes two arguments and
627 `fsize' is member of `struct statfs'])
631 if test $space = no; then
633 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
634 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
636 #include <sys/types.h>
637 #ifdef HAVE_SYS_PARAM_H
638 #include <sys/param.h>
640 #ifdef HAVE_SYS_MOUNT_H
641 #include <sys/mount.h>
643 #ifdef HAVE_SYS_FS_TYPES_H
644 #include <sys/fs_types.h>
649 /* Ultrix's statfs returns 1 for success,
650 0 for not mounted, -1 for failure. */
651 exit (statfs (".", &fsd) != 1);
653 fu_cv_sys_stat_fs_data=yes,
654 fu_cv_sys_stat_fs_data=no,
655 fu_cv_sys_stat_fs_data=no)])
656 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
657 if test $fu_cv_sys_stat_fs_data = yes; then
659 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
660 [Define if function `statfs' takes two arguments
661 and uses `struct fs_data'])
666 dnl if test $space = no; then
668 dnl AC_TRY_CPP([#include <sys/filsys.h>],
669 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
673 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
674 dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
675 AC_DEFUN([AC_TRY_WARNINGS],
676 [cat > conftest.$ac_ext <<EOF
677 dnl This sometimes fails to find confdefs.h, for some reason.
678 dnl [#]line __oline__ "[$]0"
679 [#]line __oline__ "configure"
680 #include "confdefs.h"
682 int main() { return 0; }
687 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
688 if { if eval $ac_compile_warn; then :; else echo arning; fi; } |
689 grep arning 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
690 ifelse([$4], , :, [rm -rf conftest*
692 ifelse([$3], , , [else
700 AC_DEFUN([AC_USE_TERMINFO], [
701 AC_DEFINE(SLANG_TERMINFO, 1, [Define to use S-Lang with terminfo])
702 AC_MSG_NOTICE([using SLang screen manager/terminfo])
703 slang_term=" with terminfo"
706 AC_DEFUN([AC_USE_TERMCAP], [
707 AC_MSG_NOTICE([using S-Lang screen manager/termcap])
708 AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
709 dnl Check with $LIBS at the end so that it works with ELF libs.
710 AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap"], , [$LIBS])
711 slang_term=" with termcap"
714 AC_DEFUN([AC_WITH_SLANG], [
715 AC_DEFINE(HAVE_SLANG, 1,
716 [Define to use S-Lang library for screen management])
719 if $slang_use_system_installed_lib
721 AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
722 [Define to use S-Lang library installed on the system])
723 MCLIBS="-lslang $MCLIBS"
724 screen_manager="SLang (system-installed library)"
725 AC_MSG_NOTICE([using system installed S-Lang library])
730 #ifdef HAVE_SLANG_SLANG_H
731 #include <slang/slang.h>
737 [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO],
738 [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
740 screen_manager="SLang"
745 for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
746 /usr/local/share /usr/share
748 if test -d $dir/terminfo; then
753 if $use_terminfo; then
761 AC_DEFUN([AC_WITH_EDIT], [
762 AC_DEFINE(USE_INTERNAL_EDIT, 1,
763 [Define to enable internal editor])
764 LIBEDIT_A="libedit.a"
768 AC_MSG_NOTICE([using internal editor])
771 AC_DEFUN([AC_EXT2_UNDEL], [
773 if test "$ext2fs_undel" = yes; then
774 AC_MSG_NOTICE([using ext2fs file recovery code])
775 vfs_flags="${vfs_flags}, undelfs"
776 undelfs_o="undelfs.o"
777 LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
779 AC_MSG_NOTICE([not using ext2fs file recovery code])
784 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
786 AC_DEFUN([AC_NCURSES], [
791 AC_MSG_NOTICE([found ncurses header $1/$2])
793 CPPFLAGS="$CPPFLAGS $4"
795 screen_type="ncurses"
797 AC_DEFINE(USE_NCURSES, 1,
798 [Define to use ncurses for screen management])