aboutsummaryrefslogtreecommitdiffstats
path: root/security/cyrus-sasl2/scripts/configure.sasl
blob: 8a1a6ab78a157c859b0bd90187e42c8dbf4db9da (plain) (blame)
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
#!/bin/sh
# $FreeBSD$

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

tempfile=`mktemp -t checklist`

if [ "${BATCH}" ]; then
    if [ "${WITH_DB41}" ]; then
        OPTIONS="\"DB41\""
    elif [ "${WITH_DB4}" ]; then
        OPTIONS="\"DB4\""
    elif [ "${WITH_DB3}" ]; then
        OPTIONS="\"DB3\""
    else
        OPTIONS="\"NDBM\""
    fi
    if [ "${WITH_MYSQL}" ]; then
        OPTIONS="${OPTIONS} \"MySQL\""
    fi
    if [ "${WITH_LDAP21}" ]; then
        OPTIONS="${OPTIONS} \"OpenLDAP21\""
    elif [ "${WITH_LDAP}" ]; then
        OPTIONS="${OPTIONS} \"OpenLDAP\""
    fi
    if [ "${OPTIONS}" != "x" ]; then
        OPTIONS="${OPTIONS} \"SASLAUTHD\""
        set ${OPTIONS}
    fi
else
    if [ "${WITH_DB41}" -o -f ${PREFIX}/lib/libdb41.so ] ; then
        SET_DB41="ON"
        SET_DB4="OFF"
        SET_DB3="OFF"
        SET_NDBM="OFF"
    elif [ "${WITH_DB4}" -o -f ${PREFIX}/lib/libdb4.so ] ; then
        SET_DB41="OFF"
        SET_DB4="ON"
        SET_DB3="OFF"
        SET_NDBM="OFF"
    elif [ "${WITH_DB3}" -o -f ${PREFIX}/lib/libdb3.so ] ; then
        SET_DB41="OFF"
        SET_DB4="OFF"
        SET_DB3="ON"
        SET_NDBM="OFF"
    else
        SET_DB41="OFF"
        SET_DB4="OFF"
        SET_DB3="OFF"
        SET_NDBM="ON"
    fi
    if [ "${WITH_MYSQL}" -o -f ${PREFIX}/lib/mysql/libmysqlclient.so ] ; then
        SET_MYSQL="ON"
    else
        SET_MYSQL="OFF"
    fi
    if [ "${WITH_LDAP21}" -o -f ${PREFIX}/lib/libldap.so.2 -a -f ${PREFIX}/lib/liblber.so.2 \
        -a -f ${PREFIX}/bin/ldapwhoami ] ; then
        SET_LDAP21="ON"
        SET_LDAP="OFF"
    elif [ "${WITH_LDAP}" -o -f ${PREFIX}/lib/libldap.so.2 -a -f ${PREFIX}/lib/liblber.so.2 ] ; then
        SET_LDAP21="OFF"
        SET_LDAP="ON"
    else
        SET_LDAP21="OFF"
        SET_LDAP="OFF"
    fi

    /usr/bin/dialog --title "Additional SASL options" --clear \
        --checklist "\n\
Please select desired options:" -1 -1 16 \
NDBM        "ndbm DB" ${SET_NDBM} \
DB3     "Berkeley DB, revision 3" ${SET_DB3} \
DB4     "Berkeley DB, revision 4" ${SET_DB4} \
DB41        "Berkeley DB, revision 4.1" ${SET_DB41} \
MySQL       "MySQL password Authentication" ${SET_MYSQL} \
OpenLDAP    "OpenLDAP 2.0 password Authentication w/TLS" ${SET_LDAP} \
OpenLDAP21  "OpenLDAP 2.1 password Authentication w/TLS" ${SET_LDAP21} \
SASLAUTHD       "Use saslauthd for password Authentication" ON \
2> $tempfile

    retval=$?

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

    case $retval in
        0)  if [ -z "$*" ]; then
                echo "Nothing selected"
                OPTIONS="\"NDBM\""
                set ${OPTIONS}
            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, db3, db4 and db41 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "CONFIGURE_ARGS+=  --with-dblib=ndbm"
            echo "SASLDB_NAME=  sasldb2.db"
            DBLIB=1
            ;;
        \"DB41\")
            if [ "${DBLIB}" ]; then
                echo "ndbm, db3, db4 and db41 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "LIB_DEPENDS+= db41.1:\${PORTSDIR}/databases/db41"
            echo "CONFIGURE_ARGS+=  --with-dblib=berkeley --with-bdb-incdir=${PREFIX}/include/db41  --with-bdb-libdir=${PREFIX}/lib"
            echo "SASLDB_NAME=  sasldb2"
            DBLIB=1
            ;;
        \"DB4\")
            if [ "${DBLIB}" ]; then
                echo "ndbm, db3, db4 and db41 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "LIB_DEPENDS+= db4.0:\${PORTSDIR}/databases/db4"
            echo "CONFIGURE_ARGS+=  --with-dblib=berkeley --with-bdb-incdir=${PREFIX}/include/db4  --with-bdb-libdir=${PREFIX}/lib"
            echo "SASLDB_NAME=  sasldb2"
            DBLIB=1
            ;;
        \"DB3\")
            if [ "${DBLIB}" ]; then
                echo "ndbm, db3, db4 and db41 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "LIB_DEPENDS+= db3.3:\${PORTSDIR}/databases/db3"
            echo "CONFIGURE_ARGS+=  --with-dblib=berkeley --with-bdb-incdir=${PREFIX}/include/db3  --with-bdb-libdir=${PREFIX}/lib"
            echo "SASLDB_NAME=  sasldb2"
            DBLIB=1
            ;;
        \"MySQL\")
            echo "LIB_DEPENDS+= mysqlclient.10:\${PORTSDIR}/databases/mysql323-client"
            echo "CONFIGURE_ARGS+=  --with-mysql=\${PREFIX}"
            echo "PLIST_SUB+=   MYSQL=\"\""
            DEFMYSQL=1
            ;;
        \"OpenLDAP21\")
            if [ "${OPENLDAP}" ]; then
                echo "OpenLDAP 2.0 and 2.1 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "LIB_DEPENDS+= ldap.2:\${PORTSDIR}/net/openldap21"
            echo "LIB_DEPENDS+= lber.2:\${PORTSDIR}/net/openldap21"
            echo "CONFIGURE_ARGS+=  --with-ldap=\${PREFIX}"
            OPENLDAP=1
            ;;
        \"OpenLDAP\")
            if [ "${OPENLDAP}" ]; then
                echo "OpenLDAP 2.0 and 2.1 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "LIB_DEPENDS+= ldap.2:\${PORTSDIR}/net/openldap20"
            echo "LIB_DEPENDS+= lber.2:\${PORTSDIR}/net/openldap20"
            echo "CONFIGURE_ARGS+=  --with-ldap=\${PREFIX}"
            OPENLDAP=1
            ;;
        \"SASLAUTHD\")
            echo "PWCHECK_SUB+= -e \"s;%%PWCHECK%%;saslauthd;g\""
            PWCHECK=1
            ;;
        *)
            echo "Invalid option(s): $*" > /dev/stderr
            rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
            exit 1
            ;;
    esac
    shift
done

if [ "$PWCHECK" ]; then
    echo "PWCHECK_SUB+= -e \"s;%%ENABLEPWCHECK%%;yes;g\""
    echo "PWCHECK_METHOD=   saslauthd"
else
    echo "PWCHECK_SUB+= -e \"s;%%PWCHECK%%;saslauthd;g\" \\"
    echo "          -e \"s;%%ENABLEPWCHECK%%;no;g\""
    echo "PWCHECK_METHOD=   auxprop"
fi
if [ ! "${DBLIB}" ]; then
    echo "CONFIGURE_ARGS+=  --with-dblib=ndbm"
    echo "SASLDB_NAME=  sasldb2.db"
fi
if [ ! "${DEFMYSQL}" ]; then
    echo "PLIST_SUB+=   MYSQL=\"@comment \""
fi