+AC_SUBST(ZLIBS)
+
+dnl
+dnl Check if we have AFS on this system
+dnl
+AFS_CFLAGS=""
+AFS_LIBS=""
+support_afs=auto
+AC_ARG_ENABLE(afs,
+ AC_HELP_STRING([--disable-afs], [disable afs support @<:@default=auto@:>@]),
+ [
+ if test x$enableval = xyes; then
+ support_afs=yes
+ elif test x$enableval = xno; then
+ support_afs=no
+ fi
+ ]
+)
+
+have_afs=no
+if test x$support_afs = xyes -o x$support_afs = xauto; then
+ AC_ARG_WITH(afsdir,
+ AC_HELP_STRING([--with-afsdir@<:@=DIR@:>@], [Directory holding AFS includes/libs]),
+ with_afsdir=$withval
+ )
+
+ dnl
+ dnl Search in standard places, or --with-afsdir not specified
+ dnl
+ if test x$with_afsdir = x; then
+ for root in /usr /usr/local; do
+ if test -d ${root}/include/afs/ ; then
+ with_afsdir=${root}
+ break
+ fi
+ if test -d ${root}/include/openafs/afs/ ; then
+ with_afsdir=${root}
+ break
+ fi
+ done
+ fi
+
+ if test -d ${with_afsdir}/include/afs/ ; then
+ AFS_CFLAGS="-I${with_afsdir}/include"
+ else
+ if test -d ${with_afsdir}/include/openafs/afs/ ; then
+ AFS_CFLAGS="-I${with_afsdir}/include/openafs"
+ fi
+ fi
+
+ saved_CFLAGS="${CFLAGS}"
+ saved_CPPFLAGS="${CPPFLAGS}"
+ CFLAGS="${AFS_CFLAGS} ${saved_CFLAGS}"
+ CPPFLAGS="${AFS_CFLAGS} ${saved_CPPFLAGS}"
+
+ AC_CHECK_HEADERS(afs/afsint.h)
+ AC_TRY_CPP(
+ [
+ #include <afs/afsint.h>
+ #include <afs/venus.h>
+ ],
+ AC_DEFINE(HAVE_AFS_VENUS_H,1,[Define to 1 if you have the <afs/venus.h> header file.])
+ )
+
+ CFLAGS="${saved_CFLAGS}"
+ CPPFLAGS="${saved_CPPFLAGS}"
+
+ dnl
+ dnl See if we can find a libsys with the pioctl symbol in there
+ dnl
+ AC_MSG_CHECKING(for pioctl in AFS libsys)
+ for dir in ${with_afsdir}/lib \
+ ${with_afsdir}/lib/afs \
+ ${with_afsdir}/lib/openafs \
+ ${with_afsdir}/lib64 \
+ ${with_afsdir}/lib64/afs \
+ ${with_afsdir}/lib64/openafs
+ do
+ for arch_type in .a .so
+ do
+ A=`test -f ${dir}/libsys${arch_type} && nm ${dir}/libsys${arch_type} 2>/dev/null | grep pioctl`
+ pkg=$?
+ if test $pkg = 0; then
+ have_afs=yes
+ AFS_LIBS="-L${dir} -lsys -lrx -llwp ${dir}/util${arch_type}"
+ break
+ fi
+ done
+ done
+
+ if test $have_afs = yes; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ if test x$support_afs = xyes -a $have_afs != yes; then
+ AC_MSG_ERROR([afs support explicitly enabled but no supported afs implementation found,
+ please either load the afs libraries or rerun configure without --enable-afs])
+ else
+ if test $have_afs = yes; then
+ AC_DEFINE(HAVE_AFS,1,[Define to 1 if your system has AFS support])
+ AC_DEFINE(HAVE_AFS_ACL,1,[Andrew FileSystem ACL support])
+ fi
+ fi
+fi
+AC_SUBST(AFS_CFLAGS)
+AC_SUBST(AFS_LIBS)
+
+dnl ---------------------------------------------------
+dnl Check for lzo support/directory (default on)
+dnl ---------------------------------------------------
+dnl this allows you to turn it completely off
+
+AC_ARG_ENABLE(lzo,
+ AC_HELP_STRING([--disable-lzo], [disable lzo support @<:@default=yes@:>@]),
+ [
+ if test x$enableval = xno; then
+ support_lzo=no
+ fi
+ ]
+)
+
+LZO_INC=
+LZO_LIBS=
+LZO_LDFLAGS=
+
+have_lzo="no"
+if test x$support_lzo = xyes; then
+ AC_ARG_WITH(lzo,
+ AC_HELP_STRING([--with-lzo@<:@=DIR@:>@], [specify lzo library directory]),
+ [
+ case "$with_lzo" in
+ no)
+ :
+ ;;
+ yes|*)
+ if test -f ${with_lzo}/include/lzo/lzoconf.h; then
+ LZO_INC="-I${with_lzo}/include"
+ LZO_LDFLAGS="-L${with_lzo}/lib"
+ with_lzo="${with_lzo}/include"
+ else
+ with_lzo="/usr/include"
+ fi
+
+ AC_CHECK_HEADER(${with_lzo}/lzo/lzoconf.h,
+ [
+ AC_DEFINE(HAVE_LZO, 1, [Define to 1 if you have LZO compression])
+ LZO_LIBS="${LZO_LDFLAGS} -llzo2"
+ have_lzo="yes"
+ ], [
+ echo " "
+ echo "lzoconf.h not found. lzo turned off ..."
+ echo " "
+ ]
+ )
+ ;;
+ esac
+ ],[
+ AC_CHECK_HEADER(lzo/lzoconf.h,
+ [
+ AC_CHECK_HEADER(lzo/lzo1x.h,
+ [
+ AC_CHECK_LIB(lzo2, lzo1x_1_compress,
+ [
+ LZO_LIBS="-llzo2"
+ AC_DEFINE(HAVE_LZO,1,[Define to 1 if you have LZO compression])
+ have_lzo=yes
+ ])
+ ])
+ ])
+ ])
+fi
+
+AC_SUBST(LZO_INC)
+AC_SUBST(LZO_LIBS)
+