AC_ARG_WITH(expat, AS_HELP_STRING([--without-libexpat],[Do not use libexpat for ESI. Default: auto-detect]))
if test "$with_expat" != "no" ; then
AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
+ AC_CHECK_HEADERS([expat.h])
AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
if test "$with_expat" = "yes" && test "$HAVE_LIBEXPAT" != "1" ; then
AC_MSG_ERROR([Required library libexpat is not able to be found.])
AC_ARG_WITH(xml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
if test "$with_xml2" != "no" ; then
AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
+ AC_CHECK_HEADERS([libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h])
AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
if test "$with_xml2" = "yes" && test "$HAVE_LIBXML2" != "1" ; then
AC_MSG_ERROR([Required library libxml2 is not able to be found.])
#ifndef SQUID_ESIEXPATPARSER_H
#define SQUID_ESIEXPATPARSER_H
-#if USE_SQUID_ESI
+#include "config.h"
+
+#if USE_SQUID_ESI && HAVE_LIBEXPAT
#include "esi/Parser.h"
+
+#if HAVE_EXPAT_H
#include <expat.h>
+#endif
class ESIExpatParser : public ESIParser
{
#ifndef SQUID_ESILIBXML2PARSER_H
#define SQUID_ESILIBXML2PARSER_H
-#if USE_SQUID_ESI
+#include "config.h"
+
+#if USE_SQUID_ESI && HAVE_LIBXML2
#include "esi/Parser.h"
// workaround for definition of "free" that prevents include of
#define OLD_FREE free
#undef free
#endif
+#if HAVE_LIBXML_PARSER_H
#include <libxml/parser.h>
+#endif
+#if HAVE_LIBXML_HTMLPARSER_H
#include <libxml/HTMLparser.h>
+#endif
+#if HAVE_LIBXML_HTMLTREE_H
#include <libxml/HTMLtree.h>
+#endif
#ifdef OLD_FREE
#define free OLD_FREE