summaryrefslogtreecommitdiffstats
path: root/mail/courier/scripts/configure.courier
blob: d7b017c4e5c72106d177a71dc9c48fe082e702b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
#!/bin/sh
# $FreeBSD: /tmp/pcvs/ports/mail/courier/scripts/Attic/configure.courier,v 1.5 2003-02-24 02:26:51 edwin Exp $

[ -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc ] && exit

tempfile=`mktemp -t checklist`

if [ -x ${PREFIX}/pgsql/bin/postgres -a ! -x ${PREFIX}/bin/postgres ]; then
	PGSQLBASE=${PREFIX}/pgsql
	PGSQLINCLUDES=${PGSQLBASE}/include
else
	PGSQLBASE=${PREFIX}
	PGSQLINCLUDES=${PGSQLBASE}/include/pgsql
fi

if [ ":${BATCH}" = ':yes' ]; then
	[ ":${WITH_EXPECT}"	= ':yes' ] && OPTIONS="${OPTIONS} \"Expect\""
	[ ":${WITH_GNUPG}"	= ':yes' ] && OPTIONS="${OPTIONS} \"GnuPG\""
	[ ":${WITH_ASPELL}"	= ':yes' ] && OPTIONS="${OPTIONS} \"ASpell\""
	[ ":${WITH_ISPELL}"	= ':yes' ] && OPTIONS="${OPTIONS} \"ISpell\""
	[ ":${WITH_LDAP1}"	= ':yes' ] && OPTIONS="${OPTIONS} \"OpenLDAP1\""
	[ ":${WITH_LDAP2}"	= ':yes' ] && OPTIONS="${OPTIONS} \"OpenLDAP2\""
	[ ":${WITH_MYSQL}"	= ':yes' ] && OPTIONS="${OPTIONS} \"MySQL\""
	[ ":${WITH_PGSQL}"	= ':yes' ] && OPTIONS="${OPTIONS} \"PostgreSQL\""
	[ ":${WITH_VPOPMAIL}"	= ':yes' ] && OPTIONS="${OPTIONS} \"VPopMail\""
	[ ":${WITH_PROCMAIL}"	= ':yes' ] && OPTIONS="${OPTIONS} \"Procmail\""
	[ ":${WITH_SENDFAX}"	= ':yes' ] && OPTIONS="${OPTIONS} \"SendFax\""
	[ ":${WITH_IPV6}"	= ':yes' ] && OPTIONS="${OPTIONS} \"IPv6\""
	[ -n "${OPTIONS}" ] && set ${OPTIONS}
else
	if [ ":${WITH_EXPECT}" = ':yes' \
	  -o -x ${LOCALBASE}/bin/expect ]; then
		SET_EXPECT="ON"
	else
		SET_EXPECT="OFF"
	fi
	if [ ":${WITH_GNUPG}" = ':yes' \
	  -o -x ${LOCALBASE}/bin/gpg ]; then
		SET_GNUPG="ON"
	else
		SET_GNUPG="OFF"
	fi
	if [ ":${WITH_ASPELL}" = ':yes' \
	  -o -x ${LOCALBASE}/bin/aspell ]; then
		SET_ASPELL="ON"
		SET_ISPELL="OFF"
	else
		SET_ASPELL="OFF"
	fi
	if [ ":${WITH_ISPELL}" = ':yes' \
	  -o -x ${LOCALBASE}/bin/ispell \
	  -a "${SET_ASPELL}" = "OFF" ]; then
		SET_ISPELL="ON"
		SET_ASPELL="OFF"
	else
		SET_ISPELL="OFF"
	fi
	if [ ":${WITH_LDAP1}" = ':yes' \
	  -o -f ${LOCALBASE}/lib/libldap.so.1 \
	  -a -f ${LOCALBASE}/lib/liblber.so.1 ]; then
		SET_LDAP1="ON"
		SET_LDAP2="OFF"
	else
		SET_LDAP1="OFF"
	fi
	if [ ":${WITH_LDAP2}" = ':yes' \
	  -o -f ${LOCALBASE}/lib/libldap.so.2 \
	  -a -f ${LOCALBASE}/lib/liblber.so.2 ]; then
		SET_LDAP1="OFF"
		SET_LDAP2="ON"
	else
		SET_LDAP2="OFF"
	fi
	if [ ":${WITH_MYSQL}" = ':yes' \
	  -o -f ${LOCALBASE}/lib/mysql/libmysqlclient.so.10 ]; then
		SET_MYSQL="ON"
	else
		SET_MYSQL="OFF"
	fi
	if [ ":${WITH_PGSQL}" = ':yes' \
	  -o -f ${PGSQLBASE}/lib/libpq.so.2 ]; then
		SET_PGSQL="ON"
	else
		SET_PGSQL="OFF"
	fi
	if [ ":${WITH_VPOPMAIL}" = ':yes' \
	  -o -f ${LOCALBASE}/vpopmail/lib/libvpopmail.a ]; then
		SET_VPOPMAIL="ON"	# authvchkpw and authmysql
		SET_MYSQL="OFF"		# are mutually exclusive
	else
		SET_VPOPMAIL="OFF"
	fi
	if [ ":${WITH_PROCMAIL}" = ':yes' \
	  -o -x ${LOCALBASE}/bin/procmail ]; then
		SET_PROCMAIL="ON"
	else
		SET_PROCMAIL="OFF"
	fi
	if [ ":${WITH_SENDFAX}" = ':yes' \
	  -o -x ${LOCALBASE}/bin/pnmscale \
	  -a -x ${LOCALBASE}/bin/giftopnm \
	  -a -x ${LOCALBASE}/bin/jpegtopnm \
	  -a -x ${LOCALBASE}/bin/ppmtopgm \
	  -a -x ${LOCALBASE}/bin/pgmtopbm \
	  -a -x ${LOCALBASE}/bin/pbmtog3 \
	  -a -x ${LOCALBASE}/bin/g3topbm \
	  -a -x ${LOCALBASE}/bin/pngtopnm \
	  -a -x ${LOCALBASE}/bin/pnmtopng \
	  -a -x ${LOCALBASE}/bin/gs ]; then
		SET_SENDFAX="ON"
	else
		SET_SENDFAX="OFF"
	fi
	if [ ":${WITH_IPV6}" = ':yes' ]; then
		SET_IPV6="ON"
	else
		SET_IPV6="OFF"
	fi

	/usr/bin/dialog --title "Courier configuration options" --clear \
		--checklist "\n\
Please select desired options:" -1 -1 16 \
Expect		"Expect support for WebMail change passwd" ${SET_EXPECT} \
GnuPG		"GNU Privacy Guard support for WebMail" ${SET_GNUPG} \
ASpell		"ASpell support for WebMail" ${SET_ASPELL} \
ISpell		"ISpell support for WebMail" ${SET_ISPELL} \
OpenLDAP1	"OpenLDAP 1.x authentication support" ${SET_LDAP1} \
OpenLDAP2	"OpenLDAP 2.x authentication support" ${SET_LDAP2} \
MySQL		"MySQL authentication support" ${SET_MYSQL} \
PostgreSQL	"PostgreSQL authentication support" ${SET_PGSQL} \
VPopMail	"VPopMail authentication support" ${SET_VPOPMAIL} \
Procmail	"Procmail local delivery support" ${SET_PROCMAIL} \
SendFax		"mgetty+sendfax support" ${SET_SENDFAX} \
IPv6		"IPv6 support (experimental)" ${SET_IPV6} \
2> ${tempfile}

	retval=$?

	[ -s ${tempfile} ] && set `cat ${tempfile}`
	rm -f ${tempfile}

	case ${retval} in
	0)	[ -z "$*" ] && echo "Nothing selected" ;;
	1)	echo "Cancel pressed." && exit 1 ;;
	esac
fi

${MKDIR} ${WRKDIRPREFIX}${CURDIR}
exec > ${WRKDIRPREFIX}${CURDIR}/Makefile.inc

echo "PREFIX=	${PREFIX}"

WITH_ISPELL="--without-ispell"
WITH_LDAP="--without-authldap"
WITH_MYSQL="--without-authmysql"
WITH_PGSQL="--without-authpgsql"
WITH_VCHKPW="--without-authvchkpw"
WITH_IPV6="--without-ipv6"

SUB_FAX="@comment "
SUB_LDAP="@comment "
SUB_MYSQL="@comment "
SUB_PGSQL="@comment "

while [ "$1" ]; do
	case $1 in
		\"Expect\")
			echo "BUILD_DEPENDS+=	expect:\${PORTSDIR}/lang/expect"
			;;
		\"GnuPG\")
			echo "BUILD_DEPENDS+=	gpg:\${PORTSDIR}/security/gnupg"
			;;
		\"ASpell\")
			if [ "$ISPELL" ]; then
				echo "ASpell and ISpell are mutually exclusive." > /dev/stderr
				rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
				exit 1
			fi
			echo "BUILD_DEPENDS+=	aspell:\${PORTSDIR}/textproc/aspell"
			WITH_ISPELL="--with-ispell=\${LOCALBASE}/bin/aspell"
			ASPELL=1
			;;
		\"ISpell\")
			if [ "$ASPELL" ]; then
				echo "ASpell and ISpell are mutually exclusive." > /dev/stderr
				rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
				exit 1
			fi
			echo "BUILD_DEPENDS+=	ispell:\${PORTSDIR}/textproc/ispell"
			WITH_ISPELL="--with-ispell=\${LOCALBASE}/bin/ispell"
			ISPELL=1
			;;
		\"OpenLDAP1\")
			if [ "$OPENLDAP2" ]; then
				echo "OpenLDAP1 and OpenLDAP2 are mutually exclusive." > /dev/stderr
				rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
				exit 1
			fi
			echo "LIB_DEPENDS+=	ldap.1:\${PORTSDIR}/net/openldap12"
			CPPFLAGS="${CPPFLAGS} -I\${LOCALBASE}/include"
			LDFLAGS="${LDFLAGS} -L\${LOCALBASE}/lib"
			WITH_LDAP="--with-authldap"
			PKGNAMESUFFIX="${PKGNAMESUFFIX}-ldap"
			SUB_LDAP=""
			OPENLDAP1=1
			;;
		\"OpenLDAP2\")
			if [ "$OPENLDAP1" ]; then
				echo "OpenLDAP1 and OpenLDAP2 are mutually exclusive." > /dev/stderr
				rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
				exit 1
			fi
			echo "LIB_DEPENDS+=	ldap.2:\${PORTSDIR}/net/openldap2"
			CPPFLAGS="${CPPFLAGS} -I\${LOCALBASE}/include"
			LDFLAGS="${LDFLAGS} -L\${LOCALBASE}/lib"
			WITH_LDAP="--with-authldap"
			PKGNAMESUFFIX="${PKGNAMESUFFIX}-ldap"
			SUB_LDAP=""
			OPENLDAP2=1
			;;
		\"MySQL\")
			if [ -f ${LOCALBASE}/vpopmail/lib/libvpopmail.a ]; then
				echo "VPopMAil and MySQL are mutually exclusive." > /dev/stderr
				echo "Uninstall VPopMAil if you want MySQL authentication." > /dev/stderr
				rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
				exit 1
			else
				echo "LIB_DEPENDS+=	mysqlclient.10:\${PORTSDIR}/databases/mysql323-client"
				WITH_MYSQL="--with-authmysql"
				WITH_MYSQL="${WITH_MYSQL} --with-mysql-libs=\${LOCALBASE}/lib/mysql"
				WITH_MYSQL="${WITH_MYSQL} --with-mysql-includes=\${LOCALBASE}/include/mysql"
				PKGNAMESUFFIX="${PKGNAMESUFFIX}-mysql"
				SUB_MYSQL=""
			fi	
			;;
		\"PostgreSQL\")
			echo "POSTGRESQL_PORT?=	databases/postgresql7"
			echo "LIB_DEPENDS+=	pq.3:\${PORTSDIR}/\${POSTGRESQL_PORT}"
			WITH_PGSQL="--with-authpgsql"
			WITH_PGSQL="${WITH_PGSQL} --with-pgsql-libs=${PGSQLBASE}/lib"
			WITH_PGSQL="${WITH_PGSQL} --with-pgsql-includes=${PGSQLINCLUDES}"
			PKGNAMESUFFIX="${PKGNAMESUFFIX}-pgsql"
			SUB_PGSQL=""
			;;
		\"VPopMail\")
			echo "BUILD_DEPENDS+=	\${LOCALBASE}/vpopmail/lib/libvpopmail.a:\${PORTSDIR}/mail/vpopmail"
			WITH_VCHKPW="--with-authvchkpw"
			PKGNAMESUFFIX="${PKGNAMESUFFIX}-vpopmail"
			;;
		\"Procmail\")
			echo "BUILD_DEPENDS+=	procmail:\${PORTSDIR}/mail/procmail"
			;;
		\"SendFax\")
			echo "BUILD_DEPENDS+=	gs:\${PORTSDIR}/print/ghostscript-gnu"
			echo "BUILD_DEPENDS+=	pnmscale:\${PORTSDIR}/graphics/netpbm"
			echo "BUILD_DEPENDS+=	giftopnm:\${PORTSDIR}/graphics/netpbm"
			echo "BUILD_DEPENDS+=	jpegtopnm:\${PORTSDIR}/graphics/netpbm"
			echo "BUILD_DEPENDS+=	ppmtopgm:\${PORTSDIR}/graphics/netpbm"
			echo "BUILD_DEPENDS+=	pgmtopbm:\${PORTSDIR}/graphics/netpbm"
			echo "BUILD_DEPENDS+=	pbmtog3:\${PORTSDIR}/graphics/netpbm"
			echo "BUILD_DEPENDS+=	g3topbm:\${PORTSDIR}/graphics/netpbm"
			echo "BUILD_DEPENDS+=	pngtopnm:\${PORTSDIR}/graphics/netpbm"
			echo "BUILD_DEPENDS+=	pnmtopng:\${PORTSDIR}/graphics/netpbm"
			echo "RUN_DEPENDS+=	gs:\${PORTSDIR}/print/ghostscript-gnu"
			echo "RUN_DEPENDS+=	pnmscale:\${PORTSDIR}/graphics/netpbm"
			echo "RUN_DEPENDS+=	giftopnm:\${PORTSDIR}/graphics/netpbm"
			echo "RUN_DEPENDS+=	jpegtopnm:\${PORTSDIR}/graphics/netpbm"
			echo "RUN_DEPENDS+=	ppmtopgm:\${PORTSDIR}/graphics/netpbm"
			echo "RUN_DEPENDS+=	pgmtopbm:\${PORTSDIR}/graphics/netpbm"
			echo "RUN_DEPENDS+=	pbmtog3:\${PORTSDIR}/graphics/netpbm"
			echo "RUN_DEPENDS+=	g3topbm:\${PORTSDIR}/graphics/netpbm"
			echo "RUN_DEPENDS+=	pngtopnm:\${PORTSDIR}/graphics/netpbm"
			echo "RUN_DEPENDS+=	pnmtopng:\${PORTSDIR}/graphics/netpbm"
			echo "WITH_FAX=		yes"
			WITH_TRANSPORT="${WITH_TRANSPORT} fax"
			SUB_FAX=""
			;;
		\"IPv6\")
			WITH_IPV6=""
			;;
		*)
			echo "Invalid option(s): $*" > /dev/stderr
			rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
			exit 1
			;;
	esac
	shift
done

[ -n "${CPPFLAGS}" ]	&& echo "CONFIGURE_ENV+=	CPPFLAGS='${CPPFLAGS}'"
[ -n "${LDFLAGS}" ]	&& echo "CONFIGURE_ENV+=	LDFLAGS='${LDFLAGS}'"
[ -n "${LIBS}" ]	&& echo "CONFIGURE_ENV+=	LIBS='${LIBS}'"
echo "CONFIGURE_ARGS+= ${WITH_ISPELL}"
echo "CONFIGURE_ARGS+= ${WITH_LDAP}"
echo "CONFIGURE_ARGS+= ${WITH_MYSQL}"
echo "CONFIGURE_ARGS+= ${WITH_PGSQL}"
echo "CONFIGURE_ARGS+= ${WITH_VCHKPW}"
echo "CONFIGURE_ARGS+= ${WITH_IPV6}"
echo "CONFIGURE_ARGS+= --with-transport='${WITH_TRANSPORT}'"
echo "PLIST_SUB+=	SUB_FAX='${SUB_FAX}'"
echo "PLIST_SUB+=	SUB_LDAP='${SUB_LDAP}'"
echo "PLIST_SUB+=	SUB_MYSQL='${SUB_MYSQL}'"
echo "PLIST_SUB+=	SUB_PGSQL='${SUB_PGSQL}'"
[ -n "${PKGNAMESUFFIX}" ] && echo "PKGNAMESUFFIX=	${PKGNAMESUFFIX}"

exit 0
OpenPOWER on IntegriCloud