dnl Process this file with autoconf to produce a configure script.
AC_INIT(ssmtp.c)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h strings.h syslog.h unistd.h)


AC_CACHE_CHECK([for obsolete openlog],ssmtp_cv_obsolete_openlog,
	[ AC_TRY_COMPILE([#include <syslog.h> ] , [ openlog("xx",1); ] , 
	ssmtp_cv_obsolete_openlog=yes, ssmtp_cv_obsolete_openlog=no)]
)


dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_STRUCT_TM

dnl Checks for libraries.
AC_SEARCH_LIBS(gethostname, nsl)
AC_SEARCH_LIBS(socket, socket)

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gethostname socket strdup strstr)

dnl Check for optional features
AC_ARG_ENABLE(logfile, 
[  --enable-logfile        additional logging over and above syslog])
if test x$enableval = xyes ; then
	AC_DEFINE(LOGFILE)
fi
enableval=""

AC_ARG_ENABLE(rewrite-domain,
[  --disable-rewrite-domain
                          support for rewriting the sending domain])
if test x$enableval != xno ; then
	AC_DEFINE(REWRITE_DOMAIN)
fi
enableval=""

AC_ARG_ENABLE(ssl,
[  --enable-ssl           support for secure connection to mail server])
if test x$enableval = xyes ; then
	AC_DEFINE(HAVE_SSL)
	LIBS="$LIBS -lgnutls-openssl"
fi
enableval=""

AC_ARG_ENABLE(inet6,
[  --enable-inet6         support for IPv6 transport])
if test x$enableval = xyes ; then
	AC_DEFINE(INET6)
fi
enableval=""

AC_ARG_ENABLE(md5auth,
[  --enable-md5auth         support for MD5 authentication])
if test x$enableval = xyes ; then
	AC_DEFINE(MD5AUTH)
	SRCS="$SRCS md5auth/md5c.c md5auth/hmac_md5.c"
fi
enableval=""
AC_SUBST(SRCS)

AC_OUTPUT(Makefile)
