+ AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
+fi
+
+dnl
+dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
+dnl
+AC_CHECK_HEADERS(ext2fs/ext2_fs.h)
+
+dnl
+dnl Check for ext2_ino_t type
+dnl
+AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
+AC_TRY_COMPILE([#include <stdio.h>
+#ifdef HAVE_EXT2FS_EXT2_FS_H
+#include <ext2fs/ext2_fs.h>
+#else
+#include <linux/ext2_fs.h>
+#endif
+#include <ext2fs/ext2fs.h>],
+[ext2_ino_t ino = 0;],
+[AC_DEFINE(HAVE_EXT2_INO_T) AC_MSG_RESULT(yes)],
+AC_MSG_RESULT(no))
+
+dnl
+dnl Check for s_journal_inum field in ext2_super_block struct
+dnl
+AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
+AC_TRY_COMPILE([#include <stdio.h>
+#ifdef HAVE_EXT2FS_EXT2_FS_H
+#include <ext2fs/ext2_fs.h>
+#else
+#include <linux/ext2_fs.h>
+#endif
+#include <ext2fs/ext2fs.h>],
+[struct ext2_super_block es; es.s_journal_inum = 0;],
+[AC_DEFINE(HAVE_EXT2_JOURNAL_INUM) AC_MSG_RESULT(yes)],
+AC_MSG_RESULT(no))
+
+dnl
+dnl Check for termcap libraries
+dnl
+AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
+if test "$termcap_lib" = no; then
+ if test "$READLINE" = "-lreadline -ltermcap"; then
+ AC_MSG_ERROR(You need to install the GNU termcap libraries first)
+ fi
+fi
+
+dnl
+dnl Check for readline headers and libraries
+dnl
+AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no])
+AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], "-ltermcap")
+if test "$readline_h" = no -o "$readline_lib" = no; then
+ if test "$READLINE" = "-lreadline -ltermcap"; then
+ AC_MSG_ERROR(You need to install the GNU readline libraries first)
+ fi