dnl Process this file with autoconf to produce a configure script.
AC_INIT(main.c)
AC_CONFIG_HEADER(config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_SUBST(SHELL)
AC_SYS_LARGEFILE

# Thanks to Martin Pool
if test x"$GCC" = xyes 
then
    CFLAGS="-g -Wall -O3"
    AC_MSG_NOTICE([Setting gcc options: $CFLAGS])
fi

AC_CHECK_HEADERS(fcntl.h sys/time.h sys/unistd.h unistd.h)
AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/ioctl.h)
AC_CHECK_HEADERS(string.h stdlib.h sys/types.h)

AC_TYPE_OFF_T
AC_TYPE_SIZE_T

AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(short)

AC_CACHE_CHECK([for large file support],rzip_cv_HAVE_LARGE_FILES,[
AC_TRY_RUN([
#include <stdio.h>
#include <sys/types.h>
main() { return (sizeof(off_t) == 4); }],
rzip_cv_HAVE_LARGE_FILES=yes,
rzip_cv_HAVE_LARGE_FILES=no,
rzip_cv_HAVE_LARGE_FILES=cross)])
if test x"$rzip_cv_HAVE_LARGE_FILES" = x"yes"; then
    AC_DEFINE(HAVE_LARGE_FILES, 1, [ ])
fi


AC_C_INLINE


AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, , 
        AC_MSG_ERROR([Could not find bz2 library - please install libbz2-devel]))

echo $ac_n "checking for errno in errno.h... $ac_c"
AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
echo yes; AC_DEFINE(HAVE_ERRNO_DECL),
echo no)

AC_CHECK_FUNCS(mmap strerror)
AC_CHECK_FUNCS(getopt_long)

AC_OUTPUT(Makefile)
