mc-vfs-undelfs.m4 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 ENABLE_VFS_UNDELFS for cpp.
  5. dnl Will set EXT2FS_UNDEL_LIBS to required libraries.
  6. AC_DEFUN([MC_UNDELFS_CHECKS], [
  7. ext2fs_undel=no
  8. EXT2FS_UNDEL_LIBS=
  9. AC_CHECK_HEADERS([ext2fs/ext2_fs.h linux/ext2_fs.h], [ext2_fs_h=yes; break])
  10. if test x"$ext2_fs_h" = xyes; then
  11. AC_CHECK_HEADERS([ext2fs/ext2fs.h], [ext2fs_ext2fs_h=yes], ,
  12. [
  13. #include <stdio.h>
  14. #ifdef HAVE_EXT2FS_EXT2_FS_H
  15. #include <ext2fs/ext2_fs.h>
  16. #else
  17. #undef umode_t
  18. #include <linux/ext2_fs.h>
  19. #endif
  20. ])
  21. if test x"$ext2fs_ext2fs_h" = xyes; then
  22. ext2fs_undel=yes
  23. EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
  24. AC_CHECK_TYPE([ext2_ino_t], ,
  25. [AC_DEFINE_UNQUOTED([ext2_ino_t], [ino_t],
  26. [Define to ino_t if undefined.])],
  27. [
  28. #include <errno.h>
  29. #include <stdio.h>
  30. #include <fcntl.h>
  31. #include <stdlib.h>
  32. #ifdef HAVE_EXT2FS_EXT2_FS_H
  33. #include <ext2fs/ext2_fs.h>
  34. #else
  35. #undef umode_t
  36. #include <linux/ext2_fs.h>
  37. #endif
  38. #include <ext2fs/ext2fs.h>
  39. ])
  40. fi
  41. fi
  42. ])
  43. dnl
  44. dnl Ext2fs undelete support
  45. dnl
  46. AC_DEFUN([AC_MC_VFS_UNDELFS],
  47. [
  48. AC_ARG_ENABLE([vfs-undelfs],
  49. AS_HELP_STRING([--enable-vfs-undelfs], [Support for ext2 undelete filesystem @<:@no@:>@]),
  50. [
  51. if test "x$enableval" = "xno"; then
  52. enable_vfs_undelfs=no
  53. else
  54. enable_vfs_undelfs=yes
  55. fi
  56. ],
  57. [enable_vfs_undelfs="no"])
  58. if test x"$enable_vfs" = x"yes" -a x"$enable_vfs_undelfs" != x"no"; then
  59. MC_UNDELFS_CHECKS
  60. if test x"$ext2fs_undel" = x"yes"; then
  61. enable_vfs_undelfs="yes"
  62. AC_MC_VFS_ADDNAME([undelfs])
  63. AC_DEFINE(ENABLE_VFS_UNDELFS, [1], [Support for ext2 undelfs])
  64. AC_MSG_NOTICE([using ext2fs file recovery code])
  65. MCLIBS="$MCLIBS $EXT2FS_UNDEL_LIBS"
  66. else
  67. AC_ERROR([Ext2 libraries not found])
  68. fi
  69. fi
  70. AM_CONDITIONAL(ENABLE_VFS_UNDELFS, [test "$enable_vfs" = "yes" -a x"$enable_vfs_undelfs" = x"yes"])
  71. ])