AC_PREREQ(2.50)
AC_INIT(talloc, 2.0.2)
AC_CONFIG_SRCDIR([talloc.c])
AC_SUBST(datarootdir)
AC_CONFIG_HEADER(config.h)

TALLOC_VERSION=${PACKAGE_VERSION}
TALLOC_VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d '.' -f1`
TALLOC_VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d '.' -f2`
TALLOC_VERSION_RELEASE=`echo ${PACKAGE_VERSION} | cut -d '.' -f3`

AC_SUBST(TALLOC_VERSION)
AC_SUBST(TALLOC_VERSION_MAJOR)
AC_SUBST(TALLOC_VERSION_MINOR)
AC_SUBST(TALLOC_VERSION_RELEASE)

AC_DEFINE_UNQUOTED(TALLOC_BUILD_VERSION_MAJOR,
	[${TALLOC_VERSION_MAJOR}],
	[talloc major version])
AC_DEFINE_UNQUOTED(TALLOC_BUILD_VERSION_MINOR,
	[${TALLOC_VERSION_MINOR}],
	[talloc minor version])
AC_DEFINE_UNQUOTED(TALLOC_BUILD_VERSION_RELEASE,
	[${TALLOC_VERSION_RELEASE}],
	[talloc release version])

AC_LIBREPLACE_ALL_CHECKS

AC_LD_PICFLAG
AC_LD_SHLIBEXT
AC_LD_SONAMEFLAG
AC_LD_VERSIONSCRIPT
AC_LIBREPLACE_SHLD
AC_LIBREPLACE_SHLD_FLAGS

m4_include(libtalloc.m4)
m4_include(compat/talloc_compat1.m4)

AC_PATH_PROG(XSLTPROC,xsltproc)
DOC_TARGET=""
if test -n "$XSLTPROC"; then
	DOC_TARGET=doc
fi
AC_SUBST(DOC_TARGET)

m4_include(build_macros.m4)
BUILD_WITH_SHARED_BUILD_DIR

AC_OUTPUT(Makefile talloc.pc)