# $NetBSD: Makefile.common,v 1.4 2002/02/05 15:03:19 jlam Exp $

DISTNAME?=	courier-${DIST_VERS}
CATEGORIES+=	mail
MASTER_SITES?=	${MASTER_SITE_SOURCEFORGE:=courier/}

MAINTAINER?=	jlam@netbsd.org
HOMEPAGE?=	http://www.courier-mta.org/

# Version numbering scheme:
#
# DIST_VERS	version number on the distfile
# BASE_BERS	pkgsrc-manged version number
#
DIST_VERS=	0.37.1
BASE_VERS=	${DIST_VERS}

USE_GMAKE=		yes

PKG_SYSCONFSUBDIR?=	courier
DATADIR=		${PREFIX}/share/courier
LIBEXECDIR=		${PREFIX}/libexec/courier
AUTHLIBDIR=		${LIBEXECDIR}/authlib
DOCDIR=			${PREFIX}/share/doc/courier
EGDIR=			${PREFIX}/share/examples/courier

.include "../../mk/bsd.prefs.mk"

GNU_CONFIGURE=		yes
CONFIGURE_ARGS+=	--datadir=${DATADIR}
CONFIGURE_ARGS+=	--libexecdir=${LIBEXECDIR}
CONFIGURE_ARGS+=	--localstatedir=/var
CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}

CONFIGURE_ARGS+=	--enable-unicode
CONFIGURE_ARGS+=	--with-authchangepwdir=${LIBEXECDIR}

CONFIGURE_ARGS+=	--with-db=db
CONFIGURE_ARGS+=	--with-userdb=${PKG_SYSCONFDIR}/userdb
CONFIGURE_ARGS+=	--with-makedatprog=${LIBEXECDIR}/makedatprog
CONFIGURE_ARGS+=	--disable-root-check

# Build authdaemon, but explicitly disable certain methods (ldap, mysql, pgsql)
# that are built in separate packages.  We also disable authcustom since it's
# a template authentication method.
#
CONFIGURE_ARGS+=	--with-authdaemon
CONFIGURE_ARGS+=	--without-authcustom
CONFIGURE_ARGS+=	--without-authldap
CONFIGURE_ARGS+=	--without-authmysql
CONFIGURE_ARGS+=	--without-authpgsql

CONFIGURE_ENV+=		EXPECT="${LOCALBASE}/bin/expect"

.if ${OPSYS} == "SunOS"
.include "../../databases/db/buildlink.mk"
CPPFLAGS+=		-I${BUILDLINK_DIR}/include/db2
.endif

configure-init:
	${MKDIR} ${WRKSRC}/courier
	${TOUCH} ${TOUCH_ARGS} ${WRKSRC}/courier/courier.c