summaryrefslogtreecommitdiffstats
path: root/security/cyrus-sasl/scripts/configure.sasl
blob: b4db08de7d598a33ddaf684cb7a011e56cc16f0d (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
#!/bin/sh
# $FreeBSD$

if [ -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc ]; then
	exit
fi

tempfile=`mktemp -t checklist`

if [ "${BATCH}" ]; then
	if [ "${WITH_DB3}" ]; then
		OPTIONS="\"DB3\""
	else
		OPTIONS="\"NDBM\""
	fi
	if [ "${WITH_JAVA}" ]; then
		OPTIONS="${OPTIONS} \"JAVA\""
	fi
	if [ "${WITH_MYSQL}" ]; then
		OPTIONS="${OPTIONS} \"MySQL\""
	fi
	if [ "${WITH_LDAP2}" ]; then
		OPTIONS="${OPTIONS} \"OpenLDAP2\""
	elif [ "${WITH_LDAP1}" ]; then
		OPTIONS="${OPTIONS} \"OpenLDAP1\""
	fi
	if [ "${OPTIONS}" != "x" ]; then
		set ${OPTIONS}
	fi
else
	if [ "${WITH_DB3}" -o -f ${PREFIX}/lib/libdb3.so ] ; then
		SET_DB3="ON"
		SET_NDBM="OFF"
	else
		SET_DB3="OFF"
		SET_NDBM="ON"
	fi
	if [ "${WITH_JAVA}" ] ; then
		SET_JAVA="ON"
	else
		SET_JAVA="OFF"
	fi
	if [ "${WITH_MYSQL}" -o -f ${PREFIX}/lib/mysql/libmysqlclient.so ] ; then
		SET_MYSQL="ON"
	else
		SET_MYSQL="OFF"
	fi

	#Perfer LDAP2 over LDAP1
	SET_LDAP1="OFF"
	SET_LDAP2="OFF"
	if [ "${WITH_LDAP2}" -o -f ${PREFIX}/lib/libldap.so.2 -a -f ${PREFIX}/lib/liblber.so.2 ] ; then
		SET_LDAP2="ON"
	elif [ "${WITH_LDAP1}" -o -f ${PREFIX}/lib/libldap.so.1 -a -f ${PREFIX}/lib/liblber.so.1 ]; then
		SET_LDAP1="ON"
	fi

	/usr/bin/dialog --title "Additional SASL options" --clear \
		--checklist "\n\
Please select desired options:" -1 -1 16 \
NDBM		"ndbm DB package" ${SET_NDBM} \
DB3		"Berkeley DB package, revision 3" ${SET_DB3} \
MySQL		"MySQL password Authentication" ${SET_MYSQL} \
OpenLDAP1	"OpenLDAP 1.x support" ${SET_LDAP1} \
OpenLDAP2	"OpenLDAP 2.x support" ${SET_LDAP2} \
2> $tempfile

	retval=$?

	if [ -s $tempfile ]; then
		set `cat $tempfile`
	fi
	rm -f $tempfile

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

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

echo "PREFIX=	${PREFIX}"

while [ "$1" ]; do
	case $1 in
		\"NDBM\")
			if [ "${DBLIB}" ]; then
				echo "ndbm and db3 are mutually exclusive." > /dev/stderr
				rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
				exit 1
			fi
			echo "CONFIGURE_ARGS+=	--with-dblib=ndbm"
			echo "SASLDB_NAME=	sasldb.db"
			DBLIB=1
			;;
		\"DB3\")
			if [ "${DBLIB}" ]; then
				echo "ndbm and db3 are mutually exclusive." > /dev/stderr
				rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
				exit 1
			fi
			echo "LIB_DEPENDS+=	db3.2:\${PORTSDIR}/databases/db3"
			echo "CONFIGURE_ARGS+=	--with-dblib=berkeley"
			echo "SASLDB_NAME=	sasldb"
			DBLIB=1
			;;
		\"JAVA\")
			echo "JAVA is disabled, Ignoring option" > /dev/stderr
			;;
		\"DISABLED\")
			echo "RUN_DEPENDS=	\${LOCALBASE}/\${JAVADIR}/bin/java:\${PORTSDIR}/java/jdk"
			echo "CONFIGURE_ARGS+=	--with-java \\"
			echo "			--with-javabase=\${LOCALBASE}/include"
			echo "CONFIGURE_ENV+=	JAVAC=\"\${LOCALBASE}/\${JAVADIR}/bin/javac\" \\"
			echo "			JAVAH=\"\${LOCALBASE}/\${JAVADIR}/bin/javah" \\"
			echo "			JAVADOC=\"\${LOCALBASE}/\${JAVADIR}/bin/javadoc\"
			;;
		\"MySQL\")
			echo "LIB_DEPENDS+=	mysqlclient.10:\${PORTSDIR}/databases/mysql323-client"
			echo "CONFIGURE_ARGS+=	--with-mysql=\${PREFIX}"
			MSG=1
			;;
		\"OpenLDAP1\")
			if [ "$OPENLDAP2" ]; then
				echo "OpenLDAP1 and OpenLDAP2 are mutually exclusive." > /dev/stderr
				rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
				exit 1
			fi
			echo "LIB_DEPENDS+=	ldap.1:\${PORTSDIR}/net/openldap"
			echo "LIB_DEPENDS+=	lber.1:\${PORTSDIR}/net/openldap"
			echo "CONFIGURE_ARGS+=	--with-ldap=\${PREFIX}"
			OPENLDAP1=1
			MSG=1
			;;
		\"OpenLDAP2\")
			if [ "$OPENLDAP1" ]; then
				echo "OpenLDAP1 and OpenLDAP2 are mutually exclusive." > /dev/stderr
				rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
				exit 1
			fi
			echo "LIB_DEPENDS+=	ldap.2:\${PORTSDIR}/net/openldap2"
			echo "LIB_DEPENDS+=	lber.2:\${PORTSDIR}/net/openldap2"
			echo "CONFIGURE_ARGS+=	--with-ldap=\${PREFIX}"
			OPENLDAP2=1
			MSG=1
			;;
		*)
			echo "Invalid option(s): $*" > /dev/stderr
			rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
			exit 1
			;;
	esac
	shift
done

if [ "x${MSG}" != "x" ]; then
	echo "LDAP_MYSQL_MSG=	\"See sysadmin.html in the Cyrus-SASL docs directory for informaion on using LDAP or MySQL for authentication.\""
fi
OpenPOWER on IntegriCloud