Blame SOURCES/dump-buildfix.patch

836d62
diff --git a/MCONFIG.in b/MCONFIG.in
836d62
new file mode 100644
836d62
index 0000000..f5d1012
836d62
--- /dev/null
836d62
+++ b/MCONFIG.in
836d62
@@ -0,0 +1,99 @@
836d62
+VERSION=	0.4b44
836d62
+DATE=		June 10, 2011
836d62
+
836d62
+AR=		@AR@
836d62
+CC=		@CC@
836d62
+INSTALL=	@INSTALL@
836d62
+LD=		@LD@
836d62
+LN_S=		@LN_S@
836d62
+MV=		@MV@
836d62
+RANLIB=		@RANLIB@
836d62
+RM=		@RM@
836d62
+
836d62
+BINOWNER=	@BINOWNER@
836d62
+BINGRP=		@BINGRP@
836d62
+BINMODE=	@BINMODE@
836d62
+MANOWNER=	@MANOWNER@
836d62
+MANGRP=		@MANGRP@
836d62
+MANMODE=	@MANMODE@
836d62
+
836d62
+INSTALLBIN=	$(INSTALL) -o $(BINOWNER) -g $(BINGRP) -m $(BINMODE)
836d62
+INSTALLMAN=	$(INSTALL) -o $(MANOWNER) -g $(MANGRP) -m $(MANMODE)
836d62
+
836d62
+prefix=		@prefix@
836d62
+exec_prefix=	@exec_prefix@
836d62
+SBINDIR=	@sbindir@
836d62
+MANDIR=		@mandir@/man8
836d62
+
836d62
+DUMPDATESPATH=	@DUMPDATESPATH@
836d62
+#
836d62
+# Global include directories
836d62
+#
836d62
+GINC=		-I$(top_builddir) -I$(top_srcdir)/compat/include
836d62
+# indicate where the ext2fs library can be found (this is not needed if you
836d62
+# have run `make install-libs' in the e2fsprogs source directory).
836d62
+GINC+=		@EXT2FS_CFLAGS@
836d62
+
836d62
+#
836d62
+# Global libraries
836d62
+#
836d62
+# indicate where the ext2fs library can be found (this is not needed if you
836d62
+# have run `make install-libs' in the e2fsprogs source directory).
836d62
+#GLIBDIR=	-L/usr/src/e2fsprogs-0.5c/lib
836d62
+GLIBS=		$(GLIBDIR) -L../compat/lib -lcompat @EXT2FS_LIBS@ @COM_ERR_LIBS@
836d62
+
836d62
+#
836d62
+# Definitions (don't change them unless you know what you are doing)
836d62
+#
836d62
+DEFS=		-DRDUMP -DRRESTORE -DLINUX_FORK_BUG -DHAVE_LZO -D_PATH_DUMPDATES=\"$(DUMPDATESPATH)\" -D_DUMP_VERSION=\"$(VERSION)\" @OPTDEFS@  
836d62
+
836d62
+all::
836d62
+
836d62
+#
836d62
+# Autoconf magic
836d62
+#
836d62
+
836d62
+$(top_builddir)/config.status:	$(top_srcdir)/configure
836d62
+	(cd $(top_builddir); ./config.status --recheck)
836d62
+
836d62
+$(top_builddir)/MCONFIG:	$(top_srcdir)/MCONFIG.in \
836d62
+				$(top_builddir)/config.status
836d62
+	(cd $(top_builddir); ./config.status)
836d62
+
836d62
+$(top_builddir)/config.h:	$(top_srcdir)/config.h.in \
836d62
+				$(top_builddir)/config.status
836d62
+	(cd $(top_builddir); ./config.status)
836d62
+
836d62
+Makefile:			$(srcdir)/Makefile.in $(top_builddir)/MCONFIG \
836d62
+				$(top_builddir)/config.status
836d62
+	(cd $(top_builddir); ./config.status)
836d62
+
836d62
+$(top_srcdir)/configure:	$(top_srcdir)/configure.in
836d62
+	cd $(top_srcdir) && autoconf
836d62
+
836d62
+$(top_srcdir)/config.h.in:	$(top_srcdir)/configure.in
836d62
+	cd $(top_srcdir) && autoheader
836d62
+
836d62
+#
836d62
+# Make depend magic
836d62
+#
836d62
+
836d62
+.depend:			Makefile $(SRCS) $(top_srcdir)/depfix.sed
836d62
+	if test -n "$(SRCS)" ; then \
836d62
+		$(CC) -M $(CFLAGS) $(SRCS) | \
836d62
+			sed -f $(top_srcdir)/depfix.sed \
836d62
+			    -e 's; $(srcdir)/; $$(srcdir)/;g' \
836d62
+			    -e 's; $(top_srcdir)/; $$(top_srcdir)/;g' \
836d62
+			    -e 's; $(top_builddir)/; $$(top_builddir)/;g' \
836d62
+			    -e 's; \./; ;g' \
836d62
+			    -e '/^ *\\$$/d' > .depend; \
836d62
+	else :; fi
836d62
+
836d62
+depend::			.depend
836d62
+	if test -n "$(SRCS)" ; then \
836d62
+		sed -e '/^# +++ Dependency line eater +++/,$$d' \
836d62
+			< Makefile | cat - .depend \
836d62
+			> Makefile.new; \
836d62
+		$(MV) Makefile Makefile.old; \
836d62
+		$(MV) Makefile.new Makefile; \
836d62
+	else :; fi
836d62
diff --git a/configure.in b/configure.in
836d62
new file mode 100644
836d62
index 0000000..e40e01b
836d62
--- /dev/null
836d62
+++ b/configure.in
836d62
@@ -0,0 +1,639 @@
836d62
+AC_INIT(dump/dump.h)
836d62
+AC_PREREQ(2.57)
836d62
+
836d62
+MCONFIG=./MCONFIG
836d62
+AC_SUBST_FILE(MCONFIG)
836d62
+
836d62
+AC_CONFIG_HEADER(config.h)
836d62
+
836d62
+dnl
836d62
+dnl Check for programs
836d62
+dnl
836d62
+AC_PROG_MAKE_SET
836d62
+AC_PROG_LN_S
836d62
+AC_PATH_PROG(CP, cp, cp)
836d62
+AC_PATH_PROG(MV, mv, mv)
836d62
+AC_PATH_PROG(RM, rm, rm)
836d62
+AC_CHECK_TOOL(AR, ar, ar)
836d62
+AC_CHECK_TOOL(RANLIB, ranlib, :)
836d62
+AC_CHECK_TOOL(PATCH, patch, :)
836d62
+AC_PROG_CC
836d62
+AC_PROG_INSTALL
836d62
+
836d62
+AC_CHECK_HEADERS([sys/types.h])
836d62
+
836d62
+CPPFLAGS="-D_BSD_SOURCE -D_USE_BSD_SIGNAL ${CPPFLAGS}"
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-debug
836d62
+dnl
836d62
+AC_ARG_ENABLE([debug],
836d62
+[  --enable-debug             include debugging code (default is NO)],
836d62
+if test "$enableval" = "no"
836d62
+then
836d62
+	DUMPDEBUG=""
836d62
+	RESTOREDEBUG=""
836d62
+	echo "Not including debugging code"
836d62
+else
836d62
+	DUMPDEBUG="-DFDEBUG -DTDEBUG -DWRITEDEBUG -DDIRDEBUG"
836d62
+	RESTOREDEBUG="-DDIRDEBUG"
836d62
+	echo "Including debugging code"
836d62
+fi,
836d62
+DUMPDEBUG=""
836d62
+RESTOREDEBUG=""
836d62
+echo "Not including debugging code by default"
836d62
+)
836d62
+AC_SUBST(DUMPDEBUG)
836d62
+AC_SUBST(RESTOREDEBUG)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-static
836d62
+dnl
836d62
+AC_ARG_ENABLE([static],
836d62
+[  --enable-static            link dump and restore statically (default is NO)],
836d62
+if test "$enableval" = "no"
836d62
+then
836d62
+	STATIC=""
836d62
+	echo "Linking dump and restore dynamically"
836d62
+else
836d62
+	STATIC="-static"
836d62
+	echo "Linking dump and restore statically"
836d62
+fi
836d62
+,
836d62
+STATIC=""
836d62
+echo "Linking dump and restore dynamically by default"
836d62
+)
836d62
+AC_SUBST(STATIC)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-staticz
836d62
+dnl
836d62
+AC_ARG_ENABLE([staticz],
836d62
+[  --enable-staticz           link libz and libbz2 statically (default is NO)],
836d62
+if test "$enableval" = "no"
836d62
+then
836d62
+	STATICZ="no"
836d62
+	echo "Linking libz and libbz2 dynamically"
836d62
+else
836d62
+	STATICZ="yes"
836d62
+	echo "Linking libz and libbz2 statically"
836d62
+fi
836d62
+,
836d62
+STATICZ="no"
836d62
+echo "Linking libz and libbz2 dynamically by default"
836d62
+)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-rmt
836d62
+dnl
836d62
+AC_ARG_ENABLE([rmt],
836d62
+[  --enable-rmt               compile and install rmt (default is YES)],
836d62
+if test "$enableval" = "no"
836d62
+then
836d62
+	RMTDIR=""
836d62
+	RMTMAKEFILE=""
836d62
+	echo "Not compiling rmt"
836d62
+else
836d62
+	RMTDIR="rmt"
836d62
+	RMTMAKEFILE="rmt/Makefile"
836d62
+	echo "Compiling rmt"
836d62
+fi
836d62
+,
836d62
+RMTDIR="rmt"
836d62
+RMTMAKEFILE="rmt/Makefile"
836d62
+echo "Compiling rmt by default"
836d62
+)
836d62
+AC_SUBST(RMTDIR)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-ermt
836d62
+dnl
836d62
+AC_ARG_ENABLE([ermt],
836d62
+[  --enable-ermt              compile ermt, an encrypting version of rmt (default is NO)],
836d62
+if test "$enableval" = "no"
836d62
+then
836d62
+	ERMT=""
836d62
+	echo "Not compiling ermt"
836d62
+else
836d62
+	if test "$RMTDIR" = ""
836d62
+	then
836d62
+		AC_MSG_ERROR(ermt requires --enable-rmt)
836d62
+	fi
836d62
+	ERMT="ermt"
836d62
+	echo "Compiling ermt"
836d62
+fi
836d62
+,
836d62
+ERMT=""
836d62
+echo "Not compiling ermt by default"
836d62
+)
836d62
+AC_SUBST(ERMT)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-kerberos
836d62
+dnl
836d62
+AC_ARG_ENABLE([kerberos],
836d62
+[  --enable-kerberos          compile kerberos extensions (default is NO)],
836d62
+if test "$enableval" = "yes"
836d62
+then
836d62
+	OPTDEFS="-DKERBEROS"
836d62
+	echo "Compiling kerberos extensions"
836d62
+else
836d62
+	OPTDEFS=""
836d62
+	echo "Not compiling kerberos extensions"
836d62
+fi
836d62
+,
836d62
+OPTDEFS=""
836d62
+echo "Not compiling kerberos extensions by default"
836d62
+)
836d62
+AC_SUBST(OPTDEFS)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-readline
836d62
+dnl
836d62
+AC_ARG_ENABLE([readline],
836d62
+[  --enable-readline          enable readline support in restore (default is YES)],
836d62
+if test "$enableval" = "no"
836d62
+then
836d62
+	READLINE=""
836d62
+	echo "Not including readline support"
836d62
+else
836d62
+	READLINE="yes"
836d62
+	AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
836d62
+	echo "Including readline support"
836d62
+fi
836d62
+,
836d62
+READLINE="yes"
836d62
+AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
836d62
+echo "Including readline support by default"
836d62
+)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-oldsylefscript
836d62
+dnl
836d62
+AC_ARG_ENABLE([oldstylefscript],
836d62
+[  --enable-oldstylefscript   enable old style F script (no arguments) (default is NO)],
836d62
+if test "$enableval" = "yes"
836d62
+then
836d62
+	AC_DEFINE([OLD_STYLE_FSCRIPT],1,[Define this is you want old style F script (no arguments).])
836d62
+	echo "Using old style F script"
836d62
+else
836d62
+	echo "Using new style F script"
836d62
+fi
836d62
+,
836d62
+echo "Using new style F script by default"
836d62
+)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-largefile
836d62
+dnl
836d62
+AC_ARG_ENABLE([largefile],
836d62
+[  --enable-largefile         enable Large File System support (default is YES)],
836d62
+if test "$enableval" = "yes"
836d62
+then
836d62
+	AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
836d62
+	echo "Enabling Large File System support"
836d62
+else
836d62
+	echo "Not enabling Large File System support"
836d62
+fi
836d62
+,
836d62
+AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
836d62
+echo "Enabling Large File System support by default"
836d62
+)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-qfa
836d62
+dnl
836d62
+AC_ARG_ENABLE([qfa],
836d62
+[  --enable-qfa               enable Quick File Access support (default is YES)],
836d62
+if test "$enableval" = "yes"
836d62
+then
836d62
+	AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
836d62
+	echo "Enabling Quick File Access support"
836d62
+else
836d62
+	echo "Not enabling Quick File Access support"
836d62
+fi
836d62
+,
836d62
+AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
836d62
+echo "Enabling Quick File Access support by default"
836d62
+)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-qfadebug
836d62
+dnl
836d62
+AC_ARG_ENABLE([qfadebug],
836d62
+[  --enable-qfadebug          include Quick File Access debugging code (default is NO)],
836d62
+if test "$enableval" = "yes"
836d62
+then
836d62
+	AC_DEFINE([DEBUG_QFA],1,[Define this if you want to include Quick File Access debugging code.])
836d62
+	echo "Including Quick File Access debugging code"
836d62
+else
836d62
+	echo "Not including Quick File Access debugging code"
836d62
+fi
836d62
+,
836d62
+echo "Not including Quick File Access debugging code by default"
836d62
+)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-macosx
836d62
+dnl
836d62
+AC_ARG_ENABLE([macosx],
836d62
+[  --enable-macosx            include Mac OSX restore compatibility (default is NO)],
836d62
+if test "$enableval" = "yes"
836d62
+then
836d62
+	AC_DEFINE([DUMP_MACOSX],1,[Define this if you want to include Mac OSX restore compatibility.])
836d62
+	echo "Including Mac OSX restore compatibility code"
836d62
+else
836d62
+	echo "Not including Mac OSX restore compatibility code"
836d62
+fi
836d62
+,
836d62
+echo "Not including Mac OSX restore compatibility code by default"
836d62
+)
836d62
+
836d62
+dnl
836d62
+dnl Handle --enable-transselinux
836d62
+dnl
836d62
+AC_ARG_ENABLE([transselinux],
836d62
+[  --enable-transselinux      restore can translate SELinux EAs (default is YES)],
836d62
+if test "$enableval" = "yes"
836d62
+then
836d62
+	LTRANSSELINUX="-lselinux"
836d62
+	CCTRANSSELINUX="-DTRANSSELINUX"
836d62
+	echo "restore can translate SELinux EAs"
836d62
+else
836d62
+	LTRANSSELINUX=""
836d62
+	CCTRANSSELINUX=""
836d62
+	echo "restore can not translate SELinux EAs"
836d62
+fi
836d62
+,
836d62
+LTRANSSELINUX="-lselinux"
836d62
+CCTRANSSELINUX="-DTRANSSELINUX"
836d62
+echo "restore can translate SELinux EAs by default"
836d62
+)
836d62
+AC_SUBST(LTRANSSELINUX)
836d62
+AC_SUBST(CCTRANSSELINUX)
836d62
+
836d62
+
836d62
+dnl
836d62
+dnl set $(CC) from --with-cc=value
836d62
+dnl
836d62
+AC_ARG_WITH([cc],
836d62
+[  --with-cc=COMPILER         select compiler to use],
836d62
+AC_MSG_RESULT(CC=$withval)
836d62
+CC=$withval,
836d62
+if test -z "$CC" ; then CC=cc; fi
836d62
+[AC_MSG_RESULT(CC defaults to $CC)])dnl
836d62
+export CC
836d62
+AC_SUBST([CC])
836d62
+
836d62
+dnl
836d62
+dnl set $(LD) from --with-linker=value
836d62
+dnl
836d62
+AC_ARG_WITH([linker],
836d62
+[  --with-linker=LINKER       select linker to use],
836d62
+AC_MSG_RESULT(LD=$withval)
836d62
+LD=$withval,
836d62
+if test -z "$LD" ; then LD=$CC; fi
836d62
+[AC_MSG_RESULT(LD defaults to $LD)])dnl
836d62
+export LD
836d62
+AC_SUBST([LD])
836d62
+
836d62
+dnl
836d62
+dnl set $(CCOPTS) from --with-ccopts=value
836d62
+dnl
836d62
+AC_ARG_WITH([ccopts],
836d62
+[  --with-ccopts=CCOPTS       select compiler command line options],
836d62
+AC_MSG_RESULT(CCOPTS is $withval)
836d62
+CCOPTS=$withval
836d62
+CFLAGS="$CFLAGS $withval",
836d62
+CCOPTS=)dnl
836d62
+AC_SUBST(CCOPTS)
836d62
+
836d62
+dnl
836d62
+dnl set $(LDFLAGS) from --with-ldopts=value
836d62
+dnl
836d62
+AC_ARG_WITH([ldopts],
836d62
+[  --with-ldopts=LDOPTS       select linker command line options],
836d62
+AC_MSG_RESULT(LDFLAGS is $withval)
836d62
+LDOPTS=$withval
836d62
+LDFLAGS="$LDFLAGS $withval",
836d62
+LDOPTS=)dnl
836d62
+AC_SUBST(LDOPTS)
836d62
+
836d62
+dnl
836d62
+dnl set $(BINOWNER) from --with-binowner
836d62
+dnl
836d62
+AC_ARG_WITH([binowner],
836d62
+[  --with-binowner=USER       select owner for binaries],
836d62
+AC_MSG_RESULT(BINOWNER is $withval)
836d62
+BINOWNER=$withval,
836d62
+BINOWNER=root
836d62
+echo "BINOWNER defaults to $BINOWNER"
836d62
+)dnl
836d62
+AC_SUBST(BINOWNER)
836d62
+
836d62
+dnl
836d62
+dnl set $(BINGRP) from --with-bingrp
836d62
+dnl
836d62
+AC_ARG_WITH([bingrp],
836d62
+[  --with-bingrp=GROUP        select group for binaries],
836d62
+AC_MSG_RESULT(BINGRP is $withval)
836d62
+BINGRP=$withval,
836d62
+BINGRP=tty
836d62
+echo "BINGRP defaults to $BINGRP"
836d62
+)dnl
836d62
+AC_SUBST(BINGRP)
836d62
+
836d62
+dnl
836d62
+dnl set $(BINMODE) from --with-binmode
836d62
+dnl
836d62
+AC_ARG_WITH([binmode],
836d62
+[  --with-binmode=MODE        select mode for binaries],
836d62
+AC_MSG_RESULT(BINMODE is $withval)
836d62
+BINMODE=$withval,
836d62
+BINMODE=0755
836d62
+echo "BINMODE defaults to $BINMODE"
836d62
+)dnl
836d62
+AC_SUBST(BINMODE)
836d62
+
836d62
+dnl
836d62
+dnl set $(MANOWNER) from --with-manowner
836d62
+dnl
836d62
+AC_ARG_WITH([manowner],
836d62
+[  --with-manowner=USER       select owner for manual pages],
836d62
+AC_MSG_RESULT(MANOWNER is $withval)
836d62
+MANOWNER=$withval,
836d62
+MANOWNER=man
836d62
+echo "MANOWNER defaults to $MANOWNER"
836d62
+)dnl
836d62
+AC_SUBST(MANOWNER)
836d62
+
836d62
+dnl
836d62
+dnl set $(MANGRP) from --with-mangrp
836d62
+dnl
836d62
+AC_ARG_WITH([mangrp],
836d62
+[  --with-mangrp=GROUP        select group for manual pages],
836d62
+AC_MSG_RESULT(MANGRP is $withval)
836d62
+MANGRP=$withval,
836d62
+MANGRP=tty
836d62
+echo "MANGRP defaults to $MANGRP"
836d62
+)dnl
836d62
+AC_SUBST(MANGRP)
836d62
+
836d62
+dnl
836d62
+dnl set $(MANMODE) from --with-manmode
836d62
+dnl
836d62
+AC_ARG_WITH([manmode],
836d62
+[  --with-manmode=MODE        select mode for manual pages],
836d62
+AC_MSG_RESULT(MANMODE is $withval)
836d62
+MANMODE=$withval,
836d62
+MANMODE=0644
836d62
+echo "MANMODE defaults to $MANMODE"
836d62
+)dnl
836d62
+AC_SUBST(MANMODE)
836d62
+
836d62
+dnl
836d62
+dnl set $(DUMPDATESPATH) from --with-dumpdatespath
836d62
+dnl
836d62
+AC_ARG_WITH([dumpdatespath],
836d62
+[  --with-dumpdatespath=PATH  select path for dumpdates file],
836d62
+AC_MSG_RESULT(DUMPDATESPATH is $withval)
836d62
+DUMPDATESPATH=$withval,
836d62
+DUMPDATESPATH="${sysconfdir}/dumpdates"
836d62
+echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
836d62
+)dnl
836d62
+AC_SUBST(DUMPDATESPATH)
836d62
+
836d62
+dnl
836d62
+dnl Check for Ext2fs headers and libraries
836d62
+dnl
836d62
+AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
836d62
+PKG_CHECK_MODULES(EXT2FS, [ext2fs])
836d62
+if test -n "$STATIC" ; then
836d62
+	EXT2FS_LIBS=`$PKG_CONFIG --libs --static ext2fs`
836d62
+fi
836d62
+if test "$ext2fs_h" = no -o "x$EXT2FS_LIBS" = "x"; then
836d62
+	AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
836d62
+fi
836d62
+
836d62
+PKG_CHECK_MODULES(COM_ERR, [com_err])
836d62
+if test -n "$STATIC" ; then
836d62
+	COM_ERR_LIBS=`$PKG_CONFIG --libs --static com_err`
836d62
+fi
836d62
+
836d62
+dnl
836d62
+dnl Check for ext2fs_read_inode_full
836d62
+dnl
836d62
+AC_CHECK_LIB(ext2fs, ext2fs_read_inode_full, [rif=yes], [rif=no], [-lcom_err])
836d62
+if test "$rif" = yes; then
836d62
+	AC_DEFINE([HAVE_EXT2FS_READ_INODE_FULL],1,[Define this if your ext2fs libs have the ext2fs_read_inode_full function.])
836d62
+fi
836d62
+
836d62
+dnl
836d62
+dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
836d62
+dnl
836d62
+AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
836d62
+
836d62
+dnl
836d62
+dnl Check for ext2_ino_t type
836d62
+dnl
836d62
+AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
836d62
+AC_TRY_COMPILE([#include <stdio.h>
836d62
+#ifdef HAVE_EXT2FS_EXT2_FS_H
836d62
+#include <ext2fs/ext2_fs.h>
836d62
+#else
836d62
+#include <linux/ext2_fs.h>
836d62
+#endif
836d62
+#include <ext2fs/ext2fs.h>],
836d62
+[ext2_ino_t ino = 0;], 
836d62
+[AC_DEFINE([HAVE_EXT2_INO_T],1,[Define if we have the ext2_ino_t type (from e2fsprogs 1.20+).])
836d62
+ AC_MSG_RESULT(yes)],
836d62
+AC_MSG_RESULT(no))
836d62
+
836d62
+dnl
836d62
+dnl Check for s_journal_inum field in ext2_super_block struct
836d62
+dnl
836d62
+AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
836d62
+AC_TRY_COMPILE([#include <stdio.h>
836d62
+#ifdef HAVE_EXT2FS_EXT2_FS_H
836d62
+#include <ext2fs/ext2_fs.h>
836d62
+#else
836d62
+#include <linux/ext2_fs.h>
836d62
+#endif
836d62
+#include <ext2fs/ext2fs.h>],
836d62
+[struct ext2_super_block es; es.s_journal_inum = 0;],
836d62
+[AC_DEFINE([HAVE_EXT2_JOURNAL_INUM],1,[Define if we have the s_journal_inum field in struct ext2_super_block.])
836d62
+ AC_MSG_RESULT(yes)],
836d62
+AC_MSG_RESULT(no))
836d62
+
836d62
+dnl
836d62
+dnl Check for blkid headers libraries
836d62
+dnl
836d62
+AC_CHECK_HEADER(blkid/blkid.h, [blkid_h=yes], [blkid_h=no], [-])
836d62
+PKG_CHECK_EXISTS([blkid],
836d62
+	[
836d62
+	if test -n $STATIC ; then
836d62
+		BLKID=`$PKG_CONFIG --libs --static blkid`
836d62
+	else
836d62
+		BLKID=`$PKG_CONFIG --libs blkid`
836d62
+	fi
836d62
+	if test "$blkid_h" = yes ; then
836d62
+		AC_DEFINE([HAVE_BLKID],1,[Define this if you have the blkid library.])
836d62
+	fi
836d62
+	],[BLKID=""])
836d62
+AC_SUBST(BLKID)
836d62
+
836d62
+dnl
836d62
+dnl Check for ncurses or termcap libraries
836d62
+dnl
836d62
+AC_CHECK_LIB(ncurses, tgetent, [ncurses_lib=yes], [ncurses_lib=no])
836d62
+AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
836d62
+AC_CHECK_LIB(tinfo, tgetent, [tinfo_lib=yes], [tinfo_lib=no])
836d62
+
836d62
+if test "$ncurses_lib" = no -a "$termcap_lib" = no -a "$tinfo_lib" = no; then
836d62
+	if test "$READLINE" = "yes"; then
836d62
+		AC_MSG_ERROR(You need to install the ncurses or termcap library or configure without --enable-readline)
836d62
+	fi
836d62
+fi
836d62
+if test "$tinfo_lib" = yes; then
836d62
+	rdllib="-ltinfo"
836d62
+elif test "$ncurses_lib" = yes; then
836d62
+	rdllib="-lncurses"
836d62
+elif test "$termcap_lib" = yes; then
836d62
+	rdllib="-ltermcap"
836d62
+fi
836d62
+
836d62
+dnl
836d62
+dnl Check for readline headers and libraries
836d62
+dnl
836d62
+AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
836d62
+AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], $rdllib)
836d62
+if test "$readline_h" = no -o "$readline_lib" = no; then
836d62
+	if test "$READLINE" = "yes"; then
836d62
+		AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
836d62
+	fi
836d62
+fi
836d62
+if test "$READLINE" = yes; then
836d62
+	READLINE="-lreadline $rdllib"
836d62
+fi
836d62
+AC_SUBST(READLINE)
836d62
+
836d62
+dnl
836d62
+dnl Check for rl_completion_matches
836d62
+dnl
836d62
+AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
836d62
+if test "$rlcm" = yes; then
836d62
+	AC_DEFINE([HAVE_READLINE_RLCM],1,[Define this if your readline libs have the rl_completion_matches library.])
836d62
+fi
836d62
+
836d62
+dnl
836d62
+dnl Check for rl_completion_append_character
836d62
+dnl
836d62
+AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
836d62
+if test "$rcac" = yes; then
836d62
+	AC_DEFINE([HAVE_READLINE_CAC],1,[Define this if your readline libs have the rl_completion_append_character variable.])
836d62
+fi
836d62
+
836d62
+dnl
836d62
+dnl Check for zlib headers and libraries
836d62
+dnl
836d62
+AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
836d62
+AC_CHECK_LIB(z, zlibVersion, [zlib_lib=yes], [zlib_lib=no])
836d62
+if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
836d62
+	if test "$STATICZ" = yes; then
836d62
+		ZLIB="-Wl,-Bstatic -lz -Wl,-Bdynamic"
836d62
+	else
836d62
+		ZLIB="-lz"
836d62
+	fi
836d62
+	AC_DEFINE([HAVE_ZLIB],1,[Define this if you have zlib compression library.])
836d62
+else
836d62
+	ZLIB=""
836d62
+fi
836d62
+AC_SUBST(ZLIB)
836d62
+
836d62
+dnl
836d62
+dnl Check for bzlib headers and libraries
836d62
+dnl
836d62
+AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
836d62
+AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
836d62
+if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
836d62
+	if test "$STATICZ" = yes; then
836d62
+		BZLIB="-Wl,-Bstatic -lbz2 -Wl,-Bdynamic"
836d62
+	else
836d62
+		BZLIB="-lbz2"
836d62
+	fi
836d62
+	AC_DEFINE([HAVE_BZLIB],1,[Define this if you have bzlib compression library.])
836d62
+else
836d62
+	BZLIB=""
836d62
+fi
836d62
+AC_SUBST(BZLIB)
836d62
+
836d62
+dnl
836d62
+dnl Check for library functions
836d62
+dnl
836d62
+AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
836d62
+AC_CHECK_FUNC(glob)
836d62
+
836d62
+dnl
836d62
+dnl Check for GLOB_ALTDIRFUNC
836d62
+dnl
836d62
+AC_MSG_CHECKING(for extended glob routines)
836d62
+if test "$ac_cv_func_glob" = "yes"; then
836d62
+	AC_EGREP_CPP(yes, 
836d62
+	[
836d62
+#	include <glob.h>
836d62
+#	ifdef GLOB_ALTDIRFUNC
836d62
+	yes
836d62
+#	endif
836d62
+	], 
836d62
+	[
836d62
+	AC_DEFINE([HAVE_GLOB],1,[Define if you have the glob function.])
836d62
+	AC_MSG_RESULT(yes)
836d62
+	],
836d62
+	[
836d62
+	AC_MSG_RESULT(no)
836d62
+	echo "Your system does not support extended glob, will use the internal routines"
836d62
+	])
836d62
+fi
836d62
+
836d62
+dnl
836d62
+dnl Check for OpenSSL, for ermt
836d62
+dnl
836d62
+if test "$ERMT" != ""; then
836d62
+	AC_CHECK_HEADER(openssl/evp.h, [evp_h=yes], [evp_h=no])
836d62
+	AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_set_padding, [crypto_lib=yes], [crypto_lib=no])
836d62
+	PKG_CHECK_EXISTS([libcrypto],
836d62
+		[
836d62
+		if test -n $STATIC ; then
836d62
+			CRYPTO=`$PKG_CONFIG --libs --static libcrypto`
836d62
+		else
836d62
+			CRYPTO=`$PKG_CONFIG --libs libcrypto`
836d62
+		fi
836d62
+		],[CRYPTO=""])
836d62
+	if test "$evp_h" = no -o "x$CRYPTO" = "x"; then
836d62
+		AC_MSG_ERROR(You need to install the OpenSSL library (version 0.9.7a or later), or configure without --enable-ermt)
836d62
+	fi
836d62
+fi
836d62
+AC_SUBST(CRYPTO)
836d62
+
836d62
+dnl
836d62
+dnl Check for types
836d62
+dnl
836d62
+AC_CHECK_TYPE(quad_t, int64_t)
836d62
+AC_CHECK_TYPE(u_quad_t, uint64_t)
836d62
+
836d62
+dnl
836d62
+dnl Compute top_buildir
836d62
+dnl
836d62
+top_builddir=`cd .; pwd`
836d62
+AC_SUBST(top_builddir)
836d62
+
836d62
+dnl
836d62
+dnl Create directories
836d62
+dnl
836d62
+test -d compat || mkdir compat
836d62
+test -d compat/lib || mkdir compat/lib
836d62
+
836d62
+dnl
836d62
+dnl Output files
836d62
+dnl
836d62
+AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)