dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.2)
AC_INIT(entities.h)
AM_CONFIG_HEADER(config.h)

LIBXML_MAJOR_VERSION=1
LIBXML_MINOR_VERSION=3
LIBXML_MICRO_VERSION=0
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION

AC_SUBST(LIBXML_MAJOR_VERSION)
AC_SUBST(LIBXML_MINOR_VERSION)
AC_SUBST(LIBXML_MICRO_VERSION)
AC_SUBST(LIBXML_VERSION)
AC_SUBST(LIBXML_VERSION_INFO)

VERSION=$LIBXML_VERSION

AM_INIT_AUTOMAKE(libxml, $VERSION)

AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_CPP
AC_PATH_PROG(RM, rm, /bin/rm)
AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(TAR, tar, /bin/tar)

AM_PROG_LIBTOOL

AM_MAINTAINER_MODE

dnl Checks for libraries.
Z_LIBS= 
AC_CHECK_LIB(z, inflate,
  AC_CHECK_HEADER(zlib.h,
    Z_LIBS="-lz";  AC_DEFINE(HAVE_LIBZ)))

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h ctype.h dirent.h errno.h malloc.h)
AC_CHECK_HEADERS(stdarg.h sys/stat.h sys/types.h time.h zlib.h)

dnl Specific dir for HTML output ?
if test "x$with_html_dir" = "x" ; then
  HTML_DIR='${datadir}/gtk-doc/html'
else
  HTML_DIR=$with_html_dir
fi

AC_SUBST(HTML_DIR)

XML_LIBDIR='-L${libdir}'
XML_INCLUDEDIR='-I${includedir}/gnome-xml'
XML_LIBS="-lxml $Z_LIBS"

AC_SUBST(XML_LIBDIR)
AC_SUBST(XML_LIBS)
AC_SUBST(XML_INCLUDEDIR)
AC_SUBST(HTML_DIR)

AC_ARG_ENABLE(corba,    [  --enable-corba           Add Corba support (default)])

dnl
dnl Corba is enabled by default
dnl
if test "$enable_corba" = "no" ; then
   CORBA_CFLAGS="-DWITHOUT_CORBA"
fi
AC_SUBST(CORBA_CFLAGS)

dnl Checks for library functions.
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(strdup strndup strerror snprintf )
AC_SUBST(Z_LIBS)
AC_OUTPUT(libxml.spec Makefile doc/Makefile example/Makefile xml-config)

