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"
28 dnl Check for various functions needed by libvfs.
29 dnl This has various effects:
30 dnl Sets MC_VFS_LIBS to libraries required
31 dnl Sets termnet to true or false depending on whether it is required.
32 dnl If yes, defines USE_TERMNET.
33 dnl Sets vfs_flags to "pretty" list of vfs implementations we include.
34 dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
35 dnl "no" (--without-vfs).
36 dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv".
39 AC_DEFUN([MC_WITH_VFS],[
40 dnl FIXME: network checks should probably be in their own macro.
41 AC_CHECK_LIB(nsl, t_accept)
42 AC_CHECK_LIB(socket, socket)
45 AC_CHECK_FUNCS(socket, have_socket=yes)
46 if test $have_socket = no; then
47 # socket is not in the default libraries. See if it's in some other.
48 for lib in bsd socket inet; do
49 AC_CHECK_LIB([$lib], [socket], [
52 AC_DEFINE(HAVE_SOCKET)
58 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
59 if test $have_gethostbyname = no; then
60 # gethostbyname is not in the default libraries. See if it's in some other.
61 for lib in bsd socket inet; do
62 AC_CHECK_LIB([$lib], [gethostbyname],
63 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
69 if test $have_socket = yes; then
71 AC_CHECK_FUNCS(pmap_set, , [
72 AC_CHECK_LIB(rpc, pmap_set, [
74 AC_DEFINE(HAVE_PMAP_SET)
76 AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
77 dnl add for source routing support setsockopt
78 AC_CHECK_HEADERS(rpc/pmap_clnt.h, , , [
79 #include <sys/types.h>
80 #include <sys/socket.h>
81 #include <netinet/in.h>
83 #include <rpc/pmap_prot.h>
85 vfs_flags="$vfs_flags, mcfs, ftpfs, fish"
95 [--with-samba Support smb virtual file system],[
96 if test "x$withval" != "xno"; then
97 AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
98 vfs_flags="$vfs_flags, smbfs"
100 SAMBAFILES="\$(SAMBAFILES)"
107 dnl The termnet support
111 [--with-termnet If you want a termified net support],[
112 if test x$withval = xyes; then
113 AC_DEFINE(USE_TERMNET, 1,
114 [Define to enable `term' firewall support])
120 AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
121 if $use_net_code; then
122 AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
125 if test $have_socket = yes; then
142 AC_DEFUN([MC_VFS_CHECKS],[
145 [--with-vfs Compile with the VFS code],
152 dnl Should we issue a warning?
159 dnl Check for struct linger
161 AC_DEFUN([AC_STRUCT_LINGER], [
163 AC_MSG_CHECKING([struct linger is available])
165 #include <sys/types.h>
166 #include <sys/socket.h>
177 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
178 [Define if `struct linger' is available])
185 AC_MSG_RESULT([$av_struct_linger])
191 dnl Check for size of d_name dirent member
193 AC_DEFUN([AC_SHORT_D_NAME_LEN], [
194 AC_MSG_CHECKING([filename fits on dirent.d_name])
195 AC_CACHE_VAL(ac_cv_dnamesize, [
197 CFLAGS="$CFLAGS -I$srcdir"
205 if (sizeof (ddd.d_name) < 12)
214 ac_cv_dnamesize="yes"
216 # Cannot find out, so assume no
221 if test x$ac_cv_dnamesize = xno; then
222 AC_DEFINE(NEED_EXTRA_DIRENT_BUFFER, 1,
223 [Define if using `struct dirent' can overwrite stack])
225 AC_MSG_RESULT([$ac_cv_dnamesize])
229 dnl Filesystem information detection
231 dnl To get information about the disk, mount points, etc.
234 AC_DEFUN([AC_GET_FS_INFO], [
235 AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
236 AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
237 AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
238 AC_CHECK_HEADERS(sys/mount.h, , , [
239 #include <sys/param.h>
240 #include <sys/stat.h>
242 AC_CHECK_FUNCS(getmntinfo)
244 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
245 dnl job is to detect a method to get list of mounted filesystems.
247 AC_MSG_CHECKING([for d_ino member in directory struct])
248 AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
250 #include <sys/types.h>
253 #else /* not HAVE_DIRENT_H */
254 # define dirent direct
255 # ifdef HAVE_SYS_NDIR_H
256 # include <sys/ndir.h>
257 # endif /* HAVE_SYS_NDIR_H */
258 # ifdef HAVE_SYS_DIR_H
259 # include <sys/dir.h>
260 # endif /* HAVE_SYS_DIR_H */
263 # endif /* HAVE_NDIR_H */
264 #endif /* HAVE_DIRENT_H */
266 [struct dirent dp; dp.d_ino = 0;],
267 fu_cv_sys_d_ino_in_dirent=yes,
268 fu_cv_sys_d_ino_in_dirent=no)])
269 AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
270 if test $fu_cv_sys_d_ino_in_dirent = yes; then
271 AC_DEFINE(D_INO_IN_DIRENT, 1,
272 [Define if `d_ino' is member of `struct directory'])
275 # Determine how to get the list of mounted filesystems.
278 # If the getmntent function is available but not in the standard library,
279 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
282 if test $ac_cv_func_getmntent = yes; then
284 # This system has the getmntent function.
285 # Determine whether it's the one-argument variant or the two-argument one.
287 if test -z "$list_mounted_fs"; then
289 AC_MSG_CHECKING([for two-argument getmntent function])
290 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
291 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
292 fu_cv_sys_mounted_getmntent2=yes,
293 fu_cv_sys_mounted_getmntent2=no)])
294 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
295 if test $fu_cv_sys_mounted_getmntent2 = yes; then
296 list_mounted_fs=found
297 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
298 [Define if function `getmntent' takes 2 arguments])
302 if test -z "$list_mounted_fs"; then
303 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
304 AC_MSG_CHECKING([for one-argument getmntent function])
305 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
306 [test $ac_cv_header_mntent_h = yes \
307 && fu_cv_sys_mounted_getmntent1=yes \
308 || fu_cv_sys_mounted_getmntent1=no])
309 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
310 if test $fu_cv_sys_mounted_getmntent1 = yes; then
311 list_mounted_fs=found
312 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
313 [Define if function `getmntent' takes 1 argument])
319 if test -z "$list_mounted_fs"; then
320 # DEC Alpha running OSF/1.
321 AC_MSG_CHECKING([for getfsstat function])
322 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
324 #include <sys/types.h>
325 #include <sys/mount.h>
326 #include <sys/fs_types.h>],
327 [struct statfs *stats;
328 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
329 fu_cv_sys_mounted_getsstat=yes,
330 fu_cv_sys_mounted_getsstat=no)])
331 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
332 if test $fu_cv_sys_mounted_getsstat = yes; then
333 list_mounted_fs=found
334 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
335 [Define if function `getfsstat' can be used])
339 if test -z "$list_mounted_fs"; then
341 AC_MSG_CHECKING([for mntctl function and struct vmount])
342 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
343 [AC_TRY_CPP([#include <fshelp.h>],
344 fu_cv_sys_mounted_vmount=yes,
345 fu_cv_sys_mounted_vmount=no)])
346 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
347 if test $fu_cv_sys_mounted_vmount = yes; then
348 list_mounted_fs=found
349 AC_DEFINE(MOUNTED_VMOUNT, 1,
350 [Define if function `mntctl' and `struct vmount' can be used])
354 if test -z "$list_mounted_fs"; then
356 AC_MSG_CHECKING([for existence of three headers])
357 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
359 #include <sys/statfs.h>
360 #include <sys/fstyp.h>
361 #include <mnttab.h>],
362 fu_cv_sys_mounted_fread_fstyp=yes,
363 fu_cv_sys_mounted_fread_fstyp=no)])
364 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
365 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
366 list_mounted_fs=found
367 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
368 [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
369 can be used together])
373 if test -z "$list_mounted_fs"; then
374 # 4.4BSD and DEC OSF/1.
375 AC_MSG_CHECKING([for getmntinfo function])
376 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
379 if test $ac_cv_func_getmntinfo = yes; then
380 AC_EGREP_HEADER(f_type;, sys/mount.h,
384 && fu_cv_sys_mounted_getmntinfo=yes \
385 || fu_cv_sys_mounted_getmntinfo=no
387 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
388 if test $fu_cv_sys_mounted_getmntinfo = yes; then
389 list_mounted_fs=found
390 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
391 [Define if `getmntinfo' function can be used])
392 AC_MSG_CHECKING([if struct statfs has f_fstypename])
393 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
394 [AC_EGREP_HEADER([f_fstypename],
396 [fu_cv_sys_mounted_f_fstypename=yes],
397 [fu_cv_sys_mounted_f_fstypename=no])
399 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
400 if test $fu_cv_sys_mounted_f_fstypename = yes; then
401 AC_DEFINE(HAVE_F_FSTYPENAME, 1,
402 [Define if `f_fstypename' is member of `struct statfs'])
407 if test -z "$list_mounted_fs"; then
409 AC_MSG_CHECKING([for getmnt function])
410 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
412 #include <sys/fs_types.h>
413 #include <sys/mount.h>],
414 fu_cv_sys_mounted_getmnt=yes,
415 fu_cv_sys_mounted_getmnt=no)])
416 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
417 if test $fu_cv_sys_mounted_getmnt = yes; then
418 list_mounted_fs=found
419 AC_DEFINE(MOUNTED_GETMNT, 1,
420 [Define if `getmnt' function can be used])
424 if test -z "$list_mounted_fs"; then
426 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
427 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
428 [AC_TRY_CPP([#include <mnttab.h>],
429 fu_cv_sys_mounted_fread=yes,
430 fu_cv_sys_mounted_fread=no)])
431 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
432 if test $fu_cv_sys_mounted_fread = yes; then
433 list_mounted_fs=found
434 AC_DEFINE(MOUNTED_FREAD, 1,
435 [Define if it's possible to resort to fread on /etc/mnttab])
439 if test -z "$list_mounted_fs"; then
440 AC_MSG_WARN([could not determine how to read list of mounted fs])
442 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
443 [Define if the list of mounted filesystems can be determined])
446 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
447 dnl job is to detect a method to get file system information.
449 AC_MSG_NOTICE([checking how to get filesystem space usage])
452 # Here we'll compromise a little (and perform only the link test)
453 # since it seems there are no variants of the statvfs function.
454 if test $space = no; then
456 AC_CHECK_FUNCS(statvfs)
457 if test $ac_cv_func_statvfs = yes; then
459 AC_DEFINE(STAT_STATVFS, 1,
460 [Define if function `statfs' can be used])
464 if test $space = no; then
465 # DEC Alpha running OSF/1
466 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
467 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
469 #include <sys/param.h>
470 #include <sys/types.h>
471 #include <sys/mount.h>
476 exit (statfs (".", &fsd, sizeof (struct statfs)));
478 fu_cv_sys_stat_statfs3_osf1=yes,
479 fu_cv_sys_stat_statfs3_osf1=no,
480 fu_cv_sys_stat_statfs3_osf1=no)])
481 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
482 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
484 AC_DEFINE(STAT_STATFS3_OSF1, 1,
485 [Define if function `statfs' takes 3 arguments])
489 if test $space = no; then
491 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
492 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
494 #ifdef HAVE_SYS_PARAM_H
495 #include <sys/param.h>
497 #ifdef HAVE_SYS_MOUNT_H
498 #include <sys/mount.h>
500 #ifdef HAVE_SYS_VFS_H
507 exit (statfs (".", &fsd));
509 fu_cv_sys_stat_statfs2_bsize=yes,
510 fu_cv_sys_stat_statfs2_bsize=no,
511 fu_cv_sys_stat_statfs2_bsize=no)])
512 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
513 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
515 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
516 [Define if function `statfs' takes two arguments and
517 `bsize' is member of `struct statfs'])
521 if test $space = no; then
523 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
524 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
525 [AC_TRY_RUN([#include <sys/types.h>
526 #include <sys/statfs.h>
530 exit (statfs (".", &fsd, sizeof fsd, 0));
532 fu_cv_sys_stat_statfs4=yes,
533 fu_cv_sys_stat_statfs4=no,
534 fu_cv_sys_stat_statfs4=no)])
535 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
536 if test $fu_cv_sys_stat_statfs4 = yes; then
538 AC_DEFINE(STAT_STATFS4, 1,
539 [Define if function `statfs' takes 4 arguments])
543 if test $space = no; then
545 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
546 member (4.4BSD and NetBSD)])
547 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
548 [AC_TRY_RUN([#include <sys/types.h>
549 #ifdef HAVE_SYS_PARAM_H
550 #include <sys/param.h>
552 #ifdef HAVE_SYS_MOUNT_H
553 #include <sys/mount.h>
559 exit (statfs (".", &fsd));
561 fu_cv_sys_stat_statfs2_fsize=yes,
562 fu_cv_sys_stat_statfs2_fsize=no,
563 fu_cv_sys_stat_statfs2_fsize=no)])
564 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
565 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
567 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
568 [Define if function `statfs' takes two arguments and
569 `fsize' is member of `struct statfs'])
573 if test $space = no; then
575 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
576 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
578 #include <sys/types.h>
579 #ifdef HAVE_SYS_PARAM_H
580 #include <sys/param.h>
582 #ifdef HAVE_SYS_MOUNT_H
583 #include <sys/mount.h>
585 #ifdef HAVE_SYS_FS_TYPES_H
586 #include <sys/fs_types.h>
591 /* Ultrix's statfs returns 1 for success,
592 0 for not mounted, -1 for failure. */
593 exit (statfs (".", &fsd) != 1);
595 fu_cv_sys_stat_fs_data=yes,
596 fu_cv_sys_stat_fs_data=no,
597 fu_cv_sys_stat_fs_data=no)])
598 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
599 if test $fu_cv_sys_stat_fs_data = yes; then
601 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
602 [Define if function `statfs' takes two arguments
603 and uses `struct fs_data'])
608 dnl if test $space = no; then
610 dnl AC_TRY_CPP([#include <sys/filsys.h>],
611 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
615 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
616 dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
617 AC_DEFUN([AC_TRY_WARNINGS],
618 [cat > conftest.$ac_ext <<EOF
619 dnl This sometimes fails to find confdefs.h, for some reason.
620 dnl [#]line __oline__ "[$]0"
621 [#]line __oline__ "configure"
622 #include "confdefs.h"
624 int main() { return 0; }
629 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
630 if { if eval $ac_compile_warn; then :; else echo arning; fi; } |
631 grep arning 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
632 ifelse([$4], , :, [rm -rf conftest*
634 ifelse([$3], , , [else
642 AC_DEFUN([AC_USE_TERMINFO], [
643 AC_DEFINE(SLANG_TERMINFO, 1, [Define to use S-Lang with terminfo])
644 AC_MSG_NOTICE([using SLang screen manager/terminfo])
645 slang_term=" with terminfo"
648 AC_DEFUN([AC_USE_TERMCAP], [
649 AC_MSG_NOTICE([using S-Lang screen manager/termcap])
650 AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
651 dnl Check with $LIBS at the end so that it works with ELF libs.
652 AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap"], , [$LIBS])
653 slang_term=" with termcap"
656 AC_DEFUN([AC_WITH_SLANG], [
657 AC_DEFINE(HAVE_SLANG, 1,
658 [Define to use S-Lang library for screen management])
660 if $slang_use_system_installed_lib
662 AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
663 [Define to use S-Lang library installed on the system])
664 MCLIBS="-lslang $MCLIBS"
665 screen_manager="SLang (system-installed library)"
666 AC_MSG_NOTICE([using system installed S-Lang library])
672 #ifdef HAVE_SLANG_SLANG_H
673 #include <slang/slang.h>
679 [LIBS="$ac_save_LIBS"; AC_USE_TERMINFO],
680 [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
682 screen_manager="SLang"
683 CPPFLAGS="$CPPFLAGS -I../slang"
684 fastdepslang=fastdepslang
688 /*) ln -sf $srcdir/slang/slang-mc.h slang/slang.h;;
689 *) ln -sf ../$srcdir/slang/slang-mc.h slang/slang.h;;
695 for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
696 /usr/local/share /usr/share
698 if test -d $dir/terminfo; then
703 if $use_terminfo; then
711 AC_DEFUN([AC_WITH_EDIT], [
712 AC_DEFINE(USE_INTERNAL_EDIT, 1,
713 [Define to enable internal editor])
714 LIBEDIT_A="libedit.a"
718 AC_MSG_NOTICE([using internal editor])
721 AC_DEFUN([AC_EXT2_UNDEL], [
723 if test "$ext2fs_undel" = yes; then
724 AC_MSG_NOTICE([using ext2fs file recovery code])
725 vfs_flags="${vfs_flags}, undelfs"
726 undelfs_o="undelfs.o"
727 LIBS="$LIBS $EXT2FS_UNDEL_LIBS"
729 AC_MSG_NOTICE([not using ext2fs file recovery code])
734 dnl Parameters: directory filename LIBS_append CPPFLAGS_append nicename
736 AC_DEFUN([AC_NCURSES], [
741 AC_MSG_NOTICE([found ncurses header $1/$2])
743 CPPFLAGS="$CPPFLAGS $4"
746 AC_DEFINE(USE_NCURSES, 1,
747 [Define to use ncurses for screen management])