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>
100 [--with-mcfs Support mc-specific networking file system],[
101 if test "x$withval" != "xno"; then
102 AC_DEFINE(WITH_MCFS, 1, [Define to enable mc-specific networking file system])
103 vfs_flags="$vfs_flags, mcfs"
106 vfs_flags="$vfs_flags, ftpfs, fish"
116 [--with-samba Support smb virtual file system],[
117 if test "x$withval" != "xno"; then
118 AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
119 vfs_flags="$vfs_flags, smbfs"
121 SAMBAFILES="\$(SAMBAFILES)"
127 if test "x$smbfs" != x ; then
128 #################################################
129 # set Samba configuration directory location
131 AC_ARG_WITH(configdir,
132 [ --with-configdir=DIR Where the Samba configuration files are (/etc)],
136 # Just in case anybody does it
138 AC_MSG_WARN([--with-configdir called without argument - will use default])
147 AC_ARG_WITH(codepagedir,
148 [ --with-codepagedir=DIR Where the Samba codepage files are],
152 # Just in case anybody does it
154 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
161 dnl The termnet support
165 [--with-termnet If you want a termified net support],[
166 if test x$withval = xyes; then
167 AC_DEFINE(USE_TERMNET, 1,
168 [Define to enable `term' firewall support])
174 AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
175 if $use_net_code; then
176 AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
179 if test $have_socket = yes; then
196 AC_DEFUN([MC_VFS_CHECKS],[
199 [--with-vfs Compile with the VFS code],
206 dnl Should we issue a warning?
213 dnl Check for struct linger
215 AC_DEFUN([AC_STRUCT_LINGER], [
217 AC_MSG_CHECKING([struct linger is available])
219 #include <sys/types.h>
220 #include <sys/socket.h>
231 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
232 [Define if `struct linger' is available])
239 AC_MSG_RESULT([$av_struct_linger])
244 dnl Filesystem information detection
246 dnl To get information about the disk, mount points, etc.
249 AC_DEFUN([AC_GET_FS_INFO], [
250 AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
251 AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
252 AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
253 AC_CHECK_HEADERS(sys/mount.h, , , [
254 #include <sys/param.h>
255 #include <sys/stat.h>
257 AC_CHECK_FUNCS(getmntinfo)
259 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
260 dnl job is to detect a method to get list of mounted filesystems.
262 AC_MSG_CHECKING([for d_ino member in directory struct])
263 AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
265 #include <sys/types.h>
268 #else /* not HAVE_DIRENT_H */
269 # define dirent direct
270 # ifdef HAVE_SYS_NDIR_H
271 # include <sys/ndir.h>
272 # endif /* HAVE_SYS_NDIR_H */
273 # ifdef HAVE_SYS_DIR_H
274 # include <sys/dir.h>
275 # endif /* HAVE_SYS_DIR_H */
278 # endif /* HAVE_NDIR_H */
279 #endif /* HAVE_DIRENT_H */
281 [struct dirent dp; dp.d_ino = 0;],
282 fu_cv_sys_d_ino_in_dirent=yes,
283 fu_cv_sys_d_ino_in_dirent=no)])
284 AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
285 if test $fu_cv_sys_d_ino_in_dirent = yes; then
286 AC_DEFINE(D_INO_IN_DIRENT, 1,
287 [Define if `d_ino' is member of `struct directory'])
290 # Determine how to get the list of mounted filesystems.
293 # If the getmntent function is available but not in the standard library,
294 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
297 if test $ac_cv_func_getmntent = yes; then
299 # This system has the getmntent function.
300 # Determine whether it's the one-argument variant or the two-argument one.
302 if test -z "$list_mounted_fs"; then
304 AC_MSG_CHECKING([for two-argument getmntent function])
305 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
306 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
307 fu_cv_sys_mounted_getmntent2=yes,
308 fu_cv_sys_mounted_getmntent2=no)])
309 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
310 if test $fu_cv_sys_mounted_getmntent2 = yes; then
311 list_mounted_fs=found
312 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
313 [Define if function `getmntent' takes 2 arguments])
317 if test -z "$list_mounted_fs"; then
318 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
319 AC_MSG_CHECKING([for one-argument getmntent function])
320 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
321 [test $ac_cv_header_mntent_h = yes \
322 && fu_cv_sys_mounted_getmntent1=yes \
323 || fu_cv_sys_mounted_getmntent1=no])
324 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
325 if test $fu_cv_sys_mounted_getmntent1 = yes; then
326 list_mounted_fs=found
327 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
328 [Define if function `getmntent' takes 1 argument])
334 if test -z "$list_mounted_fs"; then
335 # DEC Alpha running OSF/1.
336 AC_MSG_CHECKING([for getfsstat function])
337 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
339 #include <sys/types.h>
340 #include <sys/mount.h>
341 #include <sys/fs_types.h>],
342 [struct statfs *stats;
343 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
344 fu_cv_sys_mounted_getsstat=yes,
345 fu_cv_sys_mounted_getsstat=no)])
346 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
347 if test $fu_cv_sys_mounted_getsstat = yes; then
348 list_mounted_fs=found
349 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
350 [Define if function `getfsstat' can be used])
354 if test -z "$list_mounted_fs"; then
356 AC_MSG_CHECKING([for mntctl function and struct vmount])
357 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
358 [AC_TRY_CPP([#include <fshelp.h>],
359 fu_cv_sys_mounted_vmount=yes,
360 fu_cv_sys_mounted_vmount=no)])
361 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
362 if test $fu_cv_sys_mounted_vmount = yes; then
363 list_mounted_fs=found
364 AC_DEFINE(MOUNTED_VMOUNT, 1,
365 [Define if function `mntctl' and `struct vmount' can be used])
369 if test -z "$list_mounted_fs"; then
371 AC_MSG_CHECKING([for existence of three headers])
372 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
374 #include <sys/statfs.h>
375 #include <sys/fstyp.h>
376 #include <mnttab.h>],
377 fu_cv_sys_mounted_fread_fstyp=yes,
378 fu_cv_sys_mounted_fread_fstyp=no)])
379 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
380 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
381 list_mounted_fs=found
382 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
383 [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
384 can be used together])
388 if test -z "$list_mounted_fs"; then
389 # 4.4BSD and DEC OSF/1.
390 AC_MSG_CHECKING([for getmntinfo function])
391 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
394 if test $ac_cv_func_getmntinfo = yes; then
395 AC_EGREP_HEADER(f_type;, sys/mount.h,
399 && fu_cv_sys_mounted_getmntinfo=yes \
400 || fu_cv_sys_mounted_getmntinfo=no
402 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
403 if test $fu_cv_sys_mounted_getmntinfo = yes; then
404 list_mounted_fs=found
405 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
406 [Define if `getmntinfo' function can be used])
407 AC_MSG_CHECKING([if struct statfs has f_fstypename])
408 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
409 [AC_EGREP_HEADER([f_fstypename],
411 [fu_cv_sys_mounted_f_fstypename=yes],
412 [fu_cv_sys_mounted_f_fstypename=no])
414 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
415 if test $fu_cv_sys_mounted_f_fstypename = yes; then
416 AC_DEFINE(HAVE_F_FSTYPENAME, 1,
417 [Define if `f_fstypename' is member of `struct statfs'])
422 if test -z "$list_mounted_fs"; then
424 AC_MSG_CHECKING([for getmnt function])
425 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
427 #include <sys/fs_types.h>
428 #include <sys/mount.h>],
429 fu_cv_sys_mounted_getmnt=yes,
430 fu_cv_sys_mounted_getmnt=no)])
431 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
432 if test $fu_cv_sys_mounted_getmnt = yes; then
433 list_mounted_fs=found
434 AC_DEFINE(MOUNTED_GETMNT, 1,
435 [Define if `getmnt' function can be used])
439 if test -z "$list_mounted_fs"; then
441 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
442 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
443 [AC_TRY_CPP([#include <mnttab.h>],
444 fu_cv_sys_mounted_fread=yes,
445 fu_cv_sys_mounted_fread=no)])
446 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
447 if test $fu_cv_sys_mounted_fread = yes; then
448 list_mounted_fs=found
449 AC_DEFINE(MOUNTED_FREAD, 1,
450 [Define if it's possible to resort to fread on /etc/mnttab])
454 if test -z "$list_mounted_fs"; then
455 AC_MSG_WARN([could not determine how to read list of mounted fs])
457 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
458 [Define if the list of mounted filesystems can be determined])
461 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
462 dnl job is to detect a method to get file system information.
464 AC_MSG_NOTICE([checking how to get filesystem space usage])
467 # Here we'll compromise a little (and perform only the link test)
468 # since it seems there are no variants of the statvfs function.
469 if test $space = no; then
471 AC_CHECK_FUNCS(statvfs)
472 if test $ac_cv_func_statvfs = yes; then
474 AC_DEFINE(STAT_STATVFS, 1,
475 [Define if function `statfs' can be used])
479 if test $space = no; then
480 # DEC Alpha running OSF/1
481 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
482 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
484 #include <sys/param.h>
485 #include <sys/types.h>
486 #include <sys/mount.h>
491 exit (statfs (".", &fsd, sizeof (struct statfs)));
493 fu_cv_sys_stat_statfs3_osf1=yes,
494 fu_cv_sys_stat_statfs3_osf1=no,
495 fu_cv_sys_stat_statfs3_osf1=no)])
496 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
497 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
499 AC_DEFINE(STAT_STATFS3_OSF1, 1,
500 [Define if function `statfs' takes 3 arguments])
504 if test $space = no; then
506 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
507 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
509 #ifdef HAVE_SYS_PARAM_H
510 #include <sys/param.h>
512 #ifdef HAVE_SYS_MOUNT_H
513 #include <sys/mount.h>
515 #ifdef HAVE_SYS_VFS_H
522 exit (statfs (".", &fsd));
524 fu_cv_sys_stat_statfs2_bsize=yes,
525 fu_cv_sys_stat_statfs2_bsize=no,
526 fu_cv_sys_stat_statfs2_bsize=no)])
527 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
528 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
530 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
531 [Define if function `statfs' takes two arguments and
532 `bsize' is member of `struct statfs'])
536 if test $space = no; then
538 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
539 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
540 [AC_TRY_RUN([#include <sys/types.h>
541 #include <sys/statfs.h>
545 exit (statfs (".", &fsd, sizeof fsd, 0));
547 fu_cv_sys_stat_statfs4=yes,
548 fu_cv_sys_stat_statfs4=no,
549 fu_cv_sys_stat_statfs4=no)])
550 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
551 if test $fu_cv_sys_stat_statfs4 = yes; then
553 AC_DEFINE(STAT_STATFS4, 1,
554 [Define if function `statfs' takes 4 arguments])
558 if test $space = no; then
560 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
561 member (4.4BSD and NetBSD)])
562 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
563 [AC_TRY_RUN([#include <sys/types.h>
564 #ifdef HAVE_SYS_PARAM_H
565 #include <sys/param.h>
567 #ifdef HAVE_SYS_MOUNT_H
568 #include <sys/mount.h>
574 exit (statfs (".", &fsd));
576 fu_cv_sys_stat_statfs2_fsize=yes,
577 fu_cv_sys_stat_statfs2_fsize=no,
578 fu_cv_sys_stat_statfs2_fsize=no)])
579 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
580 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
582 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
583 [Define if function `statfs' takes two arguments and
584 `fsize' is member of `struct statfs'])
588 if test $space = no; then
590 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
591 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
593 #include <sys/types.h>
594 #ifdef HAVE_SYS_PARAM_H
595 #include <sys/param.h>
597 #ifdef HAVE_SYS_MOUNT_H
598 #include <sys/mount.h>
600 #ifdef HAVE_SYS_FS_TYPES_H
601 #include <sys/fs_types.h>
606 /* Ultrix's statfs returns 1 for success,
607 0 for not mounted, -1 for failure. */
608 exit (statfs (".", &fsd) != 1);
610 fu_cv_sys_stat_fs_data=yes,
611 fu_cv_sys_stat_fs_data=no,
612 fu_cv_sys_stat_fs_data=no)])
613 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
614 if test $fu_cv_sys_stat_fs_data = yes; then
616 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
617 [Define if function `statfs' takes two arguments
618 and uses `struct fs_data'])
623 dnl if test $space = no; then
625 dnl AC_TRY_CPP([#include <sys/filsys.h>],
626 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
630 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
631 dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
632 AC_DEFUN([AC_TRY_WARNINGS],
633 [cat > conftest.$ac_ext <<EOF
634 dnl This sometimes fails to find confdefs.h, for some reason.
635 dnl [#]line __oline__ "[$]0"
636 [#]line __oline__ "configure"
637 #include "confdefs.h"
639 int main() { return 0; }
644 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
645 if { if eval $ac_compile_warn; then :; else echo arning; fi; } |
646 grep arning 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
647 ifelse([$4], , :, [rm -rf conftest*
649 ifelse([$3], , , [else
657 AC_DEFUN([AC_USE_TERMINFO], [
658 AC_DEFINE(SLANG_TERMINFO, 1, [Define to use S-Lang with terminfo])
659 AC_MSG_NOTICE([using SLang screen manager/terminfo])
660 slang_term=" with terminfo"
663 AC_DEFUN([AC_USE_TERMCAP], [
664 AC_MSG_NOTICE([using S-Lang screen manager/termcap])
665 AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
666 dnl Check with $LIBS at the end so that it works with ELF libs.
667 AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap"], , [$LIBS])
668 slang_term=" with termcap"
671 AC_DEFUN([AC_WITH_SLANG], [
672 AC_DEFINE(HAVE_SLANG, 1,
673 [Define to use S-Lang library for screen management])
675 if $slang_use_system_installed_lib
677 AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
678 [Define to use S-Lang library installed on the system])
679 MCLIBS="-lslang $MCLIBS"
680 screen_manager="SLang (system-installed library)"
681 AC_MSG_NOTICE([using system installed S-Lang library])
686 #ifdef HAVE_SLANG_SLANG_H
687 #include <slang/slang.h>
693 [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO],
694 [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
696 screen_manager="SLang"
701 for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
702 /usr/local/share /usr/share
704 if test -d $dir/terminfo; then
709 if $use_terminfo; then
717 AC_DEFUN([AC_WITH_EDIT], [
718 AC_DEFINE(USE_INTERNAL_EDIT, 1,
719 [Define to enable internal editor])
720 LIBEDIT_A="libedit.a"
724 AC_MSG_NOTICE([using internal editor])
727 AC_DEFUN([AC_EXT2_UNDEL], [
729 if test "$ext2fs_undel" = yes; then
730 AC_MSG_NOTICE([using ext2fs file recovery code])
731 vfs_flags="${vfs_flags}, undelfs"
732 undelfs_o="undelfs.o"
733 MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS"
735 AC_MSG_NOTICE([not using ext2fs file recovery code])