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 vfs_flags to "pretty" list of vfs implementations we include.
43 dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
44 dnl "no" (--without-vfs).
45 dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv".
48 AC_DEFUN([MC_WITH_VFS],[
49 dnl FIXME: network checks should probably be in their own macro.
50 AC_CHECK_LIB(nsl, t_accept)
51 AC_CHECK_LIB(socket, socket)
54 AC_CHECK_FUNCS(socket, have_socket=yes)
55 if test $have_socket = no; then
56 # socket is not in the default libraries. See if it's in some other.
57 for lib in bsd socket inet; do
58 AC_CHECK_LIB([$lib], [socket], [
61 AC_DEFINE(HAVE_SOCKET)
67 AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
68 if test $have_gethostbyname = no; then
69 # gethostbyname is not in the default libraries. See if it's in some other.
70 for lib in bsd socket inet; do
71 AC_CHECK_LIB([$lib], [gethostbyname],
72 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
78 if test $have_socket = yes; then
80 AC_CHECK_FUNCS(pmap_set, , [
81 AC_CHECK_LIB(rpc, pmap_set, [
83 AC_DEFINE(HAVE_PMAP_SET)
85 AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
86 dnl add for source routing support setsockopt
87 AC_CHECK_HEADERS(rpc/pmap_clnt.h, , , [
88 #include <sys/types.h>
89 #include <sys/socket.h>
90 #include <netinet/in.h>
92 #include <rpc/pmap_prot.h>
98 [--with-mcfs Support mc-specific networking file system],[
99 if test "x$withval" != "xno"; then
100 AC_DEFINE(WITH_MCFS, 1, [Define to enable mc-specific networking file system])
101 vfs_flags="$vfs_flags, mcfs"
104 vfs_flags="$vfs_flags, ftpfs, fish"
114 [--with-samba Support smb virtual file system],[
115 if test "x$withval" != "xno"; then
116 AC_DEFINE(WITH_SMBFS, 1, [Define to enable VFS over SMB])
117 vfs_flags="$vfs_flags, smbfs"
119 SAMBAFILES="\$(SAMBAFILES)"
125 if test "x$smbfs" != x ; then
126 #################################################
127 # set Samba configuration directory location
129 AC_ARG_WITH(configdir,
130 [ --with-configdir=DIR Where the Samba configuration files are (/etc)],
134 # Just in case anybody does it
136 AC_MSG_WARN([--with-configdir called without argument - will use default])
145 AC_ARG_WITH(codepagedir,
146 [ --with-codepagedir=DIR Where the Samba codepage files are],
150 # Just in case anybody does it
152 AC_MSG_WARN([--with-codepagedir called without argument - will use default])
158 AC_DEFINE(USE_VFS, 1, [Define to enable VFS support])
159 if $use_net_code; then
160 AC_DEFINE(USE_NETCODE, 1, [Define to use networked VFS])
163 if test $have_socket = yes; then
176 AC_DEFUN([MC_VFS_CHECKS],[
179 [--with-vfs Compile with the VFS code],
186 dnl Should we issue a warning?
193 dnl Check for struct linger
195 AC_DEFUN([AC_STRUCT_LINGER], [
197 AC_MSG_CHECKING([struct linger is available])
199 #include <sys/types.h>
200 #include <sys/socket.h>
211 AC_DEFINE(HAVE_STRUCT_LINGER, 1,
212 [Define if `struct linger' is available])
219 AC_MSG_RESULT([$av_struct_linger])
224 dnl Filesystem information detection
226 dnl To get information about the disk, mount points, etc.
229 AC_DEFUN([AC_GET_FS_INFO], [
230 AC_CHECK_HEADERS(fcntl.h sys/dustat.h sys/param.h sys/statfs.h sys/fstyp.h)
231 AC_CHECK_HEADERS(mnttab.h mntent.h utime.h sys/statvfs.h sys/vfs.h)
232 AC_CHECK_HEADERS(sys/filsys.h sys/fs_types.h)
233 AC_CHECK_HEADERS(sys/mount.h, , , [
234 #include <sys/param.h>
235 #include <sys/stat.h>
237 AC_CHECK_FUNCS(getmntinfo)
239 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
240 dnl job is to detect a method to get list of mounted filesystems.
242 AC_MSG_CHECKING([for d_ino member in directory struct])
243 AC_CACHE_VAL(fu_cv_sys_d_ino_in_dirent,
245 #include <sys/types.h>
248 #else /* not HAVE_DIRENT_H */
249 # define dirent direct
250 # ifdef HAVE_SYS_NDIR_H
251 # include <sys/ndir.h>
252 # endif /* HAVE_SYS_NDIR_H */
253 # ifdef HAVE_SYS_DIR_H
254 # include <sys/dir.h>
255 # endif /* HAVE_SYS_DIR_H */
258 # endif /* HAVE_NDIR_H */
259 #endif /* HAVE_DIRENT_H */
261 [struct dirent dp; dp.d_ino = 0;],
262 fu_cv_sys_d_ino_in_dirent=yes,
263 fu_cv_sys_d_ino_in_dirent=no)])
264 AC_MSG_RESULT([$fu_cv_sys_d_ino_in_dirent])
265 if test $fu_cv_sys_d_ino_in_dirent = yes; then
266 AC_DEFINE(D_INO_IN_DIRENT, 1,
267 [Define if `d_ino' is member of `struct directory'])
270 # Determine how to get the list of mounted filesystems.
273 # If the getmntent function is available but not in the standard library,
274 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
277 if test $ac_cv_func_getmntent = yes; then
279 # This system has the getmntent function.
280 # Determine whether it's the one-argument variant or the two-argument one.
282 if test -z "$list_mounted_fs"; then
284 AC_MSG_CHECKING([for two-argument getmntent function])
285 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
286 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
287 fu_cv_sys_mounted_getmntent2=yes,
288 fu_cv_sys_mounted_getmntent2=no)])
289 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent2])
290 if test $fu_cv_sys_mounted_getmntent2 = yes; then
291 list_mounted_fs=found
292 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
293 [Define if function `getmntent' takes 2 arguments])
297 if test -z "$list_mounted_fs"; then
298 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
299 AC_MSG_CHECKING([for one-argument getmntent function])
300 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
301 [test $ac_cv_header_mntent_h = yes \
302 && fu_cv_sys_mounted_getmntent1=yes \
303 || fu_cv_sys_mounted_getmntent1=no])
304 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntent1])
305 if test $fu_cv_sys_mounted_getmntent1 = yes; then
306 list_mounted_fs=found
307 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
308 [Define if function `getmntent' takes 1 argument])
314 if test -z "$list_mounted_fs"; then
315 # DEC Alpha running OSF/1.
316 AC_MSG_CHECKING([for getfsstat function])
317 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
319 #include <sys/types.h>
320 #include <sys/mount.h>
321 #include <sys/fs_types.h>],
322 [struct statfs *stats;
323 numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
324 fu_cv_sys_mounted_getsstat=yes,
325 fu_cv_sys_mounted_getsstat=no)])
326 AC_MSG_RESULT([$fu_cv_sys_mounted_getsstat])
327 if test $fu_cv_sys_mounted_getsstat = yes; then
328 list_mounted_fs=found
329 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
330 [Define if function `getfsstat' can be used])
334 if test -z "$list_mounted_fs"; then
336 AC_MSG_CHECKING([for mntctl function and struct vmount])
337 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
338 [AC_TRY_CPP([#include <fshelp.h>],
339 fu_cv_sys_mounted_vmount=yes,
340 fu_cv_sys_mounted_vmount=no)])
341 AC_MSG_RESULT([$fu_cv_sys_mounted_vmount])
342 if test $fu_cv_sys_mounted_vmount = yes; then
343 list_mounted_fs=found
344 AC_DEFINE(MOUNTED_VMOUNT, 1,
345 [Define if function `mntctl' and `struct vmount' can be used])
349 if test -z "$list_mounted_fs"; then
351 AC_MSG_CHECKING([for existence of three headers])
352 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
354 #include <sys/statfs.h>
355 #include <sys/fstyp.h>
356 #include <mnttab.h>],
357 fu_cv_sys_mounted_fread_fstyp=yes,
358 fu_cv_sys_mounted_fread_fstyp=no)])
359 AC_MSG_RESULT([$fu_cv_sys_mounted_fread_fstyp])
360 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
361 list_mounted_fs=found
362 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
363 [Define if sys/statfs.h, sys/fstyp.h and mnttab.h
364 can be used together])
368 if test -z "$list_mounted_fs"; then
369 # 4.4BSD and DEC OSF/1.
370 AC_MSG_CHECKING([for getmntinfo function])
371 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
374 if test $ac_cv_func_getmntinfo = yes; then
375 AC_EGREP_HEADER(f_type;, sys/mount.h,
379 && fu_cv_sys_mounted_getmntinfo=yes \
380 || fu_cv_sys_mounted_getmntinfo=no
382 AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo])
383 if test $fu_cv_sys_mounted_getmntinfo = yes; then
384 list_mounted_fs=found
385 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
386 [Define if `getmntinfo' function can be used])
387 AC_MSG_CHECKING([if struct statfs has f_fstypename])
388 AC_CACHE_VAL(fu_cv_sys_mounted_f_fstypename,
389 [AC_EGREP_HEADER([f_fstypename],
391 [fu_cv_sys_mounted_f_fstypename=yes],
392 [fu_cv_sys_mounted_f_fstypename=no])
394 AC_MSG_RESULT([$fu_cv_sys_mounted_f_fstypename])
395 if test $fu_cv_sys_mounted_f_fstypename = yes; then
396 AC_DEFINE(HAVE_F_FSTYPENAME, 1,
397 [Define if `f_fstypename' is member of `struct statfs'])
402 if test -z "$list_mounted_fs"; then
404 AC_MSG_CHECKING([for getmnt function])
405 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
407 #include <sys/fs_types.h>
408 #include <sys/mount.h>],
409 fu_cv_sys_mounted_getmnt=yes,
410 fu_cv_sys_mounted_getmnt=no)])
411 AC_MSG_RESULT([$fu_cv_sys_mounted_getmnt])
412 if test $fu_cv_sys_mounted_getmnt = yes; then
413 list_mounted_fs=found
414 AC_DEFINE(MOUNTED_GETMNT, 1,
415 [Define if `getmnt' function can be used])
419 if test -z "$list_mounted_fs"; then
421 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
422 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
423 [AC_TRY_CPP([#include <mnttab.h>],
424 fu_cv_sys_mounted_fread=yes,
425 fu_cv_sys_mounted_fread=no)])
426 AC_MSG_RESULT([$fu_cv_sys_mounted_fread])
427 if test $fu_cv_sys_mounted_fread = yes; then
428 list_mounted_fs=found
429 AC_DEFINE(MOUNTED_FREAD, 1,
430 [Define if it's possible to resort to fread on /etc/mnttab])
434 if test -z "$list_mounted_fs"; then
435 AC_MSG_WARN([could not determine how to read list of mounted fs])
437 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
438 [Define if the list of mounted filesystems can be determined])
441 dnl This configure.in code has been stolen from GNU fileutils-3.12. Its
442 dnl job is to detect a method to get file system information.
444 AC_MSG_NOTICE([checking how to get filesystem space usage])
447 # Here we'll compromise a little (and perform only the link test)
448 # since it seems there are no variants of the statvfs function.
449 if test $space = no; then
451 AC_CHECK_FUNCS(statvfs)
452 if test $ac_cv_func_statvfs = yes; then
454 AC_DEFINE(STAT_STATVFS, 1,
455 [Define if function `statfs' can be used])
459 if test $space = no; then
460 # DEC Alpha running OSF/1
461 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
462 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
464 #include <sys/param.h>
465 #include <sys/types.h>
466 #include <sys/mount.h>
471 exit (statfs (".", &fsd, sizeof (struct statfs)));
473 fu_cv_sys_stat_statfs3_osf1=yes,
474 fu_cv_sys_stat_statfs3_osf1=no,
475 fu_cv_sys_stat_statfs3_osf1=no)])
476 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
477 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
479 AC_DEFINE(STAT_STATFS3_OSF1, 1,
480 [Define if function `statfs' takes 3 arguments])
484 if test $space = no; then
486 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)])
487 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
489 #ifdef HAVE_SYS_PARAM_H
490 #include <sys/param.h>
492 #ifdef HAVE_SYS_MOUNT_H
493 #include <sys/mount.h>
495 #ifdef HAVE_SYS_VFS_H
502 exit (statfs (".", &fsd));
504 fu_cv_sys_stat_statfs2_bsize=yes,
505 fu_cv_sys_stat_statfs2_bsize=no,
506 fu_cv_sys_stat_statfs2_bsize=no)])
507 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize])
508 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
510 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
511 [Define if function `statfs' takes two arguments and
512 `bsize' is member of `struct statfs'])
516 if test $space = no; then
518 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
519 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
520 [AC_TRY_RUN([#include <sys/types.h>
521 #include <sys/statfs.h>
525 exit (statfs (".", &fsd, sizeof fsd, 0));
527 fu_cv_sys_stat_statfs4=yes,
528 fu_cv_sys_stat_statfs4=no,
529 fu_cv_sys_stat_statfs4=no)])
530 AC_MSG_RESULT([$fu_cv_sys_stat_statfs4])
531 if test $fu_cv_sys_stat_statfs4 = yes; then
533 AC_DEFINE(STAT_STATFS4, 1,
534 [Define if function `statfs' takes 4 arguments])
538 if test $space = no; then
540 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
541 member (4.4BSD and NetBSD)])
542 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
543 [AC_TRY_RUN([#include <sys/types.h>
544 #ifdef HAVE_SYS_PARAM_H
545 #include <sys/param.h>
547 #ifdef HAVE_SYS_MOUNT_H
548 #include <sys/mount.h>
554 exit (statfs (".", &fsd));
556 fu_cv_sys_stat_statfs2_fsize=yes,
557 fu_cv_sys_stat_statfs2_fsize=no,
558 fu_cv_sys_stat_statfs2_fsize=no)])
559 AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize])
560 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
562 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
563 [Define if function `statfs' takes two arguments and
564 `fsize' is member of `struct statfs'])
568 if test $space = no; then
570 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
571 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
573 #include <sys/types.h>
574 #ifdef HAVE_SYS_PARAM_H
575 #include <sys/param.h>
577 #ifdef HAVE_SYS_MOUNT_H
578 #include <sys/mount.h>
580 #ifdef HAVE_SYS_FS_TYPES_H
581 #include <sys/fs_types.h>
586 /* Ultrix's statfs returns 1 for success,
587 0 for not mounted, -1 for failure. */
588 exit (statfs (".", &fsd) != 1);
590 fu_cv_sys_stat_fs_data=yes,
591 fu_cv_sys_stat_fs_data=no,
592 fu_cv_sys_stat_fs_data=no)])
593 AC_MSG_RESULT([$fu_cv_sys_stat_fs_data])
594 if test $fu_cv_sys_stat_fs_data = yes; then
596 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
597 [Define if function `statfs' takes two arguments
598 and uses `struct fs_data'])
603 dnl if test $space = no; then
605 dnl AC_TRY_CPP([#include <sys/filsys.h>],
606 dnl AC_DEFINE(STAT_READ_FILSYS) space=yes)
610 dnl AC_TRY_WARNINGS(INCLUDES, FUNCTION-BODY,
611 dnl ACTION-IF-NO-WARNINGS [, ACTION-IF-WARNINGS-OR-ERROR])
612 AC_DEFUN([AC_TRY_WARNINGS],
613 [cat > conftest.$ac_ext <<EOF
614 dnl This sometimes fails to find confdefs.h, for some reason.
615 dnl [#]line __oline__ "[$]0"
616 [#]line __oline__ "configure"
617 #include "confdefs.h"
619 int main() { return 0; }
624 ac_compile_warn='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1'
625 if { if eval $ac_compile_warn; then :; else echo arning; fi; } |
626 grep arning 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
627 ifelse([$4], , :, [rm -rf conftest*
629 ifelse([$3], , , [else
637 AC_DEFUN([AC_USE_TERMCAP], [
638 AC_MSG_NOTICE([using S-Lang screen manager/termcap])
639 AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
640 AC_CHECK_LIB(termcap, tgoto, [MCLIBS="$MCLIBS -ltermcap"], , [$LIBS])
641 slang_term=" with termcap"
644 AC_DEFUN([AC_WITH_SLANG], [
645 AC_DEFINE(HAVE_SLANG, 1,
646 [Define to use S-Lang library for screen management])
648 if $slang_use_system_installed_lib
650 AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
651 [Define to use S-Lang library installed on the system])
652 MCLIBS="-lslang $MCLIBS"
653 screen_manager="SLang (system-installed library)"
654 AC_MSG_NOTICE([using system installed S-Lang library])
659 #ifdef HAVE_SLANG_SLANG_H
660 #include <slang/slang.h>
666 [LIBS="$ac_save_LIBS"],
667 [LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
669 screen_manager="SLang"
674 for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
675 /usr/local/share /usr/share
677 if test -d $dir/terminfo; then
682 if test -z "$use_terminfo"; then
688 AC_DEFUN([AC_WITH_EDIT], [
689 AC_DEFINE(USE_INTERNAL_EDIT, 1,
690 [Define to enable internal editor])
691 LIBEDIT_A="libedit.a"
695 AC_MSG_NOTICE([using internal editor])
698 AC_DEFUN([AC_EXT2_UNDEL], [
700 if test "$ext2fs_undel" = yes; then
701 AC_MSG_NOTICE([using ext2fs file recovery code])
702 vfs_flags="${vfs_flags}, undelfs"
703 undelfs_o="undelfs.o"
704 MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS"
706 AC_MSG_NOTICE([not using ext2fs file recovery code])