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)"
117 if test "x$smbfs" != x ; then
118 #################################################
119 # set Samba configuration directory location
121 AC_ARG_WITH(configdir,
122 [ --with-configdir=DIR Where the Samba configuration files are (/etc)],
126 # Just in case anybody does it
128 AC_MSG_WARN([--with-configdir called without argument - will use default])
137 AC_ARG_WITH(codepagedir,
138 [ --with-codepagedir=DIR Where the Samba codepage files are],
142 # Just in case anybody does it
144 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
151 dnl The termnet support
155 [--with-termnet If you want a termified net support],[
156 if test x$withval = xyes; then
157 AC_DEFINE(USE_TERMNET, 1,
158 [Define to enable `term' firewall support])
164 AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
165 if $use_net_code; then
166 AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
169 if test $have_socket = yes; then
186 AC_DEFUN([MC_VFS_CHECKS],[
189 [--with-vfs Compile with the VFS code],
196 dnl Should we issue a warning?
203 dnl Check for struct linger
205 AC_DEFUN([AC_STRUCT_LINGER], [
207 AC_MSG_CHECKING([struct linger is available])
209 #include <sys/types.h>
210 #include <sys/socket.h>
221 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
222 [Define if `struct linger' is available])
229 AC_MSG_RESULT([$av_struct_linger])
235 dnl Check for size of d_name dirent member
237 AC_DEFUN([AC_SHORT_D_NAME_LEN], [
238 AC_MSG_CHECKING([filename fits on dirent.d_name])
239 AC_CACHE_VAL(ac_cv_dnamesize, [
241 CFLAGS="$CFLAGS -I$srcdir"
249 if (sizeof (ddd.d_name) < 12)
258 ac_cv_dnamesize="yes"
260 # Cannot find out, so assume no
265 if test x$ac_cv_dnamesize = xno; then
266 AC_DEFINE(NEED_EXTRA_DIRENT_BUFFER, 1,
267 [Define if using `struct dirent' can overwrite stack])
269 AC_MSG_RESULT([$ac_cv_dnamesize])
273 dnl Filesystem information detection
275 dnl To get information about the disk, mount points, etc.
278 AC_DEFUN([AC_GET_FS_INFO], [
279 AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
280 AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
281 AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
282 AC_CHECK_HEADERS(sys/mount.h, , , [
283 #include <sys/param.h>
284 #include <sys/stat.h>
286 AC_CHECK_FUNCS(getmntinfo)
288 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
289 dnl job is to detect a method to get list of mounted filesystems.
291 AC_MSG_CHECKING([for d_ino member in directory struct])
292 AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
294 #include <sys/types.h>
297 #else /* not HAVE_DIRENT_H */
298 # define dirent direct
299 # ifdef HAVE_SYS_NDIR_H
300 # include <sys/ndir.h>
301 # endif /* HAVE_SYS_NDIR_H */
302 # ifdef HAVE_SYS_DIR_H
303 # include <sys/dir.h>
304 # endif /* HAVE_SYS_DIR_H */
307 # endif /* HAVE_NDIR_H */
308 #endif /* HAVE_DIRENT_H */
310 [struct dirent dp; dp.d_ino = 0;],
311 fu_cv_sys_d_ino_in_dirent=yes,
312 fu_cv_sys_d_ino_in_dirent=no)])
313 AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
314 if test $fu_cv_sys_d_ino_in_dirent = yes; then
315 AC_DEFINE(D_INO_IN_DIRENT, 1,
316 [Define if `d_ino' is member of `struct directory'])
319 # Determine how to get the list of mounted filesystems.
322 # If the getmntent function is available but not in the standard library,
323 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
326 if test $ac_cv_func_getmntent = yes; then
328 # This system has the getmntent function.
329 # Determine whether it's the one-argument variant or the two-argument one.
331 if test -z "$list_mounted_fs"; then
333 AC_MSG_CHECKING([for two-argument getmntent function])
334 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
335 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
336 fu_cv_sys_mounted_getmntent2=yes,
337 fu_cv_sys_mounted_getmntent2=no)])
338 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
339 if test $fu_cv_sys_mounted_getmntent2 = yes; then
340 list_mounted_fs=found
341 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
342 [Define if function `getmntent' takes 2 arguments])
346 if test -z "$list_mounted_fs"; then
347 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
348 AC_MSG_CHECKING([for one-argument getmntent function])
349 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
350 [test $ac_cv_header_mntent_h = yes \
351 && fu_cv_sys_mounted_getmntent1=yes \
352 || fu_cv_sys_mounted_getmntent1=no])
353 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
354 if test $fu_cv_sys_mounted_getmntent1 = yes; then
355 list_mounted_fs=found
356 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
357 [Define if function `getmntent' takes 1 argument])
363 if test -z "$list_mounted_fs"; then
364 # DEC Alpha running OSF/1.
365 AC_MSG_CHECKING([for getfsstat function])
366 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
368 #include <sys/types.h>
369 #include <sys/mount.h>
370 #include <sys/fs_types.h>],
371 [struct statfs *stats;
372 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
373 fu_cv_sys_mounted_getsstat=yes,
374 fu_cv_sys_mounted_getsstat=no)])
375 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
376 if test $fu_cv_sys_mounted_getsstat = yes; then
377 list_mounted_fs=found
378 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
379 [Define if function `getfsstat' can be used])
383 if test -z "$list_mounted_fs"; then
385 AC_MSG_CHECKING([for mntctl function and struct vmount])
386 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
387 [AC_TRY_CPP([#include <fshelp.h>],
388 fu_cv_sys_mounted_vmount=yes,
389 fu_cv_sys_mounted_vmount=no)])
390 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
391 if test $fu_cv_sys_mounted_vmount = yes; then
392 list_mounted_fs=found
393 AC_DEFINE(MOUNTED_VMOUNT, 1,
394 [Define if function `mntctl' and `struct vmount' can be used])
398 if test -z "$list_mounted_fs"; then
400 AC_MSG_CHECKING([for existence of three headers])
401 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
403 #include <sys/statfs.h>
404 #include <sys/fstyp.h>
405 #include <mnttab.h>],
406 fu_cv_sys_mounted_fread_fstyp=yes,
407 fu_cv_sys_mounted_fread_fstyp=no)])
408 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
409 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
410 list_mounted_fs=found
411 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
412 [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
413 can be used together])
417 if test -z "$list_mounted_fs"; then
418 # 4.4BSD and DEC OSF/1.
419 AC_MSG_CHECKING([for getmntinfo function])
420 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
423 if test $ac_cv_func_getmntinfo = yes; then
424 AC_EGREP_HEADER(f_type;, sys/mount.h,
428 && fu_cv_sys_mounted_getmntinfo=yes \
429 || fu_cv_sys_mounted_getmntinfo=no
431 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
432 if test $fu_cv_sys_mounted_getmntinfo = yes; then
433 list_mounted_fs=found
434 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
435 [Define if `getmntinfo' function can be used])
436 AC_MSG_CHECKING([if struct statfs has f_fstypename])
437 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
438 [AC_EGREP_HEADER([f_fstypename],
440 [fu_cv_sys_mounted_f_fstypename=yes],
441 [fu_cv_sys_mounted_f_fstypename=no])
443 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
444 if test $fu_cv_sys_mounted_f_fstypename = yes; then
445 AC_DEFINE(HAVE_F_FSTYPENAME, 1,
446 [Define if `f_fstypename' is member of `struct statfs'])
451 if test -z "$list_mounted_fs"; then
453 AC_MSG_CHECKING([for getmnt function])
454 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
456 #include <sys/fs_types.h>
457 #include <sys/mount.h>],
458 fu_cv_sys_mounted_getmnt=yes,
459 fu_cv_sys_mounted_getmnt=no)])
460 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
461 if test $fu_cv_sys_mounted_getmnt = yes; then
462 list_mounted_fs=found
463 AC_DEFINE(MOUNTED_GETMNT, 1,
464 [Define if `getmnt' function can be used])
468 if test -z "$list_mounted_fs"; then
470 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
471 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
472 [AC_TRY_CPP([#include <mnttab.h>],
473 fu_cv_sys_mounted_fread=yes,
474 fu_cv_sys_mounted_fread=no)])
475 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
476 if test $fu_cv_sys_mounted_fread = yes; then
477 list_mounted_fs=found
478 AC_DEFINE(MOUNTED_FREAD, 1,
479 [Define if it's possible to resort to fread on /etc/mnttab])
483 if test -z "$list_mounted_fs"; then
484 AC_MSG_WARN([could not determine how to read list of mounted fs])
486 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
487 [Define if the list of mounted filesystems can be determined])
490 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
491 dnl job is to detect a method to get file system information.
493 AC_MSG_NOTICE([checking how to get filesystem space usage])
496 # Here we'll compromise a little (and perform only the link test)
497 # since it seems there are no variants of the statvfs function.
498 if test $space = no; then
500 AC_CHECK_FUNCS(statvfs)
501 if test $ac_cv_func_statvfs = yes; then
503 AC_DEFINE(STAT_STATVFS, 1,
504 [Define if function `statfs' can be used])
508 if test $space = no; then
509 # DEC Alpha running OSF/1
510 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
511 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
513 #include <sys/param.h>
514 #include <sys/types.h>
515 #include <sys/mount.h>
520 exit (statfs (".", &fsd, sizeof (struct statfs)));
522 fu_cv_sys_stat_statfs3_osf1=yes,
523 fu_cv_sys_stat_statfs3_osf1=no,
524 fu_cv_sys_stat_statfs3_osf1=no)])
525 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
526 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
528 AC_DEFINE(STAT_STATFS3_OSF1, 1,
529 [Define if function `statfs' takes 3 arguments])
533 if test $space = no; then
535 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
536 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
538 #ifdef HAVE_SYS_PARAM_H
539 #include <sys/param.h>
541 #ifdef HAVE_SYS_MOUNT_H
542 #include <sys/mount.h>
544 #ifdef HAVE_SYS_VFS_H
551 exit (statfs (".", &fsd));
553 fu_cv_sys_stat_statfs2_bsize=yes,
554 fu_cv_sys_stat_statfs2_bsize=no,
555 fu_cv_sys_stat_statfs2_bsize=no)])
556 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
557 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
559 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
560 [Define if function `statfs' takes two arguments and
561 `bsize' is member of `struct statfs'])
565 if test $space = no; then
567 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
568 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
569 [AC_TRY_RUN([#include <sys/types.h>
570 #include <sys/statfs.h>
574 exit (statfs (".", &fsd, sizeof fsd, 0));
576 fu_cv_sys_stat_statfs4=yes,
577 fu_cv_sys_stat_statfs4=no,
578 fu_cv_sys_stat_statfs4=no)])
579 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
580 if test $fu_cv_sys_stat_statfs4 = yes; then
582 AC_DEFINE(STAT_STATFS4, 1,
583 [Define if function `statfs' takes 4 arguments])
587 if test $space = no; then
589 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
590 member (4.4BSD and NetBSD)])
591 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
592 [AC_TRY_RUN([#include <sys/types.h>
593 #ifdef HAVE_SYS_PARAM_H
594 #include <sys/param.h>
596 #ifdef HAVE_SYS_MOUNT_H
597 #include <sys/mount.h>
603 exit (statfs (".", &fsd));
605 fu_cv_sys_stat_statfs2_fsize=yes,
606 fu_cv_sys_stat_statfs2_fsize=no,
607 fu_cv_sys_stat_statfs2_fsize=no)])
608 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
609 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
611 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
612 [Define if function `statfs' takes two arguments and
613 `fsize' is member of `struct statfs'])
617 if test $space = no; then
619 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
620 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
622 #include <sys/types.h>
623 #ifdef HAVE_SYS_PARAM_H
624 #include <sys/param.h>
626 #ifdef HAVE_SYS_MOUNT_H
627 #include <sys/mount.h>
629 #ifdef HAVE_SYS_FS_TYPES_H
630 #include <sys/fs_types.h>
635 /* Ultrix's statfs returns 1 for success,
636 0 for not mounted, -1 for failure. */
637 exit (statfs (".", &fsd) != 1);
639 fu_cv_sys_stat_fs_data=yes,
640 fu_cv_sys_stat_fs_data=no,
641 fu_cv_sys_stat_fs_data=no)])
642 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
643 if test $fu_cv_sys_stat_fs_data = yes; then
645 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
646 [Define if function `statfs' takes two arguments
647 and uses `struct fs_data'])
652 dnl if test $space = no; then
654 dnl AC_TRY_CPP([#include <sys/filsys.h>],
655 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
659 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
660 dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
661 AC_DEFUN([AC_TRY_WARNINGS],
662 [cat > conftest.$ac_ext <<EOF
663 dnl This sometimes fails to find confdefs.h, for some reason.
664 dnl [#]line __oline__ "[$]0"
665 [#]line __oline__ "configure"
666 #include "confdefs.h"
668 int main() { return 0; }
673 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
674 if { if eval $ac_compile_warn; then :; else echo arning; fi; } |
675 grep arning 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
676 ifelse([$4], , :, [rm -rf conftest*
678 ifelse([$3], , , [else
686 AC_DEFUN([AC_USE_TERMINFO], [
687 AC_DEFINE(SLANG_TERMINFO, 1, [Define to use S-Lang with terminfo])
688 AC_MSG_NOTICE([using SLang screen manager/terminfo])
689 slang_term=" with terminfo"
692 AC_DEFUN([AC_USE_TERMCAP], [
693 AC_MSG_NOTICE([using S-Lang screen manager/termcap])
694 AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
695 dnl Check with $LIBS at the end so that it works with ELF libs.
696 AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap"], , [$LIBS])
697 slang_term=" with termcap"
700 AC_DEFUN([AC_WITH_SLANG], [
701 AC_DEFINE(HAVE_SLANG, 1,
702 [Define to use S-Lang library for screen management])
705 if $slang_use_system_installed_lib
707 AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
708 [Define to use S-Lang library installed on the system])
709 MCLIBS="-lslang $MCLIBS"
710 screen_manager="SLang (system-installed library)"
711 AC_MSG_NOTICE([using system installed S-Lang library])
716 #ifdef HAVE_SLANG_SLANG_H
717 #include <slang/slang.h>
723 [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO],
724 [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
726 screen_manager="SLang"
731 for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
732 /usr/local/share /usr/share
734 if test -d $dir/terminfo; then
739 if $use_terminfo; then
747 AC_DEFUN([AC_WITH_EDIT], [
748 AC_DEFINE(USE_INTERNAL_EDIT, 1,
749 [Define to enable internal editor])
750 LIBEDIT_A="libedit.a"
754 AC_MSG_NOTICE([using internal editor])
757 AC_DEFUN([AC_EXT2_UNDEL], [
759 if test "$ext2fs_undel" = yes; then
760 AC_MSG_NOTICE([using ext2fs file recovery code])
761 vfs_flags="${vfs_flags}, undelfs"
762 undelfs_o="undelfs.o"
763 LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
765 AC_MSG_NOTICE([not using ext2fs file recovery code])
770 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
772 AC_DEFUN([AC_NCURSES], [
777 AC_MSG_NOTICE([found ncurses header $1/$2])
779 CPPFLAGS="$CPPFLAGS $4"
781 screen_type="ncurses"
783 AC_DEFINE(USE_NCURSES, 1,
784 [Define to use ncurses for screen management])