#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(libnfsidmap, 0.23, nfsv4-wg@citi.umich.edu)
AC_CONFIG_SRCDIR([nfsidmap.h])
AM_INIT_AUTOMAKE
AM_PROG_LIBTOOL

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

AC_ARG_ENABLE([ldap],
	[AC_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:@default=detect@:>@])])
if test "x$enable_ldap" != "xno" ; then
	AC_CHECK_HEADER([ldap.h],
		[AC_CHECK_LIB([ldap], [ldap_initialize],
		              [have_ldap="yes"],[have_ldap="no"])],
		[have_ldap="no"])
	if test "x$have_ldap" = "xyes" ; then
		AC_DEFINE([ENABLE_LDAP], 1, [Enable LDAP Support])
	elif test "x$enable_ldap$have_ldap" = "xyesno" ; then
		AC_MSG_ERROR(LDAP support not found!)
	fi
fi
AM_CONDITIONAL(ENABLE_LDAP, test "x$have_ldap" = "xyes")

# Should we build gums mapping library?
AC_ARG_ENABLE([gums],
	[AC_HELP_STRING([--enable-gums],[Enable support for the GUMS mapping library @<:@default=false@:>@])])
if test "x$enable_gums" = "xyes" ; then
	AC_DEFINE([ENABLE_GUMS], 1, [Enable GUMS mapping library support])
fi
AM_CONDITIONAL(ENABLE_GUMS, test "x$enable_gums" = "xyes")


# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h unistd.h errno.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_TYPE_SIZE_T

# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([strchr strdup])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT(libnfsidmap.pc)
