Merge branch '1981_AM_PROG_CC_C_O'
[midnight-commander.git] / m4.include / vfs / mc-vfs-undelfs.m4
blob0cb78fbc2b71ce341b5a2fdb3167115ba3955e8f
1 dnl MC_UNDELFS_CHECKS
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], [
8   ext2fs_undel=no
9   EXT2FS_UNDEL_LIBS=
10   AC_CHECK_HEADERS([ext2fs/ext2_fs.h linux/ext2_fs.h], [ext2_fs_h=yes; break])
11   if test x"$ext2_fs_h" = xyes; then
12     AC_CHECK_HEADERS([ext2fs/ext2fs.h], [ext2fs_ext2fs_h=yes], ,
13                      [
14 #include <stdio.h>
15 #ifdef HAVE_EXT2FS_EXT2_FS_H
16 #include <ext2fs/ext2_fs.h>
17 #else
18 #undef umode_t
19 #include <linux/ext2_fs.h>
20 #endif
21                      ])
22     if test x"$ext2fs_ext2fs_h" = xyes; then
23       AC_DEFINE(USE_EXT2FSLIB, 1,
24                 [Define to enable undelete support on ext2])
25       ext2fs_undel=yes
26       EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
27       AC_CHECK_TYPE(ext2_ino_t, ,
28                     [AC_DEFINE(ext2_ino_t, ino_t,
29                                [Define to ino_t if undefined.])],
30                     [
31 #include <errno.h>
32 #include <stdio.h>
33 #include <fcntl.h>
34 #include <stdlib.h>
35 #ifdef HAVE_EXT2FS_EXT2_FS_H
36 #include <ext2fs/ext2_fs.h>
37 #else
38 #undef umode_t
39 #include <linux/ext2_fs.h>
40 #endif
41 #include <ext2fs/ext2fs.h>
42                     ])
43     fi
44   fi
47 dnl
48 dnl Ext2fs undelete support
49 dnl
50 AC_DEFUN([AC_MC_VFS_UNDELFS],
52     AC_ARG_ENABLE([undelfs],
53                   [  --enable-vfs-undelfs    Support for ext2 undelete filesystem])
55     if test x"$enable_vfs_undelfs" = x"yes" ; then
57         MC_UNDELFS_CHECKS
59         if test x"$ext2fs_undel" = xyes; then
60             enable_vfs_undelfs="yes"
61             AC_MC_VFS_ADDNAME([undelfs])
62             AC_DEFINE(ENABLE_VFS_UNDELFS, [1], [Support for ext2 undelfs])
63             AC_MSG_NOTICE([using ext2fs file recovery code])
64             MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS"
65         else
66             AC_ERROR([Ext2 libraries not found])
67         fi
68     fi
69     AM_CONDITIONAL(ENABLE_VFS_UNDELFS, [test x"$enable_vfs_undelfs" = x"yes"])